trbajando en los custom checks

This commit is contained in:
2024-10-05 19:17:52 +02:00
parent 13e3a69cd6
commit cece606bb1
25 changed files with 1801 additions and 80 deletions

View File

@ -26,8 +26,12 @@ return [
"global_inactive" => "Inactivo",
"global_copy" => "Dupdo",
"global_print" => "Impresión",
"global_print2" => "Imprimir",
"global_confirm" => "Confirmar",
"global_excel" => "Excel",
"global_pdf" => "PDF",
"global_prev" => "Anterior",
"global_next" => "Siguiente",
// LOGIN - Index
"login_title" => "Iniciar sesión en su cuenta",

View File

@ -63,7 +63,6 @@ return [
'isbn' => 'ISBN',
'referenciaCliente' => 'Referencia del cliente',
'referenciaCliente2' => 'Referencia',
'formatoLibro' => "Formato libro",
'papelFormatoId' => "Tamaño",
'papelFormatoPersonalizado' => 'Tamaño personalizado',
'papelFormatoAncho' => 'Ancho',
@ -83,6 +82,8 @@ return [
'tipoImpresion' => 'Tipo de impresión',
'papelesComparadorCosidoTapaBlanda' => 'Papeles interior y cubierta',
'posicionPagColor' => 'Posición páginas a color',
'papelDiferente' => 'Papel color y negro diferente',
'paginasColorConsecutivas' => 'Páginas color consecutivas',
'colorPageInstructions' => 'Introduzca la posición de las páginas a color dentro del libro. Ej: 3,5,7 ó 4-10,20,155',
'numeroPaginas' => 'Nº Páginas',
'papel' => 'Papel',
@ -216,6 +217,11 @@ return [
'totalAceptado' => 'Total aceptado',
// Placeholders
'formatoLibro' => "Formato libro",
'selectCliente' => "Seleccione cliente",
// Preview
'preview' => 'Previsualización de configuraciones',
'preview-conf-bn' => 'Configuración Blanco y Negro',
@ -306,6 +312,11 @@ return [
'no_lp_for_merma' => 'Inserte líneas de presupuesto para calcular la merma',
'ejemplares_envio' => 'El número de ejemplares enviados no coincide con la tirada',
'cliente' => 'Debe seleccionar un cliente',
'papelFormato' => 'Seleccione un formato',
'tipo_libro' => 'Seleccione un tipo de libro',
'disenio_interior' => 'Seleccione el diseño del interior',
'papel_interior' => 'Seleccione el tipo de papel',
'gramaje_interior' => 'Seleccione el gramaje',
'pais' => 'Debe seleccionar un país',
'integer_greatherThan_0' => 'Número entero > 0 requerido',
'tirada_no_valida' => "Tirada no valida",

View File

@ -0,0 +1,30 @@
<div class="col-12" style="min-height: 50px;">
<div id="btnsDiv" class="d-flex w-100 position-relative" style="margin-top: 40px;">
<div class="me-auto">
<div id="btnPrint" class="btn mt-3 btn-secondary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_print2') ?></span>
</div>
</div>
<div class="position-absolute start-50 translate-middle-x">
<div id="btnPrev" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_prev') ?></span>
</div>
<div id="btnNext" class="btn mt-3 btn-primary waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_next') ?></span>
</div>
</div>
<div class="ms-auto">
<div id="btnConfirm" class="btn mt-3 btn-success waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_confirm') ?></span>
</div>
<div id="btnSave" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_save') ?></span>
</div>
</div>
</div>
</div>

View File

@ -1,6 +1,5 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<label for="titulo" class="form-label">
<?= lang('Presupuestos.titulo') ?>*
@ -9,63 +8,72 @@
</div><!--//.mb-3 -->
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
<label id="label_clienteId" for="clienteId" class="form-label">
Cliente*
</label>
<select id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
<div class="row col-sm-10 mb-3 justify-content-center">
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?> 1
<?= lang('Presupuestos.tirada') ?> 1*
</label>
<input type="number" class="calcular-presupuesto form-control text-center" id="tirada" name="tirada" step="1" value="">
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada" name="tirada" step="1" value="50">
</div><!--//.mb-3 -->
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada2" class="form-label">
<?= lang('Presupuestos.tirada') ?> 2
</label>
<input type="number" class="calcular-presupuesto form-control text-center" id="tirada2" name="tirada2" step="1" value="">
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada2" name="tirada2" step="1" value="">
</div><!--//.mb-3 -->
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada3" class="form-label">
<?= lang('Presupuestos.tirada') ?> 3
</label>
<input type="number" class="calcular-presupuesto form-control text-center" id="tirada3" name="tirada3" step="1" value="">
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada3" name="tirada3" step="1" value="">
</div><!--//.mb-3 -->
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada4" class="form-label">
<?= lang('Presupuestos.tirada') ?> 4
</label>
<input type="number" class="calcular-presupuesto form-control text-center" id="tirada4" name="tirada4" step="1" value="">
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada4" name="tirada4" step="1" value="">
</div><!--//.mb-3 -->
</div> <!--//.row -->
<div class="col-sm-10 d-flex flex-column align-items-center justify-content-center">
<div class="col-sm-4 mb-1 d-flex flex-column align-items-center">
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
Formato Libro*
</label>
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
<div id="formatoPersonalizado" class="row col-sm-8 justify-content-center" style="display: none;">
<div class="col-sm-3 mb-1 mx-1">
<label class="form-label" for="papelFormatoAncho">Ancho Libro</label>
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" step="1" class="form-control formato_libro calcular-presupuesto" value="">
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" step="1" class="form-control formato_libro calcular-presupuesto num-input" min="60" value="60">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-1 mx-1">
<label class="form-label" for="papelFormatoAlto">Alto Libro</label>
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" step="1" class="form-control formato_libro calcular-presupuesto" value="">
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" step="1" class="form-control formato_libro calcular-presupuesto num-input" min="60" value="60">
</div><!--//.mb-3 -->
</div>
<div class="row col-sm-4 mb-3 d-flex flex-column align-items-center">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" >
<input class="calcular-presupuesto form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1">
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div>
@ -74,67 +82,95 @@
<div class="row col-sm-10 mb-5 justify-content-center">
<div class="col-sm-3">
<label for="paginasColor" class="form-label">
<?= lang('Presupuestos.paginasColor') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas" id="paginasColor" name="paginasColor" step="1" value="0">
<div class="form-text">
Siempre deben ser pares
<div class="row justify-content-center">
<div class="col-sm-3">
<label for="paginasColor" class="form-label">
<?= lang('Presupuestos.paginasColor') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasColor" name="paginasColor" step="1" value="0">
<div class="form-text">
Siempre deben ser pares
</div>
</div>
</div>
<div class="col-sm-3">
<label for="paginasNegro" class="form-label">
<?= lang('Presupuestos.paginasNegro') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas" id="paginasNegro" name="paginasNegro" step="1" value="32">
<div class="col-sm-3">
<label for="paginasNegro" class="form-label">
<?= lang('Presupuestos.paginasNegro') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasNegro" name="paginasNegro" step="1" value="32">
<div class="form-text">
Siempre deben ser pares
</div>
<div class="form-text">
Siempre deben ser pares
</div>
<div class="col-sm-3">
<label for="paginas" class="form-label">
<?= lang('Presupuestos.totalPaginas') ?>
</label>
<input readonly class="form-control calcular-presupuesto" id="paginas" name="paginas" step="1" value="32">
</div>
</div>
<div class="col-sm-3">
<label for="paginas" class="form-label">
<?= lang('Presupuestos.totalPaginas') ?>
</label>
<input readonly class="form-control calcular-presupuesto" id="paginas" name="paginas" step="1" value="32">
<div class="row mt-2 justify-content-center">
<div id="divPaginasColorConsecutivas" class="form-check col-sm-9 form-switch mb-2 d-none">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="pagColorConsecutivas" name="pag_color_consecutivas" value="1">
<label class="form-check-label" for="pagColorConsecutivas"><?= lang('Presupuestos.paginasColorConsecutivas') ?></label>
</div>
<div id="divPosPaginasColor" class="col-sm-9 d-none">
<label for="posPaginasColor" class="form-label">
<?= lang('Presupuestos.posicionPagColor') ?>
</label>
<input class="form-control calcular-presupuesto" id="posPaginasColor" name="pos_paginas_color" value="">
<div class="form-text">
Intruzca la posición separada por comas. Ej: 3,5,7 ó 4-10,20,155
</div>
</div>
</div>
<div class="row mt-2 justify-content-center">
<div id="divPapelDiferente" class="form-check col-sm-9 form-switch mb-2 d-none">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="papelDiferente" name="papel_diferente" value="1">
<label class="form-check-label" for="papelDiferente"><?= lang('Presupuestos.papelDiferente') ?></label>
</div>
</div>
</div>
<div class="row col-sm-10 mb-3 justify-content-center">
<div id="divTipoLibro" name="div_tipo_libro" class="row col-sm-10 mb-3 justify-content-center">
<div id="fresado" class="tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>" alt="Fresado">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>" alt="Fresado">
<div class="form-text text-center">
Fresado (a partir de 32 páginas)
</div>
</div>
<div id="grapado" class="tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>" alt="Grapado">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>" alt="Grapado">
<div class="form-text text-center">
Grapado (entre 12 y 40 páginas)
</div>
</div>
<div id="espiral" class="tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>" alt="Espiral">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>" alt="Espiral">
<div class="form-text text-center">
Espiral
</div>
</div>
<div id="cosido" class="tipo-libro imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>" alt="Cosido">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>" alt="Cosido">
<div class="form-text text-center">
Cosido (a partir de 32 páginas)
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,202 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Diseño cubierta </h3>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-5 d-flex flex-column align-items-center">
<h6 class="mb-1 text-center"> Recuerde que la cubierta es el conjunto formado por la portada, contraportada, lomo y solapas, en caso de que las lleve. </h6>
</div><!--//.mb-3 -->
<div id="divTipoCubierta" name="div_tipo_cubierta" class="row col-sm-10 mb-5 justify-content-center">
<div id="tapaBlanda" class="d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/tapa-blanda.jpg") ?>" alt="TapaBlanda">
<label class="form-label">
Tapa blanda
</label>
</div>
<div id="tapaDura" class="d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/tapa-dura-lomo-recto.jpg") ?>" alt="TapaDura">
<label class="form-label">
Tapa dura lomo recto
</label>
</div>
<div id="tapaDuraLomoRedondo" class="d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/tapa-dura-lomo-redondo.png") ?>" alt="TapaDuraLomoRedondo">
<label class="form-label">
Tapa dura lomo redondo
</label>
</div>
</div>
<div id="divSolapasCubierta" name="div_solapas_cubierta" class="row col-sm-10 mb-5 justify-content-center">
<div id="solapasCubiertaNo" class="d-flex flex-column align-items-center justify-content-center solapas-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/sinSolapasCubierta.png") ?>" alt="Sin solapas">
<label class="form-label">
Sin solapas
</label>
</div>
<div id="solapasCubiertaNo" class="d-flex flex-column align-items-center justify-content-center solapas-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/conSolapasCubierta.png") ?>" alt="Con solapas">
<label class="form-label">
Con solapas
</label>
</div>
<div class="d-flex flex-column align-items-center justify-content-center imagen-selector image-container">
<label for="tirada2" class="form-label">
Tamaño solapas
</label>
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="solapasCubierta" name="solapas_cubierta" step="1" value="50">
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Papel interior </h3>
</div><!--//.mb-3 -->
<div id="divPapelCubierta" name="div_papel_cubierta" class="row col-sm-10 mb-3 justify-content-center">
<div id="offsetBlanco" class="d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
<label for="titulo" class="form-label">
Offset Blanco
</label>
</div>
<div id="offsetAhuesado" class="d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
<label for="titulo" class="form-label">
Offset Ahuesado
</label>
</div>
<div id="offsetAhuesadoVolumen" class="d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
<label for="titulo" class="form-label">
Offset Ahuesado Volumen
</label>
</div>
<div id="estucadoMate" class="d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
<label for="titulo" class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeCubierta" name="div_gramaje_cubierta" class="row col-sm-10 mb-3 justify-content-center">
<div class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje70">
<span class="custom-option-body">
<span class="custom-option-title"> 70 gr </span>
</span>
<input id="gramaje70" name="customRadioIcon" data-value="70" class="form-check-input" type="radio" value="" checked />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje80">
<span class="custom-option-body">
<span class="custom-option-title"> 80 gr </span>
</span>
<input id="gramaje80" name="customRadioIcon" data-value="80" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="mb-md-0 mb-2 checkbox-presupuesto-container">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje90">
<span class="custom-option-body">
<span class="custom-option-title"> 90 gr </span>
</span>
<input id="gramaje90" name="customRadioIcon" data-value="90" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje100">
<span class="custom-option-body">
<span class="custom-option-title"> 100 gr </span>
</span>
<input id="gramaje100" name="customRadioIcon" data-value="100" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje115">
<span class="custom-option-body">
<span class="custom-option-title"> 115 gr </span>
</span>
<input id="gramaje115" name="customRadioIcon" data-value="115" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje120">
<span class="custom-option-body">
<span class="custom-option-title"> 120 gr </span>
</span>
<input id="gramaje120" name="customRadioIcon" data-value="120" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje135">
<span class="custom-option-body">
<span class="custom-option-title"> 135 gr </span>
</span>
<input id="gramaje135" name="customRadioIcon" data-value="135" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje150">
<span class="custom-option-body">
<span class="custom-option-title"> 150 gr </span>
</span>
<input id="gramaje150" name="customRadioIcon" data-value="150" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div class="checkbox-presupuesto-container mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje170">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170" name="customRadioIcon" data-value="170" class="form-check-input" type="radio" value="" />
</label>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,351 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h5 class="mb-1 fw-bold titulo"></h5>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Impresión interior </h3>
</div><!--//.mb-3 -->
<div id="divImpresionInterior" name="div_impresion_interior" class="row col-sm-10 mb-3 justify-content-center">
<div id="negroEstandar" class="d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/blancoYnegro.png") ?>" alt="Negro">
<label for="titulo" class="form-label">
Blanco y Negro
</label>
</div>
<div id="negroPremium" class="d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/negroFoto.png") ?>" alt="NegroPremium">
<label for="titulo" class="form-label">
Blanco y Negro Premium
</label>
</div>
<div id="colorEstandar" class="d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/color.png") ?>" alt="Color">
<label for="titulo" class="form-label">
Color
</label>
</div>
<div id="colorPremium" class="d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/colorFoto.png") ?>" alt="ColorPremium">
<label for="titulo" class="form-label">
Color Premium
</label>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Papel interior </h3>
</div><!--//.mb-3 -->
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-5 justify-content-center">
<div id="offsetBlanco" class="d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
<label for="titulo" class="form-label">
Offset Blanco
</label>
</div>
<div id="offsetAhuesado" class="d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
<label for="titulo" class="form-label">
Offset Ahuesado
</label>
</div>
<div id="offsetAhuesadoVolumen" class="d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
<label for="titulo" class="form-label">
Offset Ahuesado Volumen
</label>
</div>
<div id="estucadoMate" class="d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
<label for="titulo" class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
<div id="interiorGramaje70" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje70">
<span class="custom-option-body">
<span class="custom-option-title"> 70 gr </span>
</span>
<input id="gramaje70" name="customRadioGramaje" data-value="70" class="check-interior-gramaje form-check-input" type="radio" value="" checked />
</label>
</div>
</div>
<div id="interiorGramaje80" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje80">
<span class="custom-option-body">
<span class="custom-option-title"> 80 gr </span>
</span>
<input id="gramaje80" name="customRadioGramaje" data-value="80" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje90" class="mb-md-0 mb-3 checkbox-presupuesto-container">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje90">
<span class="custom-option-body">
<span class="custom-option-title"> 90 gr </span>
</span>
<input id="gramaje90" name="customRadioGramaje" data-value="90" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje100" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje100">
<span class="custom-option-body">
<span class="custom-option-title"> 100 gr </span>
</span>
<input id="gramaje100" name="customRadioGramaje" data-value="100" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje115" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje115">
<span class="custom-option-body">
<span class="custom-option-title"> 115 gr </span>
</span>
<input id="gramaje115" name="customRadioGramaje" data-value="115" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje120" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje120">
<span class="custom-option-body">
<span class="custom-option-title"> 120 gr </span>
</span>
<input id="gramaje120" name="customRadioGramaje" data-value="120" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje135" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje135">
<span class="custom-option-body">
<span class="custom-option-title"> 135 gr </span>
</span>
<input id="gramaje135" name="customRadioGramaje" data-value="135" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje150" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje150">
<span class="custom-option-body">
<span class="custom-option-title"> 150 gr </span>
</span>
<input id="gramaje150" name="customRadioGramaje" data-value="150" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje170" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje170">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170" name="customRadioGramaje" data-value="170" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
</div>
<div class="col-sm-8 mb-3 mt-10 d-flex flex-column align-items-center interior-color d-none">
<h3 class="mb-1 fw-bold"> Impresión interior color</h3>
</div><!--//.mb-3 -->
<div id="divImpresionInteriorColor" name="div_impresion_interior_color" class="row col-sm-10 mb-3 justify-content-center interior-color d-none">
<div id="colorEstandarColor" class="d-flex flex-column align-items-center justify-content-center disenio-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/color.png") ?>" alt="Color">
<label for="titulo" class="form-label">
Color
</label>
</div>
<div id="colorPremiumColor" class="d-flex flex-column align-items-center justify-content-center disenio-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/colorFoto.png") ?>" alt="ColorPremium">
<label for="titulo" class="form-label">
Color Premium
</label>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center interior-color d-none">
<h3 class="mb-1 fw-bold"> Papel interior color</h3>
</div><!--//.mb-3 -->
<div id="divPapelInteriorColor" name="div_papel_interior_color" class="row col-sm-10 mb-5 interior-color justify-content-center interior-color d-none">
<div id="offsetBlancoColor" class="d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
<label class="form-label">
Offset Blanco
</label>
</div>
<div id="offsetAhuesadoColor" class="d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
<label for="titulo" class="form-label">
Offset Ahuesado
</label>
</div>
<div id="offsetAhuesadoVolumenColor" class="d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
<label class="form-label">
Offset Ahuesado Volumen
</label>
</div>
<div id="estucadoMateColor" class="d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
<label class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeInteriorColor" name="div_gramaje_interior_color" class="row col-sm-10 mb-3 justify-content-center d-none">
<div id="interiorGramaje70Color" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje70">
<span class="custom-option-body">
<span class="custom-option-title"> 70 gr </span>
</span>
<input id="gramaje70Color" name="customRadioGramajeColor" data-value="70" class="check-interior-color-gramaje form-check-input" type="radio" value="" checked />
</label>
</div>
</div>
<div id="interiorGramaje80Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje80">
<span class="custom-option-body">
<span class="custom-option-title"> 80 gr </span>
</span>
<input id="gramaje80Color" name="customRadioGramajeColor" data-value="80" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje90Color" class="mb-md-0 mb-3 checkbox-presupuesto-container">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje90">
<span class="custom-option-body">
<span class="custom-option-title"> 90 gr </span>
</span>
<input id="gramaje90Color" name="customRadioGramajeColor" data-value="90" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje100Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje100">
<span class="custom-option-body">
<span class="custom-option-title"> 100 gr </span>
</span>
<input id="gramaje100Color" name="customRadioGramajeColor" data-value="100" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje115Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje115">
<span class="custom-option-body">
<span class="custom-option-title"> 115 gr </span>
</span>
<input id="gramaje115Color" name="customRadioGramajeColor" data-value="115" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje120Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje120">
<span class="custom-option-body">
<span class="custom-option-title"> 120 gr </span>
</span>
<input id="gramaje120Color" name="customRadioGramajeColor" data-value="120" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje135Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje135">
<span class="custom-option-body">
<span class="custom-option-title"> 135 gr </span>
</span>
<input id="gramaje135Color" name="customRadioGramajeColor" data-value="135" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje150Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje150">
<span class="custom-option-body">
<span class="custom-option-title"> 150 gr </span>
</span>
<input id="gramaje150Color" name="customRadioGramajeColor" data-value="150" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje170Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon">
<label class="form-check-label custom-option-content" for="gramaje170">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170Color" name="customRadioGramajeColor" data-value="170" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
</div>

