mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en eventos datosLibro
This commit is contained in:
@ -501,26 +501,48 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$data['datosGenerales']['cliente']['nombre'] = $modelCliente->getNombre($presupuesto->cliente_id);
|
||||
$data['datosGenerales']['referenciaCliente'] = $presupuesto->referencia_cliente;
|
||||
|
||||
/*
|
||||
model('App\Models\Clientes\ClienteModel')
|
||||
->find($presupuesto->cliente_id)->nombre;
|
||||
$data['datosGenerales']['papelFormatoId'] = $presupuesto->papel_formato_id;
|
||||
$data['datosGenerales']['papelFormatoNombre'] = $modelPapelFormato->getNombre($presupuesto->papel_formato_id);
|
||||
$data['datosGenerales']['papelFormatoPersonalizado'] = $presupuesto->papel_formato_personalizado;
|
||||
$data['datosGenerales']['papelFormatoAncho'] = $presupuesto->papel_formato_ancho;
|
||||
$data['datosGenerales']['papelFormatoAlto'] = $presupuesto->papel_formato_alto;
|
||||
|
||||
$data['datosLibro']['papelFormatoId'] = $presupuesto->papel_formato_id;
|
||||
$data['datosLibro']['papelFormatoNombre'] = $modelPapelFormato->getNombre($presupuesto->papel_formato_id);
|
||||
$data['datosLibro']['papelFormatoPersonalizado'] = $presupuesto->papel_formato_personalizado;
|
||||
$data['datosLibro']['papelFormatoAncho'] = $presupuesto->papel_formato_ancho;
|
||||
$data['datosLibro']['papelFormatoAlto'] = $presupuesto->papel_formato_alto;
|
||||
$data['datosLibro']['paginas'] = $presupuesto->paginas;
|
||||
$data['datosLibro']['tirada'] = $presupuesto->tirada;
|
||||
$data['datosLibro']['merma'] = $presupuesto->merma;
|
||||
$data['datosLibro']['mermaCubierta'] = $presupuesto->merma_cubierta;
|
||||
$data['datosLibro']['solapasCubierta'] = $presupuesto->solapas;
|
||||
$data['datosLibro']['solapasSobrecubierta'] = $presupuesto->solapas_sobrecubierta;
|
||||
$data['datosLibro']['solapasCubiertaAncho'] = $presupuesto->solapas_ancho;
|
||||
$data['datosLibro']['solapasSobrecubiertaAncho'] = $presupuesto->solapas_ancho_sobrecubierta;
|
||||
$modelAcabado = model("App\Models\Tarifas\Acabados\TarifaAcabadoModel");
|
||||
$data['datosLibro']['acabadoCubierta']['id'] = $presupuesto->acabado_cubierta_id;
|
||||
if ($presupuesto->acabado_cubierta_id == 0) {
|
||||
$data['datosLibro']['acabadoCubierta']['text'] = "Ninguno";
|
||||
} else {
|
||||
$data['datosLibro']['acabadoCubierta']['text'] = $modelAcabado->find($presupuesto->acabado_cubierta_id)->nombre;
|
||||
}
|
||||
$data['datosLibro']['acabadoSobrecubierta']['id'] = $presupuesto->acabado_sobrecubierta_id;
|
||||
if ($presupuesto->acabado_sobrecubierta_id == 0) {
|
||||
$data['datosLibro']['acabadoSobrecubierta']['text'] = "Ninguno";
|
||||
} else {
|
||||
$data['datosLibro']['acabadoSobrecubierta']['text'] = $modelAcabado->find($presupuesto->acabado_sobrecubierta_id)->nombre;
|
||||
}
|
||||
|
||||
$data['datosLibro']['prototipo'] = $presupuesto->prototipo;
|
||||
$data['datosLibro']['ferro'] = $presupuesto->ferro;
|
||||
$data['datosLibro']['ferroDigital'] = $presupuesto->ferro_digital;
|
||||
$data['datosLibro']['marcapaginas'] = $presupuesto->marcapaginas;
|
||||
$data['datosLibro']['retractilado'] = $presupuesto->retractilado;
|
||||
$data['datosLibro']['retractilado5'] = $presupuesto->retractilado5;
|
||||
$data['datosLibro']['fajaColor'] = $presupuesto->faja_color;
|
||||
|
||||
/*
|
||||
$data['datosGenerales']['posPaginasColor'] = $presupuesto->comp_pos_paginas_color;
|
||||
$data['datosGenerales']['papelInteriorDiferente'] = $presupuesto->papel_interior_diferente;
|
||||
$data['datosGenerales']['paginasColorConsecutivas'] = $presupuesto->paginas_color_consecutivas;
|
||||
|
||||
$data['datosGenerales']['tipo'] = $this->getTipoLibro($presupuesto->tipo_impresion_id ?? null);
|
||||
$data['datosGenerales']['prototipo'] = $presupuesto->prototipo;
|
||||
$data['datosGenerales']['ferro'] = $presupuesto->ferro;
|
||||
$data['datosGenerales']['ferroDigital'] = $presupuesto->ferro_digital;
|
||||
$data['datosGenerales']['marcapaginas'] = $presupuesto->marcapaginas;
|
||||
$data['datosGenerales']['retractilado'] = $presupuesto->retractilado;
|
||||
$data['datosGenerales']['retractilado5'] = $presupuesto->retractilado5;
|
||||
|
||||
|
||||
$datos_papel = $this->obtenerDatosPapel($presupuesto->id);
|
||||
$data['interior'] = $datos_papel['interior'] ? $datos_papel['interior'] : [];
|
||||
|
||||
@ -38,21 +38,22 @@
|
||||
|
||||
<div class="col-md-12 col-lg-4 px-4">
|
||||
<div class="mb-1">
|
||||
<div class="tamanio-estandar">
|
||||
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
|
||||
<?= lang('Presupuestos.papelFormatoId') ?>*
|
||||
</label>
|
||||
|
||||
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="col-md-12 col-lg-6 tamanio-personalizado d-none">
|
||||
<div class="mb-1">
|
||||
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control formato_libro" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="col-md-12 col-lg-6 tamanio-personalizado d-none">
|
||||
<div class="mb-1">
|
||||
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control formato_libro" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
@ -126,7 +127,7 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-1 impresion-con-solapas" id="div_solapas_ancho">
|
||||
<div class="mb-1 impresion-con-solapas d-none" id="div_solapas_ancho">
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
|
||||
</label>
|
||||
@ -135,7 +136,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-1 impresion-con-solapas" id="div_solapas_ancho_sobrecubierta">
|
||||
<div class="mb-1 impresion-con-solapas d-none" id="div_solapas_ancho_sobrecubierta">
|
||||
<label for="solapas_ancho_sobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
|
||||
</label>
|
||||
@ -287,114 +288,4 @@
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS comportamiento general pag. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
var ancho_libro = getDimensionLibro().ancho;
|
||||
var alto_libro = getDimensionLibro().alto;
|
||||
|
||||
$('#retractilado').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
servicioRetractilado()
|
||||
});
|
||||
|
||||
|
||||
$('#retractilado5').on("change", function () {
|
||||
checkRetractiladoComparador(this);
|
||||
servicioRetractilado5()
|
||||
});
|
||||
|
||||
$('#fajaColor').on("change", function () {
|
||||
servicioFajaColor()
|
||||
});
|
||||
|
||||
$('#ferro').on("change", function () {
|
||||
servicioFerro()
|
||||
});
|
||||
|
||||
$('#prototipo').on("change", function () {
|
||||
servicioPrototipo()
|
||||
servicioFerro()
|
||||
});
|
||||
|
||||
|
||||
$('#papelFormatoId').on('select2:select', event_change_formato)
|
||||
$('.formato_libro').on('change', event_change_formato)
|
||||
|
||||
function event_change_formato(){
|
||||
ancho_libro = getDimensionLibro().ancho;
|
||||
alto_libro = getDimensionLibro().alto;
|
||||
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
$('.solapas_cubierta').trigger('change')
|
||||
$('.solapas_sobrecubierta').trigger('change')
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
//updateLineasPresupuesto()
|
||||
//update_servicios(false)
|
||||
}
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
|
||||
$("#solapas").on("click", function () {
|
||||
var e = document.getElementById('div_solapas_ancho');
|
||||
if (document.getElementById('solapas').checked) {
|
||||
e.style.display = "block";
|
||||
}
|
||||
else {
|
||||
e.style.display = "none";
|
||||
$('#solapas_ancho').val(0)
|
||||
}
|
||||
|
||||
$('#serv_default').click()
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
$("#solapas_sobrecubierta").on("click", function () {
|
||||
var e = document.getElementById('div_solapas_ancho_sobrecubierta');
|
||||
if (document.getElementById('solapas_sobrecubierta').checked) {
|
||||
e.style.display = "block";
|
||||
}
|
||||
else {
|
||||
e.style.display = "none";
|
||||
$('#solapas_ancho_sobrecubierta').val(0)
|
||||
}
|
||||
|
||||
$('#serv_default').click()
|
||||
});
|
||||
|
||||
let initTamanioPersonalizado = <?php echo ($presupuestoEntity->papel_formato_personalizado==true?1:0); ?>;
|
||||
if(initTamanioPersonalizado != null){
|
||||
if ( initTamanioPersonalizado){
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
}
|
||||
}
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -218,24 +218,7 @@ function computarPaginasColor(string) {
|
||||
}
|
||||
|
||||
|
||||
function checkRetractiladoComparador(element) {
|
||||
|
||||
switch (element.id) {
|
||||
case 'retractilado':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado5').prop('checked', false);
|
||||
}
|
||||
break;
|
||||
case 'retractilado5':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado').prop('checked', false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updatePapelesComparador() {
|
||||
|
||||
@ -502,16 +485,11 @@ function getDimensionLibro() {
|
||||
var ancho = 0;
|
||||
var alto = 0;
|
||||
|
||||
// TO-DO
|
||||
if (!document.getElementById('papelFormatoPersonalizado').checked) {
|
||||
ancho = 170//parseFloat($('#papelFormatoId').getText().trim().split(" x ")[0]);
|
||||
alto = 240//parseFloat($('#papelFormatoId').getText().trim().split(" x ")[1]);
|
||||
|
||||
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) {
|
||||
|
||||
@ -20,7 +20,12 @@ class PresupuestoAdminEdit {
|
||||
this.cosido = $("#isCosido");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip',
|
||||
{
|
||||
addService: this.addService,
|
||||
removeService: this.removeService,
|
||||
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
|
||||
}));
|
||||
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
@ -33,6 +38,7 @@ class PresupuestoAdminEdit {
|
||||
});
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.datosLibro.init();
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
@ -69,6 +75,7 @@ class PresupuestoAdminEdit {
|
||||
self.calcularPresupuesto = false;
|
||||
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
@ -103,6 +110,65 @@ class PresupuestoAdminEdit {
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
addService() {
|
||||
|
||||
}
|
||||
|
||||
removeService() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkPaginasPresupuesto() {
|
||||
|
||||
cantidad_total = 0
|
||||
|
||||
tableLineasPresupuesto.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||
cantidad_total += parseInt(rowData.paginas)
|
||||
})
|
||||
htmlString = ''
|
||||
|
||||
if (cantidad_total != parseInt($('#paginas').val())) {
|
||||
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.errores.paginasLP +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
var ancho = 0;
|
||||
var alto = 0;
|
||||
|
||||
|
||||
if ($('#papelFormatoPersonalizado').is(':checked')) {
|
||||
ancho = parseFloat($('#papelFormatoAncho').val());
|
||||
alto = parseFloat($('#papelFormatoAlto').val());
|
||||
}
|
||||
else {
|
||||
ancho = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[1]);
|
||||
}
|
||||
|
||||
return {
|
||||
ancho: ancho,
|
||||
alto: alto
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#checkChangesPresupuesto() {
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('change', function () {
|
||||
@ -150,7 +216,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos'] }, {},
|
||||
function (translations) {
|
||||
window.language = JSON.parse(translations);
|
||||
new PresupuestoAdminEdit().init();
|
||||
|
||||
@ -1,17 +1,27 @@
|
||||
import ClassSelect from '../../../components/select2.js';
|
||||
import { getToken } from '../../../common/common.js';
|
||||
|
||||
class DatosLibro {
|
||||
|
||||
constructor(domItem) {
|
||||
constructor(domItem, functions = {}) {
|
||||
|
||||
this.domItem = domItem;
|
||||
|
||||
this.addService = functions.addService;
|
||||
this.removeService = functions.removeService;
|
||||
this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto;
|
||||
|
||||
this.csrf_token = getToken();
|
||||
this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val();
|
||||
|
||||
this.paginas = this.domItem.find('#paginas');
|
||||
this.tirada = this.domItem.find('#tirada');
|
||||
this.tamanio = this.domItem.find('#papelFormatoId');
|
||||
this.tamanio = new ClassSelect($("#papelFormatoId"), '/papel-formato/getSelect2', window.language["formatoLibro"]);
|
||||
this.tamanioPersonalizado = this.domItem.find('#papelFormatoPersonalizado');
|
||||
this.anchoPersonalizado = this.domItem.find('#papelFormatoAncho');
|
||||
this.altoPersonalizado = this.domItem.find('#papelFormatoAlto');
|
||||
this.merma = this.domItem.find('#merma');
|
||||
this.mermaCubierta = this.domItem.find('#mermaCubierta');
|
||||
this.mermaCubierta = this.domItem.find('#mermacubierta');
|
||||
this.solapasCubierta = this.domItem.find('#solapas');
|
||||
this.solapasSobrecubierta = this.domItem.find('#solapas_sobrecubierta');
|
||||
this.anchoSolapasCubierta = this.domItem.find('#anchoSolapasCubierta');
|
||||
@ -20,12 +30,28 @@ class DatosLibro {
|
||||
this.divSolapasCubierta = this.domItem.find('#div_solapas_ancho');
|
||||
this.divSolapasSobrecubierta = this.domItem.find('#div_solapas_ancho_sobrecubierta');
|
||||
|
||||
this.acabadoCubierta = this.domItem.find('#acabado_cubierta_id');
|
||||
this.acabadoSobrecubierta = this.domItem.find('#acabado_sobrecubierta_id');
|
||||
this.acabadoCubierta = new ClassSelect($("#acabado_cubierta_id"),
|
||||
'/serviciosacabados/getacabados',
|
||||
'',
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
"cubierta": 1
|
||||
}
|
||||
);
|
||||
this.acabadoSobrecubierta = new ClassSelect($("#acabado_sobrecubierta_id"),
|
||||
'/serviciosacabados/getacabados',
|
||||
'',
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
"sobrecubierta": 1
|
||||
}
|
||||
);
|
||||
|
||||
this.retractilado = this.domItem.find('#retractilado');
|
||||
this.retractilado5 = this.domItem.find('#retractilado5');
|
||||
this.imprimirFajaColor = this.domItem.find('#imprimirFajaColor');
|
||||
this.imprimirFajaColor = this.domItem.find('#fajaColor');
|
||||
this.prototipo = this.domItem.find('#prototipo');
|
||||
this.ferro = this.domItem.find('#ferro');
|
||||
this.ferroDigital = this.domItem.find('#ferroDigital');
|
||||
@ -35,20 +61,193 @@ class DatosLibro {
|
||||
|
||||
init() {
|
||||
|
||||
this.tamanio.init();
|
||||
this.acabadoCubierta.init();
|
||||
this.acabadoSobrecubierta.init();
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
this.retractilado.on('change', this.checkRetractilado.bind(this));
|
||||
this.retractilado5.on('change', this.checkRetractilado.bind(this));
|
||||
this.imprimirFajaColor.on('change', (this.changeFajaColor.bind(this)));
|
||||
this.ferro.on('change', this.changeFerro.bind(this));
|
||||
this.prototipo.on('change', this.changePrototipo.bind(this));
|
||||
|
||||
this.tamanio.item.on('select2:select', this.changeFormato.bind(this));
|
||||
$('.formato_libro').on('change', this.changeFormato.bind(this));
|
||||
|
||||
if ($('#tipo_impresion_id').val() != 1 && $('#tipo_impresion_id').val() != 3 &&
|
||||
$('#tipo_impresion_id').val() != 5 && $('#tipo_impresion_id').val() != 7) {
|
||||
this.solapasCubierta.on('change', this.changeSolapasCubierta.bind(this));
|
||||
}
|
||||
|
||||
this.solapasSobrecubierta.on('change', this.changeSolapasSobrecubierta.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
changeFajaColor() {
|
||||
|
||||
if (this.imprimirFajaColor.prop('checked')) {
|
||||
this.addService('fajaColor');
|
||||
}
|
||||
else {
|
||||
this.removeService('fajaColor');
|
||||
}
|
||||
}
|
||||
|
||||
changeFerro() {
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
this.addService('ferro');
|
||||
}
|
||||
else {
|
||||
this.removeService('ferro');
|
||||
}
|
||||
}
|
||||
|
||||
changePrototipo() {
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
this.addService('prototipo');
|
||||
}
|
||||
else {
|
||||
this.removeService('prototipo');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkRetractilado(element) {
|
||||
|
||||
switch (element.id) {
|
||||
case 'retractilado':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado5').prop('checked', false);
|
||||
this.removeService('retractilado5');
|
||||
this.addService('retractilado');
|
||||
}
|
||||
break;
|
||||
case 'retractilado5':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado').prop('checked', false);
|
||||
this.removeService('retractilado');
|
||||
this.addService('retractilado5');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeFormato() {
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
$('.solapas_cubierta').trigger('change');
|
||||
$('.solapas_sobrecubierta').trigger('change');
|
||||
|
||||
this.checkPaginasPresupuesto();
|
||||
|
||||
// TO-DO
|
||||
/*updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})*/
|
||||
}
|
||||
|
||||
changeSolapasCubierta() {
|
||||
|
||||
if (this.solapasCubierta.prop('checked', true)) {
|
||||
this.divSolapasCubierta.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.divSolapasCubierta.addClass('d-none');
|
||||
this.anchoSolapasCubierta.val(0);
|
||||
}
|
||||
$('#serv_default').trigger('click');
|
||||
}
|
||||
|
||||
|
||||
changeSolapasSobrecubierta() {
|
||||
|
||||
if (this.solapasSobrecubierta.prop('checked', true)) {
|
||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.divSolapasSobrecubierta.addClass('d-none');
|
||||
this.anchoSolapasSobrecubierta.val(0);
|
||||
}
|
||||
$('#serv_default').trigger('click');
|
||||
}
|
||||
|
||||
|
||||
cargarDatos(datos) {
|
||||
|
||||
this.paginas.val(datos.paginas);
|
||||
this.tirada.val(datos.tirada);
|
||||
if (datos.papelFormatoPersonalizado) {
|
||||
this.tamanioPersonalizado.prop('checked', true);
|
||||
$(".tamanio-personalizado").removeClass('d-none');
|
||||
$(".tamanio-estandar").addClass('d-none');
|
||||
this.anchoPersonalizado.val(datos.papelFormatoAlto);
|
||||
this.altoPersonalizado.val(datos.papelFormatoAncho);
|
||||
}
|
||||
else {
|
||||
$(".tamanio-personalizado").addClass('d-none');
|
||||
$(".tamanio-estandar").removeClass('d-none');
|
||||
this.tamanio.setOption(datos.papelFormatoId, datos.papelFormatoNombre);
|
||||
}
|
||||
|
||||
this.merma.val(datos.merma);
|
||||
this.mermaCubierta.val(datos.mermaCubierta);
|
||||
|
||||
if ($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3 ||
|
||||
$('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 7) {
|
||||
$(".impresion-con-solapas").addClass('d-none');
|
||||
}
|
||||
else {
|
||||
if (datos.solapas) {
|
||||
this.solapasCubierta.val(datos.solapas);
|
||||
this.anchoSolapasCubierta.val(datos.ancho_solapas);
|
||||
$('#div_solapas_ancho').removeClass('d-none');
|
||||
}
|
||||
if (datos.solapas_sobrecubierta) {
|
||||
this.solapasSobrecubierta.prop('checked', true);
|
||||
this.anchoSolapasSobrecubierta.val(datos.ancho_solapas_sobrecubierta);
|
||||
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text);
|
||||
|
||||
if ($('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 6 ||
|
||||
$('#tipo_impresion_id').val() == 7 || $('#tipo_impresion_id').val() == 8
|
||||
|| $('#tipo_impresion_id').val() == 21) {
|
||||
$(".impresion-con-sobrecubierta").addClass('d-none');
|
||||
}
|
||||
else {
|
||||
|
||||
this.acabadoSobrecubierta.setOption(datos.acabadoSobrecubierta.id, datos.acabadoSobrecubierta.text);
|
||||
}
|
||||
|
||||
this.retractilado.prop('checked', datos.retractilado);
|
||||
this.retractilado5.prop('checked', datos.retractilado5);
|
||||
this.imprimirFajaColor.prop('checked', datos.fajaColor);
|
||||
this.prototipo.prop('checked', datos.prototipo);
|
||||
this.ferro.prop('checked', datos.ferro);
|
||||
this.ferroDigital.prop('checked', datos.ferroDigital);
|
||||
this.marcapaginas.prop('checked', datos.marcapaginas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user