From d03f19a51e9f80eaa49029baa833625406706093 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Wed, 9 Apr 2025 18:38:05 +0330 Subject: [PATCH 01/12] add new header --- .../Employees/ContractCheckoutStatus.cshtml | 10 + .../Company/RollCall/CameraAccounts.cshtml | 4 + .../Pages/Company/RollCall/CaseHistory.cshtml | 12 +- .../Pages/Company/RollCall/CurrentDay.cshtml | 639 ++++++++++-------- .../RollCall/EmployeeUploadPicture.cshtml | 3 + .../Pages/Company/RollCall/Grouping.cshtml | 4 + .../Pages/Company/RollCall/Index.cshtml | 22 +- .../Pages/Company/RollCall/Index.cshtml.cs | 46 +- .../RollCall/ModalSettingWorkTime.cshtml | 2 +- .../ContractCheckoutYearlyStatus.cshtml | 11 + ServiceHost/Areas/Client/Pages/Index.cshtml | 64 +- .../Client/Pages/Shared/_ClientLayout.cshtml | 148 +++- .../Areas/Client/Pages/Shared/_Menu.cshtml | 439 +++++++----- .../wwwroot/AssetsClient/css/responsive.css | 187 ----- .../wwwroot/AssetsClient/css/style.css | 170 +---- .../RollCall/css/ModalSettingWorkTime.css | 10 + .../pages/RollCall/js/CameraAccounts.js | 14 +- .../pages/RollCall/js/CaseHistory.js | 188 +++++- .../pages/RollCall/js/CurrentDay.js | 14 +- .../RollCall/js/EmployeeUploadPicture.js | 13 +- .../pages/RollCall/js/Grouping.js | 14 +- .../AssetsClient/pages/RollCall/js/Index.js | 34 +- 22 files changed, 1122 insertions(+), 926 deletions(-) diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/ContractCheckoutStatus.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/ContractCheckoutStatus.cshtml index f7732cef..00d958e1 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/ContractCheckoutStatus.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/ContractCheckoutStatus.cshtml @@ -442,6 +442,16 @@ top: -3px; z-index: 4; } + + .modal-dialog { + max-width: 1140px; + margin: 2rem auto; + } + + .modal-xxl { + max-width: 1140px; + --bs-modal-width: 1140px; + } @@ -328,8 +328,8 @@ @@ -407,6 +407,10 @@ // var dateIndex = 0; var deleteRollCallData = `@Url.Page("./CaseHistory", "RemoveEmployeeRollCallsInDate")`; + + // check and show modal Camera Account And Workshop Setting + var statusCameraAccountAndWorkshopSettingUrl = `@Url.Page("./Index", "StatusCameraAccountAndWorkshopSetting")`; + var saveCameraAccountUrl = `@Url.Page("./Index", "SaveCameraAccountAndWorkshopSetting")`; } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml index 1aa2cc64..156858ff 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml @@ -4,6 +4,8 @@ @{ ViewData["Title"] = " - " + "لیست حضور و غیاب جاری"; + + string clientVersion = _0_Framework.Application.Version.StyleVersion; int index = 1; int indexAbsent = 1; int indexLeave = 1; @@ -11,15 +13,15 @@ } @section Styles { - - - - - + + + + + - + - + } @@ -45,22 +47,22 @@ -
-
-
- + + + + @section Script { - + + - + } diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml index 5be0c2ba..d4506d9e 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml @@ -200,6 +200,9 @@ var deActivePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "DeActivePersonnel")`; var activePersonnelAjax = `@Url.Page("./EmployeeUploadPicture", "ActivePersonnel")`; + // check and show modal Camera Account And Workshop Setting + var statusCameraAccountAndWorkshopSettingUrl = `@Url.Page("./Index", "StatusCameraAccountAndWorkshopSetting")`; + var saveCameraAccountUrl = `@Url.Page("./Index", "SaveCameraAccountAndWorkshopSetting")`; } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/Grouping.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/Grouping.cshtml index ca5a2afd..0a53a295 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/Grouping.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/Grouping.cshtml @@ -161,6 +161,10 @@ var workshopSettingId = Number((@Model.RollCallWorkshopSettings.Id)); var isShiftChangedGlobal = false; var titleOfGroup = ""; + + // check and show modal Camera Account And Workshop Setting + var statusCameraAccountAndWorkshopSettingUrl = `@Url.Page("./Index", "StatusCameraAccountAndWorkshopSetting")`; + var saveCameraAccountUrl = `@Url.Page("./Index", "SaveCameraAccountAndWorkshopSetting")`; } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml index 7f40f891..6f2d83ee 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml @@ -307,16 +307,16 @@
- - @section Script { - - + + + + } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs index 3f7b549f..65c2f5cd 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs @@ -60,10 +60,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall var rollCallWorkshopSetting = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(workshopId, account); HasRollCallWorkshopSetting = rollCallWorkshopSetting.ArePropertiesEqual(new CustomizeWorkshopSettingsViewModel()) ? "false" : "true"; - var workshopInfo = _workshopApplication.GetWorkshopInfo(workshopId); - WorkshopFullName = _authHelper.GetWorkshopName(); + WorkshopFullName =_authHelper.GetWorkshopName(); - HasRollCallCustomizeWorkshopSetting = _customizeWorkshopSettingsApplication.GetWorkshopSettingsDetails(workshopId).Id == 0 ? "false" : "true"; + HasRollCallCustomizeWorkshopSetting = _customizeWorkshopSettingsApplication.GetWorkshopSettingsDetails(workshopId).Id == 0 ? "false" : "true"; var hasBeforeService = _rollCallServiceApplication.GetAllServiceByWorkshopId(workshopId).Any(); var rollCall = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); @@ -90,7 +89,46 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall return Page(); } - public IActionResult OnGetSaveCameraAccountAndWorkshopSetting() + public IActionResult OnGetStatusCameraAccountAndWorkshopSetting() + { + var account = _authHelper.CurrentAccountInfo(); + var workshopSlug = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopSlug); + + if (workshopId < 0) + return BadRequest(); + + var workshopSettings = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(workshopId, account); + var hasRollCallWorkshopSetting = !workshopSettings.ArePropertiesEqual(new CustomizeWorkshopSettingsViewModel()); + + var allServices = _rollCallServiceApplication.GetAllServiceByWorkshopId(workshopId); + var hasPreviousService = allServices.Any(); + + var activeService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); + var hasRollCallService = activeService != null; + + bool hasCameraAccount; + if (hasRollCallService) + { + var accountId = _authHelper.CurrentAccountId(); + var cameraAccountExists = _cameraAccountApplication.HasCameraAccount(workshopId, accountId); + + hasCameraAccount = cameraAccountExists && hasPreviousService; + } + else + { + hasCameraAccount = !hasPreviousService; + } + + return new JsonResult(new + { + hasRollCallWorkshopSetting, + hasCameraAccount, + hasRollCallService + }); + } + + public IActionResult OnGetSaveCameraAccountAndWorkshopSetting() { var account = _authHelper.CurrentAccountInfo(); diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalSettingWorkTime.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalSettingWorkTime.cshtml index 48daf878..08a631b9 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalSettingWorkTime.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalSettingWorkTime.cshtml @@ -200,7 +200,7 @@
- +
@* *@ diff --git a/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml b/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml index 5ae558c1..5650eceb 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml @@ -13,6 +13,17 @@ + + } diff --git a/ServiceHost/Areas/Client/Pages/Index.cshtml b/ServiceHost/Areas/Client/Pages/Index.cshtml index 5ecb9f72..a495b020 100644 --- a/ServiceHost/Areas/Client/Pages/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Index.cshtml @@ -5,6 +5,7 @@ string clientVersion = _0_Framework.Application.Version.StyleVersion; + }
diff --git a/ServiceHost/Areas/Client/Pages/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Index.cshtml.cs index c014b11c..e15c42c1 100644 --- a/ServiceHost/Areas/Client/Pages/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Index.cshtml.cs @@ -15,6 +15,7 @@ using PersianTools.Core; using System.Security.Claims; using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using _0_Framework.Infrastructure; +using AccountManagement.Application.Contracts.CameraAccount; using CompanyManagment.App.Contracts.Bank; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; using CompanyManagment.App.Contracts.Job; @@ -45,6 +46,7 @@ namespace ServiceHost.Areas.Client.Pages private readonly IJobApplication _jobApplication; private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopEmployee; private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication; + private readonly ICameraAccountApplication _cameraAccountApplication; public string profilePicture { get; set; } public string AccountFullName { get; set; } @@ -65,7 +67,7 @@ namespace ServiceHost.Areas.Client.Pages public bool HasApkToDownload { get; set; } #endregion - public IndexModel(IAuthHelper authHelper, IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ILeaveApplication leaveApplication, IEmployeeApplication employeeApplication, IPaymentToEmployeeItemApplication paymentToEmployeeItemApplication, IPaymentToEmployeeApplication paymentToEmployeeApplication, IHolidayItemApplication holidayItemApplication, IInsuranceListApplication insuranceListApplication, IAndroidApkVersionApplication androidApkVersionApplication, IRollCallServiceApplication rollCallServiceApplication, IPersonnelCodeApplication personnelCodeApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IBankApplication bankApplication, ILeftWorkTempApplication leftWorkTempApplication, IJobApplication jobApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopEmployee, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication) + public IndexModel(IAuthHelper authHelper, IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ILeaveApplication leaveApplication, IEmployeeApplication employeeApplication, IPaymentToEmployeeItemApplication paymentToEmployeeItemApplication, IPaymentToEmployeeApplication paymentToEmployeeApplication, IHolidayItemApplication holidayItemApplication, IInsuranceListApplication insuranceListApplication, IAndroidApkVersionApplication androidApkVersionApplication, IRollCallServiceApplication rollCallServiceApplication, IPersonnelCodeApplication personnelCodeApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IBankApplication bankApplication, ILeftWorkTempApplication leftWorkTempApplication, IJobApplication jobApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopEmployee, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, ICameraAccountApplication cameraAccountApplication) { _workshopApplication = workshopApplication; _employeeApplication = employeeApplication; @@ -82,6 +84,7 @@ namespace ServiceHost.Areas.Client.Pages _jobApplication = jobApplication; _customizeWorkshopEmployee = customizeWorkshopEmployee; _rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication; + _cameraAccountApplication = cameraAccountApplication; _leaveApplication = leaveApplication; _authHelper = authHelper; _passwordHasher = passwordHasher; @@ -635,5 +638,48 @@ namespace ServiceHost.Areas.Client.Pages } #endregion + + #region CameraAccountAndWorkshopSetting + + public IActionResult OnGetStatusCameraAccountAndWorkshopSetting() + { + var account = _authHelper.CurrentAccountInfo(); + var workshopSlug = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopSlug); + + if (workshopId < 0) + return BadRequest(); + + var workshopSettings = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(workshopId, account); + var hasRollCallWorkshopSetting = !workshopSettings.ArePropertiesEqual(new CustomizeWorkshopSettingsViewModel()); + + var allServices = _rollCallServiceApplication.GetAllServiceByWorkshopId(workshopId); + var hasPreviousService = allServices.Any(); + + var activeService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); + var hasRollCallService = activeService != null; + + bool hasCameraAccount; + if (hasRollCallService) + { + var accountId = _authHelper.CurrentAccountId(); + var cameraAccountExists = _cameraAccountApplication.HasCameraAccount(workshopId, accountId); + + hasCameraAccount = cameraAccountExists && hasPreviousService; + } + else + { + hasCameraAccount = !hasPreviousService; + } + + return new JsonResult(new + { + hasRollCallWorkshopSetting, + hasCameraAccount, + hasRollCallService + }); + } + + #endregion } } diff --git a/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml b/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml index aab7877c..760a9895 100644 --- a/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml +++ b/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml @@ -92,22 +92,58 @@ - diff --git a/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs index 0e0d630a..09b06bf9 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs @@ -1,12 +1,10 @@ using System.Security.Claims; using _0_Framework.Application; using _0_Framework.Infrastructure; -using AccountManagement.Application.Contracts.SubAccount; using CompanyManagment.App.Contracts.Employee; using CompanyManagment.App.Contracts.Error; using CompanyManagment.App.Contracts.Fine; using CompanyManagment.App.Contracts.FineSubject; -using CompanyManagment.App.Contracts.Reward; using CompanyManagment.App.Contracts.Workshop; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -24,59 +22,38 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine private readonly IFineSubjectApplication _fineSubjectApplication; private readonly IEmployeeApplication _employeeApplication; private readonly IAuthHelper _authHelper; - private readonly ISubAccountApplication _subAccountApplication; - + private readonly long _workshopId; public string WorkshopFullName; public int PageIndex = 0; - public IndexModel(IFineApplication fineApplication, IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher, IFineSubjectApplication fineSubjectApplication, IEmployeeApplication employeeApplication, IAuthHelper authHelper, ISubAccountApplication subAccountApplication) + public IndexModel(IFineApplication fineApplication, IWorkshopApplication workshopApplication, + IPasswordHasher passwordHasher, IFineSubjectApplication fineSubjectApplication, + IEmployeeApplication employeeApplication, IAuthHelper authHelper) { _fineApplication = fineApplication; _workshopApplication = workshopApplication; _passwordHasher = passwordHasher; _fineSubjectApplication = fineSubjectApplication; _employeeApplication = employeeApplication; - _authHelper = authHelper; - _subAccountApplication = subAccountApplication; + _authHelper = authHelper; + + var workshopHash = _authHelper.GetWorkshopSlug(); + _workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (_workshopId < 1) + throw new InvalidDataException("اختلال در کارگاه"); } public IActionResult OnGet() { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - - if (workshopId <= 0) - return BadRequest(); - - WorkshopFullName = _authHelper.GetWorkshopName(); + WorkshopFullName = _authHelper.GetWorkshopName(); return Page(); } public IActionResult OnGetLoadDataAjax(FineSearchViewModel searchViewModel) { - var subAccId = _authHelper.CurrentSubAccountId(); - if (subAccId > 0) - { - var subAccountViewModel = _subAccountApplication.GetDetails(subAccId); - if (subAccountViewModel.SubAccountRoleId == 2) - { - return new JsonResult(new - { - success = true, - data = new List(), - pageIndex = 0, - }); - } - } - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - - if (workshopId <= 0) - return BadRequest(); - - searchViewModel.WorkshopId = workshopId; - + searchViewModel.WorkshopId = _workshopId; var result = _fineApplication.GetSearchList(searchViewModel); return new JsonResult(new { @@ -86,21 +63,21 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine }); } + public IActionResult OnGetLoadDataByEmployeeAjax(FineSearchViewModel searchViewModel) + { + searchViewModel.WorkshopId = _workshopId; + + var result = _fineApplication.GetSearchListAsGrouped(searchViewModel); + return new JsonResult(new + { + success = true, + data = result, + }); + } + public IActionResult OnGetEmployeeList() { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - return new JsonResult(new - { - success = false, - message = "کارگاه ای یافت نشد", - }); - - - var employees = _employeeApplication.GetWorkingEmployeesByWorkshopId(workshopId); - - + var employees = _employeeApplication.GetWorkingEmployeesByWorkshopId(_workshopId); return new JsonResult(new { @@ -111,33 +88,13 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine public IActionResult OnGetCreate() { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - { - var resultError = new ErrorViewModel() - { - Message = "کارگاه شما یافت نشد" - }; - return Partial("../Error/_ErrorModal", resultError); - } - var command = new CreateFineViewModel(); return Partial("ModalCreateNewFine", command); } public IActionResult OnPostCreate(CreateFineViewModel command) { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - return new JsonResult(new - { - IsSuccedded = false, - message = "کارگاه ای یافت نشد", - }); - - command.WorkshopId = workshopId; + command.WorkshopId = _workshopId; var result = _fineApplication.Create(command); return new JsonResult(new @@ -149,34 +106,13 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine public IActionResult OnGetEdit(long id) { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - { - var resultError = new ErrorViewModel() - { - Message = "کارگاه شما یافت نشد" - }; - return Partial("../Error/_ErrorModal", resultError); - } - var command = _fineApplication.GetDetails(id); - return Partial("ModalEditFine", command); } public IActionResult OnPostEdit(EditFineViewModel command) { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - return new JsonResult(new - { - IsSuccedded = false, - message = "کارگاه ای یافت نشد", - }); - - command.WorkshopId = workshopId; + command.WorkshopId = _workshopId; var result = _fineApplication.Edit(command); return new JsonResult(new @@ -200,12 +136,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine public IActionResult OnPostCreateFineSubject(CreateFineSubjectViewModel command) { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - return BadRequest(); - - command.WorkshopId = workshopId; + command.WorkshopId = _workshopId; var result = _fineSubjectApplication.Create(command); return new JsonResult(new @@ -218,12 +149,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine //برای ویرایش عنوان دلبخواه public IActionResult OnPostEditFineSubject(EditFineSubjectViewModel command) { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId <= 0) - return BadRequest(); - - command.WorkshopId = workshopId; + command.WorkshopId = _workshopId; var result = _fineSubjectApplication.Edit(command); return new JsonResult(new @@ -247,13 +173,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine public IActionResult OnGetSearchFineSubject() { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - - if (workshopId <= 0) - return BadRequest(); - - var list = _fineSubjectApplication.GetAll(workshopId); + var list = _fineSubjectApplication.GetAll(_workshopId); return new JsonResult(new { @@ -263,5 +183,15 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine } #endregion + + public IActionResult OnGetSearch(FineSearchViewModel searchModel) + { + searchModel.WorkshopId = _workshopId; + var result = _fineApplication.GetSearchListAsGrouped(searchModel); + return new JsonResult(new + { + data = result + }); + } } } diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml index b1bf5d05..9d9cec66 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml @@ -13,7 +13,8 @@ @section Styles { - + + @@ -56,23 +57,55 @@
@@ -218,11 +289,41 @@
-
- +
+ +
+ +
+
+
+ + +
+
+
+ + +
-
+
حذف جستجو
@@ -266,7 +367,8 @@ - + } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs index df66b18d..684ef8bd 100644 --- a/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs @@ -67,12 +67,11 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid { searchViewModel.WorkshopId = _workshopId; - var result = _salaryAidApplication.GetSearchList(searchViewModel); + var result = _salaryAidApplication.GetSearchListAsGrouped(searchViewModel); return new JsonResult(new { success = true, data = result, - pageIndex = result.Count() }); } @@ -176,5 +175,15 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid }); } + public IActionResult OnGetSearch(SalaryAidSearchViewModel searchModel) + { + searchModel.WorkshopId = _workshopId; + var result = _salaryAidApplication.GetSearchListAsGrouped(searchModel); + return new JsonResult(new + { + data = result + }); + } + } } diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Fine/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/Fine/css/Index.css index 770dc7ff..17527a91 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Fine/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Fine/css/Index.css @@ -5,6 +5,138 @@ .fineListModal-width .modal-content { /*height: 430px;*/ } +.Rtable .Rtable-row .Rtable-cell.column-heading { + padding: 0.2em 0; +} + +.Rtable-row .btn-details { + background-color: #D3F8F8; + color: #4DA9D1; + border-radius: 7px; + border: 0 !important; + padding: 6px 8px; + font-size: 12px; +} + +.leaveDiv { + padding: 10px; + margin: 6px; + background-color: #ffffff; + color: #000; + border-radius: 5px; + font-size: 11px; + font-weight: 400; +} + +.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { + border-radius: 5px; + background: rgba(87, 227, 227, 0.25); + width: 45px; + height: 32px; + display: inline-block; + padding: 6px; +} + + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + padding: 8px; +} + +.table-contracts .Rtable .Rtable-row .column-heading > span input { + margin: 0 0 0 5px; +} + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + border-radius: 4px !important; + border: 0 !important; + outline: 1px solid #1dc9a0; + margin: 2px 0; +} + +.table-contracts .form-check-input { + padding: 8px !important; + border: 0 !important; + outline: 1px solid #1dc9a0; +} + +.btn-search { + background: #84CC16; + width: 100%; + height: 36px; +} + + +.tm-selection-rad:checked + .btn, :not(.tm-selection-rad) + .btn:active, .btn:first-child:active, .btn.active, .btn.show { + color: #ffffff; + background: linear-gradient(94deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%); + border: none; +} + + +.tm-rad, .tm-selection-rad { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} + +.search-box .radio-btn { + color: #717171; + padding: 0; + border-radius: 8px; + border: 1px solid #DADADA; + background-color: white; + outline: none; + width: 100%; + height: 36px; + font-size: 13px; + display: flex; + align-items: center; + justify-items: center; + text-align: center; +} + + +.select2-container .select2-selection--single, #start-date, #end-date { + height: 36px; +} + +.personnel-selector-navFilter { + width: 15%; +} + +.start-date-navbarFilter { + width: 12%; +} + +.end-date-navbarFilter { + width: 12%; +} + +.list-navbarFilter { + width: 7%; +} + +.group-navbarFilter { + width: 7%; +} + +.search-navbarFilter { + width: 10%; +} + +.clearSearch-navbarFilter { + width: 10%; +} + +.personnel-selector-navFilter, +.start-date-navbarFilter, +.end-date-navbarFilter, +.list-navbarFilter, +.group-navbarFilter, +.search-navbarFilter, +.clearSearch-navbarFilter { + height: 36px; +} .sweet-alert button { font-family: 'IRANYekanX'; @@ -43,15 +175,15 @@ } .width2 { - width: 18% !important; + width: 10% !important; } .width3 { - width: 15% !important; + width: 10% !important; } .width4 { - width: 15% !important; + width: 20% !important; } .width5 { @@ -59,11 +191,11 @@ } .width6 { - width: 5% !important; + width: 8% !important; } .width7 { - width: 10% !important; + width: 15% !important; text-align: center; } @@ -174,7 +306,6 @@ .form-check-input[type="radio"]:checked, .form-check-input[type="checkbox"]:checked { background-color: #148989; - border: 1px solid #ffffff !important; background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white" stroke-width="3"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" /%3E%3C/svg%3E'); background-size: 75%; } @@ -185,20 +316,23 @@ box-shadow: none; } - .form-check-input[type="radio"] + label, - .form-check-input[type="checkbox"] + label { - color: #83898C; - } - - .form-check-input[type="radio"]:checked + label, - .form-check-input[type="checkbox"]:checked + label { - color: #2B2F32; - } - - /************************ Radio Button Input (Like Checkbox appearance) ************************/ +/************************* row grid *************************/ + +#fineEmployeesList .personal-grid-row:nth-of-type(odd) .Rtable-row { + background: #ECFFFF !important; + border: 1px solid #E9E9E9 !important; +} + +#fineEmployeesList .personal-grid-row:nth-of-type(even) .Rtable-row { + background: #DDF4F4 !important; + border: 1px solid #E9E9E9 !important; +} + +/************************* row grid *************************/ + @media (max-width: 1366px) { .fineListModal-width { @@ -232,6 +366,17 @@ margin: 0 0 60px 0; } + .prevent-select > span{ + width: 30px !important; + } + + input[name="foo"] { + display: none !important; + } + .Rtable--collapse .Rtable-row .Rtable-cell .Rtable-cell--content { + text-align: start; + } + /* .Rtable .Rtable-row:nth-child(even), .table-workshop .Rtable .Rtable-row:nth-child(4n+2), .table-personals .Rtable .Rtable-row:nth-child(4n+2) { border-radius: 10px; diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js index 6e287e8b..afa7106a 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js @@ -2,6 +2,11 @@ var searchName = ''; var searchStartDateTime = ''; var searchEndDateTime = ''; +var listTypeDataInput = ''; +var groupTypeDataInput = ''; +var loadData = true; +var isMobile = "false"; +var groupData = false; $(document).ready(function () { loadFineList(); @@ -59,12 +64,38 @@ $(document).ready(function () { //3500); //} else { //loadAllToPrint(); - $('input:checkbox').not(this).prop('checked', this.checked); + $('input:checkbox').not(this).not("#group, #list").prop('checked', this.checked); //} }); + + $("input:checkbox").not("#group,#list,.checkAll").change(function () { + if ($("input:checkbox").not("#group,#list,.checkAll").filter(":not(:checked)").length) { + $(".checkAll").prop("checked", false); + } else { + $(".checkAll").prop("checked", true); + } + }); //******************** انتخاب همه ی چک باکس ها ******************** + + //*********************ستون نام پرسنل در حالتی که فقط اسم پرسنل هست باید هاید بشه************************ + $("#searchJustName").hide(); + + //************تنظیم چک باکس تایپ لیست******************* + $('#group, #groupMobile').change(function () { + if ($(this).is(':checked')) { + $('#list , #listMobile').prop('checked', false); + } + }); + + $('#list, #listMobile').change(function () { + if ($(this).is(':checked')) { + $('#group , #groupMobile').prop('checked', false); + } + }); + //************تنظیم چک باکس تایپ لیست******************* + }); $(document).on('click', ".openAction", function () { @@ -75,12 +106,35 @@ $(document).on('click', ".openAction", function () { }); $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function () { - let isMobile = $(this).hasClass('btn-search-click-mobile'); + isMobile = $(this).hasClass('btn-search-click-mobile'); searchStartDateTime = isMobile ? $('#start-date-mobile').val() : $('#start-date').val(); searchEndDateTime = isMobile ? $('#end-date-mobile').val() : $('#end-date').val(); searchName = isMobile ? $('#employeeSelectIndexMobile') : $('#employeeSelectIndex'); + listTypeDataInput = isMobile ? $('#listMobile') : $('#list'); + groupTypeDataInput = isMobile ? $('#groupMobile') : $('#group'); + + if (listTypeDataInput[0].checked == false && groupTypeDataInput[0].checked == false) { + if (isMobile) { + $("#listMobile").next('label').addClass('errored'); + $("#groupMobile").next('label').addClass('errored'); + } else { + $("#list").next('label').addClass('errored'); + $("#group").next('label').addClass('errored'); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی لیست باید نوع آن را مشخص کنید.'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#group, #list, #listMobile, #groupMobile').next('label').removeClass('errored'); + + }, 3500); + return; + } + if ((searchStartDateTime === '' && searchEndDateTime !== '') || (searchStartDateTime !== '' && searchEndDateTime === '')) { if (isMobile) { $('#start-date-mobile').addClass("errored"); @@ -88,14 +142,36 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function } else { $('#start-date').addClass("errored"); $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); } $('.alert-msg').show(); - $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان را مشخص نمایید'); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); setTimeout(function () { $('.alert-msg').hide(); $('.alert-msg p').text(''); - $('#start-date, #end-date, #start-date-mobile, #end-date-mobile').removeClass("errored"); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); + + }, 3500); + return; + } + + if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) { + if (isMobile) { + $('#start-date-mobile').addClass("errored"); + $('#end-date-mobile').addClass("errored"); + } else { + $('#start-date').addClass("errored"); + $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); }, 3500); return; @@ -109,9 +185,11 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function if (isMobile) { $('#searchModal').modal('hide'); } - + groupData = $("#group,#groupMobile").is(":checked"); + pageIndexJs = 0; $('#fineListAjax').html(''); + $('#fineEmployeesList').html(''); $('#PageIndex').val(0); loadFineList(); }); @@ -129,8 +207,6 @@ $('#searchModal .employeeName').on('input', function () { $('.d-none.d-md-block .employeeName').val(mobileInput); }); - - $('.d-none.d-md-block #start-date').on('input change', function () { var desktopStartDate = $(this).val(); $('#searchModal #start-date-mobile').val(desktopStartDate); @@ -140,7 +216,6 @@ $('#searchModal #start-date-mobile').on('input change', function () { $('.d-none.d-md-block #start-date').val(mobileStartDate); }); - $('.d-none.d-md-block #end-date').on('input change', function () { var desktopEndDate = $(this).val(); $('#searchModal #end-date-mobile').val(desktopEndDate); @@ -196,19 +271,21 @@ function ajaxPersonals() { }); } +//*************ajax calls base on list or group *************** function loadFineList() { var pageIndex = Number($('#PageIndex').val()); + var html = ''; var searchViewModel = { 'PageIndex': pageIndex, 'EmployeeId': $('#employeeSelectIndex').val(), 'StartDate': $('#start-date').val(), - 'EndDate': $('#end-date').val() + 'EndDate': $('#end-date').val(), + 'ShowAsGrouped': groupData, } + var b = pageIndexJs % 30; - var html = ''; - var index = 1; if (b === 0) { $.ajax({ @@ -216,41 +293,75 @@ function loadFineList() { contentType: 'charset=utf-8', dataType: 'json', type: 'GET', - url: fineListLoadDataAjax, + url: fineGroupLoadDataAjax, data: searchViewModel, headers: { "RequestVerificationToken": antiForgeryToken }, success: function (response) { var loadFineListData = response.data; + console.log(loadFineListData); + if (loadFineListData.fineListViewModels !== null || loadFineListData.groupedByDate !== null || loadFineListData.groupedByEmployee !== null) { + if ($("#group").is(":checked")) { + $("#LoadFineList").hide(); + $("#LoadFineListWithEmployee").removeClass("d-none"); + htmlLoadGroupType(loadFineListData); - if (response.success) { - if (loadFineListData.length > 0) { - loadFineListData.forEach(function (item) { - var n = pageIndexJs + 1; - html += `
-
-
-
`; - - pageIndexJs++; - - }); - - pageIndexJs = pageIndex + response.pageIndex; - $('#PageIndex').val(pageIndexJs); - $('#fineListAjax').append(html); - } else { - html += `
-
- -
اطلاعاتی وجود ندارد.
-
-
`; - $('#fineListAjax').append(html); - } - } - }, - failure: function (response) { - console.log(response); - } + pageIndexJs++; }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#fineListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#fineListAjax').append(html); + $('#fineEmployeesList').append(html); } } +function htmlLoadGroupType(loadFineListData) { + if (searchName.val() === "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar only date is valid + $(".searchByBoth").hide(); + $("#searchJustNameMiddleTab").hide(); + $("#searchJustNameFirstTab").show(); + } else if (searchName.val() !== "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar personnel and date are valid + $(".searchByBoth").show(); + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + + } else if (searchName.val() !== "0" && (!searchStartDateTime && !searchEndDateTime)) {//in filter bar only personnel is valid + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + $(".searchByBoth").show(); + } + + if ($("#group").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeDataByFullname(loadFineListData.groupedByEmployee); + } else { + htmlLoadWithEmployeeDataByDate(loadFineListData.groupedByDate); + } + } +} + +function htmlLoadWithEmployeeDataByDate(loadFineListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadFineListData.length > 0) { + loadFineListData.forEach(function (itemFines) { + n = 1; + html += `
+
+
+
+
+ ${itemFines.yearFa} +
+
+
+
+ ${itemFines.monthFa} +
+
+
+ +
`; + + itemFines.fines.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.employeeName}
+
+
+
${item.personnelCode}
+
+
+
${item.fineDateTimeFa}
+
+
+
${item.title ?? "-"}
+
+
+
${item.amount + " ریال"}
+
+
+
+ + + ${editPermission ? + ` + + ` + : + + ` + + ` + } + + + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + + + + + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + + html += `
` + html += ` +
+
+
+ ${itemFines.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#fineEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#fineListAjax').append(html); + $('#fineEmployeesList').append(html); + } +} + +function htmlLoadWithEmployeeDataByFullname(loadFineListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadFineListData.length > 0) { + loadFineListData.forEach(function (itemFines) { + n = 1; + html += ` +
+
+
+
+
+ ${itemFines.employeeName} +
+
+
+ +
+ +
`; + + + + html += `
` + itemFines.fines.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.personnelCode}
+
+
+
${item.fineDateTimeFa}
+
+
+
${item.title ?? "-"}
+
+
+
${item.amount + " ریال"}
+
+
+
+ + + ${editPermission ? + ` + + ` + : + + ` + + ` + } + + + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + + + + + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + html += `
`; + + + html += `
` + html += ` +
+
+
+ ${itemFines.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#fineEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#fineListAjax').append(html); + $('#fineEmployeesList').append(html); + } +} + +//************* 3 Template *************** + + +//**************** 2 template for Mobile********************** +function htmlLoadGroupTypeMobile(loadFineListData) { + + if ($("#groupMobile").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeMobileDataByFullname(loadFineListData.finesGroupedByEmployee); + } else { + htmlLoadWithEmployeeMobileDataByDate(loadFineListData.finesGroupedByDate); + } + } +} +function htmlLoadWithEmployeeMobileDataByFullname(loadFineListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + if (loadFineListData) { + loadFineListData.forEach(function (item) { + console.log(item); + + html += ` +
+
+
+ +
+
+ + + ${item.employeeName} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.fines.forEach(function (fineItem) { + html += ` +
+
+
+
نام پرسنل
+
${item.employeeName}
+
+
+
تاریخ
+
${fineItem.grantDate}
+
+
+
شماره پرسنلی
+
+ ${fineItem.personnelCode} +
+
+
+
عنوان
+
${fineItem.title ?? "-"}
+
+
+
توضیحات
+
${fineItem.description}
+
+
+
مبلغ
+
${fineItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#fineListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#fineListAjax').append(html); + $('#fineEmployeesList').append(html); + } + + +} + +function htmlLoadWithEmployeeMobileDataByDate(loadFineListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadFineListData) { + console.log(loadFineListData) + loadFineListData.forEach(function (item) { + console.log(item); + + html += ` +
+
+
+ +
+
+ + + ${item.year} + + + ${item.month} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.fines.forEach(function (fineItem) { + html += ` +
+
+
+
نام پرسنل
+
${fineItem.employeeName}
+
+
+
تاریخ
+
${fineItem.grantDateFa}
+
+
+
شماره پرسنلی
+
+ ${fineItem.personnelCode} +
+
+
+
عنوان
+
${fineItem.title ?? "-"}
+
+
+
توضیحات
+
${fineItem.description}
+
+
+
مبلغ
+
${fineItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#fineListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#fineListAjax').append(html); + $('#fineEmployeesList').append(html); + } + + + +} + +//**************** 2 template for Mobile********************** + function openCreateFineModal() { var goTo = `#showmodal=/Client/Company/Fine/Index?handler=Create`; window.location.href = goTo; @@ -454,7 +1243,6 @@ $(document).on('click', '.btn-delete', function () { }); }); - function removeAjax(id) { var ID = Number(id); $.ajax({ diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css index d7df6aba..f74b9c02 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css @@ -1,4 +1,24 @@ -.loanListModal-width { +/*----------------------------------------------------------- group table */ + +/*.personal-grid-row:nth-child(n+1) .Rtable-row { + border: 1px solid #eee !important; +}*/ + +.table-list .Rtable-row:nth-child(2n) { + border-radius: 10px; + background-color: #ECFFFF; + transition: all .3s ease; + border: 1px solid #eee; +} + +.table-list .Rtable-row:nth-child(4n+2) { + border-radius: 10px; + background-color: #DDF4F4; + transition: all .3s ease; + border: 1px solid #eee; +} + +.loanListModal-width { max-width: 460px; } @@ -6,6 +26,141 @@ /*height: 430px;*/ } + +.Rtable .Rtable-row .Rtable-cell.column-heading { + padding: 0.2em 0; +} + +.Rtable-row .btn-details { + background-color: #D3F8F8; + color: #4DA9D1; + border-radius: 7px; + border: 0 !important; + padding: 6px 8px; + font-size: 12px; +} + +.leaveDiv { + padding: 10px; + margin: 6px; + background-color: #ffffff; + color: #000; + border-radius: 5px; + font-size: 11px; + font-weight: 400; +} + + +.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { + border-radius: 5px; + background: rgba(87, 227, 227, 0.25); + width: 45px; + height: 32px; + display: inline-block; + padding: 6px; +} + + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + padding: 8px; +} + +.table-contracts .Rtable .Rtable-row .column-heading > span input { + margin: 0 0 0 5px; +} + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + border-radius: 4px; + border: 0 !important; + outline: 1px solid #1dc9a0; + margin: 2px 0; +} + +.table-contracts .form-check-input { + padding: 8px !important; + border: 0 !important; + outline: 1px solid #1dc9a0; +} + +.btn-search { + background: #84CC16; + width: 100%; + height: 36px; +} + + +.tm-selection-rad:checked + .btn, :not(.tm-selection-rad) + .btn:active, .btn:first-child:active, .btn.active, .btn.show { + color: #ffffff; + background: linear-gradient(94deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%); + border: none; +} + + +.tm-rad, .tm-selection-rad { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} + +.search-box .radio-btn { + color: #717171; + padding: 0; + border-radius: 8px; + border: 1px solid #DADADA; + background-color: white; + outline: none; + width: 100%; + height: 36px; + font-size: 13px; + display: flex; + align-items: center; + justify-items: center; + text-align: center; +} + + +.select2-container .select2-selection--single, #start-date, #end-date { + height: 36px; +} + +.personnel-selector-navFilter { + width: 15%; +} + +.start-date-navbarFilter { + width: 12%; +} + +.end-date-navbarFilter { + width: 12%; +} + +.list-navbarFilter { + width: 7%; +} + +.group-navbarFilter { + width: 7%; +} + +.search-navbarFilter { + width: 10%; +} + +.clearSearch-navbarFilter { + width: 10%; +} + +.personnel-selector-navFilter, +.start-date-navbarFilter, +.end-date-navbarFilter, +.list-navbarFilter, +.group-navbarFilter, +.search-navbarFilter, +.clearSearch-navbarFilter { + height: 36px; +} + .errored { animation: shake 300ms; color: #eb3434 !important; @@ -161,7 +316,7 @@ .form-check-input[type="checkbox"] { width: 15px; height: 15px; - border-radius: 6px; + border-radius: 4px; padding: 8px; border: 1px solid #CFD3D4; background-color: white; @@ -185,19 +340,23 @@ box-shadow: none; } -.form-check-input[type="radio"] + label, -.form-check-input[type="checkbox"] + label { - color: #83898C; -} - -.form-check-input[type="radio"]:checked + label, -.form-check-input[type="checkbox"]:checked + label { - color: #2B2F32; -} - /************************ Radio Button Input (Like Checkbox appearance) ************************/ +/************************* row grid *************************/ + + +#rewardEmployeesList .personal-grid-row:nth-of-type(odd) .Rtable-row { + background: #ECFFFF !important; + border: 1px solid #E9E9E9 !important; +} + +#rewardEmployeesList .personal-grid-row:nth-of-type(even) .Rtable-row { + background: #DDF4F4 !important; + border: 1px solid #E9E9E9 !important; +} + +/************************* row grid *************************/ @media (max-width: 1366px) { @@ -236,6 +395,10 @@ margin: 0 0 60px 0; } + input[name="foo"] { + display: none !important; + } + /* .Rtable .Rtable-row:nth-child(even), .table-workshop .Rtable .Rtable-row:nth-child(4n+2), .table-personals .Rtable .Rtable-row:nth-child(4n+2) { border-radius: 10px; diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js index 083d7e31..3592b1d0 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js @@ -2,7 +2,11 @@ var searchName = ''; var searchStartDateTime = ''; var searchEndDateTime = ''; - +var listTypeDataInput = ''; +var groupTypeDataInput = ''; +var loadData = true; +var isMobile = "false"; +var groupData = false; $(document).ready(function () { loadLoanList(); ajaxPersonals(); @@ -45,27 +49,52 @@ $(document).ready(function () { //let dataValPersonel = Number($('#employeeId').val()); //if ((dataValYear == '' || dataValMonth == '') && dataValPersonel == 0) { - //$('#dropdown-year').addClass("errored"); - //$('#dropdown-month').addClass("errored"); + //$('#dropdown-year').addClass("errored"); + //$('#dropdown-month').addClass("errored"); - //$(this).prop('checked', false); - //$('.alert-msg').show(); - //$('.alert-msg p').text('جهت انتخاب گروهی قراردادها ابتدا میبایست سال و ماه مورد نظر را انتخاب نمائید.'); - //setTimeout(function () { - // $('.alert-msg').hide(); - // $('.alert-msg p').text(''); - // $('#dropdown-year').removeClass("errored"); - // $('#dropdown-month').removeClass("errored"); - //}, - //3500); + //$(this).prop('checked', false); + //$('.alert-msg').show(); + //$('.alert-msg p').text('جهت انتخاب گروهی قراردادها ابتدا میبایست سال و ماه مورد نظر را انتخاب نمائید.'); + //setTimeout(function () { + // $('.alert-msg').hide(); + // $('.alert-msg p').text(''); + // $('#dropdown-year').removeClass("errored"); + // $('#dropdown-month').removeClass("errored"); + //}, + //3500); //} else { - //loadAllToPrint(); - $('input:checkbox').not(this).prop('checked', this.checked); + //loadAllToPrint(); + $('input:checkbox').not(this).not("#group, #list").prop('checked', this.checked); //} }); + + $("input:checkbox").not("#group,#list,.checkAll").change(function () { + if ($("input:checkbox").not("#group,#list,.checkAll").filter(":not(:checked)").length) { + $(".checkAll").prop("checked", false); + } else { + $(".checkAll").prop("checked", true); + } + }); //******************** انتخاب همه ی چک باکس ها ******************** + + //*********************ستون نام پرسنل در حالتی که فقط اسم پرسنل هست باید هاید بشه************************ + $("#searchJustName").hide(); + + //************تنظیم چک باکس تایپ لیست******************* + $('#group, #groupMobile').change(function () { + if ($(this).is(':checked')) { + $('#list , #listMobile').prop('checked', false); + } + }); + + $('#list, #listMobile').change(function () { + if ($(this).is(':checked')) { + $('#group , #groupMobile').prop('checked', false); + } + }); + //************تنظیم چک باکس تایپ لیست******************* }); $(document).on('click', ".openAction", function () { @@ -75,12 +104,35 @@ $(document).on('click', ".openAction", function () { } }); $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function () { - let isMobile = $(this).hasClass('btn-search-click-mobile'); + isMobile = $(this).hasClass('btn-search-click-mobile'); searchStartDateTime = isMobile ? $('#start-date-mobile').val() : $('#start-date').val(); searchEndDateTime = isMobile ? $('#end-date-mobile').val() : $('#end-date').val(); searchName = isMobile ? $('#employeeSelectIndexMobile') : $('#employeeSelectIndex'); + listTypeDataInput = isMobile ? $('#listMobile') : $('#list'); + groupTypeDataInput = isMobile ? $('#groupMobile') : $('#group'); + + if (listTypeDataInput[0].checked == false && groupTypeDataInput[0].checked == false) { + if (isMobile) { + $("#listMobile").next('label').addClass('errored'); + $("#groupMobile").next('label').addClass('errored'); + } else { + $("#list").next('label').addClass('errored'); + $("#group").next('label').addClass('errored'); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی لیست باید نوع آن را مشخص کنید.'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#group, #list, #listMobile, #groupMobile').next('label').removeClass('errored'); + + }, 3500); + return; + } + if ((searchStartDateTime === '' && searchEndDateTime !== '') || (searchStartDateTime !== '' && searchEndDateTime === '')) { if (isMobile) { $('#start-date-mobile').addClass("errored"); @@ -88,14 +140,36 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function } else { $('#start-date').addClass("errored"); $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); } $('.alert-msg').show(); - $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان را مشخص نمایید'); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); setTimeout(function () { $('.alert-msg').hide(); $('.alert-msg p').text(''); - $('#start-date, #end-date, #start-date-mobile, #end-date-mobile').removeClass("errored"); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); + + }, 3500); + return; + } + + if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) { + if (isMobile) { + $('#start-date-mobile').addClass("errored"); + $('#end-date-mobile').addClass("errored"); + } else { + $('#start-date').addClass("errored"); + $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); }, 3500); return; @@ -110,8 +184,12 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function $('#searchModal').modal('hide'); } + groupData = $("#group,#groupMobile").is(":checked"); + pageIndexJs = 0; - $('#loanListAjax').html(''); + $('#loanListAjax').html('
'); + //$('#loanListAjax').html(''); + $('#loanEmployeesList').html(''); $('#PageIndex').val(0); loadLoanList(); }); @@ -131,7 +209,6 @@ $('#searchModal .employeeName').on('input', function () { }); - $('.d-none.d-md-block #start-date').on('input change', function () { var desktopStartDate = $(this).val(); $('#searchModal #start-date-mobile').val(desktopStartDate); @@ -198,19 +275,21 @@ function ajaxPersonals() { }); } +//*************ajax calls base on list or group *************** function loadLoanList() { var pageIndex = Number($('#PageIndex').val()); + var html = ''; var searchViewModel = { 'PageIndex': pageIndex, 'EmployeeId': $('#employeeSelectIndex').val(), 'StartDate': $('#start-date').val(), - 'EndDate': $('#end-date').val() + 'EndDate': $('#end-date').val(), + 'ShowAsGrouped': groupData, } + var b = pageIndexJs % 30; - var html = ''; - var index = 1; if (b === 0) { $.ajax({ @@ -218,46 +297,78 @@ function loadLoanList() { contentType: 'charset=utf-8', dataType: 'json', type: 'GET', - url: loanListLoadDataAjax, + url: loanGroupLoadDataAjax, data: searchViewModel, headers: { "RequestVerificationToken": antiForgeryToken }, success: function (response) { + var loadLoanListData = response.data; - if (response.success) { - if (loadLoanListData.length > 0) { - loadLoanListData.forEach(function (item) { - var n = pageIndexJs + 1; - html += `
+ if (loadLoanListData.loanListViewModel !== null || loadLoanListData.groupedByDate !== null || loadLoanListData.groupedByEmployee !== null) { + if ($("#group").is(":checked")) { + $("#LoadLoanList").hide(); + $("#LoadloanListWithEmployee").removeClass("d-none"); + htmlLoadGroupType(loadLoanListData); + + } else if ($("#groupMobile").is(":checked")) { + htmlLoadGroupTypeMobile(loadLoanListData); + + } else { + if (loadLoanListData.loanListViewModel.length > 0) { + $("#LoadLoanList").show(); + $("#LoadloanListWithEmployee").addClass("d-none"); + htmlLoadSimpleListData(loadLoanListData.loanListViewModel); + } + } + } + }, + failure: function (response) { + console.log(response); + } + }); + } +} +//*************ajax calls base on list button or group button*************** + + +//************* 3 Template *************** + +function htmlLoadSimpleListData(loadLoanListData) { + var html = ''; + //var pageIndex = Number($('#PageIndex').val()); + + if (loadLoanListData.length > 0) { + loadLoanListData.forEach(function (item) { + var n = pageIndexJs + 1; + html += `
-
-
`; - - pageIndexJs++; - - }); - - pageIndexJs = pageIndex + response.pageIndex; - $('#PageIndex').val(pageIndexJs); - $('#loanListAjax').append(html); - } else { - html += `
-
- -
اطلاعاتی وجود ندارد.
-
-
`; - $('#loanListAjax').append(html); - } - } - }, - failure: function (response) { - console.log(response); - } + pageIndexJs++; }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#loanListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#loanListAjax').append(html); + $('#loanEmployeesList').append(html); } } +function htmlLoadGroupType(loadLoanListData) { + if (searchName.val() === "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar only date is valid + $(".searchByBoth").hide(); + $("#searchJustNameMiddleTab").hide(); + $("#searchJustNameFirstTab").show(); + } else if (searchName.val() !== "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar personnel and date are valid + $(".searchByBoth").show(); + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + + } else if (searchName.val() !== "0" && (!searchStartDateTime && !searchEndDateTime)) {//in filter bar only personnel is valid + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + $(".searchByBoth").show(); + } + + if ($("#group").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeDataByFullname(loadLoanListData.groupedByEmployee); + } else { + htmlLoadWithEmployeeDataByDate(loadLoanListData.groupedByDate); + } + } +} + +function htmlLoadWithEmployeeDataByDate(loadLoanListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadLoanListData.length > 0) { + html += `
`; + loadLoanListData.forEach(function (itemLoans) { + n = 1; + html += ` +
+
+
+
+ ${itemLoans.yearFa} +
+
+
+
+ ${itemLoans.monthFa} +
+
+
+ +
`; + + itemLoans.loanItems.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.loanStartDate}
+
+
+
${item.employeeName}
+
+
+
${item.personnelCode}
+
+
+
${item.totalAmountFa + " ریال" ?? "-"}
+
+
+
${item.amountPerMonth + " ریال"}
+
+
+
${item.installmentCount}
+
+
+
+ + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + + html += `
` + html += ` +
+
+
+ ${itemLoans.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#loanEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#loanListAjax').append(html); + $('#loanEmployeesList').append(html); + } +} + +function htmlLoadWithEmployeeDataByFullname(loadLoanListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadLoanListData.length > 0) { + loadLoanListData.forEach(function (itemLoans) { + n = 1; + html += ` +
+
+
+
+
+ ${itemLoans.employeeName} +
+
+
+ +
+ +
`; + + + + html += `
` + itemLoans.loanItems.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.loanDateTimeFa}
+
+
+
${item.personnelCode}
+
+
+
${item.totalAmountFa + " ریال" ?? "-"}
+
+
+
${item.amountPerMonth + " ریال"}
+
+
+
${item.installmentCount}
+
+
+
+ + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + html += `
`; + + + html += `
` + html += ` +
+
+
+ ${itemLoans.totalAmount + " ریال "} +
+
+
+ +
`; + html += `
`; + + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#loanEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#loanListAjax').append(html); + $('#loanEmployeesList').append(html); + } +} + +//************* 3 Template *************** + + +//**************** 2 template for Mobile********************** +function htmlLoadGroupTypeMobile(loadLoanListData) { + + if ($("#groupMobile").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeMobileDataByFullname(loadLoanListData.groupedByEmployee); + } else { + htmlLoadWithEmployeeMobileDataByDate(loadLoanListData.groupedByDate); + } + } +} +function htmlLoadWithEmployeeMobileDataByFullname(loadLoanListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + if (loadLoanListData) { + html += `
`; + loadLoanListData.forEach(function (item) { + + html += ` +
+
+ +
+
+ + + ${item.employeeName} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.loanItems.forEach(function (loanItem) { + html += ` +
+
+
+
تاریخ شروع
+
${loanItem.loanDateTimeFa}
+
+
+
شماره پرسنلی
+
+ ${loanItem.personnelCode} +
+
+
+
مبلغ
+
${loanItem.totalAmountFa + " ریال" ?? "-"}
+
+
+
مبلغ هر ماه
+
${loanItem.amountPerMonth + " ریال"}
+
+
+
تعداد اقساط
+
${loanItem.installmentCount}
+
+ +
+ + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount}
+
+
+
+ +
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#loanListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#loanListAjax').append(html); + $('#loanEmployeesList').append(html); + } + + +} + +function htmlLoadWithEmployeeMobileDataByDate(loadLoanListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadLoanListData) { + html += `
`; + loadLoanListData.forEach(function (item) { + + + html += ` +
+
+ +
+
+ + + ${item.yearFa} + + + ${item.monthFa} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.loanItems.forEach(function (loanItem) { + html += ` +
+
+
+
نام پرسنل
+
${loanItem.employeeName}
+
+
+
تاریخ شروع
+
${loanItem.loanStartDate}
+
+
+
شماره پرسنلی
+
+ ${loanItem.personnelCode} +
+
+
+
مبلغ
+
${loanItem.totalAmountFa + " ریال" ??"-"}
+
+
+
مبلغ هر ماه
+
${loanItem.amountPerMonth + " ریال"}
+
+
+
تعداد اقساط
+
${loanItem.installmentCount}
+
+ +
+ + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#loanListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#loanListAjax').append(html); + $('#loanEmployeesList').append(html); + } + + + +} + +//**************** 2 template for Mobile********************** + function openCreateLoanModal() { var goTo = `#showmodal=/Client/Company/Loan/Index?handler=Create`; window.location.href = goTo; } $(document).on('click', '.removeLoan', function () { + debugger; var id = $(this).data('remove-id'); swal({ @@ -436,7 +1151,8 @@ function removeAjax(id) { $('.alert-success-msg p').text(''); }, 1000); - $('#loanListAjax').html(''); + $('#loanListAjax').html('
'); + //$('#loanListAjax').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadLoanList(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js index 95647286..b78ddf41 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js @@ -1,14 +1,35 @@ var urlPathname = location.pathname; -//var Scrollbar = window.Scrollbar; -//Scrollbar.init(document.querySelector('#amountRials'), { -// alwaysShowTracks: true -//}); +document.querySelectorAll('.scroll-container-amount').forEach(container => { + let isDown = false; + let startX; + let scrollLeft; -//Scrollbar.init(document.querySelector('#amountTomans'), { -// alwaysShowTracks: true -//}); + container.addEventListener('mousedown', (e) => { + isDown = true; + startX = e.pageX - container.offsetLeft; + scrollLeft = container.scrollLeft; + container.style.cursor = "grabbing"; + }); + container.addEventListener('mouseleave', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mouseup', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mousemove', (e) => { + if (!isDown) return; + e.preventDefault(); + const x = e.pageX - container.offsetLeft; + const walk = (x - startX) * 2; + container.scrollLeft = scrollLeft - walk; + }); +}); $(document).ready(function () { $('.loading').hide(); @@ -381,7 +402,8 @@ function SaveDataAjax() { }, 2000); if (urlPathname.indexOf('/Client/Company/Loan') > -1) { - $('#loanListAjax').html(''); + $('#loanListAjax').html('
'); + $('#loanEmployeesList').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadLoanList(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Reward/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/Reward/css/Index.css index 51476d2a..cb8ea2ac 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Reward/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Reward/css/Index.css @@ -1,7 +1,193 @@ -.rewardListModal-width { +/*tooltip styles*/ +.tooltipfull-container { + cursor: pointer; + position: relative; +} + +.tooltipfull { + opacity: 0; + z-index: 99; + color: #fff; + display: grid; + font-size: 12px; + padding: 5px 10px; + border-radius: 8px; + background: #23a8a8; + border: 1px solid #23a8a8; + -webkit-transition: all .2s ease-in-out; + -moz-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; + -webkit-transform: scale(0); + -moz-transform: scale(0); + -o-transform: scale(0); + -ms-transform: scale(0); + transform: scale(0); + position: absolute; + right: -2px; + bottom: 30px; + white-space: nowrap; +} + +.tooltipfull-container:hover .tooltipfull, a:hover .tooltipfull { + opacity: 1; + -webkit-transform: scale(1); + -moz-transform: scale(1); + -o-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); +} + +.tooltipfull:before, .tooltipfull:after { + content: ''; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-top: 10px solid #23a8a8; + position: absolute; + bottom: -10px; + right: 15px; +} +/*tooltip styles*/ + +.rewardListModal-width { max-width: 460px; } +.Rtable .Rtable-row .Rtable-cell.column-heading { + padding: 0.2em 0; +} + +.Rtable-row .btn-details { + background-color: #D3F8F8; + color: #4DA9D1; + border-radius: 7px; + border: 0 !important; + padding: 6px 8px; + font-size: 12px; +} + +.leaveDiv { + padding: 10px; + margin: 6px; + background-color: #ffffff; + color: #000; + border-radius: 5px; + font-size: 11px; + font-weight: 400; +} + + +.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { + border-radius: 5px; + background: rgba(87, 227, 227, 0.25); + width: 45px; + height: 32px; + display: inline-block; + padding: 6px; +} + + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + padding: 8px; +} +.table-contracts .Rtable .Rtable-row .column-heading > span input { + margin: 0 0 0 5px; +} + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + border-radius: 4px; + border: 0 !important; + outline: 1px solid #1dc9a0; + margin: 2px 0; +} + +.table-contracts .form-check-input { + padding: 8px !important; + border: 0 !important; + outline: 1px solid #1dc9a0; +} + +.btn-search { + background: #84CC16; + width: 100%; + height: 36px; +} + + +.tm-selection-rad:checked + .btn, :not(.tm-selection-rad) + .btn:active, .btn:first-child:active, .btn.active, .btn.show { + color: #ffffff; + background: linear-gradient(94deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%); + border: none; + +} + + +.tm-rad, .tm-selection-rad { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; + } + +.search-box .radio-btn { + color: #717171; + padding: 0; + border-radius: 8px; + border: 1px solid #DADADA; + background-color: white; + outline: none; + width: 100%; + height: 36px; + font-size: 13px; + display: flex; + align-items: center; + justify-items: center; + text-align: center; +} + + +.select2-container .select2-selection--single, #start-date, #end-date { + height: 36px; +} + +.personnel-selector-navFilter { + width: 15%; +} + +.start-date-navbarFilter{ + width:12%; +} + +.end-date-navbarFilter{ + width:12%; +} + +.list-navbarFilter{ + width:7%; +} + +.group-navbarFilter{ + width:7%; +} + +.search-navbarFilter{ + width:10%; +} +.clearSearch-navbarFilter { + width:10%; +} + +.personnel-selector-navFilter, +.start-date-navbarFilter, +.end-date-navbarFilter, +.list-navbarFilter, +.group-navbarFilter, +.search-navbarFilter, +.clearSearch-navbarFilter { + height: 36px; +} + + + .rewardListModal-width .modal-content { /*height: 430px;*/ } @@ -16,23 +202,79 @@ background-color: #fef2f2 !important; border: 1px solid #eb3434 !important; border-radius: 7px; + overflow: hidden; } -.goToTop { - position: fixed; - bottom: -10px; - margin-right: 100px; - z-index: 100; - color: #fff; - background-color: #25acacd6; - display: none; +.errored .select2-selection .select2-selection--single { + background-color: #fef2f2 !important; } - .goToTop:hover { + + .goToTop { + position: fixed; + bottom: -10px; + margin-right: 100px; + z-index: 100; color: #fff; - background-color: #2ca4a4; + background-color: #25acacd6; + display: none; } +.goToTop:hover { + color: #fff; + background-color: #2ca4a4; +} + +.tooltipfull-container { + cursor: pointer; + position: relative; +} + +.tooltipfull { + opacity: 0; + z-index: 99; + color: #fff; + display: grid; + font-size: 12px; + padding: 5px 10px; + border-radius: 8px; + background: #23a8a8; + border: 1px solid #23a8a8; + -webkit-transition: all .2s ease-in-out; + -moz-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; + -webkit-transform: scale(0); + -moz-transform: scale(0); + -o-transform: scale(0); + -ms-transform: scale(0); + transform: scale(0); + position: absolute; + right: -2px; + bottom: 30px; + white-space: nowrap; +} + +.tooltipfull-container:hover .tooltipfull, a:hover .tooltipfull { + opacity: 1; + -webkit-transform: scale(1); + -moz-transform: scale(1); + -o-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); +} + +.tooltipfull:before, .tooltipfull:after { + content: ''; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-top: 10px solid #23a8a8; + position: absolute; + bottom: -10px; + right: 20px; +} + + .width1 { width: 5% !important; } @@ -200,9 +442,9 @@ padding: 3px; } -.Rtable--collapse .Rtable-row { +/*.Rtable--collapse .Rtable-row { padding: 5px; -} +}*/ .personal-paid-leave-mobile.Rtable .Rtable-row, .personal-payment-mobile.Rtable .Rtable-row { @@ -314,7 +556,7 @@ /************************ Radio Button Input (Like Checkbox appearance) ************************/ -.form-check-input[type="radio"], +/*.form-check-input[type="radio"], .form-check-input[type="checkbox"] { width: 15px; height: 15px; @@ -340,9 +582,9 @@ .form-check-input[type="checkbox"]:focus { outline: none; box-shadow: none; -} +}*/ -.form-check-input[type="radio"] + label, +/*.form-check-input[type="radio"] + label, .form-check-input[type="checkbox"] + label { color: #83898C; } @@ -351,10 +593,25 @@ .form-check-input[type="checkbox"]:checked + label { color: #2B2F32; } - +*/ /************************ Radio Button Input (Like Checkbox appearance) ************************/ +/************************* row grid *************************/ + + +#rewardEmployeesList .personal-grid-row:nth-of-type(odd) .Rtable-row { + background: #ECFFFF !important; + border: 1px solid #E9E9E9 !important; +} + +#rewardEmployeesList .personal-grid-row:nth-of-type(even) .Rtable-row { + background: #DDF4F4 !important; + border: 1px solid #E9E9E9 !important; +} + +/************************* row grid *************************/ + @media (max-width: 1366px) { .rewardListModal-width { max-width: 390px; @@ -373,6 +630,37 @@ } } + +@media(max-width: 992px) { + .personnel-selector-navFilter { + width: 15%; + } + + .start-date-navbarFilter { + width: 12%; + } + + .end-date-navbarFilter { + width: 12%; + } + + .list-navbarFilter { + width: 9%; + } + + .group-navbarFilter { + width: 9%; + } + + .search-navbarFilter { + width: 10%; + } + + .clearSearch-navbarFilter { + width: 10%; + } +} + @media (max-width: 767px) { .goToTop { position: fixed; @@ -387,6 +675,11 @@ margin: 0 0 60px 0; } + input[name="foo"] { + display: none !important; + } + + /* .Rtable .Rtable-row:nth-child(even), .table-workshop .Rtable .Rtable-row:nth-child(4n+2), .table-personals .Rtable .Rtable-row:nth-child(4n+2) { border-radius: 10px; @@ -441,18 +734,6 @@ - - - - - - - - - - - - @media(max-width: 1260px) { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js index 429e369d..e98820b1 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js @@ -1,8 +1,12 @@ var pageIndexJs = 0; -var pageIndex = Number($('#PageIndex').val()); var searchName = ''; var searchStartDateTime = ''; var searchEndDateTime = ''; +var listTypeDataInput = ''; +var groupTypeDataInput = ''; +var loadData = true; +var isMobile = "false"; +var groupData = false; $(document).ready(function () { loadRewardList(); @@ -62,12 +66,38 @@ $(document).ready(function () { //3500); //} else { //loadAllToPrint(); - $('input:checkbox').not(this).prop('checked', this.checked); + $('input:checkbox').not(this).not("#group, #list").prop('checked', this.checked); //} }); + + $("input:checkbox").not("#group,#list,.checkAll").change(function () { + if ($("input:checkbox").not("#group,#list,.checkAll").filter(":not(:checked)").length) { + $(".checkAll").prop("checked", false); + } else { + $(".checkAll").prop("checked", true); + } + }); //******************** انتخاب همه ی چک باکس ها ******************** + + //*********************ستون نام پرسنل در حالتی که فقط اسم پرسنل هست باید هاید بشه************************ + $("#searchJustName").hide(); + + //************تنظیم چک باکس تایپ لیست******************* + $('#group, #groupMobile').change(function () { + if ($(this).is(':checked')) { + $('#list , #listMobile').prop('checked', false); + } + }); + + $('#list, #listMobile').change(function () { + if ($(this).is(':checked')) { + $('#group , #groupMobile').prop('checked', false); + } + }); + //************تنظیم چک باکس تایپ لیست******************* + }); $(document).on('click', ".openAction", function () { @@ -78,12 +108,35 @@ $(document).on('click', ".openAction", function () { }); $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function () { - let isMobile = $(this).hasClass('btn-search-click-mobile'); + isMobile = $(this).hasClass('btn-search-click-mobile'); searchStartDateTime = isMobile ? $('#start-date-mobile').val() : $('#start-date').val(); searchEndDateTime = isMobile ? $('#end-date-mobile').val() : $('#end-date').val(); searchName = isMobile ? $('#employeeSelectIndexMobile') : $('#employeeSelectIndex'); + listTypeDataInput = isMobile ? $('#listMobile') : $('#list'); + groupTypeDataInput = isMobile ? $('#groupMobile') : $('#group'); + + if (listTypeDataInput[0].checked == false && groupTypeDataInput[0].checked == false) { + if (isMobile) { + $("#listMobile").next('label').addClass('errored'); + $("#groupMobile").next('label').addClass('errored'); + } else { + $("#list").next('label').addClass('errored'); + $("#group").next('label').addClass('errored'); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی لیست باید نوع آن را مشخص کنید.'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#group, #list, #listMobile, #groupMobile').next('label').removeClass('errored'); + + }, 3500); + return; + } + if ((searchStartDateTime === '' && searchEndDateTime !== '') || (searchStartDateTime !== '' && searchEndDateTime === '')) { if (isMobile) { $('#start-date-mobile').addClass("errored"); @@ -91,14 +144,36 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function } else { $('#start-date').addClass("errored"); $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); } $('.alert-msg').show(); - $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان را مشخص نمایید'); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); setTimeout(function () { $('.alert-msg').hide(); $('.alert-msg p').text(''); - $('#start-date, #end-date, #start-date-mobile, #end-date-mobile').removeClass("errored"); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); + + }, 3500); + return; + } + + if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) { + if (isMobile) { + $('#start-date-mobile').addClass("errored"); + $('#end-date-mobile').addClass("errored"); + } else { + $('#start-date').addClass("errored"); + $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); }, 3500); return; @@ -113,8 +188,11 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function $('#searchModal').modal('hide'); } + groupData = $("#group,#groupMobile").is(":checked") ? true : false; + pageIndexJs = 0; $('#rewardListAjax').html(''); + $('#rewardEmployeesList').html(''); $('#PageIndex').val(0); loadRewardList(); }); @@ -201,29 +279,21 @@ function ajaxPersonals() { }); } + +//*************ajax calls base on list or group *************** function loadRewardList() { var pageIndex = Number($('#PageIndex').val()); - var employeeId = $('#employeeSelectIndex').val(); + var html = ''; var searchViewModel = { 'PageIndex': pageIndex, - 'EmployeeId': employeeId, + 'EmployeeId': $('#employeeSelectIndex').val(), 'StartDate': $('#start-date').val(), - 'EndDate': $('#end-date').val() + 'EndDate': $('#end-date').val(), + 'ShowAsGrouped':groupData, } - var urlAjax = ``; - //if (employeeId === null || employeeId === "0") { - urlAjax = rewardListLoadDataAjax; - $('#LoadRewardList').show(); - $('#LoadRewardListWithEmployee').hide(); - //} else { - // urlAjax = rewardListLoadDataByEmployeeAjax; - // $('#LoadRewardList').hide(); - // $('#LoadRewardListWithEmployee').show(); - //} - var b = pageIndexJs % 30; if (b === 0) { @@ -232,18 +302,37 @@ function loadRewardList() { contentType: 'charset=utf-8', dataType: 'json', type: 'GET', - url: urlAjax, + url: rewardGroupLoadDataAjax , data: searchViewModel, headers: { "RequestVerificationToken": antiForgeryToken }, success: function (response) { var loadRewardListData = response.data; - if (response.success) { - //if(employeeId === null || employeeId === "0") { - htmlLoadSimpleData(loadRewardListData, response.pageIndex); - //} else { - // htmlLoadWithEmployeeData(loadRewardListData, response.pageIndex); - //} + if (loadRewardListData.rewardListViewModels !== null || loadRewardListData.rewardsGroupedByDate !== null || loadRewardListData.rewardsGroupedByEmployee !== null ) { + if ($("#group").is(":checked")) { + $("#LoadRewardList").hide(); + $("#LoadRewardListWithEmployee").removeClass("d-none"); + htmlLoadGroupType(loadRewardListData); + + } else if ($("#groupMobile").is(":checked")) { + htmlLoadGroupTypeMobile(loadRewardListData); + + } else { + if (loadRewardListData.rewardListViewModels.length > 0) { + $("#LoadRewardList").show(); + $("#LoadRewardListWithEmployee").addClass("d-none"); + htmlLoadSimpleListData(loadRewardListData.rewardListViewModels); + } + } + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); } }, failure: function (response) { @@ -252,31 +341,37 @@ function loadRewardList() { }); } } +//*************ajax calls base on list button or group button*************** -function htmlLoadSimpleData(loadRewardListData, responsePageIndex) { + +//************* 3 Template for Desktop*************** + +function htmlLoadSimpleListData(loadRewardListData) { var html = ''; + //var pageIndex = Number($('#PageIndex').val()); if (loadRewardListData.length > 0) { loadRewardListData.forEach(function (item) { var n = pageIndexJs + 1; html += `
-
+
-
+
${item.grantDateFa}
-
+
${item.employeeFullName}
-
-
${item.personnelCode}
+
+
${item.personnelCode}
${item.title ?? "-"}
@@ -290,7 +385,7 @@ function htmlLoadSimpleData(loadRewardListData, responsePageIndex) {
-
${item.amount}
+
${item.amount + " ریال"}
@@ -370,16 +465,20 @@ function htmlLoadSimpleData(loadRewardListData, responsePageIndex) { ${item.personnelCode}
- مبلغ: - ${item.amount} + عنوان: + ${item.title ?? "-"}
-
+
توضیحات: ${item.description}
تاریخ: ${item.grantDateFa} +
+
+ مبلغ: + ${item.amount + " ریال"}
`; $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); } } -function htmlLoadWithEmployeeData(loadRewardListData, responsePageIndex) { - var html = '
'; +function htmlLoadGroupType(loadRewardListData) { + if (searchName.val() === "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar only date is valid + $(".searchByBoth").hide(); + $("#searchJustNameMiddleTab").hide(); + $("#searchJustNameFirstTab").show(); + } else if (searchName.val() !== "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar personnel and date are valid + $(".searchByBoth").show(); + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); - loadRewardListData.forEach(function (itemRewards, index) { - html += `
+ } else if (searchName.val() !== "0" && (!searchStartDateTime && !searchEndDateTime)){//in filter bar only personnel is valid + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + $(".searchByBoth").show(); + } + + if ($("#group").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeDataByFullname(loadRewardListData.rewardsGroupedByEmployee); + } else { + htmlLoadWithEmployeeDataByDate(loadRewardListData.rewardsGroupedByDate); + } + } +} + +function htmlLoadWithEmployeeDataByDate(loadRewardListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadRewardListData.length > 0) { + loadRewardListData.forEach(function (itemRewards) { + n = 1; + html += `
-
- ${itemRewards.yearFa} +
+ ${itemRewards.year}
-
- ${itemRewards.monthFaName} +
+ ${itemRewards.month}
-
`; +
`; - itemRewards.rewards.forEach(function (item, index) { - var n = pageIndexJs + 1; + itemRewards.rewards.forEach(function (item) { - html += `
+ html += `
-
-
- +
+
+
-
-
${item.employeeFullName}
+
+
${item.employeeName}
-
+
${item.personnelCode}
-
-
${item.description}
+
+
${item.title ?? "-"}
-
+
+
+
${item.description}
+ + ${item.description} + +
+
+
${item.grantDateFa}
-
${item.amount}
+
${item.amount + " ریال"}
-
+
+ ${editPermission ? - ` + ` + : + + ` + ` - : - ``} + + ` + } + + - ${deletePermission ? - `` - : - ``} + + ` + : + ` + + ` + } + + + @@ -572,214 +726,495 @@ function htmlLoadWithEmployeeData(loadRewardListData, responsePageIndex) {
`; + pageIndexJs++; + n++ - pageIndexJs++; + }); + + html += `
` + html += ` +
+
+
+ ${itemRewards.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#rewardEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); + } +} + +function htmlLoadWithEmployeeDataByFullname(loadRewardListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadRewardListData.length > 0) { + loadRewardListData.forEach(function (itemRewards) { + n = 1; + html += ` +
+
+
+
+
+ ${itemRewards.employeeName} +
+
+
+ +
+ +
`; + + + + html += `
` + itemRewards.rewards.forEach(function (item) { + html += `
+
+ +
+
+
${item.personnelCode}22
+
+
+
${item.title ?? '-'}
+
+
+
+
${item.description}
+ + ${item.description} + +
+
+
+
${item.grantDate}
+
+
+
${item.amount + " ریال"}
+
+
+
+ + ${editPermission ? + `` + : + ``} + + + ${deletePermission ? + `` + : + ``} + +
+
+
` + pageIndexJs++; + n++ + }) + html += `
`; + + + html += `
` + html += ` +
+
+
+ ${itemRewards.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; }); - html += `
`; - }); - - pageIndexJs = pageIndex + responsePageIndex; - $('#PageIndex').val(pageIndexJs); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); - $('#rewardEmployeesList').append(html); - - - //if (loadRewardListData.length > 0) { - // loadRewardListData.forEach(function(item) { - // var n = pageIndexJs + 1; - // html += `
- //
- //
- // - //
- //
- //
${item.employeeFullName}
- //
- //
- //
${item.personnelCode}
- //
- //
- //
${item.amount}
- //
- //
- //
${ - // item.description}
- //
- //
- //
${item.grantDateFa}
- //
- - //
- //
- // - // ${editPermission - // ? `` - // : ``} - - - // ${deletePermission - // ? `` - // : ``} - - - - - // - - //
- //
- //
- - - //
- //
- //
- //
- // شماره پرسنلی: - // ${item.personnelCode} - //
- //
- // مبلغ: - // ${item.amount} - //
- //
- // توضیحات: - // ${item.description} - //
- //
- // تاریخ: - // ${item.grantDateFa} - //
- //
- // - - // ${editPermission - // ? `` - // : ``} - - // ${deletePermission - // ? `` - // : ``} - - - //
- //
- //
- //
`; - - // pageIndexJs++; - - // }); - - - // pageIndexJs = pageIndex + responsePageIndex; - // $('#PageIndex').val(pageIndexJs); - - // $('#rewardListAjax').append(html); - //} else { - // html += `
- //
- // - //
اطلاعاتی وجود ندارد.
- //
- //
`; - // $('#rewardListAjax').append(html); - //} + $('#rewardEmployeesList').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); + } } +//************* 3 Template for Desktop *************** + +//**************** 2 template for Mobile********************** +function htmlLoadGroupTypeMobile(loadRewardListData) { + + if ($("#groupMobile").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeMobileDataByFullname(loadRewardListData.rewardsGroupedByEmployee); + } else { + htmlLoadWithEmployeeMobileDataByDate(loadRewardListData.rewardsGroupedByDate); + } + } +} +function htmlLoadWithEmployeeMobileDataByFullname(loadRewardListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + if (loadRewardListData) { + loadRewardListData.forEach(function (item) { + + html += ` +
+
+
+ +
+
+ + + ${item.employeeName} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.rewards.forEach(function (rewardItem) { + html += ` +
+
+
+
نام پرسنل
+
${item.employeeName}
+
+
+
تاریخ
+
${rewardItem.grantDate}
+
+
+
شماره پرسنلی
+
+ ${rewardItem.personnelCode} +
+
+
+
عنوان
+
${rewardItem.title ?? "-"}
+
+
+
توضیحات
+
${rewardItem.description}
+
+
+
مبلغ
+
${rewardItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#rewardListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); + } + + +} + +function htmlLoadWithEmployeeMobileDataByDate(loadRewardListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadRewardListData) { + loadRewardListData.forEach(function (item) { + + html += ` +
+
+
+ +
+
+ + + ${item.year} + + + ${item.month} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.rewards.forEach(function (rewardItem) { + html += ` +
+
+
+
نام پرسنل
+
${rewardItem.employeeName}
+
+
+
تاریخ
+
${rewardItem.grantDateFa}
+
+
+
شماره پرسنلی
+
+ ${rewardItem.personnelCode} +
+
+
+
عنوان
+
${rewardItem.title ?? "-"}
+
+
+
توضیحات
+
${rewardItem.description}
+
+
+
مبلغ
+
${rewardItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#rewardListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#rewardListAjax').append(html); + $('#rewardEmployeesList').append(html); + } + + + +} + +//**************** 2 template for Mobile********************** + function openCreateRewardModal() { var goTo = `#showmodal=/Client/Company/Reward/Index?handler=Create`; window.location.href = goTo; @@ -846,4 +1281,4 @@ function removeAjax(id) { console.log(err); } }); -} \ No newline at end of file +} diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/css/Index.css index dd947bcd..4b481394 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/css/Index.css @@ -6,6 +6,139 @@ /*height: 430px;*/ } +.Rtable .Rtable-row .Rtable-cell.column-heading { + padding: 0.2em 0; +} + +.Rtable-row .btn-details { + background-color: #D3F8F8; + color: #4DA9D1; + border-radius: 7px; + border: 0 !important; + padding: 6px 8px; + font-size: 12px; +} + +.leaveDiv{ + padding: 10px; + margin: 6px; + background-color: #ffffff; + color: #000; + border-radius: 5px; + font-size: 11px; + font-weight: 400; +} + +.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { + border-radius: 5px; + background: rgba(87, 227, 227, 0.25); + width: 45px; + height: 32px; + display: inline-block; + padding: 6px; +} + + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + padding: 8px; +} + +.table-contracts .Rtable .Rtable-row .column-heading > span input { + margin: 0 0 0 5px; +} + +.form-check-input[type="radio"], .form-check-input[type="checkbox"] { + border-radius: 4px; + border: 0 !important; + outline: 1px solid #1dc9a0; + margin: 2px 0; +} + +.table-contracts .form-check-input { + padding: 8px !important; + border: 0 !important; + outline: 1px solid #1dc9a0; +} + +.btn-search { + background: #84CC16; + width: 100%; + height: 36px; +} + + +.tm-selection-rad:checked + .btn, :not(.tm-selection-rad) + .btn:active, .btn:first-child:active, .btn.active, .btn.show { + color: #ffffff; + background: linear-gradient(94deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%); + border: none; +} + + +.tm-rad, .tm-selection-rad { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} + +.search-box .radio-btn { + color: #717171; + padding: 0; + border-radius: 8px; + border: 1px solid #DADADA; + background-color: white; + outline: none; + width: 100%; + height: 36px; + font-size: 13px; + display: flex; + align-items: center; + justify-items: center; + text-align: center; +} + + +.select2-container .select2-selection--single, #start-date, #end-date { + height: 36px; +} + +.personnel-selector-navFilter { + width: 15%; +} + +.start-date-navbarFilter { + width: 12%; +} + +.end-date-navbarFilter { + width: 12%; +} + +.list-navbarFilter { + width: 7%; +} + +.group-navbarFilter { + width: 7%; +} + +.search-navbarFilter { + width: 10%; +} + +.clearSearch-navbarFilter { + width: 10%; +} + +.personnel-selector-navFilter, +.start-date-navbarFilter, +.end-date-navbarFilter, +.list-navbarFilter, +.group-navbarFilter, +.search-navbarFilter, +.clearSearch-navbarFilter { + height: 36px; +} + .sweet-alert button { font-family: 'IRANYekanX'; } @@ -16,6 +149,7 @@ background-color: #fef2f2 !important; border: 1px solid #eb3434 !important; border-radius: 7px; + overflow: hidden; } .goToTop { @@ -159,22 +293,14 @@ /************************ Radio Button Input (Like Checkbox appearance) ************************/ .form-check-input[type="radio"], .form-check-input[type="checkbox"] { - width: 15px; - height: 15px; - border-radius: 6px; padding: 8px; border: 1px solid #CFD3D4; background-color: white; - background-position: center; - background-size: contain; - background-repeat: no-repeat; - appearance: none; } .form-check-input[type="radio"]:checked, .form-check-input[type="checkbox"]:checked { background-color: #148989; - border: 1px solid #ffffff !important; background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white" stroke-width="3"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" /%3E%3C/svg%3E'); background-size: 75%; } @@ -185,21 +311,21 @@ box-shadow: none; } - .form-check-input[type="radio"] + label, - .form-check-input[type="checkbox"] + label { - color: #83898C; - } - .form-check-input[type="radio"]:checked + label, - .form-check-input[type="checkbox"]:checked + label { - color: #2B2F32; - } +/*rwo grid */ +#salaryaidEmployeeListAjax .personal-grid-row:nth-of-type(odd) .Rtable-row { + background: #ECFFFF !important; + border: 1px solid #E9E9E9 !important; +} +#salaryaidEmployeeListAjax .personal-grid-row:nth-of-type(even) .Rtable-row { + background: #DDF4F4 !important; + border: 1px solid #E9E9E9 !important; +} + +/*rwo grid */ /************************ Radio Button Input (Like Checkbox appearance) ************************/ - - - @media (max-width: 1366px) { .salaryaidListModal-width { max-width: 390px; @@ -218,6 +344,36 @@ } } +@media (max-width: 992px) { + .personnel-selector-navFilter { + width: 17%; + } + + .start-date-navbarFilter { + width: 15%; + } + + .end-date-navbarFilter { + width: 15%; + } + + .list-navbarFilter { + width: 10%; + } + + .group-navbarFilter { + width: 10%; + } + + .search-navbarFilter { + width: 15%; + } + + .clearSearch-navbarFilter { + width: 15%; + } +} + @media (max-width: 767px) { .goToTop { position: fixed; @@ -227,6 +383,13 @@ color: #fff; background-color: #25acac70; } + .widthNumberCustom1 { + display: none !important; + } + + input[name="foo"] { + display: none !important; + } .wrapper { margin: 0 0 60px 0; diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js index d848a159..e6d94e51 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js @@ -2,6 +2,11 @@ var searchName = ''; var searchStartDateTime = ''; var searchEndDateTime = ''; +var listTypeDataInput = ''; +var groupTypeDataInput = ''; +var loadData = true; +var isMobile = "false"; +var groupData = false; $(document).ready(function () { loadSalaryAidList(); @@ -61,12 +66,38 @@ $(document).ready(function () { //3500); //} else { //loadAllToPrint(); - $('input:checkbox').not(this).prop('checked', this.checked); + $('input:checkbox').not(this).not("#group, #list").prop('checked', this.checked); //} }); + + + //fix bug :when allcheck click group and list will be checked too + $("input:checkbox").not("#group,#groupMobile,#list,#listMobile,.checkAll").change(function () { + if ($("input:checkbox").not("#group,#list,.checkAll").filter(":not(:checked)").length) { + $(".checkAll").prop("checked", false); + } else { + $(".checkAll").prop("checked", true); + } + }); //******************** انتخاب همه ی چک باکس ها ******************** + + //************تنظیم چک باکس تایپ لیست******************* + $('#group, #groupMobile').change(function () { + if ($(this).is(':checked')) { + $('#list , #listMobile').prop('checked', false); + } + }); + + $('#list, #listMobile').change(function () { + if ($(this).is(':checked')) { + $('#group , #groupMobile').prop('checked', false); + } + }); + //************تنظیم چک باکس تایپ لیست******************* + + }); $(document).on('click', ".openAction", function () { @@ -77,12 +108,35 @@ $(document).on('click', ".openAction", function () { }); $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function () { - let isMobile = $(this).hasClass('btn-search-click-mobile'); + isMobile = $(this).hasClass('btn-search-click-mobile'); searchStartDateTime = isMobile ? $('#start-date-mobile').val() : $('#start-date').val(); searchEndDateTime = isMobile ? $('#end-date-mobile').val() : $('#end-date').val(); searchName = isMobile ? $('#employeeSelectIndexMobile') : $('#employeeSelectIndex'); + listTypeDataInput = isMobile ? $('#listMobile') : $('#list'); + groupTypeDataInput = isMobile ? $('#groupMobile') : $('#group'); + + if (listTypeDataInput[0].checked == false && groupTypeDataInput[0].checked == false) { + if (isMobile) { + $("#listMobile").next('label').addClass('errored'); + $("#groupMobile").next('label').addClass('errored'); + } else { + $("#list").next('label').addClass('errored'); + $("#group").next('label').addClass('errored'); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی لیست باید نوع آن را مشخص کنید.'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#group, #list, #listMobile, #groupMobile').next('label').removeClass('errored'); + + }, 3500); + return; + } + if ((searchStartDateTime === '' && searchEndDateTime !== '') || (searchStartDateTime !== '' && searchEndDateTime === '')) { if (isMobile) { $('#start-date-mobile').addClass("errored"); @@ -90,14 +144,36 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function } else { $('#start-date').addClass("errored"); $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); } $('.alert-msg').show(); - $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان را مشخص نمایید'); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); setTimeout(function () { $('.alert-msg').hide(); $('.alert-msg p').text(''); - $('#start-date, #end-date, #start-date-mobile, #end-date-mobile').removeClass("errored"); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); + + }, 3500); + return; + } + + if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) { + if (isMobile) { + $('#start-date-mobile').addClass("errored"); + $('#end-date-mobile').addClass("errored"); + } else { + $('#start-date').addClass("errored"); + $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); }, 3500); return; @@ -112,8 +188,11 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function $('#searchModal').modal('hide'); } + groupData = $("#group,#groupMobile").is(":checked"); + pageIndexJs = 0; - $('#salaryaidListAjax').html(''); + $('#salaryAidListAjax').html(''); + $('#salaryaidEmployeeListAjax').html(''); $('#PageIndex').val(0); loadSalaryAidList(); }); @@ -199,20 +278,21 @@ function ajaxPersonals() { }); } +//*************ajax calls base on list or group *************** function loadSalaryAidList() { - var pageIndex = Number($('#PageIndex').val()); + var html = ''; var searchViewModel = { 'PageIndex': pageIndex, 'EmployeeId': $('#employeeSelectIndex').val(), 'StartDate': $('#start-date').val(), - 'EndDate': $('#end-date').val() + 'EndDate': $('#end-date').val(), + 'ShowAsGrouped': groupData, } + var b = pageIndexJs % 30; - var html = ''; - var index = 1; if (b === 0) { $.ajax({ @@ -220,41 +300,74 @@ function loadSalaryAidList() { contentType: 'charset=utf-8', dataType: 'json', type: 'GET', - url: salaryaidListLoadDataAjax, + url: salaryAidGroupLoadDataAjax, data: searchViewModel, headers: { "RequestVerificationToken": antiForgeryToken }, success: function (response) { var loadSalaryAidListData = response.data; + if (loadSalaryAidListData.salaryAidListViewModels !== null || loadSalaryAidListData.groupedByDate !== null || loadSalaryAidListData.groupedByEmployee !== null) { + if ($("#group").is(":checked")) { + $("#LoadSalaryAidList").hide(); + $("#LoadSalaryAidListWithEmployee").removeClass("d-none"); + htmlLoadGroupType(loadSalaryAidListData); - if (response.success) { - if (loadSalaryAidListData.length > 0) { - loadSalaryAidListData.forEach(function (item) { - var n = pageIndexJs + 1; - html += `
-
-
-
`; - - pageIndexJs++; - - }); - - pageIndexJs = pageIndex + response.pageIndex; - $('#PageIndex').val(pageIndexJs); - $('#salaryaidListAjax').append(html); - } else { - html += `
-
- -
اطلاعاتی وجود ندارد.
-
-
`; - $('#salaryaidListAjax').append(html); - } - } - }, - failure: function (response) { - console.log(response); - } + pageIndexJs++; }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#salaryAidListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#salaryAidListAjax').append(html); + $('#salaryaidEmployeeListAjax').append(html); } } -function openCreateSalaryAidModal() { - var goTo = `#showmodal=/Client/Company/SalaryAid/Index?handler=Create`; - window.location.href = goTo; +function htmlLoadGroupType(loadSalaryAidListData) { + if (searchName.val() === "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar only date is valid + $(".searchByBoth").hide(); + $("#searchJustNameMiddleTab").hide(); + $("#searchJustNameFirstTab").show(); + } else if (searchName.val() !== "0" && (searchStartDateTime && searchEndDateTime)) {//in filter bar personnel and date are valid + $(".searchByBoth").show(); + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + + } else if (searchName.val() !== "0" && (!searchStartDateTime && !searchEndDateTime)) {//in filter bar only personnel is valid + $("#searchJustNameFirstTab").hide(); + $("#searchJustNameMiddleTab").show(); + $(".searchByBoth").show(); + } + + if ($("#group").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeDataByFullname(loadSalaryAidListData.groupedByEmployee); + } else { + htmlLoadWithEmployeeDataByDate(loadSalaryAidListData.groupedByDate); + } + } } -function openImportExcelSalaryAidModal() { - var goTo = `#showmodal=/Client/Company/SalaryAid/Index?handler=ImportExcel`; - window.location.href = goTo; +function htmlLoadWithEmployeeDataByDate(loadSalaryAidListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadSalaryAidListData.length > 0) { + loadSalaryAidListData.forEach(function (itemSalaryAids) { + n = 1; + html += `
+
+
+
+
+ ${itemSalaryAids.yearFa} +
+
+
+
+ ${itemSalaryAids.monthFa} +
+
+
+ +
`; + + itemSalaryAids.salaryAidViewModels.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.employeeName}
+
+
+
${item.personnelCode}
+
+
+
${item.salaryAidDateTimeFa}
+
+
+
${item.amount + " ریال"}
+
+
+
+ + + ${editPermission ? + ` + + ` + : + + ` + + ` + } + + + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + + + + + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + + html += `
` + html += ` +
+
+
+ ${itemSalaryAids.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#salaryaidEmployeeListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#salaryAidListAjax').append(html); + $('#salaryaidEmployeeListAjax').append(html); + } } +function htmlLoadWithEmployeeDataByFullname(loadSalaryAidListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadSalaryAidListData.length > 0) { + loadSalaryAidListData.forEach(function (itemSalaryAids) { + console.log(itemSalaryAids); + n = 1; + html += ` +
+
+
+
+
+ ${itemSalaryAids.employeeName} +
+
+
+ +
+ +
`; + + + + html += `
` + itemSalaryAids.salaryAidViewModels.forEach(function (item) { + + html += `
+ +
+
+ +
+
+
${item.personnelCode}
+
+
+
${item.salaryAidDateTimeFa}
+
+
+
${item.amount + " ریال"}
+
+
+
+ + + ${editPermission ? + ` + + ` + : + + ` + + ` + } + + + + + ${deletePermission ? + ` + + ` + : + ` + + ` + } + + + + + + + + + +
+
+
+
`; + pageIndexJs++; + n++ + + }); + html += `
`; + + + html += `
` + html += ` +
+
+
+ ${itemSalaryAids.totalAmount + " ریال"} +
+
+
+ +
`; + html += `
`; + + }); + + + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#salaryaidEmployeeListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#salaryAidListAjax').append(html); + $('#salaryaidEmployeeListAjax').append(html); + } +} + +//************* 3 Template *************** + + +//**************** 2 template for Mobile********************** +function htmlLoadGroupTypeMobile(loadSalaryAidListData) { + + if ($("#groupMobile").is(":checked")) { + if ((searchEndDateTime && searchStartDateTime) && searchName.val() === "0") { + htmlLoadWithEmployeeMobileDataByFullname(loadSalaryAidListData.groupedByEmployee); + } else { + htmlLoadWithEmployeeMobileDataByDate(loadSalaryAidListData.groupedByDate); + } + } +} +function htmlLoadWithEmployeeMobileDataByFullname(loadSalaryAidListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + if (loadSalaryAidListData) { + loadSalaryAidListData.forEach(function (item) { + console.log(item); + + html += ` +
+
+
+ +
+
+ + + ${item.employeeName} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.salaryAidViewModels.forEach(function (salaryAidItem) { + html += ` +
+
+
+
نام پرسنل
+
${item.employeeName}
+
+
+
تاریخ
+
${salaryAidItem.salaryAidDateTimeFa}
+
+
+
شماره پرسنلی
+
+ ${salaryAidItem.personnelCode} +
+
+
+
مبلغ
+
${salaryAidItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+ +
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#salaryAidListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#salaryAidListAjax').append(html); + $('#salaryaidEmployeeListAjax').append(html); + } + + +} + +function htmlLoadWithEmployeeMobileDataByDate(loadSalaryAidListData) { + //var pageIndex = Number($('#PageIndex').val()); + var html = ''; + var n = 1; + + if (loadSalaryAidListData) { + console.log(loadSalaryAidListData) + loadSalaryAidListData.forEach(function (item) { + console.log(item); + + html += ` +
+
+
+ +
+
+ + + ${item.yearFa} + + + ${item.monthFa} + +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
`; + item.salaryAidViewModels.forEach(function (salaryAidItem) { + html += ` +
+
+
+
نام پرسنل
+
${salaryAidItem.employeeName}
+
+
+
تاریخ
+
${salaryAidItem.salaryAidDateTimeFa}
+
+
+
شماره پرسنلی
+
+ ${salaryAidItem.personnelCode} +
+
+
+
مبلغ
+
${salaryAidItem.amount + " ریال"}
+
+ +
+ + + +
+
+
+
+ `; + }); + html += ` +
+
+
+
مجموع مبالغ
+
${item.totalAmount + " ریال"}
+
+
+
+
+
+
+
+ `; + pageIndexJs++; + n++; + }); + //pageIndexJs = pageIndex + responsePageIndex; + $('#PageIndex').val(pageIndexJs); + + $('#salaryAidListAjax').append(html); + } else { + html += `
+
+ +
اطلاعاتی وجود ندارد.
+
+
`; + $('#salaryAidListAjax').append(html); + $('#salaryaidEmployeeListAjax').append(html); + } + + + +} + +//**************** 2 template for Mobile********************** + $(document).on('click', '.btn-edit', function () { var id = $(this).data('edit-id'); var goTo = `#showmodal=/Client/Company/SalaryAid/Index?id=${id}&handler=Edit`; @@ -453,6 +1213,14 @@ $(document).on('click', '.btn-delete', function () { }); }); +function openCreateSalaryAidModal() { + var goTo = `#showmodal=/Client/Company/SalaryAid/Index?handler=Create`; + window.location.href = goTo; +} +function openImportExcelSalaryAidModal() { + var goTo = `#showmodal=/Client/Company/SalaryAid/Index?handler=ImportExcel`; + window.location.href = goTo; +} function removeAjax(id) { var ID = Number(id); $.ajax({ @@ -471,7 +1239,7 @@ function removeAjax(id) { $('.alert-success-msg p').text(''); }, 1000); - $('#salaryaidListAjax').html(''); + $('#salaryAidListAjax').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadSalaryAidList(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js index 577984de..89063877 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js @@ -204,7 +204,7 @@ function SaveDataAjax() { }, 1500); if (urlPathname.indexOf('/Client/Company/SalaryAid') > -1) { - $('#salaryaidListAjax').html(''); + $('#salaryAidListAjax').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadSalaryAidList(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js index 29c150cb..342cd2e1 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js @@ -127,7 +127,7 @@ function SaveDataAjax() { $('.alert-success-msg p').text(''); }, 1500); - $('#salaryaidListAjax').html(''); + $('#salaryAidListAjax').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadSalaryAidList(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js index 1b2883d5..ae973e2c 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js @@ -746,7 +746,7 @@ $('#createData').click(function () { }, 2000); if (urlPathname.indexOf('/Client/Company/SalaryAid') > -1) { - $('#salaryaidListAjax').html(''); + $('#salaryAidListAjax').html(''); $('#PageIndex').val(0); pageIndexJs = 0; loadSalaryAidList(); From 39eb40157511d6b21d930d8903b982846d6b4d64 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Sun, 13 Apr 2025 22:51:21 +0330 Subject: [PATCH 06/12] add loan details --- Company.Domain/LoanAgg/ILoanRepository.cs | 3 +- .../Loan/ILoanApplication.cs | 3 +- .../Loan/LoanDetailsViewModel.cs | 22 ++ .../LoanApplication.cs | 5 +- .../Repository/LoanRepository.cs | 50 ++- .../Client/Pages/Company/Loan/Index.cshtml | 4 +- .../Client/Pages/Company/Loan/Index.cshtml.cs | 23 ++ .../Pages/Company/Loan/ModalDetailLoan.cshtml | 159 +++++++++ .../AssetsClient/pages/Loan/css/Index.css | 28 +- .../pages/Loan/css/ModalDetailLoan.css | 242 ++++++++++++++ .../AssetsClient/pages/Loan/js/Index.js | 315 ++++++++++++++---- 11 files changed, 773 insertions(+), 81 deletions(-) create mode 100644 CompanyManagment.App.Contracts/Loan/LoanDetailsViewModel.cs create mode 100644 ServiceHost/Areas/Client/Pages/Company/Loan/ModalDetailLoan.cshtml create mode 100644 ServiceHost/wwwroot/AssetsClient/pages/Loan/css/ModalDetailLoan.css diff --git a/Company.Domain/LoanAgg/ILoanRepository.cs b/Company.Domain/LoanAgg/ILoanRepository.cs index 2f91b4a6..2a0fa5a7 100644 --- a/Company.Domain/LoanAgg/ILoanRepository.cs +++ b/Company.Domain/LoanAgg/ILoanRepository.cs @@ -2,13 +2,14 @@ using Company.Domain.LoanAgg.Entities; using CompanyManagment.App.Contracts.Loan; using System.Collections.Generic; +using System.Threading.Tasks; namespace Company.Domain.LoanAgg; public interface ILoanRepository:IRepository { List GetSearchList(LoanSearchViewModel searchViewModel); - LoanViewModel GetDetails(long id); + Task GetDetails(long id); void Remove(Loan entity); List GetBy(IEnumerable ids); void RemoveRange(IEnumerable loans); diff --git a/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs b/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs index 1e372d6f..f55f3132 100644 --- a/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs +++ b/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Threading.Tasks; using _0_Framework.Application; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -7,7 +8,7 @@ namespace CompanyManagment.App.Contracts.Loan; public interface ILoanApplication { List GetSearchList(LoanSearchViewModel searchViewModel); - LoanViewModel GetDetails(long id); + Task GetDetails(long id); OperationResult Create(CreateLoanViewModel command); List CalculateLoanInstallment(string amount , int installmentCount,string loanStartDate,bool getRounded); OperationResult Remove(long id); diff --git a/CompanyManagment.App.Contracts/Loan/LoanDetailsViewModel.cs b/CompanyManagment.App.Contracts/Loan/LoanDetailsViewModel.cs new file mode 100644 index 00000000..b73ddf3e --- /dev/null +++ b/CompanyManagment.App.Contracts/Loan/LoanDetailsViewModel.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace CompanyManagment.App.Contracts.Loan; + +public class LoanDetailsViewModel +{ + public long Id { get; set; } + public string EmployeeFullName { get; set; } + public string LoanGrantDate { get; set; } + public string InstallmentCount { get; set; } + public string TotalLoanAmount { get; set; } + public string TotalPaidAmount { get; set; } + public string TotalRemainingAmount { get; set; } + public List Installments { get; set; } +} +public class LoanInstallmentDetailsViewModel +{ + public long Id { get; set; } + public string InstallmentDate { get; set; } + public string InstallmentAmount { get; set; } + public bool IsPaid { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.Application/LoanApplication.cs b/CompanyManagment.Application/LoanApplication.cs index 9161e8f6..1457faa3 100644 --- a/CompanyManagment.Application/LoanApplication.cs +++ b/CompanyManagment.Application/LoanApplication.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection.Metadata.Ecma335; +using System.Threading.Tasks; using _0_Framework.Application; using Company.Domain.CheckoutAgg; using Company.Domain.CustomizeCheckoutAgg; @@ -36,9 +37,9 @@ public class LoanApplication : ILoanApplication return _loanRepository.GetSearchList(searchModel); } - public LoanViewModel GetDetails(long id) + public async Task GetDetails(long id) { - return _loanRepository.GetDetails(id); + return await _loanRepository.GetDetails(id); } public OperationResult Create(CreateLoanViewModel command) diff --git a/CompanyManagment.EFCore/Repository/LoanRepository.cs b/CompanyManagment.EFCore/Repository/LoanRepository.cs index 7de894b3..6f23763e 100644 --- a/CompanyManagment.EFCore/Repository/LoanRepository.cs +++ b/CompanyManagment.EFCore/Repository/LoanRepository.cs @@ -5,9 +5,11 @@ using Company.Domain.LoanAgg.Entities; using CompanyManagment.App.Contracts.Loan; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using _0_Framework.Application; using Microsoft.EntityFrameworkCore; using System.Globalization; +using System.Collections; namespace CompanyManagment.EFCore.Repository; @@ -20,18 +22,46 @@ public class LoanRepository : RepositoryBase, ILoanRepository _companyContext = companyContext; } - public LoanViewModel GetDetails(long id) + public async Task GetDetails(long id) { - return _companyContext.Loans.Select(x => new LoanViewModel() + var loan = await _companyContext.Loans.FirstOrDefaultAsync(x => x.id == id); + if (loan == null) { - Id = x.id, - WorkshopId = x.WorkshopId, - EmployeeId = x.EmployeeId, - EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, - StartDateTime = x.StartDateMonth, - Count = x.Count, - Amount = x.Amount.ToMoney(), - }).FirstOrDefault(x => x.Id == id); + return null; + } + + var employeeName = await _companyContext.Employees.Where(x => x.id == loan.EmployeeId) + .Select(x => x.FName + " " + x.LName).FirstOrDefaultAsync(); + + var startDate = loan.LoanInstallments.MinBy(x => x.InstallmentDate).InstallmentDate; + var endDate = loan.LoanInstallments.MaxBy(x => x.InstallmentDate).InstallmentDate; + + var customizeCheckouts =await _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId == loan.WorkshopId && x.EmployeeId == loan.EmployeeId && + x.ContractStart <= endDate && x.ContractEnd >= startDate).Select(x=> new {x.MonthInt, x.YearInt}).ToListAsync(); + + var result = new LoanDetailsViewModel() + { + TotalLoanAmount = loan.Amount.ToMoney(), + InstallmentCount = loan.LoanInstallments.Count.ToString(), + EmployeeFullName = employeeName, + Id = loan.id, + LoanGrantDate = loan.LoanGrantDate.ToFarsi(), + Installments = loan.LoanInstallments.Select(x => new LoanInstallmentDetailsViewModel() + { + Id = x.Id, + InstallmentAmount = x.AmountForMonth.ToMoney(), + InstallmentDate = x.InstallmentDate.ToFarsi(), + IsPaid = customizeCheckouts.Any(c => c.MonthInt.ToString() == x.Month && c.YearInt.ToString() == x.Year) + }).ToList() + + }; + var totalPaidAmountD = result.Installments.Where(x => x.IsPaid).Sum(x => x.InstallmentAmount.MoneyToDouble()); + var remainingD = result.Installments.Where(x => !x.IsPaid).Sum(x => x.InstallmentAmount.MoneyToDouble()); + result.TotalPaidAmount = totalPaidAmountD.ToMoney(); + result.TotalRemainingAmount= remainingD.ToMoney(); + + return result; + } public List GetBy(IEnumerable ids) diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml index 9d9cec66..e413247f 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml @@ -371,8 +371,10 @@ var loanGroupLoadDataAjax = `@Url.Page("./Index", "Search")`; var removeLoanAjax = `@Url.Page("./Index", "Remove")`; var employeeListAjax = `@Url.Page("./Index", "EmployeeList")`; - + var modalDetailLoanAjax = `@Url.Page("./Index", "Detail")`; var deletePermission = @(AuthHelper.GetPermissions().Contains(SubAccountPermissionHelper.DeleteLoanPermissionCode) ? "true" : "false"); + // TODO: Mr.Farokhi, Please set the permission for loan details. + var detailsPermission = true; } diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs index fe72cdf0..98d11786 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs @@ -219,6 +219,29 @@ namespace ServiceHost.Areas.Client.Pages.Company.Loan }); } + + #region Details + + public async Task OnGetDetail(long id) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + { + var resultError = new ErrorViewModel() + { + Message = "کارگاه شما یافت نشد" + }; + return Partial("../Error/_ErrorModal", resultError); + } + + var command = await _loanApplication.GetDetails(id); + return Partial("ModalDetailLoan", command); + } + + #endregion + + public IActionResult OnGetSearch(LoanSearchViewModel searchModel) { searchModel.WorkshopId = _workshopId; diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/ModalDetailLoan.cshtml b/ServiceHost/Areas/Client/Pages/Company/Loan/ModalDetailLoan.cshtml new file mode 100644 index 00000000..b3dabea5 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/ModalDetailLoan.cshtml @@ -0,0 +1,159 @@ +@model CompanyManagment.App.Contracts.Loan.LoanDetailsViewModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + + var index = 1; +} + + + + + + + + + + +@* *@ \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css index f74b9c02..35774e1a 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/Index.css @@ -288,7 +288,27 @@ } +.btn-detail { + display: flex; + align-items: center; + justify-content: center; + background: rgba(93, 209, 52, 0.3); + /*border: 0.5px solid #FFFFFF;*/ + border-radius: 7px; + color: #ffffff; + font-size: 12px; + padding: 3px 7px; + font-style: normal; + font-weight: 400; + line-height: normal; + white-space: nowrap; + transition: all ease-in .3s; +} + +.btn-detail:hover { + background: rgba(93, 209, 52, 0.4); +} @@ -437,11 +457,11 @@ display: flex; } - button.btn-print, button.btn-edit, button.btn-delete { + button.btn-print, button.btn-edit, button.btn-delete, btn-detail { width: 32%; } - button.btn-print, button.btn-edit span, button.btn-delete span { - display: unset; - } + button.btn-print, button.btn-edit span, button.btn-delete span, btn-detail span { + display: unset; + } } diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/ModalDetailLoan.css b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/ModalDetailLoan.css new file mode 100644 index 00000000..6f0a25a5 --- /dev/null +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/css/ModalDetailLoan.css @@ -0,0 +1,242 @@ +.sticky { + position: sticky; + top: 0px; + z-index: 10; +} + +.infoLoan { + background-color: #FCFCFC; + border: 1px solid #DADADA; + border-radius: 7px; + color: #797979; + width: 100%; + font-size: 13px; +} + + +.installmentContainer { + background-color: #F0F0F0; + padding: 9px; + border-radius: 6px; +} + + .installmentContainer .tableLoanDetail { + height: 400px; + overflow-y: auto; + } + + .installmentContainer .totalPaymentLoan { + padding: 7px; + border-radius: 6px; + background-color: #ffffff; + border: 1px solid #DEDEDE; + } + + .installmentContainer .totalPaymentLoan .infoInstallment { + color: #0B5959; + font-weight: 500; + font-size: 13px; + } + + .installmentContainer .totalPaymentLoan .lineSeparete { + background: rgb(255,255,255); + background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(214,214,214,1) 50%, rgba(255,255,255,1) 100%); + height: 1px; + width: 100%; + margin: 1px auto; + } + + .installmentContainer .totalPaymentLoan .infoInstallment.totalPay { + color: #00BE33 !important; + } + + .installmentContainer .totalPaymentLoan .infoInstallment.remainPay { + color: #D41317 !important; + } + + + +.widthTableBadgeSuccess { + background-color: #BBF7D0; + color: #5E9F02; + border-radius: 30px; + padding: 3px 6px; + width: 160px; +} + +.widthTableBadgeNone { + background-color: #E8E0E0; + color: #BF3737; + border-radius: 30px; + /*padding: 3px 6px;*/ + width: 160px; +} + + +.loanDetailTable .width1 { + width: 10% !important; + justify-content: start !important; +} + +.loanDetailTable .width2 { + width: 30% !important; + justify-content: center !important; +} + +.loanDetailTable .width3 { + width: 40% !important; + justify-content: center !important; +} + +.loanDetailTable .width4 { + width: 20% !important; + justify-content: center !important; +} + +.loanDetailTable .width5 { + width: 30% !important; + justify-content: center !important; +} + +.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { +} + +.installmentContainer1 { + background-color: #F0F0F0; + font-size: 12px; + color: #4f4f4f; + white-space: nowrap; + width: 100%; + overflow: hidden; + cursor: grab; + user-select: none; +} + + .installmentContainer1:active { + cursor: grabbing; + } + +.errored { + animation: shake 300ms; + color: #eb3434 !important; + background-color: #fef2f2 !important; + border: 1px solid #eb3434 !important; +} + +.btn-cancel2 { + width: 100% !important; +} + +.calculationBox { + border-radius: 9px; + background-color: #F0F0F0; + width: 100%; + height: 240px; + display: flex; + align-items: center; + justify-content: center; + padding: 0 50px; +} + +.calculationBox1 { + /*border: 1px solid #B4B4B4;*/ + border-radius: 9px; + background-color: #F0F0F0; + width: 100%; + height: 240px; + display: flex; + align-items: start; + justify-content: center; + overflow-y: scroll +} + + +.table { + --bs-table-bg: #F0F0F0; + --bs-table-color: #4f4f4f; + --bs-table-border-color: #B4B4B4; + font-size: 12px; + margin: 0; +} + +tr.sticky { + position: sticky; + top: 0; + z-index: 1; +} + + +@media (max-width:1366px) { + .loanListModal-width { + max-width: 460px; + } +} + +@media (max-width:768px) { + .infoLoan { + font-size: 11px; + } + + .infoLoan .fullname { + white-space: nowrap; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + } + + + .Rtable .Rtable-row .Rtable-cell { + font-size: 10px; + } + + .Rtable--collapse .Rtable-row { + padding: 0.6em; + margin: 6px 0px 0; + } + + .widthTableBadgeSuccess, + .widthTableBadgeNone { + font-size: 10px; + width: 70px; + } + .Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > span { + font-size: 10px; + width: 22px; + height: 22px; + } + + .loanDetailTable .width1 { + width: 10% !important; + } + + .loanDetailTable .width2 { + width: 20% !important; + } + + .loanDetailTable .width3 { + width: 40% !important; + } + + .loanDetailTable .width4 { + width: 20% !important; + } + + .loanDetailTable .width5 { + width: 30% !important; + } +} + +@media (max-width:576px) { + .btnCreateNew, .btn-cancel2 { + width: 100% !important; + padding: 10px 40px; + display: flex; + justify-content: center; + } +} + +@media (max-height: 667px) { + .installmentContainer .tableLoanDetail { + height: 300px; + } +} diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js index 3592b1d0..7bbfec61 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js @@ -341,10 +341,10 @@ function htmlLoadSimpleListData(loadLoanListData) { var n = pageIndexJs + 1; html += `
-
-
`; + pageIndexJs++; }); @@ -594,7 +645,31 @@ function htmlLoadWithEmployeeDataByDate(loadLoanListData) { - + ${detailsPermission + ? + `` + : + ``} ${deletePermission ? ` - + ${detailsPermission + ? + `` + : + ``} ${deletePermission ? ` @@ -915,15 +1014,57 @@ function htmlLoadWithEmployeeMobileDataByFullname(loadLoanListData) { پرینت - + جزئیات + ` + : + ``} + + ${deletePermission ? + ` + + ` + : + ` + + ` + }
@@ -1054,15 +1195,57 @@ function htmlLoadWithEmployeeMobileDataByDate(loadLoanListData) { ویرایش - + جزئیات + ` + : + ``} + + ${deletePermission ? + ` + + ` + : + ` + + ` + }
@@ -1170,4 +1353,12 @@ function removeAjax(id) { console.log(err); } }); -} \ No newline at end of file +} + + + +function DetailLoan(LoanId) { + var id = Number(LoanId); + var url = `/Client/Company/Loan/Index?id=${id}&handler=Detail`; + AjaxUrlContentModal(url); +} From 1915dc056511a30c4fd34a26ba047d5a12c08cb2 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Wed, 16 Apr 2025 15:30:20 +0330 Subject: [PATCH 07/12] fix rollcall bug and reward desc bug --- CompanyManagment.EFCore/Repository/RewardRepository.cs | 4 ++-- .../Repository/RollCallEmployeeRepository.cs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/RewardRepository.cs b/CompanyManagment.EFCore/Repository/RewardRepository.cs index 1e78eb05..cfecb44f 100644 --- a/CompanyManagment.EFCore/Repository/RewardRepository.cs +++ b/CompanyManagment.EFCore/Repository/RewardRepository.cs @@ -50,7 +50,7 @@ public class RewardRepository : RepositoryBase, IRewardRepository Title = x.Title, Amount = x.Amount, CreationDate = x.CreationDate, - Description = x.Description, + Description = x.Description??"", GrantDateFa = x.GrantDateFa, EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, Id = x.Id, @@ -203,7 +203,7 @@ public class RewardRepository : RepositoryBase, IRewardRepository WorkshopId = x.WorkshopId, Amount = x.Amount.ToMoney(), AmountDouble = x.Amount, - Description = x.Description, + Description = x.Description??"", EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, EmployeeId = x.EmployeeId, GrantDateFa = x.GrantDate.ToFarsi(), diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs index 2f290277..7b8b4a79 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs @@ -72,7 +72,12 @@ public class RollCallEmployeeRepository : RepositoryBase EmployeeLName = x.LName, EmployeeFullName = x.EmployeeFullName, IsActiveString = x.IsActiveString, - HasUploadedImage = x.HasUploadedImage + HasUploadedImage = x.HasUploadedImage, + Statuses = x.EmployeesStatus.Select(x => new RollCallEmployeeStatusViewModel() + { + StartDateGr = x.StartDate, + EndDateGr = x.EndDate + }) }).FirstOrDefault(); } From f2a2afc7a4ca5ee1fb381606cbca1a005a508e4c Mon Sep 17 00:00:00 2001 From: MahanCh Date: Wed, 16 Apr 2025 17:14:23 +0330 Subject: [PATCH 08/12] fix sidebar bugs --- .../Client/Pages/Shared/_ClientLayout.cshtml | 9 ++++---- .../Areas/Client/Pages/Shared/_Menu.cshtml | 23 ++++++++++++------- .../wwwroot/AssetsClient/css/sidebar-menu.css | 14 +++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml b/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml index 760a9895..647d9b6b 100644 --- a/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml +++ b/ServiceHost/Areas/Client/Pages/Shared/_ClientLayout.cshtml @@ -389,16 +389,17 @@ success: function (response) { if (response.success) { if (response.countWorkFlow === 0) { - $('#_countWorkFlowMenu').hide(); - $('#spinnerWorkFlow').hide(); + $('#_countWorkFlowMenu, #_countRollCallMenuSubmenu').hide(); + $('#spinnerWorkFlow, #spinnerRollCall').hide(); $('#_countWorkFlowMenuMobile').hide(); $('#spinnerWorkFlowMobile').hide(); } else { - $('#_countWorkFlowMenu').css('display', 'flex'); - $('#spinnerWorkFlow').hide(); + $('#_countWorkFlowMenu, #_countRollCallMenuSubmenu').css('display', 'flex'); + $('#spinnerWorkFlow, #spinnerRollCall').hide(); $('#_countWorkFlowMenuMobile').show(); // $('#spinnerWorkFlowMobile').hide(); $('#_countWorkFlowMenu').text(response.countWorkFlow); + $('#_countRollCallMenuSubmenu').text(response.countWorkFlow); $('#_countWorkFlowMenuMobile').text(response.countWorkFlow); } } diff --git a/ServiceHost/Areas/Client/Pages/Shared/_Menu.cshtml b/ServiceHost/Areas/Client/Pages/Shared/_Menu.cshtml index 025868b6..b1c2007f 100644 --- a/ServiceHost/Areas/Client/Pages/Shared/_Menu.cshtml +++ b/ServiceHost/Areas/Client/Pages/Shared/_Menu.cshtml @@ -101,13 +101,13 @@
  • لیست کل پرسنل
  • لیست کل مرخصی
  • @*
  • ثبت مرخصی
  • *@ -
  • عملیات حساب بانکی پرسنل
  • -
  • عملیات مدارک پرسنل
  • +
  • حساب بانکی پرسنل
  • +
  • مدارک پرسنل
  • @*
  • عملیات پرداخت حقوق پرسنل
  • *@ -
  • عملیات وام
  • -
  • عملیات پاداش
  • -
  • عملیات مساعده
  • -
  • عملیات جرایم
  • +
  • وام
  • +
  • پاداش
  • +
  • مساعده
  • +
  • جرایم
  • @@ -187,7 +187,7 @@
  • آپلود عکس پرسنل
  • حضور و غیاب جاری
  • سوابق حضور و غیاب
  • -
  • عملیات گروه‌بندی
  • +
  • گروه‌بندی
  • تنظیم ساعت فعالیت مجموعه
  • تنظیمات حساب کاربری دوربین
  • @@ -223,8 +223,15 @@
    @@ -648,21 +652,21 @@
    @section Script { - - + + - + } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs index 966496cf..0d3c406f 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/Checkouts/Index.cshtml.cs @@ -8,188 +8,193 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.Security.Claims; +using _0_Framework.Infrastructure; namespace ServiceHost.Areas.Client.Pages.Company.Checkouts { - [Authorize] - public class IndexModel : PageModel - { - #region Entities + [Authorize] + [NeedsPermission(SubAccountPermissionHelper.CheckoutListPermissionCode)] + public class IndexModel : PageModel + { + #region Entities - public List Checkouts; - public CheckoutSearchModel SearchModel; - public List Employees; - public string Year; - public string Month; - public long EmployeeId; - public string ContarctStart; - public string ContarctEnd; - public long WorkshopId; - public string Sorting; - public string WorkshopName { get; set; } - public List YearlyList; - private readonly ICheckoutApplication _checkoutApplication; - private readonly IWorkshopApplication _workshopApplication; - private readonly IYearlySalaryApplication _yearlySalaryApplication; - private readonly IPasswordHasher _passwordHasher; - private readonly IRollCallApplication rollCallApplication; - public int PageIndex; + public List Checkouts; + public CheckoutSearchModel SearchModel; + public List Employees; + public string Year; + public string Month; + public long EmployeeId; + public string ContarctStart; + public string ContarctEnd; + public long WorkshopId; + public string Sorting; + public string WorkshopName { get; set; } + public List YearlyList; + private readonly ICheckoutApplication _checkoutApplication; + private readonly IWorkshopApplication _workshopApplication; + private readonly IEmployeeApplication _employeeApplication; + private readonly IYearlySalaryApplication _yearlySalaryApplication; + private readonly IPasswordHasher _passwordHasher; + private readonly IRollCallApplication rollCallApplication; + public int PageIndex; - #endregion + #endregion - public IndexModel(IWorkshopApplication workshopApplication, - IEmployeeApplication employeeApplication, - IYearlySalaryApplication yearlySalaryApplication, - ICheckoutApplication checkoutApplication, IPasswordHasher passwordHasher, IRollCallApplication rollCallApplication) - { + public IndexModel(IWorkshopApplication workshopApplication, + IEmployeeApplication employeeApplication, + IYearlySalaryApplication yearlySalaryApplication, + ICheckoutApplication checkoutApplication, IPasswordHasher passwordHasher, IRollCallApplication rollCallApplication) + { - _workshopApplication = workshopApplication; + _workshopApplication = workshopApplication; + _employeeApplication = employeeApplication; - _yearlySalaryApplication = yearlySalaryApplication; + _yearlySalaryApplication = yearlySalaryApplication; - _checkoutApplication = checkoutApplication; - _passwordHasher = passwordHasher; - this.rollCallApplication = rollCallApplication; - } + _checkoutApplication = checkoutApplication; + _passwordHasher = passwordHasher; + this.rollCallApplication = rollCallApplication; + } - #region FirstLoad-OnGet + #region FirstLoad-OnGet - public IActionResult OnGet(CheckoutSearchModel searchModel) - { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId > 0) - { - searchModel.Sorting = string.IsNullOrWhiteSpace(searchModel.Sorting) - ? "CreationDate-Max" - : searchModel.Sorting; - searchModel.PageIndex = 0; - Year = searchModel.Year; - Month = searchModel.Month; - ContarctStart = searchModel.ContractStart; - ContarctEnd = searchModel.ContractEnd; - EmployeeId = searchModel.EmployeeId; - WorkshopId = workshopId == 0 ? searchModel.WorkshopId : workshopId; - searchModel.WorkshopId = WorkshopId; - Sorting = string.IsNullOrWhiteSpace(searchModel.Sorting) ? "CreationDate-Max" : searchModel.Sorting; - var workshopInfo = _workshopApplication.GetWorkshopInfo(WorkshopId); - WorkshopName = workshopInfo.WorkshopFullName; - Employees = workshopInfo.EmployeeList.Select(x => new EmployeeSelectListViewModel() - { Id = x.Id, EmployeeFullName = x.EmployeeFullName }).ToList(); + public async Task OnGet(CheckoutSearchModel searchModel) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId > 0) + { + searchModel.Sorting = string.IsNullOrWhiteSpace(searchModel.Sorting) + ? "CreationDate-Max" + : searchModel.Sorting; + searchModel.PageIndex = 0; + Year = searchModel.Year; + Month = searchModel.Month; + ContarctStart = searchModel.ContractStart; + ContarctEnd = searchModel.ContractEnd; + EmployeeId = searchModel.EmployeeId; + WorkshopId = workshopId == 0 ? searchModel.WorkshopId : workshopId; + searchModel.WorkshopId = WorkshopId; + Sorting = string.IsNullOrWhiteSpace(searchModel.Sorting) ? "CreationDate-Max" : searchModel.Sorting; + var workshopInfo = _workshopApplication.GetWorkshopInfo(WorkshopId); + WorkshopName = workshopInfo.WorkshopFullName; + //Employees = workshopInfo.EmployeeList.Select(x => new EmployeeSelectListViewModel() + //{ Id = x.Id, EmployeeFullName = x.EmployeeFullName }).ToList(); + Employees = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(workshopId); Checkouts = _checkoutApplication.SearchForClient(searchModel); - PageIndex = Checkouts.Count; - YearlyList = - _yearlySalaryApplication.GetYears(); - SearchModel = new CheckoutSearchModel() - { - Year = string.IsNullOrWhiteSpace(searchModel.Year) ? " " : searchModel.Year, - Month = string.IsNullOrWhiteSpace(searchModel.Month) ? " " : searchModel.Month, - ContractStart = searchModel.ContractStart, - ContractEnd = searchModel.ContractEnd, - EmployeeId = searchModel.EmployeeId, - Sorting = searchModel.Sorting, + PageIndex = Checkouts.Count; + YearlyList = + _yearlySalaryApplication.GetYears(); + SearchModel = new CheckoutSearchModel() + { + Year = string.IsNullOrWhiteSpace(searchModel.Year) ? " " : searchModel.Year, + Month = string.IsNullOrWhiteSpace(searchModel.Month) ? " " : searchModel.Month, + ContractStart = searchModel.ContractStart, + ContractEnd = searchModel.ContractEnd, + EmployeeId = searchModel.EmployeeId, + Sorting = searchModel.Sorting, - }; - return Page(); - } - else - { - return Redirect("error/401"); - } - } + }; + return Page(); + } + else + { + return Redirect("error/401"); + } + } - #endregion + #endregion - #region Pagination + #region Pagination - public IActionResult OnGetPagination(int pageIndex, long workshopId, long employeeId, string year, string month, string start, string end, string sorting) - { - var searchModel = new CheckoutSearchModel() - { - PageIndex = pageIndex, - WorkshopId = workshopId, - EmployeeId = employeeId, - Year = year, - Month = month, - ContractStart = start, - ContractEnd = end, - Sorting = sorting - }; + public IActionResult OnGetPagination(int pageIndex, long workshopId, long employeeId, string year, string month, string start, string end, string sorting) + { + var searchModel = new CheckoutSearchModel() + { + PageIndex = pageIndex, + WorkshopId = workshopId, + EmployeeId = employeeId, + Year = year, + Month = month, + ContractStart = start, + ContractEnd = end, + Sorting = sorting + }; - var search = _checkoutApplication.SearchForClient(searchModel); + var search = _checkoutApplication.SearchForClient(searchModel); - return new JsonResult(new - { - contractResultViewModels = search, - pageIndex = search.Count + return new JsonResult(new + { + contractResultViewModels = search, + pageIndex = search.Count - }); + }); - } + } - #endregion + #endregion - #region PrintOne + #region PrintOne - public IActionResult OnGetPrintOne(long id) - { + public IActionResult OnGetPrintOne(long id) + { - var res = _checkoutApplication.PrintOne(id); + var res = _checkoutApplication.PrintOne(id); if (res.HasRollCall) return Partial("PrintOneRollCall", res); return Partial("PrintOne", res); - } + } - #endregion + #endregion - #region PrintOneMobile - public IActionResult OnGetPrintOneMobile(long id) - { + #region PrintOneMobile + public IActionResult OnGetPrintOneMobile(long id) + { - var res = _checkoutApplication.PrintOne(id); + var res = _checkoutApplication.PrintOne(id); if (res.HasRollCall) return Partial("PrintOneRollCall", res); return Partial("PrintOneMobile", res); - } + } - #endregion + #endregion - #region LoadAllToPrint - public IActionResult OnGetLoadAllToPrint(long workshopId, long employeeId, string year, string month) - { - var searchModel = new CheckoutSearchModel() - { - SearchAll = true, - WorkshopId = workshopId, - EmployeeId = employeeId, - Year = year, - Month = month, + #region LoadAllToPrint + public IActionResult OnGetLoadAllToPrint(long workshopId, long employeeId, string year, string month) + { + var searchModel = new CheckoutSearchModel() + { + SearchAll = true, + WorkshopId = workshopId, + EmployeeId = employeeId, + Year = year, + Month = month, - }; + }; - var search = _checkoutApplication.SearchForClient(searchModel); + var search = _checkoutApplication.SearchForClient(searchModel); - return new JsonResult(new - { - contractResultViewModels = search, - pageIndex = search.Count + return new JsonResult(new + { + contractResultViewModels = search, + pageIndex = search.Count - }); + }); - } - #endregion - } + } + #endregion + } - public class Person - { - public string FirstName { get; set; } - public string LastName { get; set; } - public int Age { get; set; } - } + public class Person + { + public string FirstName { get; set; } + public string LastName { get; set; } + public int Age { get; set; } + } } diff --git a/ServiceHost/Areas/Client/Pages/Company/Contracts/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Contracts/Index.cshtml index 8d3f6b8d..4a99bd94 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Contracts/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Contracts/Index.cshtml @@ -104,7 +104,7 @@
    - + بازگشت
    @@ -167,7 +167,8 @@ @foreach (var person in @Model.Employees) { - + var black = person.Black ? "blackSelect" : ""; + }
    @@ -507,7 +508,8 @@ @foreach (var person in @Model.Employees) { - + var black = person.Black ? "blackSelect" : ""; + }
    @@ -1782,13 +1784,25 @@ } $("#getPersonnel").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $("#getPersonneModal").select2({ language: "fa", dir: "rtl", - dropdownParent: $("#searchModal") + dropdownParent: $('#searchModal'), + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); // $(".date").mask("0000/00/00"); @@ -2205,14 +2219,13 @@ diff --git a/ServiceHost/Areas/Client/Pages/PaymentToPersonnelCreate.cshtml b/ServiceHost/Areas/Client/Pages/PaymentToPersonnelCreate.cshtml index 6010939b..456d4511 100644 --- a/ServiceHost/Areas/Client/Pages/PaymentToPersonnelCreate.cshtml +++ b/ServiceHost/Areas/Client/Pages/PaymentToPersonnelCreate.cshtml @@ -108,7 +108,14 @@ $(".select2Option").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + //dropdownParent: $('#MainModal'), + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); }); @@ -143,7 +150,8 @@ var employees = response.employees.connectedPersonnelViewModels; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ''; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); }, diff --git a/ServiceHost/Areas/Client/Pages/Shared/_headerAndFooter.cshtml b/ServiceHost/Areas/Client/Pages/Shared/_headerAndFooter.cshtml index a97cbd07..bd1e7c9c 100644 --- a/ServiceHost/Areas/Client/Pages/Shared/_headerAndFooter.cshtml +++ b/ServiceHost/Areas/Client/Pages/Shared/_headerAndFooter.cshtml @@ -218,24 +218,27 @@
    -
    + - *@ @*
    diff --git a/ServiceHost/wwwroot/AssetsClient/css/select2.css b/ServiceHost/wwwroot/AssetsClient/css/select2.css index 72335795..89f1c14e 100644 --- a/ServiceHost/wwwroot/AssetsClient/css/select2.css +++ b/ServiceHost/wwwroot/AssetsClient/css/select2.css @@ -1,3 +1,7 @@ +.blackSelect { + background-color: #cbd5e1; +} + .select2-dropdown { border: 1px solid #DADADA; border-radius: 0 0 7px 7px !important; diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Checkouts/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Checkouts/js/Index.js index 62959bcc..710a1c70 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Checkouts/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Checkouts/js/Index.js @@ -144,7 +144,7 @@ $(document).ready(function () { var filterStart = $('#start').val(); var filterEnd = $('#end').val(); - if (filterEmployeeId !== 0 || filterYear !== '' || filterMonth !== '' || filterStart !== '' || filterEnd !== '') { + if (filterEmployeeId !== "0" || filterYear !== '' || filterMonth !== '' || filterStart !== '' || filterEnd !== '') { $('.btn-clear-filter').removeClass('disable'); } else { $('.btn-clear-filter').addClass('disable'); @@ -1129,13 +1129,25 @@ $("#overlaySearchAdvance").click(function () { } $("#getPersonnel").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $("#getPersonneModal").select2({ language: "fa", dir: "rtl", - dropdownParent: $("#searchModal") + dropdownParent: $('#searchModal'), + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); // $(".date").mask("0000/00/00"); @@ -1559,14 +1571,13 @@ $(window).scroll(function () { function printOne(id) { var parametr = '&id=' + id; var url = PrintOneUrl; - window.location.href = url + parametr; - + AjaxUrlContentModal(url + parametr); } + function printOneMobile(id) { var parametr = '&id=' + id; var url = PrintOneMobileUrl; - window.location.href = url + parametr; - + AjaxUrlContentModal(url + parametr); } function printAll() { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutTemporary.js b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutTemporary.js index b2f9e9c9..6dc702e4 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutTemporary.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutTemporary.js @@ -79,7 +79,13 @@ $(document).ready(function () { $(".select2Option").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionMobile").select2({ @@ -1692,35 +1698,6 @@ function showExcelAllModal() { function downloadExcelAll() { var idlist = ""; - var year = $('#Year').val(); - var month = $('#Month').val(); - - - if (year === '0' || month === '0') { - $('#dropdown-year').addClass("errored"); - $('#dropdown-month').addClass("errored"); - $('.alert-msg').show(); - $('.alert-msg p').text('لطفا سال و ماه را انتخاب نموده و جستجو نمایید'); - setTimeout(function () { - $('.alert-msg').hide(); - $('.alert-msg p').text(''); - $('#dropdown-year').removeClass("errored"); - $('#dropdown-month').removeClass("errored"); - }, 3500); - return - } - - if (!($('input:checkbox').is(":checked"))) { - $('.alert-msg').show(); - $('.alert-msg p').text('هیچ موردی انتخاب نشده است.'); - setTimeout(function () { - $('.alert-msg').hide(); - $('.alert-msg p').text(''); - }, 3500); - return - } - - $('.foo').each(function () { if ($(this).is(":checked")) { @@ -1829,7 +1806,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#getPersonnel').html(employeeOptionsHtml); $('#getPersonnelMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutUnofficial.js b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutUnofficial.js index d2446bc4..7071be0f 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutUnofficial.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/CheckoutUnofficial.js @@ -1236,7 +1236,13 @@ $(document).ready(function () { $(".select2Option").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionMobile").select2({ @@ -1674,36 +1680,8 @@ function showExcelAllModal() { window.location.href = showCheckoutExcelModalUrl; } -function excelDownloadAll() { +function downloadExcelAll() { var idlist = ""; - var year = $('#Year').val(); - var month = $('#Month').val(); - - - if (year === '0' || month === '0') { - $('#dropdown-year').addClass("errored"); - $('#dropdown-month').addClass("errored"); - $('.alert-msg').show(); - $('.alert-msg p').text('لطفا سال و ماه را انتخاب نموده و جستجو نمایید'); - setTimeout(function () { - $('.alert-msg').hide(); - $('.alert-msg p').text(''); - $('#dropdown-year').removeClass("errored"); - $('#dropdown-month').removeClass("errored"); - }, 3500); - return - } - - if (!($('input:checkbox').is(":checked"))) { - $('.alert-msg').show(); - $('.alert-msg p').text('هیچ موردی انتخاب نشده است.'); - setTimeout(function () { - $('.alert-msg').hide(); - $('.alert-msg p').text(''); - }, 3500); - return - } - $('.foo').each(function () { if ($(this).is(":checked")) { @@ -1714,47 +1692,22 @@ function excelDownloadAll() { } }); + var filterArray = []; + $("input[name='filter[]']:checked").each(function () { + filterArray.push($(this).val()); + }); + + if (idlist !== "") { + //var url = CheckoutExcelAllUrl + "&idList=" + idlist; + var url = CheckoutExcelAllUrl + "&idList=" + encodeURIComponent(idlist); - - var yearFa = '&yearFa=' + year; - var monthFa = '&monthFa=' + month; - var url = CheckoutExcelAllUrl + '&idlist=' + idlist; - - - //console.log(url + '?checkoutId=' + idlist + yearFa + monthFa); + filterArray.forEach(function (filter) { + url += "&filter=" + encodeURIComponent(filter); + }); window.open(url, "_blank"); - } } -//function downloadExcelAll() { -// var idlist = ""; -// $('.foo').each(function () { -// if ($(this).is(":checked")) { - -// var a = $(this).val(); -// var b = a + "+"; -// idlist += b; - -// } -// }); - -// var filterArray = []; -// $("input[name='filter[]']:checked").each(function () { -// filterArray.push($(this).val()); -// }); - - -// if (idlist !== "") { -// //var url = CheckoutExcelAllUrl + "&idList=" + idlist; -// var url = CheckoutExcelAllUrl + "&idList=" + encodeURIComponent(idlist); - -// filterArray.forEach(function (filter) { -// url += "&filter=" + encodeURIComponent(filter); -// }); -// window.open(url, "_blank"); -// } -//} function printAllMobile() { var idlist = ""; @@ -1824,7 +1777,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#getPersonnel').html(employeeOptionsHtml); $('#getPersonnelMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/ModalCreateLeftWorkEmployee.js b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/ModalCreateLeftWorkEmployee.js index 42762c6c..d304d52a 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/ModalCreateLeftWorkEmployee.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/ModalCreateLeftWorkEmployee.js @@ -190,7 +190,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); } else { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js index fb4bfdc3..53202cb3 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js @@ -629,12 +629,11 @@ function ajaxPersonals() { success: function (response) { $('#cardSectionLeave').addClass('blur'); $("#cardSectionLeave div *").prop('disabled', true); - var employees = response.connectedPersonnel.connectedPersonnelViewModels; - + var employees = response.data; var employeeOptionsHtml = ''; - employees.forEach(function (employee) { - var black = employee.black ? "blackSelect" : ""; - employeeOptionsHtml += ``; + employees.forEach(function (employee) { + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectList').html(employeeOptionsHtml); }, diff --git a/ServiceHost/wwwroot/AssetsClient/pages/EmployeesBankInfo/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/EmployeesBankInfo/js/Index.js index e42c7bee..3c2ab797 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/EmployeesBankInfo/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/EmployeesBankInfo/js/Index.js @@ -25,7 +25,13 @@ $(document).ready(function () { $(".select2OptionIndex").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionIndexMobile").select2({ @@ -283,7 +289,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectIndex').html(employeeOptionsHtml); $('#employeeSelectIndexMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js index afa7106a..c709db9e 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/Index.js @@ -14,7 +14,13 @@ $(document).ready(function () { $(".select2OptionIndex").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionIndexMobile").select2({ @@ -252,7 +258,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectIndex').html(employeeOptionsHtml); $('#employeeSelectIndexMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/ModalCreateNewFine.js b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/ModalCreateNewFine.js index c0c6a772..e9ce8af4 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/ModalCreateNewFine.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Fine/js/ModalCreateNewFine.js @@ -1,5 +1,36 @@ var urlPathname = location.pathname; +document.querySelectorAll('.scroll-container-amount').forEach(container => { + let isDown = false; + let startX; + let scrollLeft; + + container.addEventListener('mousedown', (e) => { + isDown = true; + startX = e.pageX - container.offsetLeft; + scrollLeft = container.scrollLeft; + container.style.cursor = "grabbing"; + }); + + container.addEventListener('mouseleave', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mouseup', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mousemove', (e) => { + if (!isDown) return; + e.preventDefault(); + const x = e.pageX - container.offsetLeft; + const walk = (x - startX) * 2; + container.scrollLeft = scrollLeft - walk; + }); +}); + $(document).ready(function () { $('.loading').hide(); @@ -94,7 +125,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); } else { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js b/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js index a8a2e2e8..0165e540 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js @@ -726,7 +726,7 @@ function ajaxPersonals() { var employeeOptionsHtml = ''; employees.forEach(function (employee) { var black = employee.black ? "blackSelect" : ""; - employeeOptionsHtml += ``; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); }, diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js index 7bbfec61..850e1b01 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/Index.js @@ -13,7 +13,13 @@ $(document).ready(function () { $(".select2OptionIndex").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionIndexMobile").select2({ @@ -256,7 +262,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectIndex').html(employeeOptionsHtml); $('#employeeSelectIndexMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js index b78ddf41..39c64a6b 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Loan/js/ModalCreateNewLoan.js @@ -126,7 +126,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); } else { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js index e98820b1..67d45171 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/Index.js @@ -15,7 +15,13 @@ $(document).ready(function () { $(".select2OptionIndex").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionIndexMobile").select2({ @@ -260,7 +266,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectIndex').html(employeeOptionsHtml); $('#employeeSelectIndexMobile').html(employeeOptionsHtml); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/ModalCreateNewReward.js b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/ModalCreateNewReward.js index 5c29ab7b..c70bc822 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/ModalCreateNewReward.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Reward/js/ModalCreateNewReward.js @@ -1,5 +1,36 @@ var urlPathname = location.pathname; +document.querySelectorAll('.scroll-container-amount').forEach(container => { + let isDown = false; + let startX; + let scrollLeft; + + container.addEventListener('mousedown', (e) => { + isDown = true; + startX = e.pageX - container.offsetLeft; + scrollLeft = container.scrollLeft; + container.style.cursor = "grabbing"; + }); + + container.addEventListener('mouseleave', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mouseup', () => { + isDown = false; + container.style.cursor = "grab"; + }); + + container.addEventListener('mousemove', (e) => { + if (!isDown) return; + e.preventDefault(); + const x = e.pageX - container.offsetLeft; + const walk = (x - startX) * 2; + container.scrollLeft = scrollLeft - walk; + }); +}); + $(document).ready(function () { $('.loading').hide(); @@ -89,7 +120,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); } else { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js index e6d94e51..d118fa7e 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/Index.js @@ -15,7 +15,13 @@ $(document).ready(function () { $(".select2OptionIndex").select2({ language: "fa", - dir: "rtl" + dir: "rtl", + templateResult: function (data, container) { + if (data.element) { + $(container).addClass($(data.element).attr("class")); + } + return data.text; + } }); $(".select2OptionIndexMobile").select2({ @@ -179,6 +185,27 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function return; } + if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) { + if (isMobile) { + $('#start-date-mobile').addClass("errored"); + $('#end-date-mobile').addClass("errored"); + } else { + $('#start-date').addClass("errored"); + $('#end-date').addClass("errored"); + $('.select2.select2-container .select2-selection').addClass("errored"); + } + + $('.alert-msg').show(); + $('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید'); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(''); + $('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored"); + + }, 3500); + return; + } + $('.btn-clear-filter').removeClass('disable'); if (searchName.val() === "0" && searchStartDateTime === "" && searchEndDateTime === "") { $('.btn-clear-filter').addClass('disable'); @@ -259,7 +286,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelectIndex').html(employeeOptionsHtml); $('#employeeSelectIndexMobile').html(employeeOptionsHtml); @@ -557,7 +585,8 @@ function htmlLoadWithEmployeeDataByDate(loadSalaryAidListData) { if (loadSalaryAidListData.length > 0) { loadSalaryAidListData.forEach(function (itemSalaryAids) { n = 1; - html += `
    + //
    + html += `
    @@ -689,7 +718,7 @@ function htmlLoadWithEmployeeDataByDate(loadSalaryAidListData) { }); - html += `
    ` + html += `
    `; html += `
    diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js index 89063877..2bfd9a13 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js @@ -120,7 +120,8 @@ function ajaxPersonals() { var employees = response.data; var employeeOptionsHtml = ''; employees.forEach(function (employee) { - employeeOptionsHtml += ``; + var black = employee.black ? "blackSelect" : ""; + employeeOptionsHtml += ``; }); $('#employeeSelect').html(employeeOptionsHtml); } else { From 9eb9c0d49ae730c845c695b6ca5d5effd714c20b Mon Sep 17 00:00:00 2001 From: MahanCh Date: Wed, 16 Apr 2025 20:05:21 +0330 Subject: [PATCH 11/12] fix bugs for employees select list --- .../IRollCallEmployeeStatusRepository.cs | 1 - .../RollCallEmployeeStatusApplication.cs | 4 ---- .../Company/Workshop/ContractCheckoutYearlyStatus.cshtml | 2 +- .../wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs index a853cc67..ed2db0ec 100644 --- a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs +++ b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs @@ -15,7 +15,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg /// /// void AdjustRollCallStatusEndDates(List command); - bool IsActiveInPeriod(long employeeId, long workshopId, DateTime start, DateTime end); /// /// دریافت وضعیت حضور غیاب پرسنل در تاریخ مشخص diff --git a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs index 7046b585..b9662278 100644 --- a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs @@ -169,9 +169,5 @@ namespace CompanyManagment.Application { return _employeeRollCallStatusRepository.GetAll(); } - public bool IsActiveInPeriod(long employeeId, long workshopId, DateTime startDate, DateTime endDate) - { - return _employeeRollCallStatusRepository.IsActiveInPeriod(employeeId, workshopId, startDate, endDate); - } } } diff --git a/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml b/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml index 5650eceb..1666fa7e 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Workshop/ContractCheckoutYearlyStatus.cshtml @@ -51,7 +51,7 @@