mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en lineas presupuesto eventos
This commit is contained in:
@ -4,15 +4,16 @@
|
||||
* @param {String} url
|
||||
* @param {String} placeholder
|
||||
*/
|
||||
let ClassSelect = function (domItem, url, placeholder, allowClear = false, params = {}) {
|
||||
let ClassSelect = function (domItem, url, placeholder, allowClear = false, params = {}, dropdownParent = "") {
|
||||
this.url = url;
|
||||
this.item = domItem;
|
||||
this.params = params;
|
||||
|
||||
this.dropdownParent = dropdownParent;
|
||||
|
||||
this.config = {
|
||||
placeholder: placeholder,
|
||||
allowClear: allowClear,
|
||||
dropdownParent: domItem.parent(),
|
||||
dropdownParent: dropdownParent!=""?dropdownParent:domItem.parent(),
|
||||
language: "es",
|
||||
ajax: {
|
||||
url: () => {
|
||||
|
||||
@ -4,6 +4,7 @@ import Ajax from '../../components/ajax.js';
|
||||
import DatosGenerales from './sections/datosGenerales.js';
|
||||
import DatosLibro from './sections/datosLibro.js';
|
||||
import Comparador from './sections/comparador.js';
|
||||
import LineasPresupuesto from './sections/lineasPresupuesto.js';
|
||||
|
||||
class PresupuestoAdminEdit {
|
||||
|
||||
@ -19,6 +20,7 @@ class PresupuestoAdminEdit {
|
||||
this.cosido = $("#isCosido");
|
||||
this.tipo_impresion = $("#tipo_impresion_id");
|
||||
this.cosido = $("#isCosido");
|
||||
this.POD = $("#POD");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'),
|
||||
@ -28,6 +30,10 @@ class PresupuestoAdminEdit {
|
||||
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
|
||||
});
|
||||
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'));
|
||||
this.lineasPresupuesto = new LineasPresupuesto(this.domItem.find('#accordionLineasPresupuestoTip'),
|
||||
{
|
||||
getDimensionLibro: this.getDimensionLibro,
|
||||
});
|
||||
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
@ -42,6 +48,7 @@ class PresupuestoAdminEdit {
|
||||
this.datosGenerales.init();
|
||||
this.datosLibro.init();
|
||||
this.comparador.init();
|
||||
this.lineasPresupuesto.init();
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
@ -74,6 +81,7 @@ class PresupuestoAdminEdit {
|
||||
self.lsc.val(parseFloat(response.data.lsc).toFixed(2));
|
||||
self.cosido.val(response.data.cosido);
|
||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||
self.POD.val(response.data.POD);
|
||||
|
||||
self.calcularPresupuesto = false;
|
||||
|
||||
@ -164,8 +172,11 @@ class PresupuestoAdminEdit {
|
||||
alto = parseFloat($('#papelFormatoAlto').val());
|
||||
}
|
||||
else {
|
||||
ancho = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[1]);
|
||||
const selectedText = $('#papelFormatoId').find('option:selected').text();
|
||||
if (selectedText.length > 0) {
|
||||
ancho = parseFloat(selectedText.trim().split(" x ")[0]);
|
||||
alto = parseFloat(selectedText.trim().split(" x ")[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@ -961,8 +961,8 @@ class Comparador {
|
||||
cliente_id: $('#clienteId').select2('data')[0].id,
|
||||
papel_generico: papel_generico,
|
||||
gramaje: gramaje,
|
||||
isColor: this.tipo_impresion.val().includes('color'),
|
||||
isHq: this.tipo_impresion.val().includes('hq'),
|
||||
isColor: this.tipo_impresion.val().includes('color')?1:0,
|
||||
isHq: this.tipo_impresion.val().includes('hq')?1:0,
|
||||
paginas_color: paginasColor
|
||||
}
|
||||
|
||||
@ -970,7 +970,9 @@ class Comparador {
|
||||
datos.datosPedido.lomo = this.getLomoLineasPresupuesto('interior');
|
||||
datos.datosPedido.solapas = $('#solapas').prop('checked') ? 1 : 0;
|
||||
datos.datosPedido.solapas_ancho = $('#solapas').prop('checked') ? parseInt($('#solapas_ancho').val()) : 0;
|
||||
datos.lomoRedondo = this.lomoRedondo.val();
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
datos.lomoRedondo = this.lomoRedondo.val();
|
||||
}
|
||||
}
|
||||
else if (uso == 'sobrecubierta') {
|
||||
datos.datosPedido.lomo = this.getLomoLineasPresupuesto() + this.getLomoLineasPresupuesto('cubierta');
|
||||
@ -1039,8 +1041,8 @@ class Comparador {
|
||||
}
|
||||
else {
|
||||
|
||||
const isHq = this.tipo_impresion.val().includes('hq');
|
||||
const isColor = this.tipo_impresion.val().includes('color');
|
||||
const isHq = this.tipo_impresion.val().includes('hq')?1:0;
|
||||
const isColor = this.tipo_impresion.val().includes('color')?1:0;
|
||||
|
||||
datosComp.data['tipo_maquina'] = 'plana';
|
||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||
|
||||
@ -289,15 +289,16 @@ class DatosLibro {
|
||||
|
||||
calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
htmlString = ''
|
||||
const tirada = parseInt($('#tirada').val());
|
||||
const POD = parseInt($('#POD').val());
|
||||
let merma = 0;
|
||||
let htmlString = '';
|
||||
|
||||
if(tirada> parseInt($('#POD').val())){
|
||||
merma = tirada*0.1<=30 ? tirada*0.1 : 30
|
||||
if(tirada> POD){
|
||||
merma = tirada*0.1<=POD ? tirada*0.1 : POD;
|
||||
}
|
||||
else{
|
||||
merma_lineas = []
|
||||
let 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'){
|
||||
@ -342,6 +343,7 @@ class DatosLibro {
|
||||
|
||||
this.paginas.val(datos.paginas);
|
||||
this.tirada.val(datos.tirada);
|
||||
this.calcular_mermas();
|
||||
if (datos.papelFormatoPersonalizado) {
|
||||
this.tamanioPersonalizado.prop('checked', true);
|
||||
$(".tamanio-personalizado").removeClass('d-none');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user