trabajando en resumen

This commit is contained in:
Jaime Jiménez Ortega
2024-05-09 19:09:21 +02:00
parent 4452ab02bd
commit 4debac578a
8 changed files with 3190 additions and 44 deletions

View File

@ -397,14 +397,7 @@
<div class="row sobrecubierta enable-sobrecubierta" style="display: none;">
<div class="col-sm-3 mb-md-0 mb-2 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input calcular-presupuesto input-sobrecubierta" type="checkbox" id="solapasSobrecubierta" name="solapasSobrecubierta" value="0">
<label class="form-check-label" for="solapasSobrecubierta">Solapas sobrecubierta</label>
</div>
</div>
<div id="tamanioSolapasSobrecubierta" class="col-sm-3 mb-md-0 mb-2" style="display: none;">
<div id="tamanioSolapasSobrecubierta" class="col-sm-3 mb-md-0 mb-2"">
<label for="anchoSolapasSobrecubierta" class="form-label">Tamaño</label>
<input type="number" id="anchoSolapasSobrecubierta" name="anchoSolapasSobrecubierta" maxLength="8" step="1" class="form-control input-sobrecubierta calcular-presupuesto" value="">
</div>

View File

@ -0,0 +1,42 @@
<div class="col-12 pb-2">
<div class="row mb-3">
<div class="col-sm-6">
<h3>Resumen</h3>
<h4>Libro</h4>
<p>Rústica cosido tapa blanda</p>
<p>Número de páginas: 200</p>
<p>Tirada: 200</p>
<p>Prototipo: NO</p>
<h4>Interior</h4>
<p>Impresion: Negro premium</p>
<p>Páginas a color: 100</p>
<p>Papel: Blanco Offset 70gr/m^2</p>
<h4>Cubierta</h4>
<p>Papel: Blanco Offset 70gr/m^2</p>
<p>Impresión: 1 cara</p>
<h4>Sobrecubierta</h4>
<p>Papel: Blanco Offset 70gr/m^2</p>
<p>Impresión: sin impresion</p>
<h4>Guardas</h4>
<p>Papel: Blanco Offset 70gr/m^2</p>
<p>Impresión: 1 cara</p>
<h4>Extras</h4>
<p>Retractilado de 5</p>
</div>
<div class="col-sm-6">
<h6>Coste impresion: 100</h6>
<h6>Coste impresion (4% IVA): 104</h6>
<h6>Precio unidad (I.V.A. incl): 10.4</h6>
<h6>Coste Envío: 30</h6>
<h6>Total (I.V.A. inc.): 134</h6>
</div>
</div>
</div>

View File

@ -57,8 +57,7 @@
</div>
</div>
<div class="row row-cols-3 d-flex justify-content-center d-flex justify-content-center"
style="margin-bottom: 40px;">
<div class="row row-cols-3 d-flex justify-content-center d-flex justify-content-center">
<div class="col-md-4 mb-6 d-flex justify-content-center">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="espiralDiv"
@ -77,7 +76,7 @@
</div>
</div>
<div class="col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div class="col-md-4 mb-6 d-flex justify-content-center" >
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="wireoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">

View File

@ -85,6 +85,21 @@ function updateTiradasDireccionesCheck(el) {
}
function obtenerUnidadesEnvio(){
const elements = $('#divDirecciones').find('.row.mb-3');
let total = 0;
if(elements.length > 0) {
for (let index=0; index<elements.length; index++){
let unidades_direcciones = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
total += unidades_direcciones;
};
}
return total;
}
$('#insertarDireccion').on('click', function() {
if( $('#direcciones').val() > 0 ) {
@ -107,15 +122,7 @@ $('#insertarDireccion').on('click', function() {
}
let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text());
const elements = $('#divDirecciones').find('.row.mb-3');
let total = 0;
if(elements.length > 0) {
for (let index=0; index<elements.length; index++){
let unidades_direcciones = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
total += unidades_direcciones;
};
}
let total = obtenerUnidadesEnvio();
if($('#prototipo').is(':checked')) {
tirada += 1;
@ -263,4 +270,31 @@ function saveAdd_callback(){
});
}
}
function validarEnvio(){
const seleccion = $('.custom-option-tiradasDirecciones.checked');
if(seleccion.length == 0) {
return false;
}
const element_tirada =($(seleccion[0]).find('label input')[0]);
const number = element_tirada.id.match(/\d+$/);
if (number.length == 0) {
return false;
}
let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text());
let total = obtenerUnidadesEnvio();
if($('#prototipo').is(':checked')) {
tirada += 1;
}
if(total != tirada){
return false;
}
return true;
}

View File

@ -137,7 +137,6 @@ $('#enableSobrecubierta').on('change', function () {
$('#gramajeSobrecubierta').val('').trigger('change');
$('#paperSobrecubierta').val('').trigger('change');
$('#acabadosSobrecubierta').val('').trigger('change');
$('#solapasSobrecubierta').prop('checked', false).trigger('change');
$('#tamanioSolapasSobrecubierta').val();
$('.enable-sobrecubierta').hide();
@ -356,14 +355,6 @@ $('#solapasCubierta').on('change', function () {
}
});
$('#solapasSobrecubierta').on('change', function () {
if ($(this).is(":checked")) {
$('#tamanioSolapasSobrecubierta').show();
} else {
$('#tamanioSolapasSobrecubierta').hide();
}
});
// Funcion que comprueba que están rellenos todos los datos necesarios para calcular el presupuesto
function checkValues() {
@ -654,9 +645,8 @@ async function calcularPresupuesto() {
gramaje: $('#gramajeSobrecubierta option:selected').text(),
acabado: $('#acabadosSobrecubierta').val()
}
if ($('#solapasSobrecubierta').is(':checked')) {
datos.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
}
datos.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
}
}

View File

@ -237,7 +237,12 @@
submitButton: new FormValidation.plugins.SubmitButton()
}
}).on('core.form.valid', function () {
validationStepper.next();
if(validarEnvio())
validationStepper.next();
else{
$('#errorDirecciones').text('El número de unidades supera la tirada seleccionada.');
$('#errorDirecciones').show();
}
});
// Deal Usage

View File

@ -83,10 +83,8 @@
<div id="tipo-libro" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
<?php /*
<?= view("themes/vuexy/form/presupuestos/cliente/_direccionesItems") ?>
*/?>
<?= view("themes/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
<div class="col-12 d-flex justify-content-between mt-4">
<button class="btn btn-label-secondary btn-prev waves-effect">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
@ -142,15 +140,25 @@
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_resumenItems") ?>
</div>
<div class="col-12 d-flex justify-content-between mt-4">
<button class="btn btn-label-secondary btn-prev waves-effect">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
</button>
<button class="btn btn-success btn-submit btn-next waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Submit</span><i class="ti ti-check ti-xs"></i>
</button>
<div class="col-6 flex-row">
<button class="btn btn-label-secondary btn-prev waves-effect">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none">Anterior</span>
</button>
</div>
<div class="col-6 flex-row-reverse">
<button class="btn btn-primary btn-submit waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
<button class="btn btn-success btn-submit btn-next waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Confirmar</span><i class="ti ti-check ti-xs"></i>
</button>
</div>
</div>
</div>

3075
xdebug.log

File diff suppressed because it is too large Load Diff