mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 MiB |
@ -1062,14 +1062,14 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.removeClass('is-invalid');
|
||||
this.divPapelEspecial.removeClass('is-invalid');
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.textoPapelCubierta.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelCubierta.addClass("d-none");
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-cubierta d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -1102,7 +1102,7 @@ class DisenioCubierta {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.divPapelCubierta.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
@ -1124,7 +1124,7 @@ class DisenioCubierta {
|
||||
|
||||
radioButton.on('click', this.#handleGramajeCubierta.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
if (papel.id == this.papelCubierta) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
@ -1201,11 +1201,11 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
let papel = response.length > 0 ? response : response;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
|
||||
@ -18,15 +18,12 @@ class DisenioInterior {
|
||||
this.validatorStepper = validatorStepper;
|
||||
|
||||
this.disenioInterior = this.domItem.find(".disenio-interior");
|
||||
this.divTipoPapelInterior = this.domItem.find("#divTipoPapelInterior");
|
||||
this.textoTipoPapelInterior = this.domItem.find("#textoTipoPapelInterior");
|
||||
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
||||
this.textoPapelInterior = this.domItem.find("#textoPapelInterior");
|
||||
this.textoPapelInteriorColor = this.domItem.find("#textoPapelInteriorColor");
|
||||
this.divPapelInteriorColor = this.domItem.find("#divPapelInteriorColor");
|
||||
this.divPapelEspecialInterior = this.domItem.find("#divPapelEspecialInterior");
|
||||
this.divPapelEspecialInteriorColor = this.domItem.find("#divPapelEspecialInteriorColor");
|
||||
this.papelEspecialInterior = this.domItem.find("#papelEspecialInterior");
|
||||
this.textoPapelInterior = this.domItem.find(".texto-papel-interior");
|
||||
this.divGramajeInterior = this.domItem.find("#divGramajeInterior");
|
||||
this.divGramajeInteriorColor = this.domItem.find("#divGramajeInteriorColor");
|
||||
this.textoGramajeInterior = this.domItem.find("#textoGramajeInterior");
|
||||
|
||||
this.negroEstandar = this.domItem.find("#negroEstandar");
|
||||
this.negroPremium = this.domItem.find("#negroPremium");
|
||||
@ -49,42 +46,10 @@ class DisenioInterior {
|
||||
this.rl_papel_interior = $("#rl_papel_interior");
|
||||
this.rl_papel_interior_color = $("#rl_papel_interior_color");
|
||||
|
||||
this.papelEspecial = new ClassSelect($("#papelEspecialInterior"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
this.papelEspecialColor = new ClassSelect($("#papelEspecialInteriorColor"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
|
||||
this.papelInteriorDiferente = false;
|
||||
this.tipoPapel = null;
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
this.cargando = true;
|
||||
|
||||
@ -102,98 +67,75 @@ class DisenioInterior {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.papelEspecial.init();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelEspecialColor.init();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
|
||||
// Eventos
|
||||
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
|
||||
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
|
||||
|
||||
// test
|
||||
$(document).on('keydown', function (e) {
|
||||
if (e.ctrlKey && e.key === '.') {
|
||||
e.preventDefault(); // Evita comportamiento por defecto si es necesario
|
||||
console.log('Se pulsó Control + .');
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[self.csrf_token]: self.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => self.getTipoImpresion(),
|
||||
ancho: self.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: self.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { console.log(response); },
|
||||
(response) => { console.error(response); }
|
||||
).get();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
updateTiposPapeles() {
|
||||
|
||||
updatePapeles(papeles = null) {
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
cliente_id: () => this.presupuestoCliente.datosGenerales.getCliente(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillTiposPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
updatePapeles() {
|
||||
|
||||
const context = this;
|
||||
|
||||
if (papeles == 'color') {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapelesColor(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
if (papeles == 'negro' || papeles == null) {
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
fillPapeles(response) {
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
if (response.length > 0) {
|
||||
this.textoPapelInterior.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -222,117 +164,50 @@ class DisenioInterior {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInterior.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInterior) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecial.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInterior').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
fillPapelesColor(response) {
|
||||
|
||||
this.divPapelInteriorColor.empty()
|
||||
this.divGramajeInteriorColor.empty();
|
||||
fillTiposPapeles(response) {
|
||||
|
||||
if (response.papeles.length > 0) {
|
||||
this.textoPapelInteriorColor.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInteriorColor.addClass("d-none");
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if(response.length <= 0) {
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
return;
|
||||
}
|
||||
|
||||
response.papeles.forEach(papel => {
|
||||
this.textoTipoPapelInterior.removeClass('d-none');
|
||||
|
||||
response.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
class: 'custom-selector custom-selector-tipo-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelColor_' + papel.id, // ID único
|
||||
name: 'tipo-papel-interior',
|
||||
id: 'tipoPapel_' + papel.id, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelColor_' + papel.id,
|
||||
text: papel.nombre
|
||||
for: 'tipoPapel_' + papel.id,
|
||||
text: papel.texto
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
radioButton.on('click', this.#handleTipoPapelInterior.bind(this));
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
this.divTipoPapelInterior.append(container);
|
||||
|
||||
if (this.papelInteriorColor == papel.id) {
|
||||
if (this.tipoPapel == papel.id) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInteriorColor) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecialColor.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -340,63 +215,35 @@ class DisenioInterior {
|
||||
|
||||
this.papelInteriorDiferente = papelInteriorDiferente;
|
||||
|
||||
if (papelInteriorDiferente) {
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
if (datos.negro) {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
|
||||
}
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium_color.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar_color.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInteriorColor = datos.color.papel.id;
|
||||
this.gramajeColor = datos.color.gramaje;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar.addClass('selected');
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
this.colorEstandar.addClass('selected');
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
this.tipoPapel = datos.color.tipo_papel;
|
||||
}
|
||||
if (datos.paginasColorConsecutivas)
|
||||
this.updatePapeles();
|
||||
else
|
||||
this.updatePapeles('negro');
|
||||
else {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
this.tipoPapel = datos.negro.tipo_papel;
|
||||
}
|
||||
|
||||
this.updateTiposPapeles();
|
||||
this.updatePapeles();
|
||||
}
|
||||
|
||||
|
||||
@ -456,21 +303,11 @@ class DisenioInterior {
|
||||
|
||||
const papelSeleccionado = $('.custom-selector-papel input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
if (!$('#divPapelEspecialInterior').hasClass("d-none")) {
|
||||
if ($('#papelEspecialInterior').select2('data').length == 0) {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior_especial);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
|
||||
|
||||
} else {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior);
|
||||
@ -506,16 +343,6 @@ class DisenioInterior {
|
||||
return tipo;
|
||||
}
|
||||
|
||||
getTipoImpresionColor() {
|
||||
|
||||
let tipo = 'colorhq';
|
||||
if (this.colorEstandar_color.hasClass('selected'))
|
||||
tipo = 'color';
|
||||
|
||||
return tipo;
|
||||
}
|
||||
|
||||
|
||||
getIsHq() {
|
||||
|
||||
try {
|
||||
@ -597,72 +424,18 @@ class DisenioInterior {
|
||||
|
||||
if (this.papelInterior != null && checkedPapel != null && checkedPapel.length > 0) {
|
||||
|
||||
if (this.divPapelInteriorColor.hasClass('d-none')) {
|
||||
|
||||
if (forResumen) {
|
||||
if (forResumen) {
|
||||
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
if (radioButtonId == 'papelEspecialInterior')
|
||||
return capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
return this.papelInterior;
|
||||
else {
|
||||
return this.papelEspecial.getVal();
|
||||
}
|
||||
}
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
else {
|
||||
let checkedPapelColor = $('.custom-selector-papel-color input[type="radio"]:checked');
|
||||
|
||||
if (checkedPapelColor == null || checkedPapelColor.length == 0 || checkedPapel == null || checkedPapel.length == 0)
|
||||
return null;
|
||||
|
||||
let papelNegro = 0;
|
||||
let papelColor = 0;
|
||||
|
||||
if (forResumen) {
|
||||
|
||||
let radioButtonIdNegro = checkedPapel[0].id;
|
||||
if (radioButtonIdNegro == 'papelEspecialInterior')
|
||||
papelNegro = capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdNegro + '"]');
|
||||
papelNegro = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
let radioButtonIdColor = checkedPapelColor[0].id;
|
||||
if (radioButtonIdColor == 'papelEspecialInteriorColor')
|
||||
papelColor = capitalizeFirstLetter(this.papelEspecialColor.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdColor + '"]');
|
||||
papelColor = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
papelNegro = this.papelInterior;
|
||||
else {
|
||||
papelNegro = this.papelEspecial.getVal();
|
||||
}
|
||||
if (this.divPapelEspecialInteriorColor.hasClass('d-none'))
|
||||
papelColor = this.papelInteriorColor;
|
||||
else {
|
||||
papelColor = this.papelEspecialColor.getVal();
|
||||
}
|
||||
}
|
||||
return {
|
||||
negro: papelNegro,
|
||||
color: papelColor,
|
||||
}
|
||||
return this.papelInterior;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -730,10 +503,6 @@ class DisenioInterior {
|
||||
let class2Find = '.disenio-interior';
|
||||
if (element[0].closest('.image-container').id.includes('Color')) {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
$('#papelEspecialInteriorColor').off("change");
|
||||
this.papelEspecialColor.empty();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
class2Find = '.disenio-interior-color';
|
||||
@ -742,10 +511,6 @@ class DisenioInterior {
|
||||
}
|
||||
else {
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
$('#papelEspecialInterior').off("change");
|
||||
this.papelEspecial.empty();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.divPapelInterior.empty();
|
||||
@ -765,11 +530,15 @@ class DisenioInterior {
|
||||
// Para recalcular el presupuesto
|
||||
element.trigger('change');
|
||||
|
||||
if ($('.disenio-interior.selected').length != 0) {
|
||||
if (class2Find == '.disenio-interior-color')
|
||||
this.updatePapeles('color');
|
||||
else
|
||||
this.updatePapeles();
|
||||
if(element.closest(class2Find).parent().find(class2Find).hasClass('selected'))
|
||||
this.updateTiposPapeles();
|
||||
else{
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass('d-none');
|
||||
this.divPapelInterior.empty();
|
||||
this.textoPapelInterior.addClass('d-none');
|
||||
}
|
||||
|
||||
if (this.validateDisenioInterior()) {
|
||||
@ -805,37 +574,24 @@ class DisenioInterior {
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
if (element[0].id == 'papelEspecialInterior') {
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesimpresion/getgramajecliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel_id: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
if (!this.cargando)
|
||||
this.gramaje = null;
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.removeClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
if (!this.cargando) {
|
||||
this.gramaje = null;
|
||||
if (this.validatePapelInterior()) {
|
||||
@ -858,107 +614,34 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
#handlePapelInteriorEspecial() {
|
||||
|
||||
#handleTipoPapelInterior(event) {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.papelInterior = this.papelEspecial.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
#handlePapelInteriorColor(event) {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
this.divTipoPapelInterior.removeClass('is-invalid');
|
||||
this.divPapelInterior.removeClass('is-invalid');
|
||||
this.divGramajeInterior.removeClass('is-invalid');
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
|
||||
// Accede al ID del elemento que disparó el evento
|
||||
const element = $(event.target);
|
||||
const papel = element[0].id.split('_')[1];
|
||||
this.papelInteriorColor = papel;
|
||||
if (!this.cargando)
|
||||
this.gramajeColor = null;
|
||||
else {
|
||||
this.cargandoColor = false;
|
||||
}
|
||||
this.tipoPapel = papel;
|
||||
|
||||
$('#' + papel).prop('checked', true);
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
|
||||
if (element[0].id == 'papelEspecialInteriorColor') {
|
||||
|
||||
this.gramajeColor = null;
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.removeClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#handlePapelInteriorEspecialColor() {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.papelInteriorColor = this.papelEspecialColor.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
tipo_papel_generico_id: papel,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
@ -966,13 +649,14 @@ class DisenioInterior {
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
this.fillPapeles.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fillGramajes(response) {
|
||||
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
@ -980,11 +664,13 @@ class DisenioInterior {
|
||||
this.divGramajeInterior.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
this.textoGramajeInterior.removeClass('d-none');
|
||||
|
||||
let papel = response.length > 0 ? response : response;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
@ -1051,65 +737,6 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
fillGramajesColor(response) {
|
||||
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.divGramajeInteriorColor.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.papeles.forEach(valor => {
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-gramaje-color d-flex flex-column align-items-center justify-content-center gramaje-interior',
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: ' calcular-solapas calcular-presupuesto gramaje-interior-color',
|
||||
id: 'gramajeColor_' + valor.gramaje, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: "gramajeColor_" + valor.gramaje,
|
||||
text: valor.gramaje + " gr"
|
||||
});
|
||||
|
||||
radioButton.on('click', (event) => {
|
||||
const element = $(event.target);
|
||||
const gramaje = element[0].id;
|
||||
|
||||
this.presupuestoCliente.calcularSolapas(event);
|
||||
this.presupuestoCliente.checkForm(event);
|
||||
});
|
||||
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divGramajeInteriorColor').append(container);
|
||||
|
||||
if (this.gramaje != null) {
|
||||
if (this.gramaje == valor.gramaje) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
showGramaje = true;
|
||||
});
|
||||
|
||||
if ($("#divGramajeInteriorColor").hasClass("d-none") && showGramaje) {
|
||||
$("#divGramajeInteriorColor").removeClass("d-none");
|
||||
}
|
||||
else if (!showGramaje) {
|
||||
$("#divGramajeInteriorColor").addClass("d-none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user