add set salary tab in create employee
This commit is contained in:
@@ -213,6 +213,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
|
||||
.ToList(), earlyExit.Value);
|
||||
}
|
||||
|
||||
public void UpdateIsShiftChange()
|
||||
{
|
||||
var groupSetting = CustomizeWorkshopGroupSettings;
|
||||
@@ -269,4 +270,10 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
|
||||
IsShiftChanged = isShiftChange;
|
||||
}
|
||||
|
||||
|
||||
public void SetSalary(double salary)
|
||||
{
|
||||
Salary = salary;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ public class CustomizeWorkshopGroupSettingsViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public double Salary { get; set; }
|
||||
public string SalaryStr { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public bool MainGroup { get; set; }
|
||||
public List<CustomizeWorkshopShiftViewModel> RollCallWorkshopShifts { get; set; }
|
||||
@@ -18,4 +19,5 @@ public class CustomizeWorkshopGroupSettingsViewModel
|
||||
public BreakTime BreakTime { get; set; }
|
||||
public FridayWork FridayWork { get; set; }
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
public int LeavePermitted { get; set; }
|
||||
}
|
||||
@@ -28,6 +28,10 @@ public class CreateEmployeeByClient
|
||||
public List<AddEmployeeDocumentItem> EmployeeDocumentItems { get; set; }
|
||||
public bool HasEmployeeDocument { get; set; }
|
||||
public bool HasRollCallService { get; set; }
|
||||
public bool HasCustomizeCheckoutService { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,12 +19,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Hangfire.States;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -372,10 +373,10 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
}
|
||||
|
||||
if (customizeWorkshopGroupSettings.MainGroup)
|
||||
{
|
||||
var createDefaultEmployee = CreateEmployeeSettings(command);
|
||||
return createDefaultEmployee;
|
||||
}
|
||||
{
|
||||
var createDefaultEmployee = CreateEmployeeSettings(command);
|
||||
return createDefaultEmployee;
|
||||
}
|
||||
|
||||
|
||||
List<CustomizeWorkshopEmployeeSettingsShift> shiftCollection = new List<CustomizeWorkshopEmployeeSettingsShift>();
|
||||
@@ -557,7 +558,13 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
_customizeWorkshopEmployeeSettingsRepository.Create(entity);
|
||||
|
||||
entity.SimpleEdit(shiftCollection, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, isChanged, command.FridayWork, command.HolidayWork, rotatingShift);
|
||||
entity.SimpleEdit(shiftCollection, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, isChanged, command.FridayWork, command.HolidayWork, rotatingShift);
|
||||
var employeeSalary = command.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary > 0)
|
||||
{
|
||||
entity.SetSalary(employeeSalary);
|
||||
}
|
||||
|
||||
_customizeWorkshopGroupSettingsRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
@@ -681,7 +688,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command,
|
||||
List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
List<ReCalculateRollCallValues> reCalculateCommand)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
@@ -712,15 +719,15 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
{
|
||||
|
||||
groupSettingsShifts = command.ShiftViewModel.Select(x =>
|
||||
{
|
||||
if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start))
|
||||
throw new InvalidDataException();
|
||||
if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end))
|
||||
throw new InvalidDataException();
|
||||
{
|
||||
if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start))
|
||||
throw new InvalidDataException();
|
||||
if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end))
|
||||
throw new InvalidDataException();
|
||||
|
||||
return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement);
|
||||
return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement);
|
||||
|
||||
}).ToList();
|
||||
}).ToList();
|
||||
|
||||
if (groupSettingsShifts.All(x => workshopSettings.CustomizeWorkshopSettingsShifts.Any(y => x.Equals(y)))
|
||||
&& command.WorkshopShiftStatus == workshopSettings.WorkshopShiftStatus && command.FridayWork == workshopSettings.FridayWork &&
|
||||
@@ -1589,10 +1596,6 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
return _customizeWorkshopGroupSettingsRepository.GetEmployeesGroupSettingsByEmployeeId(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
return _customizeWorkshopGroupSettingsRepository.HasAnyEmployeeWithoutGroup(workshopId);
|
||||
}
|
||||
public OperationResult<List<long>> ValidateReCalculateValueForGroupEdit(List<ReCalculateRollCallValues> commands,
|
||||
long workshopId)
|
||||
{
|
||||
@@ -1623,10 +1626,16 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
employeeIdsHasCheckout = employeeIdsHasCheckout.Distinct().ToList();
|
||||
return isSuccess ?
|
||||
operationResult.Succcedded(employeeIdsHasCheckout)
|
||||
operationResult.Succcedded(employeeIdsHasCheckout)
|
||||
:
|
||||
operationResult.Failed("پرسنل هایی دارای فیش هستند لطفا نسبت به تعیین تکلیف این ها اقدام نمایید", employeeIdsHasCheckout);
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
return _customizeWorkshopGroupSettingsRepository.HasAnyEmployeeWithoutGroup(workshopId);
|
||||
}
|
||||
|
||||
public bool CheckEmployeeShiftHasChanged(EditCustomizeEmployeeSettings command)
|
||||
{
|
||||
return _customizeWorkshopEmployeeSettingsRepository.CheckEmployeeShiftHasChanged(command);
|
||||
|
||||
@@ -1,35 +1,38 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.EFCore;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using CompanyManagment.EFCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
using EmployeeInsuranceRecord = Company.Domain.EmployeeInsuranceRecordAgg.EmployeeInsuranceRecord;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
using CompanyManagment.App.Contracts.EmployeeBankInformation;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using System.Transactions;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using RollCallEmployee = Company.Domain.RollCallEmployeeAgg.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using System.Reflection;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -37,6 +40,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
private readonly IEmployeeRepository _EmployeeRepository;
|
||||
private readonly IWorkshopRepository _WorkShopRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IPersonnelCodeRepository _personnelCodeRepository;
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly CompanyContext _context;
|
||||
public bool nationalCodValid = false;
|
||||
public bool idnumberIsOk = true;
|
||||
@@ -54,16 +60,25 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly IUidService _uidService;
|
||||
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IPersonnelCodeRepository _personnelCodeRepository;
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
private readonly IEmployeeAuthorizeTempRepository _employeeAuthorizeTempRepository;
|
||||
private readonly IRollCallServiceRepository _rollCallServiceRepository;
|
||||
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository) : base(context)
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository,
|
||||
ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository,
|
||||
IEmployeeClientTempRepository employeeClientTempRepository, IWebHostEnvironment webHostEnvironment,
|
||||
IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository,
|
||||
ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository,
|
||||
ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication,
|
||||
IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository,
|
||||
IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository,
|
||||
IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, IRollCallServiceRepository rollCallServiceRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
this._leftWorkRepository = leftWorkRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
@@ -73,18 +88,15 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_uidService = uidService;
|
||||
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
_rollCallServiceRepository = rollCallServiceRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateEmployee command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
if (_EmployeeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null && x.IsActiveString == "true"))
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber !=null))
|
||||
@@ -102,7 +114,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
if (command.Address != null && command.State == null)
|
||||
{
|
||||
@@ -141,8 +153,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -194,9 +206,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return opration.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
@@ -221,9 +233,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return opration.Succcedded(employeeData.id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public OperationResult Edit(EditEmployee command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -232,11 +245,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_EmployeeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id && x.IsActiveString == "true"))
|
||||
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber != null && x.id != command.Id))
|
||||
// return opration.Failed("شماره شناسنامه وارد شده تکراری است");
|
||||
|
||||
|
||||
if (command.Address != null && command.State == null)
|
||||
{
|
||||
StatCity = false;
|
||||
@@ -274,8 +287,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -328,7 +341,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
||||
@@ -336,7 +349,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
dateOfIssue,
|
||||
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,
|
||||
command.Phone, command.Address,
|
||||
command.State,command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
||||
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
||||
command.FieldOfStudy, command.BankCardNumber,
|
||||
command.BankBranch, command.InsuranceCode, command.InsuranceHistoryByYear,
|
||||
command.InsuranceHistoryByMonth, command.NumberOfChildren, command.OfficePhone
|
||||
@@ -349,7 +362,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return opration.Succcedded();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public EditEmployee GetDetails(long id)
|
||||
@@ -357,6 +370,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return _EmployeeRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public EditEmployee GetDetailsIgnoreQueryFilter(long id)
|
||||
{
|
||||
return _EmployeeRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -395,8 +413,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
public async Task<List<EmployeeViewModel>> Search(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var res=await _EmployeeRepository.Search(searchModel);
|
||||
|
||||
var res = await _EmployeeRepository.Search(searchModel);
|
||||
|
||||
foreach (var item in res)
|
||||
{
|
||||
var children = _context.EmployeeChildrenSet.Count(x => x.EmployeeId == item.Id);
|
||||
@@ -687,8 +705,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -817,8 +835,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "2222222222":
|
||||
case "3333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
@@ -898,11 +916,17 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Pooya
|
||||
|
||||
|
||||
public List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
public EmployeeViewModel GetEmployeeByNationalCodeIfHasActiveLeftWork(string nationalCode, List<long> workshopIds)
|
||||
{
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
@@ -910,7 +934,6 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
||||
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
||||
}
|
||||
|
||||
public EmployeeViewModel GetEmployeeByNationalCodeIfHasLeftWork(string nationalCode, List<long> workshopIds)
|
||||
{
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
@@ -918,11 +941,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkedEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
||||
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
||||
}
|
||||
public List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeViewModel> GetRangeByIds(IEnumerable<long> employeeIds)
|
||||
{
|
||||
@@ -958,6 +978,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
@@ -1041,6 +1062,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
_personnelCodeRepository.SaveChanges();
|
||||
}
|
||||
|
||||
var rollCallService = _rollCallServiceRepository.GetActiveServiceByWorkshopId(command.WorkshopId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture1) == false &&
|
||||
string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture2) == false)
|
||||
@@ -1050,14 +1072,14 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
var filePath1 = Path.Combine(directoryPath) + $@"\1.jpg";
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture1, filePath1);
|
||||
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture1, filePath1);
|
||||
|
||||
|
||||
var filePath2 = Path.Combine(directoryPath) + $@"\2.jpg";
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture2, filePath2);
|
||||
|
||||
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture2, filePath2);
|
||||
|
||||
|
||||
|
||||
var rollCallEmployee =
|
||||
@@ -1090,6 +1112,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (rollCallService?.HasCustomizeCheckoutService == "true")
|
||||
{
|
||||
var employeeSalary = command.CreateCustomizeEmployeeSettings.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary < 1)
|
||||
{
|
||||
return op.Failed("لطفا حقوق پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
}
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id))
|
||||
{
|
||||
@@ -1117,6 +1149,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
else if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (rollCallService?.HasCustomizeCheckoutService == "true")
|
||||
{
|
||||
var employeeSalary = command.CreateCustomizeEmployeeSettings.Salary?.MoneyToDouble() ?? 0;
|
||||
|
||||
if (employeeSalary < 1)
|
||||
{
|
||||
return op.Failed("لطفا حقوق پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
}
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id))
|
||||
{
|
||||
@@ -1210,6 +1252,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
byte[] bytes = Convert.FromBase64String(subBase64);
|
||||
System.IO.File.WriteAllBytes(filePath, bytes);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate, long workshopId)
|
||||
{
|
||||
@@ -1499,9 +1542,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
{
|
||||
employee.EditAuthorizeEmployee(employee.DateOfIssue, employee.PlaceOfIssue,
|
||||
employee.Phone, employee.Address, employee.State, employee.City, command.MaritalStatus,
|
||||
command.MilitaryService, employee.LevelOfEducation, employee.FieldOfStudy,
|
||||
command.MilitaryService, employee.LevelOfEducation, employee.FieldOfStudy,
|
||||
employee.BankCardNumber, employee.BankBranch, employee.InsuranceCode,
|
||||
employee.InsuranceHistoryByYear, employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.InsuranceHistoryByYear, employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
@@ -1615,6 +1658,5 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -8,364 +8,351 @@ using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewM
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, IAuthHelper authHelper, IEmployeeRepository employeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IAuthHelper _authHelper = authHelper;
|
||||
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth)
|
||||
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, IAuthHelper authHelper, IEmployeeRepository employeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
|
||||
{
|
||||
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();
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IAuthHelper _authHelper = authHelper;
|
||||
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
|
||||
|
||||
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Select(y => y.EmployeeId)
|
||||
.ToList();
|
||||
var employees = _employeeRepository.GetBy(employeeIds);
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth)
|
||||
{
|
||||
Id = entity.id,
|
||||
Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
|
||||
{
|
||||
var employee = employees.First(e => e.Id == y.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = y.id,
|
||||
EmployeeId = y.EmployeeId,
|
||||
IsSettingChanged = y.IsSettingChanged,
|
||||
IsShiftChanged = y.IsShiftChanged,
|
||||
Name = $"{employee}",
|
||||
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,
|
||||
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();
|
||||
|
||||
};
|
||||
}).ToList(),
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
IrregularShift = x.IrregularShift,
|
||||
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,
|
||||
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,
|
||||
Offset = entity.EndTimeOffSet,
|
||||
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,
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = y.LeavePermittedDays,
|
||||
IrregularShift = y.IrregularShift,
|
||||
WorkshopShiftStatus = y.WorkshopShiftStatus
|
||||
};
|
||||
}).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,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift
|
||||
|
||||
|
||||
|
||||
}).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Select(y => y.EmployeeId)
|
||||
.ToList();
|
||||
var employees = _employeeRepository.GetBy(employeeIds);
|
||||
return new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value,
|
||||
LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value,
|
||||
EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
Value = entity.BonusesPay.Value,
|
||||
BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
Value = entity.ShiftPay.Value,
|
||||
ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value,
|
||||
PaymentType = entity.BaseYearsPay.PaymentType
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new()
|
||||
{
|
||||
Value = entity.LeavePay.Value,
|
||||
LeavePayType = entity.LeavePay.LeavePayType
|
||||
},
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
Currency = entity.Currency,
|
||||
MaxMonthDays = entity.MaxMonthDays,
|
||||
Id = entity.id,
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
BonusesPaysInEndOfMonth = entity.BonusesPaysInEndOfMonth,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus
|
||||
|
||||
};
|
||||
return viewModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm"),
|
||||
Placement = x.Placement
|
||||
}).ToList(),
|
||||
Id = entity.id,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
FridayWork = entity.FridayWork,
|
||||
HolidayWork = entity.HolidayWork
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId)
|
||||
{
|
||||
|
||||
|
||||
var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
where groupSetting.IsShiftChange // Filter parent tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged// Filter child tables where isChange is true
|
||||
join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped
|
||||
select new ChangedGroupedViewModel
|
||||
{
|
||||
GroupName = grouped.First().GroupName,
|
||||
EmployeeName = grouped.Select(e => e.FullName).ToList()
|
||||
};
|
||||
|
||||
return result.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
|
||||
{
|
||||
var customizeWorkshopSettings = _companyContext.CustomizeWorkshopSettings
|
||||
.AsNoTracking().AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.Select(x => new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
GroupSettings = x.CustomizeWorkshopGroupSettingsCollection.Select(g =>
|
||||
Id = entity.id,
|
||||
Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name,
|
||||
GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = g.id,
|
||||
IrregularShift = g.IrregularShift,
|
||||
WorkshopShiftStatus = g.WorkshopShiftStatus,
|
||||
GroupName = g.GroupName,
|
||||
MainGroup = g.MainGroup,
|
||||
RollCallWorkshopShifts = g.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
Id = x.id,
|
||||
GroupName = x.GroupName,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
IrregularShift = x.IrregularShift,
|
||||
Salary = x.Salary,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
StartTime = s.StartTime.ToString("HH:mm"),
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
}).ToList(),
|
||||
BreakTime = g.BreakTime,
|
||||
HolidayWork = g.HolidayWork,
|
||||
FridayWork = g.FridayWork,
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime = r.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).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(),
|
||||
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
return customizeWorkshopSettings;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
|
||||
{
|
||||
var employee = _companyContext.CustomizeWorkshopSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
if (employee == null)
|
||||
return new();
|
||||
|
||||
var employeeName = _companyContext.Employees.Select(x => new { x.FullName, x.id })
|
||||
.FirstOrDefault(x => x.id == employee.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
};
|
||||
}
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
|
||||
{
|
||||
Id = employee.id,
|
||||
EmployeeId = employee.EmployeeId,
|
||||
IsSettingChanged = employee.IsSettingChanged,
|
||||
IsShiftChanged = employee.IsShiftChanged,
|
||||
Name = employeeName?.FullName,
|
||||
RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
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,
|
||||
Offset = entity.EndTimeOffSet,
|
||||
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,
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = y.LeavePermittedDays,
|
||||
IrregularShift = y.IrregularShift,
|
||||
WorkshopShiftStatus = y.WorkshopShiftStatus
|
||||
};
|
||||
}).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,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r=>new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift
|
||||
|
||||
|
||||
|
||||
}).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value,
|
||||
LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value,
|
||||
EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
Value = entity.BonusesPay.Value,
|
||||
BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
Value = entity.ShiftPay.Value,
|
||||
ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value,
|
||||
PaymentType = entity.BaseYearsPay.PaymentType
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new()
|
||||
{
|
||||
Value = entity.LeavePay.Value,
|
||||
LeavePayType = entity.LeavePay.LeavePayType
|
||||
},
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
Currency = entity.Currency,
|
||||
MaxMonthDays = entity.MaxMonthDays,
|
||||
Id = entity.id,
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
BonusesPaysInEndOfMonth = entity.BonusesPaysInEndOfMonth,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus
|
||||
|
||||
};
|
||||
return viewModel;
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettings GetBy(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
StartTime = x.StartTime.ToString("HH:mm"),
|
||||
Placement = x.Placement
|
||||
}).ToList(),
|
||||
Salary = employee.Salary
|
||||
};
|
||||
}
|
||||
Id = entity.id,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
FridayWork = entity.FridayWork,
|
||||
HolidayWork = entity.HolidayWork
|
||||
|
||||
#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 =>
|
||||
};
|
||||
}
|
||||
|
||||
public List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId)
|
||||
{
|
||||
|
||||
|
||||
var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
where groupSetting.IsShiftChange // Filter parent tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged// Filter child tables where isChange is true
|
||||
join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped
|
||||
select new ChangedGroupedViewModel
|
||||
{
|
||||
GroupName = grouped.First().GroupName,
|
||||
EmployeeName = grouped.Select(e => e.FullName).ToList()
|
||||
};
|
||||
|
||||
return result.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
|
||||
{
|
||||
var customizeWorkshopSettings = _companyContext.CustomizeWorkshopSettings
|
||||
.AsNoTracking().AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.Select(x => new CustomizeWorkshopSettingsViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
GroupSettings = x.CustomizeWorkshopGroupSettingsCollection.Select(g =>
|
||||
new CustomizeWorkshopGroupSettingsViewModel()
|
||||
{
|
||||
Id = g.id,
|
||||
IrregularShift = g.IrregularShift,
|
||||
WorkshopShiftStatus = g.WorkshopShiftStatus,
|
||||
GroupName = g.GroupName,
|
||||
MainGroup = g.MainGroup,
|
||||
Salary = g.Salary,
|
||||
SalaryStr = g.Salary.ToMoney(),
|
||||
LeavePermitted = g.LeavePermittedDays,
|
||||
RollCallWorkshopShifts = g.CustomizeWorkshopGroupSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
StartTime = s.StartTime.ToString("HH:mm"),
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
}).ToList(),
|
||||
BreakTime = g.BreakTime,
|
||||
HolidayWork = g.HolidayWork,
|
||||
FridayWork = g.FridayWork,
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r=>new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime= r.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
|
||||
}).ToList(),
|
||||
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
return customizeWorkshopSettings;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
|
||||
{
|
||||
var employee = _companyContext.CustomizeWorkshopSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
if (employee == null)
|
||||
return new();
|
||||
|
||||
var employeeName = _companyContext.Employees.Select(x => new { x.FullName, x.id })
|
||||
.FirstOrDefault(x => x.id == employee.EmployeeId);
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = employee.id,
|
||||
EmployeeId = employee.EmployeeId,
|
||||
IsSettingChanged = employee.IsSettingChanged,
|
||||
IsShiftChanged = employee.IsShiftChanged,
|
||||
Name = employeeName?.FullName,
|
||||
RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
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 =>
|
||||
.Where(x => x.Salary > 0).Select(x =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
@@ -374,31 +361,26 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
EmployeeId = x.EmployeeId,
|
||||
BreakTime = x.BreakTime
|
||||
});
|
||||
return query.ToList();
|
||||
}
|
||||
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
|
||||
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();
|
||||
}
|
||||
.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();
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettings GetBy(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.AsSplitQuery()
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -44,14 +44,20 @@
|
||||
<div>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-3">گروهبندی حضور و غیاب</button>
|
||||
</div>
|
||||
@if (Model.HasCustomizeCheckoutService)
|
||||
{
|
||||
<div>
|
||||
<button class="stepStatus" id="step-4">فیش حقوقی غیر رسمی</button>
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-4">آپلود عکس حضور و غیاب</button>
|
||||
<button class="stepStatus @(Model.HasRollCallService ? "" : "disable")" id="step-5">آپلود عکس حضور و غیاب</button>
|
||||
</div>
|
||||
<div class="employeePart">
|
||||
<button class="stepStatus" id="step-5">حساب بانکی پرسنل</button>
|
||||
<button class="stepStatus" id="step-6">حساب بانکی پرسنل</button>
|
||||
</div>
|
||||
<div class="employeePart">
|
||||
<button class="stepStatus" id="step-6">آپلود مدارک</button>
|
||||
<button class="stepStatus" id="step-7">آپلود مدارک</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,20 +152,53 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="step4" class="step m-auto">
|
||||
<div class="container p-0 m-0 @(Model.HasRollCallService ? "" : "disable")" id="step-form4">
|
||||
|
||||
@if (Model.HasCustomizeCheckoutService)
|
||||
{
|
||||
<div id="step4" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="tempCheckoutEmployeeSetting">
|
||||
<partial name="Company/Employees/_Partials/TempCheckout" model="@Model" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep4">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep4">مرحله بعد</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
<button type="button" class="stepBtn saveData SaveFullData" id="saveFullData4">
|
||||
<span>ذخیره</span>
|
||||
<div class="spinner-loading loading" style="display: none;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
<div id="step5" class="step m-auto">
|
||||
<div class="container p-0 m-0 @(Model.HasRollCallService ? "" : "disable")" id="step-form5">
|
||||
<partial name="Company/Employees/_Partials/ModalUploadImagePersonnel" model="@Model"/>
|
||||
</div>
|
||||
<div class="stepBtnHolder3">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep4">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="prevStep5">مرحله قبل</button>
|
||||
@if (rollCallPath == "/Client/Company/RollCall/EmployeeUploadPicture")
|
||||
{
|
||||
<button type="button" class="stepBtn disable">مرحله بعد</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="stepBtn" id="nextStep4">مرحله بعد</button>
|
||||
<button type="button" class="stepBtn" id="nextStep5">مرحله بعد</button>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
@@ -176,7 +215,7 @@
|
||||
|
||||
@if (rollCallPath != "/Client/Company/RollCall/EmployeeUploadPicture")
|
||||
{
|
||||
<div id="step5" class="step w-100 overflow-y-auto">
|
||||
<div id="step6" class="step w-100 overflow-y-auto overflow-x-hidden">
|
||||
<div class="container p-0 m-0" id="step-form5">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -188,8 +227,8 @@
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep5">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep5">مرحله بعد</button>
|
||||
<button type="button" class="stepBtn" id="prevStep6">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn" id="nextStep6">مرحله بعد</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
@@ -203,8 +242,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="step6" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form6">
|
||||
<div id="step7" class="step w-100 overflow-y-auto">
|
||||
<div class="container p-0 m-0" id="step-form7">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="uploadDocument">
|
||||
@@ -215,8 +254,8 @@
|
||||
</div>
|
||||
<div class="stepBtnHolder2">
|
||||
<div class="stepBtnFirst d-flex gap-2 justify-content-center">
|
||||
<button type="button" class="stepBtn" id="prevStep6">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn disable" id="nextStep6">پایان</button>
|
||||
<button type="button" class="stepBtn" id="prevStep7">مرحله قبل</button>
|
||||
<button type="button" class="stepBtn disable" id="nextStep7">پایان</button>
|
||||
</div>
|
||||
<div class="w-100 d-flex gap-2 mt-2 justify-content-center">
|
||||
<button type="button" class="stepBtn cancelButton">انصراف</button>
|
||||
@@ -284,6 +323,8 @@
|
||||
var workshopSettingListAjax = `@Url.Page("/Company/Employees/EmployeeList", "WorkshopSettingList")`; // EmployeeList Handler
|
||||
var workshopSettingListAjaxRollCall = `@Url.Page("/Company/RollCall/EmployeeUploadPicture", "WorkshopSettingList")`; // RollCall Handler
|
||||
var workshopSettingListAjaxHome = `@Url.Page("/Index", "WorkshopSettingList")`; // Home Handler
|
||||
|
||||
var hasCustomizeCheckoutService = `@Model.HasCustomizeCheckoutService`;
|
||||
|
||||
// @* var workshopSettingEmployeeSelecting = @Html.Raw(Json.Serialize(Model.EmployeeSettings)); *@
|
||||
</script>
|
||||
|
||||
@@ -24,257 +24,260 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
[Authorize]
|
||||
[NeedsPermission(SubAccountPermissionHelper.PersonnelListPermissionCode)]
|
||||
public class EmployeeListModel : PageModel
|
||||
{
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
private readonly IBankApplication _bankApplication;
|
||||
private readonly IEmployeeBankInformationApplication _employeeBankInformationApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IJobApplication _jobApplication;
|
||||
{
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
private readonly IBankApplication _bankApplication;
|
||||
private readonly IEmployeeBankInformationApplication _employeeBankInformationApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IJobApplication _jobApplication;
|
||||
private readonly ILeftWorkTempApplication _leftWorkTempApplication;
|
||||
private readonly IRollCallServiceApplication _rollCallServiceApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public PersonnelInfoViewModel Employees;
|
||||
public bool HasEmployees;
|
||||
public long WorkshopId;
|
||||
public string WorkshopFullName;
|
||||
public EmployeeSearchModel SearchModel;
|
||||
public bool HasEmployees;
|
||||
public long WorkshopId;
|
||||
public string WorkshopFullName;
|
||||
public EmployeeSearchModel SearchModel;
|
||||
|
||||
public EmployeeListModel(IBankApplication bankApplication,IEmployeeBankInformationApplication employeeBankInformationApplication,IEmployeeDocumentsApplication employeeDocumentsApplication,IAuthHelper authHelper,IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IPersonnelCodeApplication personnelCodeApplication, IJobApplication jobApplication, ILeftWorkTempApplication leftWorkTempApplication, IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_workshopApplication = workshopApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_contextAccessor = contextAccessor;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_jobApplication = jobApplication;
|
||||
_leftWorkTempApplication = leftWorkTempApplication;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_authHelper = authHelper;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_bankApplication = bankApplication;
|
||||
public EmployeeListModel(IBankApplication bankApplication, IEmployeeBankInformationApplication employeeBankInformationApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IAuthHelper authHelper, IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IPersonnelCodeApplication personnelCodeApplication, IJobApplication jobApplication, ILeftWorkTempApplication leftWorkTempApplication, IRollCallServiceApplication rollCallServiceApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_workshopApplication = workshopApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_contextAccessor = contextAccessor;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_jobApplication = jobApplication;
|
||||
_leftWorkTempApplication = leftWorkTempApplication;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_authHelper = authHelper;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_bankApplication = bankApplication;
|
||||
|
||||
|
||||
|
||||
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
|
||||
if (_workshopId < 1)
|
||||
throw new InvalidDataException("اختلال در کارگاه");
|
||||
if (_workshopId < 1)
|
||||
throw new InvalidDataException("اختلال در کارگاه");
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
var workshop = _workshopApplication.GetWorkshopInfo(_workshopId);
|
||||
WorkshopFullName = workshop.WorkshopFullName;
|
||||
WorkshopId = workshop.Id;
|
||||
public void OnGet()
|
||||
{
|
||||
var workshop = _workshopApplication.GetWorkshopInfo(_workshopId);
|
||||
WorkshopFullName = workshop.WorkshopFullName;
|
||||
WorkshopId = workshop.Id;
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeeListAjax(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var personnelSearchModel = new PersonnelInfoSearchModel()
|
||||
{
|
||||
WorkshopId = _workshopId,
|
||||
};
|
||||
public IActionResult OnGetEmployeeListAjax(EmployeeSearchModel searchModel)
|
||||
{
|
||||
var personnelSearchModel = new PersonnelInfoSearchModel()
|
||||
{
|
||||
WorkshopId = _workshopId,
|
||||
};
|
||||
|
||||
var result = _workshopApplication.GetPersonnelInfoRemastered(personnelSearchModel);
|
||||
var result = _workshopApplication.GetPersonnelInfoRemastered(personnelSearchModel);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
||||
result = result.Where(x => x.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
||||
result = result.Where(x => x.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||
result = result.Where(x => x.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||
result = result.Where(x => x.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
||||
|
||||
var resultData = new PersonnelInfoViewModel()
|
||||
{
|
||||
PersonnelInfoViewModels = result.OrderByDescending(x => x.CreatedByClient).ThenByDescending(x => x.LefWorkTemp).ThenBy(x => x.Black ? 1 : 0).ThenBy(x => x.PersonnelCode).ToList(),
|
||||
};
|
||||
var resultData = new PersonnelInfoViewModel()
|
||||
{
|
||||
PersonnelInfoViewModels = result.OrderByDescending(x => x.CreatedByClient).ThenByDescending(x => x.LefWorkTemp).ThenBy(x => x.Black ? 1 : 0).ThenBy(x => x.PersonnelCode).ToList(),
|
||||
};
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetPrintOnePersonnelInfo(long employeeId)
|
||||
{
|
||||
var result = _employeeApplication.GetDetails(employeeId);
|
||||
return Partial("PrintOnePersonnelInfo", result);
|
||||
}
|
||||
public IActionResult OnGetPrintOnePersonnelInfo(long employeeId)
|
||||
{
|
||||
var result = _employeeApplication.GetDetails(employeeId);
|
||||
return Partial("PrintOnePersonnelInfo", result);
|
||||
}
|
||||
|
||||
public IActionResult OnGetEmployeeDataByNationalCode(string nationalCode)
|
||||
{
|
||||
var workshopIds = _workshopApplication.GetWorkshopAccount().Select(workshop => workshop.Id).ToList();
|
||||
public IActionResult OnGetEmployeeDataByNationalCode(string nationalCode)
|
||||
{
|
||||
var workshopIds = _workshopApplication.GetWorkshopAccount().Select(workshop => workshop.Id).ToList();
|
||||
|
||||
var resultData = _employeeApplication.GetEmployeeByNationalCodeIfHasLeftWork(nationalCode, workshopIds);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetWorkshopSettingList()
|
||||
{
|
||||
var resultData = _customizeWorkshopSettingsApplication.GetWorkshopIncludeGroupsByWorkshopId(_workshopId);
|
||||
if (resultData != null)
|
||||
{
|
||||
resultData.GroupSettings = resultData?.GroupSettings.Where(x => !x.MainGroup).ToList();
|
||||
public IActionResult OnGetWorkshopSettingList()
|
||||
{
|
||||
var resultData = _customizeWorkshopSettingsApplication.GetWorkshopIncludeGroupsByWorkshopId(_workshopId);
|
||||
if (resultData != null)
|
||||
{
|
||||
resultData.GroupSettings = resultData?.GroupSettings.Where(x => !x.MainGroup).ToList();
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetCreateEmployee()
|
||||
{
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(_workshopId) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(_workshopId);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(_workshopId);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
public IActionResult OnPostCreateEmployee(CreateEmployeeByClient command)
|
||||
{
|
||||
command.WorkshopId = _workshopId;
|
||||
{
|
||||
command.WorkshopId = _workshopId;
|
||||
var result = _employeeApplication.CreateEmployeeByClient(command);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
});
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode,string birthDate)
|
||||
{
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate)
|
||||
{
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, _workshopId);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnGetJobSearch(string jobName)
|
||||
{
|
||||
var jobViewModels = _jobApplication.GetJobListByText(jobName);
|
||||
public IActionResult OnGetJobSearch(string jobName)
|
||||
{
|
||||
var jobViewModels = _jobApplication.GetJobListByText(jobName);
|
||||
|
||||
return new JsonResult(jobViewModels);
|
||||
}
|
||||
return new JsonResult(jobViewModels);
|
||||
}
|
||||
|
||||
//step 4
|
||||
public IActionResult OnGetDetailsAjax(long employeeId)
|
||||
{
|
||||
var resultData = _employeeBankInformationApplication.GetByEmployeeId(_workshopId, employeeId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData
|
||||
});
|
||||
}
|
||||
//public IActionResult OnPostCreate(CreateEmployeeInformation command)
|
||||
//{
|
||||
// command.WorkshopId = _workshopId;
|
||||
// if (!string.IsNullOrWhiteSpace(command.CardNumber))
|
||||
// command.CardNumber = command.CardNumber.Replace("-", "");
|
||||
//step 4
|
||||
public IActionResult OnGetDetailsAjax(long employeeId)
|
||||
{
|
||||
var resultData = _employeeBankInformationApplication.GetByEmployeeId(_workshopId, employeeId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData
|
||||
});
|
||||
}
|
||||
//public IActionResult OnPostCreate(CreateEmployeeInformation command)
|
||||
//{
|
||||
// command.WorkshopId = _workshopId;
|
||||
// if (!string.IsNullOrWhiteSpace(command.CardNumber))
|
||||
// command.CardNumber = command.CardNumber.Replace("-", "");
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(command.ShebaNumber))
|
||||
// command.ShebaNumber = command.ShebaNumber.Replace("-", "");
|
||||
// if (!string.IsNullOrWhiteSpace(command.ShebaNumber))
|
||||
// command.ShebaNumber = command.ShebaNumber.Replace("-", "");
|
||||
|
||||
// var result = _employeeBankInformationApplication.Create(command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostDelete(long id)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.Remove(id);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
// var result = _employeeBankInformationApplication.Create(command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostDelete(long id)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.Remove(id);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
|
||||
public IActionResult OnGetBankListAjax()
|
||||
{
|
||||
var resultData = _bankApplication.Search("");
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
public IActionResult OnGetBankListAjax()
|
||||
{
|
||||
var resultData = _bankApplication.Search("");
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData,
|
||||
});
|
||||
}
|
||||
|
||||
//public IActionResult OnPostGroupCreate(List<CreateEmployeeInformation> command)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.GroupCreate(_workshopId, command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostGroupCreate(List<CreateEmployeeInformation> command)
|
||||
//{
|
||||
// var result = _employeeBankInformationApplication.GroupCreate(_workshopId, command);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// success = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// id = result.SendId
|
||||
// });
|
||||
//}
|
||||
|
||||
//step 5
|
||||
public IActionResult OnPostCreateUploadDocument(AddEmployeeDocumentItem command)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId <= 0)
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = false,
|
||||
message = "کارگاهی یافت نشد",
|
||||
});
|
||||
command.WorkshopId = workshopId;
|
||||
//step 5
|
||||
public IActionResult OnPostCreateUploadDocument(AddEmployeeDocumentItem command)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId <= 0)
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = false,
|
||||
message = "کارگاهی یافت نشد",
|
||||
});
|
||||
command.WorkshopId = workshopId;
|
||||
|
||||
|
||||
var result = _employeeDocumentsApplication.AddEmployeeDocumentItemForClient(command);
|
||||
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(command.EmployeeId, workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
imageSrc = employeeDocument
|
||||
});
|
||||
}
|
||||
|
||||
//public IActionResult OnPostSaveSubmit(SubmitEmployeeDocuments cmd)
|
||||
//{
|
||||
// var result = _employeeDocumentsApplication.SubmitDocumentItemsByClient(cmd);
|
||||
var result = _employeeDocumentsApplication.AddEmployeeDocumentItemForClient(command);
|
||||
var employeeDocument = _employeeDocumentsApplication.GetDetailsForClient(command.EmployeeId, workshopId);
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccedded = result.IsSuccedded,
|
||||
message = result.Message,
|
||||
imageSrc = employeeDocument
|
||||
});
|
||||
}
|
||||
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostSaveSubmit(SubmitEmployeeDocuments cmd)
|
||||
//{
|
||||
// var result = _employeeDocumentsApplication.SubmitDocumentItemsByClient(cmd);
|
||||
|
||||
//public IActionResult OnPostRemoveEmployeeDocumentByLabel(long employeeId, DocumentItemLabel label)
|
||||
//{
|
||||
// var workshopId = _passwordHasher.SlugDecrypt(_authHelper.GetWorkshopSlug());
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message,
|
||||
// });
|
||||
//}
|
||||
|
||||
// var result = _employeeDocumentsApplication.DeleteEmployeeMultipleUnsubmittedDocumentsByLabel(workshopId, employeeId,
|
||||
// label);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message
|
||||
// });
|
||||
//}
|
||||
//public IActionResult OnPostRemoveEmployeeDocumentByLabel(long employeeId, DocumentItemLabel label)
|
||||
//{
|
||||
// var workshopId = _passwordHasher.SlugDecrypt(_authHelper.GetWorkshopSlug());
|
||||
|
||||
// var result = _employeeDocumentsApplication.DeleteEmployeeMultipleUnsubmittedDocumentsByLabel(workshopId, employeeId,
|
||||
// label);
|
||||
// return new JsonResult(new
|
||||
// {
|
||||
// isSuccedded = result.IsSuccedded,
|
||||
// message = result.Message
|
||||
// });
|
||||
//}
|
||||
|
||||
#region Left Work
|
||||
public IActionResult OnGetCreateLeftWorkEmployee()
|
||||
@@ -282,7 +285,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
var command = new CreateLeftWorkTemp();
|
||||
return Partial("ModalCreateLeftWorkEmployee", command);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeList()
|
||||
{
|
||||
var employees = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId);
|
||||
@@ -293,13 +296,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
data = employees
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeListLeftWorkTemp()
|
||||
{
|
||||
var exists = _leftWorkTempApplication.GetLeftWorksByWorkshopId(_workshopId);
|
||||
|
||||
var employees = (await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId))
|
||||
.Where(x=> exists.All(a => a.EmployeeId != x.Id)).ToList();
|
||||
.Where(x => exists.All(a => a.EmployeeId != x.Id)).ToList();
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
@model CompanyManagment.App.Contracts.Employee.CreateEmployeeByClient
|
||||
|
||||
|
||||
@{
|
||||
string clientVersion = _0_Framework.Application.Version.StyleVersion;
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/pages/employees/css/createbankinfomodal.css?ver=@clientVersion" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
.disableColor {
|
||||
border: 1px solid #C6C6C6 !important;
|
||||
background-color: #F0F0F0 !important;
|
||||
}
|
||||
|
||||
.msgStepTempCheckout {
|
||||
border: 1px solid #C6C6C6;
|
||||
border-radius: 9px;
|
||||
width: 60%;
|
||||
margin: 35px auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
}
|
||||
@*
|
||||
<div class="text-center">
|
||||
<div>
|
||||
<p class="m-0 pdHeaderTitle1">ایجاد شماره حساب پرسنل</p>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">نام گروه</span>
|
||||
<input type="text" class="form-control text-center disable disableColor" id="groupNameTemp" placeholder="-" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">حقوق تعیین شده در این گروه</span>
|
||||
<input type="text" class="form-control text-center disable disableColor" id="priceTemp" placeholder="-" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">مرخصی مجاز تعیین شده در این گروه</span>
|
||||
<input class="form-control text-center disable disableColor" id="leavePermitted" placeholder="-" style="direction: ltr;" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">حقوق پرسنل</span>
|
||||
<input class="form-control text-center disable disableColor" id="personnelSalary" name="Command.CreateCustomizeEmployeeSettings.Salary" placeholder="-" style="direction: ltr" />
|
||||
</div>
|
||||
<div class="col-12 my-1 position-relative">
|
||||
<span class="spanTitleText">مجاز مرخصی</span>
|
||||
<input class="form-control text-center disable disableColor" id="leavePermittedDays" name="Command.CreateCustomizeEmployeeSettings.LeavePermittedDays" placeholder="-" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1 position-relative" id="has-group" style="display: block;">
|
||||
<div class="text-center p-4 msgStepTempCheckout">
|
||||
<span class="spanTitleText">به دلیل عدم انتخاب گروهبندی حضور و غیاب، امکان ثبت حقوق برای پرسنل وجود ندارد.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// var getDetailsAjaxUrl = `@Url.Page("/Company/Employees/EmployeeList", "DetailsAjax")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/employees/js/TempCheckout.js?ver=@clientVersion"></script>
|
||||
@@ -732,6 +732,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(_workshopId) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(_workshopId);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(_workshopId);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("../Employees/CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,10 @@ namespace ServiceHost.Areas.Client.Pages
|
||||
long workshopIDecrypt = _passwordHasher.SlugDecrypt(workshopSlug);
|
||||
var command = new CreateEmployeeByClient();
|
||||
command.PersonnelCode = (_personnelCodeApplication.GetLastPersonnelCodeByWorkshop(workshopIDecrypt) + 1).ToString();
|
||||
command.HasRollCallService = _rollCallServiceApplication.IsExistActiveServiceByWorkshopId(workshopIDecrypt);
|
||||
var activeServiceByWorkshopId = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopIDecrypt);
|
||||
command.HasRollCallService = activeServiceByWorkshopId is { Id: > 0 };
|
||||
if (command.HasRollCallService)
|
||||
command.HasCustomizeCheckoutService = activeServiceByWorkshopId.HasCustomizeCheckoutService == "true";
|
||||
return Partial("./Company/Employees/CreateEmployeeModal", command);
|
||||
}
|
||||
|
||||
|
||||
@@ -232,9 +232,18 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// This should be checked the hasCustomizeCheckoutService for step4 / TempCheckout
|
||||
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
if (hasCustomizeCheckoutService==='True') {
|
||||
console.log(hasCustomizeCheckoutService);
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
}
|
||||
} else {
|
||||
if (allowToNextStep3) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,46 +290,58 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
|
||||
class Step4 extends ModalState {
|
||||
class Step4 extends ModalState {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step4").show();
|
||||
$(".step").hide();
|
||||
$("#step4").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-4").addClass("active");
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-4").addClass("active");
|
||||
checkStepStatus();
|
||||
checkPicture();
|
||||
}
|
||||
|
||||
|
||||
next() {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
if (checkStepTempCheckout()) {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
|
||||
prev() {
|
||||
if (checkPicture()) {
|
||||
//if (checkStepTempCheckout()) {
|
||||
this.modal.setState(this.modal.step3);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
class Step5 extends ModalState {
|
||||
render() {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step5").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-5").addClass("active");
|
||||
checkStepStatus();
|
||||
}
|
||||
checkPicture();
|
||||
}
|
||||
|
||||
next() {
|
||||
this.modal.setState(this.modal.step6);
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step6);
|
||||
}
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step4);
|
||||
// This should be checked the hasCustomizeCheckoutService for step4 / TempCheckout
|
||||
if (hasCustomizeCheckoutService === 'True') {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step4);
|
||||
}
|
||||
} else {
|
||||
if (checkPicture()) {
|
||||
this.modal.setState(this.modal.step3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,12 +353,31 @@ $(document).ready(function () {
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-6").addClass("active");
|
||||
checkStepStatus();
|
||||
}
|
||||
|
||||
next() {
|
||||
this.modal.setState(this.modal.step7);
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step5);
|
||||
}
|
||||
}
|
||||
|
||||
class Step7 extends ModalState {
|
||||
render() {
|
||||
$(".step").hide();
|
||||
$("#step7").show();
|
||||
|
||||
$(".stepStatus").removeClass("active");
|
||||
$("#step-7").addClass("active");
|
||||
checkStepStatus();
|
||||
|
||||
checkStep5();
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.modal.setState(this.modal.step5);
|
||||
this.modal.setState(this.modal.step6);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +389,7 @@ $(document).ready(function () {
|
||||
this.step4 = new Step4(this);
|
||||
this.step5 = new Step5(this);
|
||||
this.step6 = new Step6(this);
|
||||
this.step7 = new Step7(this);
|
||||
this.currentState = this.step1;
|
||||
|
||||
this.formData = {};
|
||||
@@ -420,7 +461,10 @@ function saveFullData() {
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.BreakTime.BreakTimeValue", $("#TimeOnly").val());
|
||||
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.FridayWork", $('#Friday1').prop('checked') ? "Default" : "WorkInFriday");
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.HolidayWork", $('#HolidayWork1').prop('checked') ? "Default" : "WorkInHolidays");
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.HolidayWork", $('#HolidayWork1').prop('checked') ? "Default" : "WorkInHolidays");
|
||||
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.Salary", $('#personnelSalary').val());
|
||||
formData.append("Command.CreateCustomizeEmployeeSettings.LeavePermittedDays", $('#leavePermittedDays').val());
|
||||
|
||||
let pic1 = $("#pic1").attr('src');
|
||||
let pic2 = $("#pic2").attr('src');
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
$(document).ready(function() {
|
||||
$("#personnelSalary").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
numeral: true,
|
||||
numeralThousandsGroupStyle: 'thousand'
|
||||
});
|
||||
});
|
||||
|
||||
$("#leavePermittedDays").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
element.mask("000");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function checkStepTempCheckout() {
|
||||
var workshopSettingSelect = $('#workshopSettingSelect').val();
|
||||
if (workshopSettingSelect === "0") {
|
||||
return true;
|
||||
} else {
|
||||
if ($("#personnelSalary").val() === "") {
|
||||
showAlert('لطفا حقوق پرسنل را وارد نمائید.', $("#personnelSalary"));
|
||||
return false;
|
||||
}
|
||||
if ($("#leavePermittedDays").val() === "") {
|
||||
showAlert('لطفا تعداد روز مجاز مرخصی را وارد نمائید.', $("#leavePermittedDays"));
|
||||
return false;
|
||||
}
|
||||
if ($("#personnelSalary").val() !== "" && $("#leavePermittedDays").val() !== "") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -771,6 +771,14 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
if (id === 0) {
|
||||
$('#GroupId').val(0);
|
||||
$('#footer-section').hide();
|
||||
|
||||
//Step (TempCheckout)
|
||||
$("#groupNameTemp").val("-");
|
||||
$("#priceTemp").val("-");
|
||||
$("#leavePermitted").val("-");
|
||||
$("#personnelSalary").val("-").addClass("disable").addClass("disableColor");
|
||||
$("#leavePermittedDays").val("-").addClass("disable").addClass("disableColor");
|
||||
$("#has-group").show();
|
||||
}
|
||||
|
||||
if ($("#workshopSettingSelect").val() === "0") {
|
||||
@@ -803,7 +811,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
success: function (response) {
|
||||
const workshopSettingGroupSelecting = response.data;
|
||||
|
||||
console.log(workshopSettingGroupSelecting);
|
||||
var regularShiftsIndex = 0;
|
||||
var rotatingShiftsIndex = 0;
|
||||
|
||||
@@ -811,7 +819,19 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
workshopSettingGroupSelecting.groupSettings.forEach(function (itemGroupSettings) {
|
||||
|
||||
if (itemGroupSettings.id === id) {
|
||||
if ($('#workshopSettingSelect').find(':selected').data('name-group') === "بدون گروه") {
|
||||
|
||||
if (id !== 0) {
|
||||
//Step (TempCheckout)
|
||||
$("#groupNameTemp").val(itemGroupSettings.groupName);
|
||||
$("#priceTemp").val(itemGroupSettings.salaryStr);
|
||||
$("#leavePermitted").val(itemGroupSettings.leavePermitted);
|
||||
$("#personnelSalary").val('').removeClass("disable").removeClass("disableColor");
|
||||
$("#leavePermittedDays").val('').removeClass("disable").removeClass("disableColor");
|
||||
$("#has-group").hide();
|
||||
}
|
||||
|
||||
|
||||
if ($('#workshopSettingSelect').find(':selected').data('name-group') === "بدون گروه") {
|
||||
$('#stepWorkTimeOptionRadio').hide();
|
||||
$('#step_workTimeOptionNull').hide();
|
||||
$('#step_workTimeOption').hide();
|
||||
@@ -819,6 +839,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
$('#step_workTimeOptionIrregular').hide();
|
||||
$('#step_workTimeOptionWithoutGroup').show();
|
||||
$('#footer-section').hide();
|
||||
|
||||
} else {
|
||||
if (itemGroupSettings.workshopShiftStatus === 0) {
|
||||
|
||||
@@ -927,8 +948,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
|
||||
$('#step_workTimeOptionIrregular').hide();
|
||||
$('#step_workTimeOptionIrregular').html(loadIrregularHtml());
|
||||
|
||||
|
||||
|
||||
updateAddButtonText(regularShiftsIndex);
|
||||
if ((regularShiftsIndex) === 3) {
|
||||
$(".btnAddTimeWork").hide();
|
||||
@@ -938,8 +958,7 @@ $('#workshopSettingSelect').on('change', function () {
|
||||
// Update Remove button enable/disable state
|
||||
updateRemoveButtons();
|
||||
loadCleaveClasses();
|
||||
|
||||
} else if (itemGroupSettings.workshopShiftStatus === 1) {
|
||||
} else if (itemGroupSettings.workshopShiftStatus === 1) {
|
||||
|
||||
//radio btn
|
||||
$("#organized").prop('checked', false);
|
||||
|
||||
Reference in New Issue
Block a user