diff --git a/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor b/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor
index ef7ef3c..2b0e20a 100644
--- a/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor
+++ b/phronCare.UIBlazor/Pages/Sales/CustomerForm.razor
@@ -110,6 +110,76 @@
}
+
+
Direcciones
+
+@foreach (var address in customer.PhSCustomerAddresses)
+{
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @if (address.Country == "Argentina")
+ {
+
+ }
+ else
+ {
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
@code {
@@ -121,6 +191,8 @@
private List taxConditions = new();
private List documentTypes = new();
private ECustomerDocument documentFormModel = new();
+ private ECustomerAddress AddressForModel = new();
+ private List addresses => customer.PhSCustomerAddresses.ToList();
private string returnUrl = "/sales/customers";
@@ -164,6 +236,56 @@
customer.PhSCustomerDocuments.Remove(document);
}
+ private void AddCustomerAddress()
+ {
+ if (!string.IsNullOrWhiteSpace(AddressForModel.Streetaddress1))
+ {
+ customer.PhSCustomerAddresses.Add(AddressForModel);
+ AddressForModel = new(); // limpiar el formulario
+ }
+ }
+ private void RemoveCustomerAddress(ECustomerAddress address)
+ {
+ customer.PhSCustomerAddresses.Remove(address);
+ }
+
+ private List countries = new()
+ {
+ "Argentina", "Brasil", "Chile", "Uruguay", "Paraguay", "Bolivia", "Perú", "Colombia", "Venezuela", "México",
+ "Estados Unidos", "Canadá", "España", "Reino Unido", "Alemania", "Francia", "Italia", "China", "India", "Japón"
+ };
+
+ private List argentinaProvinces = new()
+ {
+ "Buenos Aires", "Catamarca", "Chaco", "Chubut", "Córdoba", "Corrientes", "Entre Ríos", "Formosa", "Jujuy",
+ "La Pampa", "La Rioja", "Mendoza", "Misiones", "Neuquén", "Río Negro", "Salta", "San Juan", "San Luis",
+ "Santa Cruz", "Santa Fe", "Santiago del Estero", "Tierra del Fuego", "Tucumán", "Ciudad Autónoma de Buenos Aires"
+ };
+ private void OnCountryChanged(ChangeEventArgs e, ECustomerAddress address)
+ {
+ address.Country = e.Value?.ToString();
+ if (address.Country != "Argentina")
+ {
+ address.Stateprovince = string.Empty;
+ }
+ }
+ private void AddAddress()
+ {
+ customer.PhSCustomerAddresses.Add(new());
+ }
+
+ private void RemoveAddress(ECustomerAddress address)
+ {
+ customer.PhSCustomerAddresses.Remove(address);
+ }
+
+ private void OnCountryChanged(ECustomerAddress address)
+ {
+ if (address.Country != "Argentina")
+ {
+ address.Stateprovince = string.Empty;
+ }
+ }
private async Task HandleValidSubmit()
{
try
@@ -178,7 +300,6 @@
{
response = await _httpClient.PostAsJsonAsync("/api/Customer/Create", customer);
}
-
if (response.IsSuccessStatusCode)
{
toastService.ShowSuccess("Cliente guardado exitosamente");