mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-24 09:40:21 +00:00
arreglados problemas presupuesto, botones css etc
This commit is contained in:
@ -152,11 +152,11 @@ $(document).on('change', '.marcapaginas-item', () => {
|
||||
|
||||
const payload = {
|
||||
marcapaginas_tirada: parseInt($('#marcapaginas-tirada').val()) || 100,
|
||||
tamanio_marcapaginas: $('#tamanio-marcapaginas').val() || '_50x140_',
|
||||
caras_impresion: $('#caras-impresion').val() || 'una_cara',
|
||||
papel_marcapaginas: $('#papel-marcapaginas').val() || 'cartulina_grafica',
|
||||
gramaje_marcapaginas: parseInt($('#gramaje-marcapaginas').val()) || 300,
|
||||
acabado_marcapaginas: $('#acabado-marcapaginas').val() || 'ninguno',
|
||||
tamanio: $('#tamanio-marcapaginas').val() || '_50x140_',
|
||||
carasImpresion: $('#caras-impresion').val() || 'una_cara',
|
||||
papel: $('#papel-marcapaginas').val() || 'cartulina_grafica',
|
||||
gramaje: parseInt($('#gramaje-marcapaginas').val()) || 300,
|
||||
acabado: $('#acabado-marcapaginas').val() || 'ninguno',
|
||||
};
|
||||
$(document).trigger('marcapaginas:update', [payload]);
|
||||
});
|
||||
@ -167,11 +167,11 @@ function loadMarcapaginasData() {
|
||||
|
||||
$(document).one('marcapaginas:response', (e, stored) => {
|
||||
$('#marcapaginas-tirada').val(stored.marcapaginas_tirada);
|
||||
$('#tamanio-marcapaginas').val(stored.tamanio_marcapaginas);
|
||||
$('#caras-impresion').val(stored.caras_impresion);
|
||||
$('#papel-marcapaginas').val(stored.papel_marcapaginas);
|
||||
$('#gramaje-marcapaginas').val(stored.gramaje_marcapaginas);
|
||||
$('#acabado-marcapaginas').val(stored.acabado_marcapaginas);
|
||||
$('#tamanio-marcapaginas').val(stored.tamanio);
|
||||
$('#caras-impresion').val(stored.carasImpresion);
|
||||
$('#papel-marcapaginas').val(stored.papel);
|
||||
$('#gramaje-marcapaginas').val(stored.gramaje);
|
||||
$('#acabado-marcapaginas').val(stored.acabado);
|
||||
});
|
||||
|
||||
$(document).trigger('marcapaginas:request');
|
||||
|
||||
@ -36,7 +36,7 @@ class TiradaCard {
|
||||
|
||||
const col = $(`
|
||||
<div class="col d-flex">
|
||||
<label class="tirada-card ${this.selected ? 'selected' : ''} w-100 h-100" for="tirada-${this.id}">
|
||||
<label class="tirada-card ${this.selected ? 'selected' : ''} h-100" for="tirada-${this.id}">
|
||||
<input type="radio" name="${this.name}" id="tirada-${this.id}" value="${this.unidades}" ${this.selected ? 'checked' : ''}>
|
||||
<div class="title">${this.#title()}</div>
|
||||
|
||||
|
||||
@ -70,14 +70,19 @@ export default class PresupuestoWizard {
|
||||
}
|
||||
},
|
||||
servicios: {
|
||||
servicios: [],
|
||||
servicios: [{
|
||||
"id": "ferro-digital",
|
||||
"label": "Ferro Digital",
|
||||
"price": 0,
|
||||
"units": 1
|
||||
}],
|
||||
datosMarcapaginas: {
|
||||
marcapaginas_tirada: 100,
|
||||
tamanio_marcapaginas: '_50x140_',
|
||||
caras_impresion: 'una_cara',
|
||||
papel_marcapaginas: 'cartulina_grafica',
|
||||
gramaje_marcapaginas: 300,
|
||||
acabado_marcapaginas: 'ninguno',
|
||||
tamanio: '_50x140_',
|
||||
carasImpresion: 'una_cara',
|
||||
papel: 'cartulina_grafica',
|
||||
gramaje: 300,
|
||||
acabado: 'ninguno',
|
||||
resultado: {
|
||||
precio_unitario: 0,
|
||||
precio: 0
|
||||
@ -127,7 +132,6 @@ export default class PresupuestoWizard {
|
||||
this.entregaTipo = $('#entregaTipo');
|
||||
this.ivaReducido = $('#iva-reducido');
|
||||
this.btnIvaReducidoDetail = $('#btn-iva-reducido-detail');
|
||||
this.btn_next_datos_generales = $('#next-datos-generales');
|
||||
this.datos_generales_alert = $('#datos-generales-alert');
|
||||
|
||||
// pestaña interior
|
||||
@ -481,7 +485,7 @@ export default class PresupuestoWizard {
|
||||
Summary.updateFormato();
|
||||
});
|
||||
|
||||
this.btn_next_datos_generales.on('click', () => {
|
||||
$('.btn-change-tab-datos-generales').on('click', () => {
|
||||
this.#nextDatosGenerales();
|
||||
});
|
||||
|
||||
@ -715,7 +719,7 @@ export default class PresupuestoWizard {
|
||||
$('.tipo-libro#grapado').removeClass('d-none');
|
||||
}
|
||||
|
||||
if (!(selectedTipo && $('.tipo-libro#' + selectedTipo).length > 0 && !$('.tipo-libro#' + selectedTipo).hasClass('d-none'))) {
|
||||
if (!(selectedTipo && $(`.tipo-libro input[value="${selectedTipo}"]`).length && !$(`.tipo-libro input[value="${selectedTipo}"]`).closest('.tipo-libro').hasClass('d-none'))) {
|
||||
|
||||
let firstVisible = $('.tipo-libro').not('.d-none').first();
|
||||
|
||||
@ -883,7 +887,7 @@ export default class PresupuestoWizard {
|
||||
$('.btn-change-tab-interior').on('click', (e) => {
|
||||
|
||||
let data = this.#getPresupuestoData();
|
||||
const id = e.currentTarget.id;
|
||||
const action = $(e.currentTarget).data('btn-action') || 'next';
|
||||
this.interior_alert.addClass('d-none').find('#form-errors-alert-list').empty();
|
||||
|
||||
$.ajax({
|
||||
@ -891,7 +895,7 @@ export default class PresupuestoWizard {
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: (data) => {
|
||||
if (id === 'btn-prev-interior') {
|
||||
if (action === 'previous') {
|
||||
this.summaryTableInterior.addClass('d-none');
|
||||
this.#changeTab('pills-general-data');
|
||||
} else {
|
||||
@ -1247,9 +1251,9 @@ export default class PresupuestoWizard {
|
||||
$('.btn-change-tab-cubierta').on('click', (e) => {
|
||||
|
||||
const data = this.#getPresupuestoData();
|
||||
const id = e.currentTarget.id;
|
||||
const action = $(e.currentTarget).data('btn-action') || 'next';
|
||||
|
||||
if (id === 'btn-prev-cubierta') {
|
||||
if (action === 'previous') {
|
||||
data.calcular = false;
|
||||
}
|
||||
else {
|
||||
@ -1261,7 +1265,7 @@ export default class PresupuestoWizard {
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: (data) => {
|
||||
if (id === 'btn-prev-cubierta') {
|
||||
if (action === 'previous') {
|
||||
this.summaryTableCubierta.addClass('d-none');
|
||||
this.#changeTab('pills-inside');
|
||||
}
|
||||
@ -1272,7 +1276,7 @@ export default class PresupuestoWizard {
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
if (id === 'btn-prev-cubierta') {
|
||||
if (action === 'previous') {
|
||||
this.#changeTab('pills-inside');
|
||||
return;
|
||||
}
|
||||
@ -1540,9 +1544,9 @@ export default class PresupuestoWizard {
|
||||
|
||||
$(document).on('click', '.btn-change-tab-seleccion-tirada', (e) => {
|
||||
|
||||
const id = e.currentTarget.id;
|
||||
const action = $(e.currentTarget).data('btn-action') || 'next';
|
||||
|
||||
if (id === 'btn-prev-seleccion-tirada') {
|
||||
if (action === 'previous') {
|
||||
this.#changeTab('pills-cover');
|
||||
} else {
|
||||
const data = this.#getPresupuestoData();
|
||||
@ -1621,9 +1625,9 @@ export default class PresupuestoWizard {
|
||||
|
||||
$(document).on('click', '.btn-change-tab-extras', (e) => {
|
||||
|
||||
const id = e.currentTarget.id;
|
||||
const action = $(e.currentTarget).data('btn-action') || 'next';
|
||||
|
||||
if (id === 'btn-prev-extras') {
|
||||
if (action === 'previous') {
|
||||
this.#changeTab('pills-seleccion-tirada');
|
||||
this.summaryTableExtras.addClass('d-none');
|
||||
} else {
|
||||
@ -1631,11 +1635,22 @@ export default class PresupuestoWizard {
|
||||
const servicios = [];
|
||||
$('.service-checkbox:checked').each(function () {
|
||||
const $servicio = $(this);
|
||||
let price = 0;
|
||||
if ($servicio.attr('id') === 'marcapaginas') {
|
||||
price = self.formData.servicios.datosMarcapaginas.resultado.precio;
|
||||
}
|
||||
else if ($servicio.attr('id') === 'maquetacion') {
|
||||
price = self.formData.servicios.datosMaquetacion.resultado.precio;
|
||||
}
|
||||
else {
|
||||
price = $servicio.data('price') ?? $(`label[for="${$servicio.attr('id')}"] .service-price`).text().trim().replace(" " + self.divExtras.data('currency'), '');
|
||||
}
|
||||
|
||||
servicios.push({
|
||||
id: $servicio.attr('id') ?? $(`label[for="${$servicio.attr('id')}"] .service-title`).text().trim(),
|
||||
label: $(`label[for="${$servicio.attr('id')}"] .service-title`).text().trim(),
|
||||
units: $servicio.attr('id') === 'marcapaginas' ? self.formData.servicios.datosMarcapaginas.marcapaginas_tirada : 1,
|
||||
price: $servicio.data('price') ?? $(`label[for="${$servicio.attr('id')}"] .service-price`).text().trim().replace(" " + self.divExtras.data('currency'), ''),
|
||||
price: price,
|
||||
});
|
||||
});
|
||||
|
||||
@ -1643,7 +1658,9 @@ export default class PresupuestoWizard {
|
||||
presupuesto: this.#getPresupuestoData(),
|
||||
save: !this.opts.canSave,
|
||||
mode: this.opts.mode,
|
||||
servicios: servicios
|
||||
servicios: servicios,
|
||||
datosMaquetacion: this.formData.servicios.datosMaquetacion,
|
||||
datosMarcapaginas: this.formData.servicios.datosMarcapaginas,
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
@ -1673,15 +1690,25 @@ export default class PresupuestoWizard {
|
||||
const $target = $(e.currentTarget);
|
||||
|
||||
if ($target.prop('checked')) {
|
||||
let price = 0;
|
||||
if ($target.attr('id') === 'marcapaginas') {
|
||||
price = self.formData.servicios.datosMarcapaginas.resultado.precio;
|
||||
}
|
||||
else if ($target.attr('id') === 'maquetacion') {
|
||||
price = self.formData.servicios.datosMaquetacion.resultado.precio;
|
||||
}
|
||||
else {
|
||||
price = $target.data('price') ?? $(`label[for="${$target.attr('id')}"] .service-price`).text().trim().replace(" " + self.divExtras.data('currency'), '');
|
||||
}
|
||||
this.formData.servicios.servicios.push(
|
||||
{
|
||||
id: $target.attr('id') ?? $(`label[for="${$target.attr('id')}"] .service-title`).text().trim(),
|
||||
label: $(`label[for="${$target.attr('id')}"] .service-title`).text().trim(),
|
||||
units: $target.attr('id') === 'marcapaginas' ? self.formData.servicios.datosMarcapaginas.marcapaginas_tirada : 1,
|
||||
price: $target.data('price') ?? $(`label[for="${$target.attr('id')}"] .service-price`).text().trim().replace(" " + self.divExtras.data('currency'), ''),
|
||||
price: price,
|
||||
});
|
||||
} else {
|
||||
const index = this.formData.servicios.servicios.indexOf($target.val());
|
||||
const index = this.formData.servicios.servicios.findIndex(item => item.id == $target.attr('id'));
|
||||
if (index > -1) {
|
||||
this.formData.servicios.servicios.splice(index, 1);
|
||||
}
|
||||
@ -1705,7 +1732,7 @@ export default class PresupuestoWizard {
|
||||
if (this.formData.servicios.servicios.some(s => s.id === extra.id) && !extra.checked) {
|
||||
extra.checked = true;
|
||||
if (extra.id === "marcapaginas" || extra.id === "maquetacion") {
|
||||
extra.price = extra.id === "marcapaginas" ?
|
||||
extra.price = (extra.id === "marcapaginas") ?
|
||||
this.formData.servicios.datosMarcapaginas.resultado.precio :
|
||||
this.formData.servicios.datosMaquetacion.resultado.precio;
|
||||
extra.priceUnit = this.divExtras.data('currency');
|
||||
@ -1749,9 +1776,6 @@ export default class PresupuestoWizard {
|
||||
...result,
|
||||
};
|
||||
|
||||
const list = this.formData.servicios.servicios;
|
||||
if (!list.includes('maquetacion')) list.push('maquetacion');
|
||||
|
||||
this.#cacheFormData();
|
||||
});
|
||||
}
|
||||
@ -1779,10 +1803,6 @@ export default class PresupuestoWizard {
|
||||
...result,
|
||||
};
|
||||
|
||||
// asegúrate de añadir el servicio seleccionado
|
||||
const list = this.formData.servicios.servicios;
|
||||
if (!list.includes('marcapaginas')) list.push('marcapaginas');
|
||||
|
||||
this.#cacheFormData();
|
||||
});
|
||||
|
||||
@ -1811,7 +1831,8 @@ export default class PresupuestoWizard {
|
||||
|
||||
// 2) Botón "atrás" en Resumen
|
||||
$(document).on('click', '.btn-change-tab-resumen', (e) => {
|
||||
if (e.currentTarget.id === 'btn-prev-resumen') {
|
||||
const action = $(e.currentTarget).data('btn-action') || 'next';
|
||||
if (action === 'previous') {
|
||||
this.#changeTab('pills-extras');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user