diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/_Partials/ConfirmEmployeeChangeModal.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/_Partials/ConfirmEmployeeChangeModal.cshtml index 6f3ac9e2..c190fecc 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/_Partials/ConfirmEmployeeChangeModal.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/_Partials/ConfirmEmployeeChangeModal.cshtml @@ -4,58 +4,59 @@ } + \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/css/ConfirmEditGroupTimeChangeModal.css b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/css/ConfirmEditGroupTimeChangeModal.css index d0658cd7..21ad9c9a 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/css/ConfirmEditGroupTimeChangeModal.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/css/ConfirmEditGroupTimeChangeModal.css @@ -233,3 +233,10 @@ input:focus { user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */ } + +.hasPaySlip { + background-color: #ffe6e6 !important; + border: 1px solid #ff9999 !important; + color: #b30000; + font-weight: bold; +} diff --git a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ConfirmEmployeeChange.js b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ConfirmEmployeeChange.js index 9ecbfda8..6098fe86 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ConfirmEmployeeChange.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ConfirmEmployeeChange.js @@ -175,4 +175,30 @@ function updateRowIndexes() { $('.btn-card').each(function (index) { $(this).text(index + 1); }); +} +function updateListEmployeeOrderByCheckout(paidIds = []) { + const rows = []; + + $('#employeeTable .TaleRowCell').each(function () { + const $row = $(this); + const employeeId = parseInt($row.find('input[name="EmployeeId[]"]').val()); + const isPaid = paidIds.includes(employeeId); + + if (isPaid) { + $row.addClass('hasPaySlip'); + } else { + $row.removeClass('hasPaySlip'); + } + + rows.push({ element: $row, isPaid }); + }); + + rows.sort((a, b) => b.isPaid - a.isPaid); + + $('#employeeTable').empty(); + rows.forEach(({ element }) => { + $('#employeeTable').append(element); + }); + + updateRowIndexes(); } \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ModalEditGroup.js b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ModalEditGroup.js index 8ae8f690..71543b81 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ModalEditGroup.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/RollCall/js/ModalEditGroup.js @@ -851,48 +851,65 @@ async function postChangeEditGroup() { FromDate: $('[name="FromDate[]"]').eq(index).val() }); }); - - const response = await $.ajax({ + + const responseValid = await $.ajax({ dataType: 'json', type: 'POST', - url: ajaxEditGroupSave, + url: ajaxValidateGroupEditUrl, headers: { "RequestVerificationToken": antiForgeryToken }, - data: { ...saveData, reCalculateCommand: command } + data: { command } }); - if (response.success) { - isShiftChangedGlobal = true; + if (responseValid.success) { + const responseEditGroup = await $.ajax({ + dataType: 'json', + type: 'POST', + url: ajaxEditGroupSave, + headers: { "RequestVerificationToken": antiForgeryToken }, + data: { ...saveData, reCalculateCommand: command } + }); + if (responseEditGroup.success) { + isShiftChangedGlobal = true; + $('.alert-success-msg').show(); + $('.alert-success-msg p').text(responseEditGroup.message); + setTimeout(function () { + $('.alert-success-msg').hide(); + $('.alert-success-msg p').text(''); + }, 2000); + + loadDataAjax(); + $('#btn-register').addClass('disable'); + $('#MainModal').modal('hide'); + + $('#ConfirmRecalculationLoading').hide(); + $('.btn-confirm').removeClass('disable'); + //} + } else { + $('.alert-msg').show(); + $('.alert-msg p').text(responseEditGroup.message); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + }, 3500); + $('#ConfirmRecalculationLoading').hide(); + $('.btn-confirm').removeClass('disable'); + } + } else { $('.alert-success-msg').show(); - $('.alert-success-msg p').text(response.message); + $('.alert-success-msg p').text(responseValid.message); setTimeout(function () { $('.alert-success-msg').hide(); $('.alert-success-msg p').text(''); - }, 2000); - - loadDataAjax(); - $('#btn-register').addClass('disable'); - $('#MainModal').modal('hide'); - - $('#ConfirmRecalculationLoading').hide(); - $('.btn-confirm').removeClass('disable'); - //} - } else { - $('.alert-msg').show(); - $('.alert-msg p').text(response.message); - setTimeout(function () { - $('.alert-msg').hide(); - $('.alert-msg p').text(''); }, 3500); - $('#ConfirmRecalculationLoading').hide(); + + // Updating the employees that who has checkout + updateListEmployeeOrderByCheckout(responseValid.data); $('.btn-confirm').removeClass('disable'); } } - - - async function saveReCalculateValues(command) { var btnConfirm = $('.btn-confirm').addClass('disable'); @@ -908,6 +925,7 @@ async function saveReCalculateValues(command) { headers: { "RequestVerificationToken": antiForgeryToken }, data: { command: command }, }); + if (response.success) { $('.alert-success-msg').show(); $('.alert-success-msg p').text(response.message);