From faeb297f5c76f497139148d673aa39feb052f8db Mon Sep 17 00:00:00 2001 From: MahanCh Date: Mon, 28 Apr 2025 15:49:56 +0330 Subject: [PATCH] fix register problems --- .../MonthlyInstallment.cs | 25 ++++ .../ReviewAndPaymentViewModel.cs | 39 ++++- .../TemporaryClientRegistrationApplication.cs | 103 ++++++++++--- ServiceHost/Pages/Register/Index.cshtml | 4 +- ServiceHost/Pages/Register/Index.cshtml.cs | 13 +- .../Pages/Register/_Partials/_Step1.cshtml | 2 +- .../Pages/Register/_Partials/_Step4.cshtml | 53 +++---- .../Pages/Register/_Partials/_Step5.cshtml | 10 +- .../AssetsClient/pages/Register/css/Index.css | 24 ++- .../pages/Register/css/_Partials/_Step3.css | 2 +- .../pages/Register/css/_Partials/_Step4.css | 15 +- .../pages/Register/css/_Partials/_Step5.css | 2 +- .../pages/Register/js/_Partials/_Step1.js | 6 +- .../pages/Register/js/_Partials/_Step3.js | 45 ++++-- .../pages/Register/js/_Partials/_Step4.js | 137 +++++++++++++++--- 15 files changed, 375 insertions(+), 105 deletions(-) create mode 100644 CompanyManagment.App.Contracts/TemporaryClientRegistration/MonthlyInstallment.cs diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/MonthlyInstallment.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/MonthlyInstallment.cs new file mode 100644 index 00000000..efa53d67 --- /dev/null +++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/MonthlyInstallment.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CompanyManagment.App.Contracts.TemporaryClientRegistration; + +public class MonthlyInstallment +{ + /// + /// مبلغ قسط ماهانه + /// + public string InstallmentAmountStr { get; set; } + + /// + /// تاریخ قسط ماهانه + /// + public string InstalmentDate { get; set; } + + /// + /// شمارنده قسط + /// + public string InstallmentCounter{ get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs index bc2478b3..2a1c47c4 100644 --- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs +++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs @@ -23,28 +23,54 @@ public class ReviewAndPaymentViewModel /// مبلغ پرداخت بدون مالیات /// Double /// - public double WithoutTaxPaymentDouble { get; set; } + public double OneTimeWithoutTaxPaymentDouble { get; set; } /// /// مبلغ پرداخت بدون مالیات /// string /// - public string WithoutTaxPaymentStr { get; set; } + public string OneTimeWithoutTaxPaymentStr { get; set; } /// /// مبلغ پرداخت کامل /// Double /// - public double TotalPaymentDouble { get; set; } + public double OneTimeTotalPaymentDouble { get; set; } /// /// مبلغ پرداخت کامل /// string /// - public string TotalPaymentStr { get; set; } + public string OneTimeTotalPaymentStr { get; set; } + + /// + /// مبلغ پرداخت بدون مالیات + /// Double + /// + public double MonthlyWithoutTaxPaymentDouble { get; set; } + + /// + /// مبلغ پرداخت بدون مالیات + /// string + /// + public string MonthlyWithoutTaxPaymentStr { get; set; } + + + /// + /// مبلغ پرداخت کامل + /// Double + /// + public double MonthlyTotalPaymentDouble { get; set; } + + /// + /// مبلغ پرداخت کامل + /// string + /// + public string MonthlyTotalPaymentStr { get; set; } + /// /// مالیات بر ارزش افزوده /// Double @@ -83,4 +109,9 @@ public class ReviewAndPaymentViewModel /// آی دی طرف حساب /// public long ContractingPartTempId { get; set; } + + /// + /// لیست اقساط ماهیانه + /// + public List MonthlyInstallments { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs index c7bdbc8a..c7307dd1 100644 --- a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs +++ b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs @@ -367,7 +367,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati /// /// public async Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId, string periodModel = "12", string paymentModel = "OneTime") - { + { + //دریافت کارگاه ها var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId); @@ -409,32 +410,92 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati //مالیات result.ValueAddedTaxDouble = tenPercent; result.ValueAddedTaxSt = tenPercent.ToMoney(); - if (paymentModel == "OneTime")//تخفیف 10 درصدی درصورت پرداخت یکجا - { + //پرداخت یکجا + #region OneTimePaymentResult - double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent; + double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent; + + + //مبلغ بدون مالیات و با تخفیف + result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment; + result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney(); + + //مبلغ با مالیات + result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent; + result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney(); + #endregion - //مبلغ بدون مالیات و با تخفیف - result.WithoutTaxPaymentDouble = discountOneTimePeyment; - result.WithoutTaxPaymentStr = discountOneTimePeyment.ToMoney(); + //پرداخت ماهیانه + #region MonthlyPaymentResult - //مبلغ با مالیات - result.TotalPaymentDouble = discountOneTimePeyment + tenPercent; - result.TotalPaymentStr = result.TotalPaymentDouble.ToMoney(); - } - else - { - //مبلغ بدون مالیات - result.WithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble; - result.WithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney(); + //مبلغ بدون مالیات + result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble; + result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney(); + + // مبلغ با مالیات + result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent; + result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney(); + var installmentList = new List(); - // مبلغ با مالیات - result.TotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent; - result.TotalPaymentStr = result.TotalPaymentDouble.ToMoney(); - } + var startDate = (DateTime.Now).ToFarsi(); - result.ContractingPartTempId = contractingPartyTempId; + if (periodModel == "1") + { + + installmentList.Add(new MonthlyInstallment() + { + InstallmentAmountStr = result.MonthlyTotalPaymentStr, + InstallmentCounter = "قسط شماره یک", + InstalmentDate = startDate + + }); + result.MonthlyInstallments = installmentList; + } + else + { + int instalmentCount = Convert.ToInt32(periodModel); + var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount; + var findEndOfMonth = startDate.FindeEndOfMonth(); + for (int i = 1; i <= instalmentCount; i++) + { + if (i > 1) + { + var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi(); + startDate = currentMonthStart.FindeEndOfMonth(); + findEndOfMonth = startDate; + } + + installmentList.Add(new MonthlyInstallment() + { + InstallmentAmountStr = instalmentAmount.ToMoney(), + InstallmentCounter = i switch + { + 1 => "قسط شماره یک", + 2 => "قسط شماره دو", + 3 => "قسط شماره سه", + 4 => "قسط شماره چهار", + 5 => "قسط شماره پنج", + 6 => "قسط شماره شش", + 7 => "قسط شماره هفت", + 8 => "قسط شماره هشت", + 9 => "قسط شماره نه", + 10 => "قسط شماره ده", + 11 => "قسط شماره یازده", + 12 => "قسط شماره دوازده", + _ => "قسط شماره دوازده", + }, + InstalmentDate = startDate + + }); + } + + } + + #endregion + + result.MonthlyInstallments = installmentList; + result.ContractingPartTempId = contractingPartyTempId; return result; diff --git a/ServiceHost/Pages/Register/Index.cshtml b/ServiceHost/Pages/Register/Index.cshtml index 8126abdb..f5e6925d 100644 --- a/ServiceHost/Pages/Register/Index.cshtml +++ b/ServiceHost/Pages/Register/Index.cshtml @@ -238,7 +238,7 @@
-
+
@@ -256,7 +256,7 @@
-
+
diff --git a/ServiceHost/Pages/Register/Index.cshtml.cs b/ServiceHost/Pages/Register/Index.cshtml.cs index e706a74e..4e2e0d74 100644 --- a/ServiceHost/Pages/Register/Index.cshtml.cs +++ b/ServiceHost/Pages/Register/Index.cshtml.cs @@ -73,9 +73,20 @@ namespace ServiceHost.Pages.register { data = result, }); - } + public async Task OnGetCreateOrUpdatePeriodTemp(List command,long contractingPartyTempId) + { + var result = await _temporaryClientRegistrationApplication.CreateOrUpdateWorkshopTemp(command, contractingPartyTempId); + + return new JsonResult(new + { + success = result.IsSuccedded, + message = result.Message, + }); + } + + public async Task OnPostCreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax) { var result = await _temporaryClientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(contractingPartyTempId, periodModel, paymentModel, totalPayment, valueAddedTax); diff --git a/ServiceHost/Pages/Register/_Partials/_Step1.cshtml b/ServiceHost/Pages/Register/_Partials/_Step1.cshtml index 5d5383aa..8cb778ba 100644 --- a/ServiceHost/Pages/Register/_Partials/_Step1.cshtml +++ b/ServiceHost/Pages/Register/_Partials/_Step1.cshtml @@ -6,7 +6,7 @@
- +
-
+
-
-
+
+
-
@@ -23,16 +23,16 @@
مدت قرارداد
- - + + - - + + - - + + - +
@@ -40,48 +40,48 @@
-
+
مجموع مبالغ:
-
-
+
ارزش افزوده:
-
-
+
مبلغ قابل پرداخت:
-
@@ -96,6 +96,7 @@ var receivedCodeFromServerUrl = `@Url.Page("./Index", "ReceivedCodeFromServer")`; var totalPaymentAndWorkshopListUrl = `@Url.Page("./Index", "TotalPaymentAndWorkshopList")`; var createOrUpdateInstitutionContractTemp = `@Url.Page("./Index", "CreateOrUpdateInstitutionContractTemp")`; + var CreateOrUpdatePeriodTemp = `@Url.Page("./Index", "CreateOrUpdatePeriodTemp")`; \ No newline at end of file diff --git a/ServiceHost/Pages/Register/_Partials/_Step5.cshtml b/ServiceHost/Pages/Register/_Partials/_Step5.cshtml index 127844e5..1d34f766 100644 --- a/ServiceHost/Pages/Register/_Partials/_Step5.cshtml +++ b/ServiceHost/Pages/Register/_Partials/_Step5.cshtml @@ -28,21 +28,21 @@
-
- @*
+
+ @*
مبلغ قابل پرداخت:
۲۵,۰۰۰,۰۰۰ ریال
*@ -
+
مجموع مبالغ:
-
-
+
ارزش افزوده:
-
-
+
مبلغ قابل پرداخت:
-
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/Index.css b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/Index.css index 27cba5e1..c34b86f7 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/Index.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/Index.css @@ -1,4 +1,9 @@ -.registerTitleSteps { +body { + height: 100vh; + overflow: hidden; +} + +.registerTitleSteps { font-size: 16px; font-weight: 900; color: #22A8A8; @@ -160,7 +165,9 @@ color: #A3E635; } - +#logoSvg { + width: 150px; +} .customRegisterForm { @@ -315,6 +322,10 @@ font-size: 13px !important; width: 122px !important; } + + #logoSvg { + width: 130px; + } } @media (max-width:992px) { @@ -337,6 +348,15 @@ .progressSteps.currentStep { display: flex; } + + body { + height: auto; + overflow: auto; + } + + #logoSvg { + width: 120px; + } } @media (max-width: 576px) { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step3.css b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step3.css index 8405b920..0a813e57 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step3.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step3.css @@ -99,7 +99,7 @@ .main { - max-height: 480px; + height: 60vh; overflow-y: auto; } diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step4.css b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step4.css index a00961ec..cb3d7e76 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step4.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step4.css @@ -29,7 +29,7 @@ .cardHeight { - height: 500px; + height: 50%; overflow: auto; } @@ -180,6 +180,9 @@ display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); + height: 120px; + overflow: auto; + align-content: start; } .infoPricesContainer .item { @@ -229,9 +232,9 @@ font-size: 11px; } - .cardHeight { + /*.cardHeight { height: 260px; - } + }*/ } @media (max-width:992px) { @@ -245,8 +248,12 @@ overflow: auto; } - .cardHeight { + /*.cardHeight { height: 48vh; + }*/ + + .checkLabelListOption { + font-size: 10px; } } diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step5.css b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step5.css index 363e3b77..e3bf5a79 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step5.css +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/css/_Partials/_Step5.css @@ -13,7 +13,7 @@ .descriptionContainerStep5 { overflow-y: auto; - height: 66vh; + height: 60vh; } .titleDescStep5 { diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step1.js b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step1.js index 3e015314..f099690b 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step1.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step1.js @@ -71,7 +71,7 @@ async function checkInputsStep1() { birthDate: birthdate, nationalCode: nationalCode }; - console.log(commandStep1); + var btnDisable = $('#btnGetUidInfo').addClass('disable'); var loading = $('#btnGetUidInfo .loading').show(); @@ -87,13 +87,15 @@ async function checkInputsStep1() { btnDisable.removeClass('disable'); loading.hide(); + // console.log(response.data); + // ************ Infos for Step 2 ************ $('#contractPartyId').val(response.data.id); $('#firstName').val(response.data.fName); $('#lastName').val(response.data.lName); $('#birthdayDate').val(response.data.dateOfBirthFa); $('#fatherName').val(response.data.fatherName); - $('#nationalNumber').val(response.data.nationalCode); + $('#nationalNumber').val(response.data.idNumber); globalPhone = response.data.phone; // The State and City diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step3.js b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step3.js index 39bd8895..813f1524 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step3.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step3.js @@ -11,9 +11,17 @@ $(document).ready(function () { $(".select2Option").select2({ language: "fa", dir: "rtl" - }); + }); + + autoScroll(); }); +function autoScroll() { + $('.main').animate({ + scrollTop: $('.accordion').height() + }, 2500); +} + $(document).on('input', '.operations-btns input[type="text"]', function() { let $input = $(this); let nameSpan = $input.closest(".accordion-item").find('.workshopListItem .workshopNameSpan'); @@ -169,7 +177,9 @@ function addNewWorkshop() { // Expand only the new one $newOperationsBtns.slideDown(300); - $newOpenBtn.addClass('expanded'); + $newOpenBtn.addClass('expanded'); + + autoScroll(); } $(document).on("click", ".btnRemove", function () { @@ -250,9 +260,9 @@ function createOrUpdateCommand() { return; } - let existingAmount = sumAmountArray.find(w => w.workshopDataId === dataId); + let existingAmount = sumAmountArray.find(w => w.workshopDataId === dataId); - let existingWorkshop = command.workshops.find(w => w.workshopId === workshopID); + let existingWorkshop = command.workshops.find(w => w.workshopId === dataId); if (existingWorkshop) { existingWorkshop.CountPerson = personnelCount; @@ -334,7 +344,7 @@ async function checkInputsStep3() { } - await loadSpecifiedWorkshop(); + await loadSpecifiedWorkshop(createOrUpdate); try { @@ -421,16 +431,14 @@ $(document).on('change', '.operations-btns select, .btnRadioContainer .radioOpti CountPerson: personnelCount, ...selectedOptions }; - - ajax.get(institutionPlanForWorkshopUrl, newWorkshopGetAmountCommand, false) - .then(response => { - console.log(response); + ajax.get(institutionPlanForWorkshopUrl, newWorkshopGetAmountCommand, false) + .then(response => { const amountStr = response.data.onlineAndInPersonSumAmountStr + ' ریال'; const amountDouble = response.data.onlineAndInPersonSumAmountDouble || 0; - let existingSumAmount = sumAmountArray.find(w => w.workshopDataId === dataId); if (existingSumAmount) { + existingSumAmount.amountStr = amountStr; existingSumAmount.amount = amountDouble; } else { let newSumAmount = { @@ -440,6 +448,7 @@ $(document).on('change', '.operations-btns select, .btnRadioContainer .radioOpti }; sumAmountArray.push(newSumAmount); } + sumNumberOfAmount(); $(`#totalPayment_${dataId}`).text(amountStr); $(`#totalPay_${dataId}`).text(amountStr); @@ -464,7 +473,12 @@ function formatNumber(number) { } function loadWorkshopData(id) { - var html = ``; + var html = ``; + command = { + workshops: [] + }; + sumAmountArray = []; + ajax.get(getWorkshopTempUrl, { contractingPartyId: id }, true) .then(response => { if (response.data.length > 0) { @@ -558,7 +572,7 @@ function loadWorkshopData(id) {
`; - + var itemOfWorkshops = { Id: item.id, workshopId: item.id, @@ -687,6 +701,11 @@ function loadWorkshopData(id) { $(`#numberPersonnel_new_0`).val("25").trigger('change'); } + // console.log(command.workshops); + // console.log(sumAmountArray); sumNumberOfAmount(); - }); + + autoScroll(); + }); + } \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step4.js b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step4.js index 24782eac..2b89c034 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step4.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/Register/js/_Partials/_Step4.js @@ -1,26 +1,36 @@ $(document).ready(function () { + $('input[name="radMonth"]').on('change', function () { + totalPaymentAndWorkshopList(); + }); + + $('input[name="radMonth"]:checked').trigger('change'); }); -async function loadSpecifiedWorkshop() { +function autoScrollStep4() { + $('.cardHeight').animate({ + scrollTop: $('.cardHeight').height() + }, 100); +} + +async function loadSpecifiedWorkshop(data) { var html = ''; - if (command.workshops.length > 0) { - command.workshops.forEach(function(item) { + if (data.workshops.length > 0) { + data.workshops.forEach(function(item) { html += `
نام کارگاه : ${item.WorkshopName}
ریال ${item.WorkshopServicesAmountStr}
-
+
- +
- +
- +
- +