Mearge RecalCulate Valuse group
This commit is contained in:
@@ -219,7 +219,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
|
||||
}
|
||||
|
||||
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.id));
|
||||
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId));
|
||||
|
||||
foreach (var item in permittedToOverWrite)
|
||||
{
|
||||
|
||||
@@ -1602,19 +1602,19 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
foreach (var command in commands)
|
||||
{
|
||||
var fromDateGr = command.FromDate.ToGeorgianDateTime();
|
||||
if (_checkoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
if (_checkoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractEnd))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
}
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractEnd))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
}
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractEnd))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
public CustomizeWorkshopSettingsViewModel RollCallWorkshopSettings;
|
||||
public List<RollCallEmployeeViewModel> RollCallEmployeeList;
|
||||
|
||||
public GroupingModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ICustomizeWorkshopSettingsApplication rollCallWorkshopSettingsApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, IRollCallEmployeeApplication rollCallEmployeeApplication, IRollCallApplication rollCallApplication)
|
||||
public GroupingModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ICustomizeWorkshopSettingsApplication rollCallWorkshopSettingsApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, IRollCallEmployeeApplication rollCallEmployeeApplication, IRollCallApplication rollCallApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_workshopApplication = workshopApplication;
|
||||
@@ -249,19 +249,19 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetEmployeesHaveToChange(long groupId, bool isChange)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId)
|
||||
.Where(x => x.IsSettingChanged = isChange).ToList();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = result
|
||||
});
|
||||
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId)
|
||||
.Where(x => x.IsSettingChanged = isChange).ToList();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = result
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnPostChangeEditEmployee(EditCustomizeEmployeeSettings command, List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
command.WorkshopId = _workshopId;
|
||||
OperationResult result = _customizeWorkshopSettingsApplication.EditSimpleRollCallEmployeeSetting(command, reCalculateCommand);
|
||||
command.WorkshopId = _workshopId;
|
||||
OperationResult result = _customizeWorkshopSettingsApplication.EditSimpleRollCallEmployeeSetting(command, reCalculateCommand);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
@@ -280,14 +280,14 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnPostReCalculateValues(List<ReCalculateRollCallValues> command)
|
||||
{
|
||||
var result = _rollCallApplication.RecalculateValues(_workshopId, command);
|
||||
var result = _rollCallApplication.RecalculateValues(_workshopId, command);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message
|
||||
});
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetDownloadExcel()
|
||||
{
|
||||
@@ -359,6 +359,17 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
$"اطلاعات گروهبندی.xlsx");
|
||||
}
|
||||
|
||||
public IActionResult OnPostValidateGroupEdit(List<ReCalculateRollCallValues> command)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.ValidateReCalculateValueForGroupEdit(command, _workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
data = result.Data
|
||||
});
|
||||
}
|
||||
|
||||
// public IActionResult OnGetGroupingSetting(long groupId)
|
||||
// {
|
||||
// var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId);
|
||||
|
||||
@@ -4,58 +4,59 @@
|
||||
}
|
||||
|
||||
<div class="modal-content" style="height: auto;">
|
||||
<div class="modal-header d-block text-center position-relative">
|
||||
<div class="modal-header d-block text-center position-relative">
|
||||
<button type="button" class="btn-close position-absolute text-start closeConfirmModal"></button>
|
||||
<h5 class="modal-title" id="morakhasiEstehghaghiModalLabel" style="font-size: 19px;">تغییرات انجام شده آماده اعمال می باشد</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div>
|
||||
<p class="m-0">پرسنل زیر بصورت سفارشی قبلا تنظیم شده اند:</p>
|
||||
</div>
|
||||
<div class="employee-item">
|
||||
<ul id="loadEmployeeItem"></ul>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div>
|
||||
<p class="m-0">پرسنل زیر بصورت سفارشی قبلا تنظیم شده اند:</p>
|
||||
</div>
|
||||
<div class="employee-item">
|
||||
<ul id="loadEmployeeItem"></ul>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 d-flex align-items-center justify-content-between">
|
||||
<p class="m-0">آیا تغییرات کنونی شامل پرسنل بالا بشود؟</p>
|
||||
<div class="form-group my-1">
|
||||
<p class="m-0">آیا تغییرات کنونی شامل پرسنل بالا بشود؟</p>
|
||||
<div class="form-group my-1">
|
||||
<input type="radio" name="IsShiftChanged" id="YesConfirm" class="form-check-input modal2" value="true" />
|
||||
<label for="YesConfirm">بله</label>
|
||||
</div>
|
||||
<div class="form-group my-1">
|
||||
</div>
|
||||
<div class="form-group my-1">
|
||||
<input type="radio" name="IsShiftChanged" id="NotConfirm" class="form-check-input modal2" value="false" />
|
||||
<label for="NotConfirm">خیر</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label for="NotConfirm">خیر</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row mt-3">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn-secondary w-100 closeConfirmModal">انصراف</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="position-relative">
|
||||
<div class="row mt-3">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn-secondary w-100 closeConfirmModal">انصراف</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="position-relative">
|
||||
<button type="button" class="btn-primary w-100 disable" id="finalSaveRollCallSetting" onclick="ajaxConfirm()">ثبت نهایی</button>
|
||||
<div class="spinner-loading loading" style="display: none;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-loading loading" style="display: none;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
|
||||
var loadEmployeesIsSettingChangeAjax = '@Url.Page("./Grouping", "EmployeeIsChangeList")';
|
||||
var ajaxEmployeesHaveToChangeUrl = `@Url.Page("./Grouping", "EmployeesHaveToChange")`;
|
||||
var ajaxValidateGroupEditUrl = `@Url.Page("./Grouping", "ValidateGroupEdit")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/confirmemployeechange.js?ver=@clientVersion"></script>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -154,11 +154,12 @@ function employeeList() {
|
||||
}
|
||||
|
||||
$('#initialDateInput').on('input', function () {
|
||||
new Cleave('.dateInput', {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
$('.dateInput').mask('0000/00/00')
|
||||
//new Cleave('.dateInput', {
|
||||
// delimiters: ['/', '/'],
|
||||
// blocks: [4, 2, 2],
|
||||
// numericOnly: true
|
||||
//});
|
||||
// new Cleave('.dateInput', {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
@@ -175,4 +176,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();
|
||||
}
|
||||
@@ -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(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-success-msg').hide();
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 2000);
|
||||
$('.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');
|
||||
loadDataAjax();
|
||||
$('#btn-register').addClass('disable');
|
||||
$('#MainModal').modal('hide');
|
||||
|
||||
$('#ConfirmRecalculationLoading').hide();
|
||||
$('.btn-confirm').removeClass('disable');
|
||||
//}
|
||||
$('#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-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
$('.alert-msg p').text(responseValid.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);
|
||||
|
||||
Reference in New Issue
Block a user