ReCalculateValues Merged
This commit is contained in:
@@ -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,8 +249,22 @@ 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();
|
||||
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId)
|
||||
.Where(x => x.IsSettingChanged = isChange).ToList();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = result
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeesForRecalculateValues(long groupId, bool getChanged)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId).ToList();
|
||||
if (getChanged ==false)
|
||||
{
|
||||
result = result.Where(x => !x.IsShiftChanged).ToList();
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -260,8 +274,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
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 +294,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()
|
||||
{
|
||||
@@ -361,13 +375,13 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnPostValidateGroupEdit(List<ReCalculateRollCallValues> command)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.ValidateReCalculateValueForGroupEdit(command, _workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
var result= _customizeWorkshopSettingsApplication.ValidateReCalculateValueForGroupEdit(command,_workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
data = result.Data
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// public IActionResult OnGetGroupingSetting(long groupId)
|
||||
|
||||
@@ -488,4 +488,4 @@
|
||||
var ajaxReCalculateValuesUrl = `@Url.Page("./Grouping", "ReCalculateValues")`;
|
||||
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/modaleditgroup.js?ver=@clientVersion"></script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/modaleditgroup.js?ver=clientVersion"></script>
|
||||
@@ -4,59 +4,60 @@
|
||||
}
|
||||
|
||||
<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 ajaxEmployeesForRecalculateValuesUrl = `@Url.Page("./Grouping", "EmployeesForRecalculateValues")`;
|
||||
var ajaxValidateGroupEditUrl = `@Url.Page("./Grouping", "ValidateGroupEdit")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/confirmemployeechange.js?ver=@clientVersion"></script>
|
||||
@@ -22,7 +22,7 @@
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
loadEmployeeIsChangeAjax();
|
||||
loadEmployeeIsChangeAjax();
|
||||
});
|
||||
|
||||
function loadEmployeeIsChangeAjax() {
|
||||
@@ -72,16 +72,20 @@ function loadEmployeeIsChangeAjax() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var getChangedGlobal = false;
|
||||
function ajaxConfirm() {
|
||||
saveDataLocal();
|
||||
employeeList();
|
||||
var isYesCheck = $('#YesConfirm').is(':checked');
|
||||
if (isYesCheck) {
|
||||
$('#ConfirmModal').show();
|
||||
getChangedGlobal = true;
|
||||
//$('#ConfirmModal').show();
|
||||
} else {
|
||||
postChangeEditGroup();
|
||||
getChangedGlobal = false;
|
||||
//postChangeEditGroup();
|
||||
}
|
||||
|
||||
$('#ConfirmModal').show();
|
||||
saveDataLocal();
|
||||
employeeList();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,18 +98,21 @@ function employeeList() {
|
||||
contentType: 'charset=utf-8',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: ajaxEmployeesHaveToChangeUrl,
|
||||
data: { 'groupId': groupId, 'isChange': isChange },
|
||||
url: ajaxEmployeesForRecalculateValuesUrl,
|
||||
data: { 'groupId': groupId, 'getChanged': getChangedGlobal },
|
||||
headers: { "RequestVerificationToken": `${antiForgeryToken}` },
|
||||
success: function (response) {
|
||||
var employeeList = response.data;
|
||||
var index = 1;
|
||||
if (response.success) {
|
||||
employeeList.forEach(function (item) {
|
||||
htmlEmployeeList += `<div class="TaleRowCell d-flex w-100 justify-content-between align-items-center px-2 " style="background: #F1FFFF; height: 45px; border-radius: 7px;border: 1px solid #D2D2D2">
|
||||
if (employeeList.length > 0) {
|
||||
employeeList.forEach(function(item) {
|
||||
htmlEmployeeList +=
|
||||
`<div class="TaleRowCell d-flex w-100 justify-content-between align-items-center px-2 " style="background: #F1FFFF; height: 45px; border-radius: 7px;border: 1px solid #D2D2D2">
|
||||
<div class="d-flex align-items-center gap-3 noselect">
|
||||
<span class="btn-card noselect">${index++}</span>
|
||||
<span style="color: #0B5959; font-size: 14px; font-weight: 400; text-align: right">${item.name}</span>
|
||||
<span style="color: #0B5959; font-size: 14px; font-weight: 400; text-align: right">${item.name
|
||||
}</span>
|
||||
</div>
|
||||
<input type="hidden" name="EmployeeId[]" value="${item.employeeId}" />
|
||||
|
||||
@@ -126,25 +133,30 @@ function employeeList() {
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
$('#employeeTable').html(htmlEmployeeList);
|
||||
|
||||
|
||||
|
||||
$('.dateInput').each(function () {
|
||||
new Cleave(this, {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
$(this).val(dateNow);
|
||||
});
|
||||
$('#employeeTable').html(htmlEmployeeList);
|
||||
|
||||
|
||||
$('.dateInput').each(function() {
|
||||
new Cleave(this,
|
||||
{
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
$(this).val(dateNow);
|
||||
});
|
||||
} else {
|
||||
$('#ConfirmModal').hide();
|
||||
ajaxSaveSubmit();
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
failure: function (response) {
|
||||
@@ -154,7 +166,7 @@ function employeeList() {
|
||||
}
|
||||
|
||||
$('#initialDateInput').on('input', function () {
|
||||
$('.dateInput').mask('0000/00/00')
|
||||
$('.dateInput').mask('0000/00/00');
|
||||
//new Cleave('.dateInput', {
|
||||
// delimiters: ['/', '/'],
|
||||
// blocks: [4, 2, 2],
|
||||
|
||||
@@ -371,6 +371,9 @@ function loadEmployeeAjax(groupSettingId) {
|
||||
$(`#loadEmployeeItemsMobile_${groupSettingId}`).html(htmlEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('-----------------------------------------------');
|
||||
console.log(isShiftChangedGlobal);
|
||||
},
|
||||
failure: function (response) {
|
||||
console.log(5, response);
|
||||
|
||||
@@ -747,17 +747,18 @@ function timeValidCheck(value) {
|
||||
//******************** برای نوشتن تاریخ ********************
|
||||
|
||||
|
||||
function ajaxEditGroupingSaveData() {
|
||||
async function ajaxEditGroupingSaveData() {
|
||||
if ($('#Name').val() === "") {
|
||||
showAlert('لطفا نام گروه را وارد نمایید', $('#Name'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isShiftChangedGlobal) {
|
||||
$('#ConfirmEmployeeModal').show();
|
||||
} else {
|
||||
ajaxSaveSubmit();
|
||||
$('#ConfirmModal').show();
|
||||
saveDataLocal();
|
||||
employeeList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,6 +806,11 @@ function saveDataLocal() {
|
||||
}
|
||||
//var hasBreakTime = $("#BreakTime").prop("checked") ? "true" : "false";
|
||||
var breakTimeValue = $("#TimeOnly").val();
|
||||
|
||||
//var isShiftChanged = 'true';
|
||||
//if ($('#YesConfirm').prop("checked") || $('#NotConfirm').prop("checked")) {
|
||||
// isShiftChanged = $('#YesConfirm').prop("checked") ? "true" : "false";
|
||||
//}
|
||||
var isShiftChanged = $('#YesConfirm').prop("checked") ? "true" : "false";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user