| 
									
										
										
										
											2024-05-31 00:24:45 +03:30
										 |  |  |  | <PageTitle>سامانه مودیان</PageTitle> | 
					
						
							|  |  |  |  | @inject HttpClientController hc; | 
					
						
							|  |  |  |  | @layout PanelLayout | 
					
						
							|  |  |  |  | @page "/TaxPayer" | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | @page "/TaxPayer/{routed:int}" | 
					
						
							| 
									
										
										
										
											2024-05-31 00:24:45 +03:30
										 |  |  |  | @using Front.Services | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | @using Shared | 
					
						
							|  |  |  |  | @using Shared.DTOs | 
					
						
							|  |  |  |  | @using Shared.DTOs.Serch | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  | <Modal @ref="modal" /> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | <Preload LoadingText="در حال بارگذاری..." /> | 
					
						
							|  |  |  |  | @* search *@ | 
					
						
							|  |  |  |  | <div class="row"> | 
					
						
							|  |  |  |  |     <h4 class="fw-bold py-3 mb-4"> | 
					
						
							|  |  |  |  |         <span class="text-muted fw-light">سرویس ها /</span> سامانه مودیان | 
					
						
							|  |  |  |  |     </h4> | 
					
						
							|  |  |  |  |     <div class="col-md-12"> | 
					
						
							|  |  |  |  |         <div class="card mb-2"> | 
					
						
							|  |  |  |  |             <div class="row"> | 
					
						
							|  |  |  |  |                 <div class="col-md-12"> | 
					
						
							|  |  |  |  |                     <ul class="list-group fa-padding" style="border: 2px solid #0d6efd"> | 
					
						
							|  |  |  |  |                         <li class="list-group-item" data-toggle="modal" data-target="#issue"> | 
					
						
							|  |  |  |  |                             <div class="row g-3"> | 
					
						
							|  |  |  |  |                                 <div class="col-md-1"> | 
					
						
							|  |  |  |  |                                     <input @bind-value="itemsearch.ID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text"> | 
					
						
							|  |  |  |  |                                 </div> | 
					
						
							|  |  |  |  |                                 <div class="col-md-2"> | 
					
						
							|  |  |  |  |                                     <input @bind-value="itemsearch.InvoiceID" placeholder="شناسه صورتحساب" style="text-align:center;" class="form-control" type="text"> | 
					
						
							|  |  |  |  |                                 </div> | 
					
						
							|  |  |  |  |                                 <div class="col-md-2"> | 
					
						
							|  |  |  |  |                                     <select @bind="itemsearch.invoiceType" class="form-control" aria-label="Default select example"> | 
					
						
							|  |  |  |  |                                         <option value="100" style="color: #b5b5b5" selected>نوع صورتحساب...</option> | 
					
						
							|  |  |  |  |                                         @foreach (InvoiceType i in Enum.GetValues(typeof(InvoiceType))) | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |                                             <option value="@i">@i.GetEnumDisplayName()</option> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                     </select> | 
					
						
							|  |  |  |  |                                 </div> | 
					
						
							|  |  |  |  |                                 <div class="col-md-2"> | 
					
						
							|  |  |  |  |                                     <select @bind="itemsearch.SentStatus" class="form-control" aria-label="Default select example"> | 
					
						
							|  |  |  |  |                                         <option value="100" style="color: #b5b5b5" selected>وضعیت...</option> | 
					
						
							|  |  |  |  |                                         @foreach (SentStatus i in Enum.GetValues(typeof(SentStatus))) | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |                                             <option value="@i">@i.GetEnumDisplayName()</option> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                     </select> | 
					
						
							|  |  |  |  |                                 </div> | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |                                 <div class="col-auto"> | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |                                     <Button Disabled="SpinnerVisible" @onclick="() => Load(1)" Color="ButtonColor.Primary">جستجو</Button> | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |                                 </div> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |                             </div> | 
					
						
							|  |  |  |  |                         </li> | 
					
						
							|  |  |  |  |                     </ul> | 
					
						
							|  |  |  |  |                 </div> | 
					
						
							|  |  |  |  |             </div> | 
					
						
							|  |  |  |  |         </div> | 
					
						
							|  |  |  |  |     </div> | 
					
						
							|  |  |  |  | </div> | 
					
						
							|  |  |  |  | @* alert *@ | 
					
						
							|  |  |  |  | <div class="row"> | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |     <div class="col-md-10"> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     <Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false"> | 
					
						
							|  |  |  |  |         <Icon Name="@alertIconName" class="me-2"></Icon> | 
					
						
							|  |  |  |  |         @alertMessage | 
					
						
							|  |  |  |  |     </Alert> | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |     </div> | 
					
						
							|  |  |  |  |     <div class="col-md-2"> | 
					
						
							|  |  |  |  |         <Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" /> | 
					
						
							|  |  |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | </div> | 
					
						
							|  |  |  |  | @* data *@ | 
					
						
							|  |  |  |  | @if (request != null) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     <LTable ModelinComponent="request?.list" OnMultipleOfThree="EventCallback.Factory.Create<int>(this,SentTaxItem)" /> | 
					
						
							|  |  |  |  |     @* pagination *@ | 
					
						
							|  |  |  |  |     <p style="color:red">@request?.RowCount آیتم یافت شد</p> | 
					
						
							|  |  |  |  |     <nav aria-label="Page navigation"> | 
					
						
							|  |  |  |  |         <ul class="pagination justify-content-center"> | 
					
						
							|  |  |  |  |             @for (int page = 1; page <= request?.PageCount; page++) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (page == PageIndex) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     <li class="page-item active"> | 
					
						
							|  |  |  |  |                         <a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a> | 
					
						
							|  |  |  |  |                     </li> | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     <li class="page-item"> | 
					
						
							|  |  |  |  |                         <a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a> | 
					
						
							|  |  |  |  |                     </li> | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         </ul> | 
					
						
							|  |  |  |  |     </nav> | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-31 00:24:45 +03:30
										 |  |  |  | @code { | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |     public bool SpinnerVisible { get; set; } = false; | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |     private Modal modal = default!; | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     [Inject] protected PreloadService PreloadService { get; set; } = default!; | 
					
						
							|  |  |  |  |     ItemSerchGetSentTax itemsearch = new ItemSerchGetSentTax(); | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |     [Parameter] | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     public int? routed { get; set; } = 0; | 
					
						
							|  |  |  |  |     // alert | 
					
						
							|  |  |  |  |     AlertColor alertColor = AlertColor.Primary; | 
					
						
							|  |  |  |  |     IconName alertIconName = IconName.CheckCircleFill; | 
					
						
							|  |  |  |  |     bool Hidealert = true; | 
					
						
							|  |  |  |  |     string alertMessage = ""; | 
					
						
							|  |  |  |  |     [Parameter, SupplyParameterFromQuery] | 
					
						
							|  |  |  |  |     public int? PageIndex { get; set; } | 
					
						
							|  |  |  |  |     public Shared.DTOs.PagingDto<SentTaxDto>? request { get; set; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |     protected override Task OnInitializedAsync() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         SpinnerVisible = false; | 
					
						
							|  |  |  |  |         return base.OnInitializedAsync(); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     protected override async Task OnParametersSetAsync() | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |         SpinnerVisible = false; | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |         if (routed.HasValue && routed > 0) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowSuccessAlert($"صورتحساب شماره {routed} با موفقیت ارسال شد " +'\n'+ | 
					
						
							|  |  |  |  |             "برای برای 'نمایش وضعیت' آن را تعیین وضعیت کنید"); | 
					
						
							|  |  |  |  |             itemsearch.InvoiceID = routed.Value; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-31 00:24:45 +03:30
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |         if (PageIndex == null) PageIndex = 1; | 
					
						
							|  |  |  |  |         await Load(PageIndex.Value); | 
					
						
							|  |  |  |  |         await base.OnParametersSetAsync(); | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-05-31 00:24:45 +03:30
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  | @functions{ | 
					
						
							|  |  |  |  |     public async Task SentTaxItem(int ID) | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2024-10-16 23:36:52 +03:30
										 |  |  |  |         PreloadService.Show(SpinnerColor.Dark); | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |         SpinnerVisible = true; | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |         var rsp = await hc.Get($"TaxPayer/GetResult/{ID}"); | 
					
						
							|  |  |  |  |         if (rsp.IsSuccessStatusCode) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var requestsendTax = await rsp.Content.ReadFromJsonAsync<DataInSendTaxDto>(); | 
					
						
							|  |  |  |  |             //عویض کردن اطلاعات در گرید | 
					
						
							|  |  |  |  |             var ingriddata= request.list.Where(w => w.ID == ID).First(); | 
					
						
							|  |  |  |  |             ingriddata.SentStatus = requestsendTax.SentStatus; | 
					
						
							|  |  |  |  |             ingriddata.msgSentStatus = requestsendTax.msgSentStatus; | 
					
						
							| 
									
										
										
										
											2024-10-16 16:35:38 +03:30
										 |  |  |  |             SpinnerVisible = false; | 
					
						
							| 
									
										
										
										
											2024-10-16 23:36:52 +03:30
										 |  |  |  |             PreloadService.Hide(); | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |             //----------------- | 
					
						
							|  |  |  |  |             var parameters = new Dictionary<string, object>(); | 
					
						
							|  |  |  |  |             parameters.Add("inData", requestsendTax); | 
					
						
							|  |  |  |  |             await modal.ShowAsync<CUSComponent.SendTaxItem>(title: "وضعیت صورتحساب ارسالی", parameters: parameters); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         else{ | 
					
						
							|  |  |  |  |             var request = await rsp.Content.ReadFromJsonAsync<List<string>>(); | 
					
						
							| 
									
										
										
										
											2024-10-16 23:36:52 +03:30
										 |  |  |  |             SpinnerVisible = false; PreloadService.Hide(); | 
					
						
							| 
									
										
										
										
											2024-06-10 17:26:31 +03:30
										 |  |  |  |             ShowDangerAlert(request[0]); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-10-16 16:35:38 +03:30
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     } | 
					
						
							|  |  |  |  |     public async Task Load(int pi) | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |         SpinnerVisible = true; | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |         itemsearch.PageSize = 10; | 
					
						
							|  |  |  |  |         itemsearch.PageIndex = pi; | 
					
						
							|  |  |  |  |         PreloadService.Show(SpinnerColor.Dark); | 
					
						
							|  |  |  |  |         var rsp = await hc.Post<ItemSerchGetSentTax>("TaxPayer/GetAllSentTax", itemsearch); | 
					
						
							|  |  |  |  |         if (rsp.IsSuccessStatusCode) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             request = await rsp.Content.ReadFromJsonAsync<PagingDto<SentTaxDto>>(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         else if (rsp.StatusCode == System.Net.HttpStatusCode.Forbidden) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowDangerAlert("شما دسترسی به خواندن اطلاعات صورتحساب را نداربد"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         else | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowDangerAlert("خطایی در اجرای عملیات رخ داده"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         PreloadService.Hide(); | 
					
						
							| 
									
										
										
										
											2024-10-15 14:19:54 +03:30
										 |  |  |  |         SpinnerVisible = false; | 
					
						
							| 
									
										
										
										
											2024-06-09 17:23:57 +03:30
										 |  |  |  |     } | 
					
						
							|  |  |  |  |     private void ShowSuccessAlert(string msg) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         Hidealert = false; | 
					
						
							|  |  |  |  |         alertColor = AlertColor.Success; | 
					
						
							|  |  |  |  |         alertIconName = IconName.CheckCircleFill; | 
					
						
							|  |  |  |  |         alertMessage = msg; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     private void ShowDangerAlert(string msg) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         Hidealert = false; | 
					
						
							|  |  |  |  |         alertColor = AlertColor.Danger; | 
					
						
							|  |  |  |  |         alertIconName = IconName.ExclamationTriangleFill; | 
					
						
							|  |  |  |  |         alertMessage = msg; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |