feat: update address working

This commit is contained in:
Pablo Moreno
2025-01-19 03:10:34 +01:00
parent f9e57c2339
commit b48f84c337
4 changed files with 39 additions and 4 deletions
@@ -1,7 +1,13 @@
{% load i18n %}
{% load static %}
{% for address in customer_addresses %}
<form id="edit_address_{{ address.pk }}" class="hidden py-2 md:py-4" hx-post="" hx-swap="none">
<form
id="edit_address_{{ address.pk }}"
class="hidden py-2 md:py-4"
hx-post="{% url 'web:update_customer_address' pk=address.pk %}"
hx-on:htmx:after-request="htmx.toggleClass(htmx.find('#edit_address_{{ address.pk }}'), 'hidden'); htmx.toggleClass(htmx.find('#details_address_{{ address.pk }}'), 'hidden')"
hx-swap="none"
>
{% csrf_token %}
<div class="mb-4 grid gap-4 sm:grid-cols-2 sm:gap-8 lg:gap-16">
<div class="space-y-4">
@@ -16,7 +22,7 @@
focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700
dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500
dark:focus:border-primary-500"
id="address_full_name" type="text" value="{{ address.full_name }}">
id="address_full_name" name="full_name" type="text" value="{{ address.full_name }}">
</dd>
</dl>
<dl>
@@ -100,7 +106,7 @@
focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600
dark:hover:bg-primary-700 dark:focus:ring-primary-800"
>
{% translate 'Actualizar datos' %}
{% translate 'Guardar' %}
</button>
</div>