CWS RolCall Changed

This commit is contained in:
SamSys
2025-01-04 18:49:34 +03:30
parent 0feba76fb4
commit 805f33fe0f
48 changed files with 11076 additions and 1822 deletions

View File

@@ -13,7 +13,7 @@ public class BaseCustomizeEntity : EntityBase
public BaseCustomizeEntity(FridayPay fridayPay, OverTimePay overTimePay,
BaseYearsPay baseYearsPay, BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
FridayWork fridayWork, HolidayWork holidayWork, BreakTime breakTime)
FridayWork fridayWork, HolidayWork holidayWork, BreakTime breakTime,int leavePermittedDays)
{
FridayPay = fridayPay;
@@ -32,6 +32,7 @@ public class BaseCustomizeEntity : EntityBase
FridayWork = fridayWork;
HolidayWork = holidayWork;
BreakTime = breakTime;
LeavePermittedDays = leavePermittedDays;
}
/// <summary>
@@ -109,6 +110,11 @@ public class BaseCustomizeEntity : EntityBase
/// </summary>
public HolidayWork HolidayWork { get; protected set; }
/// <summary>
/// تعداد روز های مجاز برای مرخصی
/// </summary>
public int LeavePermittedDays { get; protected set; }
public BreakTime BreakTime { get; protected set; }
public BreakTime BreakTime { get; protected set; }
}

View File

@@ -2,18 +2,18 @@
public enum EarlyExitType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به ازای هر دقیقه تعجیل به نسبت حقوق دریافتی از حقوق پرسنل کسر میگردد
/// </summary>
Default,
/// <summary>
/// به ازای هر دقیقه تعجیل به نسبت حقوق دریافتی از حقوق پرسنل کسر میگردد
/// </summary>
Default,
/// <summary>
/// در صورت تعجیل به ازای هر دقیقه مبلغی از مزد روزانه کسر میشود
/// </summary>
MoneyPerMinute
/// <summary>
/// در صورت تعجیل به ازای هر دقیقه مبلغی از مزد روزانه کسر میشود
/// </summary>
MoneyPerMinute
}

View File

@@ -6,10 +6,10 @@ public enum FridayPayType
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// اضافه کار محاسبه میشود
/// </summary>
ExtraWorking,
///// <summary>
///// اضافه کار محاسبه میشود
///// </summary>
//ExtraWorking,
/// <summary>
/// به صورت درصدی از مزد روزانه به ازای هر ساعت کار در جمعه
/// </summary>

View File

@@ -2,18 +2,18 @@
public enum LateToWorkType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به ازای هر دقیقه تاخیر به نسبت حقوق دریافتی از حقوق پرسنل کسر میگردد
/// </summary>
Default,
/// <summary>
/// به ازای هر دقیقه تاخیر به نسبت حقوق دریافتی از حقوق پرسنل کسر میگردد
/// </summary>
Default,
/// <summary>
/// در صورت تاخیر به ازای هر دقیقه مبلغی از مزد روزانه کسر میشود
/// </summary>
MoneyPerMinute
/// <summary>
/// در صورت تاخیر به ازای هر دقیقه مبلغی از مزد روزانه کسر میشود
/// </summary>
MoneyPerMinute
}

View File

@@ -10,5 +10,10 @@ public enum WorkshopShiftStatus
/// <summary>
/// نامنظم
/// </summary>
Irregular
Irregular,
/// <summary>
/// چرخشی
/// </summary>
Rotating
}

View File

@@ -0,0 +1,24 @@
using System;
using Microsoft.AspNetCore.Authentication;
namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
public record CustomizeRotatingShift
{
public CustomizeRotatingShift(TimeOnly startTime,TimeOnly endTime)
{
StartTime = startTime;
EndTime = endTime;
}
public TimeOnly StartTime { get; set; }
public TimeOnly EndTime { get; set; }
public virtual bool Equals(CustomizeRotatingShift other)
{
if (StartTime==other.StartTime && EndTime == other.EndTime)
{
return true;
}
return false;
}
}

View File

@@ -10,203 +10,214 @@ using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.EmployeeAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
{
private CustomizeWorkshopEmployeeSettings()
{
private CustomizeWorkshopEmployeeSettings()
{
}
public CustomizeWorkshopEmployeeSettings(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, long employeeId,
long workshopId, double salary, long customizeWorkshopGroupSettingId,
ICollection<CustomizeWorkshopEmployeeSettingsShift> customizeWorkshopEmployeeSettingsShifts,
FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime) : base(fridayPay, overTimePay,
baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, fridayWork, holidayWork, breakTime)
{
CustomizeWorkshopEmployeeSettingsShifts = EmployeeSettingsShiftsConvertor(customizeWorkshopEmployeeSettingsShifts);
}
public CustomizeWorkshopEmployeeSettings(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, long employeeId,
long workshopId, double salary, long customizeWorkshopGroupSettingId,
ICollection<CustomizeWorkshopEmployeeSettingsShift> customizeWorkshopEmployeeSettingsShifts,
FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
base(fridayPay, overTimePay,
baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
{
CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId;
IsSettingChanged = false;
IsShiftChanged = false;
EmployeeId = employeeId;
WorkshopId = workshopId;
Salary = salary;
WorkshopShiftStatus = workshopShiftStatus;
CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId;
CustomizeWorkshopEmployeeSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? EmployeeSettingsShiftsConvertor(customizeWorkshopEmployeeSettingsShifts) : [];
IsSettingChanged = false;
IsShiftChanged = false;
EmployeeId = employeeId;
WorkshopId = workshopId;
Salary = salary;
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
public IrregularShift IrregularShift { get; set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; private set; }
public long EmployeeId { get; private set; }
public long WorkshopId { get; private set; }
public double Salary { get; private set; }
public bool IsShiftChanged { get; private set; }
public bool IsSettingChanged { get; private set; }
public long CustomizeWorkshopGroupSettingId { get; set; }
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
public ICollection<CustomizeWorkshopEmployeeSettingsShift> CustomizeWorkshopEmployeeSettingsShifts { get; set; }
public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; }
public IrregularShift IrregularShift { get; set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; private set; }
public long EmployeeId { get; private set; }
public long WorkshopId { get; private set; }
public double Salary { get; private set; }
public bool IsShiftChanged { get; private set; }
public bool IsSettingChanged { get; private set; }
public long CustomizeWorkshopGroupSettingId { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettingsShift> CustomizeWorkshopEmployeeSettingsShifts { get; set; }
public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; }
/// <summary>
/// تغییر مقادیر تنظیمات پرسنل
/// </summary>
/// <param name="customizeWorkshopEmployeeSettingsShifts">شیفت های کاری پرسنل</param>
/// <param name="salary"> حقوق ماهیانه اختصاص داده شده</param>
/// <param name="fridayPay">جمعه کاری</param>
/// <param name="overTimePay">اضافه کاری</param>
/// <param name="baseYearsPay">سنوات</param>
/// <param name="bonusesPay">عیدی</param>
/// <param name="nightWorkPay">شب کاری</param>
/// <param name="marriedAllowance">حق تاهل</param>
/// <param name="shiftPay">نوبت کاری</param>
/// <param name="familyAllowance">حق اولاد</param>
/// <param name="leavePay">مزد مرخصی</param>
/// <param name="insuranceDeduction">حق بیمه</param>
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
/// <param name="lateToWork">تاخیر در ورود</param>
/// <param name="earlyExit">تعجیل درخروج</param>
/// <param name="fridayWork">آیا در روز های جمعه موظف به کار است</param>
/// <param name="holidayWork">آیا در تعطیلات رسمی موظف به کار است</param>
/// <param name="workshopIrregularShifts">نوع شیفت کاری </param>
/// <param name="workshopShiftStatus">آیا شیفت منظم است یا نا منظم</param>
/// <param name="isSettingChange"></param>
public void EditEmployees(double salary, FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, bool isSettingChange)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
/// <summary>
/// تغییر مقادیر تنظیمات پرسنل
/// </summary>
/// <param name="customizeWorkshopEmployeeSettingsShifts">شیفت های کاری پرسنل</param>
/// <param name="salary"> حقوق ماهیانه اختصاص داده شده</param>
/// <param name="fridayPay">جمعه کاری</param>
/// <param name="overTimePay">اضافه کاری</param>
/// <param name="baseYearsPay">سنوات</param>
/// <param name="bonusesPay">عیدی</param>
/// <param name="nightWorkPay">شب کاری</param>
/// <param name="marriedAllowance">حق تاهل</param>
/// <param name="shiftPay">نوبت کاری</param>
/// <param name="familyAllowance">حق اولاد</param>
/// <param name="leavePay">مزد مرخصی</param>
/// <param name="insuranceDeduction">حق بیمه</param>
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
/// <param name="lateToWork">تاخیر در ورود</param>
/// <param name="earlyExit">تعجیل درخروج</param>
/// <param name="fridayWork">آیا در روز های جمعه موظف به کار است</param>
/// <param name="holidayWork">آیا در تعطیلات رسمی موظف به کار است</param>
/// <param name="workshopIrregularShifts">نوع شیفت کاری </param>
/// <param name="workshopShiftStatus">آیا شیفت منظم است یا نا منظم</param>
/// <param name="isSettingChange"></param>
public void EditEmployees(double salary, FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, bool isSettingChange, int leavePermittedDays)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
Salary = salary;
IsSettingChanged = isSettingChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
}
Salary = salary;
IsSettingChanged = isSettingChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
LeavePermittedDays = leavePermittedDays;
}
public void SimpleEdit(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift,
IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange,HolidayWork holidayWork,FridayWork fridayWork)
{
CustomizeWorkshopEmployeeSettingsShifts = EmployeeSettingsShiftsConvertor(employeeSettingsShift);
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChanged = isShiftChange;
WorkshopShiftStatus = workshopShiftStatus;
HolidayWork = holidayWork;
FridayWork = fridayWork;
public void SimpleEdit(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift,
IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork,
ICollection<CustomizeRotatingShift> rotatingShifts)
{
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChanged = isShiftChange;
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
CustomizeWorkshopEmployeeSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? EmployeeSettingsShiftsConvertor(employeeSettingsShift) : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
FridayWork = fridayWork;
HolidayWork = holidayWork;
}
private List<CustomizeWorkshopEmployeeSettingsShift> EmployeeSettingsShiftsConvertor(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift)
{
var customizeWorkshopSettingShiftsList =
employeeSettingsShift.ToList(); // Handle the special case where there's only one shift
if (customizeWorkshopSettingShiftsList.Count == 1)
{
var singleShift = customizeWorkshopSettingShiftsList.First();
return new List<CustomizeWorkshopEmployeeSettingsShift>
{
new CustomizeWorkshopEmployeeSettingsShift(singleShift.StartTime, singleShift.EndTime,
singleShift.Placement, TimeOnly.MaxValue)
};
}
private List<CustomizeWorkshopEmployeeSettingsShift> EmployeeSettingsShiftsConvertor(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift)
{
var customizeWorkshopSettingShiftsList =
employeeSettingsShift.ToList();
// Handle the special case where there's only one shift
if (customizeWorkshopSettingShiftsList.Count == 1)
{
var singleShift = customizeWorkshopSettingShiftsList.First();
return new List<CustomizeWorkshopEmployeeSettingsShift>
{
new CustomizeWorkshopEmployeeSettingsShift(singleShift.StartTime, singleShift.EndTime,
singleShift.Placement, TimeOnly.MaxValue)
};
}
return customizeWorkshopSettingShiftsList.Select((x, index) =>
{
return customizeWorkshopSettingShiftsList.Select((x, index) =>
{
if (index == 0)
{
return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement);
if (index == 0)
{
return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement);
}
}
// Ensure no more than three shifts
if (index >= 3)
{
throw new InvalidDataException("شیفت های پرسنل نمیتواند بیشتر از سه تا باشد");
}
// Ensure no more than three shifts
if (index >= 3)
{
throw new InvalidDataException("شیفت های پرسنل نمیتواند بیشتر از سه تا باشد");
}
var previousShift = customizeWorkshopSettingShiftsList[index - 1];
var nextStart = new DateTime(DateOnly.MinValue, x.StartTime);
var previousEnd = new DateTime(DateOnly.MinValue, previousShift.EndTime);
if (nextStart < previousEnd)
{
nextStart = nextStart.AddDays(1);
}
var previousShift = customizeWorkshopSettingShiftsList[index - 1];
var nextStart = new DateTime(DateOnly.MinValue, x.StartTime);
var previousEnd = new DateTime(DateOnly.MinValue, previousShift.EndTime);
if (nextStart < previousEnd)
{
nextStart = nextStart.AddDays(1);
}
var differenceTimeSpan = nextStart - previousEnd;
var oneThirdOfDifference = (differenceTimeSpan / 3) * 2;
var previousTimeThreshold = TimeOnly.FromDateTime(previousEnd.AddTicks(oneThirdOfDifference.Ticks));
return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement,
previousTimeThreshold);
}).ToList();
var differenceTimeSpan = nextStart - previousEnd;
var oneThirdOfDifference = (differenceTimeSpan / 3) * 2;
var previousTimeThreshold = TimeOnly.FromDateTime(previousEnd.AddTicks(oneThirdOfDifference.Ticks));
return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement,
previousTimeThreshold);
}).ToList();
}
}
private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay
, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = new(fridayPay.FridayPayType, fridayPay.Value);
OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value);
BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType);
BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType);
NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value);
MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value);
ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value);
FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value);
LeavePay = new(leavePay.LeavePayType, leavePay.Value);
InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value);
FineAbsenceDeduction = new(
fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value,
fineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork = new(
lateToWork.LateToWorkType,
lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), lateToWork.Value
);
EarlyExit = new(earlyExit.EarlyExitType,
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), earlyExit.Value);
}
private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay
, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = new(fridayPay.FridayPayType, fridayPay.Value);
OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value);
BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType);
BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType);
NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value);
MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value);
ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value);
FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value);
LeavePay = new(leavePay.LeavePayType, leavePay.Value);
InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value);
FineAbsenceDeduction = new(
fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value,
fineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork = new(
lateToWork.LateToWorkType,
lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), lateToWork.Value
);
EarlyExit = new(earlyExit.EarlyExitType,
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), earlyExit.Value);
}
}

