mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el envio del presupuesto al backend
This commit is contained in:
@ -325,7 +325,7 @@
|
|||||||
<select id="acabadosCubierta" name="acabadosCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
|
<select id="acabadosCubierta" name="acabadosCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
|
||||||
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
|
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
|
||||||
foreach ($datosPresupuesto->acabadosCubierta as $acabado) : ?>
|
foreach ($datosPresupuesto->acabadosCubierta as $acabado) : ?>
|
||||||
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
|
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_cubierta_id ? ' selected' : '' ?>>
|
||||||
<?= $acabado->label ?>
|
<?= $acabado->label ?>
|
||||||
</option>
|
</option>
|
||||||
<?php endforeach;
|
<?php endforeach;
|
||||||
@ -465,7 +465,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label for="retractilado" class="form-check-label">
|
<label for="retractilado" class="form-check-label">
|
||||||
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
|
<input type="checkbox" id="retractilado" name="retractilado" serv_id="3" value="1" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
|
||||||
<?= lang('Presupuestos.retractilado') ?>
|
<?= lang('Presupuestos.retractilado') ?>
|
||||||
</label>
|
</label>
|
||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
@ -476,7 +476,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label for="retractilado5" class="form-check-label">
|
<label for="retractilado5" class="form-check-label">
|
||||||
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
|
<input type="checkbox" id="retractilado5" name="retractilado_5" serv_id="5" value="1" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
|
||||||
<?= lang('Presupuestos.retractilado5') ?>
|
<?= lang('Presupuestos.retractilado5') ?>
|
||||||
</label>
|
</label>
|
||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
@ -488,7 +488,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label for="fajaColor" class="form-check-label">
|
<label for="fajaColor" class="form-check-label">
|
||||||
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
|
<input type="checkbox" id="fajaColor" name="faja_color" value="1" serv_id="16" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
|
||||||
<?= lang('Presupuestos.fajaColor') ?>
|
<?= lang('Presupuestos.fajaColor') ?>
|
||||||
</label>
|
</label>
|
||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
@ -499,7 +499,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label for="prototipo" class="form-check-label">
|
<label for="prototipo" class="form-check-label">
|
||||||
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
|
<input type="checkbox" id="prototipo" name="prototipo" value="1" serv_id="9" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
|
||||||
<?= lang('Presupuestos.prototipo') ?>
|
<?= lang('Presupuestos.prototipo') ?>
|
||||||
</label>
|
</label>
|
||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
@ -513,38 +513,16 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<label for="ferro" class="form-check-label">
|
<label for="ferro" class="form-check-label">
|
||||||
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
|
<input type="checkbox" id="ferro" name="ferro" value="1" serv_id="24" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
|
||||||
<?= lang('Presupuestos.ferro') ?>
|
<?= lang('Presupuestos.ferro') ?>
|
||||||
</label>
|
</label>
|
||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-12 col-lg-3 px-4">
|
|
||||||
<div class="mb-3">
|
|
||||||
<div class="form-check">
|
|
||||||
<label for="ferroDigital" class="form-check-label">
|
|
||||||
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->ferro_digital == true ? 'checked' : ''; ?>>
|
|
||||||
<?= lang('Presupuestos.ferroDigital') ?>
|
|
||||||
</label>
|
|
||||||
</div><!--//.form-check -->
|
|
||||||
</div><!--//.mb-3 -->
|
|
||||||
</div><!--//.col -->
|
|
||||||
|
|
||||||
<div class="col-md-12 col-lg-3 px-4">
|
|
||||||
<div class="mb-3">
|
|
||||||
<div class="form-check">
|
|
||||||
<label for="marcapaginas" class="form-check-label">
|
|
||||||
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input calcular-presupuesto" <?= $presupuestoEntity->marcapaginas == true ? 'checked' : ''; ?>>
|
|
||||||
<?= lang('Presupuestos.marcapaginas') ?>
|
|
||||||
</label>
|
|
||||||
</div><!--//.form-check -->
|
|
||||||
</div><!--//.mb-3 -->
|
|
||||||
</div><!--//.col -->
|
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
|
|
||||||
<!--SECCION DE SERVICIOS EXTRA -->
|
<!--SECCION DE OTRAS OPCIONES -->
|
||||||
<div class="divider divider-dark text-start mb-1">
|
<div class="divider divider-dark text-start mb-1">
|
||||||
<div class="divider-text">
|
<div class="divider-text">
|
||||||
<h5>Otras opciones</h5>
|
<h5>Otras opciones</h5>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
|
src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<input name="cosido" class="form-check-input elementos-libro" type="radio" value="tipoCosido"
|
<input name="cosido" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoCosido"
|
||||||
id="tipoCosido" checked="">
|
id="tipoCosido" checked="">
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-center">Rústica cosido</h4>
|
<h4 class="text-center">Rústica cosido</h4>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
|
src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<input name="fresado" class="form-check-input elementos-libro" type="radio" value="tipoFresado"
|
<input name="fresado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoFresado"
|
||||||
id="tipoFresado">
|
id="tipoFresado">
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-center">Rústica fresado</h4>
|
<h4 class="text-center">Rústica fresado</h4>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
|
src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<input name="grapado" class="form-check-input elementos-libro" type="radio" value="tipoGrapado"
|
<input name="grapado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoGrapado"
|
||||||
id="tipoGrapado">
|
id="tipoGrapado">
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-center">Cosido con grapas</h4>
|
<h4 class="text-center">Cosido con grapas</h4>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
|
src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<input name="espiral" class="form-check-input elementos-libro" type="radio" value="tipoEspiral"
|
<input name="espiral" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoEspiral"
|
||||||
id="tipoEspiral">
|
id="tipoEspiral">
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-center">Espiral</h4>
|
<h4 class="text-center">Espiral</h4>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
|
src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<input name="wireo" class="form-check-input elementos-libro" type="radio" value="tipoWireO"
|
<input name="wireo" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoWireO"
|
||||||
id="tipoWireO">
|
id="tipoWireO">
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-center">Wire-o</h4>
|
<h4 class="text-center">Wire-o</h4>
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
$('#papelFormatoPersonalizado').on('change', function()
|
$('#papelFormatoPersonalizado').on('change', function () {
|
||||||
{
|
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$('#tamanioLibroDiv').hide();
|
$('#tamanioLibroDiv').hide();
|
||||||
$('#anchoLibroDiv').show();
|
$('#anchoLibroDiv').show();
|
||||||
@ -14,8 +13,7 @@ $('#papelFormatoPersonalizado').on('change', function()
|
|||||||
|
|
||||||
|
|
||||||
// Init custom option check
|
// Init custom option check
|
||||||
function initTapaCheck()
|
function initTapaCheck() {
|
||||||
{
|
|
||||||
const _this = this
|
const _this = this
|
||||||
|
|
||||||
const tapaOptionList = [].slice.call(document.querySelectorAll('.custom-option-tapa .form-check-input'))
|
const tapaOptionList = [].slice.call(document.querySelectorAll('.custom-option-tapa .form-check-input'))
|
||||||
@ -30,8 +28,7 @@ function initTapaCheck()
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTapaCheck(el)
|
function updateTapaCheck(el) {
|
||||||
{
|
|
||||||
if (el.checked) {
|
if (el.checked) {
|
||||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||||
if (el.type === 'radio') {
|
if (el.type === 'radio') {
|
||||||
@ -41,7 +38,7 @@ function updateTapaCheck(el)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
el.closest('.custom-option-tapa').classList.add('checked')
|
el.closest('.custom-option-tapa').classList.add('checked')
|
||||||
if(el.closest('.custom-option-tapa').id == 'tapaBlandaInnerDiv') {
|
if (el.closest('.custom-option-tapa').id == 'tapaBlandaInnerDiv') {
|
||||||
$('#tapaBlanda').prop('checked', true);
|
$('#tapaBlanda').prop('checked', true);
|
||||||
$('#tapaDura').prop('checked', false);
|
$('#tapaDura').prop('checked', false);
|
||||||
}
|
}
|
||||||
@ -55,8 +52,7 @@ function updateTapaCheck(el)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function initColorCheck()
|
function initColorCheck() {
|
||||||
{
|
|
||||||
const _this = this
|
const _this = this
|
||||||
|
|
||||||
const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-color .form-check-input'))
|
const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-color .form-check-input'))
|
||||||
@ -71,8 +67,7 @@ function initColorCheck()
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateColorCheck(el)
|
function updateColorCheck(el) {
|
||||||
{
|
|
||||||
if (el.checked) {
|
if (el.checked) {
|
||||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||||
if (el.type === 'radio') {
|
if (el.type === 'radio') {
|
||||||
@ -82,7 +77,7 @@ function updateColorCheck(el)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
el.closest('.custom-option-color').classList.add('checked')
|
el.closest('.custom-option-color').classList.add('checked')
|
||||||
if(el.closest('.custom-option-color').id == 'colorNegroDiv') {
|
if (el.closest('.custom-option-color').id == 'colorNegroDiv') {
|
||||||
$('#colorNegro').prop('checked', true);
|
$('#colorNegro').prop('checked', true);
|
||||||
$('#colorColor').prop('checked', false);
|
$('#colorColor').prop('checked', false);
|
||||||
}
|
}
|
||||||
@ -90,15 +85,14 @@ function updateColorCheck(el)
|
|||||||
$('#colorNegro').prop('checked', false);
|
$('#colorNegro').prop('checked', false);
|
||||||
$('#colorColor').prop('checked', true);
|
$('#colorColor').prop('checked', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
el.closest('.custom-option-color').classList.remove('checked')
|
el.closest('.custom-option-color').classList.remove('checked')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function initCalidadCheck()
|
function initCalidadCheck() {
|
||||||
{
|
|
||||||
const _this = this
|
const _this = this
|
||||||
|
|
||||||
const calidadOptionList = [].slice.call(document.querySelectorAll('.custom-option-calidad .form-check-input'))
|
const calidadOptionList = [].slice.call(document.querySelectorAll('.custom-option-calidad .form-check-input'))
|
||||||
@ -113,8 +107,7 @@ function initCalidadCheck()
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCalidadCheck(el)
|
function updateCalidadCheck(el) {
|
||||||
{
|
|
||||||
if (el.checked) {
|
if (el.checked) {
|
||||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||||
if (el.type === 'radio') {
|
if (el.type === 'radio') {
|
||||||
@ -124,7 +117,7 @@ function updateCalidadCheck(el)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
el.closest('.custom-option-calidad').classList.add('checked')
|
el.closest('.custom-option-calidad').classList.add('checked')
|
||||||
if(el.closest('.custom-option-calidad').id == 'calidadEstandarDiv') {
|
if (el.closest('.custom-option-calidad').id == 'calidadEstandarDiv') {
|
||||||
$('#calidadEstandar').prop('checked', true);
|
$('#calidadEstandar').prop('checked', true);
|
||||||
$('#calidadPremium').prop('checked', false);
|
$('#calidadPremium').prop('checked', false);
|
||||||
}
|
}
|
||||||
@ -137,7 +130,7 @@ function updateCalidadCheck(el)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#enableSobrecubierta').on('change', function() {
|
$('#enableSobrecubierta').on('change', function () {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$('.enable-sobrecubierta').show();
|
$('.enable-sobrecubierta').show();
|
||||||
} else {
|
} else {
|
||||||
@ -146,7 +139,7 @@ $('#enableSobrecubierta').on('change', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function initDisenioLibro(){
|
function initDisenioLibro() {
|
||||||
initTapaCheck();
|
initTapaCheck();
|
||||||
initColorCheck();
|
initColorCheck();
|
||||||
initCalidadCheck();
|
initCalidadCheck();
|
||||||
@ -158,7 +151,7 @@ function initDisenioLibro(){
|
|||||||
$('#papelCubierta').val('').trigger('change');
|
$('#papelCubierta').val('').trigger('change');
|
||||||
$('#papelSobrecubierta').val('').trigger('change');
|
$('#papelSobrecubierta').val('').trigger('change');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#enableSobrecubierta').trigger('change');
|
$('#enableSobrecubierta').trigger('change');
|
||||||
}
|
}
|
||||||
@ -168,31 +161,31 @@ $('.change-tipo-impresion').on('change', function () {
|
|||||||
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
||||||
|
|
||||||
//si es color hay que mostrar el numero de paginas a color
|
//si es color hay que mostrar el numero de paginas a color
|
||||||
if(isColor){
|
if (isColor) {
|
||||||
$('#pagColorDiv').show();
|
$('#pagColorDiv').show();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#pagColorDiv').hide();
|
$('#pagColorDiv').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
||||||
if(!isColor && !isHq) {
|
if (!isColor && !isHq) {
|
||||||
data = window.datosPresupuesto.papelInteriorNegro;
|
data = window.datosPresupuesto.papelInteriorNegro;
|
||||||
}
|
}
|
||||||
else if(!isColor && isHq) {
|
else if (!isColor && isHq) {
|
||||||
data = window.datosPresupuesto.papelInteriorNegroHq;
|
data = window.datosPresupuesto.papelInteriorNegroHq;
|
||||||
}
|
}
|
||||||
else if(isColor && !isHq) {
|
else if (isColor && !isHq) {
|
||||||
data = window.datosPresupuesto.papelInteriorColor;
|
data = window.datosPresupuesto.papelInteriorColor;
|
||||||
}
|
}
|
||||||
else if(isColor && isHq) {
|
else if (isColor && isHq) {
|
||||||
data = window.datosPresupuesto.papelInteriorColorHq;
|
data = window.datosPresupuesto.papelInteriorColorHq;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dropdown = $("#papelInterior");
|
var dropdown = $("#papelInterior");
|
||||||
dropdown.empty();
|
dropdown.empty();
|
||||||
$.each(data, function() {
|
$.each(data, function () {
|
||||||
dropdown.append($("<option />").val(this.id).text(this.nombre));
|
dropdown.append($("<option />").val(this.id).text(this.nombre));
|
||||||
});
|
});
|
||||||
//Se quita la seleccion del dropdown
|
//Se quita la seleccion del dropdown
|
||||||
@ -201,7 +194,7 @@ $('.change-tipo-impresion').on('change', function () {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tirada').on('change', function() {
|
$('#tirada').on('change', function () {
|
||||||
|
|
||||||
const valInterior = $('#gramajeInterior option:selected').val();
|
const valInterior = $('#gramajeInterior option:selected').val();
|
||||||
const valCubierta = $('#gramajeCubierta option:selected').val();
|
const valCubierta = $('#gramajeCubierta option:selected').val();
|
||||||
@ -214,23 +207,23 @@ $('#tirada').on('change', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#papelInterior').on('change', function() {
|
$('#papelInterior').on('change', function () {
|
||||||
isColor = $('#colorNegroDiv').hasClass('checked') ? false : true;
|
isColor = $('#colorNegroDiv').hasClass('checked') ? false : true;
|
||||||
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
isHq = $('#calidadEstandarDiv').hasClass('checked') ? false : true;
|
||||||
|
|
||||||
if($('#papelInterior option:selected').val() != undefined){
|
if ($('#papelInterior option:selected').val() != undefined) {
|
||||||
var uso = 'bn';
|
var uso = 'bn';
|
||||||
|
|
||||||
if(!isColor && !isHq) {
|
if (!isColor && !isHq) {
|
||||||
uso = 'bn';
|
uso = 'bn';
|
||||||
}
|
}
|
||||||
else if(!isColor && isHq) {
|
else if (!isColor && isHq) {
|
||||||
uso = 'bnhq';
|
uso = 'bnhq';
|
||||||
}
|
}
|
||||||
else if(isColor && !isHq) {
|
else if (isColor && !isHq) {
|
||||||
uso = 'color';
|
uso = 'color';
|
||||||
}
|
}
|
||||||
else if(isColor && isHq) {
|
else if (isColor && isHq) {
|
||||||
uso = 'colorhq';
|
uso = 'colorhq';
|
||||||
}
|
}
|
||||||
datos = {
|
datos = {
|
||||||
@ -247,27 +240,27 @@ $('#papelInterior').on('change', function() {
|
|||||||
url: window.routes_disenio_libro.obtenerGramaje,
|
url: window.routes_disenio_libro.obtenerGramaje,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: datos,
|
data: datos,
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
|
|
||||||
$('#gramajeInterior').empty();
|
$('#gramajeInterior').empty();
|
||||||
$(response.menu).each(function( index, element ) {
|
$(response.menu).each(function (index, element) {
|
||||||
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
|
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
|
||||||
});
|
});
|
||||||
|
|
||||||
if(valInterior != undefined)
|
if (valInterior != undefined)
|
||||||
$('#gramajeInterior option[value='+valInterior + ']').prop('selected', true).trigger('change');
|
$('#gramajeInterior option[value=' + valInterior + ']').prop('selected', true).trigger('change');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#papelCubierta').on('change', function() {
|
$('#papelCubierta').on('change', function () {
|
||||||
isColor = true;
|
isColor = true;
|
||||||
isHq = true;
|
isHq = true;
|
||||||
|
|
||||||
if($('#papelCubierta option:selected').val() != undefined){
|
if ($('#papelCubierta option:selected').val() != undefined) {
|
||||||
var uso = 'colorhq';
|
var uso = 'colorhq';
|
||||||
|
|
||||||
datos = {
|
datos = {
|
||||||
@ -284,26 +277,26 @@ $('#papelCubierta').on('change', function() {
|
|||||||
url: window.routes_disenio_libro.obtenerGramaje,
|
url: window.routes_disenio_libro.obtenerGramaje,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: datos,
|
data: datos,
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
|
|
||||||
$('#gramajeCubierta').empty();
|
$('#gramajeCubierta').empty();
|
||||||
$(response.menu).each(function( index, element ) {
|
$(response.menu).each(function (index, element) {
|
||||||
$('#gramajeCubierta').append($("<option />").val(element.id).text(element.text));
|
$('#gramajeCubierta').append($("<option />").val(element.id).text(element.text));
|
||||||
});
|
});
|
||||||
|
|
||||||
if(valCubierta != undefined)
|
if (valCubierta != undefined)
|
||||||
$('#gramajeCubierta option[value='+ valCubierta + ']').prop('selected', true).trigger('change');
|
$('#gramajeCubierta option[value=' + valCubierta + ']').prop('selected', true).trigger('change');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#papelSobrecubierta').on('change', function() {
|
$('#papelSobrecubierta').on('change', function () {
|
||||||
isColor = true;
|
isColor = true;
|
||||||
isHq = true;
|
isHq = true;
|
||||||
|
|
||||||
if($('#papelSobrecubierta option:selected').val() != undefined){
|
if ($('#papelSobrecubierta option:selected').val() != undefined) {
|
||||||
var uso = 'colorhq';
|
var uso = 'colorhq';
|
||||||
|
|
||||||
datos = {
|
datos = {
|
||||||
@ -320,22 +313,22 @@ $('#papelSobrecubierta').on('change', function() {
|
|||||||
url: window.routes_disenio_libro.obtenerGramaje,
|
url: window.routes_disenio_libro.obtenerGramaje,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: datos,
|
data: datos,
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
|
|
||||||
$('#gramajeSobrecubierta').empty();
|
$('#gramajeSobrecubierta').empty();
|
||||||
$(response.menu).each(function( index, element ) {
|
$(response.menu).each(function (index, element) {
|
||||||
$('#gramajeSobrecubierta').append($("<option />").val(element.id).text(element.text));
|
$('#gramajeSobrecubierta').append($("<option />").val(element.id).text(element.text));
|
||||||
});
|
});
|
||||||
|
|
||||||
if(valSobrecubierta != undefined)
|
if (valSobrecubierta != undefined)
|
||||||
$('#gramajeSobrecubierta option[value='+ valCubierta + ']').prop('selected', true).trigger('change');
|
$('#gramajeSobrecubierta option[value=' + valCubierta + ']').prop('selected', true).trigger('change');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#solapasCubierta').on('change', function() {
|
$('#solapasCubierta').on('change', function () {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$('#tamanioSolapasCubierta').show();
|
$('#tamanioSolapasCubierta').show();
|
||||||
} else {
|
} else {
|
||||||
@ -343,7 +336,7 @@ $('#solapasCubierta').on('change', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#solapasSobrecubierta').on('change', function() {
|
$('#solapasSobrecubierta').on('change', function () {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$('#tamanioSolapasSobrecubierta').show();
|
$('#tamanioSolapasSobrecubierta').show();
|
||||||
} else {
|
} else {
|
||||||
@ -353,7 +346,7 @@ $('#solapasSobrecubierta').on('change', function() {
|
|||||||
|
|
||||||
|
|
||||||
// Funcion que comprueba que están rellenos todos los datos necesarios para calcular el presupuesto
|
// Funcion que comprueba que están rellenos todos los datos necesarios para calcular el presupuesto
|
||||||
function checkValues(){
|
function checkValues() {
|
||||||
|
|
||||||
const tirada = $('#tirada').val();
|
const tirada = $('#tirada').val();
|
||||||
const paginas = $('#paginas').val();
|
const paginas = $('#paginas').val();
|
||||||
@ -364,27 +357,27 @@ function checkValues(){
|
|||||||
const papelFormatoAlto = $('#altoLibro').val();
|
const papelFormatoAlto = $('#altoLibro').val();
|
||||||
const papelFormatoAncho = $('#anchoLibro').val();
|
const papelFormatoAncho = $('#anchoLibro').val();
|
||||||
|
|
||||||
|
|
||||||
if(tirada == '' || isNaN(tirada) || parseInt(tirada) <= 0){
|
if (tirada == '' || isNaN(tirada) || parseInt(tirada) <= 0) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(paginas == '' || isNaN(paginas) || parseInt(paginas) <= 0){
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(papelInterior == '' || gramajeInterior == ''){
|
if (paginas == '' || isNaN(paginas) || parseInt(paginas) <= 0) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(papelCubierta == '' || gramajeCubierta == ''){
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('#papelFormatoId').val() == '' ||
|
if (papelInterior == '' || gramajeInterior == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (papelCubierta == '' || gramajeCubierta == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('#papelFormatoId').val() == '' ||
|
||||||
($('#papelFormatoPersonalizado').is(':checked') &&
|
($('#papelFormatoPersonalizado').is(':checked') &&
|
||||||
((papelFormatoAncho == '' || isNaN(papelFormatoAncho) || parseInt(papelFormatoAncho) <= 0) ||
|
((papelFormatoAncho == '' || isNaN(papelFormatoAncho) || parseInt(papelFormatoAncho) <= 0) ||
|
||||||
(papelFormatoAlto == '' || isNaN(papelFormatoAlto) || parseInt(papelFormatoAlto) <= 0) )
|
(papelFormatoAlto == '' || isNaN(papelFormatoAlto) || parseInt(papelFormatoAlto) <= 0))
|
||||||
)){
|
)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,26 +385,220 @@ function checkValues(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('.calcular-presupuesto').on('change', function() {
|
function getTiradas() {
|
||||||
|
let tiradas = [];
|
||||||
|
tiradas.push(parseInt($('#tirada').val()));
|
||||||
|
if ($('#tirada2').val().length > 0 && parseInt($('#tirada2').val()) > 0)
|
||||||
|
tiradas.push(parseInt($('#tirada2').val()));
|
||||||
|
if ($('#tirada3').val().length > 0 && parseInt($('#tirada3').val()) > 0)
|
||||||
|
tiradas.push(parseInt($('#tirada3').val()));
|
||||||
|
if ($('#tirada4').val().length > 0 && parseInt($('#tirada4').val()) > 0)
|
||||||
|
tiradas.push(parseInt($('#tirada4').val()));
|
||||||
|
return tiradas;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getDimensionLibro() {
|
||||||
|
|
||||||
|
var ancho = 0;
|
||||||
|
var alto = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if ($('#papelFormatoId').select2('data').length > 0) {
|
||||||
|
if ($('#papelFormatoId').select2('data')[0].id.length > 0) {
|
||||||
|
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
|
||||||
|
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
|
||||||
|
}
|
||||||
|
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
||||||
|
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||||
|
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
||||||
|
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||||
|
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
ancho: ancho,
|
||||||
|
alto: alto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#retractilado').on('change', function () {
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
if ($('#retractilado5').is(':checked'))
|
||||||
|
$('#retractilado5').prop('checked', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#retractilado5').on('change', function () {
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
if ($('#retractilado').is(':checked'))
|
||||||
|
$('#retractilado').prop('checked', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.elementos-libro').on('change', function () {
|
||||||
|
// Libro cosido
|
||||||
|
if ($('#cosidoDiv').hasClass('checked')) {
|
||||||
|
$('#tituloDisenioLibro').text("Rústica cosido");
|
||||||
|
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
||||||
|
// Cosido tapa blanda
|
||||||
|
$('.guardas').hide();
|
||||||
|
$('.solapas-cubierta').show();
|
||||||
|
$('.sobrecubierta').show();
|
||||||
|
$('#enableSobrecubierta').trigger('change');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Cosido tapa dura
|
||||||
|
$('.guardas').show();
|
||||||
|
numCarasGuardas(2);
|
||||||
|
$('.solapas-cubierta').hide();
|
||||||
|
$('.sobrecubierta').show();
|
||||||
|
$('#enableSobrecubierta').trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Libro fresado
|
||||||
|
else if ($('#fresadoDiv').hasClass('checked')) {
|
||||||
|
$('#tituloDisenioLibro').text("Rústica fresado");
|
||||||
|
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
||||||
|
// fresado tapa blanda
|
||||||
|
$('.guardas').hide();
|
||||||
|
$('.solapas-cubierta').show();
|
||||||
|
$('.sobrecubierta').show();
|
||||||
|
$('#enableSobrecubierta').trigger('change');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// fresado tapa dura
|
||||||
|
$('.guardas').show();
|
||||||
|
numCarasGuardas(2);
|
||||||
|
$('.solapas-cubierta').hide();
|
||||||
|
$('.sobrecubierta').show();
|
||||||
|
$('#enableSobrecubierta').trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Libro grapado
|
||||||
|
else if ($('#grapadoDiv').hasClass('checked')) {
|
||||||
|
$('#tituloDisenioLibro').text("Cosido con grapas");
|
||||||
|
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
||||||
|
// grapado tapa blanda
|
||||||
|
$('.guardas').hide();
|
||||||
|
$('.solapas-cubierta').show();
|
||||||
|
$('.sobrecubierta').hide();
|
||||||
|
$('#enableSobrecubierta').prop('checked', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Libro wire-o
|
||||||
|
else if ($('#wireoDiv').hasClass('checked')) {
|
||||||
|
$('#tituloDisenioLibro').text("Wire-O");
|
||||||
|
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
||||||
|
// wire-o tapa blanda
|
||||||
|
$('.guardas').hide();
|
||||||
|
$('.solapas-cubierta').show();
|
||||||
|
$('.sobrecubierta').hide();
|
||||||
|
$('#enableSobrecubierta').prop('checked', false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// wire-o tapa dura
|
||||||
|
$('.guardas').show();
|
||||||
|
numCarasGuardas(1);
|
||||||
|
$('.solapas-cubierta').hide();
|
||||||
|
$('.sobrecubierta').hide();
|
||||||
|
$('#enableSobrecubierta').prop('checked', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Libro espiral
|
||||||
|
else if ($('#espiralDiv').hasClass('checked')) {
|
||||||
|
$('#tituloDisenioLibro').text("Espiral");
|
||||||
|
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
||||||
|
// espiral tapa blanda
|
||||||
|
$('.guardas').hide();
|
||||||
|
$('.solapas-cubierta').show();
|
||||||
|
$('.sobrecubierta').hide();
|
||||||
|
$('#enableSobrecubierta').prop('checked', false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// espiral tapa dura
|
||||||
|
$('.espiral').show();
|
||||||
|
numCarasGuardas(1);
|
||||||
|
$('.solapas-cubierta').hide();
|
||||||
|
$('.sobrecubierta').hide();
|
||||||
|
$('#enableSobrecubierta').prop('checked', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function numCarasGuardas(numCaras) {
|
||||||
|
if (numCaras == 1) {
|
||||||
|
$("#impresionGuardas option[value='8']").remove();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($("#impresionGuardas option[value='8']").length == 0)
|
||||||
|
$("#impresionGuardas").append('<option value="8">' + window.Presupuestos.dosCaras + '</option>');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('.calcular-presupuesto').on('change', function () {
|
||||||
calcularPresupuesto();
|
calcularPresupuesto();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
async function calcularPresupuesto(){
|
async function calcularPresupuesto() {
|
||||||
|
|
||||||
if(!checkValues()){
|
// se obtiene la propiedad serv_id de los checkboxes seleccionados de la clase .servicio-extra
|
||||||
|
if (!checkValues()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var datos = {
|
let servicios = [];
|
||||||
tirada: $('#tirada').val(),
|
$('.servicio-extra:checked').each(function () {
|
||||||
merma: $('#merma').val(),
|
servicios.push($(this).attr('serv_id'));
|
||||||
uso: 'colorhq',
|
})
|
||||||
papelInterior: $('#papelInterior option:selected').text(),
|
|
||||||
|
let datos = {
|
||||||
|
tamanio: getDimensionLibro(),
|
||||||
|
tirada: getTiradas(),
|
||||||
|
paginas: $('#paginas').val(),
|
||||||
|
tipo: $('.custom-option-tipo.checked').attr('id').replace('Div', ''),
|
||||||
|
tapa: $('#tapaDura').is(':checked') ? 'dura' : 'blanda',
|
||||||
|
isColor: $('#colorNegroDiv').hasClass('checked') ? false : true,
|
||||||
|
isHq: $('#calidadEstandarDiv').hasClass('checked') ? false : true,
|
||||||
|
papelInterior: $('#papelInterior option:selected').val(),
|
||||||
gramajeInterior: $('#gramajeInterior option:selected').text(),
|
gramajeInterior: $('#gramajeInterior option:selected').text(),
|
||||||
papelCubierta: $('#papelCubierta option:selected').text(),
|
excluirRotativa: $('#excluirRotativa').is(':checked'),
|
||||||
|
papelCubierta: $('#papelCubierta option:selected').val(),
|
||||||
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
|
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
|
||||||
papelSobrecubierta: $('#papelSobrecubierta option:selected').text(),
|
carasCubierta: $('#carasCubierta').val(),
|
||||||
gramajeSobrecubierta: $('#gramajeSobrecubierta option:selected').text(),
|
acabadoCubierta: $('#acabadosCubierta').val(),
|
||||||
|
servicios: servicios,
|
||||||
|
}
|
||||||
|
// Si hay solapas de cubierta
|
||||||
|
if ($('#solapasCubierta').is(':checked')) {
|
||||||
|
datos.solapasCubierta = $('#anchoSolapasCubierta').val()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si hay sobrecubierta
|
||||||
|
if($('.enable-sobrecubierta').is(':visible')) {
|
||||||
|
datos.sobrecubierta = {
|
||||||
|
papel: $('#papelSobrecubierta option:selected').val(),
|
||||||
|
gramaje: $('#gramajeSobrecubierta option:selected').text(),
|
||||||
|
acabado: $('#acabadosSobrecubierta').val()
|
||||||
|
}
|
||||||
|
if($('#solapasSobrecubierta').is(':checked')) {
|
||||||
|
datos.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('.guardas').is(':visible')){
|
||||||
|
datos.guardas = {
|
||||||
|
papel: $('#papelGuardas option:selected').val(),
|
||||||
|
caras: $('#impresionGuardas option:selected').val()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,231 +318,3 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
$('.elementos-libro').on('change', function () {
|
|
||||||
// Libro cosido
|
|
||||||
if ($('#cosidoDiv').hasClass('checked')) {
|
|
||||||
$('#tituloDisenioLibro').text("Rústica cosido");
|
|
||||||
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
|
||||||
// Cosido tapa blanda
|
|
||||||
$('.guardas').hide();
|
|
||||||
$('.solapas-cubierta').show();
|
|
||||||
$('.sobrecubierta').show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Cosido tapa dura
|
|
||||||
$('.guardas').show();
|
|
||||||
numCarasGuardas(2);
|
|
||||||
$('.solapas-cubierta').hide();
|
|
||||||
$('.sobrecubierta').show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Libro fresado
|
|
||||||
else if ($('#fresadoDiv').hasClass('checked')) {
|
|
||||||
$('#tituloDisenioLibro').text("Rústica fresado");
|
|
||||||
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
|
||||||
// fresado tapa blanda
|
|
||||||
$('.guardas').hide();
|
|
||||||
$('.solapas-cubierta').show();
|
|
||||||
$('.sobrecubierta').show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// fresado tapa dura
|
|
||||||
$('.guardas').show();
|
|
||||||
numCarasGuardas(2);
|
|
||||||
$('.solapas-cubierta').hide();
|
|
||||||
$('.sobrecubierta').show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Libro grapado
|
|
||||||
else if ($('#grapadoDiv').hasClass('checked')) {
|
|
||||||
$('#tituloDisenioLibro').text("Cosido con grapas");
|
|
||||||
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
|
||||||
// grapado tapa blanda
|
|
||||||
$('.guardas').hide();
|
|
||||||
$('.solapas-cubierta').show();
|
|
||||||
$('.sobrecubierta').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Libro wire-o
|
|
||||||
else if ($('#wireoDiv').hasClass('checked')) {
|
|
||||||
$('#tituloDisenioLibro').text("Wire-O");
|
|
||||||
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
|
||||||
// wire-o tapa blanda
|
|
||||||
$('.guardas').hide();
|
|
||||||
$('.solapas-cubierta').show();
|
|
||||||
$('.sobrecubierta').hide();
|
|
||||||
$('#enableSobrecubierta').prop('checked', false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// wire-o tapa dura
|
|
||||||
$('.guardas').show();
|
|
||||||
numCarasGuardas(1);
|
|
||||||
$('.solapas-cubierta').hide();
|
|
||||||
$('.sobrecubierta').hide();
|
|
||||||
$('#enableSobrecubierta').prop('checked', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Libro espiral
|
|
||||||
else if ($('#espiralDiv').hasClass('checked')) {
|
|
||||||
$('#tituloDisenioLibro').text("Espiral");
|
|
||||||
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
|
|
||||||
// espiral tapa blanda
|
|
||||||
$('.guardas').hide();
|
|
||||||
$('.solapas-cubierta').show();
|
|
||||||
$('.sobrecubierta').hide();
|
|
||||||
$('#enableSobrecubierta').prop('checked', false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// espiral tapa dura
|
|
||||||
$('.espiral').show();
|
|
||||||
numCarasGuardas(1);
|
|
||||||
$('.solapas-cubierta').hide();
|
|
||||||
$('.sobrecubierta').hide();
|
|
||||||
$('#enableSobrecubierta').prop('checked', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function numCarasGuardas(numCaras) {
|
|
||||||
if (numCaras == 1) {
|
|
||||||
$("#impresionGuardas option[value='8']").remove();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($("#impresionGuardas option[value='8']").length == 0)
|
|
||||||
$("#impresionGuardas").append('<option value="8">' + window.Presupuestos.dosCaras + '</option>');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function calcular_mermas() {
|
|
||||||
|
|
||||||
const tirada = parseInt($('#tirada').val())
|
|
||||||
var merma = 0
|
|
||||||
|
|
||||||
if (tirada > window.datosPresupuesto.POD) {
|
|
||||||
merma = tirada * 0.1 <= 30 ? tirada * 0.1 : 30
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*merma_lineas = []
|
|
||||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
|
||||||
var rowData = this.data();
|
|
||||||
if(rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
|
|
||||||
const formas_linea = parseInt($('#isCosido').val())==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
|
|
||||||
if(formas_linea > tirada)
|
|
||||||
merma_lineas.push(formas_linea-tirada)
|
|
||||||
else
|
|
||||||
merma_lineas.push(tirada%formas_linea)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
if(merma_lineas.length>0)
|
|
||||||
merma = Math.max(...merma_lineas)
|
|
||||||
|
|
||||||
else{
|
|
||||||
htmlString = `
|
|
||||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
|
||||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
|
||||||
<i class="ti ti-bell ti-sm"></i>
|
|
||||||
</span>
|
|
||||||
<div class="d-flex flex-column ps-1">
|
|
||||||
<h5 class="alert-heading mb-2">` +
|
|
||||||
window.Presupuestos.validation.no_lp_for_merma +
|
|
||||||
`</h5>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
|
|
||||||
merma = 0
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
return merma;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDimensionLibro() {
|
|
||||||
var ancho = 0;
|
|
||||||
var alto = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if ($('#papelFormatoId').select2('data').length > 0) {
|
|
||||||
if ($('#papelFormatoId').select2('data')[0].id.length > 0) {
|
|
||||||
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
|
|
||||||
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
|
|
||||||
}
|
|
||||||
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
|
||||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
|
||||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (document.getElementById('papelFormatoPersonalizado').checked) {
|
|
||||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
|
||||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
ancho: ancho,
|
|
||||||
alto: alto
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTiradas() {
|
|
||||||
let tiradas = [];
|
|
||||||
tiradas.push(parseInt($('#tirada').val()));
|
|
||||||
if($('#tirada2').val().length > 0 && parseInt($('#tirada2').val()) > 0)
|
|
||||||
tiradas.push(parseInt($('#tirada2').val()));
|
|
||||||
if($('#tirada3').val().length > 0 && parseInt($('#tirada3').val()) > 0)
|
|
||||||
tiradas.push(parseInt($('#tirada3').val()));
|
|
||||||
if($('#tirada4').val().length > 0 && parseInt($('#tirada4').val()) > 0)
|
|
||||||
tiradas.push(parseInt($('#tirada4').val()));
|
|
||||||
return tiradas;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function checkPresupuestoData(){
|
|
||||||
if(
|
|
||||||
$('#clienteId').val().length > 0 &&
|
|
||||||
$('#paginas').val().length > 0 &&
|
|
||||||
$('#tirada').val().length > 0 &&
|
|
||||||
$('#papelInterior').val().length > 0 &&
|
|
||||||
$('#gramajeInterior').val().length > 0 &&
|
|
||||||
$('#papelCubierta').val().length > 0 &&
|
|
||||||
$('#gramajeCubierta').val().length > 0
|
|
||||||
){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function obtenerDatos() {
|
|
||||||
|
|
||||||
if(!checkPresupuestoData()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
libro = getDimensionLibro();
|
|
||||||
|
|
||||||
let data = {
|
|
||||||
clienteId: $('#clienteId').val(),
|
|
||||||
ancho: libro.ancho,
|
|
||||||
alto: libro.alto,
|
|
||||||
paginas: parseInt($('#paginas').val()),
|
|
||||||
tiradas: getTiradas(),
|
|
||||||
papelInterior: $('#papelInterior').val(),
|
|
||||||
gramajeInterior: $('#gramajeInterior').val(),
|
|
||||||
papelCubierta: $('#papelCubierta').val(),
|
|
||||||
gramajeCubierta: $('#gramajeCubierta').val(),
|
|
||||||
carasCubierta: $('#carasCubierta').val(),
|
|
||||||
acabadoCubierta: $('#acabadoCubiertaId').val(),
|
|
||||||
solapasCubierta: $('#solapasCubierta').is(':checked'),
|
|
||||||
tamanioSolapasCubierta: $('#anchoSolapasCubierta').val(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
3864
xdebug.log
3864
xdebug.log
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user