mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado tarifas envio
This commit is contained in:
@ -48,7 +48,7 @@
|
||||
<th><?= lang('TarifasEnviosZonas.cpInicial') ?></th>
|
||||
<th><?= lang('TarifasEnviosZonas.cpFinal') ?></th>
|
||||
<th><?= lang('TarifasEnviosZonas.importeFijo') ?></th>
|
||||
<th></th>
|
||||
<th style="min-width:100px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -81,7 +81,7 @@
|
||||
<th><?= lang('TarifasEnviosPrecios.pesoMax') ?></th>
|
||||
<th><?= lang('TarifasEnviosPrecios.precio') ?></th>
|
||||
<th><?= lang('TarifasEnviosPrecios.precioAdicional') ?></th>
|
||||
<th></th>
|
||||
<th style="min-width:100px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -127,10 +127,10 @@
|
||||
// Delete row
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
if($(this).closest('table').attr('id').includes('zonas')){
|
||||
if($(this).closest('table').attr('id').includes('Zonas')){
|
||||
$(".btn-remove").attr('table', "zonas");
|
||||
}
|
||||
else if($(this).closest('table').attr('id').includes('precios')){
|
||||
else if($(this).closest('table').attr('id').includes('Precios')){
|
||||
$(".btn-remove").attr('table', "precios");
|
||||
}
|
||||
else{
|
||||
@ -234,8 +234,8 @@
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfTarifasEnvioZonas') ?>',
|
||||
data: function ( d ) {
|
||||
d.tarifa_envio_id = id;
|
||||
data: {
|
||||
tarifa_envio_id: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
@ -301,7 +301,11 @@
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
if(typeof jqXHR.responseJSON.messages != "undefined")
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error);
|
||||
else
|
||||
popErrorAlert(jqXHR.responseJSON.message);
|
||||
$('#confirm2delete').modal('toggle');
|
||||
});
|
||||
}
|
||||
|
||||
@ -344,7 +348,8 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
"name": "proveedor_id",
|
||||
"type": "select"
|
||||
}, {
|
||||
name: "tipo_envio"
|
||||
name: "tipo_envio",
|
||||
"type": "select"
|
||||
}, {
|
||||
name: "peso_min"
|
||||
}, {
|
||||
@ -356,9 +361,6 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
}, {
|
||||
"name": "zona_envio_id",
|
||||
"type": "hidden"
|
||||
}, {
|
||||
"name": "proveedor_id",
|
||||
"type": "hidden"
|
||||
}, {
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
@ -369,7 +371,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
]
|
||||
} );
|
||||
|
||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
||||
// Generación de la lista de proveedores (id, nombre)
|
||||
const suppliersList = <?php echo json_encode($proveedores); ?>;
|
||||
editor2.field( 'proveedor_id' ).update( suppliersList );
|
||||
|
||||
@ -384,7 +386,25 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
editor2.dependent('proveedor_id', function (val, data, callback, e ) {
|
||||
|
||||
var supplier = suppliersList.find(o => o.value === val);
|
||||
values = [{label:'<?= lang('TarifasEnviosPrecios.aDomicilio') ?>', value: "a domicilio"}];
|
||||
|
||||
if(supplier.options != null)
|
||||
{
|
||||
if(supplier.options.includes("cajas")){
|
||||
values.push({label:'<?= lang('TarifasEnviosPrecios.cajas') ?>', value: "cajas"});
|
||||
}
|
||||
if(supplier.options.includes("palets")){
|
||||
values.push({label:'<?= lang('TarifasEnviosPrecios.palets') ?>', value: "palets"});
|
||||
}
|
||||
}
|
||||
editor2.field( 'tipo_envio' ).update( values );
|
||||
callback(true);
|
||||
});
|
||||
|
||||
editor2.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
@ -397,7 +417,7 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
theTable2.draw();
|
||||
});
|
||||
|
||||
|
||||
|
||||
var theTable2 = $('#tableOfPrecios').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
@ -421,8 +441,21 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'proveedor' },
|
||||
{ 'data': 'tipo_envio' },
|
||||
{'data': 'proveedor_id',
|
||||
render: function(data, type, row, meta) {
|
||||
var value = suppliersList.find(element => element.value === data);
|
||||
return value['label'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'tipo_envio', "render": function ( data, type, row, meta ) {
|
||||
if(data=='a domicilio')
|
||||
return '<?= lang('TarifasEnviosPrecios.aDomicilio') ?>';
|
||||
else if (data=='cajas')
|
||||
return '<?= lang('TarifasEnviosPrecios.cajas') ?>';
|
||||
else if (data=='palets')
|
||||
return '<?= lang('TarifasEnviosPrecios.palets') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'peso_min' },
|
||||
{ 'data': 'peso_max' },
|
||||
{ 'data': 'precio' },
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [0,lastColNr]
|
||||
targets: [lastColNr]
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
@ -96,7 +96,7 @@
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
|
||||
window.location.href = `/tarifas/tarifasenvios/edit/${$(this).attr('data-id')}/edit`;
|
||||
window.location.href = `/tarifas/tarifasenvios/edit/${$(this).attr('data-id')}`;
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
|
||||
Reference in New Issue
Block a user