View File

@@ -1,4 +1,4 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;

View File

@@ -9,9 +9,9 @@ public interface ICustomizeWorkshopEmployeeSettingsRepository : IRepository<long
{
EditCustomizeEmployeeSettings GetCustomizeEmployeeSettingsDetails(long customizeEmployeeId);
CustomizeWorkshopEmployeeSettings GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(long workshopId, long employeeId);
CustomizeWorkshopEmployeeSettings GetByEmployeeIdGroupSettingsId(long workshopId, long employeeId);
void Remove(long id);
List<CustomizeWorkshopEmployeeSettings> GetBy(long groupId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingNotInMainGroup(long entityWorkshopId);
}

View File

@@ -9,6 +9,7 @@ using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Leave;
using Newtonsoft.Json.Serialization;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
@@ -27,20 +28,25 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork,
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift) : base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, fridayWork, holidayWork, breakTime)
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
private void GuardGroupShifts(ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts)
{
@@ -60,6 +66,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
public IrregularShift IrregularShift { get; set; }
public ICollection<CustomizeWorkshopGroupSettingsShift> CustomizeWorkshopGroupSettingsShifts { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettingsCollection { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
@@ -70,8 +77,8 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId,BreakTime breakTime)
HolidayWork holidayWork, IrregularShift irregularShift, ICollection<CustomizeRotatingShift> rotatingShifts,
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays)
{
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
GroupName = "اصلی";
@@ -91,11 +98,15 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
LeavePermittedDays = leavePermittedDays;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
MainGroup = true;
BreakTime = breakTime;
@@ -112,7 +123,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange)
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
@@ -132,6 +143,8 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
FridayWork = fridayWork;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
@@ -141,7 +154,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false);
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false, leavePermittedDays);
}
}
public void EditAndOverwriteOnAllEmployees(string groupName, double salary,
@@ -149,26 +162,18 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange)
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
GroupName = groupName;
Salary = salary;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
@@ -177,7 +182,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false);
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false, leavePermittedDays);
}
}
@@ -190,18 +195,23 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable<long> employeeIds,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus,
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,HolidayWork holidayWork , FridayWork fridayWork)
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
if (isShiftChange)
@@ -210,35 +220,49 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
}
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.id));
foreach (var item in permittedToOverWrite)
{
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
IrregularShift, WorkshopShiftStatus, BreakTime, false,holidayWork, fridayWork);
IrregularShift, WorkshopShiftStatus, BreakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
public void EditSimpleAndOverwriteOnAllEmployees(string groupName,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange)
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
HolidayWork = holidayWork;
FridayWork = fridayWork;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
foreach (var item in CustomizeWorkshopEmployeeSettingsCollection)
{
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
irregularShift, workshopShiftStatus, breakTime, false,HolidayWork,FridayWork);
irregularShift, workshopShiftStatus, breakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
@@ -275,16 +299,48 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
IrregularShift.WorkshopIrregularShifts);
BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue);
var rotatingShift = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)).ToList();
var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, employeeId, workshopId, Salary, id, shifts, FridayWork, HolidayWork, irregularShift,
WorkshopShiftStatus, breakTime);
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift);
CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings);
}
private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay
, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = new(fridayPay.FridayPayType, fridayPay.Value);
OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value);
BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType);
BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType);
NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value);
MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value);
ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value);
FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value);
LeavePay = new(leavePay.LeavePayType, leavePay.Value);
InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value);
FineAbsenceDeduction = new(
fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value,
fineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork = new(
lateToWork.LateToWorkType,
lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), lateToWork.Value
);
EarlyExit = new(earlyExit.EarlyExitType,
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), earlyExit.Value);
}
//public void OverWriteEmployeesShiftAndSalary(IEnumerable<long> ids,ICollection<RollCallWorkshopEmployeeSettingsShift> employeeSettingsShifts,double salary)

View File

@@ -10,7 +10,7 @@ public interface ICustomizeWorkshopGroupSettingsRepository : IRepository<long, C
{
CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id);
CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId);
List<EmployeeViewModel> GetEmployeesWithoutGroup(long workshopId);
List<EmployeeViewModel> GetEmployeesWithoutGroup(long workshopSettingsId);
List<EmployeeViewModel> GetEmployeesWithoutGroupByWorkshopId(long workshopId);
CustomizeWorkshopGroupSettings GetWithEmployees(long groupId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId);

View File

@@ -17,7 +17,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
public CustomizeWorkshopSettings(long workshopId,
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts, int leavePermittedDays,
WorkshopShiftStatus workshopShiftStatus)
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
{
FridayPay = new FridayPay(FridayPayType.None, 0);
OverTimePay = new OverTimePay(OverTimePayType.None, 0);
@@ -38,8 +38,8 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
OverTimeThresholdMinute = 0;
Currency = Currency.Rial;
MaxMonthDays = MaxMonthDays.Default;
FridayWork = FridayWork.Default;
HolidayWork = HolidayWork.Default;
FridayWork = fridayWork;
HolidayWork = holidayWork;
BonusesPaysInEndOfMonth = BonusesPaysInEndOfYear.EndOfYear;
WorkshopShiftStatus = workshopShiftStatus;
@@ -69,10 +69,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
public MaxMonthDays MaxMonthDays { get; private set; }
/// <summary>
/// تعداد روز های مجاز برای مرخصی
/// </summary>
public int LeavePermittedDays { get; private set; }
/// <summary>
/// آیا عیدی همیشه آخر سال تعلق میگیره یا در زمان ترک کار هم تعلق میگیره
@@ -129,26 +126,26 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
Currency = currency;
}
public void ChangeWorkshopShifts(ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts,
WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork)
{
WorkshopShiftStatus = workshopShiftStatus;
public void ChangeWorkshopShifts(ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts,
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
{
WorkshopShiftStatus = workshopShiftStatus;
HolidayWork = holidayWork;
FridayWork = fridayWork;
CustomizeWorkshopSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopSettingsShifts : new List<CustomizeWorkshopSettingsShift>();
if (workshopShiftStatus == WorkshopShiftStatus.Regular)
{
var date = new DateOnly();
var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime);
var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime);
CustomizeWorkshopSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopSettingsShifts : new List<CustomizeWorkshopSettingsShift>();
if (workshopShiftStatus == WorkshopShiftStatus.Regular)
{
var date = new DateOnly();
var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime);
var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime);
if (lastEndShift > firstStartShift)
firstStartShift = firstStartShift.AddDays(1);
var offSet = (firstStartShift - lastEndShift).Divide(2);
EndTimeOffSet = TimeOnly.FromDateTime(lastEndShift.Add(offSet));
}
}
}
}

View File

@@ -1,25 +1,25 @@
using System.Collections.Generic;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using System.Collections.Generic;
namespace Company.Domain.CustomizeWorkshopSettingsAgg;
public interface ICustomizeWorkshopSettingsRepository : IRepository<long, CustomizeWorkshopSettings>
{
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId);
CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId,
long employeeId);
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId);
EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId);
EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId);
EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId);
List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId);
CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId);
#region Pooya
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId);
#endregion
}

View File

@@ -1,6 +1,7 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
using System.Security.AccessControl;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
@@ -15,4 +16,5 @@ public class CreateCustomizeEmployeeSettings
public WorkshopShiftStatus WorkshopShiftStatus { get; set; }
public IrregularShift IrregularShift { get; set; }
public int LeavePermittedDays { get; set; }
}

View File

@@ -7,6 +7,7 @@ namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CreateCustomizeWorkshopGroupSettings
{
public string Name { get; set; }
public string Salary { get; set; }
public long CustomizeWorkshopSettingId { get; set; }
@@ -17,4 +18,6 @@ public class CreateCustomizeWorkshopGroupSettings
public int LeavePermittedDays { get; set; }
public FridayWork FridayWork { get; set; }
public HolidayWork HolidayWork { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
}

View File

@@ -20,6 +20,17 @@ public class CreateCustomizeWorkshopSettings
public BreakTime BreakTime { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
}

View File

@@ -0,0 +1,9 @@
using System;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CustomizeRotatingShiftsViewModel
{
public string StartTime{ get; set; }
public string EndTime{ get; set; }
};

View File

@@ -1,8 +1,6 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using System;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
@@ -24,4 +22,5 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
public HolidayWork HolidayWork { get; set; }
public FridayWork FridayWork { get; set; }
public int LeavePermittedDays { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
}

View File

@@ -12,6 +12,10 @@ public class CustomizeWorkshopGroupSettingsViewModel
public bool MainGroup { get; set; }
public List<CustomizeWorkshopShiftViewModel> RollCallWorkshopShifts { get; set; }
public List<CustomizeWorkshopEmployeeSettingsViewModel> RollCallWorkshopEmployeesSettings { get; set; }
public List<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; set; }
public IrregularShift IrregularShift { get; set; }
public BreakTime BreakTime { get; set; }
public FridayWork FridayWork { get; set; }
public HolidayWork HolidayWork { get; set; }
}

View File