View File

@ -23,34 +23,74 @@
<div class="step active" data-target="#datos-generales">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
<span class="bs-stepper-circle"><i class="ti ti-info-circle ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Datos generales</span>
</span>
</button>
</div>
<div class="step" data-target="#interior-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Interior</span>
</span>
</button>
</div>
<div class="step" data-target="#cubierta-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-books ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Cubierta</span>
</span>
</button>
</div>
<div class="line"></div>
</div>
</div> <!--//.bs-stepper-header -->
<div class="bs-stepper-content">
<form id="presupuesto-cliente-form" onsubmit="return false">
<!-- Tipo Libro -->
<div id="datos-generales" class="content active" dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div id="datos-generales" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_datosGenerales") ?>
<?= view("themes/vuexy/form/presupuestos/cliente/items/_datosGenerales") ?>
</div>
</div>
<div id="interior-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioInterior") ?>
</div>
</div>
<div id="cubierta-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta") ?>
</div>
</div>
<?= view("themes/vuexy/form/presupuestos/cliente/items/_buttons") ?>
</form>
</div>
</div><!--//.col -->
<?= view("themes/vuexy/components/chat_presupuesto",data:["modelId" => $presupuestoEntity->id]) ?>
</div><!--//.wizard -->
<div id="form_buttons" class="row col-sm-12 justify-content-center" style="display: none;">
</div>
<?php //<?= view("themes/vuexy/components/chat_presupuesto", data: ["modelId" => $presupuestoEntity->id]) ?> */?>
</div><!--//.row -->
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
@ -72,7 +112,7 @@
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/bs-stepper/bs-stepper.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
@ -81,6 +121,6 @@
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<script type="module" src="<?= site_url('assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js') ?>"></script>
<?= $this->endSection() ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

