trabajando en la funcion de calcular presupuesto

This commit is contained in:
2024-04-29 15:38:30 +02:00
parent d8778f0f2f
commit 7c754599f9
6 changed files with 3235 additions and 117 deletions

View File

@ -46,7 +46,7 @@
<div class="col-sm-3 mb-md-0 mb-2" id="tapaBlandaDiv">
<div id="tapaBlandaInnerDiv" class="form-check custom-option custom-option-tapa custom-option-basic checked">
<label class="form-check-label custom-option-content" for="tapaBlanda">
<input name="tapaBlanda" class="form-check-input elementos-libro" type="radio" value="" id="tapaBlanda" checked="">
<input name="tapaBlanda" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="" id="tapaBlanda" checked="">
<span class="custom-option-header">
<span class="h6 mb-0">Tapa blanda</span>
</span>
@ -56,7 +56,7 @@
<div id="tapaDuraDiv" class="col-sm-3 mb-md-0 mb-2">
<div class="form-check custom-option custom-option-tapa custom-option-basic">
<label class="form-check-label custom-option-content" for="tapaDura">
<input name="tapaDura" class="form-check-input elementos-libro" type="radio" value="" id="tapaDura">
<input name="tapaDura" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="" id="tapaDura">
<span class="custom-option-header">
<span class="h6 mb-0">Tapa Dura</span>
</span>
@ -77,28 +77,28 @@
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?> 1
</label>
<input type="number" id="tirada" name="tirada" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada) ?>">
<input type="number" class="calcular-presupuesto" id="tirada" name="tirada" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada2" class="form-label">
<?= lang('Presupuestos.tirada') ?> 2
</label>
<input type="number" id="tirada2" name="tirada2" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada2) ?>">
<input type="number" class="calcular-presupuesto" id="tirada2" name="tirada2" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada2) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada3" class="form-label">
<?= lang('Presupuestos.tirada') ?> 3
</label>
<input type="number" id="tirada3" name="tirada3" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada3) ?>">
<input type="number" class="calcular-presupuesto" id="tirada3" name="tirada3" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada3) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada4" class="form-label">
<?= lang('Presupuestos.tirada') ?> 4
</label>
<input type="number" id="tirada4" name="tirada4" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada4) ?>">
<input type="number" class="calcular-presupuesto" id="tirada4" name="tirada4" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada4) ?>">
</div><!--//.mb-3 -->
</div> <!--//.row -->
@ -110,7 +110,7 @@
<label for="paginas" class="form-label">
<?= lang('Presupuestos.paginas') ?>
</label>
<input type="number" id="paginas" name="paginas" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->paginas) ?>">
<input type="number" class="calcular-presupuesto" id="paginas" name="paginas" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->paginas) ?>">
</div><!--//.mb-3 -->
</div> <!--//.row -->
@ -122,7 +122,7 @@
Tamaño Libro*
</label>
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelFormatoList) && is_array($datosPresupuesto->papelFormatoList) && !empty($datosPresupuesto->papelFormatoList)) :
foreach ($datosPresupuesto->papelFormatoList as $formato) : ?>
@ -137,14 +137,14 @@
<div id="anchoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>>
<div class="mb-1">
<label class="form-label" for="papelFormatoAncho">Ancho Libro</label>
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="1" class="form-control formato_libro" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="1" class="form-control formato_libro calcular-presupuesto" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div id="altoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>>
<div class="mb-1">
<label class="form-label" for="papelFormatoAlto">Alto Libro</label>
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="1" class="form-control formato_libro" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="1" class="form-control formato_libro calcular-presupuesto" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
@ -173,7 +173,7 @@
<img style="height:120px;width:120px" src="<?= site_url("assets/img/grises.png") ?>" alt="">
</span>
</label>
<input name="colorNegro" class="form-check-input" type="radio" value="colorNegro" id="colorNegro" checked="">
<input name="colorNegro" class="form-check-input calcular-presupuesto" type="radio" value="colorNegro" id="colorNegro" checked="">
</div>
</div>
@ -184,7 +184,7 @@
<img style="height:120px;width:120px" src="<?= site_url("assets/img//gamacolor.png") ?>" alt="">
</span>
</label>
<input name="colorColor" class="form-check-input" type="radio" value="colorColor" id="colorColor">
<input name="colorColor" class="form-check-input calcular-presupuesto" type="radio" value="colorColor" id="colorColor">
</div>
</div>
@ -195,7 +195,7 @@
<label for="paginasColor" class="form-label">
Páginas a color
</label>
<input type="number" id="paginasColor" name="paginasColor" maxLength="8" step="1" class="form-control" value="">
<input type="number" class="calcular-presupuesto" id="paginasColor" name="paginasColor" maxLength="8" step="1" class="form-control" value="">
</div><!--//.mb-3 -->
</div>
@ -205,7 +205,7 @@
<div class="col-sm-3 mb-md-0 mb-2">
<div id="calidadEstandarDiv" class="form-check change-tipo-impresion custom-option custom-option-calidad custom-option-basic checked">
<label class="form-check-label custom-option-content" for="calidadEstandar">
<input name="calidadEstandar" class="form-check-input" type="radio" value="" id="calidadEstandar" checked="">
<input name="calidadEstandar" class="form-check-input calcular-presupuesto" type="radio" value="" id="calidadEstandar" checked="">
<span class="custom-option-header">
<span class="h6 mb-0">Estándar</span>
</span>
@ -215,7 +215,7 @@
<div class="col-sm-3">
<div id="calidadPremiumDiv" class="form-check change-tipo-impresion custom-option custom-option-calidad custom-option-basic">
<label class="form-check-label custom-option-content" for="calidadPremium">
<input name="calidadPremium" class="form-check-input" type="radio" value="" id="calidadPremium">
<input name="calidadPremium" class="form-check-input calcular-presupuesto" type="radio" value="" id="calidadPremium">
<span class="custom-option-header">
<span class="h6 mb-0">Premium</span>
</span>
@ -230,12 +230,12 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelInterior" class="form-label">Tipo de papel</label>
<select id="papelInterior" name="papelInterior" class="form-control select2bs2" style="width: 100%;"></select>
<select id="papelInterior" name="papelInterior" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;"></select>
</div>
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeInterior" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeInterior" name="gramajeInterior" class="form-control select2bs2" style="width: 100%;">
<select id="gramajeInterior" name="gramajeInterior" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
@ -246,7 +246,7 @@
<div class="row">
<div class="col-sm-3 mb-3 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="0" <?= $presupuestoEntity->excluir_rotativa == true ? 'checked' : ''; ?>>
<input class="form-check-input calcular-presupuesto" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="0" <?= $presupuestoEntity->excluir_rotativa == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
</div>
</div>
@ -264,7 +264,7 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelCubierta" class="form-label">Tipo de papel</label>
<select id="papelCubierta" name="papelCubierta" class="form-control select2bs2" style="width: 100%;">
<select id="papelCubierta" name="papelCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelCubierta) && is_array($datosPresupuesto->papelCubierta) && !empty($datosPresupuesto->papelCubierta)) :
foreach ($datosPresupuesto->papelCubierta as $k => $v) : ?>
<option value="<?= $v->id ?>">
@ -277,7 +277,7 @@
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeCubierta" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeCubierta" name="gramajeCubierta" class="form-control select2bs2" style="width: 100%;">
<select id="gramajeCubierta" name="gramajeCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
@ -287,7 +287,7 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="carasCubierta" class="form-label">Caras impresas cubierta</label>
<select id="carasCubierta" name="carasCubierta" class="form-control select2bs2" style="width: 100%;">
<select id="carasCubierta" name="carasCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<option value="2">
<p><?= lang('Presupuestos.unaCara') ?></p>
</option>
@ -306,14 +306,14 @@
<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" type="checkbox" id="solapasCubierta" name="solapasCubierta" value="0">
<input class="form-check-input calcular-presupuesto" type="checkbox" id="solapasCubierta" name="solapasCubierta" value="0">
<label class="form-check-label" for="solapasCubierta">Solapas cubierta</label>
</div>
</div>
<div id="tamanioSolapasCubierta" class="col-sm-3 mb-md-0 mb-2" style="display: none;">
<label for="anchoSolapasCubierta" class="form-label">Tamaño</label>
<input type="number" id="anchoSolapasCubierta" name="anchoSolapasCubierta" maxLength="8" step="1" class="form-control" value="">
<input type="number" id="anchoSolapasCubierta" name="anchoSolapasCubierta" maxLength="8" step="1" class="form-control calcular-presupuesto" value="">
</div>
</div>
@ -322,7 +322,7 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="acabadosCubierta" class="form-label">Acabados cubierta</label>
<select id="acabadosCubierta" name="acabadosCubierta" class="form-control select2bs2" style="width: 100%;">
<select id="acabadosCubierta" name="acabadosCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
foreach ($datosPresupuesto->acabadosCubierta as $acabado) : ?>
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
@ -357,7 +357,7 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelSobrecubierta" class="form-label">Tipo de papel</label>
<select id="papelSobrecubierta" name="papelSobrecubierta" class="form-control select2bs2" style="width: 100%;">
<select id="papelSobrecubierta" name="papelSobrecubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelSobrecubierta) && is_array($datosPresupuesto->papelSobrecubierta) && !empty($datosPresupuesto->papelSobrecubierta)) :
foreach ($datosPresupuesto->papelSobrecubierta as $k => $v) : ?>
<option value="<?= $v->id ?>">
@ -370,7 +370,7 @@
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeSobrecubierta" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeSobrecubierta" name="gramajeSobrecubierta" class="form-control select2bs2" style="width: 100%;">
<select id="gramajeSobrecubierta" name="gramajeSobrecubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
@ -382,14 +382,14 @@
<div class="col-sm-3 mb-md-0 mb-2">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="solapasSobrecubierta" name="solapasSobrecubierta" value="0">
<input class="form-check-input calcular-presupuesto" 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;">
<label for="anchoSolapasSobrecubierta" class="form-label">Tamaño</label>
<input type="number" id="anchoSolapasSobrecubierta" name="anchoSolapasSobrecubierta" maxLength="8" step="1" class="form-control" value="">
<input type="number" id="anchoSolapasSobrecubierta" name="anchoSolapasSobrecubierta" maxLength="8" step="1" class="form-control calcular-presupuesto" value="">
</div>
</div>
@ -398,7 +398,7 @@
<div class="col-sm-4 mb-md-0 mb-2">
<label for="acabadosSobrecubierta" class="form-label">Acabados cubierta</label>
<select id="acabadosSobrecubierta" name="acabadosSobrecubierta" class="form-control select2bs2" style="width: 100%;">
<select id="acabadosSobrecubierta" name="acabadosSobrecubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->acabadosSobrecubierta) && is_array($datosPresupuesto->acabadosSobrecubierta) && !empty($datosPresupuesto->acabadosSobrecubierta)) :
foreach ($datosPresupuesto->acabadosSobrecubierta as $acabado) : ?>
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
@ -422,7 +422,7 @@
<div class="row guardas">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="impresionGuardas" class="form-label">Impresión de guardas</label>
<select id="impresionGuardas" name="impresionGuardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
<select id="impresionGuardas" name="impresionGuardas" class="form-control select2bs2 comp_guardas_items calcular-presupuesto" style="width: 100%;">
<option value="0">
<p><?= lang('Presupuestos.sinImpresion') ?></p>
</option>
@ -439,7 +439,7 @@
<div class="row guardas">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelGuardas" class="form-label">Tipo de papel</label>
<select id="papelGuardas" name="papelGuardas" class="form-control select2bs2" style="width: 100%;">
<select id="papelGuardas" name="papelGuardas" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelGuardas) && is_array($datosPresupuesto->papelGuardas) && !empty($datosPresupuesto->papelGuardas)) :
foreach ($datosPresupuesto->papelGuardas as $k => $v) : ?>
<option value="<?= $v->id ?>">
@ -465,7 +465,7 @@
<div class="mb-3">
<div class="form-check">
<label for="retractilado" class="form-check-label">
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.retractilado') ?>
</label>
</div><!--//.form-check -->
@ -476,7 +476,7 @@
<div class="mb-3">
<div class="form-check">
<label for="retractilado5" class="form-check-label">
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.retractilado5') ?>
</label>
</div><!--//.form-check -->
@ -488,7 +488,7 @@
<div class="mb-3">
<div class="form-check">
<label for="fajaColor" class="form-check-label">
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.fajaColor') ?>
</label>
</div><!--//.form-check -->
@ -499,7 +499,7 @@
<div class="mb-3">
<div class="form-check">
<label for="prototipo" class="form-check-label">
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.prototipo') ?>
</label>
</div><!--//.form-check -->
@ -513,7 +513,7 @@
<div class="mb-3">
<div class="form-check">
<label for="ferro" class="form-check-label">
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.ferro') ?>
</label>
</div><!--//.form-check -->
@ -525,7 +525,7 @@
<div class="mb-3">
<div class="form-check">
<label for="ferroDigital" class="form-check-label">
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input" <?= $presupuestoEntity->ferro_digital == true ? 'checked' : ''; ?>>
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->ferro_digital == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.ferroDigital') ?>
</label>
</div><!--//.form-check -->
@ -536,7 +536,7 @@
<div class="mb-3">
<div class="form-check">
<label for="marcapaginas" class="form-check-label">
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input" <?= $presupuestoEntity->marcapaginas == true ? 'checked' : ''; ?>>
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->marcapaginas == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.marcapaginas') ?>
</label>
</div><!--//.form-check -->
@ -554,7 +554,7 @@
<div class="row">
<div class="col-sm-2 mb-md-0 mb-2">
<label for="ivaReducido" class="form-label">I.V.A. reducido</label>
<select id="ivaReducido" name="ivaReducido" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
<select id="ivaReducido" name="ivaReducido" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<option value="1">
<p><?= lang('SI') ?></p>
</option>