@@ -1,5 +1,5 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using System.Collections.Generic;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
@@ -7,6 +7,6 @@ public class CustomizeWorkshopSettingsViewModel
{
public long Id { get; set; }
public string Name { get; set; }
public List<CustomizeWorkshopGroupSettingsViewModel> GroupSettings { get; set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; set; }
public List<CustomizeWorkshopGroupSettingsViewModel> GroupSettings { get; set; }
}

View File

@@ -89,5 +89,6 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
public bool IsShiftChanged { get; set; }
public bool IsSettingChanged { get; set; }
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftViewModel { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShifts{ get; set; }
public BreakTime BreakTime { get; set; }
}

View File

@@ -1,90 +1,90 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class EditCustomizeWorkshopGroupSettings : CreateCustomizeWorkshopGroupSettings
{
public long Id { get; set; }
public List<long> EmployeeIds { get; set; }
public long Id { get; set; }
public List<long> EmployeeIds { get; set; }
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPayViewModel FridayPay { get; set; }
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPayViewModel FridayPay { get; set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePayViewModel OverTimePay { get; set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPayViewModel BaseYearsPay { get; set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePayViewModel OverTimePay { get; set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPayViewModel BonusesPay { get; set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPayViewModel BaseYearsPay { get; set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPayViewModel NightWorkPay { get; set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPayViewModel BonusesPay { get; set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowanceViewModel MarriedAllowance { get; set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPayViewModel NightWorkPay { get; set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPayViewModel ShiftPay { get; set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowanceViewModel MarriedAllowance { get; set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowanceViewModel FamilyAllowance { get; set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPayViewModel ShiftPay { get; set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePayViewModel LeavePay { get; set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowanceViewModel FamilyAllowance { get; set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeductionViewModel InsuranceDeduction { get; set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePayViewModel LeavePay { get; set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeductionViewModel InsuranceDeduction { get; set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWorkViewModel LateToWork { get; set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExitViewModel EarlyExit { get; set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWorkViewModel LateToWork { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExitViewModel EarlyExit { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
public bool IsShiftChanged { get; set; }
public bool IsSettingChanged { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
public bool IsShiftChanged { get; set; }
public bool IsSettingChanged { get; set; }
}

View File

@@ -81,15 +81,6 @@ public class EditCustomizeWorkshopSettings : CreateCustomizeWorkshopSettings
public EarlyExitViewModel EarlyExit { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
/// <summary>
/// آیا عیدی همیشه آخر سال تعلق میگیره یا در زمان ترک کار هم تعلق میگیره

View File

@@ -41,6 +41,8 @@ public interface ICustomizeWorkshopSettingsApplication
OperationResult AddEmployeeToMainGroupSettings(long workshopId, long employeeId);
OperationResult CreateEmployeesSettingsAndSetChanges(EditCustomizeEmployeeSettings command);
/// <summary>
/// این متد تاریخ شیفت تنظیمات کارگاه را تغییر میدهد
/// </summary>
@@ -50,13 +52,11 @@ public interface ICustomizeWorkshopSettingsApplication
/// <param name="workshopShiftStatus"></param>
/// <returns></returns>
OperationResult EditWorkshopSettingShifts(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork);
long customizeWorkshopSettingsId,WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork);
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdWorkshopId(long workshopId,
long employeeId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId);
@@ -65,8 +65,6 @@ public interface ICustomizeWorkshopSettingsApplication
CustomizeWorkshopEmployeeSettingsViewModel GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(long workshopId, long employeeId);
CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdGroupSettingsId(long workshopId, long employeeId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId);
EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId);
@@ -78,7 +76,9 @@ public interface ICustomizeWorkshopSettingsApplication
/// <returns></returns>
EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId);
EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId);
CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId);
EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId);
EditCustomizeEmployeeSettings GetCustomizeEmployeeSettingsDetails(long customizeEmployeeId);

View File

@@ -228,5 +228,7 @@ public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration
});
builder.OwnsMany(x => x.CustomizeRotatingShifts);
}
}

View File

@@ -227,6 +227,9 @@ public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration<Cu
});
builder.OwnsMany(x => x.CustomizeRotatingShifts);
builder.HasOne(x => x.CustomizeWorkshopSettings).WithMany(x => x.CustomizeWorkshopGroupSettingsCollection)
.HasForeignKey(x => x.CustomizeWorkshopSettingId);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class CWS_Daltons : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "LeavePermittedDays",
table: "CustomizeWorkshopGroupSettings",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "LeavePermittedDays",
table: "CustomizeWorkshopEmployeeSettings",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings_CustomizeRotatingShifts",
columns: table => new
{
CustomizeWorkshopEmployeeSettingsid = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<TimeOnly>(type: "time", nullable: false),
EndTime = table.Column<TimeOnly>(type: "time", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_CustomizeRotatingShifts", x => new { x.CustomizeWorkshopEmployeeSettingsid, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_CustomizeRotatingShifts_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopEmployeeSetting~",
column: x => x.CustomizeWorkshopEmployeeSettingsid,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings_CustomizeRotatingShifts",
columns: table => new
{
CustomizeWorkshopGroupSettingsid = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<TimeOnly>(type: "time", nullable: false),
EndTime = table.Column<TimeOnly>(type: "time", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_CustomizeRotatingShifts", x => new { x.CustomizeWorkshopGroupSettingsid, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_CustomizeRotatingShifts_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingsid",
column: x => x.CustomizeWorkshopGroupSettingsid,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings_CustomizeRotatingShifts");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings_CustomizeRotatingShifts");
migrationBuilder.DropColumn(
name: "LeavePermittedDays",
table: "CustomizeWorkshopGroupSettings");
migrationBuilder.DropColumn(
name: "LeavePermittedDays",
table: "CustomizeWorkshopEmployeeSettings");
}
}
}

View File

@@ -989,6 +989,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool>("IsShiftChanged")
.HasColumnType("bit");
b.Property<int>("LeavePermittedDays")
.HasColumnType("int");
b.Property<double>("Salary")
.HasColumnType("float");
@@ -1041,6 +1044,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool>("IsShiftChange")
.HasColumnType("bit");
b.Property<int>("LeavePermittedDays")
.HasColumnType("int");
b.Property<bool>("MainGroup")
.HasColumnType("bit");
@@ -5419,6 +5425,31 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("CustomizeWorkshopEmployeeSettingsid");
});
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.CustomizeRotatingShift", "CustomizeRotatingShifts", b1 =>
{
b1.Property<long>("CustomizeWorkshopEmployeeSettingsid")
.HasColumnType("bigint");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
b1.Property<TimeOnly>("EndTime")
.HasColumnType("time");
b1.Property<TimeOnly>("StartTime")
.HasColumnType("time");
b1.HasKey("CustomizeWorkshopEmployeeSettingsid", "Id");
b1.ToTable("CustomizeWorkshopEmployeeSettings_CustomizeRotatingShifts");
b1.WithOwner()
.HasForeignKey("CustomizeWorkshopEmployeeSettingsid");
});
b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 =>
{
b1.Property<long>("CustomizeWorkshopEmployeeSettingsid")
@@ -5794,6 +5825,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("BreakTime");
b.Navigation("CustomizeRotatingShifts");
b.Navigation("CustomizeWorkshopEmployeeSettingsShifts");
b.Navigation("CustomizeWorkshopGroupSettings");
@@ -5950,6 +5983,31 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("CustomizeWorkshopGroupSettingsid");
});
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.CustomizeRotatingShift", "CustomizeRotatingShifts", b1 =>
{
b1.Property<long>("CustomizeWorkshopGroupSettingsid")
.HasColumnType("bigint");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
b1.Property<TimeOnly>("EndTime")
.HasColumnType("time");
b1.Property<TimeOnly>("StartTime")
.HasColumnType("time");
b1.HasKey("CustomizeWorkshopGroupSettingsid", "Id");
b1.ToTable("CustomizeWorkshopGroupSettings_CustomizeRotatingShifts");
b1.WithOwner()
.HasForeignKey("CustomizeWorkshopGroupSettingsid");
});
b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 =>
{
b1.Property<long>("CustomizeWorkshopGroupSettingsid")
@@ -6325,6 +6383,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("BreakTime");
b.Navigation("CustomizeRotatingShifts");
b.Navigation("CustomizeWorkshopGroupSettingsShifts");
b.Navigation("CustomizeWorkshopSettings");

View File

@@ -74,7 +74,8 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
Value = entity.BaseYearsPay.Value
},
NightWorkPay = new() { NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
NightWorkPay = new()
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
MarriedAllowance = new()
{
@@ -90,12 +91,18 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
Salary = entity.Salary.ToMoney(),
ShiftViewModel = entity.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
new CustomizeWorkshopShiftViewModel()
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
{
EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement,
StartTime = x.StartTime.ToString("HH:mm")
}).ToList(),
WorkshopId = entity.WorkshopId,
EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName,
GroupId = entity.CustomizeWorkshopGroupSettingId,
IsSettingChanged = entity.IsSettingChanged,
IsShiftChanged = entity.IsShiftChanged
IsShiftChanged = entity.IsShiftChanged,
LeavePermittedDays = entity.LeavePermittedDays,
CustomizeRotatingShifts = entity.CustomizeRotatingShifts.Select(x => new CustomizeRotatingShiftsViewModel()
{ StartTime = x.StartTime.ToString("HH:mm"), EndTime = x.EndTime.ToString("HH:mm") }).ToList()
};
@@ -107,12 +114,6 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
}
public CustomizeWorkshopEmployeeSettings GetByEmployeeIdGroupSettingsId(long workshopId, long employeeId)
{
return _companyContext.CustomizeWorkshopEmployeeSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings).FirstOrDefault(x =>
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
}
public void Remove(long id)
{
var entity = Get(id);

View File

@@ -7,6 +7,7 @@ using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Company.Domain.RollCallEmployeeAgg;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
@@ -72,7 +73,7 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
public List<EmployeeViewModel> GetEmployeesWithoutGroupByWorkshopId(long workshopId)
{
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Where(x => x.WorkshopId == workshopId);
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Where(x=>x.WorkshopId==workshopId);
if (workshopSettings == null)
return new();
@@ -198,7 +199,11 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
Placement = z.Placement
}).ToList(),
IrregularShift = x.IrregularShift,
WorkshopShiftStatus = x.WorkshopShiftStatus
WorkshopShiftStatus = x.WorkshopShiftStatus,
LeavePermittedDays = x.LeavePermittedDays,
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
});
return joinedList.ToList();
}
@@ -277,7 +282,12 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.Select(x =>
new CustomizeWorkshopShiftViewModel()
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
LeavePermittedDays = entity.LeavePermittedDays,
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x=> new CustomizeRotatingShiftsViewModel()
{
EndTime = x.EndTime.ToString("HH:mm"),
StartTime = x.StartTime.ToString("HH:mm")
}).ToList()
};

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
@@ -10,6 +6,8 @@ using Company.Domain.EmployeeAgg;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
namespace CompanyManagment.EFCore.Repository
{
@@ -20,7 +18,7 @@ namespace CompanyManagment.EFCore.Repository
private readonly IAuthHelper _authHelper = authHelper;
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId,AuthViewModel auth)
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth)
{
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
@@ -29,12 +27,12 @@ namespace CompanyManagment.EFCore.Repository
if (entity == null)
return new();
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.Select(y => y.EmployeeId)
.ToList();
var employees = _employeeRepository.GetBy(employeeIds);
return new CustomizeWorkshopSettingsViewModel()
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.Select(y => y.EmployeeId)
.ToList();
var employees = _employeeRepository.GetBy(employeeIds);
return new CustomizeWorkshopSettingsViewModel()
{
Id = entity.id,
Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name,
@@ -76,68 +74,66 @@ namespace CompanyManagment.EFCore.Repository
}).ToList(),
MainGroup = x.MainGroup,
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.
Select(r=>new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm"), EndTime = r.EndTime.ToString("HH:mm")}).ToList()
}).ToList(),
};
}
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
{
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
.FirstOrDefault();
if (entity == null)
return new();
return new CustomizeWorkshopSettingsViewModel()
{
Id = entity.id,
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
new CustomizeWorkshopGroupSettingsViewModel()
{
Id = x.id,
GroupName = x.GroupName,
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
{
var employee = _employeeRepository.Get(y.EmployeeId);
return new CustomizeWorkshopEmployeeSettingsViewModel()
{
Id = y.id,
EmployeeId = y.EmployeeId,
IsSettingChanged = y.IsSettingChanged,
IsShiftChanged = y.IsShiftChanged,
Name = $"{employee.FName} {employee.LName}",
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime.ToString("HH:mm"),
Placement = s.Placement,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
Salary = y.Salary,
};
}).ToList(),
Salary = x.Salary,
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime.ToString("HH:mm"),
Placement = s.Placement,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
MainGroup = x.MainGroup
}).ToList(),
};
}
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId, long employeeId)
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
{
throw new NotImplementedException();
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery()
.FirstOrDefault();
if (entity == null)
return new();
return new CustomizeWorkshopSettingsViewModel()
{
Id = entity.id,
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
new CustomizeWorkshopGroupSettingsViewModel()
{
Id = x.id,
GroupName = x.GroupName,
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
{
var employee = _employeeRepository.Get(y.EmployeeId);
return new CustomizeWorkshopEmployeeSettingsViewModel()
{
Id = y.id,
EmployeeId = y.EmployeeId,
IsSettingChanged = y.IsSettingChanged,
IsShiftChanged = y.IsShiftChanged,
Name = $"{employee.FName} {employee.LName}",
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime.ToString("HH:mm"),
Placement = s.Placement,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
Salary = y.Salary,
};
}).ToList(),
Salary = x.Salary,
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime.ToString("HH:mm"),
Placement = s.Placement,
StartTime = s.StartTime.ToString("HH:mm")
}).ToList(),
MainGroup = x.MainGroup
}).ToList(),
};
}
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
{
@@ -228,6 +224,7 @@ namespace CompanyManagment.EFCore.Repository
}
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
{
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
@@ -276,7 +273,7 @@ namespace CompanyManagment.EFCore.Repository
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
{
var customizeWorkshopSettings = _companyContext.CustomizeWorkshopSettings
.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
.AsNoTracking().AsSplitQuery().Where(x => x.WorkshopId == workshopId)
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
.Select(x => new CustomizeWorkshopSettingsViewModel()
{
@@ -296,9 +293,14 @@ namespace CompanyManagment.EFCore.Repository
StartTime = s.StartTime.ToString("HH:mm"),
EndTime = s.EndTime.ToString("HH:mm"),
Placement = s.Placement,
}).ToList()
}).ToList(),
BreakTime = g.BreakTime,
HolidayWork = g.HolidayWork,
FridayWork = g.FridayWork
}).ToList(),
}).FirstOrDefault();
return customizeWorkshopSettings;
@@ -334,5 +336,41 @@ namespace CompanyManagment.EFCore.Repository
Salary = employee.Salary
};
}
#region Pooya
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId)
{
var query = _companyContext.CustomizeWorkshopGroupSettings.Where(x => x.MainGroup == false).Include(x => x)
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection).Where(x => x.CustomizeWorkshopEmployeeSettingsCollection.Any(y =>
y.WorkshopId == workshopId)).SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.Where(x => x.Salary > 0).Select(x =>
new CustomizeWorkshopEmployeeSettingsViewModel()
{
WorkshopShiftStatus = x.WorkshopShiftStatus,
Salary = x.Salary,
Id = x.id,
EmployeeId = x.EmployeeId,
BreakTime = x.BreakTime
});
return query.ToList();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId)
{
return _companyContext.CustomizeWorkshopSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId).Include(x => x.CustomizeWorkshopGroupSettingsCollection)
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).SelectMany(x => x.CustomizeWorkshopGroupSettingsCollection
.SelectMany(y => y.CustomizeWorkshopEmployeeSettingsCollection))
.Select(x => new CustomizeWorkshopEmployeeSettingsViewModel
{
BreakTime = x.BreakTime,
IsShiftChanged = x.IsShiftChanged,
IsSettingChanged = x.IsSettingChanged,
EmployeeId = x.EmployeeId,
Id = x.id,
Salary = x.Salary,
GroupSettingsId = x.CustomizeWorkshopGroupSettingId
}).ToList();
}
#endregion
}
}

