From 5d16823a28962955f032335abbbf472334b7440f Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 16 Sep 2024 23:33:13 +0330 Subject: [PATCH] rollcall change - workshop vipservice ui added --- .../RollCallService/CreateRollCallService.cs | 1 + .../RollCallServiceViewModel.cs | 2 +- .../Workshop/CreateWorkshop.cs | 5 + .../Repository/RollCallEmployeeRepository.cs | 4 +- .../Company/Workshops/CreateWorkshop.cshtml | 3938 +++++++-------- .../Workshops/CreateWorkshop.cshtml.cs | 348 +- .../Company/Workshops/EditWorkshop.cshtml | 4481 +++++++++-------- .../Company/Workshops/EditWorkshop.cshtml.cs | 349 +- .../_CreateForms/FormPermissionAccount.cshtml | 378 ++ .../_EditForms/FormPermissionAccount.cshtml | 412 ++ ServiceHost/ServiceHost.csproj | 2 + 11 files changed, 5435 insertions(+), 4485 deletions(-) create mode 100644 ServiceHost/Areas/Admin/Pages/Company/Workshops/_CreateForms/FormPermissionAccount.cshtml create mode 100644 ServiceHost/Areas/Admin/Pages/Company/Workshops/_EditForms/FormPermissionAccount.cshtml diff --git a/CompanyManagment.App.Contracts/RollCallService/CreateRollCallService.cs b/CompanyManagment.App.Contracts/RollCallService/CreateRollCallService.cs index 6948cf7b..baf90295 100644 --- a/CompanyManagment.App.Contracts/RollCallService/CreateRollCallService.cs +++ b/CompanyManagment.App.Contracts/RollCallService/CreateRollCallService.cs @@ -21,4 +21,5 @@ public class CreateRollCallService public string AmountFa { get; set; } public string Duration { get; set; } public string FullName { get; set; } + public int AddPersonValid { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/RollCallService/RollCallServiceViewModel.cs b/CompanyManagment.App.Contracts/RollCallService/RollCallServiceViewModel.cs index 5d908b32..023e721f 100644 --- a/CompanyManagment.App.Contracts/RollCallService/RollCallServiceViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCallService/RollCallServiceViewModel.cs @@ -2,5 +2,5 @@ public class RollCallServiceViewModel : EditRollCallService { - + public string EndServiceToFarsiDuration { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs index b8565253..be850243 100644 --- a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs +++ b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs @@ -72,5 +72,10 @@ public class CreateWorkshop public SelectList InsuranceJobViewModels { get; set; } public List PermissionIds { get; set; } public long CurrentAccoutRoleId { get; set; } + #region Vafa + public List InAccountIdsList { get; set; } + public string HasRollCallFreeVip { get; set; } + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs index b243830a..ce1c9a09 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs @@ -152,8 +152,8 @@ public class RollCallEmployeeRepository : RepositoryBase join = contractLeftWork.Concat(insuranceLeftWork).ToList(); } - if (joinEqualList.Count == 0) - return join; + //if (joinEqualList.Count == 0) + // return join; join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList(); diff --git a/ServiceHost/Areas/Admin/Pages/Company/Workshops/CreateWorkshop.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Workshops/CreateWorkshop.cshtml index e8437bbf..37dec7f6 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Workshops/CreateWorkshop.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Workshops/CreateWorkshop.cshtml @@ -1,9 +1,9 @@ @page @model ServiceHost.Areas.Admin.Pages.Company.Workshops.CreateWorkshopModel @{ - + - @*select2 css start*@ - @*select2 css start*@ - + .handle-title a:hover { + color: #ffffff !important; + } + }
-
+
-
-
-
-

ویرایش اطلاعات کارگاه

- - بازگشت - -
-
+
+
+
+

ویرایش اطلاعات کارگاه

+ + بازگشت + +
+
-
+ - + -
-
+
+
- + -
+
-
-
- -
-
- - -
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
-
- - - -
-
-
-
- - - - -
-
-
-
- @*
+
+
+ +
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + + +
+
+
+
+ + + + +
+
+
+
+ @* *@ -
- - - - -
- -
-
-
-
- - -
-
- -
-
-

- شما مجوز دسترسی به این بخش را ندارید. -

-
-
- +
+
+ + +
+
+ +
+
+

+ شما مجوز دسترسی به این بخش را ندارید. +

+
+
+ + - - - - - -
+
+ +
- + - - + + -
+
-
- +
+ -
-
+
+
@@ -1124,1548 +1176,1641 @@ \ No newline at end of file + $(window).on("load", part2()); + + function part2() { + + $(".date").mask("0000/00/00"); + $('.phoneInput').on("input", + function () { + this.value = this.value.replace(/[^\d]/, ''); + }); + $('.jobSalaryStr').on('input', + function () { + let selfGroupNo = $(this).attr("jobSalary-groupNo"); + this.value = this.value.replace(/[^\d]/, ''); + var contractAmount = $(this); + $(this).removeClass('errored'); + + let baseSalary = $('input[baseSalary-groupNo=' + selfGroupNo + ']').val(); + let b = baseSalary.replace(/,/g, ''); + let baseSalaryNumber = parseFloat(b); + //setting format + numeral.defaultFormat("0,0 تومان"); + contractAmount.on("keyup", + function (e) { + contractAmount.val(numeral(contractAmount.val()).format()); + let jobSalary = $(this).val(); + let j = jobSalary.replace(/,/g, ''); + let jobSalaryNumber = parseFloat(j); + let sum = jobSalaryNumber + baseSalaryNumber; + $('input[mabna-groupNo=' + selfGroupNo + ']').val(numeral(sum).format()); + }); + }); + $('.baseSalaryStr').on('input', + function () { + + let selfGroupNo = $(this).attr("baseSalary-groupNo"); + this.value = this.value.replace(/[^\d]/, ''); + var baseSalaryAmount = $(this); + let jobSalary = $('input[jobSalary-groupNo=' + selfGroupNo + ']').val(); + let j = jobSalary.replace(/,/g, ''); + let jobSalaryNumber = parseFloat(j); + + + $(this).removeClass('errored'); + //setting format + numeral.defaultFormat("0,0 تومان"); + baseSalaryAmount.on("keyup", + function (e) { + baseSalaryAmount.val(numeral(baseSalaryAmount.val()).format()); + let baseSalary = $(this).val(); + let b = baseSalary.replace(/,/g, ''); + let baseSalaryNumber = parseFloat(b); + let sum = jobSalaryNumber + baseSalaryNumber; + $('input[mabna-groupNo=' + selfGroupNo + ']').val(numeral(sum).format()); + + }); + }); + $('.annualSalaryStr').on('input', + function () { + this.value = this.value.replace(/[^\d]/, ''); + var contractAmount = $(this); + $(this).removeClass('errored'); + //setting format + numeral.defaultFormat("0,0 تومان"); + contractAmount.on("keyup", + function (e) { + contractAmount.val(numeral(contractAmount.val()).format()); + }); + }); + // هنگام ورود مقدار به فیلد start + $('.date').on('input', + function () { + let startDate = this.value; + if (startDate.length == 10) { + let submitcheck = dateValidcheck(this); + if (submitcheck) { + + $(this).removeClass('errored'); + } else { + $(this).addClass('errored'); + } + + } + + + }); + + + $('#yes').on('change', + function () { + if ($(this).hasClass('active')) { + $('input[class="yes"]').attr("checked", true); + $('input[class="no"]').attr("checked", false); + $('#IsClassified').val(true); + $('.classifidedField1').removeClass("blured"); + $('.classifidedField2').removeClass("blured"); + // $("#next").css({ + // 'background-color': "white", + // 'color': '#1763b1' + // }); + + $(".addPerson").css({ + color: "rgb(51, 51, 51)" + }); + } + }); + + $('#no').on('change', + function () { + if ($(this).hasClass('active')) { + $('input[class="no"]').attr("checked", true); + $('input[class="yes"]').attr("checked", false); + $('#IsClassified').val(false); + $('.classifidedField1').addClass("blured"); + $('.classifidedField2').addClass("blured"); + // $("#next").css({ + // 'background-color': "#c7c0c0ba", + // 'color': '#000000b8', + // 'box-shadow': 'none' + // }); + $(".addPerson").css({ + color: "rgb(170, 170, 170)" + }); + } + }); + } + $(document).ready(function () { + + var aspValue = $("#asp-hidden").val(); + + if (aspValue != "") { + var checkbox = $('input.myCheckbox[value="' + aspValue + '"]'); + checkbox.prop("checked", true); + $('#myDiv').removeClass('disabled'); + $('#myDiv2').removeClass('disabled'); + $('#myDiv4').removeClass('disabled'); + + if($('.myCheckbox2').is(':checked')) { + $('#myDiv3').removeClass('disabled'); + } + } + + + + var aspValueContract = $("#asp-contract-hidden").val(); + if (aspValue != "" || aspValue != undefined) { + var checkspan = $('span.contractDuration[text="' + aspValueContract + '"]'); + checkspan.addClass("contActive"); + } + + if (PermissionWorkshopInfo == "True") { + let state = document.getElementById('state').value; + let city = document.getElementById('hide3').value; + iranwebsv(state); + $(`#city option:contains("${city}")`).attr("selected", true); + } + + + + + var allInputsFilled = true; + var selectElement = $('.EmployerIdList .select-city'); + var selectedOption = selectElement.find('option:selected'); + var selectedText = selectedOption.text(); + + selectElement.on('change', function () { + if (selectedText !== "") { + allInputsFilled = false; + $('.EmployerIdList .select2-container').addClass('errored'); + } else { + $('.EmployerIdList .select2-container').removeClass('errored'); + allInputsFilled = true; + } + }) + + + + //برای مشخص کردن مراحلی که انجام داده یا خیر + if ($(".notEmptyWorkshop").val() !== '') { + $('#success-icon1').show(); + $('#form1Tab').addClass('completed'); + } + // if ($("#ContrcatOrColleague").val() !== '') { + // $('#success-icon2').show(); + // $('#form2Tab').addClass('completed'); + // } + $('#success-iconPermissionAccount').show(); + $('#formPermissionAccountTab').addClass('completed'); + + if ($(".sendList2").is(':checked') && $(".sendList3").is(':checked') && $(".sendList4").is(':checked')) { + $('#success-icon2').show(); + $('#form2Tab').addClass('completed'); + } + if ($(".myCheckbox").is(':checked')) { + $('#success-icon3').show(); + $('#form3Tab').addClass('completed'); + } + //برای مشخص کردن مراحلی که انجام داده یا خیر + + // امور قرارداد + if (PermissionContract == "True") { + $(".sendList2").on('change', function () { + if ($(".sendList2").is(':checked')) { + $("#radio2").removeClass('errored'); + allInputsFilled = true; + } else { + allInputsFilled = false; + $("#radio2").addClass('errored'); + return; + } + }) + $(".sendList3").on('change', function () { + if ($(".sendList3").is(':checked')) { + $("#radio3").removeClass('errored'); + allInputsFilled = true; + } else { + allInputsFilled = false; + $("#radio3").addClass('errored'); + return; + } + }) + $(".sendList4").on('change', function () { + if ($(".sendList4").is(':checked')) { + $("#radio4").removeClass('errored'); + allInputsFilled = true; + } else { + allInputsFilled = false; + $("#radio4").addClass('errored'); + return; + } + }) + } + // امور قرارداد + + $(".notEmptyWorkshop").on('change', function () { + if ($(".notEmptyWorkshop").val() === '') { + allInputsFilled = false; + $(".notEmptyWorkshop").addClass('errored'); + return; + } else { + $(".notEmptyWorkshop").removeClass('errored'); + allInputsFilled = true; + } + }) + + + + + /************ ولیدشن مربوط به استان، شهر و آدرس ***************/ + //نام استان + var selectElementState = $('#state.select-city'); + var selectedOptionState = selectElementState.find('option:selected'); + + //نام شهر + var selectCity = $('#city.select-city'); + var selectedCityOption = selectCity.find('option:selected'); + + $(document).on('change', selectElementState, function () { + $('.state').removeClass('errored'); + $('.city').removeClass('errored'); + allInputsFilled = true; + }) + + $(document).on('change', selectedCityOption, function () { + $('.state').removeClass('errored'); + $('.city').removeClass('errored'); + allInputsFilled = true; + }) + + $(".addressEmpty").on('keyup', function () { + var selectElementState = $('#state.select-city'); + var selectedOptionState = selectElementState.find('option:selected'); + + var selectCity = $('#city.select-city'); + var selectedCityOption = selectCity.find('option:selected'); + + if (selectedOptionState.val() !== '') { + $(this).removeClass('errored'); + $(".state").removeClass('errored'); + $(".city").removeClass('errored'); + allInputsFilled = true; + } + + if (selectedCityOption.val() !== '0') { + $(this).removeClass('errored'); + $(".state").removeClass('errored'); + $(".city").removeClass('errored'); + allInputsFilled = true; + } + }) + /************ ولیدشن مربوط به استان، شهر و آدرس ***************/ + + + + // $("#ContrcatOrColleague").on('change', function () { + // if ($(this).val() === '0') { + // allInputsFilled = false; + // $("#ContrcatOrColleague").addClass('errored'); + // return; + // } else { + // $(this).removeClass('errored'); + // $("#form2Tab a").removeClass('errored'); + // allInputsFilled = true; + // } + // }) + + + $(".notEmptyWorkshop").on('keyup', function () { + if ($(this).val() === '') { + allInputsFilled = false; + $('.EmployerIdList .select2-container').addClass('errored'); + $(".notEmptyWorkshop").addClass('errored'); + return; + } else { + $(".notEmptyWorkshop").removeClass('errored'); + $('.EmployerIdList .select2-container').removeClass('errored'); + allInputsFilled = true; + } + }) + + $(".notEmptyArchive ").on('keyup', function () { + if ($(this).val() === '') { + allInputsFilled = false; + $(".notEmptyArchive").addClass('errored'); + return; + } else { + $(".notEmptyArchive").removeClass('errored'); + allInputsFilled = true; + } + }) + + + $("#population").on('change', function () { + if ($(this).val() === '') { + allInputsFilled = false; + $("#population").addClass('errored'); + return; + } else { + $(this).removeClass('errored'); + allInputsFilled = true; + } + }) + + + $("#jobName").on('change', function () { + if ($(this).val() === null || $('#jobName').val() == '') { + $('#jobName').next('span').addClass('errored'); + allInputsFilled = false; + return; + } else { + $('#jobName').next('span').removeClass('errored'); + allInputsFilled = true; + } + }) + + + function checkBonus() { + const totalPayment = $("#totalPayment").prop("checked"); + if (totalPayment) { + $(".totalPayment").removeClass('bonusDeactive').addClass('bonusActive'); + + } else { + $(".totalPayment").addClass('bonusDeactive').removeClass('bonusActive'); + } + + } + + + contractDuration(); + checkContractDuration(); + checkBonus(); + + $(".EmployerIdList .select2-container").addClass('notEmpty '); + $('.activated').prop('checked', true); + + $(function () { + $('#edit-modal [data-parent-modal]').on('click', + function (e) { + e.preventDefault(); + e.stopPropagation(); + var parentModalId = $(this).data('parent-modal'); + $(parentModalId).modal('hide'); + }); + }); + $(function () { + $('.addNeighbor').on('click', + function (e) { + e.preventDefault(); + $('#edit-modal').modal('show'); + }); + }); + + $("#edit-modal").on('hidden.bs.modal', + function () { + $('body').addClass('modal-open'); + }); + + + + if(PermissionInsurance == "True") { + // امور بیمه ای + $('.sendList').click(function () { + if ($(this).is(':checked')) { + $('.sendList').not(this).prop('checked', false); + } + }); + + const myCheckbox = $('.myCheckbox'); + const myCheckbox2 = $('.myCheckbox2'); + const myDiv = $('#myDiv'); + const myDiv2 = $('#myDiv2'); + const myDiv3 = $('#myDiv3'); + const myDiv4 = $('#myDiv4'); + + myCheckbox.on('change', + function () { + // console.log($('#isLegal').val()) + if ($(this).is(':checked') && $('#isLegal').val() == "false") { + myDiv.removeClass('disabled'); + } else { + myDiv.addClass('disabled'); + } + }); + + myCheckbox.on('change', + function () { + if ($(this).is(':checked')) { + myDiv2.removeClass('disabled'); + } else { + myDiv2.addClass('disabled'); + } + }); + myCheckbox2.on('change', + function () { + if ($(this).is(':checked')) { + myDiv3.removeClass('disabled'); + } else { + myDiv3.addClass('disabled'); + $('#population').removeClass('errored'); + $('#jobName').next('span').removeClass('errored'); + } + }); + myCheckbox.on('change', + function () { + if ($(this).is(':checked')) { + myDiv4.removeClass('disabled'); + } else { + myDiv4.addClass('disabled'); + } + }); + $(".myCheckbox").on('change', + function () { + if ($(this).is(':checked')) { + $("#asp-hidden").val($(this).val()); + } else { + $("#asp-hidden").val(''); + $("#InsuranceCode").val(''); + } + }); + // امور بیمه ای + } + + // new jquery for steps + // $(document).ready(function () { + // var $tabs = $('.li-wizard'); + // var $forms = $('.custom-height .row'); + + // function showForm(index) { + // $forms.hide().eq(index).show(); + // $tabs.removeClass('active').eq(index).addClass('active'); + // } + + // function handleNavigation(step) { + // var currentIndex = $tabs.filter('.active').index(); + // var newIndex = currentIndex + step; + + // if (newIndex >= 0 && newIndex < $tabs.length && !$tabs.eq(newIndex).hasClass('disable')) { + // showForm(newIndex); + // } + // } + + // $('#next').on('click', function () { + // handleNavigation(1); + // }); + + // $('#pre').on('click', function () { + // handleNavigation(-1); + // }); + + // $tabs.on('click', function () { + // var index = $(this).index(); + // showForm(index); + // }); + + // showForm(0); + // }); + + + $("#pre").css({ 'box-shadow': 'none' }); + $("#next").click(function () { + allInputsFilled = true; + + if (PermissionWorkshopInfo == "True") { + selectElement = $('.EmployerIdList .select-city'); + selectedOption = selectElement.find('option:selected'); + selectedText = selectedOption.text(); + + if (selectedText === "") { + allInputsFilled = false; + $('.EmployerIdList .select2-container').addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا موارد اجباری را تکمیل کنید."); + $('#save').show(); + $('#fakeSave').hide(); + return; + } else { + $('.EmployerIdList .select2-container').removeClass('errored'); + allInputsFilled = true; + } + + if ($(".notEmptyWorkshop").val() === '') { + allInputsFilled = false; + $(".notEmptyWorkshop").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا موارد اجباری را تکمیل کنید."); + $('#save').show(); + $('#fakeSave').hide(); + return; + } else { + $(".notEmptyWorkshop").removeClass('errored'); + allInputsFilled = true; + } + + + if ($(".notEmptyArchive").val() === '') { + allInputsFilled = false; + $(".notEmptyArchive").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا موارد اجباری را تکمیل کنید."); + $('#save').show(); + $('#fakeSave').hide(); + return; + } else { + $(".notEmptyArchive").removeClass('errored'); + allInputsFilled = true; + } + + + + + /************ ولیدشن مربوط به استان، شهر و آدرس ***************/ + //نام استان + var selectElementState = $('#state.select-city'); + var selectedOptionState = selectElementState.find('option:selected'); + + //نام شهر + var selectCity = $('#city.select-city'); + var selectedCityOption = selectCity.find('option:selected'); + + + if ($(".addressEmpty").val() !== '') { + if (selectedOptionState.val() === '' && (selectedCityOption.val() === '' || selectedCityOption.val() === undefined)) { + allInputsFilled = false; + $(".state").addClass('errored'); + $(".city").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نام استان و شهر را وارد نمائید."); + return; + } + if (selectedCityOption.val() === '0') { + $(".city").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نام شهر را وارد نمائید."); + allInputsFilled = false; + return; + } + } else { + $(".state").removeClass('errored'); + $(".city").removeClass('errored'); + allInputsFilled = true; + } + + if (selectedOptionState.val() !== '') { + if (selectedCityOption.val() === '0') { + $(".city").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نام شهر را وارد نمائید."); + allInputsFilled = false; + return; + } else { + $(".city").removeClass('errored'); + allInputsFilled = true; + } + if ($(".addressEmpty").val() === '') { + allInputsFilled = false; + $(".addressEmpty").addClass('errored'); + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا آدرس را وارد نمائید."); + return; + } else { + $(".addressEmpty").removeClass('errored'); + allInputsFilled = true; + } + } else { + $(".addressEmpty").removeClass('errored'); + $(".city").removeClass('errored'); + allInputsFilled = true; + } + /************ ولیدشن مربوط به استان، شهر و آدرس ***************/ + } + + + + + //var criteria = [true, false]; + //var hasError=false; + //let found = containsAll(criteria,isLegalList); + //if(found){ + // $('#EmployerIdList').next('span').addClass('errored'); + // $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد"); + //} + //else + if (!allInputsFilled) { + $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا موارد اجباری را تکمیل کنید."); + } else { + + if ($('#form1').hasClass("activeTab")) { + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $('#form1Tab').removeClass('active').addClass('completed'); + $('#success-icon1').show(); + $('#formPermissionAccountTab').addClass('active'); + + $("#form1").hide(); + $("#formPermissionAccount").show(); + $("#form1").removeClass("activeTab"); + $("#formPermissionAccount").addClass("activeTab"); + $("#progress").css({ + 'width': '40%' + }); + + $("#myTab").animate({ scrollLeft: '-=160' }, 500); + } else if ($('#formPermissionAccount').hasClass("activeTab")) { + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff', + 'box-shadow': 'none' + }); + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $('#formPermissionAccountTab').removeClass('active').addClass('completed'); + $('#success-icon2').show(); + $('#form2Tab').addClass('active'); + + $("#formPermissionAccount").hide(); + + $("#progress").css({ + 'width': '60%', + 'border-top-right-radius': '7px' + }); + $("#form2").show(); + + $("#formPermissionAccount").removeClass("activeTab"); + $("#form2").addClass("activeTab"); + $("#myTab").animate({ scrollLeft: '-=160' }, 500); + + } else if ($('#form2').hasClass("activeTab")) { + + // if (PermissionContract == "True") { + // if ($(".sendList2").is(':checked')) { + // $("#radio2").removeClass('errored'); + // allInputsFilled = true; + // } else { + // allInputsFilled = false; + // $("#radio2").addClass('errored'); + // $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نوع محاسبه طلب مرخصی را مشخص نمائید."); + // $('#save').show(); + // $('#fakeSave').hide(); + // return; + // } + + // if ($(".sendList3").is(':checked')) { + // $("#radio3").removeClass('errored'); + // allInputsFilled = true; + // } else { + // allInputsFilled = false; + // $("#radio3").addClass('errored'); + // $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نوع محاسبه سنوات را مشخص نمائید."); + // $('#save').show(); + // $('#fakeSave').hide(); + // return; + // } + + // if ($(".sendList4").is(':checked')) { + // $("#radio4").removeClass('errored'); + // allInputsFilled = true; + // } else { + // allInputsFilled = false; + // $("#radio4").addClass('errored'); + // $.Notification.autoHideNotify('error', 'bottom right', 'پیام سیستم ', "لطفا نوع محاسبه عیدی و پاداش را مشخص نمائید."); + // $('#save').show(); + // $('#fakeSave').hide(); + // return; + // } + // } + + $("#next").css({ + 'background-color': "#c7c0c0ba", + 'color': '#000000b8', + 'box-shadow': 'none' + }); + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $('#form2Tab').removeClass('active').addClass('completed'); + $('#success-icon2').show(); + $('#form3Tab').addClass('active'); + + $("#form2").hide(); + + $("#form3").show(); + $("#form2").removeClass("activeTab"); + $("#form3").addClass("activeTab"); + $("#myTab").animate({ scrollLeft: '-=160' }, 500); + } else if ($('#form3').hasClass("activeTab")) { + + $("#next").css({ + 'background-color': "#c7c0c0ba", + 'color': '#000000b8', + 'box-shadow': 'none' + }); + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $('#form3Tab').removeClass('active').addClass('completed'); + $('#success-icon3').show(); + $('#form4Tab').addClass('active'); + + $("#form3").hide(); + + $("#form4").show(); + $("#form3").removeClass("activeTab"); + $("#form4").addClass("activeTab"); + $("#myTab").animate({ scrollLeft: '-=160' }, 500); + } else if ($('#form4').hasClass("activeTab") && $('input[class="yes"]').is(':checked')) { + //تا اینجا متوقف می شود، برای ادامه این کار میبایست این دستور را بردارید. + return + + $("#next").css({ + 'background-color': "#c7c0c0ba", + 'color': '#000000b8', + 'box-shadow': 'none' + }); + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + + $('#form4Tab').removeClass('active').addClass('completed'); + $('#success-icon4').show(); + $('#form4Tab').addClass('active'); + + $("#form4").hide(); + + $("#progress").css({ + 'width': '100%', + 'border-top-right-radius': '7px' + }); + $("#form5").show(); + + $("#form4").removeClass("activeTab"); + $("#form5").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '-=160' }, 500); + } + + } + }); + $("#pre").click(function () { + if (!$('#formPermissionAccount').hasClass("activeTab") && !$('#form2').hasClass("activeTab") && !$('#form3').hasClass("activeTab") && !$('#form4').hasClass("activeTab") && !$('#form5').hasClass("activeTab")) { + $("#pre").css({ + 'background-color': "#c7c0c0ba", + 'color': '#000000b8', + 'box-shadow': 'none' + }); + + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff' + }); + + } else if ($('#formPermissionAccount').hasClass("activeTab")) { + $("#pre").css({ + 'background-color': "#c7c0c0ba", + 'color': '#000000b8', + 'box-shadow': 'none' + }); + + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff' + }); + + $('#formPermissionAccountTab').removeClass('active'); + $('#form1Tab').addClass('active'); + + // $("#form2").css({ + // visibility: 'hidden' + // }); + $("#formPermissionAccount").hide(); + $("#progress").css({ + 'width': '20%', + 'border-top-right-radius': '0px' + }); + // $("#form1").css({ + // visibility: 'visible' + // }); + $("#form1").show(); + $("#formPermissionAccount").removeClass("activeTab"); + $("#form1").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '+=160' }, 500); + } else if ($('#form2').hasClass("activeTab")) { + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff' + }); + + $('#form2Tab').removeClass('active'); + $('#formPermissionAccountTab').addClass('active'); + + // $("#form2").css({ + // visibility: 'hidden' + // }); + $("#form2").hide(); + $("#progress").css({ + 'width': '20%', + 'border-top-right-radius': '0px' + }); + // $("#form1").css({ + // visibility: 'visible' + // }); + $("#formPermissionAccount").show(); + $("#form2").removeClass("activeTab"); + $("#formPermissionAccount").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '+=160' }, 500); + } else if ($('#form3').hasClass("activeTab")) { + + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff' + }); + + $('#form3Tab').removeClass('active'); + $('#form2Tab').addClass('active'); + + $("#form3").hide(); + $("#progress").css({ + 'width': '40%', + 'border-top-right-radius': '0px' + }); + $("#form2").show(); + $("#form3").removeClass("activeTab"); + $("#form2").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '+=160' }, 500); + } else if ($('#form4').hasClass("activeTab")) { + + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $("#next").css({ + 'background-color': "#84CC16", + 'color': '#ffffff' + }); + + $("#form4").hide(); + $("#progress").css({ + 'width': '60%', + 'border-top-right-radius': '0px' + }); + $('#form4Tab').removeClass('active'); + $('#form3Tab').addClass('active'); + $("#form3").show(); + $("#form4").removeClass("activeTab"); + $("#form3").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '+=160' }, 500); + } else if ($('#form5').hasClass("activeTab")) { + + $("#pre").css({ + 'background-color': "#323232", + 'color': '#ffffff', + 'box-shadow': '0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)' + }); + + $("#form5").hide(); + $("#progress").css({ + 'width': '80%', + 'border-top-right-radius': '0px' + }); + $("#form4").show(); + $("#form5").removeClass("activeTab"); + $("#form4").addClass("activeTab"); + + $("#myTab").animate({ scrollLeft: '+=160' }, 500); + } + + }); + getEmployer(@Model.Command.EmployerIdList[0]); + }); + + //مدت قرارداد + $(".contractDuration").on('click', + function () { + if (!$(this).hasClass('contActive')) { + $(".contractDuration").removeClass('contActive'); + $(this).removeClass('btn-deactive').addClass('contActive'); + } + contractDuration(); + }); + + function contractDuration() { + if ($(".contActive").text() == '1 ماهه') { + $("#asp-contract-hidden").val(1); + } else if ($(".contActive").text() == '2 ماهه') { + $("#asp-contract-hidden").val(2); + } else if ($(".contActive").text() == '3 ماهه') { + $("#asp-contract-hidden").val(3); + } else if ($(".contActive").text() == '6 ماهه') { + $("#asp-contract-hidden").val(6); + } else if ($(".contActive").text() == '1 ساله') { + $("#asp-contract-hidden").val(12); + } else if ($(".contActive").text() == 'دائمی') { + $("#asp-contract-hidden").val("ForEver"); + } + } + + function checkContractDuration() { + var aspValueContract = $("#asp-contract-hidden").val(); + if (aspValueContract != '' || aspValueContract != undefined) { + if (aspValueContract == '1') { + $('span.contractDuration:contains("1 ماهه")').removeClass('btn-deactive').addClass("contActive"); + } else if (aspValueContract == '2') { + $('span.contractDuration:contains("2 ماهه")').removeClass('btn-deactive').addClass("contActive"); + } else if (aspValueContract == '3') { + $('span.contractDuration:contains("3 ماهه")').removeClass('btn-deactive').addClass("contActive"); + } else if (aspValueContract == '6') { + $('span.contractDuration:contains("6 ماهه")').removeClass('btn-deactive').addClass("contActive"); + } else if (aspValueContract == '12') { + $('span.contractDuration:contains("1 ساله")').removeClass('btn-deactive').addClass("contActive"); + } else if (aspValueContract == 'ForEver') { + $('span.contractDuration:contains("دائمی")').removeClass('btn-deactive').addClass("contActive"); + } + } + } + + //عناوین فیش حقوقی + function addBonus(element, id) { + if ($(element).hasClass('bonusActive')) { + $(element).addClass('bonusDeactive').removeClass('bonusActive'); + $("#" + id).removeAttr("checked"); + } else { + $(element).removeClass('bonusDeactive').addClass('bonusActive'); + $("#" + id).attr("checked", "checked"); + } + $("#" + id).change(); + } + //مجموع مبالغ + //function addPayment(element) { + // if ($(element).hasClass('totalActive')) { + // $(element).addClass('totalDeactive').removeClass('totalActive'); + // $("#totalPayment").prop("checked", false); + // $(element).children().replaceWith(''); + // } else { + // $(element).removeClass('totalDeactive').addClass('totalActive'); + // $("#totalPayment").prop("checked", true); + // $(element).children().replaceWith(''); + + // } + // $("#totalPayment").change(); + //} + + + var isLegalList = []; + + function getEmployer(employerId) { + + if (employerId !== null && employerId != '') { + $.ajax({ + /* contentType: 'charset=utf-8',*/ + dataType: 'json', + type: 'POST', + url: '@Url.Page("/Company/Workshops/Index", "GetEmployerName")', + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "employerId": employerId }, + success: function (response) { + //console.log(response.isLegal); + if ((response.isLegal && response.nationalId == '') || (!response.isLegal && response.nationalcode == '')) { + swal({ + title: (response.isLegal ? "کارفرمای انتخاب شده شناسه ملی ندارد." : " کارفرمای انتخاب شده کد ملی ندارد."), + text: (response.isLegal ? "در صورت تمایل به درج شناسه ملی به منوی کارفرما مراجعه نمایید." : "در صورت تمایل به درج کد ملی به منوی کارفرما مراجعه نمایید."), + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + closeOnCancel: true, + customClass: "errorSwall" + }); + $('#EmployerIdList option').filter('[value="' + employerId + '"]').remove(); + var option = new Option(response.lName, employerId); + $("#EmployerIdList").append(option); + $("#EmployerIdList").trigger("change"); + } else { + $('#isLegal').val(response.isLegal); + isLegalList.push(response.isLegal); + } + + }, + failure: function (response) { + console.log(5, response); + } + + }); + } + + } + + + function containsAll(needles, haystack) { + for (var i = 0; i < needles.length; i++) { + if ($.inArray(needles[i], haystack) == -1) return false; + } + return true; + } + + function dateValidcheck(inputField1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function (str) { + if (typeof str === 'string') { + for (var i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = inputField1.value; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + let s1, s2; + for (var i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 4) { + s1 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 7) { + s2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let fixResult = yRes + s1 + mRes + s2 + dRes; + let test1 = checkEnValid(inputField1.value); + + let isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); + + + if (isValid && test1) { + inputField1.style.backgroundColor = '#a6e9a6'; + start1valid = true; + + + } else { + + if (inputField1.value != "") { + inputField1.style.backgroundColor = '#f94c4c'; + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); + start1valid = false; + } + + + } + return start1valid; + + } + + function checkEnValid(fixDate1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function (str) { + if (typeof str === 'string') { + for (var i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = fixDate1; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let kabiseh = false; + if (month <= 6 && day > 31) { + return false; + } else if (month > 6 && month < 12 && day > 30) { + return false; + } else if (month === 12) { + + switch (year) { + case 1346: + kabiseh = true; + break; + case 1350: + kabiseh = true; + break; + case 1354: + kabiseh = true; + break; + case 1358: + kabiseh = true; + break; + case 1362: + kabiseh = true; + break; + case 1366: + kabiseh = true; + break; + case 1370: + kabiseh = true; + break; + case 1375: + kabiseh = true; + break; + case 1379: + kabiseh = true; + break; + case 1383: + kabiseh = true; + break; + case 1387: + kabiseh = true; + break; + case 1391: + kabiseh = true; + break; + case 1395: + kabiseh = true; + break; + case 1399: + kabiseh = true; + break; + case 1403: + kabiseh = true; + break; + case 1408: + kabiseh = true; + break; + case 1412: + kabiseh = true; + break; + case 1416: + kabiseh = true; + break; + case 1420: + kabiseh = true; + break; + case 1424: + kabiseh = true; + break; + case 1428: + kabiseh = true; + break; + case 1432: + kabiseh = true; + break; + case 1436: + kabiseh = true; + break; + case 1441: + kabiseh = true; + break; + case 1445: + kabiseh = true; + break; + default: + kabiseh = false; + + } + if (kabiseh == true && day > 30) { + return false; + } else if (kabiseh == false && day > 29) { + return false; + } else { + return true; + } + } else { + return true; + } + + + } + + diff --git a/ServiceHost/Areas/Admin/Pages/Company/Workshops/EditWorkshop.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Workshops/EditWorkshop.cshtml.cs index 186517b9..a0d9a60a 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Workshops/EditWorkshop.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Workshops/EditWorkshop.cshtml.cs @@ -1,175 +1,232 @@ -using _0_Framework.Application; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; using AccountManagement.Domain.AccountAgg; -using Company.Domain.WorkshopAgg; using CompanyManagment.App.Contracts.Employer; using CompanyManagment.App.Contracts.InsuranceJob; using CompanyManagment.App.Contracts.Workshop; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; +using _0_Framework.Application; +using AccountManagement.Application.Contracts.Account; +using Company.Domain.WorkshopAgg; +using CompanyManagment.App.Contracts.RollCall; +using CompanyManagment.App.Contracts.RollCallService; +using CompanyManagment.EFCore.Repository; +using CompanyManagment.EFCore.Migrations; -namespace ServiceHost.Areas.Admin.Pages.Company.Workshops; - -[Authorize] -public class EditWorkshopModel : PageModel +namespace ServiceHost.Areas.Admin.Pages.Company.Workshops { - private readonly IAccountRepository _accountRepository; - private readonly IAuthHelper _authHelper; - private readonly IEmployerApplication _EmployerApplication; - private readonly IInsuranceJobApplication _insuranceJobApplication; - private readonly IWorkshopApplication _workshopApplication; - private readonly IWorkshopRepository _workshopRepository; - public EditWorkshop Command; - public SelectList Employers; - public bool HasPermissionContract; - public bool HasPermissionInsurance; - public bool HasPermissionWorkshopInfo; + [Authorize] + public class EditWorkshopModel : PageModel + { + public string Message { get; set; } + private readonly IWorkshopApplication _workshopApplication; + private readonly IWorkshopRepository _workshopRepository; + private readonly IEmployerApplication _EmployerApplication; + private readonly IAccountRepository _accountRepository; + private readonly IInsuranceJobApplication _insuranceJobApplication; + private readonly IRollCallServiceApplication _rollCallServiceApplication; + private readonly IAuthHelper _authHelper; + public EditWorkshop Command; + public SelectList Employers; + public RollCallServiceViewModel RollCallService; + public bool HasPermissionWorkshopInfo; + public bool HasPermissionContract; + public bool HasPermissionInsurance; - public EditWorkshopModel(IWorkshopApplication workshopApplication, IWorkshopRepository workshopRepository, - IEmployerApplication employerApplication, IAccountRepository accountRepository, - IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper) - { - _workshopApplication = workshopApplication; - _workshopRepository = workshopRepository; - _EmployerApplication = employerApplication; - _accountRepository = accountRepository; - _insuranceJobApplication = insuranceJobApplication; - _authHelper = authHelper; - } + public EditWorkshopModel(IWorkshopApplication workshopApplication, IWorkshopRepository workshopRepository, IEmployerApplication employerApplication, IAccountRepository accountRepository, IInsuranceJobApplication insuranceJobApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication) + { + _workshopApplication = workshopApplication; + _workshopRepository = workshopRepository; + _EmployerApplication = employerApplication; + _accountRepository = accountRepository; + _insuranceJobApplication = insuranceJobApplication; + _authHelper = authHelper; + _rollCallServiceApplication = rollCallServiceApplication; + } - public string Message { get; set; } + public void OnGet(long id) + { + var permissions = _authHelper.GetPermissions(); + HasPermissionWorkshopInfo = permissions.Any(x => x == 10326); + HasPermissionContract = permissions.Any(x => x == 10323); + HasPermissionInsurance = permissions.Any(x => x == 10324); - public void OnGet(long id) - { - var permissions = _authHelper.GetPermissions(); - HasPermissionWorkshopInfo = permissions.Any(x => x == 10326); - HasPermissionContract = permissions.Any(x => x == 10323); - HasPermissionInsurance = permissions.Any(x => x == 10324); + var permissionIds = _authHelper.GetPermissions(); + // var currentAccout = _authHelper.CurrentAccountInfo(); + var list = _insuranceJobApplication.GetInsurancJob(); + var insuranceJob = list.Select(x => new InsuranceJobViewModel() + { + Id = x.Id, + InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode, + }).ToList(); - var permissionIds = _authHelper.GetPermissions(); - // var currentAccout = _authHelper.CurrentAccountInfo(); - var list = _insuranceJobApplication.GetInsurancJob(); - var insuranceJob = list.Select(x => new InsuranceJobViewModel - { - Id = x.Id, - InsuranceJobTitle = x.InsuranceJobTitle + " | " + x.EconomicCode - }).ToList(); + RollCallService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(id); + if (RollCallService != null) + RollCallService.EndServiceToFarsiDuration = RollCallService.EndServiceStr.ToFarsiDuration2(); - var workshop = _workshopApplication.GetDetails(id); - workshop.Employers = _EmployerApplication.GetAllEmployers(); - workshop.AccountsList = _accountRepository.GetAccounts(); - workshop.EmployerIdList = _workshopRepository.GetRelation(id); - workshop.AccountIdsList = _workshopRepository.GetWorkshopAccountRelation(id); - workshop.InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle"); - Message = workshop.ArchiveCode; - workshop.PermissionIds = permissionIds; + var workshop = _workshopApplication.GetDetails(id); + workshop.Employers = _EmployerApplication.GetAllEmployers(); + workshop.AccountsList = _accountRepository.GetAccounts() + .Where(x => x.AdminAreaPermission == "true" && !_workshopRepository.GetWorkshopAccountRelation(id).Contains(x.Id)) + .ToList(); + workshop.EmployerIdList = _workshopRepository.GetRelation(id); + workshop.AccountIdsList = _workshopRepository.GetWorkshopAccountRelation(id); + workshop.InAccountIdsList = _accountRepository.GetAccounts() + .Where(x => _workshopRepository.GetWorkshopAccountRelation(id).Contains(x.Id)) + .ToList(); + workshop.InsuranceJobViewModels = new SelectList(insuranceJob, "Id", "InsuranceJobTitle"); + Message = workshop.ArchiveCode; + workshop.PermissionIds = permissionIds; + Command = workshop; + + } - Command = workshop; - } + public IActionResult OnPostEdit(EditWorkshop command) + { + var aaa = command; + if (ModelState.IsValid) + { - public IActionResult OnPostEdit(EditWorkshop command) - { - var aaa = command; - if (ModelState.IsValid) - { - } + } - #region checkIsLegalAndNotIsLegal + #region checkIsLegalAndNotIsLegal + OperationResult resultIsLegal = new OperationResult(); + var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id)).ToList(); + var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault(); + var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault(); - var resultIsLegal = new OperationResult(); - var selectEmployerList = _EmployerApplication.GetEmployers().Where(x => command.EmployerIdList.Contains(x.Id)) - .ToList(); - var isNotlegal = selectEmployerList.Where(x => x.IsLegal == "حقیقی").FirstOrDefault(); - var islegal = selectEmployerList.Where(x => x.IsLegal == "حقوقی").FirstOrDefault(); + if (isNotlegal != null && islegal != null) + return new JsonResult(resultIsLegal.Failed("امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد")); + #endregion - if (isNotlegal != null && islegal != null) - return new JsonResult(resultIsLegal.Failed( - "امکان انتخاب کارفرمای حقیقی و حقوقی به دلیل موانع قانونی در نرم افزار بصورت همزمان امکان پذیر نمی باشد")); + var workshop = _workshopApplication.GetDetails(command.Id); + var lastNumber = workshop.ArchiveCode; + var res = _workshopApplication.GetWorkshop(); + bool checkNumber = false; + bool checkExist = false; + var pration = new OperationResult(); + string a = command.ArchiveCode; + string bb = string.Empty; + int convert2 = 0; + if (!string.IsNullOrWhiteSpace(a)) + { + for (int x = 0; x < a.Length; x++) + { + if (char.IsDigit(a[x])) + bb += a[x]; + } - #endregion + if (bb.Length > 0) + { + checkNumber = true; + convert2 = int.Parse(bb); + } + else + { + checkNumber = false; - var workshop = _workshopApplication.GetDetails(command.Id); - var lastNumber = workshop.ArchiveCode; - var res = _workshopApplication.GetWorkshop(); - var checkNumber = false; - var checkExist = false; - var pration = new OperationResult(); - var a = command.ArchiveCode; - var bb = string.Empty; - var convert2 = 0; - if (!string.IsNullOrWhiteSpace(a)) - { - for (var x = 0; x < a.Length; x++) - if (char.IsDigit(a[x])) - bb += a[x]; + } + } + else + { + checkNumber = true; - if (bb.Length > 0) - { - checkNumber = true; - convert2 = int.Parse(bb); - } - else - { - checkNumber = false; - } - } - else - { - checkNumber = true; - } + } - var codes = new List(); - foreach (var i in res) - { - var b2 = string.Empty; + var codes = new List(); + foreach (var i in res) + { - if (i.ArchiveCode != null && i.ArchiveCode != lastNumber) - { - for (var x = 0; x < i.ArchiveCode.Length; x++) - if (char.IsDigit(i.ArchiveCode[x])) - b2 += i.ArchiveCode[x]; + string b2 = string.Empty; - if (b2.Length > 0) - { - var convert = int.Parse(b2); - codes.Add(convert); + if (i.ArchiveCode != null && i.ArchiveCode != lastNumber) + { + for (int x = 0; x < i.ArchiveCode.Length; x++) + { + if (char.IsDigit(i.ArchiveCode[x])) + b2 += i.ArchiveCode[x]; + } + + if (b2.Length > 0) + { + int convert = int.Parse(b2); + codes.Add(convert); + } + } + + + } + + foreach (var item in codes) + { + if (item == convert2) + checkExist = true; + } + + if (checkNumber) + { + //var EmpoyersSelected = _EmployerRepository.Get(command.EmployerId); + //if (EmpoyersSelected.EmployerNo == null) + //{ + // EmpoyersSelected.EditEmployerNo(command.ArchiveCode); + //} + command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode) ? command.InsuranceCode.ConvertToEnglish() : ""; + command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode) ? command.ArchiveCode.ConvertToEnglish() : ""; + command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber) ? command.AgreementNumber.ConvertToEnglish() : ""; + command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend; + + #region Vafa + + if (command.HasRollCallFreeVip == "ture") + { + //var todayPersianDate = DateTime.Now.ToFirstDayOfNextMonth(); + // var financialWorkshop + //double amount = Convert.ToDouble(0); + + //var commandSaveRollCall = new CreateRollCallService() + //{ + // AccountId = _authHelper.CurrentAccountId(), + // WorkshopId = command.Id, + // ServiceType = "VIP", + // EndService = command.EndService, + // Amount = amount, + // MaxPersonValid = -1, + // Duration = command.Duration, + //}; + + //var resultRollCall = _rollCallServiceApplication.Create(commandSaveRollCall); } - } - } - foreach (var item in codes) - if (item == convert2) - checkExist = true; + #endregion - if (checkNumber) - { - //var EmpoyersSelected = _EmployerRepository.Get(command.EmployerId); - //if (EmpoyersSelected.EmployerNo == null) - //{ - // EmpoyersSelected.EditEmployerNo(command.ArchiveCode); - //} - command.InsuranceCode = !string.IsNullOrWhiteSpace(command.InsuranceCode) - ? command.InsuranceCode.ConvertToEnglish() - : ""; - command.ArchiveCode = !string.IsNullOrWhiteSpace(command.ArchiveCode) - ? command.ArchiveCode.ConvertToEnglish() - : ""; - command.AgreementNumber = !string.IsNullOrWhiteSpace(command.AgreementNumber) - ? command.AgreementNumber.ConvertToEnglish() - : ""; - command.TypeOfInsuranceSend = command.TypeOfInsuranceSend == "false" ? null : command.TypeOfInsuranceSend; - var result = _workshopApplication.Edit(command); + var result = _workshopApplication.Edit(command); - return new JsonResult(result); - } + return new JsonResult(result); + } + else + { + var res2 = _workshopApplication.Err(); + return new JsonResult(res2); + } + //else + //{ + // var res3 = _workshopApplication.ExistErr(); + // return new JsonResult(res3); + //} + } - var res2 = _workshopApplication.Err(); - return new JsonResult(res2); - //else - //{ - // var res3 = _workshopApplication.ExistErr(); - // return new JsonResult(res3); - //} - } -} \ No newline at end of file + + + + + + + + + + + + + } +} diff --git a/ServiceHost/Areas/Admin/Pages/Company/Workshops/_CreateForms/FormPermissionAccount.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Workshops/_CreateForms/FormPermissionAccount.cshtml new file mode 100644 index 00000000..f9b16385 --- /dev/null +++ b/ServiceHost/Areas/Admin/Pages/Company/Workshops/_CreateForms/FormPermissionAccount.cshtml @@ -0,0 +1,378 @@ +@model CompanyManagment.App.Contracts.Workshop.CreateWorkshop +@{ + +} + +
+
+
+
+ +
+
+ + افزودن +
+ +
+
+ ردیف + نام و نام خانوادگی + + + + + + + + + + + + + فعال یا غیر فعال + +
+
+
+ + + + diff --git a/ServiceHost/Areas/Admin/Pages/Company/Workshops/_EditForms/FormPermissionAccount.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Workshops/_EditForms/FormPermissionAccount.cshtml new file mode 100644 index 00000000..676f979d --- /dev/null +++ b/ServiceHost/Areas/Admin/Pages/Company/Workshops/_EditForms/FormPermissionAccount.cshtml @@ -0,0 +1,412 @@ +@model CompanyManagment.App.Contracts.Workshop.EditWorkshop +@{ + int index = 1; + +} + +
+
+
+
+ +
+
+ + افزودن +
+ +
+
+ ردیف + نام و نام خانوادگی + + + + + + + + + + + + + فعال یا غیر فعال +
+ + @foreach (var itemAccount in Model.InAccountIdsList) + { +
+ +
@(index++)
+ @itemAccount.Fullname + + + + + + + + + +
+ + + +
+ +
+ } +
+
+ + diff --git a/ServiceHost/ServiceHost.csproj b/ServiceHost/ServiceHost.csproj index 8fedf605..72b92ee6 100644 --- a/ServiceHost/ServiceHost.csproj +++ b/ServiceHost/ServiceHost.csproj @@ -108,6 +108,8 @@ + +