diff --git a/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor b/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor index c2605a8..c5f980f 100644 --- a/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor +++ b/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor @@ -61,14 +61,55 @@ +
+
Documentos
-
-
- - +
+
+ + + + @foreach (var tipo in documentTypes) + { + + } + +
+
+ + +
+
+
+
+ + @if (customer.PhSCustomerDocuments?.Any() == true) + { + + + + + + + + + + @foreach (var doc in customer.PhSCustomerDocuments) + { + + + + + + } + +
TipoNúmero
@documentTypes.FirstOrDefault(t => t.Id == doc.DocumenttypesId)?.Name@doc.DocumentNumber + +
+ } @code { @@ -78,6 +119,8 @@ private ECustomer customer { get; set; } = new(); private List accountTypes = new(); private List taxConditions = new(); + private List documentTypes = new(); + private ECustomerDocument documentFormModel = new(); private string returnUrl = "/sales/customers"; @@ -96,11 +139,28 @@ { accountTypes = await accountTypeService.GetAllAsync(); } - private async Task LoadTaxConditions() { taxConditions = await taxConditionService.GetAllAsync(); } + private async Task LoadDocumentTypes() + { + var result = await _httpClient.GetFromJsonAsync>("/api/DocumentType/GetAll"); + documentTypes = result ?? new(); + } + + private void AddCustomerDocument() + { + if (!string.IsNullOrWhiteSpace(documentFormModel.DocumentNumber)) + { + customer.PhSCustomerDocuments.Add(documentFormModel); + documentFormModel = new(); + } + } + private void RemoveCustomerDocument(ECustomerDocument document) + { + customer.PhSCustomerDocuments.Remove(document); + } private async Task HandleValidSubmit() {