View File

@ -1,77 +1,100 @@
<div class="col-12 pb-2">
<div class="row row-cols-3 mb-6 d-flex justify-content-center d-flex justify-content-center">
<div class="tipo_libro">
<div class="row row-cols-3 mb-6 d-flex justify-content-center d-flex justify-content-center">
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="cosidoDiv" class="form-check checked custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content" for="tipoCosido">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;" src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
</span>
</label>
<input name="cosido" class="form-check-input elementos-libro" type="radio" value="tipoCosido" id="tipoCosido" checked="">
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="cosidoDiv"
class="form-check checked custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoCosido">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
</span>
</label>
<input name="cosido" class="form-check-input elementos-libro" type="radio" value="tipoCosido"
id="tipoCosido" checked="">
</div>
<h4 class="text-center">Rústica cosido</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="fresadoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoFresado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
</span>
</label>
<input name="fresado" class="form-check-input elementos-libro" type="radio" value="tipoFresado"
id="tipoFresado">
</div>
<h4 class="text-center">Rústica fresado</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="grapadoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoGrapado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
</span>
</label>
<input name="grapado" class="form-check-input elementos-libro" type="radio" value="tipoGrapado"
id="tipoGrapado">
</div>
<h4 class="text-center">Cosido con grapas</h4>
</div>
<h4 class="text-center">Rústica cosido</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="fresadoDiv" class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content" for="tipoFresado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;" src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
</span>
</label>
<input name="fresado" class="form-check-input elementos-libro" type="radio" value="tipoFresado" id="tipoFresado">
<div class="row row-cols-3 d-flex justify-content-center 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="espiralDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoEspiral">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
</span>
</label>
<input name="espiral" class="form-check-input elementos-libro" type="radio" value="tipoEspiral"
id="tipoEspiral">
</div>
<h4 class="text-center">Espiral</h4>
</div>
<h4 class="text-center">Rústica fresado</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="grapadoDiv" class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content" for="tipoGrapado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;" src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
</span>
</label>
<input name="grapado" class="form-check-input elementos-libro" type="radio" value="tipoGrapado" id="tipoGrapado">
<div class="col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<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">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoWireO">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
</span>
</label>
<input name="wireo" class="form-check-input elementos-libro" type="radio" value="tipoWireO"
id="tipoWireO">
</div>
<h4 class="text-center">Wire-o</h4>
</div>
<h4 class="text-center">Cosido con grapas</h4>
</div>
</div>
</div>
<div class="row row-cols-3 d-flex justify-content-center 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="espiralDiv" class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content" for="tipoEspiral">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;" src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
</span>
</label>
<input name="espiral" class="form-check-input elementos-libro" type="radio" value="tipoEspiral" id="tipoEspiral">
</div>
<h4 class="text-center">Espiral</h4>
</div>
</div>
<div class="col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<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">
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content" for="tipoWireO">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;" src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
</span>
</label>
<input name="wireo" class="form-check-input elementos-libro" type="radio" value="tipoWireO" id="tipoWireO">
</div>
<h4 class="text-center">Wire-o</h4>
</div>
</div>
</div>
</div>

