mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta arreglar error en load_envios
This commit is contained in:
@ -34,6 +34,12 @@ class Js_loader extends BaseController
|
||||
}
|
||||
|
||||
|
||||
function datosLibro_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js');
|
||||
}
|
||||
|
||||
function previsualizador_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
|
||||
@ -92,8 +92,8 @@ return [
|
||||
'encuadernacion' => 'Binding',
|
||||
'solapasCubierta' => 'Cover dust jacket',
|
||||
'solapasAnchoCubierta' => 'Cover dust jacket width',
|
||||
'1cara' => '1 side',
|
||||
'2caras' => '2 sides',
|
||||
'unaCara' => '1 side',
|
||||
'dosCaras' => '2 sides',
|
||||
'bn' => 'BW',
|
||||
'bnhq' => 'BWHQ',
|
||||
'color' => 'Colour',
|
||||
|
||||
@ -108,8 +108,8 @@ return [
|
||||
'solapasAnchoCubierta' => 'Ancho solapas cub.',
|
||||
'solapasAnchoSobrecubierta' => 'Ancho solapas sobrecub.',
|
||||
'sinImpresion' => 'Sin impresion',
|
||||
'1cara' => '1 cara',
|
||||
'2caras' => '2 caras',
|
||||
'unaCara' => '1 cara',
|
||||
'dosCaras' => '2 caras',
|
||||
'bn' => 'BN',
|
||||
'bnhq' => 'BNHQ',
|
||||
'color' => 'Color',
|
||||
@ -257,6 +257,7 @@ return [
|
||||
'requerido' => 'El campo {field} es obligatorio.',
|
||||
'max_length' => 'El campo {field} no puede exceder los {param} caracteres de longitud.',
|
||||
'no_lp_for_merma' => 'Inserte líneas de presupuesto para calcular la merma',
|
||||
'ejemplares_envio' => 'El número de ejemplares enviados no coincide con la tirada',
|
||||
],
|
||||
|
||||
'errores' => [
|
||||
|
||||
@ -17,9 +17,9 @@ return [
|
||||
'paginasMax' => 'Páginas Max',
|
||||
'paginasMin' => 'Páginas Min',
|
||||
'dimensiones' => 'Dimensiones',
|
||||
'menor_a5' =>'Menor A5',
|
||||
'menor_a5' =>'Hasta A5',
|
||||
'entre_a5_a4' =>'Entre A5 y A4',
|
||||
'mayor_a4' =>'Mayor A4',
|
||||
'mayor_a4' =>'Desde A4',
|
||||
'por_defecto' =>'Genérico',
|
||||
'moduleExplanation' => 'El número de páginas reflejado en este apartado se refiere por ejemplar, no al total del pedido',
|
||||
'margen' => 'Margen',
|
||||
|
||||
@ -103,7 +103,9 @@ function checkInsertar(){
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang("PresupuestosDirecciones.validation.ejemplares_envio") ?></h5>
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.validation.ejemplares_envio +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
@ -181,4 +183,254 @@ async function updateTablaEnvios(tirada_inicial = null, tirada = null){
|
||||
popErrorAlert(window.error_no_tarifa_envio, 'error-tarifa')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$('#insertar_direccion').on('click', function(){
|
||||
|
||||
$("#addressForm").attr('action','create')
|
||||
var $newAddDialog = $("#addressForm")
|
||||
var maximaCantidad = parseInt($('#tirada').val())
|
||||
$("#add_cantidad").attr("max" , maximaCantidad);
|
||||
$("#add_cantidad").val( maximaCantidad);
|
||||
$("#add_cantidad").on('change', function(){
|
||||
$("#add_cantidad").val(parseInt($("#add_cantidad").val())>maximaCantidad ? maximaCantidad : $("#add_cantidad").val())
|
||||
})
|
||||
|
||||
cantidad_total = 0
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data = this.data();
|
||||
cantidad_total += parseInt(data.cantidad)
|
||||
} );
|
||||
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val())-cantidad_total)
|
||||
$('#add_cantidad').val(parseInt($('#tirada').val())-cantidad_total)
|
||||
$newAddDialog.modal('show')
|
||||
})
|
||||
|
||||
const lastColNr_direcciones = $('#tableOfDireccionesEnvio').find("tr:first th").length - 1;
|
||||
|
||||
|
||||
$(document).on('click', '.delete-add-row', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
tableEnvios.row( row )
|
||||
.remove()
|
||||
.draw();
|
||||
checkInsertar()
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
$(document).on('click', '.btn-edit-add', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
var data = tableEnvios.row( row ).data()
|
||||
|
||||
$("#addressForm").attr('action','edit')
|
||||
$("#addressForm").attr('row', row[0]._DT_RowIndex)
|
||||
$("#addressForm").attr('presupuestodireccion_id', $(this).attr('data-id'))
|
||||
var $newAddDialog = $("#addressForm")
|
||||
var maximaCantidad = parseInt($('#tirada').val())
|
||||
$("#add_cantidad").attr("max" , maximaCantidad);
|
||||
$("#add_cantidad").val( maximaCantidad);
|
||||
$("#add_cantidad").on('change', function(){
|
||||
$("#add_cantidad").val(parseInt($("#add_cantidad").val())>maximaCantidad ? maximaCantidad : $("#add_cantidad").val())
|
||||
})
|
||||
|
||||
cantidad_total = 0
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data2 = this.data();
|
||||
cantidad_total += parseInt(data2.cantidad)
|
||||
} );
|
||||
cantidad_total -= parseInt(data.cantidad) // Si es editar tienes que restar los de la linea actual
|
||||
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val())-cantidad_total)
|
||||
$('#add_cantidad').val(parseInt($('#tirada').val())-cantidad_total)
|
||||
|
||||
$('#add_att').val(data.att)
|
||||
$('#add_direccion').val(data.direccion)
|
||||
$('#add_email').val(data.email)
|
||||
$('#add_cp').val(data.cp)
|
||||
$('#add_municipio').val(data.municipio)
|
||||
$('#add_provincia').val(data.provincia)
|
||||
$('#add_pais_id').val(data.paisId)
|
||||
$('#add_telefono').val(data.telefono)
|
||||
$('#add_cantidad').val(data.cantidad)
|
||||
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle==1?true:false)
|
||||
|
||||
$newAddDialog.modal('show')
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#recoger_en_taller').change(function(){
|
||||
if(this.checked) {
|
||||
$('#rowTable').css('display', 'none')
|
||||
$('#rowInsertar').css('display', 'none')
|
||||
tableEnvios.clear().draw()
|
||||
}
|
||||
else{
|
||||
$('#rowTable').css('display', 'flex')
|
||||
$('#rowInsertar').css('display', 'flex')
|
||||
tableEnvios.columns.adjust();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
|
||||
draw:5,
|
||||
serverSide: false,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
order: [[ 0, "asc" ]],
|
||||
pageLength: 20,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
scrollX: true,
|
||||
|
||||
columns: [
|
||||
{ 'data': 'tarifa_id' },
|
||||
{ 'data': 'cantidad' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'att' },
|
||||
{ 'data': 'email' },
|
||||
{ 'data': 'direccion' },
|
||||
{ 'data': 'cp' },
|
||||
{ 'data': 'municipio' },
|
||||
{ 'data': 'paisId' ,
|
||||
render: function(data, type, row, meta) {
|
||||
var value = window.paisList.find(element => element.id === data);
|
||||
return value['nombre'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'telefono' },
|
||||
{ 'data': 'proveedor'},
|
||||
{ 'data': 'proveedor_id'},
|
||||
{ 'data': 'precio' },
|
||||
{ 'data': 'margen' },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{
|
||||
data: actionBtns_direcciones,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr_direcciones]
|
||||
},
|
||||
{"orderData": [ 0], "targets": 0 },
|
||||
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [0,11,13,14],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function save_datos_envios(){
|
||||
$.post( window.routes_envios.dataTableOfPresupuestoDirecciones,
|
||||
Object.assign({tipo: "clear_lineas", presupuesto_id: id}, window.token_ajax))
|
||||
.done(function( data ) {
|
||||
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data = this.data();
|
||||
$.post( '/presupuestos/presupuestodirecciones/add',
|
||||
Object.assign({
|
||||
presupuesto_id : id,
|
||||
tarifa_id : data.tarifa_id,
|
||||
cantidad : data.cantidad,
|
||||
peso : data.peso,
|
||||
att : data.att,
|
||||
email : data.email,
|
||||
direccion : data.direccion,
|
||||
paisId : data.paisId,
|
||||
provincia : data.provincia,
|
||||
municipio : data.municipio,
|
||||
cp : data.cp,
|
||||
telefono : data.telefono,
|
||||
precio : data.precio,
|
||||
margen : data.margen,
|
||||
proveedor : data.proveedor,
|
||||
proveedor_id : data.proveedor_id,
|
||||
entregaPieCalle : data.entregaPieCalle}, window.token_ajax))
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function load_datos_envios(){
|
||||
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
const id = url_parts[url_parts.length-1];
|
||||
}
|
||||
else{
|
||||
const id = -1;
|
||||
}
|
||||
|
||||
$.post( window.routes_envios.dataTableOfPresupuestoDirecciones,
|
||||
Object.assign({
|
||||
draw: 1,
|
||||
columns: 1,
|
||||
search: {value: ""},
|
||||
presupuesto_id: id},
|
||||
window.token_ajax))
|
||||
.done(function( data ) {
|
||||
data.data.forEach((linea) => {
|
||||
tableEnvios.row
|
||||
.add({
|
||||
'tarifa_id': linea.tarifa_id,
|
||||
'cantidad': linea.cantidad,
|
||||
'peso': linea.peso,
|
||||
'att': linea.att,
|
||||
'email': linea.email,
|
||||
'direccion': linea.direccion,
|
||||
'cp': linea.cp,
|
||||
'municipio': linea.municipio,
|
||||
'provincia': linea.provincia,
|
||||
'paisId': linea.pais_id,
|
||||
'telefono': linea.telefono,
|
||||
'proveedor': linea.proveedor,
|
||||
'proveedor_id': linea.proveedor_id,
|
||||
'precio': linea.precio,
|
||||
'margen': linea.margen,
|
||||
'entregaPieCalle': linea.entregaPieCalle,
|
||||
'actionBtns_direcciones': actionBtns_direcciones,
|
||||
})
|
||||
.draw();
|
||||
checkInsertar()
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@ -60,258 +60,16 @@
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#insertar_direccion').on('click', function(){
|
||||
|
||||
$("#addressForm").attr('action','create')
|
||||
var $newAddDialog = $("#addressForm")
|
||||
var maximaCantidad = parseInt($('#tirada').val())
|
||||
$("#add_cantidad").attr("max" , maximaCantidad);
|
||||
$("#add_cantidad").val( maximaCantidad);
|
||||
$("#add_cantidad").on('change', function(){
|
||||
$("#add_cantidad").val(parseInt($("#add_cantidad").val())>maximaCantidad ? maximaCantidad : $("#add_cantidad").val())
|
||||
})
|
||||
|
||||
cantidad_total = 0
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data = this.data();
|
||||
cantidad_total += parseInt(data.cantidad)
|
||||
} );
|
||||
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val())-cantidad_total)
|
||||
$('#add_cantidad').val(parseInt($('#tirada').val())-cantidad_total)
|
||||
$newAddDialog.modal('show')
|
||||
})
|
||||
|
||||
const lastColNr_direcciones = $('#tableOfDireccionesEnvio').find("tr:first th").length - 1;
|
||||
|
||||
|
||||
$(document).on('click', '.delete-add-row', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
tableEnvios.row( row )
|
||||
.remove()
|
||||
.draw();
|
||||
checkInsertar()
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
$(document).on('click', '.btn-edit-add', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
var data = tableEnvios.row( row ).data()
|
||||
|
||||
$("#addressForm").attr('action','edit')
|
||||
$("#addressForm").attr('row', row[0]._DT_RowIndex)
|
||||
$("#addressForm").attr('presupuestodireccion_id', $(this).attr('data-id'))
|
||||
var $newAddDialog = $("#addressForm")
|
||||
var maximaCantidad = parseInt($('#tirada').val())
|
||||
$("#add_cantidad").attr("max" , maximaCantidad);
|
||||
$("#add_cantidad").val( maximaCantidad);
|
||||
$("#add_cantidad").on('change', function(){
|
||||
$("#add_cantidad").val(parseInt($("#add_cantidad").val())>maximaCantidad ? maximaCantidad : $("#add_cantidad").val())
|
||||
})
|
||||
|
||||
cantidad_total = 0
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data2 = this.data();
|
||||
cantidad_total += parseInt(data2.cantidad)
|
||||
} );
|
||||
cantidad_total -= parseInt(data.cantidad) // Si es editar tienes que restar los de la linea actual
|
||||
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val())-cantidad_total)
|
||||
$('#add_cantidad').val(parseInt($('#tirada').val())-cantidad_total)
|
||||
|
||||
$('#add_att').val(data.att)
|
||||
$('#add_direccion').val(data.direccion)
|
||||
$('#add_email').val(data.email)
|
||||
$('#add_cp').val(data.cp)
|
||||
$('#add_municipio').val(data.municipio)
|
||||
$('#add_provincia').val(data.provincia)
|
||||
$('#add_pais_id').val(data.paisId)
|
||||
$('#add_telefono').val(data.telefono)
|
||||
$('#add_cantidad').val(data.cantidad)
|
||||
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle==1?true:false)
|
||||
|
||||
$newAddDialog.modal('show')
|
||||
})
|
||||
|
||||
|
||||
const paisList = <?php echo json_encode($paisList); ?>;
|
||||
|
||||
|
||||
$('#recoger_en_taller').change(function(){
|
||||
if(this.checked) {
|
||||
$('#rowTable').css('display', 'none')
|
||||
$('#rowInsertar').css('display', 'none')
|
||||
tableEnvios.clear().draw()
|
||||
}
|
||||
else{
|
||||
$('#rowTable').css('display', 'flex')
|
||||
$('#rowInsertar').css('display', 'flex')
|
||||
tableEnvios.columns.adjust();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
|
||||
draw:5,
|
||||
serverSide: false,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
order: [[ 0, "asc" ]],
|
||||
pageLength: 20,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
scrollX: true,
|
||||
|
||||
columns: [
|
||||
{ 'data': 'tarifa_id' },
|
||||
{ 'data': 'cantidad' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'att' },
|
||||
{ 'data': 'email' },
|
||||
{ 'data': 'direccion' },
|
||||
{ 'data': 'cp' },
|
||||
{ 'data': 'municipio' },
|
||||
{ 'data': 'paisId' ,
|
||||
render: function(data, type, row, meta) {
|
||||
var value = paisList.find(element => element.id === data);
|
||||
return value['nombre'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'telefono' },
|
||||
{ 'data': 'proveedor'},
|
||||
{ 'data': 'proveedor_id'},
|
||||
{ 'data': 'precio' },
|
||||
{ 'data': 'margen' },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{
|
||||
data: actionBtns_direcciones,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr_direcciones]
|
||||
},
|
||||
{"orderData": [ 0], "targets": 0 },
|
||||
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [0,11,13,14],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function save_datos_envios(){
|
||||
$.post( '<?= route_to('dataTableOfPresupuestoDirecciones') ?>',
|
||||
{
|
||||
tipo: "clear_lineas",
|
||||
presupuesto_id: id,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
})
|
||||
.done(function( data ) {
|
||||
|
||||
tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var data = this.data();
|
||||
$.post( '/presupuestos/presupuestodirecciones/add',
|
||||
{
|
||||
presupuesto_id : id,
|
||||
tarifa_id : data.tarifa_id,
|
||||
cantidad : data.cantidad,
|
||||
peso : data.peso,
|
||||
att : data.att,
|
||||
email : data.email,
|
||||
direccion : data.direccion,
|
||||
paisId : data.paisId,
|
||||
provincia : data.provincia,
|
||||
municipio : data.municipio,
|
||||
cp : data.cp,
|
||||
telefono : data.telefono,
|
||||
precio : data.precio,
|
||||
margen : data.margen,
|
||||
proveedor : data.proveedor,
|
||||
proveedor_id : data.proveedor_id,
|
||||
entregaPieCalle : data.entregaPieCalle,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
window.paisList = <?php echo json_encode($paisList); ?>;
|
||||
|
||||
window.routes_envios = {
|
||||
dataTableOfPresupuestoDirecciones: '<?= route_to('dataTableOfPresupuestoDirecciones') ?>'
|
||||
}
|
||||
|
||||
load_datos_envios()
|
||||
|
||||
function load_datos_envios(){
|
||||
$.post( '<?= route_to('dataTableOfPresupuestoDirecciones') ?>',
|
||||
{
|
||||
draw: 1,
|
||||
columns: 1,
|
||||
search: {
|
||||
value: "",
|
||||
},
|
||||
presupuesto_id: id,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
})
|
||||
.done(function( data ) {
|
||||
data.data.forEach((linea) => {
|
||||
tableEnvios.row
|
||||
.add({
|
||||
'tarifa_id': linea.tarifa_id,
|
||||
'cantidad': linea.cantidad,
|
||||
'peso': linea.peso,
|
||||
'att': linea.att,
|
||||
'email': linea.email,
|
||||
'direccion': linea.direccion,
|
||||
'cp': linea.cp,
|
||||
'municipio': linea.municipio,
|
||||
'provincia': linea.provincia,
|
||||
'paisId': linea.pais_id,
|
||||
'telefono': linea.telefono,
|
||||
'proveedor': linea.proveedor,
|
||||
'proveedor_id': linea.proveedor_id,
|
||||
'precio': linea.precio,
|
||||
'margen': linea.margen,
|
||||
'entregaPieCalle': linea.entregaPieCalle,
|
||||
'actionBtns_direcciones': actionBtns_direcciones,
|
||||
})
|
||||
.draw();
|
||||
checkInsertar()
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
});
|
||||
//$('#tableOfDireccionesEnvio').bind('draw.dt', update_tiradas_alternativas);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
window.url_get_precio_envio = '<?= route_to('processDataDirecciones') ?>';
|
||||
window.error_no_tarifa_envio = '<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>'
|
||||
window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
|
||||
|
||||
load_datos_envios()
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -0,0 +1,146 @@
|
||||
$('#paginas').on("change", function () {
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
$('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val()));
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val()));
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.solapas_cubierta').on('change', function(){
|
||||
$('#compGramajeCubierta').trigger('change')
|
||||
})
|
||||
|
||||
$('.solapas_sobrecubierta').on('change', function(){
|
||||
$('#compGramajeSobrecubierta').trigger('change')
|
||||
})
|
||||
|
||||
$('#tirada').on("change", function (update_tiradas_alternativas = true) {
|
||||
|
||||
calcular_mermas()
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
if(update_tiradas_alternativas)
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
else
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
checkInsertar()
|
||||
}
|
||||
})
|
||||
|
||||
function calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
htmlString = ''
|
||||
|
||||
if(tirada> parseInt($('#POD').val())){
|
||||
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"><?= lang("Presupuestos.validation.no_lp_for_merma") ?></h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
merma = 0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$('#mermacubierta').val(parseInt(merma))
|
||||
$('#merma').val(parseInt(merma))
|
||||
$('#alert-datosLibro').html(htmlString)
|
||||
}
|
||||
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
$('#papelFormatoPersonalizado').on("click",function(){
|
||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||
if(checkbox.checked == true){
|
||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
$('#papelFormatoId').val(0).change();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
|
||||
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
|
||||
}
|
||||
else{
|
||||
document.getElementById("papelFormatoAncho").value= "";
|
||||
document.getElementById("papelFormatoAlto").value= "";
|
||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||
$('#papelFormatoId').next(".select2-container").show();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
||||
}
|
||||
});
|
||||
@ -327,130 +327,6 @@
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#paginas').on("change", function () {
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
$('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val()));
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val()));
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.solapas_cubierta').on('change', function(){
|
||||
$('#compGramajeCubierta').trigger('change')
|
||||
})
|
||||
|
||||
$('.solapas_sobrecubierta').on('change', function(){
|
||||
$('#compGramajeSobrecubierta').trigger('change')
|
||||
})
|
||||
|
||||
$('#tirada').on("change", function (update_tiradas_alternativas = true) {
|
||||
|
||||
calcular_mermas()
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
if(update_tiradas_alternativas)
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
else
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
checkInsertar()
|
||||
}
|
||||
})
|
||||
|
||||
function calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
htmlString = ''
|
||||
|
||||
if(tirada><?php echo $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 = <?php echo $isCosido; ?>==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"><?= lang("Presupuestos.validation.no_lp_for_merma") ?></h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
merma = 0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$('#mermacubierta').val(parseInt(merma))
|
||||
$('#merma').val(parseInt(merma))
|
||||
$('#alert-datosLibro').html(htmlString)
|
||||
}
|
||||
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
let initTamanioPersonalizado = <?php echo ($presupuestoEntity->papel_formato_personalizado==true?1:0); ?>;
|
||||
if(initTamanioPersonalizado != null){
|
||||
@ -459,27 +335,7 @@ if(initTamanioPersonalizado != null){
|
||||
}
|
||||
}
|
||||
|
||||
$('#papelFormatoPersonalizado').on("click",function(){
|
||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||
if(checkbox.checked == true){
|
||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
$('#papelFormatoId').val(0).change();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
|
||||
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
|
||||
}
|
||||
else{
|
||||
document.getElementById("papelFormatoAncho").value= "";
|
||||
document.getElementById("papelFormatoAlto").value= "";
|
||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||
$('#papelFormatoId').next(".select2-container").show();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
var ancho_libro = getDimensionLibro().ancho;
|
||||
|
||||
@ -188,10 +188,10 @@
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compCarasCubierta" name="comp_paginas_cubierta" class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
|
||||
<option value="2">
|
||||
<p><?= lang('Presupuestos.1cara') ?></p>
|
||||
<p><?= lang('Presupuestos.unaCara') ?></p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<p><?= lang('Presupuestos.2caras') ?></p>
|
||||
<p><?= lang('Presupuestos.dosCaras') ?></p>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -261,10 +261,10 @@
|
||||
<p><?= lang('Presupuestos.sinImpresion') ?></p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<p><?= lang('Presupuestos.1cara') ?></p>
|
||||
<p><?= lang('Presupuestos.unaCara') ?></p>
|
||||
</option>
|
||||
<option value="8">
|
||||
<p><?= lang('Presupuestos.2caras') ?></p>
|
||||
<p><?= lang('Presupuestos.dosCaras') ?></p>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -243,6 +243,12 @@
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
|
||||
if (url_parts[url_parts.length - 2] == 'edit') {
|
||||
id = url_parts[url_parts.length - 1];
|
||||
} else {
|
||||
id = -1;
|
||||
}
|
||||
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
@ -250,15 +256,7 @@ const url_parts = url.split('/');
|
||||
function generate_json_tiradas() {
|
||||
const data = tableTiradas.rows().data().toArray();
|
||||
$('#tirada_alternativa_json_data').val(JSON.stringify(data));
|
||||
}
|
||||
|
||||
|
||||
if (url_parts[url_parts.length - 2] == 'edit') {
|
||||
id = url_parts[url_parts.length - 1];
|
||||
} else {
|
||||
id = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#presupuestoForm').on("submit", function(event) {
|
||||
event.preventDefault();
|
||||
@ -310,7 +308,7 @@ const url_parts = url.split('/');
|
||||
|
||||
window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
|
||||
window.csrf_token = '<?= csrf_token() ?>';
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
<?php endif; ?>
|
||||
|
||||
@ -332,6 +330,7 @@ const url_parts = url.split('/');
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/datosLibro_js') ?>"></script>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user