View File

@@ -1443,13 +1443,13 @@ CreateWorkingHoursTemp command, long leavId)
fridayPayAmount = percentageAmount * workedFridaysHours;
break;
}
case (FridayPayType.ExtraWorking):
{
var fridayOvertimeTimeSpan = CalculateFridayWorkingTimeSpanWithoutOvertime(rollCallResult, shiftSettings);
overtimePayAmount += CalculateOvertimePay(fridayOvertimeTimeSpan, customizeWorkshopEmployeeSettings.OverTimePay, dailyWage);
return overtimePayAmount;
break;
}
//case (FridayPayType.ExtraWorking):
// {
// var fridayOvertimeTimeSpan = CalculateFridayWorkingTimeSpanWithoutOvertime(rollCallResult, shiftSettings);
// overtimePayAmount += CalculateOvertimePay(fridayOvertimeTimeSpan, customizeWorkshopEmployeeSettings.OverTimePay, dailyWage);
// return overtimePayAmount;
// break;
// }
default:
break;
}

View File

@@ -11,10 +11,12 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc.Formatters;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Infrastructure;
namespace ServiceHost.Areas.Client.Pages.Company.RollCall
{
[Authorize]
[NeedsPermission(SubAccountPermissionHelper.GroupingOperationsPermissionCode)]
public class GroupingModel : PageModel
{
private readonly IPasswordHasher _passwordHasher;
@@ -218,6 +220,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
IrregularShift = employee.IrregularShift,
FridayWork = employee.FridayWork,
HolidayWork = employee.HolidayWork,
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels
};
return Partial("ModalEditEmployeeFromGroup", command);
}

View File

@@ -1,4 +1,6 @@
@page
@using _0_Framework.Application
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model ServiceHost.Areas.Client.Pages.Company.RollCall.IndexModel
@{
@@ -183,7 +185,7 @@
<div class="row p-lg-2">
<div class="d-grid card-area-rollcall gap-2 p-lg-0">
<div class="gwb-card disable">
<div class="gwb-card disable" Permission="@SubAccountPermissionHelper.UpgradeOrChangeRollCallServicePermissionCode">
@* asp-page="/Company/RollCall/Plans" *@
<a class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
@@ -207,7 +209,7 @@
</a>
</div>
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" ? "" : "disable")">
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.UploadEmployeePicturePermissionCode">
<a asp-page="/Company/RollCall/EmployeeUploadPicture" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/icons/image-rollcall.png" alt="" class="img-fluid mx-1" width="50px"/>
@@ -221,7 +223,7 @@
</a>
</div>
<div class="gwb-card @(Model.RollCallServicePersonnelActive == "true" && Model.HasCameraAccount == "true" ? "" : "disable")">
<div class="gwb-card @(Model.RollCallServicePersonnelActive == "true" && Model.HasCameraAccount == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.ListCurrentDayRollCallsPermissionCode">
<a asp-page="/Company/RollCall/CurrentDay" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/rollcall.png" alt="" class="img-fluid mx-1" width="50px"/>
@@ -235,7 +237,7 @@
</a>
</div>
<div class="gwb-card @(Model.RollCallServicePersonnelActive == "true" && Model.HasCameraAccount == "true" ? "" : "disable")">
<div class="gwb-card @(Model.RollCallServicePersonnelActive == "true" && Model.HasCameraAccount == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.ListRollCallHistoryPermissionCode">
<a asp-page="/Company/RollCall/CaseHistory" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/rollcall-history.png" alt="" class="img-fluid mx-1" width="50px"/>
@@ -249,7 +251,7 @@
</a>
</div>
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")">
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.GroupingOperationsPermissionCode">
<a asp-page="/Company/RollCall/Grouping" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/icons/grouping-rollcall.png" alt="" class="img-fluid mx-1" width="50px" />
@@ -263,7 +265,7 @@
</a>
</div>
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")">
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.SetWorkshopWorkingHoursPermissionCode">
<a href="#showmodal=@Url.Page("./Index", "EditSettingWorkTime")" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/icons/time-management.png" alt="" class="img-fluid mx-1" width="50px" />
@@ -278,7 +280,7 @@
</div>
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")">
<div class="gwb-card @(Model.CheckRollCallService && Model.HasCameraAccount == "true" && Model.HasRollCallCustomizeWorkshopSetting == "true" ? "" : "disable")" Permission="@SubAccountPermissionHelper.CameraAccountSettingsPermissionCode">
<a asp-page="/Company/RollCall/CameraAccounts" class="click loadingButton">
<div class="d-flex align-items-center justify-content-start p-1">
<img src="~/AssetsClient/images/icons/account-camera.png" alt="" class="img-fluid mx-1" width="50px" />

View File

@@ -12,10 +12,12 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Security.Claims;
using System.Transactions;
using _0_Framework.Infrastructure;
namespace ServiceHost.Areas.Client.Pages.Company.RollCall
{
[Authorize]
[NeedsPermission(SubAccountPermissionHelper.RollCallOperationsPermissionCode)]
public class IndexModel : PageModel
{
private readonly IWorkshopApplication _workshopApplication;

View File

@@ -32,6 +32,9 @@
<input type="radio" value="Regular" name="workshopShiftStatus" id="organized" class="radio-workTimeOption">
<label for="organized" class="radio-label-workTimeOption w-100">منظم</label>
<input type="radio" value="Rotating" name="workshopShiftStatus" id="rotating_shift" class="radio-workTimeOption">
<label for="rotating_shift" class="radio-label-workTimeOption w-100">گردشی</label>
<input type="radio" value="Irregular" name="workshopShiftStatus" id="disorganized" class="radio-workTimeOption">
<label for="disorganized" class="radio-label-workTimeOption w-100">مختلط</label>
</div>
@@ -75,6 +78,45 @@
<p class="m-0" id="ShowSettingMessage"></p>
</div>
</div>
<div class="row mt-2" id="step_workTimeOptionRotatingShift" style="height: 0; display: none">
<div class="col-12" id="appendChildTimeWorkHtmlRS">
<div class="groupBoxRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت اول</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" id="startDateTimeRS" name="CustomizeRotatingShiftsViewModels[0].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" id="endDateTimeRS" name="CustomizeRotatingShiftsViewModels[0].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
</div>
</div>
</div>
</div>
<div class="d-flex align-items-center justify-content-center w-100 my-2">
<button type="button" class="btnAddTimeWorkRS">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round"/>
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round"/>
</svg>
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت دوم</div>
</button>
</div>
<div class="col-12">
<p class="m-0" id="ShowSettingMessageRS"></p>
</div>
</div>
<div class="row p-0" id="step_workTimeOptionIrregular" style="height: 0; gap: 12px; display: none">

View File

@@ -5,6 +5,7 @@
@{
string clientVersion = _0_Framework.Application.Version.StyleVersion;
int iteration = 0;
int iterationRS = 0;
int indexEmployee = 0;
<link href="~/assetsclient/pages/rollcall/css/modaleditemployeefromgroup.css?ver=@clientVersion" rel="stylesheet" />
}
@@ -45,6 +46,9 @@
<div class="btn-workTimeOption-container align-items-center justify-content-center w-100">
<input type="radio" value="Regular" name="Command.workshopShiftStatus" id="organized" class="radio-workTimeOption">
<label for="organized" class="radio-label-workTimeOption w-100">منظم</label>
<input type="radio" value="Rotating" name="Command.workshopShiftStatus" id="rotating_shift" class="radio-workTimeOption">
<label for="rotating_shift" class="radio-label-workTimeOption w-100">گردشی</label>
<input type="radio" value="Irregular" name="Command.workshopShiftStatus" id="disorganized" class="radio-workTimeOption">
<label for="disorganized" class="radio-label-workTimeOption w-100">مختلط</label>
@@ -152,9 +156,129 @@
<p class="m-0" id="ShowSettingMessage"></p>
</div>
</div>
<div class="row mt-2" id="step_workTimeOptionRotatingShift" style="height: 0; display: none">
<div class="col-12" id="appendChildTimeWorkHtmlRS">
@if (Model.CustomizeRotatingShifts.Any())
{
@foreach (var item in Model.CustomizeRotatingShifts)
{
<div class="groupBoxRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">
@if (iterationRS == 0)
{
@("نوبت اول")
}
else if (iterationRS == 1)
{
@("نوبت دوم")
}
else if (iterationRS == 2)
{
@("نوبت سوم")
}
else if (iterationRS == 3)
{
@("نوبت چهارم")
}
</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" name="Command.CustomizeRotatingShifts[@iterationRS].StartTime" value="@item.StartTime" placeholder="00:00" style="direction: ltr;" />
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" name="Command.CustomizeRotatingShifts[@iterationRS].EndTime" value="@item.EndTime" placeholder="00:00" style="direction: ltr;" />
</div>
@if (iterationRS == 0)
{
<div class="col-1 d-flex align-items-center justify-content-end">
</div>
}
else
{
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWork">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M6.875 11H15.125" stroke="white" />
</svg>
</button>
</div>
}
</div>
@{
iterationRS++;
}
</div>
}
}
else
{
<div class="groupBoxRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت اول</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" id="startDateTimeRS" name="Command.CustomizeRotatingShifts[0].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" id="endDateTimeRS" name="Command.CustomizeRotatingShifts[0].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
</div>
</div>
</div>
}
</div>
<div class="d-flex align-items-center justify-content-center w-100 my-2">
<button type="button" class="btnAddTimeWorkRS @(Model.CustomizeRotatingShifts.Count() == 4 ? "d-none" : "")">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round"/>
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round"/>
</svg>
@if (Model.CustomizeRotatingShifts.Count() == 1)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت دوم</div>
}
else if (Model.CustomizeRotatingShifts.Count() == 2)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت سوم</div>
}
else if (Model.CustomizeRotatingShifts.Count() == 3)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت چهارم</div>
}
else
{
<div class="mx-1 btnAppendChildTimeWorkRS"></div>
}
</button>
</div>
<div class="col-12">
<p class="m-0" id="ShowSettingMessageRS"></p>
</div>
</div>
<div class="row p-0" id="step_workTimeOptionIrregular" style="height: 0; gap: 12px; @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? "display: none" : "")">
<div class="btn-workTimeOption-container align-items-center justify-content-center mt-4">
@@ -317,7 +441,9 @@
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
var ajaxPostChangeEditEmployee = `@Url.Page("./Grouping", "ChangeEditEmployee")`;
var indexShiftViewModel = Number(@iteration);
var indexShiftViewModelRS = Number(@iterationRS);
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? 0 : Model.WorkshopShiftStatus == WorkshopShiftStatus.Irregular ? 1 : 2);
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? "true" : "false");
</script>
<script src="~/assetsclient/pages/rollcall/js/modaleditEmployeegroup.js?ver=@clientVersion"></script>

