diff --git a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs index 29f9346c..1918c115 100644 --- a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs +++ b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs @@ -28,6 +28,8 @@ public class CreateEmployeeByClient public List EmployeeDocumentItems { get; set; } public bool HasEmployeeDocument { get; set; } public bool HasRollCallService { get; set; } + public bool CanceledAuthorize { get; set; } + public string BirthDate { get; set; } } diff --git a/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs b/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs index 3e4c10e6..4f6dce73 100644 --- a/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs +++ b/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs @@ -17,6 +17,7 @@ public record EmployeeByNationalCodeInWorkshopViewModel public long PersonnelCode { get; set; } public List EmployeeBankInfos { get; set; } public EmployeeByNationalCodeEmployeeDocumentViewModel EmployeeDocument { get; set; } + public bool AuthorizedCanceled { get; set; } } diff --git a/CompanyManagment.Application/EmployeeAplication.cs b/CompanyManagment.Application/EmployeeAplication.cs index 466acf36..5842c8eb 100644 --- a/CompanyManagment.Application/EmployeeAplication.cs +++ b/CompanyManagment.Application/EmployeeAplication.cs @@ -996,10 +996,24 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli //{ // return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد"); //} + var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode); + var workshop = _WorkShopRepository.GetDetails(command.WorkshopId); - if (employee == null) + + if (employee == null && command.CanceledAuthorize) + { + var birthDate = command.BirthDate.ToGeorgianDateTime(); + var dateOfIssue = new DateTime(1922, 1, 1); + + employee = new Employee(command.FirstName, command.LastName, null, birthDate, + dateOfIssue, null, command.NationalCode, null, command.Gender, "ایرانی", null, null); + _EmployeeRepository.Create(employee); + _EmployeeRepository.SaveChanges(); + + } + if (employee == null) { return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید"); } @@ -1242,6 +1256,11 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli if (employee == null) { var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate); + + if (personalInfo.ResponseContext.Status.Code == 14) + { + return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",new EmployeeByNationalCodeInWorkshopViewModel(){AuthorizedCanceled = true}); + } if (personalInfo.ResponseContext.Status.Code != 0) { return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند"); diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/CreateEmployeeForm.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/CreateEmployeeForm.cshtml index 2d64b133..b5ee87c4 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/CreateEmployeeForm.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/CreateEmployeeForm.cshtml @@ -33,8 +33,8 @@ -
-
+
+
@@ -45,7 +45,7 @@
-
+
@@ -70,8 +70,8 @@
-
-
+
+
@@ -89,7 +89,7 @@
-
+
@@ -111,28 +111,28 @@
-
+
نام پرسنل
-
+
نام خانوادگی پرسنل
-
+
تاریخ شروع بکار
-
+
انتخاب سمت
@@ -142,7 +142,7 @@
- +
-
- - -
-
- تاریخ تولد را وارد کنید -
+
+ + +
+
+ تاریخ تولد را وارد کنید +
+
+ +
+ + +
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs index 062d22e6..3797af95 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs @@ -381,7 +381,6 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall } } - result = _rollCallEmployeeApplication.UploadedImage(employeeId, workshopId); if (result.IsSuccedded == false) { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/CreateEmployeeForm.js b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/CreateEmployeeForm.js index 15fea561..6b0662fe 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/CreateEmployeeForm.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/CreateEmployeeForm.js @@ -5,7 +5,7 @@ $(document).ready(function () { language: "fa", dir: "rtl" }); - var jobsLoadAjaxURL = ''; + var jobsLoadAjaxURL = ''; if (currentUrl.includes("/Client#showmodal=/Client?handler=CreateEmployee")) { jobsLoadAjaxURL = jobsLoadHomeAjaxUrl; } else if (currentUrl.includes("/Client/Company/Employees/EmployeeList")) { @@ -76,7 +76,7 @@ function checkInputs() { const startWork = $("#startWork").val().trim(); const startWorkIsValidDate = /^\d{4}[-\/]\d{2}[-\/]\d{2}$/.test(startWork); const semat = $("#sematSelect").val(); - + debugger; let isEmpty = false; if (!genderSelected || !maritalStatusSelected || !nationality || !fName || !lName || !startWork || !startWorkIsValidDate || semat === "0") { @@ -88,7 +88,18 @@ function checkInputs() { validateField(".validMariage", "لطفا وضعیت تاهل را مشخص کنید."); return false; } - + if (!$("input[name='Command.Gender']:checked").val()) { + validateField(".validGender", "لطفا جنسیت را مشخص کنید."); + return false; + } + if (fName === "") { + validateField("#firstName", "لطفا نام پرسنل را وارد کنید."); + return false; + } + if (lName === "") { + validateField("#lastName", "لطفا نام خانوادگی پرسنل را وارد کنید."); + return false; + } if (startWork === "") { validateField("#startWork", "لطفا تاریخ شروع بکار را مشخص کنید"); return false; diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/IdentityInformationModal.js b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/IdentityInformationModal.js index 6efa24cd..b4d86a95 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/IdentityInformationModal.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/IdentityInformationModal.js @@ -44,6 +44,8 @@ $(document).ready(function () { lastNationalCode = ""; } }); + + }); function checkNationalCodeAndBirthday() { @@ -82,7 +84,7 @@ function checkNationalCode(nationalCode, birthDate) { $("#IdentityLoading").show(); $.ajax({ - async: false, + //async: false, url: checkNationalUrl, method: "GET", data: { nationalCode: nationalCode, birthDate: birthDate }, @@ -180,7 +182,24 @@ function checkNationalCode(nationalCode, birthDate) { $("#IdentityLoading").hide(); } - } else { + } + else if (response.data.authorizedCanceled) { + $(".checkByHistoryCode2").removeClass("disable"); + $("#AuthorizedCanceled").removeClass("disable"); + + $("#canceledAuthorizedStep2").prop("checked", true); + $("#canceledAuthorizedStep2").val("true"); + + $('.alert-msg').show(); + $('.alert-msg p').text(response.message); + setTimeout(function () { + $('.alert-msg').hide(); + $('.alert-msg p').text(response.message); + }, 3500); + $("#IdentityLoading").hide(); + + } + else { //$(".saveData").prop("disabled", true); $(".checkByNationalCode").each(function () { $(this).addClass("disable"); @@ -213,4 +232,48 @@ function checkNationalCode(nationalCode, birthDate) { goToStep2 = false; } }); -} \ No newline at end of file + $('#authorizedCheckboxInput').change(function () { + if ($(this).is(':checked')) { + + let nationalCode = $("#nationalCode").val().trim(); + let birthDate = $("#birthDate").val().trim(); + + if (nationalCode === "") { + validateField("#nationalCode", "لطفا شماره ملی پرسنل را وارد کنید."); + $("#authorizedCheckboxInput").prop("checked", false); + return; + } else if (!/^\d{10}$/.test(nationalCode)) { + validateField("#nationalCode", "شماره ملی باید ۱۰ رقم باشد."); + $("#authorizedCheckboxInput").prop("checked", false); + return; + } + + if (birthDate === "") { + validateField("#birthDate", "لطفا تاریخ تولد پرسنل را وارد کنید."); + $("#authorizedCheckboxInput").prop("checked", false); + return; + } else if (!/^\d{4}[-\/]\d{2}[-\/]\d{2}$/.test(birthDate) || birthDate.length !== 10) { + validateField("#birthDate", "تاریخ تولد را به درستی وارد کنید."); + $("#authorizedCheckboxInput").prop("checked", false); + return; + } + + $("#nationalCodeS2Section").removeClass("disable"); + $("#birthDateS2Section").removeClass("disable"); + $("#genderS2Section").removeClass("disable"); + $("#marriageS2Section").removeClass("disable"); + $("#nameS2Section").removeClass("disable"); + $("#fNameS2Section").removeClass("disable"); + $("#startworkS2Section").removeClass("disable"); + $("#jobS2Section").removeClass("disable"); + + $("#nationalCodeStep2").val(nationalCode); + $("#birthDateStep2").val(birthDate); + + goToStep2 = true; + + $("#nextStep1").click(); + } + }); +} +