trabajando en edit

This commit is contained in:
2024-05-20 16:18:54 +02:00
parent 5d80eacb3f
commit 75df199c5d
4 changed files with 8623 additions and 20 deletions

View File

@ -576,6 +576,14 @@
<?= $this->section("additionalInlineJs") ?>
window.datosDisenioLibro = {
papel_interior: <?php echo $presupuestoEntity->papel_interior ? $presupuestoEntity->papel_interior : 'null'; ?>,
gramaje_interior: <?php echo $presupuestoEntity->gramaje_interior ? $presupuestoEntity->gramaje_interior : 'null'; ?>,
papel_cubierta: <?php echo $presupuestoEntity->papel_cubierta ? $presupuestoEntity->papel_cubierta : 'null'; ?>,
gramaje_cubierta: <?php echo $presupuestoEntity->gramaje_cubierta ? $presupuestoEntity->gramaje_cubierta : 'null'; ?>,
papel_sobrecubierta: <?php echo $presupuestoEntity->papel_sobrecubierta ? $presupuestoEntity->papel_sobrecubierta : 'null'; ?>,
gramaje_sobrecubierta: <?php echo $presupuestoEntity->gramaje_sobrecubierta ? $presupuestoEntity->gramaje_sobrecubierta : 'null'; ?>,
}
window.routes_disenio_libro = {
obtenerGramaje: "<?= route_to('obtenerGramaje') ?>",
presupuestoCliente: "<?= route_to('presupuestoCliente') ?>",

View File

@ -153,7 +153,20 @@ function initDisenioLibro() {
$('.change-tipo-impresion').trigger('change');
$('#papelInterior').trigger('change');
$('#papelInterior').val(window.datosDisenioLibro.papel_interior);
$('#gramajeInterior').append($('<option>', {
value: window.datosDisenioLibro.gramaje_interior,
text: window.datosDisenioLibro.gramaje_interior
}));
$('#gramajeInterior').val(window.datosDisenioLibro.gramaje_interior);
$('#papelCubierta').val('').trigger('change');
$('#papelCubierta').val(window.datosDisenioLibro.papel_cubierta);
$('#gramajeCubierta').append($('<option>', {
value: window.datosDisenioLibro.gramaje_cubierta,
text: window.datosDisenioLibro.gramaje_cubierta
}));
$('#gramajeCubierta').val(window.datosDisenioLibro.gramaje_cubierta);
$('#papelSobrecubierta').val('').trigger('change');
$('#enableSobrecubierta').trigger('change');
@ -718,25 +731,27 @@ async function calcularPresupuesto() {
$('#precios').show();
for (i = 0; i < response.tiradas.length; i++) {
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
const label = "tiradaPrecio" + parseInt(i+1);
if(response.tiradas){
for (i = 0; i < response.tiradas.length; i++) {
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
const label = "tiradaPrecio" + parseInt(i+1);
let html = '';
let html = '';
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
html += '<div class="list-content">';
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
html += '</div>';
html += '</div>'
html += '</a>';
html += '</div>';
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
html += '<div class="list-content">';
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
html += '</div>';
html += '</div>'
html += '</a>';
html += '</div>';
$('#divTiradasPrecio').append(html);
$('#divTiradasPrecio').append(html);
}
}
},
error: function (error) {