1425 lines
65 KiB
JavaScript
1425 lines
65 KiB
JavaScript
var lengthMenu = 0;
|
|
var loadFunctionAbsent = true;
|
|
var loadFunctionCut = true;
|
|
var loadFunctionLunchBreak = true;
|
|
var loadFunctionUndefined = true;
|
|
var loadFunctionOverlappingLeaves = true;
|
|
|
|
loadMenuAnime();
|
|
$(document).ready(function () {
|
|
CountWorkFlowOfAbsentAndCut();
|
|
loadWorkFlowsAbsentsList();
|
|
//LoadWorkFlowsCutList();
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
//loadUndefinedRollCallsList();
|
|
//loadOverlappingLeavesList();
|
|
|
|
$("#clickAbsentTab").click(function () {
|
|
$('.cutWorkFlowLists, .lunchBreakWorkFlowLists, .undefinedWorkFlowLists, .overlappingLeavesLists').fadeOut(200, function () {
|
|
$('.absentWorkFlowLists').fadeIn(200);
|
|
});
|
|
if (loadFunctionAbsent) {
|
|
loadWorkFlowsAbsentsList();
|
|
}
|
|
});
|
|
|
|
$("#clickCutTab").click(function () {
|
|
$('.absentWorkFlowLists, .lunchBreakWorkFlowLists, .undefinedWorkFlowLists, .overlappingLeavesLists').fadeOut(200, function () {
|
|
$('.cutWorkFlowLists').fadeIn(200);
|
|
});
|
|
if (loadFunctionCut) {
|
|
LoadWorkFlowsCutList();
|
|
}
|
|
});
|
|
|
|
$("#clickLunchBreakTab").click(function () {
|
|
$('.absentWorkFlowLists, .cutWorkFlowLists, .undefinedWorkFlowLists, .overlappingLeavesLists').fadeOut(200, function () {
|
|
$('.lunchBreakWorkFlowLists').fadeIn(200);
|
|
});
|
|
if (loadFunctionLunchBreak) {
|
|
loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
}
|
|
});
|
|
|
|
$("#clickUndefinedTab").click(function () {
|
|
$('.absentWorkFlowLists, .cutWorkFlowLists, .lunchBreakWorkFlowLists, .overlappingLeavesLists').fadeOut(200, function () {
|
|
$('.undefinedWorkFlowLists').fadeIn(200);
|
|
});
|
|
if (loadFunctionUndefined) {
|
|
loadUndefinedRollCallsList();
|
|
}
|
|
});
|
|
|
|
//$("#clickOverlappingLeavesTab").click(function () {
|
|
// $('.absentWorkFlowLists, .cutWorkFlowLists, .lunchBreakWorkFlowLists, .undefinedWorkFlowLists').fadeOut(200, function () {
|
|
// $('.overlappingLeavesLists').fadeIn(200);
|
|
// });
|
|
// if (loadFunctionOverlappingLeaves) {
|
|
// loadOverlappingLeavesList();
|
|
// }
|
|
//});
|
|
});
|
|
|
|
function loadMenuAnime() {
|
|
var tabsNewAnim = $('#navbar-animmenu');
|
|
var selectorNewAnim = $('#navbar-animmenu').find('li').length;
|
|
var activeItemNewAnim = tabsNewAnim.find('.active');
|
|
var activeHeightNewAnimHeight = activeItemNewAnim.innerHeight();
|
|
var itemPosNewAnimTop = activeItemNewAnim.position();
|
|
$(".verti-selector").css({
|
|
"top": itemPosNewAnimTop.top + "px",
|
|
"height": activeHeightNewAnimHeight + "px"
|
|
});
|
|
|
|
$('.active').each(function () {
|
|
var targetForm = $(this).data('target');
|
|
$('#' + targetForm).show();
|
|
});
|
|
|
|
if (lengthMenu === 1) {
|
|
if ($('.main-navbar li').hasClass('lastRole')) {
|
|
$('.verti-selector .top').addClass('last-role');
|
|
$('#hideCircle').css('border-radius', '25px 0 0 0');
|
|
} else {
|
|
$('.verti-selector .top').removeClass('last-role');
|
|
$('#hideCircle').css('border-radius', '0 0 0 0');
|
|
}
|
|
}
|
|
|
|
$("#navbar-animmenu").on("click", "li", function (e) {
|
|
if ($(this).hasClass('lastRole')) {
|
|
//$('.verti-selector .top').addClass('last-role');
|
|
$('#hideCircle').css('border-radius', '25px 0 0 0');
|
|
} else {
|
|
//$('.verti-selector .top').removeClass('last-role');
|
|
$('#hideCircle').css('border-radius', '0 0 0 0');
|
|
}
|
|
|
|
$('#navbar-animmenu ul li').removeClass("active");
|
|
$(this).addClass('active');
|
|
|
|
var activeHeightNewAnimHeight = $(this).innerHeight();
|
|
var itemPosNewAnimTop = $(this).position();
|
|
$(".verti-selector").css({
|
|
"top": itemPosNewAnimTop.top + "px",
|
|
"height": activeHeightNewAnimHeight + "px"
|
|
});
|
|
|
|
$('.form-section').hide();
|
|
$('.accountListHead').text($(this).find('a').text());
|
|
var targetForm = $(this).data('target');
|
|
$('#' + targetForm).show();
|
|
});
|
|
|
|
//$("#navbar-animmenu").on("click", "li", function (e) {
|
|
// var targetForm = $(this).data('target');
|
|
// $('#navbar-animmenu ul li').removeClass("active");
|
|
// $(this).addClass('active');
|
|
|
|
// var activeHeightNewAnimHeight = $(this).innerHeight();
|
|
// var itemPosNewAnimTop = $(this).position();
|
|
|
|
// $(".verti-selector").stop(true, true).animate({
|
|
// "top": itemPosNewAnimTop.top + "px",
|
|
// "height": activeHeightNewAnimHeight + "px"
|
|
// }, 300); // انیمیشن با مدت زمان 300 میلیثانیه
|
|
|
|
// $('.form-section').fadeOut(200);
|
|
// $('#' + targetForm).fadeIn(300); // انیمیشن تغییر صفحه
|
|
//});
|
|
}
|
|
|
|
$(document).on('click', ".openActionMain", function () {
|
|
$('.toggle').not($(this).find('.toggle')).removeClass('open');
|
|
|
|
$(this).next().find(".operations-btns-main").slideToggle(500);
|
|
$(".operations-btns-main").not($(this).next().find(".operations-btns-main")).slideUp(500);
|
|
|
|
$(this).find('.toggle').toggleClass('open');
|
|
});
|
|
|
|
$(document).on('click', ".openAction", function () {
|
|
if (window.matchMedia('(max-width: 768px)').matches) {
|
|
$(this).next().find(".operations-btns").slideToggle(500);
|
|
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
|
|
}
|
|
});
|
|
|
|
function loadWorkFlowsAbsentsList() {
|
|
$('#loadingSkeletonAbsent').show();
|
|
var mainIndexNum = 1;
|
|
|
|
var html = ``;
|
|
$.ajax({
|
|
//async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadWorkFlowsAbsentsListUrl,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
//beforeSend: function () {
|
|
// this.startTime = new Date().getTime();
|
|
//},
|
|
success: function (response) {
|
|
var data = response.data;
|
|
$('#loadingSkeletonAbsent').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function(item) {
|
|
html += `
|
|
<div id="absentMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsAbsents('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNum++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.dayOfWeekFa}</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-start">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.dateTimeFa}</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count">${item.rollCallWorkFlowPerDayCount}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
html += `<div class="w-100 operation-div">
|
|
<div id="absent_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
$('#loadRollCallAbsentWorkFlow').html(html);
|
|
$('#loadRollCallAbsentWorkFlowMobile').html(html);
|
|
loadFunctionAbsent = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
//complete: function () {
|
|
// const endTime = new Date().getTime();
|
|
// const timeTaken = endTime - this.startTime;
|
|
// console.log(`loadWorkFlowsAbsentsList AJAX request completed in ${timeTaken} ms`);
|
|
//}
|
|
});
|
|
}
|
|
|
|
function loadEmployeeListByWorkFlowsAbsents(date) {
|
|
var html = ``;
|
|
$.ajax({
|
|
async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeeListByWorkFlowsAbsentsUrl,
|
|
data: { 'date': date },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
console.log(data);
|
|
if (response.success) {
|
|
if (data.rollCallWorkFlowPerDayViewModels.length > 0) {
|
|
|
|
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-absent-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${rollCallItem.employeeName}
|
|
<p class="m-0 mt-2 d-block d-md-none"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex ms-1"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button type="button" class="btn-workflow-leave" onclick="showModalLeave(${rollCallItem.employeeId}, '${data.dateTimeFa}', '${rollCallItem.employeeName}')">
|
|
<span class="mx-1">مرخصی</span>
|
|
</button>
|
|
|
|
<button type="button" class="btn-workflow-absent" onclick="confirmAbsentAlert(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
|
<span class="mx-1 text-nowrap">عدم حضور</span>
|
|
</button>
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCall(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
|
<span class="mx-1">ویرایش</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
var dateTimeFaId = data.dateTimeFa.replaceAll("/", "");
|
|
$(`.dateTimeFa_${dateTimeFaId}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function LoadWorkFlowsCutList() {
|
|
$('#loadingSkeletonCut').show();
|
|
var mainIndexNumCutBySystem = 1;
|
|
|
|
var htmlCutList = ``;
|
|
$.ajax({
|
|
//async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadWorkFlowsCutListUrl,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
$('#loadingSkeletonCut').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function (item) {
|
|
htmlCutList += `
|
|
<div id="cutMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsCut('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNumCutBySystem++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.dayOfWeekFa} </span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.dateTimeFa}</span>
|
|
</div>
|
|
</div><div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count">${item.rollCallWorkFlowPerDayCount}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
htmlCutList += `<div class="w-100 operation-div">
|
|
<div id="cut_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_cut_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
} else {
|
|
htmlCutList += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
|
|
}
|
|
$('#loadRollCallCutWorkFlow').html(htmlCutList);
|
|
$('#loadRollCallCutWorkFlowMobile').html(htmlCutList);
|
|
loadFunctionCut = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadEmployeeListByWorkFlowsCut(date) {
|
|
var html = ``;
|
|
$.ajax({
|
|
async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeeListByWorkFlowsCutUrl,
|
|
data: { 'date': date },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
|
|
if (response.success) {
|
|
if (data.rollCallWorkFlowPerDayViewModels.length > 0) {
|
|
|
|
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-cut-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${rollCallItem.employeeName}
|
|
<div class="m-0 mt-2 d-block d-md-none">
|
|
<div class="d-flex d-md-none flex-column justify-content-start text-start gap-2">`;
|
|
rollCallItem.timesList.forEach(function (timeItem) {
|
|
html += `<div>${timeItem.startTimeAndEndTimeAsMessage}</div>`;
|
|
});
|
|
html += `</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex ms-1">
|
|
<div class="d-flex flex-column justify-content-start text-start gap-2">`;
|
|
rollCallItem.timesList.forEach(function (timeItem) {
|
|
html += `<div>${timeItem.startTimeAndEndTimeAsMessage}</div>`;
|
|
});
|
|
html += `</div></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button type="button" class="btn-workflow-accept" onclick="confirmCutAlert(${rollCallItem.rollCallId}, ${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
|
<span class="mx-1">تایید</span>
|
|
</button>
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCallAction(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
|
<span class="mx-1">ویرایش</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
var dateTimeFaId = data.dateTimeFa.replaceAll("/", "");
|
|
$(`.dateTimeFa_cut_${dateTimeFaId}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function loadWorkFlowEmployeesWithoutLunchBreakList() {
|
|
var mainIndexNumLunchBreak = 1;
|
|
$('#loadingSkeletonLunchBreak').show();
|
|
|
|
var htmlLunchBreakList = ``;
|
|
$.ajax({
|
|
//async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadWorkFlowEmployeesWithoutLunchBreak,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
$('#loadingSkeletonLunchBreak').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function (item) {
|
|
htmlLunchBreakList += `
|
|
<div id="breakMain_${item.dateFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak('${item.dateGr}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNumLunchBreak++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.dayOfWeekFa} </span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.dateFa}</span>
|
|
</div>
|
|
</div><div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count">${item.count}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
htmlLunchBreakList += `<div class="w-100 operation-div">
|
|
<div id="breack_${item.dateFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_without_lunch_break_${item.dateFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
} else {
|
|
htmlLunchBreakList += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
|
|
}
|
|
$('#loadRollCallLunchBreakWorkFlow').html(htmlLunchBreakList);
|
|
$('#loadRollCallLunchBreakWorkFlowMobile').html(htmlLunchBreakList);
|
|
loadFunctionLunchBreak = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak(date) {
|
|
|
|
var html = ``;
|
|
$.ajax({
|
|
async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreakUrl,
|
|
data: { 'date': date },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
if (response.success) {
|
|
if (data.rollCallConfirmedWithoutLunchList.length > 0) {
|
|
|
|
data.rollCallConfirmedWithoutLunchList.forEach(function (rollCallItem, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-break-employee-date="${rollCallItem.employeeId + `-` + data.dateFa.replaceAll("/", "")}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${rollCallItem.employeeName}
|
|
<p class="m-0 mt-2 d-block d-md-none"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex ms-1"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button type="button" class="btn-workflow-accept" onclick="confirmWithoutLunchBreakAlert(${rollCallItem.rollCallId}, ${rollCallItem.employeeId}, '${data.dateFa.replaceAll("/", "")}')">
|
|
<span class="mx-1">تایید</span>
|
|
</button>
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCall(${rollCallItem.employeeId}, '${data.dateFa}')">
|
|
<span class="mx-1">ویرایش</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
var dateTimeFaId = data.dateFa.replaceAll("/", "");
|
|
$(`.dateTimeFa_without_lunch_break_${dateTimeFaId}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function loadUndefinedRollCallsList() {
|
|
var mainIndexNumUndefined = 1;
|
|
$('#loadingSkeletonUndefined').show();
|
|
|
|
var htmlUndefinedList = ``;
|
|
$.ajax({
|
|
//async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadUndefinedRollCalls,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
$('#loadingSkeletonUndefined').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function (item) {
|
|
|
|
htmlUndefinedList += `
|
|
<div id="undefinedMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByUndefinedRollCalls('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNumUndefined++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.dayOfWeekFa} </span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.dateTimeFa}</span>
|
|
</div>
|
|
</div><div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count">${item.rollCallWorkFlowPerDayCount}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
htmlUndefinedList += `<div class="w-100 operation-div">
|
|
<div id="undefined_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_without_undefined_${item.dateTimeFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
} else {
|
|
htmlUndefinedList += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
$('#loadRollCallUndefinedWorkFlow').html(htmlUndefinedList);
|
|
$('#loadRollCallUndefinedWorkFlowMobile').html(htmlUndefinedList);
|
|
loadFunctionUndefined = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadEmployeeListByUndefinedRollCalls(date) {
|
|
|
|
var html = ``;
|
|
$.ajax({
|
|
async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeeListByUndefinedRollCallsUrl,
|
|
data: { 'date': date },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
if (response.success) {
|
|
if (data.rollCallWorkFlowPerDayViewModels.length > 0) {
|
|
|
|
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-undefined-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${rollCallItem.employeeName}
|
|
<p class="m-0 mt-2 d-block d-md-none"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex ms-1"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCallUndefined(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
|
<span class="mx-1">ویرایش</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
var dateTimeFaId = data.dateTimeFa.replaceAll("/", "");
|
|
$(`.dateTimeFa_without_undefined_${dateTimeFaId}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function loadOverlappingLeavesList() {
|
|
var mainIndexNumOverlappingLeaves = 1;
|
|
$('#loadingSkeletonOverlappingLeaves').show();
|
|
|
|
var htmlOverlappingLeavesList = ``;
|
|
$.ajax({
|
|
//async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadOverlappingLeave,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
$('#loadingSkeletonOverlappingLeaves').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function (item) {
|
|
|
|
htmlOverlappingLeavesList += `
|
|
<div id="leaveMain_${item.dateFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByOverlappingLeaves('${item.date}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNumOverlappingLeaves++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.dayOfWeek} </span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.dateFa}</span>
|
|
</div>
|
|
</div><div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count">${item.employeesListCount}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
htmlOverlappingLeavesList += `<div class="w-100 operation-div">
|
|
<div id="leave_${item.dateFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_overlapping_leaves_${item.dateFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
} else {
|
|
htmlOverlappingLeavesList += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
$('#loadOverlappingLeaves').html(htmlOverlappingLeavesList);
|
|
$('#loadOverlappingLeavesMobile').html(htmlOverlappingLeavesList);
|
|
loadFunctionOverlappingLeaves = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadEmployeeListByOverlappingLeaves(date) {
|
|
|
|
var html = ``;
|
|
$.ajax({
|
|
async: false,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeeListByOverlappingLeaveUrl,
|
|
data: { 'date': date },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
if (response.success) {
|
|
|
|
if (data.employeesList.length > 0) {
|
|
|
|
data.employeesList.forEach(function (rollCallItem, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-leave-employee-date="${rollCallItem.employeeId + `-` + data.dateFa.replaceAll("/", "")}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${rollCallItem.employeeFullName}
|
|
<p class="m-0 mt-2 d-block d-md-none"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex ms-1"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button type="button" class="btn-workflow-leave" onclick="showModalEditLeave(${rollCallItem.leaveId})">
|
|
<span class="mx-1">مرخصی</span>
|
|
</button>
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCall(${rollCallItem.employeeId}, '${data.dateFa}')">
|
|
<span class="mx-1">ویرایش</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
var dateTimeFaId = data.dateFa.replaceAll("/", "");
|
|
$(`.dateTimeFa_overlapping_leaves_${dateTimeFaId}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showModalLeave(employeeId, dateFa, employeeName) {
|
|
var goTo = `#showmodal=/Client/Company/WorkFlow/RollCall?handler=LeaveCreate&Command.StartLeave=${dateFa}&Command.EmployeeId=${employeeId}&Command.EmployeeFullName=${employeeName}`;
|
|
window.location.href = goTo;
|
|
}
|
|
|
|
function showModalEditLeave(leaveId) {
|
|
var goTo = `#showmodal=/Client/Company/Employees/Leave?id=${leaveId}&handler=EditLeave`;
|
|
window.location.href = goTo;
|
|
}
|
|
|
|
function confirmAbsentAlert(employeeId, dateFa) {
|
|
swal({
|
|
title: "آیا از تایید این عدم حضور اطمینان دارید؟",
|
|
text: "",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "بله",
|
|
cancelButtonText: "خیر",
|
|
closeOnConfirm: true,
|
|
closeOnCancel: true
|
|
}, function (isConfirm) {
|
|
if (isConfirm) {
|
|
confirmAbsent(employeeId, dateFa);
|
|
}
|
|
});
|
|
}
|
|
|
|
function confirmAbsent(employeeId, dateFa) {
|
|
var dateEmployeeID = employeeId + '-' + dateFa.replaceAll("/", "");
|
|
$.ajax({
|
|
async: false,
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
url: postAjaxConfirmedAbsence,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
data: { 'employeeId': Number(employeeId), 'absenceDate': dateFa },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
CountWorkFlowOfAbsentAndCut();
|
|
_RefreshCountMenu();
|
|
$('.alert-success-msg').show();
|
|
$('.alert-success-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-success-msg').hide();
|
|
$('.alert-success-msg p').text('');
|
|
}, 1000);
|
|
|
|
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
switch (menuActive) {
|
|
case "absent":
|
|
/*loadWorkFlowsAbsentsList();*/
|
|
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`absent_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`absentMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "cut":
|
|
//LoadWorkFlowsCutList();
|
|
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`cut_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`cutMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "lunchBreak":
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`break_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`breakMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "undefined":
|
|
//loadUndefinedRollCallsList();
|
|
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`undefined_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`undefinedMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "overlappingLeave":
|
|
//loadOverlappingLeavesList();
|
|
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`leave_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`leaveMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
default:
|
|
}
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showModalEditRollCall(employeeId, dateFa) {
|
|
window.location.href = `#showmodal=/Client/Company/WorkFlow/RollCall?employeeId=${employeeId}&date=${dateFa}&handler=EditRollCall`;
|
|
}
|
|
|
|
function showModalEditRollCallAction(employeeId, dateFa) {
|
|
window.location.href = `#showmodal=/Client/Company/WorkFlow/RollCall?employeeId=${employeeId}&date=${dateFa}&handler=EditRollCallAction`;
|
|
}
|
|
|
|
function showModalEditRollCallUndefined(employeeId, dateFa) {
|
|
window.location.href = `#showmodal=/Client/Company/WorkFlow/RollCall?employeeId=${employeeId}&date=${dateFa}&handler=EditRollCallForUndefined`;
|
|
}
|
|
|
|
function confirmCutAlert(rollCallId, employeeId, dateFa) {
|
|
swal({
|
|
title: "آیا از تایید این پرسنل اطمینان دارید؟",
|
|
text: "",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "بله",
|
|
cancelButtonText: "خیر",
|
|
closeOnConfirm: true,
|
|
closeOnCancel: true
|
|
}, function (isConfirm) {
|
|
if (isConfirm) {
|
|
confirmCut(rollCallId, employeeId, dateFa);
|
|
}
|
|
});
|
|
}
|
|
|
|
function confirmCut(rollCallId, employeeId, dateFa) {
|
|
var dateEmployeeID = employeeId + '-' + dateFa.replaceAll("/", "");
|
|
$.ajax({
|
|
async: false,
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
url: postAjaxConfirmedCut,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
data: { 'employeeId': Number(employeeId), 'absenceDate': dateFa },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
CountWorkFlowOfAbsentAndCut();
|
|
_RefreshCountMenu();
|
|
$('.alert-success-msg').show();
|
|
$('.alert-success-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-success-msg').hide();
|
|
$('.alert-success-msg p').text('');
|
|
}, 1000);
|
|
|
|
|
|
//var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
//switch (menuActive) {
|
|
// case "absent":
|
|
// loadWorkFlowsAbsentsList();
|
|
// break;
|
|
// case "cut":
|
|
// LoadWorkFlowsCutList();
|
|
// break;
|
|
// case "lunchBreak":
|
|
// loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
// break;
|
|
// case "undefined":
|
|
// loadUndefinedRollCallsList();
|
|
// break;
|
|
// case "overlappingLeave":
|
|
// loadOverlappingLeavesList();
|
|
// break;
|
|
// default:
|
|
//}
|
|
|
|
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
switch (menuActive) {
|
|
case "absent":
|
|
/*loadWorkFlowsAbsentsList();*/
|
|
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`absent_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`absentMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "cut":
|
|
//LoadWorkFlowsCutList();
|
|
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`cut_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`cutMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "lunchBreak":
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`break_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`breakMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "undefined":
|
|
//loadUndefinedRollCallsList();
|
|
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`undefined_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`undefinedMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
case "overlappingLeave":
|
|
//loadOverlappingLeavesList();
|
|
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`leave_${dateFa.replaceAll("/", "") }`);
|
|
updateMainWorkFlow(`leaveMain_${dateFa.replaceAll("/", "") }`);
|
|
break;
|
|
default:
|
|
}
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
function confirmWithoutLunchBreakAlert(rollCallId, employeeId, dateFa) {
|
|
swal({
|
|
title: "آیا از تایید این پرسنل اطمینان دارید؟",
|
|
text: "",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "بله",
|
|
cancelButtonText: "خیر",
|
|
closeOnConfirm: true,
|
|
closeOnCancel: true
|
|
}, function (isConfirm) {
|
|
if (isConfirm) {
|
|
confirmWithoutLunchBreak(rollCallId, employeeId, dateFa);
|
|
}
|
|
});
|
|
}
|
|
|
|
function confirmWithoutLunchBreak(rollCallId, employeeId, dateFa) {
|
|
var dateEmployeeID = employeeId + '-' + dateFa;
|
|
$.ajax({
|
|
async: false,
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
url: postAjaxConfirmedWithoutLunchBreak,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
data: { 'rollCallId': Number(rollCallId) },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
CountWorkFlowOfAbsentAndCut();
|
|
_RefreshCountMenu();
|
|
$('.alert-success-msg').show();
|
|
$('.alert-success-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-success-msg').hide();
|
|
$('.alert-success-msg p').text('');
|
|
}, 1000);
|
|
|
|
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
switch (menuActive) {
|
|
case "absent":
|
|
/*loadWorkFlowsAbsentsList();*/
|
|
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`absent_${dateFa}`);
|
|
updateMainWorkFlow(`absentMain_${dateFa}`);
|
|
break;
|
|
case "cut":
|
|
//LoadWorkFlowsCutList();
|
|
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`cut_${dateFa}`);
|
|
updateMainWorkFlow(`cutMain_${dateFa}`);
|
|
break;
|
|
case "lunchBreak":
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`break_${dateFa}`);
|
|
updateMainWorkFlow(`breakMain_${dateFa}`);
|
|
break;
|
|
case "undefined":
|
|
//loadUndefinedRollCallsList();
|
|
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
|
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
|
break;
|
|
case "overlappingLeave":
|
|
//loadOverlappingLeavesList();
|
|
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`leave_${dateFa}`);
|
|
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
|
break;
|
|
default:
|
|
}
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function CountWorkFlowOfAbsentAndCut() {
|
|
$.ajax({
|
|
dataType: 'json',
|
|
type: 'Get',
|
|
url: loadCountWorkFlowOfAbsentAndCut,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('.spinner-grow').hide();
|
|
|
|
if (response.dataAbsent === 0) {
|
|
$('#CountAbsent').hide();
|
|
$('#CountAbsentMobile').hide();
|
|
} else {
|
|
$('#CountAbsent').show();
|
|
$('#CountAbsentMobile').show();
|
|
$('#CountAbsent').text(response.dataAbsent);
|
|
$('#CountAbsentMobile').text(response.dataAbsent);
|
|
}
|
|
|
|
if (response.dataCut === 0) {
|
|
$('#CountCut').hide();
|
|
$('#CountCutMobile').hide();
|
|
} else {
|
|
$('#CountCut').show();
|
|
$('#CountCutMobile').show();
|
|
$('#CountCut').text(response.dataCut);
|
|
$('#CountCutMobile').text(response.dataCut);
|
|
}
|
|
|
|
if (response.dataLunchBreak === 0) {
|
|
$('#CountLunchBreak').hide();
|
|
$('#CountLunchBreakMobile').hide();
|
|
} else {
|
|
$('#CountLunchBreak').show();
|
|
$('#CountLunchBreakMobile').show();
|
|
$('#CountLunchBreak').text(response.dataLunchBreak);
|
|
$('#CountLunchBreakMobile').text(response.dataLunchBreak);
|
|
}
|
|
|
|
if (response.dataUndefined === 0) {
|
|
$('#CountUndefined').hide();
|
|
$('#CountUndefinedMobile').hide();
|
|
} else {
|
|
$('#CountUndefined').show();
|
|
$('#CountUndefinedMobile').show();
|
|
$('#CountUndefined').text(response.dataUndefined);
|
|
$('#CountUndefinedMobile').text(response.dataUndefined);
|
|
}
|
|
|
|
if (response.dataOverlappingLeave === 0) {
|
|
$('#CountOverlappingLeave').hide();
|
|
$('#CountOverlappingLeaveMobile').hide();
|
|
} else {
|
|
$('#CountOverlappingLeave').show();
|
|
$('#CountOverlappingLeaveMobile').show();
|
|
$('#CountOverlappingLeave').text(response.dataOverlappingLeave);
|
|
$('#CountOverlappingLeaveMobile').text(response.dataOverlappingLeave);
|
|
}
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
function updateIndexesWorkFlow(dateDiv) {
|
|
let index = 1;
|
|
|
|
$(`#${dateDiv} .employee-row:visible .table-number`).each(function () {
|
|
$(this).text(index++);
|
|
});
|
|
}
|
|
|
|
function updateMainWorkFlow(dateDiv) {
|
|
let indexMain = 1;
|
|
|
|
$(`#${dateDiv} .number-of-count`).each(function () {
|
|
var text = Number($(this).text());
|
|
$(this).text(text - 1);
|
|
|
|
if (text - 1 === 0) {
|
|
$(`#${dateDiv}`).next().remove();
|
|
$(`#${dateDiv}`).remove();
|
|
|
|
$(`.Rtable-cell.width1 .Rtable-cell--content span`).each(function () {
|
|
$(this).text(indexMain++);
|
|
});
|
|
}
|
|
});
|
|
} |