View File

@ -3,48 +3,306 @@ import ClassSelect from '../../components/select2.js';
class DatosGenerales {
constructor(domItem) {
constructor(domItem, wizardForm, validatorStepper) {
this.domItem = domItem;
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/menuitems', window.translations["formatoLibro"]);
this.wizardStep = wizardForm.querySelector('#datos-generales');
this.validatorStepper = validatorStepper;
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/menuitems', window.translations["formatoLibro"]);
this.cliente = new ClassSelect($("#clienteId"), '/clientes/cliente/menuitems', window.translations["selectCliente"]);
this.titulo = this.domItem.find("#titulo");
this.checkFormatoPersonalizado = this.domItem.find("#papelFormatoPersonalizado");
this.formatoPersonalizado = this.domItem.find("#formatoPersonalizado");
this.anchoPersonalizado = this.domItem.find("#papelFormatoAncho");
this.altoPersonalizado = this.domItem.find("#papelFormatoAlto");
this.tiposLibro = this.domItem.find(".tipo-libro");
this.paginas = this.domItem.find("#paginas");
this.paginasNegro = this.domItem.find("#paginasNegro");
this.paginasColor = this.domItem.find("#paginasColor");
this.divPaginasColorConsecutivas = this.domItem.find("#divPaginasColorConsecutivas");
this.pagColorConsecutivas = this.domItem.find("#pagColorConsecutivas");
this.divPapelDiferente = this.domItem.find("#divPapelDiferente");
this.papelDiferente = this.domItem.find("#papelDiferente");
this.divPosPaginasColor = this.domItem.find("#divPosPaginasColor");
this.posPaginasColor = this.domItem.find("#posPaginasColor");
this.initValidation();
}
init() {
// Selects
this.formatoLibro.init();
this.cliente.init();
// Eventos
this.checkFormatoPersonalizado.bind('change', this.#handleFormatoLibro.bind(this));
this.tiposLibro.on('click', this.#handleTipolibro.bind(this));
this.tiposLibro.on('click', this.#handleTipolibro.bind(this));
this.domItem.find('.input-paginas').on('change', this.#handlePaginas.bind(this));
this.anchoPersonalizado.on('blur', this.#handleCheckFormatoPersonalizado.bind(this));
this.altoPersonalizado.on('blur', this.#handleCheckFormatoPersonalizado.bind(this));
this.pagColorConsecutivas.on('change', this.#handPaginasConsecutivas.bind(this));
this.papelDiferente.on('change', this.#handlePapelDiferente.bind(this));
this.titulo.on('change', () => { $(".titulo").html(this.titulo.val()); });
this.papelDiferente.on('change', () => { $(".titulo").html(this.titulo.val()); });
}
initValidation() {
const stepper = this.validatorStepper;
this.formValidation = FormValidation.formValidation(this.wizardStep, {
fields: {
titulo: {
validators: {
notEmpty: {
message: window.translations["validation"].requerido_short
},
}
},
cliente_id: {
validators: {
callback: {
message: window.translations["validation"].cliente,
callback: function (input) {
// Get the selected options
const options = $("#clienteId").select2('data');
const hasValidOption = options.some(option => parseInt(option.id) > 0);
return options !== null && options.length > 0 && hasValidOption;
},
}
}
},
tirada: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
const value = $("#tirada").val();
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
tirada2: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
let field = $("#tirada2");
field.val(field.val().replace(/[^0-9]/g, ''));
let value = field.value;
if (value == '')
return true;
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
tirada3: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
let field = $("#tirada3");
field.val(field.val().replace(/[^0-9]/g, ''));
let value = field.value;
if (value == '')
return true;
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
tirada4: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
let field = $("#tirada4");
field.val(field.val().replace(/[^0-9]/g, ''));
let value = field.value;
if (value == '')
return true;
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
papel_formato_id: {
validators: {
callback: {
message: window.translations["validation"].papelFormato,
callback: function (input) {
// Get the selected options
const options = $("#clienteId").select2('data');
const hasValidOption = options.some(option => parseInt(option.id) > 0);
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
if (custom_format)
return true;
return options !== null && options.length > 0 && hasValidOption;
},
}
}
},
papel_formato_ancho: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
// Get the selected options
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
if (!custom_format)
return true;
const value = $("#papelFormatoAncho").val();
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
papel_formato_alto: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
// Get the selected options
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
if (!custom_format)
return true;
const value = $("#papelFormatoAlto").val();
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
paginasColor: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
// Get the selected options
const value = $("#paginasColor").val();
return value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0;
},
}
}
},
paginasNegro: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
// Get the selected options
const value = $("#paginasNegro").val();
return value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0;
},
}
}
},
paginas: {
validators: {
callback: {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
// Get the selected options
const value = $("#paginas").val();
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
},
}
}
},
div_tipo_libro: {
validators: {
callback: {
callback: function (input) {
const divTipoLibro = $('#divTipoLibro'); // Selecciona el div
divTipoLibro.find('.fv-plugins-message-container').remove();
if ($('.tipo-libro.selected').length > 0) {
return true;
}
else {
divTipoLibro.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].tipo_libro}
</div>
</div>
`);
}
return false;
},
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap5: new FormValidation.plugins.Bootstrap5({
// Use this for enabling/changing valid/invalid class
// eleInvalidClass: '',
eleValidClass: '',
rowSelector: function (field, ele) {
// field is the field name
// ele is the field element
switch (field) {
case 'div_tipo_libro':
return '.col-sm-10';
case 'titulo':
return '.col-sm-8';
case 'cliente_id':
return '.col-sm-5';
case 'papel_formato_id':
return '.col-sm-4';
case 'papel_formato_ancho':
case 'papel_formato_ancho':
return '.col-sm-3';
case 'tirada':
case 'tirada2':
case 'tirada3':
case 'tirada4':
return '.col-sm-2';
default:
return '.col-sm-3';
}
}
}),
autoFocus: new FormValidation.plugins.AutoFocus(),
submitButton: new FormValidation.plugins.SubmitButton()
}
}).on('core.form.valid', () => {
stepper.next();
});
}
#handleFormatoLibro() {
if(this.checkFormatoPersonalizado.is(':checked')) {
if (this.checkFormatoPersonalizado.is(':checked')) {
this.formatoLibro.hide();
this.formatoPersonalizado.show();
this.formValidation.revalidateField('papel_formato_id');
}
else{
else {
this.formatoLibro.show();
this.formatoPersonalizado.hide();
this.formValidation.revalidateField('papel_formato_ancho');
this.formValidation.revalidateField('papel_formato_alto');
}
}
#handleTipolibro(event) {
// Accede al ID del elemento que disparó el evento
const element = $(event.target);
let containers = element.closest('.tipo-libro').parent().find('.tipo-libro');
for (let container of containers) {
if (container != element.closest('.tipo-libro')[0]) {
@ -58,7 +316,7 @@ class DatosGenerales {
}
#handlePaginas() {
let paginasNegro = this.paginasNegro.val();
let paginasColor = this.paginasColor.val();
@ -72,16 +330,16 @@ class DatosGenerales {
let totalPaginas = parseInt(paginasNegro) + parseInt(paginasColor);
this.paginas.val(totalPaginas);
let tipos = [this.domItem.find('#fresado'), this.domItem.find('#cosido')];
if (totalPaginas < 32){
let tipos = [this.domItem.find('#fresado'), this.domItem.find('#cosido')];
if (totalPaginas < 32) {
for (let tipo of tipos) {
tipo.removeClass('selected');
tipo.find('.image-presupuesto').removeClass('selected');
tipo.hide();
}
}
else{
else {
for (let tipo of tipos) {
tipo.show();
}
@ -92,9 +350,90 @@ class DatosGenerales {
this.domItem.find('#grapado').find('.image-presupuesto').removeClass('selected');
this.domItem.find('#grapado').hide();
}
else{
else {
this.domItem.find('#grapado').show();
}
this.formValidation.revalidateField('paginas');
// Se configura dependiento si hay color o no
if (paginasColor == 0) {
this.#handleInteriorLayout('negro');
this.divPaginasColorConsecutivas.addClass('d-none');
this.divPosPaginasColor.addClass('d-none');
this.posPaginasColor.val("");
this.pagColorConsecutivas.prop('checked', false);
}
else {
if(this.papelDiferente.is(":checked"))
this.#handleInteriorLayout('mixto');
else
this.#handleInteriorLayout('color');
this.divPaginasColorConsecutivas.removeClass('d-none');
this.divPosPaginasColor.removeClass('d-none');
}
}
#handPaginasConsecutivas() {
if (this.pagColorConsecutivas.is(':checked')) {
this.divPapelDiferente.removeClass('d-none');
}
else {
this.divPapelDiferente.addClass('d-none');
this.papelDiferente.prop('checked', false);
}
}
#handlePapelDiferente() {
if (this.papelDiferente.is(':checked')){
$(".interior-color").removeClass('d-none');
this.#handleInteriorLayout('mixto');
}
else {
$(".interior-color").addClass('d-none');
$("#divGramajeInteriorColor").addClass('d-none');
$(".papel-interior").removeClass('selected');
$(".gramaje-interior").prop('checked', false);
$(".gramaje-interior-color").prop('checked', false);
this.#handlePaginas();
}
}
#handleInteriorLayout(layout) {
switch (layout) {
case 'negro':
case 'mixto':
$('#negroEstandar').removeClass('d-none');
$('#negroPremium').removeClass('d-none');
$('#colorEstandar').addClass('d-none');
$('#colorPremium').addClass('d-none');
break;
case 'color':
$('#negroEstandar').addClass('d-none');
$('#negroPremium').addClass('d-none');
$('#colorEstandar').removeClass('d-none');
$('#colorPremium').removeClass('d-none');
break;
default:
break;
}
}
#handleCheckFormatoPersonalizado() {
const minAncho = this.anchoPersonalizado.min;
const minAlto = this.altoPersonalizado.min;
if (this.anchoPersonalizado.val() < minAncho || this.anchoPersonalizado.val() == '' || isNaN(this.anchoPersonalizado.val())) {
this.anchoPersonalizado.val(minAncho);
}
if (this.altoPersonalizado.val() < minAlto || this.altoPersonalizado.val() == '' || isNaN(this.altoPersonalizado.val())) {
this.altoPersonalizado.val(minAlto);
}
}
}

View File

@ -0,0 +1,562 @@
class DisenioInterior {
constructor(domItem, wizardForm, validatorStepper) {
this.domItem = domItem;
this.wizardStep = wizardForm.querySelector('#interior-libro');
this.validatorStepper = validatorStepper;
this.disenioInterior = this.domItem.find(".disenio-interior");
this.papelInterior = this.domItem.find(".papel-interior");
this.negroEstandar = this.domItem.find("#negroEstandar");
this.negroPremium = this.domItem.find("#negroPremium");
this.colorEstandar = this.domItem.find("#colorEstandar");
this.colorPremium = this.domItem.find("#colorPremium");
this.offsetBlanco = this.domItem.find("#offsetBlanco");
this.offsetAhuesado = this.domItem.find("#offsetAhuesado");
this.offsetAhuesadoVolumen = this.domItem.find("#offsetAhuesadoVolumen");
this.estucadoMate = this.domItem.find("#estucadoMate");
this.gramaje70 = this.domItem.find("#interiorGramaje70");
this.gramaje80 = this.domItem.find("#interiorGramaje80");
this.gramaje90 = this.domItem.find("#interiorGramaje90");
this.gramaje100 = this.domItem.find("#interiorGramaje100");
this.gramaje115 = this.domItem.find("#interiorGramaje115");
this.gramaje120 = this.domItem.find("#interiorGramaje120");
this.gramaje135 = this.domItem.find("#interiorGramaje135");
this.gramaje150 = this.domItem.find("#interiorGramaje150");
this.gramaje170 = this.domItem.find("#interiorGramaje170");
this.disenioInterior_color = this.domItem.find(".disenio-interior-color");
this.papelInterior_color = this.domItem.find(".papel-interior-color");
this.colorEstandar_color = this.domItem.find("#colorEstandarColor");
this.colorPremium_color = this.domItem.find("#colorPremiumColor");
this.offsetBlanco_color = this.domItem.find("#offsetBlancoColor");
this.offsetAhuesado_color = this.domItem.find("#offsetAhuesadoColor");
this.offsetAhuesadoVolumen_color = this.domItem.find("#offsetAhuesadoVolumenColor");
this.estucadoMate_color = this.domItem.find("#estucadoMateColor");
this.gramaje70_color = this.domItem.find("#interiorGramaje70Color");
this.gramaje80_color = this.domItem.find("#interiorGramaje80Color");
this.gramaje90_color = this.domItem.find("#interiorGramaje90Color");
this.gramaje100_color = this.domItem.find("#interiorGramaje100Color");
this.gramaje115_color = this.domItem.find("#interiorGramaje115Color");
this.gramaje120_color = this.domItem.find("#interiorGramaje120Color");
this.gramaje135_color = this.domItem.find("#interiorGramaje135Color");
this.gramaje150_color = this.domItem.find("#interiorGramaje150Color");
this.gramaje170_color = this.domItem.find("#interiorGramaje170Color");
this.initValidation();
// Creamos un nuevo observador que detecta cambios en los atributos
this.observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
const targetElement = mutation.target;
if (targetElement.id.includes("Color"))
this.#handleUpdateGramajeColor();
else
this.#handleUpdateGramaje();
}
});
});
}
init() {
// Eventos
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
this.papelInterior.on('click', this.#handlePapelInterior.bind(this));
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
this.papelInterior_color.on('click', this.#handlePapelInterior.bind(this));
// Observadores
this.observer.observe(this.negroEstandar[0], { attributes: true });
this.observer.observe(this.negroPremium[0], { attributes: true });
this.observer.observe(this.colorEstandar[0], { attributes: true });
this.observer.observe(this.colorPremium[0], { attributes: true });
this.observer.observe(this.offsetBlanco[0], { attributes: true });
this.observer.observe(this.offsetAhuesado[0], { attributes: true });
this.observer.observe(this.offsetAhuesadoVolumen[0], { attributes: true });
this.observer.observe(this.estucadoMate[0], { attributes: true });
this.observer.observe(this.colorEstandar_color[0], { attributes: true });
this.observer.observe(this.colorPremium_color[0], { attributes: true });
this.observer.observe(this.offsetBlanco_color[0], { attributes: true });
this.observer.observe(this.offsetAhuesado_color[0], { attributes: true });
this.observer.observe(this.offsetAhuesadoVolumen_color[0], { attributes: true });
this.observer.observe(this.estucadoMate_color[0], { attributes: true });
}
initValidation() {
const stepper = this.validatorStepper;
this.formValidation = FormValidation.formValidation(this.wizardStep, {
fields: {
div_impresion_interior: {
validators: {
callback: {
callback: function (input) {
const divImpresionInterior = $('#divImpresionInterior'); // Selecciona el div
divImpresionInterior.find('.fv-plugins-message-container').remove();
if ($('.disenio-interior.selected').length > 0) {
return true;
}
else {
divImpresionInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].disenio_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
div_papel_interior: {
validators: {
callback: {
callback: function (input) {
const divPapelInterior = $('#divPapelInterior'); // Selecciona el div
divPapelInterior.find('.fv-plugins-message-container').remove();
if ($('.papel-interior.selected').length > 0) {
return true;
}
else {
divPapelInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].papel_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
div_gramaje_interior: {
validators: {
callback: {
callback: function (input) {
const divGramajeInterior = $('#divGramajeInterior'); // Selecciona el div
if ($("#divGramajeInterior").hasClass("d-none")) return true;
divGramajeInterior.find('.fv-plugins-message-container').remove();
if ($('.check-interior-gramaje:checked').length > 0) {
return true;
}
else {
divGramajeInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].gramaje_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
div_impresion_interior_color: {
validators: {
callback: {
callback: function (input) {
const divImpresionInterior = $('#divImpresionInteriorColor'); // Selecciona el div
if (divImpresionInterior.hasClass("d-none")) return true;
divImpresionInterior.find('.fv-plugins-message-container').remove();
if ($('.disenio-interior-color.selected').length > 0) {
return true;
}
else {
divImpresionInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior_color" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].disenio_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
div_papel_interior_color: {
validators: {
callback: {
callback: function (input) {
const divPapelInterior = $('#divPapelInteriorColor'); // Selecciona el div
if (divPapelInterior.hasClass("d-none")) return true;
divPapelInterior.find('.fv-plugins-message-container').remove();
if ($('.papel-interior.selected').length > 0) {
return true;
}
else {
divPapelInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].papel_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
div_gramaje_interior_color: {
validators: {
callback: {
callback: function (input) {
const divGramajeInterior = $('#divGramajeInteriorColor'); // Selecciona el div
if ($("#divGramajeInterior").hasClass("d-none")) return true;
divGramajeInterior.find('.fv-plugins-message-container').remove();
if ($('.check-interior-gramaje:checked').length > 0) {
return true;
}
else {
divGramajeInterior.append(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
${window.translations["validation"].gramaje_interior}
</div>
</div>
`);
}
return false;
},
}
}
},
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap5: new FormValidation.plugins.Bootstrap5({
// Use this for enabling/changing valid/invalid class
// eleInvalidClass: '',
eleValidClass: '',
rowSelector: function (field, ele) {
// field is the field name
// ele is the field element
switch (field) {
case 'div_impresion_interior':
case 'div_papel_interior':
case 'div_gramaje_interior':
case 'div_impresion_interior_color':
case 'div_papel_interior_color':
case 'div_gramaje_interior_color':
return '.col-sm-10';
default:
return '.col-sm-3';
}
}
}),
autoFocus: new FormValidation.plugins.AutoFocus(),
submitButton: new FormValidation.plugins.SubmitButton()
}
}).on('core.form.valid', () => {
stepper.next();
});
}
#handleDisenioInterior(event) {
// Accede al ID del elemento que disparó el evento
const element = $(event.target);
let class2Find = '.disenio-interior';
if (element[0].closest('.image-container').id.includes('Color'))
class2Find = '.disenio-interior-color';
let containers = element.closest(class2Find).parent().find(class2Find);
for (let container of containers) {
if (container != element.closest(class2Find)[0]) {
$(container).removeClass('selected');
$(container).find('.image-presupuesto').removeClass('selected');
}
}
element.closest(class2Find).toggleClass('selected');
element.closest('.image-presupuesto').toggleClass('selected');
}
#handlePapelInterior(event) {
// Accede al ID del elemento que disparó el evento
const element = $(event.target);
let class2Find = '.papel-interior';
if (element[0].closest('.image-container').id.includes('Color'))
class2Find = '.papel-interior-color';
let containers = element.closest(class2Find).parent().find(class2Find);
for (let container of containers) {
if (container != element.closest(class2Find)[0]) {
$(container).removeClass('selected');
$(container).find('.image-presupuesto').removeClass('selected');
}
}
element.closest(class2Find).toggleClass('selected');
element.closest('.image-presupuesto').toggleClass('selected');
}
#handleUpdateGramaje() {
let showGramaje = false;
$(".check-interior-gramaje ").prop("checked", false);
if (this.negroEstandar.hasClass("selected") || this.colorEstandar.hasClass("selected")) {
if (this.offsetBlanco.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.removeClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.removeClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesado.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.removeClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesadoVolumen.hasClass("selected")) {
this.gramaje70.removeClass("d-none");
this.gramaje80.addClass("d-none");
this.gramaje90.addClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
else if (this.estucadoMate.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.addClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.removeClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
}
else if (this.negroPremium.hasClass("selected") || this.colorPremium.hasClass("selected")) {
if (this.offsetBlanco.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.removeClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.removeClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.removeClass("d-none");
this.gramaje170.removeClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesado.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.removeClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.removeClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesadoVolumen.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.addClass("d-none");
this.gramaje90.addClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.addClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.addClass("d-none");
this.gramaje150.addClass("d-none");
this.gramaje170.addClass("d-none");
showGramaje = true;
}
else if (this.estucadoMate.hasClass("selected")) {
this.gramaje70.addClass("d-none");
this.gramaje80.addClass("d-none");
this.gramaje90.removeClass("d-none");
this.gramaje100.addClass("d-none");
this.gramaje115.removeClass("d-none");
this.gramaje120.addClass("d-none");
this.gramaje135.removeClass("d-none");
this.gramaje150.removeClass("d-none");
this.gramaje170.removeClass("d-none");
showGramaje = true;
}
}
if ($("#divGramajeInterior").hasClass("d-none") && showGramaje) {
$("#divGramajeInterior").removeClass("d-none");
}
else if (!showGramaje) {
$("#divGramajeInterior").addClass("d-none");
}
}
#handleUpdateGramajeColor() {
let showGramaje = false;
$(".check-interior-color-gramaje ").prop("checked", false);
if (this.colorEstandar_color.hasClass("selected")) {
if (this.offsetBlanco_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.removeClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.removeClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesado_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.removeClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesadoVolumen_color.hasClass("selected")) {
this.gramaje70_color.removeClass("d-none");
this.gramaje80_color.addClass("d-none");
this.gramaje90_color.addClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
else if (this.estucadoMate_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.addClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.removeClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
}
else if (this.colorPremium_color.hasClass("selected")) {
if (this.offsetBlanco_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.removeClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.removeClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.removeClass("d-none");
this.gramaje170_color.removeClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesado_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.removeClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.removeClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
else if (this.offsetAhuesadoVolumen_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.addClass("d-none");
this.gramaje90_color.addClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.addClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.addClass("d-none");
this.gramaje150_color.addClass("d-none");
this.gramaje170_color.addClass("d-none");
showGramaje = true;
}
else if (this.estucadoMate_color.hasClass("selected")) {
this.gramaje70_color.addClass("d-none");
this.gramaje80_color.addClass("d-none");
this.gramaje90_color.removeClass("d-none");
this.gramaje100_color.addClass("d-none");
this.gramaje115_color.removeClass("d-none");
this.gramaje120_color.addClass("d-none");
this.gramaje135_color.removeClass("d-none");
this.gramaje150_color.removeClass("d-none");
this.gramaje170_color.removeClass("d-none");
showGramaje = true;
}
}
if ($("#divGramajeInteriorColor").hasClass("d-none") && showGramaje) {
$("#divGramajeInteriorColor").removeClass("d-none");
}
else if (!showGramaje) {
$("#divGramajeInteriorColor").addClass("d-none");
}
}
}
export default DisenioInterior;

View File

@ -1,26 +1,160 @@
import DatosGenerales from './datosGenerales.js';
import DisenioInterior from './disenioInterior.js';
import Ajax from '../../components/ajax.js';
class PresupuestoCliente {
function initPresupuesto(response){
constructor() {
this.clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
window.translations = JSON.parse(response);
this.validationStepper = new Stepper(this.clientePresupuestoWizard, {
linear: true
});
let datosGenerales = new DatosGenerales($("#datos-generales"));
datosGenerales.init();
this.btnNext = $('#btnNext');
this.btnPrev = $('#btnPrev');
this.btnPrint = $('#btnPrint');
this.btnSave = $('#btnSave');
this.btnConfirm = $('#btnConfirm');
this.datosGenerales = new DatosGenerales($("#datos-generales"), this.clientePresupuestoWizard, this.validationStepper);
this.disenioInterior = new DisenioInterior($("#interior-libro"), this.clientePresupuestoWizard, this.validationStepper);
}
init() {
this.btnNext.on('click', this.#nextStep.bind(this));
this.btnPrev.on('click', this.#prevtStep.bind(this));
// Fuerza el foco en el campo de búsqueda de select2
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});
this.validationStepper._element.addEventListener('shown.bs-stepper', this.buttonsHandler.bind(this));
this.datosGenerales.init();
this.disenioInterior.init();
this.RELLENAR_PRESUPUESTO();
}
RELLENAR_PRESUPUESTO() {
$("#titulo").val("Titulo del libro");
const clienteId = $("#clienteId");
const newOption = new Option("Cliente 1", "1", true, true);
clienteId.append(newOption).trigger('change');
const papelFormatoId = $("#papelFormatoId");
const newOption2 = new Option("Formato 1", "1", true, true);
papelFormatoId.append(newOption2).trigger('change');
$("#paginasColor").val("5");
$("#paginasColor").trigger('change');
$("#fresado").trigger("click");
$("#colorEstandar").trigger("click");
$("#offsetBlanco").trigger("click");
$("#gramaje80").prop("checked", true);
$("#gramaje80").trigger("change");
}
buttonsHandler() {
switch (this.validationStepper._currentIndex + 1) {
case 0:
this.btnPrev.addClass('d-none');
this.btnNext.removeClass('d-none');
this.btnPrint.addClass('d-none');
this.btnSave.addClass('d-none');
this.btnConfirm.addClass('d-none');
break;
case 1:
this.btnPrev.removeClass('d-none');
this.btnNext.removeClass('d-none');
this.btnPrint.addClass('d-none');
this.btnSave.addClass('d-none');
this.btnConfirm.addClass('d-none');
break;
}
}
#nextStep() {
switch (this.validationStepper._currentIndex) {
case 0:
this.datosGenerales.formValidation.validate();
break;
case 1:
this.disenioInterior.formValidation.validate();
break;
/*
case 2:
FormValidation4.validate();
break;
case 3:
FormValidation5.validate();
break;
*/
default:
break;
}
}
#prevtStep() {
switch (this.validationStepper._currentIndex) {
case 4:
validationStepper.previous();
break;
case 3:
validationStepper.previous();
break;
case 2:
validationStepper.previous();
break;
case 1:
this.validationStepper.previous();
break;
default:
break;
}
}
}
function initialize(translations) {
window.translations = JSON.parse(translations);
let presupuestoCliente = new PresupuestoCliente();
presupuestoCliente.init();
}
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
new Ajax('/translate/getTranslation', {locale: locale, translationFile: 'Presupuestos'}, {},
initPresupuesto,
function(error){
new Ajax('/translate/getTranslation', { locale: locale, translationFile: 'Presupuestos' }, {},
initialize,
function (error) {
console.log("Error getting translations:", error);
}
).post();
});

View File

@ -37,3 +37,9 @@
transform-style: preserve-3d;
}
.checkbox-presupuesto-container {
width: 110px !important;
max-width: 110px !important;
min-width: 110px !important;
}