quitado tipo de entrega de todos sitios. Trabajando en el iva dependiendo de la dirección de facturación

This commit is contained in:
2026-02-13 21:19:25 +01:00
parent cef0af1bd2
commit fffc2b91c1
13 changed files with 128 additions and 83 deletions

View File

@ -0,0 +1,20 @@
databaseChangeLog:
- changeSet:
id: 0026-drop-entrega-tipo-from-presupuesto
author: jjo
changes:
- dropColumn:
tableName: presupuesto
columnName: entrega_tipo
rollback:
- addColumn:
tableName: presupuesto
columns:
- column:
name: entrega_tipo
type: ENUM('peninsula', 'canarias', 'paises_ue')
defaultValue: peninsula
afterColumn: base_imponible
constraints:
nullable: false

View File

@ -48,4 +48,6 @@ databaseChangeLog:
- include:
file: db/changelog/changesets/0024-series-facturacion-seeder.yml
- include:
file: db/changelog/changesets/0025-create-facturas-direcciones.yml
file: db/changelog/changesets/0025-create-facturas-direcciones.yml
- include:
file: db/changelog/changesets/0026-drop-entrega-tipo-from-presupuesto.yml

View File

@ -18,8 +18,8 @@ $(() => {
$('#addBillingAddressBtn').on('click', seleccionarDireccionEnvio);
$('#authorization-required').on('change', function () {
if($(this).is(':checked')) {
$(document).on('change', '#authorization-required', function () {
if ($(this).is(':checked')) {
if ($('#direccion-div .direccion-card').length > 0) {
$('#btn-checkout').prop('disabled', false);
}
@ -148,6 +148,22 @@ $(() => {
$('#btn-checkout').prop('disabled', false);
}
hideLoader();
if (direccionId) {
$.ajax({
url: `/checkout/get-summary/${direccionId}`,
type: 'GET',
success: function (response) {
const parent = $('.cart-summary-container').parent();
$('.cart-summary-container').remove();
parent.append(response);
},
error: function () {
console.error('Error al actualizar el resumen del carrito.');
}
});
}
return true;
}
hideLoader();
@ -164,6 +180,18 @@ $(() => {
$card.remove();
$('#addBillingAddressBtn').removeClass('d-none');
$('#btn-checkout').prop('disabled', true);
$.ajax({
url: `/checkout/get-summary`,
type: 'GET',
success: function (response) {
const parent = $('.cart-summary-container').parent();
$('.cart-summary-container').remove();
parent.append(response);
},
error: function () {
console.error('Error al actualizar el resumen del carrito.');
}
});
});
@ -194,7 +222,7 @@ $(() => {
type: 'POST', // PUT simulado via _method
data: $form.serialize(),
dataType: 'html',
success: function (html) {
success: async function (html) {
// Si por cualquier motivo llega 200 con fragmento, lo insertamos igual
if (typeof html === 'string' && html.indexOf('id="direccionForm"') !== -1 && html.indexOf('<html') === -1) {
$('#direccionFormModalBody').html(html);
@ -205,7 +233,8 @@ $(() => {
}
// Éxito real: cerrar y recargar tabla
$('#direccionFormModal').modal('hide');
seleccionarDireccionEnvio();
await seleccionarDireccionEnvio();
},
error: function (xhr) {
// Con 422 devolvemos el fragmento con errores aquí

View File

@ -34,7 +34,6 @@ export default class PresupuestoWizard {
paginasColor: 0,
posicionPaginasColor: '',
tipoEncuadernacion: 'fresado',
entregaTipo: 'peninsula',
ivaReducido: true,
},
interior: {
@ -130,7 +129,6 @@ export default class PresupuestoWizard {
this.divPosicionPaginasColor = $('#div-posicion-paginas-color');
this.posicionPaginasColor = $('#posicionPaginasColor');
this.paginas = $('#paginas');
this.entregaTipo = $('#entregaTipo');
this.ivaReducido = $('#iva-reducido');
this.btnIvaReducidoDetail = $('#btn-iva-reducido-detail');
this.datos_generales_alert = $('#datos-generales-alert');
@ -666,7 +664,6 @@ export default class PresupuestoWizard {
paginasColor: this.paginasColor.val(),
posicionPaginasColor: this.posicionPaginasColor.val(),
tipoEncuadernacion: $('.tipo-libro input:checked').val() || 'fresado',
entregaTipo: this.entregaTipo.val(),
ivaReducido: this.ivaReducido.is(':checked'),
};
}
@ -688,7 +685,6 @@ export default class PresupuestoWizard {
paginasColor: data.paginasColor,
posicionPaginasColor: data.posicionPaginasColor,
tipoEncuadernacion: data.tipoEncuadernacion,
entregaTipo: data.entregaTipo,
ivaReducido: data.ivaReducido,
};
}
@ -736,7 +732,6 @@ export default class PresupuestoWizard {
}
}
this.entregaTipo.val(this.formData.datosGenerales.entregaTipo);
this.ivaReducido.prop('checked', this.formData.datosGenerales.ivaReducido);
}

View File

@ -302,19 +302,6 @@
</label>
</div>
</div>
<div class="row justify-content-center mb-2">
<div class="col-sm-3 justify-content-center">
<label for="entregaTipo" class="form-label mt-2"
th:text="#{presupuesto.entrega}">Entrega</label>
<select class="form-select select2 datos-generales-data" id="entregaTipo" name="entregaTipo">
<option selected value="peninsula" th:text="#{presupuesto.entrega.peninsula}">Península
y
Baleares</option>
<option value="canarias" th:text="#{presupuesto.entrega.canarias}">Canarias</option>
<option value="paises_ue" th:text="#{presupuesto.entrega.paises-ue}">Países UE</option>
</select>
</div>
</div>
</div>
</div>
</div>