View File

@ -4,6 +4,7 @@ $('#papelFormatoPersonalizado').on('change', function()
$('#tamanioLibroDiv').hide();
$('#anchoLibroDiv').show();
$('#altoLibroDiv').show();
$('#papelFormatoId').val('');
} else {
$('#tamanioLibroDiv').show();
$('#anchoLibroDiv').hide();
@ -154,8 +155,10 @@ function initDisenioLibro(){
$('.change-tipo-impresion').trigger('change');
$('#papelInterior').trigger('change');
$('#papelCubierta').trigger('change');
$('#papelSobrecubierta').trigger('change');
$('#papelCubierta').val('').trigger('change');
$('#papelSobrecubierta').val('').trigger('change');
$('#enableSobrecubierta').trigger('change');
}
@ -248,7 +251,6 @@ $('#papelInterior').on('change', function() {
$('#gramajeInterior').empty();
$(response.menu).each(function( index, element ) {
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
});
@ -347,4 +349,69 @@ $('#solapasSobrecubierta').on('change', function() {
} else {
$('#tamanioSolapasSobrecubierta').hide();
}
});
});
// Funcion que comprueba que están rellenos todos los datos necesarios para calcular el presupuesto
function checkValues(){
const tirada = $('#tirada').val();
const paginas = $('#paginas').val();
const papelInterior = $('#papelInterior option:selected').val();
const gramajeInterior = $('#gramajeInterior option:selected').text();
const papelCubierta = $('#papelCubierta option:selected').val();
const gramajeCubierta = $('#gramajeCubierta option:selected').text();
const papelFormatoAlto = $('#altoLibro').val();
const papelFormatoAncho = $('#anchoLibro').val();
if(tirada == '' || isNaN(tirada) || parseInt(tirada) <= 0){
return false;
}
if(paginas == '' || isNaN(paginas) || parseInt(paginas) <= 0){
return false;
}
if(papelInterior == '' || gramajeInterior == ''){
return false;
}
if(papelCubierta == '' || gramajeCubierta == ''){
return false;
}
if($('#papelFormatoId').val() == '' ||
($('#papelFormatoPersonalizado').is(':checked') &&
((papelFormatoAncho == '' || isNaN(papelFormatoAncho) || parseInt(papelFormatoAncho) <= 0) ||
(papelFormatoAlto == '' || isNaN(papelFormatoAlto) || parseInt(papelFormatoAlto) <= 0) )
)){
return false;
}
return true;
}
$('.calcular-presupuesto').on('change', function() {
calcularPresupuesto();
});
async function calcularPresupuesto(){
if(!checkValues()){
return;
}
var datos = {
tirada: $('#tirada').val(),
merma: $('#merma').val(),
uso: 'colorhq',
papelInterior: $('#papelInterior option:selected').text(),
gramajeInterior: $('#gramajeInterior option:selected').text(),
papelCubierta: $('#papelCubierta option:selected').text(),
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
papelSobrecubierta: $('#papelSobrecubierta option:selected').text(),
gramajeSobrecubierta: $('#gramajeSobrecubierta option:selected').text(),
}
}

