mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/papeles_imp_maquinas' into 'main'
rehecho papeles impresion. Lista de tarifas a 50 elementos por defecto See merge request jjimenez/safekat!43
This commit is contained in:
@ -30,18 +30,21 @@
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="pesoPorPliego" class="form-label">
|
||||
<?= lang('PapelImpresion.pesoPorPliego') ?>*
|
||||
<label for="precioTonelada" class="form-label">
|
||||
<?= lang('PapelImpresion.precioTonelada') ?>*
|
||||
</label>
|
||||
<input type="number" id="pesoPorPliego" name="peso_por_pliego" required maxLength="31" step="0.01" class="form-control" value="<?= old('peso_por_pliego', $papelImpresion->peso_por_pliego) ?>">
|
||||
<input type="number" id="precioTonelada" name="precio_tonelada" required maxLength="31" step="0.01" class="form-control" value="<?= old('precio_tonelada', $papelImpresion->precio_tonelada) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="pesoPorPliego" class="form-label">
|
||||
<?= lang('PapelImpresion.pesoPorPliego') ?>
|
||||
</label>
|
||||
<input readonly style="background-color:#d6d6d6;" id="pesoPorPliego" name="peso_por_pliego" required maxLength="31" class="form-control" value="<?= old('peso_por_pliego', $papelImpresion->peso_por_pliego) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="margen" class="form-label">
|
||||
<?= lang('PapelImpresion.margen') ?>*
|
||||
</label>
|
||||
<input type="number" id="margen" name="margen" required placeholder="0" maxLength="31" step="0.01" class="form-control" value="<?= old('margen', $papelImpresion->margen) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
@ -86,6 +89,8 @@
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="papelGenericoId" class="form-label">
|
||||
@ -124,20 +129,26 @@
|
||||
<input type="number" id="espesor" name="espesor" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?= old('espesor', $papelImpresion->espesor) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precioPliego" class="form-label">
|
||||
<?= lang('PapelImpresion.precioPliego') ?>*
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="margen" class="form-label">
|
||||
<?= lang('PapelImpresion.margen') ?>*
|
||||
</label>
|
||||
<input type="number" id="precioPliego" name="precio_pliego" required maxLength="31" step="0.01" class="form-control" value="<?= old('precio_pliego', $papelImpresion->precio_pliego) ?>">
|
||||
<input type="number" id="margen" name="margen" required placeholder="0" maxLength="31" step="0.01" class="form-control" value="<?= old('margen', $papelImpresion->margen) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precioTonelada" class="form-label">
|
||||
<?= lang('PapelImpresion.precioTonelada') ?>*
|
||||
<label for="precioPliego" class="form-label">
|
||||
<?= lang('PapelImpresion.precioPliego') ?>
|
||||
</label>
|
||||
<input type="number" id="precioTonelada" name="precio_tonelada" required maxLength="31" step="0.01" class="form-control" value="<?= old('precio_tonelada', $papelImpresion->precio_tonelada) ?>">
|
||||
<input readonly style="background-color:#d6d6d6; id="precioPliego" name="precio_pliego" required maxLength="31" class="form-control" value="<?= old('precio_pliego', $papelImpresion->precio_pliego) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section("content") ?>
|
||||
<div class="row">
|
||||
@ -24,7 +25,7 @@
|
||||
|
||||
</div><!-- /.card-footer -->
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</div><!-- //.card -->
|
||||
|
||||
|
||||
<?php if(str_contains($formAction,'edit') && $papelImpresion->rotativa == true): ?>
|
||||
@ -37,7 +38,6 @@
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||
<p><?= lang("PapelImpresion.consumo_tintas_rotativas") ?></p>
|
||||
</button>
|
||||
<p class="btn btn-primary float-end me-sm-3 me-1" id="newTipologia"> <?= lang('Basic.global.addNew') ?> </p>
|
||||
</h2>
|
||||
|
||||
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionTipologias">
|
||||
@ -65,8 +65,11 @@
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
|
||||
<div class="accordion mt-3" id="accordionMaquinas">
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
<div class="accordion mt-3" id="accordionMaquinas">
|
||||
<?php else: ?>
|
||||
<div class="accordion mt-3" id="accordionMaquinas" style="display:none">
|
||||
<?php endif; ?>
|
||||
<div class="card accordion-item">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button
|
||||
@ -77,117 +80,34 @@
|
||||
aria-expanded="false"
|
||||
aria-controls="accordionMaq"
|
||||
>
|
||||
MAAAAQUIIIINAAAAAS<!--- lang("PapelImpresion.consumo_tintas_rotativas") ?> AÑADIR LANGUAJE MAQUINAS-->
|
||||
<p><?= lang("PapelImpresion.maquinas_papel") ?></p>
|
||||
</button>
|
||||
</h2>
|
||||
<div
|
||||
id="accordionMaq"
|
||||
class="accordion-collapse collapse"
|
||||
aria-labelledby="headingTwo"
|
||||
data-bs-parent="#accordionMaquinas"
|
||||
>
|
||||
<div class="accordion-body">
|
||||
<table id="tableOfMaquinas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('ImpresionTipologias.tipo') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.negro') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.cyan') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.magenta') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.amarillo') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.gotaNegro') ?></th>
|
||||
<th><?= lang('ImpresionTipologias.gotaColor') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="accordionMaq" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionMaquinas">
|
||||
<div class="accordion-body">
|
||||
<table id="tableOfMaquinas" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('MaquinasPapelImpresion.activo') ?></th>
|
||||
<th><?= lang('Maquinas.nombre') ?></th>
|
||||
<th><?= lang('Maquinas.ancho') ?></th>
|
||||
<th><?= lang('Maquinas.alto') ?></th>
|
||||
<th><?= lang('Maquinas.anchoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.altoImpresion') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
|
||||
<div id="tipologiaModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="tipologia_form">
|
||||
<div class="modal-content">
|
||||
<?= csrf_field() ?>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title"><?= lang('Basic.edit') ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="tipo" class="form-label">
|
||||
<?=lang('ImpresionTipologias.tipo') ?>
|
||||
</label>
|
||||
|
||||
<select id="tipologiaTipo" name="tipologia_tipo" required class="form-control select2" style="width: 100%;" >
|
||||
<option value=negro><?=lang('ImpresionTipologias.negro') ?></option>
|
||||
<option value=color><?=lang('ImpresionTipologias.color') ?></option>
|
||||
<option value=bicolor><?=lang('ImpresionTipologias.bicolor') ?></option>
|
||||
</select><!--//.form-check -->
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="negro" class="form-label">
|
||||
<?=lang('ImpresionTipologias.negro') ?>
|
||||
</label>
|
||||
<input type="number" id="negro" name="negro" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="cyan" class="form-label">
|
||||
<?=lang('ImpresionTipologias.cyan') ?>
|
||||
</label>
|
||||
<input type="number" id="cyan" name="cyan" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="magenta" class="form-label">
|
||||
<?=lang('ImpresionTipologias.magenta') ?>
|
||||
</label>
|
||||
<input type="number" id="magenta" name="magenta" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amarillo" class="form-label">
|
||||
<?=lang('ImpresionTipologias.amarillo') ?>
|
||||
</label>
|
||||
<input type="number" id="amarillo" name="amarillo" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="gotaNegro" class="form-label">
|
||||
<?=lang('ImpresionTipologias.gotaNegro') ?>
|
||||
</label>
|
||||
<input type="number" id="gotaNegro" name="gota_negro" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="gotaColor" class="form-label">
|
||||
<?=lang('ImpresionTipologias.gotaColor') ?>
|
||||
</label>
|
||||
<input type="number" id="gotaColor" name="gota_color" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="0.00">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="hidden" name="hidden_id" id="hidden_id" />
|
||||
<input type="hidden" name="action" id="action" value="add" />
|
||||
<input type="submit" name="submit" id="submit_button" class="btn btn-primary float-start me-sm-3 me-1" value="Add" />
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> <?= lang("Basic.global.Cancel") ?> </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -206,15 +126,84 @@
|
||||
|
||||
const lastColNr = $('#tableOfPapelimpresiontipologias').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
return `<div class="action-buttons">
|
||||
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
|
||||
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
|
||||
</div>`;
|
||||
return `
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<span class="cancel"></span>
|
||||
`;
|
||||
};
|
||||
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
|
||||
tipoTypes = [
|
||||
{label:'<?= lang('ImpresionTipologias.negro') ?>', value:'negro'},
|
||||
{label:'<?= lang('ImpresionTipologias.color') ?>', value: 'color'},
|
||||
{label:'<?= lang('ImpresionTipologias.bicolor') ?>', value: 'bicolor'}
|
||||
];
|
||||
|
||||
editor = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfConsumoTintas') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfPapelimpresiontipologias",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
name: "tipo",
|
||||
type: "select",
|
||||
options: tipoTypes
|
||||
}, {
|
||||
name: "negro",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
},{
|
||||
name: "cyan",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
},{
|
||||
name: "magenta",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
},{
|
||||
name: "amarillo",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
},{
|
||||
name: "gota_negro",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
},{
|
||||
name: "gota_color",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
}, {
|
||||
"name": "papel_impresion_id",
|
||||
"type": "hidden"
|
||||
}
|
||||
]
|
||||
} );
|
||||
|
||||
|
||||
editor.on( 'initCreate', function () {
|
||||
if ($('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3){
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.maxRowsReached') ?>',
|
||||
icon: 'info',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.Close') ?>',
|
||||
|
||||
});
|
||||
}
|
||||
} );
|
||||
|
||||
theTable = $('#tableOfPapelimpresiontipologias').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
@ -224,10 +213,9 @@
|
||||
lengthMenu: [ 5],
|
||||
pageLength: 5,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
//paging: false,
|
||||
searching: false,
|
||||
info: false,
|
||||
"dom": 'lrt',
|
||||
"dom": '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
stateSave: true,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
@ -242,237 +230,96 @@
|
||||
async: true,
|
||||
}),
|
||||
columns : [
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'tipo', "render": function ( data, type, row, meta ) {
|
||||
if(data=='negro')
|
||||
return '<?= lang('ImpresionTipologias.negro') ?>';
|
||||
else if (data=='color')
|
||||
return '<?= lang('ImpresionTipologias.color') ?>';
|
||||
else if (data=='bicolor')
|
||||
return '<?= lang('ImpresionTipologias.bicolor') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'negro' },
|
||||
{ 'data': 'cyan' },
|
||||
{ 'data': 'magenta' },
|
||||
{ 'data': 'amarillo' },
|
||||
{ 'data': 'gota_negro' },
|
||||
{ 'data': 'gota_color' },
|
||||
{ data: actionBtns}
|
||||
]
|
||||
{ data: actionBtns,
|
||||
className: 'row-edit dt-center'}
|
||||
],
|
||||
buttons: [ {
|
||||
className: 'btn btn-primary float-end me-sm-3 me-1',
|
||||
extend: "createInline",
|
||||
editor: editor,
|
||||
formOptions: {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
}
|
||||
} ]
|
||||
});
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
editor.inline(
|
||||
theTable.cells(this.parentNode.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||
cancelTrigger: 'span.cancel',
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
||||
submitTrigger: 'span.edit',
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
}
|
||||
// Add new tipología
|
||||
$('#newTipologia').on("click", function(e) {
|
||||
if ($('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3){
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.maxRowsReached') ?>',
|
||||
icon: 'info',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.Close') ?>',
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('#tipologiaTipo').attr('disabled', false);
|
||||
$('#tipologiaTipo').val("");
|
||||
$('#negro').val("0.00");
|
||||
$('#cyan').val("0.00");
|
||||
$('#magenta').val("0.00");
|
||||
$('#amarillo').val("0.00");
|
||||
$('#gotaNegro').val("0.00");
|
||||
$('#gotaColor').val("0.00");
|
||||
|
||||
$('#action').val('add');
|
||||
$('.modal-title').text('<?= lang('Basic.global.add') ?>' + ' ' + '<?= lang("PapelImpresion.consumo_tintas_rotativas") ?>');
|
||||
$('#submit_button').val('<?= lang('Basic.global.Save') ?>');
|
||||
|
||||
|
||||
$('#tipologiaModal').modal('show');
|
||||
|
||||
$('#hidden_id').val("");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#rotativa').on("click",function(el){
|
||||
if(!$(this).is(':checked')){
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('PapelImpresion.papel impresion'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.value) {
|
||||
if($(this).is(':checked')){
|
||||
$("#accordionTipologias").show();
|
||||
}else{
|
||||
$("#accordionTipologias").hide();
|
||||
}
|
||||
|
||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['papel_impresion_id'] = id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
d.data[v]['papel_impresion_id'] = id;
|
||||
}
|
||||
else{
|
||||
$(this).prop('checked', true) ;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#accordionTipologias").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#tipologiaModal').on('submit', function(event){
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const tipo_values = $('#tableOfPapelimpresiontipologias').DataTable().column().data().toArray();
|
||||
|
||||
if(tipo_values.includes($('#tipologiaTipo').val()) && $('#action').val() == 'add'){
|
||||
$('#tipologiaModal').modal('hide');
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.Error') ?>',
|
||||
text: '<?= lang('ImpresionTipologias.errorTipo') ?>',
|
||||
icon: 'error',
|
||||
showCancelButton: false,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.ok') ?>',
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
var formData = {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
papel_impresion_id: id,
|
||||
tipo: $('#tipologiaTipo').val(),
|
||||
negro: $('#negro').val(),
|
||||
cyan: $('#cyan').val(),
|
||||
magenta: $('#magenta').val(),
|
||||
amarillo: $('#amarillo').val(),
|
||||
gota_negro: $('#gotaNegro').val(),
|
||||
gota_color: $('#gotaColor').val()
|
||||
}
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
if( $('#action').val() == 'edit')
|
||||
{
|
||||
var url_to_go = "/configuracion/papelimpresiontipologias/edit/" + $('#hidden_id').val();
|
||||
formData['id']= $('#hidden_id').val();
|
||||
}
|
||||
else
|
||||
{
|
||||
var url_to_go = "<?= route_to('createPapelImpresionTipologia'); ?>";
|
||||
}
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: url_to_go,
|
||||
method:"POST",
|
||||
data: formData,
|
||||
dataType:"JSON",
|
||||
encode: true,
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
});
|
||||
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#tipologiaModal').modal('hide') ;
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
$('#tipologiaModal').modal('hide') ;
|
||||
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
|
||||
var id = $(this).attr('data-id');
|
||||
|
||||
$.ajax({
|
||||
|
||||
url:"<?= route_to('fetchTipologia'); ?>",
|
||||
|
||||
|
||||
method:"POST",
|
||||
|
||||
data:{id:id,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v},
|
||||
|
||||
dataType:'JSON',
|
||||
|
||||
success:function(response)
|
||||
{
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
$('#tipologiaTipo').val(response.data.tipo);
|
||||
$('#negro').val(response.data.negro);
|
||||
$('#cyan').val(response.data.cyan);
|
||||
$('#magenta').val(response.data.magenta);
|
||||
$('#amarillo').val(response.data.amarillo);
|
||||
$('#gotaNegro').val(response.data.gota_negro);
|
||||
$('#gotaColor').val(response.data.gota_color);
|
||||
|
||||
$('#tipologiaTipo').attr('disabled', 'disabled');
|
||||
$('#action').val('edit');
|
||||
$('.modal-title').text('<?= lang('Basic.global.edit') ?>' + ' ' + '<?= lang("PapelImpresion.consumo_tintas_rotativas") ?>');
|
||||
$('#submit_button').val('<?= lang('Basic.global.Save') ?>');
|
||||
|
||||
|
||||
$('#tipologiaModal').modal('show');
|
||||
|
||||
$('#hidden_id').val(id);
|
||||
|
||||
},
|
||||
cache: true
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('PapelImpresion.consumo_tintas_rotativas'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
$(document).on('click', '.btn-remove', function(e) {
|
||||
const dataId = $(this).attr('data-id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/configuracion/papelimpresiontipologias/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
dataType: "json",
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
|
||||
$('#confirm2delete').modal('toggle');
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#papelGenericoId').select2({
|
||||
|
||||
@ -504,13 +351,153 @@
|
||||
}
|
||||
});
|
||||
|
||||
var theTable2 = $('#tableOfMaquinas').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 1, "asc" ]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: true,
|
||||
paging: true,
|
||||
info: true,
|
||||
dom: "lftp",
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfPapelesImpresionMaquinas') ?>',
|
||||
data: function (d) {
|
||||
d.papel_id = id;
|
||||
d.isRotativa = $('#rotativa').is(':checked')?1:0;
|
||||
d.ancho = document.getElementById("ancho").value;
|
||||
d.alto = document.getElementById("alto").value;
|
||||
d.webguard_token = '<?= csrf_hash() ?>';
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'active',
|
||||
render: function (data, type, row) {
|
||||
if (type === 'display') {
|
||||
return '<input type="checkbox" class="editor-active" id="check_' + row.papel_impresion_id + '">';
|
||||
}
|
||||
return data;
|
||||
},
|
||||
className: 'dt-body-center'
|
||||
},
|
||||
{ 'data': 'maquina'},
|
||||
{ 'data': 'ancho'},
|
||||
{ 'data': 'alto'},
|
||||
{ 'data': 'anchoimpresion'},
|
||||
{ 'data': 'altoimpresion'},
|
||||
],
|
||||
rowCallback: function (row, data) {
|
||||
// Set the checked state of the checkbox in the table
|
||||
$('input.editor-active', row).prop('checked', data.active == 1);
|
||||
},
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
searchable: false,
|
||||
targets: [0,2,3,4,5]
|
||||
}
|
||||
],
|
||||
} );
|
||||
|
||||
editor2 = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfMaquinasPapelImpresion') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfMaquinas",
|
||||
idSrc: 'papel_impresion_id',
|
||||
fields: [
|
||||
{
|
||||
name: "active",
|
||||
type: "checkbox",
|
||||
separator: "|",
|
||||
ipOpts: [
|
||||
{ label: '', value: 1 }
|
||||
]
|
||||
},{
|
||||
"name": "papel_impresion_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "gramaje",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "maquina_id",
|
||||
"type": "hidden"
|
||||
}
|
||||
]
|
||||
} );
|
||||
|
||||
editor2.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
if(json.error){
|
||||
document.getElementById("check_" + json.data.papel_impresion_id).checked = false;
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: '<?= lang('Basic.global.sweet.error_tittle') ?>',
|
||||
text: json.error,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Cuando se clica en un checkbox hacer submit en el editor
|
||||
theTable2.on( 'change', 'input.editor-active', function () {
|
||||
editor2
|
||||
.edit( $(this).closest('tr'), false )
|
||||
.set( 'active', $(this).prop( 'checked' ) ? 1 : 0 )
|
||||
.submit();
|
||||
} );
|
||||
|
||||
|
||||
// Para los calculos del precio
|
||||
$("#ancho").on('input', function () {
|
||||
updateValue();
|
||||
});
|
||||
|
||||
$("#alto").on('input', function () {
|
||||
updateValue();
|
||||
});
|
||||
|
||||
$("#gramaje").on('input', function () {
|
||||
updateValue();
|
||||
});
|
||||
|
||||
$("#precioTonelada").on('input', function () {
|
||||
updateValue();
|
||||
});
|
||||
|
||||
function updateValue() {
|
||||
let value = parseFloat($("#gramaje").val()) * parseFloat($("#ancho").val())*parseFloat($("#alto").val())/1E6;
|
||||
value = value.toFixed(2);
|
||||
$('#pesoPorPliego').val(value);
|
||||
let value2 = parseFloat($("#precioTonelada").val()) *value/1E6;
|
||||
value2 = value2.toFixed(6);
|
||||
$('#precioPliego').val(value2);
|
||||
}
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
|
||||
<?php /*
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/ccs/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
-*/ ?>
|
||||
<link rel="stylesheet" href="https://editor.datatables.net/extensions/Editor/css/editor.dataTables.min.css">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
@ -522,5 +509,8 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.js') ?>"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 10,
|
||||
pageLength: 50,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip',
|
||||
"buttons": [
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 10,
|
||||
pageLength: 50,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip',
|
||||
"buttons": [
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
pageLength: 10,
|
||||
pageLength: 50,
|
||||
lengthChange: true,
|
||||
"dom": 'lfBrtip',
|
||||
"buttons": [
|
||||
|
||||
@ -85,7 +85,7 @@
|
||||
"responsive": true,
|
||||
"paging": true,
|
||||
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
"pageLength": 10,
|
||||
"pageLength": 50,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
|
||||
Reference in New Issue
Block a user