diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 44581391..2ce703a0 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -584,6 +584,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest $routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']); $routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']); $routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']); + $routes->post('calcularsolapas', 'Presupuestocliente::calcularMaxSolapas', ['as' => 'calcularSolapas']); }); $routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']); diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index aa04c45f..55715e3c 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -471,6 +471,94 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController } } + + public function calcularMaxSolapas() + { + if ($this->request->isAJAX()) { + + $reqData = $this->request->getPost(); + $modelPapelGenerico = new PapelGenericoModel(); + + $POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD(); + + $cliente_id = $reqData['clienteId'] ?? -1; + + $tirada = $reqData['tirada'] ?? 0; + $tamanio = $reqData['tamanio']; + $paginas = $reqData['paginas'] ?? 0; + $paginas_color = $reqData['paginasColor'] ?? 0; + $papelInteriorDiferente = intval($reqData['papelInteriorDiferente']) ?? null; + $excluirRotativa = $reqData['excluirRotativa'] ?? 0; + $excluirRotativa = intval($excluirRotativa); + + $tipo = $reqData['tipo']; + $tipoCubierta = 'blanda'; // solapas sólo tapa blanda y sobre cubierta + + $isColor = intval($reqData['isColor']) ?? 0; + $isHq = intval($reqData['isHq']) ?? 0; + + $tipo_impresion_id = $this->getTipoImpresion($tipo, $tipoCubierta); + $is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id); + + $interior = $reqData['interior'] ?? []; + + if ($papelInteriorDiferente) { + $papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray(); + $papel['color'] = $modelPapelGenerico->where('id', $interior['papelInterior']['color'])->first()->toArray(); + $gramaje['negro'] = intval($interior['gramajeInterior']['negro']); + $gramaje['color'] = intval($interior['gramajeInterior']['color']); + } else { + $papel = $modelPapelGenerico->where('id', $interior['papelInterior'])->first()->toArray(); + $gramaje = intval($interior['gramajeInterior']); + } + + $datosPedido = (object) array( + 'paginas' => $paginas, + 'tirada' => $tirada[0], + 'merma' => $tirada[0] > $POD ? $this->calcular_merma($tirada[0], $POD) : 0, + 'ancho' => intval($tamanio['ancho']) ?? 100000, + 'alto' => intval($tamanio['alto']) ?? 100000, + 'isCosido' => $is_cosido, + 'a_favor_fibra' => 1, + ); + + $input_data = array( + 'uso' => 'interior', + 'tipo_impresion_id' => $tipo_impresion_id, + 'datosPedido' => $datosPedido, + 'papel_generico' => $papel, + 'gramaje' => $gramaje, + 'isColor' => $isColor, + 'isHq' => $isHq, + 'cliente_id' => $cliente_id, + 'paginas_color' => $paginas_color, + 'excluirRotativa' => $excluirRotativa, + 'papelInteriorDiferente' => $papelInteriorDiferente + ); + + $interior = PresupuestoClienteService::obtenerInterior($input_data); + if($interior == null) { + return $this->failServerError('Error al calcular el interior'); + } + $anchoTotal = $interior[0]['mano']; + // le añadimos 2*ancho libro + $anchoTotal += 2 * $datosPedido->ancho; + // le añadimos los dobleces de las solapas + $anchoTotal += 6; + // le añadimos la sangre + $anchoTotal += PresupuestoService::SANGRE_FORMAS; + // 863 es el ancho máximo permitido por las máquinas + $maxSolapa = (865-floor($anchoTotal))/2; + $maxSolapa = min($maxSolapa, 0.75 * $datosPedido->ancho); + return $this->respond($maxSolapa); + + } else { + return $this->failUnauthorized('Invalid request', 403); + } + + } + + public function getDireccionesCliente() { if ($this->request->isAJAX()) { @@ -488,6 +576,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController 'menu' => $data, $csrfTokenName => $newTokenHash ]); + } else { return $this->failUnauthorized('Invalid request', 403); } @@ -699,7 +788,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController 'papel_generico_cubierta' => $modelPapelGenerico->where('id', $cubierta['papelCubierta'])->first()->toArray(), 'gramajeCubierta' => intval($cubierta['gramajeCubierta']), 'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0), - 'solapasCubierta' => intval($cubierta['solapas'] ?? 0), + 'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1? intval($cubierta['tamanioSolapas']) : 0, 'acabadosCubierta' => $cubierta['acabados'] ?? 0, 'lomoRedondo' => $cubierta['lomoRedondo'] ?? 0, 'cabezada' => $cubierta['cabezada'] ?? 'WHI', @@ -1013,6 +1102,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $data['sobrecubierta']['solapas'] = $presupuesto->solapas_sobrecubierta ? 1 : 0; $data['sobrecubierta']['solapas_ancho'] = $presupuesto->solapas_ancho_sobrecubierta; $data['sobrecubierta']['plastificado'] = $modelAcabado->getCodeFromId($presupuesto->acabado_sobrecubierta_id); + if ($data['sobrecubierta']['plastificado'] == '') { + $data['sobrecubierta']['plastificado'] = 'NONE'; + } $data['guardas'] = array_key_exists('guardas', $datos_papel) ? $datos_papel['guardas'] : []; @@ -1796,6 +1888,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController 'solapas' => intval($solapasCubierta) > 0 ? 1 : 0, 'paginasCuadernillo' => $paginasCuadernillo, ]); + + + $costeServiciosDefecto = 0.0; foreach ($servDefecto as $servicio) { if ($servicio->total <= 0) { @@ -1829,6 +1924,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController } // Servicios + + + /* + 'retractilado' => 3, + 'prototipo' => 9, + */ + $serviciosAutomaticos = []; + $servicios = []; // se comprueba si $datos guardas es un array if (is_array($datos_guardas)) { if (count($datos_guardas) > 0) { @@ -1839,13 +1942,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController array_push($servicios, 62); // Plegado de guardas } } - - /* - 'retractilado' => 3, - 'prototipo' => 9, - */ - $serviciosAutomaticos = []; - $servicios = []; if ($datos_entrada['servicios']['retractilado']) // acabado array_push($servicios, 3); if ($datos_entrada['servicios']['retractilado5']) // acabado @@ -1873,7 +1969,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $errorModel->insertError( $datos_entrada['id'], auth()->user()->id, - 'No se puede obtener servicio con id ' . ((string)$servicio), + 'No se puede obtener servicio con id ' . ((string) $servicio), $input_data ); $return_data = [ @@ -1901,7 +1997,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $errorModel->insertError( $datos_entrada['id'], auth()->user()->id, - 'No se puede obtener servicio con id ' . ((string)$servicio), + 'No se puede obtener servicio con id ' . ((string) $servicio), $input_data ); $return_data = [ @@ -1921,6 +2017,45 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController } } + // Plegado de solapas grandes + if( + (intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630) || + (is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630)) + ){ + + // Servicios acabado + $resultado = PresupuestoCLienteService::getServiciosManipulado([ + 'tarifa_id' => 79, + 'tirada' => $datosPedido->tirada, + 'POD' => $POD, + ]); + array_push($serviciosAutomaticos, $resultado[0]); + + if ($resultado[0]->total <= 0) { + + $errorModel = new ErrorPresupuesto(); + $errorModel->insertError( + $datos_entrada['id'], + auth()->user()->id, + 'No se puede obtener servicio de manupulado con id ' . ((string) $servicio), + $input_data + ); + $return_data = [ + 'errors' => (object) ([ + 'status' => 1 + ]), + ]; + return $return_data; + } + + $coste_servicios += floatval($resultado[0]->total); + if ($extra_info) { + $totalServicios += floatval($resultado[0]->total); + $margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0; + } + + } + array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios) / $tirada[$t], 4)); array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2)); diff --git a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php index 9e78b7a1..7ce6c1c4 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php @@ -248,7 +248,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel return []; } - public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = null){ + public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = 32){ $modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel'); diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index dc73bd25..974c29fa 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -426,7 +426,7 @@ class PresupuestoModel extends \App\Models\BaseModel 'solapas' => $data['cubierta']['solapasCubierta'] == 0 ? 0 : 1, 'lomo_redondo' => $data['cubierta']['lomoRedondo'] == 0 ? 0 : 1, 'cabezada' => $data['cubierta']['cabezada'] == 0 ? 0 : 1, - 'solapas_ancho' => $data['cubierta']['solapasCubierta'] == 0 ? $data['cubierta']['solapasCubierta'] : 0, + 'solapas_ancho' => $data['cubierta']['solapasCubierta'] > 0 ? $data['cubierta']['solapasCubierta'] : 0, 'solapas_sobrecubierta' => !$data['sobrecubierta'] ? 0 : 1, 'solapas_ancho_sobrecubierta' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['solapas'], 'cosido' => $is_cosido, diff --git a/ci4/app/Services/PresupuestoClienteService.php b/ci4/app/Services/PresupuestoClienteService.php index ea59622c..000a27e3 100644 --- a/ci4/app/Services/PresupuestoClienteService.php +++ b/ci4/app/Services/PresupuestoClienteService.php @@ -416,6 +416,17 @@ class PresupuestoClienteService extends BaseService return $values; } + public static function getServiciosManipuladoDefault($data) + { + + $tirada = $data['tirada'] ?? -1; + $anchoDesarrollo = $data['anchoDesarrollo'] ?? -1; + + /*$model = model('App\Models\Presupuestos\PresupuestoEncuadernacionesModel'); + $values = $model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD, $paginasCuadernillo);*/ + //return $values; + } + public static function getServiciosManipulado($data) { diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index a6c1074b..1aba14fd 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -1479,7 +1479,7 @@ class PresupuestoService extends BaseService // con el mismo proveedor else { if ($tarifaModel->isTarifaPorHoras($servicio->tarifa_encuadernado_id)) { - $paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? null; + $paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? 32; $nueva_tarifa = $model->getPrecioTarifaHoras( $servicio->tarifa_encuadernado_id, $input_data['paginas'], @@ -1815,6 +1815,12 @@ class PresupuestoService extends BaseService } } + if ($uso == 'cubierta' || $uso == 'sobrecubierta') { + + $linea['fields']['dimension_desarrollo']['ancho'] = $datosPedido->anchoExteriores; + $linea['fields']['dimension_desarrollo']['alto'] = $datosPedido->altoExteriores; + } + if (!array_key_exists('tipo_linea', $linea['fields'])) { if ($isColor) { if ($isHq) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php index 37b01331..3f9997af 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php @@ -54,7 +54,7 @@ - user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto calcular-solapas" style="width: 100%;"> user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?> @@ -66,7 +66,7 @@
">
- user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa" + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class=" calcular-solapas calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="1">
@@ -78,7 +78,7 @@ -
@@ -86,7 +86,7 @@ - @@ -94,7 +94,7 @@ - @@ -102,7 +102,7 @@ - @@ -113,7 +113,7 @@ - @@ -123,20 +123,20 @@
+ class="form-control formato_libro calcular-presupuesto calcular-solapas num-input" min="110" value="110">
+ class="form-control formato_libro calcular-presupuesto calcular-solapas num-input" min="170" value="170">
- @@ -153,7 +153,7 @@ -
@@ -166,7 +166,7 @@ -
@@ -179,7 +179,7 @@ -
@@ -234,28 +234,28 @@
-
+
" alt="Fresado">
Fresado (a partir de 32 páginas)
-
+
" alt="Grapado">
Grapado (entre 12 y 40 páginas)
-
+
" alt="Espiral">
Espiral
-
+
" alt="Cosido">
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta.php index fc3c3b6f..5b242bca 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta.php @@ -91,7 +91,7 @@ -
+
Entre 60 y 120 mm
@@ -261,7 +261,7 @@ -
+
Entre 60 y 120 mm
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioInterior.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioInterior.php index 83e399a6..600e4686 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioInterior.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_disenioInterior.php @@ -65,7 +65,7 @@ Seleccione el papel especial
@@ -120,7 +120,7 @@ Seleccione el papel especial
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js index 86aabc91..0b39cec9 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js @@ -38,7 +38,7 @@ class DisenioCubierta { this.divSolapas = this.domItem.find("#divSolapasCubierta"); this.divCarasImpresion = this.domItem.find("#divCarasImpresion"); - this.divConfigGuardas = this.domItem.find("#divConfigGuardas"); + this.divConfigGuardas = this.domItem.find("#divConfigTapaDura"); this.carasCubierta = this.domItem.find("#carasCubierta"); @@ -49,6 +49,7 @@ class DisenioCubierta { this.sinSolapas = this.domItem.find("#solapasCubiertaNo"); this.conSolapas = this.domItem.find("#solapasCubiertaSi"); this.divTamanioSolapas = this.domItem.find("#divTamanioSolapas"); + this.textoSolapasCubierta = this.domItem.find("#textoSolapasCubierta"); this.tamanioSolapasCubierta = $(this.domItem.find("#solapasCubierta")); this.papelGuardas = this.domItem.find("#papelGuardas"); @@ -75,6 +76,7 @@ class DisenioCubierta { this.faja = this.domItem.find("#addFaja"); this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta"); + this.textoSolapasSobrecubierta = this.domItem.find("#textoLimitesSolapasSobrecubierta"); this.solapasFaja = this.domItem.find("#solapasFaja"); this.altoFaja = this.domItem.find("#altoFaja"); @@ -325,6 +327,7 @@ class DisenioCubierta { callback: function (input) { const divGramajeInterior = $('#divGramajeCubierta'); // Selecciona el div + divGramajeInterior.find('.fv-plugins-message-container').remove(); const gramajeSeleccionado = $('.custom-selector-gramaje-cubierta input[type="radio"]:checked'); if (gramajeSeleccionado.length > 0) { diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js index 6337bf90..02669b39 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js @@ -986,7 +986,7 @@ class DisenioInterior { var radioButton = $('', { type: 'radio', // Tipo de input - name: 'calcular-presupuesto gramaje-interior', + name: ' calcular-solapas calcular-presupuesto gramaje-interior', id: 'gramaje_' + valor.gramaje, // ID único value: 'option1' // Valor del radio button }); @@ -1001,6 +1001,7 @@ class DisenioInterior { const element = $(event.target); const gramaje = element[0].id; + this.presupuestoCliente.calcularSolapas(event); this.presupuestoCliente.checkForm(event); }); @@ -1044,7 +1045,7 @@ class DisenioInterior { var radioButton = $('', { type: 'radio', // Tipo de input - name: 'calcular-presupuesto gramaje-interior-color', + name: ' calcular-solapas calcular-presupuesto gramaje-interior-color', id: 'gramajeColor_' + valor.gramaje, // ID único value: 'option1' // Valor del radio button }); @@ -1059,6 +1060,7 @@ class DisenioInterior { const element = $(event.target); const gramaje = element[0].id; + this.presupuestoCliente.calcularSolapas(event); this.presupuestoCliente.checkForm(event); }); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js index 50d2ad45..431b1d76 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js @@ -11,7 +11,7 @@ import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js'; class PresupuestoCliente { constructor() { - + this.clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente'); this.validationStepper = new Stepper(this.clientePresupuestoWizard, { @@ -110,6 +110,7 @@ class PresupuestoCliente { $(".calcular-presupuesto").on('change', this.checkForm.bind(this)); + $(".calcular-solapas").on('change', this.calcularSolapas.bind(this)); } @@ -154,6 +155,28 @@ class PresupuestoCliente { return !(noPOD && siPOD); } + calcularSolapas(){ + + /* Solapas Max */ + this.#getDatos(false, true); + if (Object.values(this.datos).every(this.#isValidDataForm)) { + new Ajax('/presupuestocliente/calcularsolapas', + this.datos, + {}, + (response) => { + if (response === null || response === undefined || response === "") { + console.log("Error en el calculo máximo de solapas."); + return; + } + this.disenioCubierta.tamanioSolapasCubierta.attr('max', response); + this.disenioCubierta.solapasSobrecubierta.attr('max', response); + this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm"); + this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm"); + }, + () => { } + ).post(); + } + } checkForm(event) { @@ -163,6 +186,7 @@ class PresupuestoCliente { return; } + if (this.calcularPresupuesto) { if (event.target.id === 'divDirecciones') { @@ -580,7 +604,7 @@ class PresupuestoCliente { } - #getDatos(save = false) { + #getDatos(save = false, calcularSolapas = false) { this.datos = { @@ -590,20 +614,12 @@ class PresupuestoCliente { tirada: this.datosGenerales.getTiradas(), paginas: this.datosGenerales.paginas.val(), paginasColor: this.datosGenerales.paginasColor.val(), - posPaginasColor: this.datosGenerales.posPaginasColor.val(), pagColorConsecutivas: this.datosGenerales.pagColorConsecutivas.is(':checked') ? 1 : 0, papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0, paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(), tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'), - prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0, - ferro: this.datosGenerales.ferro.is(':checked') ? 1 : 0, - ferroDigital: this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0, - marcapaginas: this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0, - retractilado: this.datosGenerales.retractilado.is(':checked') ? 1 : 0, - retractilado5: this.datosGenerales.retractilado5.is(':checked') ? 1 : 0, - isColor: this.datosGenerales.getIsColor() ? 1 : 0, isHq: this.disenioInterior.getIsHq() ? 1 : 0, @@ -612,31 +628,46 @@ class PresupuestoCliente { gramajeInterior: this.disenioInterior.getGramaje(), }, + } - cubierta: { - tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'), - papelCubierta: this.disenioCubierta.getPapel(), - gramajeCubierta: this.disenioCubierta.getGramaje(), - cabezada: this.disenioCubierta.getCabezada(), - acabados: this.disenioCubierta.getAcabados(), - carasImpresion: this.disenioCubierta.carasCubierta.val(), - }, + if (calcularSolapas) { + return; + } - guardas: this.disenioCubierta.getGuardas(), - sobrecubierta: this.disenioCubierta.getSobrecubierta(), - faja: this.disenioCubierta.getFaja(), + this.datos.posPaginasColor = this.datosGenerales.posPaginasColor.val(); - excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0, - ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(), - servicios: { - 'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0, - 'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0, - 'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0, - 'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0, - 'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0, - 'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0, - }, + this.datos.prototipo = this.datosGenerales.prototipo.is(':checked') ? 1 : 0; + this.datos.ferro = this.datosGenerales.ferro.is(':checked') ? 1 : 0; + this.datos.ferroDigital = this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0; + this.datos.marcapaginas = this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0; + this.datos.retractilado = this.datosGenerales.retractilado.is(':checked') ? 1 : 0; + this.datos.retractilado5 = this.datosGenerales.retractilado5.is(':checked') ? 1 : 0; + + + this.datos.cubierta = { + tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'), + papelCubierta: this.disenioCubierta.getPapel(), + gramajeCubierta: this.disenioCubierta.getGramaje(), + cabezada: this.disenioCubierta.getCabezada(), + acabados: this.disenioCubierta.getAcabados(), + carasImpresion: this.disenioCubierta.carasCubierta.val(), }; + + this.datos.guardas = this.disenioCubierta.getGuardas(); + this.datos.sobrecubierta = this.disenioCubierta.getSobrecubierta(); + this.datos.faja = this.disenioCubierta.getFaja(); + + this.datos.excluirRotativa = this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0; + this.datos.ivaReducido = this.datosGenerales.ivaReducido.find('option:selected').val(); + this.datos.servicios = { + 'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0, + 'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0, + 'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0, + 'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0, + 'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0, + 'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0, + }; + let lomoRedondo = 0; if (this.disenioCubierta.disenioCubierta.filter('.selected').length > 0) lomoRedondo = this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0; @@ -706,7 +737,7 @@ class PresupuestoCliente { this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente); this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta); - + setTimeout(() => {