View File

@ -120,24 +120,23 @@
gramajeInterior: {
validators: {
callback: {
message: window.Presupuestos.validation.tirada_no_valida,
callback: function (input) {
const value = $("#tirada").val();
if ($('#gramajeInterior option:selected').text().length == 0) {
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
if(value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0){
return {
valid: false,
message: window.Presupuestos.validation.sin_gramaje,
}
}
return {
valid: value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0,
message: window.Presupuestos.validation.tirada_no_valida,
}
}
return true;
},
},
callback: {
message: window.Presupuestos.validation.sin_gramaje,
callback: function (input) {
if ($('#gramajeInterior option:selected').text().length == 0) {
return false;
}
return true;
},
}
}
},
gramajeCubierta: {

View File

@ -20,7 +20,7 @@ function updateTipoLibroCheck(el)
if (el.checked) {
// If custom option element is radio, remove checked from the siblings (closest `.row`)
if (el.type === 'radio') {
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tipo'))
const customRadioOptionList = [].slice.call(el.closest('.tipo_libro').querySelectorAll('.custom-option-tipo'))
customRadioOptionList.map(function (customRadioOptionEL) {
customRadioOptionEL.closest('.custom-option-tipo').classList.remove('checked')
})

3029
xdebug.log

File diff suppressed because it is too large Load Diff