View File

@@ -4,6 +4,7 @@
@{
string clientVersion = _0_Framework.Application.Version.StyleVersion;
int indexShiftViewModel = 0;
int indexShiftViewModelRS = 0;
<link href="~/assetsclient/pages/rollcall/css/modaleditgroup.css?var=@clientVersion" rel="stylesheet" />
}
@@ -34,6 +35,9 @@
<div class="btn-workTimeOption-container align-items-center justify-content-center w-100">
<input type="radio" value="Regular" name="workshopShiftStatus" id="organized" class="radio-workTimeOption">
<label for="organized" class="radio-label-workTimeOption w-100">منظم</label>
<input type="radio" value="Rotating" name="workshopShiftStatus" id="rotating_shift" class="radio-workTimeOption">
<label for="rotating_shift" class="radio-label-workTimeOption w-100">گردشی</label>
<input type="radio" value="Irregular" name="workshopShiftStatus" id="disorganized" class="radio-workTimeOption">
<label for="disorganized" class="radio-label-workTimeOption w-100">مختلط</label>
@@ -155,6 +159,133 @@
<p class="m-0" id="ShowSettingMessage"></p>
</div>
</div>
<div class="row mt-2" id="step_workTimeOptionRotatingShift" style="height: 0; display: none">
<div class="col-12" id="appendChildTimeWorkHtmlRS">
@if (Model.CustomizeRotatingShiftsViewModels.Any())
{
@foreach (var item in Model.CustomizeRotatingShiftsViewModels)
{
<div class="groupBoxRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">
@if (indexShiftViewModelRS == 0)
{
@("نوبت اول")
}
else if (indexShiftViewModelRS == 1)
{
@("نوبت دوم")
}
else if (indexShiftViewModelRS == 2)
{
@("نوبت سوم")
}
else if (indexShiftViewModelRS == 3)
{
@("نوبت چهارم")
}
</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[@indexShiftViewModelRS].StartTime" value="@item.StartTime" placeholder="00:00" style="direction: ltr;" />
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[@indexShiftViewModelRS].EndTime" value="@item.EndTime" placeholder="00:00" style="direction: ltr;" />
</div>
@if (indexShiftViewModelRS == 0)
{
<div class="col-1 d-flex align-items-center justify-content-end">
</div>
}
else
{
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWork">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M6.875 11H15.125" stroke="white" />
</svg>
</button>
</div>
}
</div>
@{
indexShiftViewModelRS++;
}
</div>
}
}
else
{
<div class="groupBoxRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت اول</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" id="startDateTimeRS" name="CustomizeRotatingShiftsViewModels[0].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" id="endDateTimeRS" name="CustomizeRotatingShiftsViewModels[0].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
</div>
</div>
</div>
}
</div>
<div class="d-flex align-items-center justify-content-center w-100 my-2">
<button type="button" class="btnAddTimeWorkRS @(Model.ShiftViewModel.Count() == 4 ? "d-none" : "")">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round"/>
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round"/>
</svg>
@if (Model.CustomizeRotatingShiftsViewModels.Count() == 1)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت دوم</div>
}
else if (Model.CustomizeRotatingShiftsViewModels.Count() == 2)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت سوم</div>
}
else if (Model.CustomizeRotatingShiftsViewModels.Count() == 3)
{
<div class="mx-1 btnAppendChildTimeWorkRS">افزودن نوبت چهارم</div>
}
else
{
<div class="mx-1 btnAppendChildTimeWorkRS"></div>
}
</button>
</div>
<div class="col-12">
<p class="m-0" id="ShowSettingMessageRS"></p>
</div>
</div>
<div class="row p-0" id="step_workTimeOptionIrregular" style="height: 0; gap: 12px; @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? "display: none" : "")">
@@ -332,8 +463,11 @@
var ajaxEditGroupSave = `@Url.Page("./Grouping", "EditGroup")`;
var indexShiftViewModel = Number(@indexShiftViewModel);
var indexShiftViewModelRS = Number(@indexShiftViewModel);
var groupId = Number(@Model.Id);
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? "true" : "false");
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? 0 : Model.WorkshopShiftStatus == WorkshopShiftStatus.Irregular ? 1 : 2);
</script>
<script src="~/assetsclient/pages/rollcall/js/modaleditgroup.js?ver=@clientVersion"></script>

View File

@@ -18,6 +18,7 @@
<ItemGroup>
<Compile Remove="Areas\Admin\Pages\Company\Tax\**" />
<Compile Remove="Areas\Client\Client\**" />
<Compile Remove="wwwroot\AssetsClient\pages\RollCall\js\AssetsClient\**" />
<Compile Remove="wwwroot\labels\صادق فرخی\**" />
<Compile Remove="wwwroot\labels\صفا پور توکلی\**" />
<Compile Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -25,6 +26,7 @@
<Compile Remove="wwwroot\webcamjs\flash\**" />
<Content Remove="Areas\Admin\Pages\Company\Tax\**" />
<Content Remove="Areas\Client\Client\**" />
<Content Remove="wwwroot\AssetsClient\pages\RollCall\js\AssetsClient\**" />
<Content Remove="wwwroot\labels\صادق فرخی\**" />
<Content Remove="wwwroot\labels\صفا پور توکلی\**" />
<Content Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -32,6 +34,7 @@
<Content Remove="wwwroot\webcamjs\flash\**" />
<EmbeddedResource Remove="Areas\Admin\Pages\Company\Tax\**" />
<EmbeddedResource Remove="Areas\Client\Client\**" />
<EmbeddedResource Remove="wwwroot\AssetsClient\pages\RollCall\js\AssetsClient\**" />
<EmbeddedResource Remove="wwwroot\labels\صادق فرخی\**" />
<EmbeddedResource Remove="wwwroot\labels\صفا پور توکلی\**" />
<EmbeddedResource Remove="wwwroot\labels\میلاد مصباح\**" />
@@ -39,6 +42,7 @@
<EmbeddedResource Remove="wwwroot\webcamjs\flash\**" />
<None Remove="Areas\Admin\Pages\Company\Tax\**" />
<None Remove="Areas\Client\Client\**" />
<None Remove="wwwroot\AssetsClient\pages\RollCall\js\AssetsClient\**" />
<None Remove="wwwroot\labels\صادق فرخی\**" />
<None Remove="wwwroot\labels\صفا پور توکلی\**" />
<None Remove="wwwroot\labels\میلاد مصباح\**" />

View File

