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%;">
|
||||
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
|
||||
foreach ($datosPresupuesto->acabadosCubierta as $acabado) : ?>
|
||||
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
|
||||
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_cubierta_id ? ' selected' : '' ?>>
|
||||
<?= $acabado->label ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
@ -465,7 +465,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="retractilado" class="form-check-label">
|
||||
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input 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') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -476,7 +476,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="retractilado5" class="form-check-label">
|
||||
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input 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') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -488,7 +488,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="fajaColor" class="form-check-label">
|
||||
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input 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') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -499,7 +499,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="prototipo" class="form-check-label">
|
||||
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input 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') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -513,38 +513,16 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="ferro" class="form-check-label">
|
||||
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input 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') ?>
|
||||
</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="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 -->
|
||||
|
||||
<!--SECCION DE SERVICIOS EXTRA -->
|
||||
<!--SECCION DE OTRAS OPCIONES -->
|
||||
<div class="divider divider-dark text-start mb-1">
|
||||
<div class="divider-text">
|
||||
<h5>Otras opciones</h5>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
|
||||
</span>
|
||||
</label>
|
||||
<input name="cosido" class="form-check-input elementos-libro" type="radio" value="tipoCosido"
|
||||
<input name="cosido" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoCosido"
|
||||
id="tipoCosido" checked="">
|
||||
</div>
|
||||
<h4 class="text-center">Rústica cosido</h4>
|
||||
@ -31,7 +31,7 @@
|
||||
src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
|
||||
</span>
|
||||
</label>
|
||||
<input name="fresado" class="form-check-input elementos-libro" type="radio" value="tipoFresado"
|
||||
<input name="fresado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoFresado"
|
||||
id="tipoFresado">
|
||||
</div>
|
||||
<h4 class="text-center">Rústica fresado</h4>
|
||||
@ -49,7 +49,7 @@
|
||||
src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
|
||||
</span>
|
||||
</label>
|
||||
<input name="grapado" class="form-check-input elementos-libro" type="radio" value="tipoGrapado"
|
||||
<input name="grapado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoGrapado"
|
||||
id="tipoGrapado">
|
||||
</div>
|
||||
<h4 class="text-center">Cosido con grapas</h4>
|
||||
@ -70,7 +70,7 @@
|
||||
src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
|
||||
</span>
|
||||
</label>
|
||||
<input name="espiral" class="form-check-input elementos-libro" type="radio" value="tipoEspiral"
|
||||
<input name="espiral" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoEspiral"
|
||||
id="tipoEspiral">
|
||||
</div>
|
||||
<h4 class="text-center">Espiral</h4>
|
||||
@ -88,7 +88,7 @@
|
||||
src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
|
||||
</span>
|
||||
</label>
|
||||
<input name="wireo" class="form-check-input elementos-libro" type="radio" value="tipoWireO"
|
||||
<input name="wireo" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoWireO"
|
||||
id="tipoWireO">
|
||||
</div>
|
||||
<h4 class="text-center">Wire-o</h4>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
$('#papelFormatoPersonalizado').on('change', function()
|
||||
{
|
||||
$('#papelFormatoPersonalizado').on('change', function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$('#tamanioLibroDiv').hide();
|
||||
$('#anchoLibroDiv').show();
|
||||
@ -14,8 +13,7 @@ $('#papelFormatoPersonalizado').on('change', function()
|
||||
|
||||
|
||||
// Init custom option check
|
||||
function initTapaCheck()
|
||||
{
|
||||
function initTapaCheck() {
|
||||
const _this = this
|
||||
|
||||
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 custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
@ -55,8 +52,7 @@ function updateTapaCheck(el)
|
||||
}
|
||||
|
||||
|
||||
function initColorCheck()
|
||||
{
|
||||
function initColorCheck() {
|
||||
const _this = this
|
||||
|
||||
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 custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
@ -97,8 +92,7 @@ function updateColorCheck(el)
|
||||
}
|
||||
|
||||
|
||||
function initCalidadCheck()
|
||||
{
|
||||
function initCalidadCheck() {
|
||||
const _this = this
|
||||
|
||||
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 custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
@ -392,6 +385,165 @@ function checkValues(){
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
});
|
||||
@ -399,19 +551,54 @@ $('.calcular-presupuesto').on('change', function() {
|
||||
|
||||
async function calcularPresupuesto() {
|
||||
|
||||
// se obtiene la propiedad serv_id de los checkboxes seleccionados de la clase .servicio-extra
|
||||
if (!checkValues()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var datos = {
|
||||
tirada: $('#tirada').val(),
|
||||
merma: $('#merma').val(),
|
||||
uso: 'colorhq',
|
||||
papelInterior: $('#papelInterior option:selected').text(),
|
||||
let servicios = [];
|
||||
$('.servicio-extra:checked').each(function () {
|
||||
servicios.push($(this).attr('serv_id'));
|
||||
})
|
||||
|
||||
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(),
|
||||
papelCubierta: $('#papelCubierta option:selected').text(),
|
||||
excluirRotativa: $('#excluirRotativa').is(':checked'),
|
||||
papelCubierta: $('#papelCubierta option:selected').val(),
|
||||
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
|
||||
papelSobrecubierta: $('#papelSobrecubierta option:selected').text(),
|
||||
gramajeSobrecubierta: $('#gramajeSobrecubierta option:selected').text(),
|
||||
carasCubierta: $('#carasCubierta').val(),
|
||||
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