recalculte values group
This commit is contained in:
@@ -51,4 +51,11 @@ public class OperationResult<T>
|
||||
Message = message;
|
||||
return this;
|
||||
}
|
||||
public OperationResult<T> Failed(string message, T data)
|
||||
{
|
||||
IsSuccedded = false;
|
||||
Message = message;
|
||||
Data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,60 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
|
||||
.ToList(), earlyExit.Value);
|
||||
}
|
||||
public void UpdateIsShiftChange()
|
||||
{
|
||||
var groupSetting = CustomizeWorkshopGroupSettings;
|
||||
if (groupSetting == null)
|
||||
return;
|
||||
bool isShiftChange;
|
||||
|
||||
|
||||
if (WorkshopShiftStatus == WorkshopShiftStatus.Regular)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (CustomizeWorkshopEmployeeSettingsShifts.All(x => groupSetting.CustomizeWorkshopGroupSettingsShifts.Any(y => x.Equals(y)))
|
||||
&& WorkshopShiftStatus == groupSetting.WorkshopShiftStatus && FridayWork == groupSetting.FridayWork &&
|
||||
HolidayWork == groupSetting.HolidayWork && BreakTime == groupSetting.BreakTime)
|
||||
{
|
||||
isShiftChange = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
isShiftChange = true;
|
||||
}
|
||||
}
|
||||
else if (WorkshopShiftStatus == WorkshopShiftStatus.Irregular)
|
||||
{
|
||||
if (WorkshopShiftStatus == groupSetting.WorkshopShiftStatus && BreakTime == groupSetting.BreakTime &&
|
||||
IrregularShift == groupSetting.IrregularShift && FridayWork == groupSetting.FridayWork &&
|
||||
HolidayWork == groupSetting.HolidayWork)
|
||||
{
|
||||
isShiftChange = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isShiftChange = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CustomizeRotatingShifts.All(x => groupSetting.CustomizeRotatingShifts.Any(y => x.Equals(y)))
|
||||
&& WorkshopShiftStatus == groupSetting.WorkshopShiftStatus && FridayWork == groupSetting.FridayWork &&
|
||||
HolidayWork == groupSetting.HolidayWork && BreakTime == groupSetting.BreakTime)
|
||||
{
|
||||
isShiftChange = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
isShiftChange = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IsShiftChanged = isShiftChange;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public interface ICustomizeWorkshopSettingsApplication
|
||||
//Remove the Employee From the Group Settings
|
||||
OperationResult RemoveEmployeeFromRollCallWorkshopGroup(long employeeId, long groupId, long workshopId);
|
||||
|
||||
OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command);
|
||||
OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command, List<ReCalculateRollCallValues> reCalculateCommand);
|
||||
|
||||
#region Vafa
|
||||
OperationResult EditSimpleRollCallEmployeeSetting(EditCustomizeEmployeeSettings command,
|
||||
@@ -90,7 +90,13 @@ public interface ICustomizeWorkshopSettingsApplication
|
||||
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId);
|
||||
CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// این متد برای قبل از ویرایش گروهی و محاسبه مجدد گروهی استفاده میشود برای اینکه پرسنل هایی که دارای فیش هستند رو فرانت نمایش بده
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult<List<long>> ValidateReCalculateValueForGroupEdit(List<ReCalculateRollCallValues> command, long workshopId);
|
||||
bool HasAnyEmployeeWithoutGroup(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,6 +21,10 @@ using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -30,7 +34,10 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, IEmployeeRepository employeeRepository,
|
||||
ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository,
|
||||
IRollCallEmployeeApplication rollCallEmployeeApplication,
|
||||
IRollCallApplication rollCallAppllication)
|
||||
IRollCallApplication rollCallAppllication,
|
||||
ICheckoutRepository checkoutRepository,
|
||||
ICustomizeCheckoutRepository customizeCheckoutRepository,
|
||||
ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
|
||||
: ICustomizeWorkshopSettingsApplication
|
||||
{
|
||||
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
|
||||
@@ -42,6 +49,9 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
private readonly ICameraAccountApplication _cameraAccountApplication = cameraAccountApplication;
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
private readonly IRollCallApplication _rollCallApplication = rollCallAppllication;
|
||||
private readonly ICheckoutRepository _checkoutRepository = checkoutRepository;
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
|
||||
#region RollCallShifts
|
||||
|
||||
@@ -670,7 +680,8 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
transActionScope.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command)
|
||||
public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command,
|
||||
List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
@@ -689,9 +700,11 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
var workshopSettings = _customizeWorkshopSettingsRepository.Get(entity.CustomizeWorkshopSettingId);
|
||||
|
||||
var employeeIds = command.IsShiftChanged ? entity.CustomizeWorkshopEmployeeSettingsCollection
|
||||
.Select(x => x.id).ToList() : entity.CustomizeWorkshopEmployeeSettingsCollection.Where(x => !x.IsShiftChanged)
|
||||
.Select(x => x.id).ToList();
|
||||
//var employeeIds = command.IsShiftChanged ? entity.CustomizeWorkshopEmployeeSettingsCollection
|
||||
// .Select(x => x.id).ToList() : entity.CustomizeWorkshopEmployeeSettingsCollection.Where(x => !x.IsShiftChanged)
|
||||
// .Select(x => x.id).ToList();
|
||||
|
||||
|
||||
var groupSettingsShifts = new List<CustomizeWorkshopGroupSettingsShift>();
|
||||
ICollection<CustomizeRotatingShift> rotatingShift = [];
|
||||
bool isChanged;
|
||||
@@ -708,7 +721,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement);
|
||||
|
||||
}).ToList();
|
||||
;
|
||||
|
||||
if (groupSettingsShifts.All(x => workshopSettings.CustomizeWorkshopSettingsShifts.Any(y => x.Equals(y)))
|
||||
&& command.WorkshopShiftStatus == workshopSettings.WorkshopShiftStatus && command.FridayWork == workshopSettings.FridayWork &&
|
||||
command.HolidayWork == workshopSettings.HolidayWork &&
|
||||
@@ -782,10 +795,38 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
var breakTime = new BreakTime(command.BreakTime.HasBreakTimeValue, command.BreakTime.BreakTimeValue);
|
||||
|
||||
entity.EditSimpleAndOverwriteOnEmployee(command.Name, employeeIds, groupSettingsShifts, command.WorkshopShiftStatus,
|
||||
var employeeSettings = entity.CustomizeWorkshopEmployeeSettingsCollection;
|
||||
|
||||
var employeeSettingIds = employeeSettings.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
reCalculateCommand = reCalculateCommand.Where(x => employeeSettingIds.Contains(x.EmployeeId)).ToList();
|
||||
|
||||
var selectedEmployeesIds = reCalculateCommand.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
var notSelectedEmployeeSettings = employeeSettings.Where(x => !selectedEmployeesIds.Contains(x.EmployeeId));
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
entity.EditSimpleAndOverwriteOnEmployee(command.Name, selectedEmployeesIds, groupSettingsShifts, command.WorkshopShiftStatus,
|
||||
command.IrregularShift, breakTime, isChanged, command.FridayWork, command.HolidayWork, rotatingShift);
|
||||
if (reCalculateCommand.Count > 0)
|
||||
{
|
||||
var result = _rollCallApplication.RecalculateValues(workshopSettings.WorkshopId, reCalculateCommand);
|
||||
|
||||
if (result.IsSuccedded == false)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var notSelectedEmployeeSetting in notSelectedEmployeeSettings)
|
||||
{
|
||||
notSelectedEmployeeSetting.UpdateIsShiftChange();
|
||||
}
|
||||
|
||||
_customizeWorkshopGroupSettingsRepository.SaveChanges();
|
||||
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult EditSimpleRollCallEmployeeSetting(EditCustomizeEmployeeSettings command,
|
||||
@@ -1552,7 +1593,40 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
{
|
||||
return _customizeWorkshopGroupSettingsRepository.HasAnyEmployeeWithoutGroup(workshopId);
|
||||
}
|
||||
public OperationResult<List<long>> ValidateReCalculateValueForGroupEdit(List<ReCalculateRollCallValues> commands,
|
||||
long workshopId)
|
||||
{
|
||||
var operationResult = new OperationResult<List<long>>();
|
||||
bool isSuccess = true;
|
||||
List<long> employeeIdsHasCheckout = [];
|
||||
foreach (var command in commands)
|
||||
{
|
||||
var fromDateGr = command.FromDate.ToGeorgianDateTime();
|
||||
if (_checkoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
}
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
}
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == workshopId && x.EmployeeId == command.EmployeeId && fromDateGr <= x.ContractStart))
|
||||
{
|
||||
isSuccess = false;
|
||||
employeeIdsHasCheckout.Add(command.EmployeeId);
|
||||
}
|
||||
}
|
||||
|
||||
employeeIdsHasCheckout = employeeIdsHasCheckout.Distinct().ToList();
|
||||
return isSuccess ?
|
||||
operationResult.Succcedded(employeeIdsHasCheckout)
|
||||
:
|
||||
operationResult.Failed("پرسنل هایی دارای فیش هستند لطفا نسبت به تعیین تکلیف این ها اقدام نمایید", employeeIdsHasCheckout);
|
||||
}
|
||||
public bool CheckEmployeeShiftHasChanged(EditCustomizeEmployeeSettings command)
|
||||
{
|
||||
return _customizeWorkshopEmployeeSettingsRepository.CheckEmployeeShiftHasChanged(command);
|
||||
|
||||
@@ -196,6 +196,11 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
|
||||
return true;
|
||||
}
|
||||
|
||||
if (command.BreakTime.BreakTimeValue != employeeSettings.BreakTime.BreakTimeValue || command.BreakTime.HasBreakTimeValue != employeeSettings.BreakTime.HasBreakTimeValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (employeeSettings.WorkshopShiftStatus)
|
||||
{
|
||||
case WorkshopShiftStatus.Irregular:
|
||||
|
||||
@@ -130,11 +130,11 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
return Partial("ModalEditGroup", command);
|
||||
}
|
||||
|
||||
public IActionResult OnPostEditGroup(EditCustomizeWorkshopGroupSettings command)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command);
|
||||
public IActionResult OnPostEditGroup(EditCustomizeWorkshopGroupSettings command, List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command, reCalculateCommand);
|
||||
|
||||
return new JsonResult(new
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message
|
||||
|
||||
@@ -152,9 +152,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
return Partial("ModalEditGroup", command);
|
||||
}
|
||||
|
||||
public IActionResult OnPostEditGroup(EditCustomizeWorkshopGroupSettings command)
|
||||
public IActionResult OnPostEditGroup(EditCustomizeWorkshopGroupSettings command, List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command);
|
||||
var result = _customizeWorkshopSettingsApplication.EditSimpleRollCallGroupSetting(command, reCalculateCommand);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -481,6 +481,7 @@
|
||||
var indexShiftViewModel = Number(@indexShiftViewModel);
|
||||
var indexShiftViewModelRS = Number(@indexShiftViewModel);
|
||||
|
||||
var ajaxEmployeeSettingsHasChangedValueUrl = `@Url.Page("./Grouping", "EmployeeSettingsHasChangedValue")`;
|
||||
var groupId = Number(@Model.Id);
|
||||
|
||||
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? 0 : Model.WorkshopShiftStatus == WorkshopShiftStatus.Irregular ? 1 : 2);
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
<div class="modal-header d-block text-center position-relative">
|
||||
<button type="button" class="btn-close position-absolute text-start closeConfirmModal2"></button>
|
||||
<div class="modal-header d-flex flex-column " id="morakhasiEstehghaghiModalLabel" style="font-size: 19px; padding: 0 20px !important;">
|
||||
<span class="header-title mb-4 "> تغییرات ساعت کار پرسنل به صورت گروهی : </span>
|
||||
<span class="header-title mb-4 ">تغییرات ساعت کار پرسنل به صورت گروهی</span>
|
||||
<span class="header-description">
|
||||
تاریخ تغییرات ساعت کاری را میتوانید بصورت انفرادی در منوی
|
||||
ذیل انجام دهید :
|
||||
تاریخ تغییرات ساعت کاری را میتوانید بصورت انفرادی در منوی ذیل انجام دهید:
|
||||
</span>
|
||||
|
||||
</div>
|
||||
@@ -24,21 +23,31 @@
|
||||
|
||||
<div class="cardModal2-content">
|
||||
<div class="Table d-flex flex-column gap-2">
|
||||
<div class="TableHeader d-flex w-100 justify-content-between align-items-center px-3 " style="background: linear-gradient(180deg, #41D1D1 0%, #2CD0D0 100%); height: 49px; border-radius: 5px; position: sticky;top: 0; ">
|
||||
<div class="TableHeader d-flex w-100 justify-content-between align-items-center px-2" style="background: linear-gradient(180deg, #41D1D1 0%, #2CD0D0 100%); height: 45px; border-radius: 7px; position: sticky; top: -7px;border: 1px solid #D2D2D2">
|
||||
|
||||
<div class="d-flex gap-3">
|
||||
<div class="TableHeaderCell text-white" style="font-size: 14px; font-weight: 400">ردیف</div>
|
||||
<div class="TableHeaderCell text-white" style="font-size: 14px; font-weight: 400">نام پرسنل</div>
|
||||
</div>
|
||||
|
||||
<input
|
||||
id="initialDateInput"
|
||||
type="text" value="" class="form-control m-0 py-0 dateInput" style="width: 120px; height: 36px; text-align: center; font-size: 16px; color: #5C5C5C; font-weight: 500; border: 2px solid #C6C6C6; direction: ltr">
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center gap-1">
|
||||
<input
|
||||
id="initialDateInput"
|
||||
type="text" value="" class="form-control m-0 py-0 dateInput" style="width: 110px; height: 30px; text-align: center; font-size: 14px; color: #5C5C5C; font-weight: 500; border: 2px solid #C6C6C6; direction: ltr">
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center cusRemove invisible">
|
||||
<svg width="20" height="20" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16.5" height="16.5" transform="translate(0.25 0.214844)" fill="#F2B3B3"/>
|
||||
<path d="M6.78125 10.1836L6.78125 8.12109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M10.2188 10.1836L10.2187 8.12109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M2.3125 4.68359H14.6875V4.68359C14.3101 4.68359 14.1214 4.68359 13.9635 4.70899C13.1117 4.84606 12.4437 5.514 12.3066 6.36588C12.2812 6.52372 12.2812 6.71243 12.2812 7.08984V9.83984C12.2812 11.5137 12.2812 12.3506 11.8116 12.9088C11.7378 12.9965 11.6566 13.0776 11.5689 13.1514C11.0107 13.6211 10.1738 13.6211 8.5 13.6211V13.6211C6.82618 13.6211 5.98926 13.6211 5.43109 13.1514C5.34339 13.0776 5.2622 12.9965 5.18842 12.9088C4.71875 12.3506 4.71875 11.5137 4.71875 9.83984V7.08984C4.71875 6.71243 4.71875 6.52372 4.69335 6.36588C4.55628 5.514 3.88835 4.84606 3.03647 4.70899C2.87862 4.68359 2.68992 4.68359 2.3125 4.68359V4.68359Z" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M6.78125 2.62126C6.78125 2.62126 7.125 1.93359 8.5 1.93359C9.875 1.93359 10.2188 2.62109 10.2188 2.62109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* load employees *@
|
||||
<div class="TableRow d-flex flex-column gap-2" id="employeeTable">
|
||||
<div class="TableRow d-flex flex-column gap-1" id="employeeTable">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="position-relative">
|
||||
@* ajaxConfirm() *@
|
||||
<button type="button" class="btn-primary w-100 disable" id="finalSaveRollCallSetting" onclick="ajaxSaveSubmit()">ثبت نهایی</button>
|
||||
<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>
|
||||
|
||||
@@ -152,24 +152,18 @@
|
||||
background: #F5F5F5;
|
||||
border-radius: 10px;
|
||||
width: 100%;
|
||||
height: 372px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #E7E7E7
|
||||
height: 400px;
|
||||
overflow: auto;
|
||||
border: 1px solid #E7E7E7;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
|
||||
.cardModal2-content {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
height: 400px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.btn-quit {
|
||||
background-color: #292D32;
|
||||
color: white;
|
||||
@@ -192,9 +186,9 @@
|
||||
font-weight: 500
|
||||
}
|
||||
|
||||
.btn-confirm:hover {
|
||||
background-color: #5f9213;
|
||||
}
|
||||
.btn-confirm:hover {
|
||||
background-color: #5f9213;
|
||||
}
|
||||
|
||||
.btn-quit:hover {
|
||||
background-color: #121820;
|
||||
@@ -213,10 +207,29 @@ input:focus {
|
||||
|
||||
.btn-card {
|
||||
color: #0B5959;
|
||||
width: 33px;
|
||||
height: 33px;
|
||||
border-radius: 3px;
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
border-radius: 5px;
|
||||
background-color: #57E3E340;
|
||||
font-size: 14px;
|
||||
line-height: 29px;
|
||||
}
|
||||
}
|
||||
|
||||
.cusRemove {
|
||||
background-color: #F2B3B3;
|
||||
border: 1px solid #F63D3D;
|
||||
border-radius: 7px;
|
||||
padding: 3px;
|
||||
cursor: pointer;
|
||||
transition: all ease-in-out 0.3s;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-webkit-touch-callout: none; /* iOS Safari */
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-khtml-user-select: none; /* Konqueror HTML */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||
user-select: none; /* Non-prefixed version, currently
|
||||
supported by Chrome and Opera */
|
||||
}
|
||||
|
||||
@@ -74,8 +74,14 @@ function loadEmployeeIsChangeAjax() {
|
||||
|
||||
|
||||
function ajaxConfirm() {
|
||||
$('#ConfirmModal').show();
|
||||
saveDataLocal();
|
||||
employeeList();
|
||||
var isYesCheck = $('#YesConfirm').is(':checked');
|
||||
if (isYesCheck) {
|
||||
$('#ConfirmModal').show();
|
||||
} else {
|
||||
postChangeEditGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,16 +102,29 @@ function employeeList() {
|
||||
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-3 " style="background: #F1FFFF; height: 49px; border-radius: 5px">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<span class="btn-card">${index++}</span>
|
||||
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>
|
||||
</div>
|
||||
<input type="hidden" name="EmployeeId[]" value="${item.employeeId}" />
|
||||
<input type="text" class="form-control m-0 py-0 dateInput"
|
||||
name="FromDate[]"
|
||||
value=""
|
||||
style="width: 120px; height: 36px; text-align: center; font-size: 16px; color: #5C5C5C; font-weight: 500; border: 2px solid #C6C6C6; direction: ltr" />
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center gap-1">
|
||||
<input type="text" class="form-control m-0 py-0 dateInput"
|
||||
name="FromDate[]"
|
||||
value=""
|
||||
style="width: 110px; height: 30px; text-align: center; font-size: 14px; color: #5C5C5C; font-weight: 500; border: 2px solid #C6C6C6; direction: ltr" />
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center cusRemove">
|
||||
<svg width="21" height="21" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16.5" height="16.5" transform="translate(0.25 0.214844)" fill="#F2B3B3"/>
|
||||
<path d="M6.78125 10.1836L6.78125 8.12109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M10.2188 10.1836L10.2187 8.12109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M2.3125 4.68359H14.6875V4.68359C14.3101 4.68359 14.1214 4.68359 13.9635 4.70899C13.1117 4.84606 12.4437 5.514 12.3066 6.36588C12.2812 6.52372 12.2812 6.71243 12.2812 7.08984V9.83984C12.2812 11.5137 12.2812 12.3506 11.8116 12.9088C11.7378 12.9965 11.6566 13.0776 11.5689 13.1514C11.0107 13.6211 10.1738 13.6211 8.5 13.6211V13.6211C6.82618 13.6211 5.98926 13.6211 5.43109 13.1514C5.34339 13.0776 5.2622 12.9965 5.18842 12.9088C4.71875 12.3506 4.71875 11.5137 4.71875 9.83984V7.08984C4.71875 6.71243 4.71875 6.52372 4.69335 6.36588C4.55628 5.514 3.88835 4.84606 3.03647 4.70899C2.87862 4.68359 2.68992 4.68359 2.3125 4.68359V4.68359Z" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
<path d="M6.78125 2.62126C6.78125 2.62126 7.125 1.93359 8.5 1.93359C9.875 1.93359 10.2188 2.62109 10.2188 2.62109" stroke="#F63D3D" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
@@ -145,4 +164,15 @@ $('#initialDateInput').on('input', function () {
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
$('.dateInput').val($(this).val());
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.cusRemove', function () {
|
||||
$(this).closest('.TaleRowCell').remove();
|
||||
updateRowIndexes();
|
||||
});
|
||||
|
||||
function updateRowIndexes() {
|
||||
$('.btn-card').each(function (index) {
|
||||
$(this).text(index + 1);
|
||||
});
|
||||
}
|
||||
@@ -804,6 +804,8 @@ function saveDataLocal() {
|
||||
saveData['Command.FridayWork'] = FridayWork;
|
||||
saveData['Command.HolidayWork'] = HolidayWork;
|
||||
|
||||
console.log(saveData);
|
||||
|
||||
//data.push({ name: 'Command.BreakTime.HasBreakTimeValue', value: hasBreakTime });
|
||||
//data.push({ name: 'Command.BreakTime.BreakTimeValue', value: breakTimeValue });
|
||||
//data.push({ name: 'Command.FridayWork', value: FridayWork });
|
||||
|
||||
@@ -504,6 +504,7 @@
|
||||
|
||||
updateRemoveButtons();
|
||||
updateRemoveButtonsRS();
|
||||
saveDataLocal();
|
||||
});
|
||||
|
||||
function updateRemoveButtons() {
|
||||
@@ -772,10 +773,29 @@ async function ajaxSaveSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnSave').addClass('disable');
|
||||
$('#finalSaveRollCallSetting').addClass('disable');
|
||||
saveDataLocal();
|
||||
postChangeEditGroup();
|
||||
|
||||
//try {
|
||||
// const responseCheckCal = await checkEmployeeSettingsHasChangedValue(saveData);
|
||||
|
||||
// if (responseCheckCal) {
|
||||
// $('#ConfirmModal').show();
|
||||
// } else {
|
||||
// postChangeEditGroup();
|
||||
// }
|
||||
|
||||
//} catch (err) {
|
||||
// console.log(err);
|
||||
//}
|
||||
}
|
||||
|
||||
// save all data
|
||||
var saveData = {};
|
||||
function saveDataLocal() {
|
||||
//$('#btnSave').addClass('disable');
|
||||
//$('#finalSaveRollCallSetting').addClass('disable');
|
||||
|
||||
var data = $('#edit-form').serializeArray();
|
||||
|
||||
var hasBreakTime = "false";
|
||||
if ($('#BreakTime').prop('checked')) {
|
||||
@@ -787,9 +807,7 @@ async function ajaxSaveSubmit() {
|
||||
var breakTimeValue = $("#TimeOnly").val();
|
||||
var isShiftChanged = $('#YesConfirm').prop("checked") ? "true" : "false";
|
||||
|
||||
//console.log(breakTimeValue);
|
||||
//return;
|
||||
|
||||
|
||||
var FridayWork = "Default";
|
||||
if ($('#Friday1').prop('checked')) {
|
||||
FridayWork = "Default";
|
||||
@@ -806,70 +824,75 @@ async function ajaxSaveSubmit() {
|
||||
}
|
||||
|
||||
|
||||
data.push({ name: 'BreakTime.HasBreakTimeValue', value: hasBreakTime });
|
||||
data.push({ name: 'BreakTime.BreakTimeValue', value: breakTimeValue });
|
||||
data.push({ name: 'FridayWork', value: FridayWork });
|
||||
data.push({ name: 'HolidayWork', value: HolidayWork });
|
||||
var formData = $('#edit-form').serializeArray();
|
||||
|
||||
data.push({ name: 'IsShiftChanged', value: isShiftChanged });
|
||||
formData.forEach(function (item) {
|
||||
saveData[item.name] = item.value;
|
||||
});
|
||||
|
||||
saveData['BreakTime.HasBreakTimeValue'] = hasBreakTime;
|
||||
saveData['BreakTime.BreakTimeValue'] = breakTimeValue;
|
||||
saveData['FridayWork'] = FridayWork;
|
||||
saveData['HolidayWork'] = HolidayWork;
|
||||
saveData['IsShiftChanged'] = isShiftChanged;
|
||||
}
|
||||
|
||||
|
||||
async function postChangeEditGroup() {
|
||||
|
||||
var requestData = $.param(data);
|
||||
$('#ConfirmRecalculationLoading').show();
|
||||
$('.btn-confirm').addClass('disable');
|
||||
|
||||
var command = [];
|
||||
|
||||
|
||||
var commandGroup = [];
|
||||
|
||||
$('input[name="EmployeeId[]"]').each(function (index) {
|
||||
var employeeId = $(this).val();
|
||||
var fromDate = $('input[name="FromDate[]"]').eq(index).val();
|
||||
|
||||
commandGroup.push({
|
||||
EmployeeId: employeeId,
|
||||
FromDate: fromDate
|
||||
$('[name="EmployeeId[]"]').each(function (index) {
|
||||
command.push({
|
||||
EmployeeId: $(this).val(),
|
||||
FromDate: $('[name="FromDate[]"]').eq(index).val()
|
||||
});
|
||||
});
|
||||
|
||||
// console.log(commandGroup);
|
||||
const response = await $.ajax({
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
url: ajaxEditGroupSave,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
data: { ...saveData, reCalculateCommand: command }
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await $.ajax({
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
url: ajaxEditGroupSave,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
data: requestData
|
||||
});
|
||||
if (response.success) {
|
||||
isShiftChangedGlobal = true;
|
||||
|
||||
if (response.success) {
|
||||
//const responseSaveCal = await saveReCalculateValues(commandGroup);
|
||||
//if (responseSaveCal) {
|
||||
// loadDataAjax();
|
||||
// $('#btn-register').addClass('disable');
|
||||
// $('#MainModal').modal('hide');
|
||||
//}
|
||||
loadDataAjax();
|
||||
$('#btnSave').removeClass('disable');
|
||||
$('#btn-register').addClass('disable');
|
||||
$('#MainModal').modal('hide');
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
$('#btn-register').removeClass('disable');
|
||||
$('#finalSaveRollCallSetting').removeClass('disable');
|
||||
}
|
||||
} catch (err) {
|
||||
$('#btn-register').removeClass('disable');
|
||||
$('#finalSaveRollCallSetting').removeClass('disable');
|
||||
console.log(err);
|
||||
|
||||
$('.alert-success-msg').show();
|
||||
$('.alert-success-msg p').text(response.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();
|
||||
$('.btn-confirm').removeClass('disable');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function saveReCalculateValues(command) {
|
||||
|
||||
var btnConfirm = $('.btn-confirm').addClass('disable');
|
||||
|
||||
Reference in New Issue
Block a user