@@ -6,7 +6,7 @@
}
.modal-dialog, .modal-content {
height: 700px;
height: 750px;
}
.groupWorkModal-width {
@@ -24,7 +24,8 @@
background-color: #ffffff !important;
}
.groupBox {
.groupBox,
.groupBoxRS {
background-color: #F5F5F5;
border-radius: 10px;
border: 1px solid #E7E7E7;
@@ -32,18 +33,21 @@
margin: 6px 3px;
}
.groupBox .form-control {
.groupBox .form-control,
.groupBoxRS .form-control {
background-color: #ffffff;
}
.groupBox .form-control::placeholder {
color: #bfbfbf;
opacity: 1; /* Firefox */
}
.groupBox .form-control::placeholder,
.groupBoxRS .form-control::placeholder {
color: #bfbfbf;
opacity: 1; /* Firefox */
}
.groupBox .form-control::-ms-input-placeholder { /* Edge 12-18 */
color: #bfbfbf;
}
.groupBox .form-control::-ms-input-placeholder,
.groupBoxRS .form-control::-ms-input-placeholder { /* Edge 12-18 */
color: #bfbfbf;
}
.groupBoxIrregular {
background-color: #F5F5F5;
@@ -66,7 +70,8 @@
color: #bfbfbf;
}
.btnAddTimeWork {
.btnAddTimeWork,
.btnAddTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;
@@ -78,7 +83,8 @@
padding: 4px 8px;
}
.btnRemoveTimeWork {
.btnRemoveTimeWork,
.btnRemoveTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;

View File

@@ -6,7 +6,7 @@
}
.modal-dialog, .modal-content {
height: 700px;
height: 750px;
}
.groupWorkModal-width {
@@ -24,7 +24,8 @@
background-color: #ffffff !important;
}
.groupBox {
.groupBox,
.groupBoxRS {
background-color: #F5F5F5;
border-radius: 10px;
border: 1px solid #E7E7E7;
@@ -32,16 +33,19 @@
margin: 6px 3px;
}
.groupBox .form-control {
.groupBox .form-control,
.groupBoxRS .form-control {
background-color: #ffffff;
}
.groupBox .form-control::placeholder {
.groupBox .form-control::placeholder,
.groupBoxRS .form-control::placeholder {
color: #bfbfbf;
opacity: 1; /* Firefox */
}
.groupBox .form-control::-ms-input-placeholder { /* Edge 12-18 */
.groupBox .form-control::-ms-input-placeholder,
.groupBoxRS .form-control::-ms-input-placeholder { /* Edge 12-18 */
color: #bfbfbf;
}
@@ -66,7 +70,8 @@
color: #bfbfbf;
}
.btnAddTimeWork {
.btnAddTimeWork,
.btnAddTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;
@@ -78,7 +83,8 @@
padding: 4px 8px;
}
.btnRemoveTimeWork {
.btnRemoveTimeWork,
.btnRemoveTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;

View File

@@ -6,7 +6,7 @@
}
.modal-dialog, .modal-content {
height: 700px;
height: 750px;
}
.groupWorkModal-width {
@@ -24,7 +24,8 @@
background-color: #ffffff !important;
}
.groupBox {
.groupBox,
.groupBoxRS {
background-color: #F5F5F5;
border-radius: 10px;
border: 1px solid #E7E7E7;
@@ -32,16 +33,19 @@
margin: 6px 3px;
}
.groupBox .form-control {
.groupBox .form-control,
.groupBoxRS .form-control {
background-color: #ffffff;
}
.groupBox .form-control::placeholder {
.groupBox .form-control::placeholder,
.groupBoxRS .form-control::placeholder {
color: #bfbfbf;
opacity: 1; /* Firefox */
}
.groupBox .form-control::-ms-input-placeholder { /* Edge 12-18 */
.groupBox .form-control::-ms-input-placeholder,
.groupBoxRS .form-control::-ms-input-placeholder { /* Edge 12-18 */
color: #bfbfbf;
}
@@ -66,7 +70,8 @@
color: #bfbfbf;
}
.btnAddTimeWork {
.btnAddTimeWork,
.btnAddTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;
@@ -78,7 +83,8 @@
padding: 4px 8px;
}
.btnRemoveTimeWork {
.btnRemoveTimeWork,
.btnRemoveTimeWorkRS {
display: flex;
align-items: center;
justify-content: center;

View File

@@ -52,6 +52,8 @@ function loadDataAjax() {
</div>
<div class="title-group1 text-center d-none d-md-block width3">`;
console.log('--------------------------------------------------------');
console.log(item);
if (item.workshopShiftStatus === 0) {
item.rollCallWorkshopShifts.forEach(function (itemShifts) {
@@ -63,7 +65,7 @@ function loadDataAjax() {
</p>
`;
});
} else {
} else if (item.workshopShiftStatus === 1) {
html += `<p class="m-0 time-set-title">`;
if (item.irregularShift.workshopIrregularShifts === 1) {
html += `<span>12-24</span>`;
@@ -76,6 +78,16 @@ function loadDataAjax() {
}
html += `</p>`;
} else {
item.customizeRotatingShiftsViewModels.forEach(function (itemRotatingShifts) {
html += `
<p class="m-0 time-set-title">
<span style="width: 46px;display: inline-block;">${itemRotatingShifts.startTime}</span>
الی
<span style="width: 46px;display: inline-block;">${itemRotatingShifts.endTime}</span>
</p>
`;
});
}
html += `</div>
@@ -204,7 +216,7 @@ function loadEmployeeAjax(groupSettingId) {
<span style="width: 46px;display: inline-block;text-align: center;">${itemEmployeeShifts.endTime}</span>
</p>`;
});
} else {
} else if (itemEmployee.workshopShiftStatus === 1) {
htmlEmployee += `<p class="m-0 time-set-title">`;
if (itemEmployee.irregularShift.workshopIrregularShifts === 1) {
htmlEmployee += `<span>12-24</span>`;
@@ -217,6 +229,16 @@ function loadEmployeeAjax(groupSettingId) {
}
htmlEmployee += `</p>`;
} else {
itemEmployee.customizeRotatingShiftsViewModels.forEach(function (itemRotatingShifts) {
htmlEmployee += `
<p class="m-0 time-set-title">
<span style="width: 46px;display: inline-block;">${itemRotatingShifts.startTime}</span>
الی
<span style="width: 46px;display: inline-block;">${itemRotatingShifts.endTime}</span>
</p>
`;
});
}
htmlEmployee += `</div></div>

View File

@@ -31,6 +31,20 @@
});
});
$(".dateTimeRS").each(function () {
let element = $(this);
element.on('input', function () {
let value = convertPersianNumbersToEnglish(element.val());
element.val(value);
});
new Cleave(this, {
time: true,
timePattern: ['h', 'm']
});
});
$(".dateTimeIrregular").each(function () {
let element = $(this);
@@ -47,14 +61,13 @@
$("#organized").on("click", function () {
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
if ($('#step_workTimeOption').is(':visible')) {
var currentCount = $('.groupBox').length;
$('.dateTime').each(function () {
if ($(this).val() === '') {
var currentCount = $('.groupBox').length;
updateAddButtonText(currentCount);
}
updateAddButtonText(currentCount);
});
}
@@ -63,35 +76,79 @@
$('.dateTimeIrregular').val('');
});
$("#disorganized").on("click", function () {
$("#rotating_shift").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionIrregular').show();
});
if (IsRegularWorkshop) {
$("#organized").prop('checked', true);
$("#disorganized").prop('checked', false);
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').show();
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
} else {
$("#organized").prop('checked', false);
$("#disorganized").prop('checked', true);
$('#step_workTimeOption').hide();
$('#step_workTimeOptionIrregular').show();
if ($("#hour").val() === "0" && $("#min").val() === "00") {
$('#computeTimeText').text('');
} else {
$('#computeTimeText').text($("#hour").val() + ' ساعت ' + $("#min").val() + ' دقیقه ');
if ($('#step_workTimeOptionRotatingShift').is(':visible')) {
var currentCountRS = $('.groupBoxRS').length;
$('.dateTimeRS').each(function () {
updateAddButtonTextRS(currentCountRS);
});
}
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
});
updateIrregularButton();
$("#disorganized").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
});
switch (IsRegularWorkshop) {
case 0:
//radio btn
$("#organized").prop('checked', true);
$("#rotating_shift").prop('checked', false);
$("#disorganized").prop('checked', false);
//form
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
break;
case 1:
//radio btn
$("#organized").prop('checked', false);
$("#rotating_shift").prop('checked', false);
$("#disorganized").prop('checked', true);
//form
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
// این مرحله هنگام چک کردن وضعیت نامنظم بودن ساعت هستش
if ($("#hour").val() === "0" && $("#min").val() === "00") {
$('#computeTimeText').text('');
} else {
$('#computeTimeText').text($("#hour").val() + ' ساعت ' + $("#min").val() + ' دقیقه ');
}
updateIrregularButton();
break;
case 2:
//radio btn
$("#organized").prop('checked', false);
$("#rotating_shift").prop('checked', true);
$("#disorganized").prop('checked', false);
//form
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').show();
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonTextRS(indexShiftViewModelRS);
break;
default:
alert("بروز خطا هنگام لود شدن");
}
$('input[name="Command.IrregularShift.WorkshopIrregularShifts"]').on('change', function () {
if ($('input[name="Command.IrregularShift.WorkshopIrregularShifts"]:checked').length > 0) {
$('#irregularShiftsDateTime').removeClass('disable');
@@ -109,7 +166,13 @@
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = $('.groupBox').length;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
$(this).prop('checked', false);
@@ -245,17 +308,7 @@
time: true,
timePattern: ['h', 'm']
});
//new Cleave(`input[name="Command.ShiftViewModel[${currentCount}].StartTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
//new Cleave(`input[name="Command.ShiftViewModel[${currentCount}].EndTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
updateAddButtonText(currentCount + 1);
if (currentCount + 1 === 3) {
@@ -267,6 +320,127 @@
}
});
$(".btnAddTimeWorkRS").on("click", function () {
var currentCount = $('.groupBoxRS').length;
var $inputs = $('.dateTimeRS');
var allFilled = true;
if ($("#BreakTime").is(':Checked') && parseInt($("#hour").val(), 10) === 3) {
showAlert('به دلیل داشتن 3 ساعت استراحت، بیشتر از نوبت اول نمیتوانید ایجاد نمائید.', $(this));
return false;
}
$inputs.each(function () {
if ($(this).val() === '') {
allFilled = false;
showAlert('ابتدا ساعت شروع و پایان را وارد نمائید.', $(this));
}
});
if (!allFilled) {
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
if (currentCount < 5) {
var namePlacement = "";
var namePlacementPersian = "";
switch (currentCount + 1) {
case 2:
namePlacement = "Second";
namePlacementPersian = "دوم";
break;
case 3:
namePlacement = "Third";
namePlacementPersian = "سوم";
break;
case 4:
namePlacement = "Third";
namePlacementPersian = "چهارم";
break;
case 5:
namePlacement = "Third";
namePlacementPersian = "پنجم";
break;
default:
}
var timeWorkHtml = `
<div class="groupBoxRS timeWorkRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" name="Command.CustomizeRotatingShifts[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" name="Command.CustomizeRotatingShifts[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWorkRS">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M6.875 11H15.125" stroke="white"/>
</svg>
</button>
</div>
</div>
</div>`;
$('#appendChildTimeWorkHtmlRS').append(timeWorkHtml);
const newStartTimeInput = $(`input[name="Command.CustomizeRotatingShifts[${currentCount}].StartTime"]`);
const newEndTimeInput = $(`input[name="Command.CustomizeRotatingShifts[${currentCount}].EndTime"]`);
newStartTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
newEndTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
new Cleave(newStartTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
new Cleave(newEndTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
updateAddButtonTextRS(currentCount + 1);
if (currentCount + 1 === 4) {
$(".btnAddTimeWorkRS").hide();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
}
});
$(document).on("click", ".btnRemoveTimeWork", function () {
$(".btnAddTimeWork").removeClass('d-none');
$(this).closest(".groupBox").remove();
@@ -281,6 +455,20 @@
// Update Remove button enable/disable state
updateRemoveButtons();
});
$(document).on("click", ".btnRemoveTimeWorkRS", function () {
$(this).closest(".groupBoxRS").remove();
var currentCount = $('.groupBoxRS').length;
updateAddButtonTextRS(currentCount);
if (currentCount < 4) {
$(".btnAddTimeWorkRS").show();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
});
});
@@ -288,9 +476,11 @@ function updateRemoveButtons() {
$(".btnRemoveTimeWork").addClass("disable");
$(".btnRemoveTimeWork").last().removeClass("disable");
}
function updateRemoveButtonsRS() {
$(".btnRemoveTimeWorkRS").addClass("disable");
$(".btnRemoveTimeWorkRS").last().removeClass("disable");
}
updateAddButtonText(indexShiftViewModel);
function updateAddButtonText(currentCount) {
if (currentCount === 1) {
$('.btnAppendChildTimeWork').text('افزودن نوبت دوم');
@@ -314,6 +504,33 @@ function updateAddButtonText(currentCount) {
}
}
function updateAddButtonTextRS(currentCount) {
if (currentCount === 1) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت دوم');
} else if (currentCount === 2) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت سوم');
} else if (currentCount === 3) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت چهارم');
} else if (currentCount === 4) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت پنجم');
}
let allFilled = true;
$('.dateTimeRS').each(function () {
const value = $(this).val().trim();
if (value === "" || !timeValidCheck(value)) {
allFilled = false;
return false;
}
});
if (allFilled) {
$('.btn-register').removeClass('disable');
} else {
$('.btn-register').addClass('disable');
}
}
function updateIrregularButton() {
let allFilled = true;
$('.dateTimeIrregular').each(function () {
@@ -332,12 +549,6 @@ function updateIrregularButton() {
}
//******************** برای نوشتن تاریخ ********************
//$(document).on('input', ".dateTime", function () {
// var value = $(this).val();
// $(this).val(convertPersianNumbersToEnglish(value)).mask("00:00");
//});
$(document).on('keyup', ".dateTime", function () {
let $input = $(this);
let value = $input.val();
@@ -350,16 +561,32 @@ $(document).on('keyup', ".dateTime", function () {
updateAddButtonText(currentCount);
} else {
clearAlert($input);
// validateAllTimes();
updateAddButtonText(currentCount);
//focusNextTimeInput($input);
}
} else {
updateAddButtonText(currentCount);
}
});
$(document).on("keyup", ".dateTimeRS", function () {
let $input = $(this);
let value = $input.val();
let lengthValue = value.length;
let currentCount = $('.groupBoxRS').length;
if (lengthValue >= 5) {
if (!timeValidCheck(value)) {
showAlert('ساعت را به درستی وارد نمائید', $input);
updateAddButtonTextRS(currentCount);
} else {
clearAlert($input);
updateAddButtonTextRS(currentCount);
}
} else {
updateAddButtonTextRS(currentCount);
}
});
$(document).on("keyup", ".dateTimeIrregular", function () {
let $input = $(this);
let value = $input.val();
@@ -482,54 +709,6 @@ function timeValidCheck(value) {
const timePattern = /^([01]\d|2[0-3]):([0-5]\d)$/; // Validates HH:mm format
return timePattern.test(value);
}
//function validateAllTimes() {
// let timeRanges = [];
// $(".groupBox").each(function () {
// let startTime = $(this).find('input[name*="StartTime"]').val();
// let endTime = $(this).find('input[name*="EndTime"]').val();
// if (startTime.length === 5 && endTime.length === 5) {
// let startParts = startTime.split(':');
// let endParts = endTime.split(':');
// let startInMinutes = parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
// let endInMinutes = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
// timeRanges.push({ start: startInMinutes, end: endInMinutes });
// }
// });
// // Check for conflicts and order
// for (let i = 0; i < timeRanges.length; i++) {
// for (let j = 0; j < i; j++) {
// if (timeRanges[i].start >= timeRanges[i].end) {
// showAlert('زمان شروع باید قبل از زمان پایان باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check for overlap with previous entries
// if (timeRanges[i].start < timeRanges[j].end && timeRanges[i].end > timeRanges[j].start) {
// showAlert('زمان‌ها نباید تداخل داشته باشند', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check if the current start time is before the previous start time
// if (i > 0 && timeRanges[i].start < timeRanges[i - 1].start) {
// showAlert('ساعت جدید نباید کوچکتر از ساعت‌های قبلی باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// }
// }
//}
//function focusNextTimeInput(currentInput) {
// var inputs = $(".dateTime");
// var currentIndex = inputs.index(currentInput);
// if (currentIndex !== -1 && currentIndex < inputs.length - 1) {
// $(inputs[currentIndex + 1]).focus();
// }
//}
//******************** برای نوشتن تاریخ ********************
function ajaxEditEmployeeSaveData() {

View File

@@ -31,6 +31,20 @@
});
});
$(".dateTimeRS").each(function () {
let element = $(this);
element.on('input', function () {
let value = convertPersianNumbersToEnglish(element.val());
element.val(value);
});
new Cleave(this, {
time: true,
timePattern: ['h', 'm']
});
});
$(".dateTimeIrregular").each(function () {
let element = $(this);
@@ -52,48 +66,90 @@
$("#organized").on("click", function () {
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
if ($('#step_workTimeOption').is(':visible')) {
var currentCount = $('.groupBox').length;
$('.dateTime').each(function () {
if ($(this).val() === '') {
var currentCount = $('.groupBox').length;
updateAddButtonText(currentCount);
}
updateAddButtonText(currentCount);
});
}
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
});
$("#rotating_shift").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').show();
$('#step_workTimeOptionIrregular').hide();
if ($('#step_workTimeOptionRotatingShift').is(':visible')) {
var currentCountRS = $('.groupBoxRS').length;
$('.dateTimeRS').each(function () {
updateAddButtonTextRS(currentCountRS);
});
}
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
});
$("#disorganized").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
});
console.log(IsRegularWorkshop);
switch (IsRegularWorkshop) {
case 0:
//radio btn
$("#organized").prop('checked', true);
$("#rotating_shift").prop('checked', false);
$("#disorganized").prop('checked', false);
//form
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
break;
case 1:
//radio btn
$("#organized").prop('checked', false);
$("#rotating_shift").prop('checked', false);
$("#disorganized").prop('checked', true);
//form
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
// این مرحله هنگام چک کردن وضعیت نامنظم بودن ساعت هستش
if ($("#hour").val() === "0" && $("#min").val() === "00") {
$('#computeTimeText').text('');
} else {
$('#computeTimeText').text($("#hour").val() + ' ساعت ' + $("#min").val() + ' دقیقه ');
}
updateIrregularButton();
break;
if (IsRegularWorkshop) {
$("#organized").prop('checked', true);
$("#disorganized").prop('checked', false);
$('#step_workTimeOption').show();
$('#step_workTimeOptionIrregular').hide();
case 2:
//radio btn
$("#organized").prop('checked', false);
$("#rotating_shift").prop('checked', true);
$("#disorganized").prop('checked', false);
//form
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').show();
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonTextRS(indexShiftViewModelRS);
break;
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
} else {
$("#organized").prop('checked', false);
$("#disorganized").prop('checked', true);
$('#step_workTimeOption').hide();
$('#step_workTimeOptionIrregular').show();
if ($("#hour").val() === "0" && $("#min").val() === "00") {
$('#computeTimeText').text('');
} else {
$('#computeTimeText').text($("#hour").val() + ' ساعت ' + $("#min").val() + ' دقیقه ');
}
updateIrregularButton();
default:
alert("بروز خطا هنگام لود شدن");
}
@@ -115,7 +171,13 @@
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = $('.groupBox').length;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
$(this).prop('checked', false);
@@ -255,16 +317,6 @@
timePattern: ['h', 'm']
});
//new Cleave(`input[name="ShiftViewModel[${currentCount}].StartTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
//new Cleave(`input[name="ShiftViewModel[${currentCount}].EndTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
updateAddButtonText(currentCount + 1);
if (currentCount + 1 === 3) {
@@ -275,6 +327,127 @@
updateRemoveButtons();
}
});
$(".btnAddTimeWorkRS").on("click", function () {
var currentCount = $('.groupBoxRS').length;
var $inputs = $('.dateTimeRS');
var allFilled = true;
if ($("#BreakTime").is(':Checked') && parseInt($("#hour").val(), 10) === 3) {
showAlert('به دلیل داشتن 3 ساعت استراحت، بیشتر از نوبت اول نمیتوانید ایجاد نمائید.', $(this));
return false;
}
$inputs.each(function () {
if ($(this).val() === '') {
allFilled = false;
showAlert('ابتدا ساعت شروع و پایان را وارد نمائید.', $(this));
}
});
if (!allFilled) {
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
if (currentCount < 5) {
var namePlacement = "";
var namePlacementPersian = "";
switch (currentCount + 1) {
case 2:
namePlacement = "Second";
namePlacementPersian = "دوم";
break;
case 3:
namePlacement = "Third";
namePlacementPersian = "سوم";
break;
case 4:
namePlacement = "Third";
namePlacementPersian = "چهارم";
break;
case 5:
namePlacement = "Third";
namePlacementPersian = "پنجم";
break;
default:
}
var timeWorkHtml = `
<div class="groupBoxRS timeWorkRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWorkRS">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M6.875 11H15.125" stroke="white"/>
</svg>
</button>
</div>
</div>
</div>`;
$('#appendChildTimeWorkHtmlRS').append(timeWorkHtml);
const newStartTimeInput = $(`input[name="CustomizeRotatingShiftsViewModels[${currentCount}].StartTime"]`);
const newEndTimeInput = $(`input[name="CustomizeRotatingShiftsViewModels[${currentCount}].EndTime"]`);
newStartTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
newEndTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
new Cleave(newStartTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
new Cleave(newEndTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
updateAddButtonTextRS(currentCount + 1);
if (currentCount + 1 === 4) {
$(".btnAddTimeWorkRS").hide();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
}
});
$(document).on("click", ".btnRemoveTimeWork", function () {
$(".btnAddTimeWork").removeClass('d-none');
@@ -290,12 +463,30 @@
// Update Remove button enable/disable state
updateRemoveButtons();
});
$(document).on("click", ".btnRemoveTimeWorkRS", function () {
$(this).closest(".groupBoxRS").remove();
var currentCount = $('.groupBoxRS').length;
updateAddButtonTextRS(currentCount);
if (currentCount < 4) {
$(".btnAddTimeWorkRS").show();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
});
});
function updateRemoveButtons() {
$(".btnRemoveTimeWork").addClass("disable");
$(".btnRemoveTimeWork").last().removeClass("disable");
}
function updateRemoveButtonsRS() {
$(".btnRemoveTimeWorkRS").addClass("disable");
$(".btnRemoveTimeWorkRS").last().removeClass("disable");
}
function updateAddButtonText(currentCount) {
if (currentCount === 1) {
@@ -320,6 +511,33 @@ function updateAddButtonText(currentCount) {
}
}
function updateAddButtonTextRS(currentCount) {
if (currentCount === 1) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت دوم');
} else if (currentCount === 2) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت سوم');
} else if (currentCount === 3) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت چهارم');
} else if (currentCount === 4) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت پنجم');
}
let allFilled = true;
$('.dateTimeRS').each(function () {
const value = $(this).val().trim();
if (value === "" || !timeValidCheck(value)) {
allFilled = false;
return false;
}
});
if (allFilled) {
$('.btn-register').removeClass('disable');
} else {
$('.btn-register').addClass('disable');
}
}
function updateIrregularButton() {
let allFilled = true;
$('.dateTimeIrregular').each(function () {
@@ -338,12 +556,6 @@ function updateIrregularButton() {
}
//******************** برای نوشتن تاریخ ********************
//$(document).on('input', ".dateTime", function () {
// var value = $(this).val();
// $(this).val(convertPersianNumbersToEnglish(value)).mask("00:00");
//});
$(document).on('keyup', ".dateTime", function () {
let $input = $(this);
let value = $input.val();
@@ -356,16 +568,32 @@ $(document).on('keyup', ".dateTime", function () {
updateAddButtonText(currentCount);
} else {
clearAlert($input);
// validateAllTimes();
updateAddButtonText(currentCount);
//focusNextTimeInput($input);
}
} else {
updateAddButtonText(currentCount);
}
});
$(document).on("keyup", ".dateTimeRS", function () {
let $input = $(this);
let value = $input.val();
let lengthValue = value.length;
let currentCount = $('.groupBoxRS').length;
if (lengthValue >= 5) {
if (!timeValidCheck(value)) {
showAlert('ساعت را به درستی وارد نمائید', $input);
updateAddButtonTextRS(currentCount);
} else {
clearAlert($input);
updateAddButtonTextRS(currentCount);
}
} else {
updateAddButtonTextRS(currentCount);
}
});
$(document).on("keyup", ".dateTimeIrregular", function () {
let $input = $(this);
let value = $input.val();
@@ -488,54 +716,6 @@ function timeValidCheck(value) {
const timePattern = /^([01]\d|2[0-3]):([0-5]\d)$/; // Validates HH:mm format
return timePattern.test(value);
}
//function validateAllTimes() {
// let timeRanges = [];
// $(".groupBox").each(function () {
// let startTime = $(this).find('input[name*="StartTime"]').val();
// let endTime = $(this).find('input[name*="EndTime"]').val();
// if (startTime.length === 5 && endTime.length === 5) {
// let startParts = startTime.split(':');
// let endParts = endTime.split(':');
// let startInMinutes = parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
// let endInMinutes = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
// timeRanges.push({ start: startInMinutes, end: endInMinutes });
// }
// });
// // Check for conflicts and order
// for (let i = 0; i < timeRanges.length; i++) {
// for (let j = 0; j < i; j++) {
// if (timeRanges[i].start >= timeRanges[i].end) {
// showAlert('زمان شروع باید قبل از زمان پایان باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check for overlap with previous entries
// if (timeRanges[i].start < timeRanges[j].end && timeRanges[i].end > timeRanges[j].start) {
// showAlert('زمان‌ها نباید تداخل داشته باشند', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check if the current start time is before the previous start time
// if (i > 0 && timeRanges[i].start < timeRanges[i - 1].start) {
// showAlert('ساعت جدید نباید کوچکتر از ساعت‌های قبلی باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// }
// }
//}
//function focusNextTimeInput(currentInput) {
// var inputs = $(".dateTime");
// var currentIndex = inputs.index(currentInput);
//
// if (currentIndex !== -1 && currentIndex < inputs.length - 1) {
// $(inputs[currentIndex + 1]).focus();
// }
//}
//******************** برای نوشتن تاریخ ********************

View File

@@ -1,12 +1,4 @@
$(document).ready(function () {
//$('.money').simpleMoneyFormat();
//$('.money').on('input', function() {
// var value = $(this).val();
// value = value.replace(/[^0-9]/g, '');
// $(this).val(value);
//});
$(document).on("click", ".btn-cancel2", function () {
$('#MainModal').modal('toggle');
});
@@ -39,6 +31,20 @@
});
});
$(".dateTimeRS").each(function () {
let element = $(this);
element.on('input', function () {
let value = convertPersianNumbersToEnglish(element.val());
element.val(value);
});
new Cleave(this, {
time: true,
timePattern: ['h', 'm']
});
});
$(".dateTimeIrregular").each(function () {
let element = $(this);
@@ -55,14 +61,29 @@
$("#organized").on("click", function () {
$('#step_workTimeOption').show();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
if ($('#step_workTimeOption').is(':visible')) {
var currentCount = $('.groupBox').length;
$('.dateTime').each(function () {
if ($(this).val() === '') {
var currentCount = $('.groupBox').length;
updateAddButtonText(currentCount);
}
updateAddButtonText(currentCount);
});
}
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
});
$("#rotating_shift").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').show();
$('#step_workTimeOptionIrregular').hide();
if ($('#step_workTimeOptionRotatingShift').is(':visible')) {
var currentCountRS = $('.groupBoxRS').length;
$('.dateTimeRS').each(function () {
updateAddButtonTextRS(currentCountRS);
});
}
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
@@ -72,6 +93,7 @@
$("#disorganized").on("click", function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
});
@@ -92,7 +114,13 @@
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = $('.groupBox').length;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
$(this).prop('checked', false);
@@ -227,15 +255,6 @@
timePattern: ['h', 'm']
});
//new Cleave(`input[name="ShiftViewModel[${currentCount}].StartTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
//new Cleave(`input[name="ShiftViewModel[${currentCount}].EndTime"]`, {
// time: true,
// timePattern: ['h', 'm']
//});
updateAddButtonText(currentCount + 1);
@@ -248,28 +267,127 @@
}
});
//$(document).on("keyup", ".dateTime", function () {
// let $input = $(this);
// let value = $input.val();
// let lengthValue = value.length;
// let currentCount = $('.groupBox').length;
// if (lengthValue >= 5) {
// if (!timeValidCheck(value)) {
// showAlert('ساعت را به درستی وارد نمائید', $input);
// updateAddButtonText(currentCount);
// } else {
// clearAlert($input);
// // validateAllTimes();
// updateAddButtonText(currentCount);
// //focusNextTimeInput($input);
// }
// } else {
// updateAddButtonText(currentCount);
// }
//});
$(".btnAddTimeWorkRS").on("click", function () {
var currentCount = $('.groupBoxRS').length;
var $inputs = $('.dateTimeRS');
var allFilled = true;
if ($("#BreakTime").is(':Checked') && parseInt($("#hour").val(), 10) === 3) {
showAlert('به دلیل داشتن 3 ساعت استراحت، بیشتر از نوبت اول نمیتوانید ایجاد نمائید.', $(this));
return false;
}
$inputs.each(function () {
if ($(this).val() === '') {
allFilled = false;
showAlert('ابتدا ساعت شروع و پایان را وارد نمائید.', $(this));
}
});
if (!allFilled) {
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
if (currentCount < 5) {
var namePlacement = "";
var namePlacementPersian = "";
switch (currentCount + 1) {
case 2:
namePlacement = "Second";
namePlacementPersian = "دوم";
break;
case 3:
namePlacement = "Third";
namePlacementPersian = "سوم";
break;
case 4:
namePlacement = "Third";
namePlacementPersian = "چهارم";
break;
case 5:
namePlacement = "Third";
namePlacementPersian = "پنجم";
break;
default:
}
var timeWorkHtml = `
<div class="groupBoxRS timeWorkRS">
<div class="row align-items-center justify-content-between">
<div class="col-3 d-flex align-items-center">
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">از</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-4 d-flex align-items-center">
<div class="timeWorkTitle">الی</div>
<input type="text" class="form-control text-center dateTimeRS" name="CustomizeRotatingShiftsViewModels[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
</div>
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWorkRS">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white"/>
<path d="M6.875 11H15.125" stroke="white"/>
</svg>
</button>
</div>
</div>
</div>`;
$('#appendChildTimeWorkHtmlRS').append(timeWorkHtml);
const newStartTimeInput = $(`input[name="CustomizeRotatingShiftsViewModels[${currentCount}].StartTime"]`);
const newEndTimeInput = $(`input[name="CustomizeRotatingShiftsViewModels[${currentCount}].EndTime"]`);
newStartTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
newEndTimeInput.on('input', function () {
const value = convertPersianNumbersToEnglish($(this).val());
$(this).val(value);
});
new Cleave(newStartTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
new Cleave(newEndTimeInput[0], {
time: true,
timePattern: ['h', 'm']
});
updateAddButtonTextRS(currentCount + 1);
if (currentCount + 1 === 4) {
$(".btnAddTimeWorkRS").hide();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
}
});
$(document).on("click", ".btnRemoveTimeWork", function () {
@@ -285,6 +403,21 @@
// Update Remove button enable/disable state
updateRemoveButtons();
});
$(document).on("click", ".btnRemoveTimeWorkRS", function () {
$(this).closest(".groupBoxRS").remove();
var currentCount = $('.groupBoxRS').length;
updateAddButtonTextRS(currentCount);
if (currentCount < 4) {
$(".btnAddTimeWorkRS").show();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
});
});
function updateRemoveButtons() {
@@ -292,6 +425,11 @@ function updateRemoveButtons() {
$(".btnRemoveTimeWork").last().removeClass("disable");
}
function updateRemoveButtonsRS() {
$(".btnRemoveTimeWorkRS").addClass("disable");
$(".btnRemoveTimeWorkRS").last().removeClass("disable");
}
updateAddButtonText(1);
function updateAddButtonText(currentCount) {
@@ -317,6 +455,33 @@ function updateAddButtonText(currentCount) {
}
}
function updateAddButtonTextRS(currentCount) {
if (currentCount === 1) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت دوم');
} else if (currentCount === 2) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت سوم');
} else if (currentCount === 3) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت چهارم');
} else if (currentCount === 4) {
$('.btnAppendChildTimeWorkRS').text('افزودن نوبت پنجم');
}
let allFilled = true;
$('.dateTimeRS').each(function () {
const value = $(this).val().trim();
if (value === "" || !timeValidCheck(value)) {
allFilled = false;
return false;
}
});
if (allFilled) {
$('.btn-register').removeClass('disable');
} else {
$('.btn-register').addClass('disable');
}
}
function updateIrregularButton() {
let allFilled = true;
$('.dateTimeIrregular').each(function () {
@@ -335,12 +500,6 @@ function updateIrregularButton() {
}
//******************** برای نوشتن تاریخ ********************
//$(document).on('input', ".dateTime", function () {
// var value = $(this).val();
// $(this).val(convertPersianNumbersToEnglish(value)).mask("00:00");
//});
$(document).on("keyup", ".dateTime", function () {
let $input = $(this);
let value = $input.val();
@@ -353,16 +512,32 @@ $(document).on("keyup", ".dateTime", function () {
updateAddButtonText(currentCount);
} else {
clearAlert($input);
// validateAllTimes();
updateAddButtonText(currentCount);
//focusNextTimeInput($input);
}
} else {
updateAddButtonText(currentCount);
}
});
$(document).on("keyup", ".dateTimeRS", function () {
let $input = $(this);
let value = $input.val();
let lengthValue = value.length;
let currentCount = $('.groupBoxRS').length;
if (lengthValue >= 5) {
if (!timeValidCheck(value)) {
showAlert('ساعت را به درستی وارد نمائید', $input);
updateAddButtonTextRS(currentCount);
} else {
clearAlert($input);
updateAddButtonTextRS(currentCount);
}
} else {
updateAddButtonTextRS(currentCount);
}
});
$(document).on("keyup", ".dateTimeIrregular", function () {
let $input = $(this);
let value = $input.val();
@@ -377,6 +552,7 @@ $(document).on("keyup", ".dateTimeIrregular", function () {
}
updateIrregularButton();
});
$(document).on("keyup", "#irregularShiftsStartDateTime", function () {
let $input = $(this);
let value = $input.val();
@@ -485,59 +661,6 @@ function timeValidCheck(value) {
const timePattern = /^([01]\d|2[0-3]):([0-5]\d)$/; // Validates HH:mm format
return timePattern.test(value);
}
//function validateAllTimes() {
// let timeRanges = [];
// $(".groupBox").each(function () {
// let startTime = $(this).find('input[name*="StartTime"]').val();
// let endTime = $(this).find('input[name*="EndTime"]').val();
// if (startTime.length === 5 && endTime.length === 5) {
// let startParts = startTime.split(':');
// let endParts = endTime.split(':');
// let startInMinutes = parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
// let endInMinutes = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
// timeRanges.push({ start: startInMinutes, end: endInMinutes });
// }
// });
// // Check for conflicts and order
// for (let i = 0; i < timeRanges.length; i++) {
// for (let j = 0; j < i; j++) {
// if (timeRanges[i].start >= timeRanges[i].end) {
// showAlert('زمان شروع باید قبل از زمان پایان باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check for overlap with previous entries
// if (timeRanges[i].start < timeRanges[j].end && timeRanges[i].end > timeRanges[j].start) {
// showAlert('زمان‌ها نباید تداخل داشته باشند', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// // Check if the current shift is earlier than the previous one
// if (i === 1 && timeRanges[i].start < timeRanges[0].end) {
// showAlert('نوبت دوم نباید قبل از نوبت اول باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// if (i === 2 && timeRanges[i].start < timeRanges[1].end) {
// showAlert('نوبت سوم نباید قبل از نوبت دوم باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
// return;
// }
// }
// }
//}
function focusNextTimeInput(currentInput) {
var inputs = $(".dateTime");
var currentIndex = inputs.index(currentInput);
if (currentIndex !== -1 && currentIndex < inputs.length - 1) {
$(inputs[currentIndex + 1]).focus();
}
}
//******************** برای نوشتن تاریخ ********************
function ajaxSaveData() {