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 += `
${mainIndexNum++}
${item.dayOfWeekFa}
${item.dateTimeFa}
${item.rollCallWorkFlowPerDayCount}
`; html += `
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } $('#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 += `
ردیف
${i + 1}
نام پرسنل
${rollCallItem.employeeName}

پیغام:
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } 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 += `
${mainIndexNumCutBySystem++}
${item.dayOfWeekFa}
${item.dateTimeFa}
${item.rollCallWorkFlowPerDayCount}
`; htmlCutList += `
`; }); } else { htmlCutList += `
اطلاعاتی وجود ندارد.
`; } $('#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 += `
ردیف
${i + 1}
نام پرسنل
${rollCallItem.employeeName}
`; rollCallItem.timesList.forEach(function (timeItem) { html += `
${timeItem.startTimeAndEndTimeAsMessage}
`; }); html += `
پیغام:
`; rollCallItem.timesList.forEach(function (timeItem) { html += `
${timeItem.startTimeAndEndTimeAsMessage}
`; }); html += `
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } 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 += `
${mainIndexNumLunchBreak++}
${item.dayOfWeekFa}
${item.dateFa}
${item.count}
`; htmlLunchBreakList += `
`; }); } else { htmlLunchBreakList += `
اطلاعاتی وجود ندارد.
`; } $('#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 += `
ردیف
${i + 1}
نام پرسنل
${rollCallItem.employeeName}

پیغام:
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } 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 += `
${mainIndexNumUndefined++}
${item.dayOfWeekFa}
${item.dateTimeFa}
${item.rollCallWorkFlowPerDayCount}
`; htmlUndefinedList += `
`; }); } else { htmlUndefinedList += `
اطلاعاتی وجود ندارد.
`; } $('#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 += `
ردیف
${i + 1}
نام پرسنل
${rollCallItem.employeeName}

پیغام:
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } 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 += `
${mainIndexNumOverlappingLeaves++}
${item.dayOfWeek}
${item.dateFa}
${item.employeesListCount}
`; htmlOverlappingLeavesList += `
`; }); } else { htmlOverlappingLeavesList += `
اطلاعاتی وجود ندارد.
`; } $('#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 += `
ردیف
${i + 1}
نام پرسنل
${rollCallItem.employeeFullName}

پیغام:
`; }); } else { html += `
اطلاعاتی وجود ندارد.
`; } 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++); }); } }); }