intentando resolver conflictos

This commit is contained in:
jaimejimenezortega
2024-05-08 20:44:40 +02:00
parent e2b998bfa4
commit feebbed24d
135 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,230 @@
<h6>Datos de la Máquina</h6>
<div class="row g-3">
<div class="col-md-3">
<label for="nombre" class="form-label">
<?= lang('Maquinas.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
value="<?= old('nombre', $maquina->nombre) ?>">
</div>
<div class="col-md-2">
<label for="min" class="form-label">
<?= lang('Maquinas.min') ?>*
</label>
<input type="number" id="min" name="min" required placeholder="1" maxLength="11"
class="form-control" value="<?= old('min', $maquina->min) ?>">
</div>
<div class="col-md-2">
<label for="max" class="form-label">
<?= lang('Maquinas.max') ?>*
</label>
<input type="number" id="max" name="max" required placeholder="1000000" maxLength="11"
class="form-control" value="<?= old('max', $maquina->max) ?>">
</div>
<div class="col-md-2">
<label for="velocidad" class="form-label">
<?= lang('Maquinas.velocidad') ?>*
</label>
<input type="number" id="velocidad" name="velocidad" required placeholder="0.00" maxLength="8"
step="0.01" class="form-control" value="<?= old('velocidad', $maquina->velocidad) ?>">
</div>
<div class="col-md-3">
<label for="tipo" class="form-label">
<?= lang('Maquinas.tipo') ?>*
</label>
<select id="tipo" name="tipo" required class="form-control select2" style="width: 100%;">
<option value="" selected="selected"><?= lang('Basic.global.pleaseSelectOne') ?></option>
<option value="impresion"<?= $maquina->tipo == 'impresion' ? ' selected' : '' ?>><?= lang('Maquinas.impresion') ?></option>
<option value="manipulado"<?= $maquina->tipo == 'manipulado' ? ' selected' : '' ?>><?= lang('Maquinas.manipulado') ?></option>
<option value="acabado"<?= $maquina->tipo == 'acabado' ? ' selected' : '' ?>><?= lang('Maquinas.acabado') ?></option>
</select>
</div>
<!--Propiedades-->
<div class="col-md-2">
<label for="ancho" class="form-label">
<?= lang('Maquinas.ancho') ?>*
</label>
<input type="number" id="ancho" name="ancho" maxLength="8" step="0.01" class="form-control"
value="<?= old('ancho', $maquina->ancho) ?>">
</div>
<div class="col-md-2">
<label for="alto" class="form-label">
<?= lang('Maquinas.alto') ?>*
</label>
<input type="number" id="alto" name="alto" maxLength="8" step="0.01" class="form-control"
value="<?= old('alto', $maquina->alto) ?>">
</div>
<div class="col-md-3">
<label for="anchoImpresion" class="form-label">
<?= lang('Maquinas.anchoImpresion') ?>*
</label>
<input type="number" id="anchoImpresion" name="ancho_impresion" required placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('ancho_impresion', $maquina->ancho_impresion) ?>">
</div>
<div class="col-md-3">
<label for="altoImpresion" class="form-label">
<?= lang('Maquinas.altoImpresion') ?>*
</label>
<input type="number" id="altoImpresion" name="alto_impresion" required placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('alto_impresion', $maquina->alto_impresion) ?>">
</div>
<div class="col-md-2">
<label for="altoClick" class="form-label">
<?= lang('Maquinas.altoClick') ?>*
</label>
<input type="number" id="altoClick" name="alto_click" required placeholder="0.00" maxLength="8"
step="0.01" class="form-control" value="<?= old('alto_click', $maquina->alto_click) ?>">
</div>
<!--Produccion-->
<div class="col-md-3">
<label for="duracionJornada" class="form-label">
<?= lang('Maquinas.duracionJornada') ?>*
</label>
<input type="number" id="duracionJornada" name="duracion_jornada" required placeholder="8"
maxLength="11" class="form-control"
value="<?= old('duracion_jornada', $maquina->duracion_jornada) ?>">
</div>
<div class="col-md-3">
<label for="ordenPlanning" class="form-label">
<?= lang('Maquinas.ordenPlanning') ?>*
</label>
<input type="number" id="ordenPlanning" name="orden_planning" required placeholder="1"
maxLength="11" class="form-control"
value="<?= old('orden_planning', $maquina->orden_planning) ?>">
</div>
<div class="col-md-3">
<label for="forzarNumFormasHorizontalesPortada" class="form-label">
<?= lang('Maquinas.forzarNumFormasHorizontalesPortada') ?>
</label>
<input type="number" id="forzarNumFormasHorizontalesPortada"
name="forzar_num_formas_horizontales_cubierta" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_horizontales_cubierta', $maquina->forzar_num_formas_horizontales_cubierta) ?>">
</div>
<div class="col-md-3">
<label for="forzarNumFormasVerticalesPortada" class="form-label">
<?= lang('Maquinas.forzarNumFormasVerticalesPortada') ?>
</label>
<input type="number" id="forzarNumFormasVerticalesPortada"
name="forzar_num_formas_verticales_cubierta" maxLength="11" class="form-control"
value="<?= old('forzar_num_formas_verticales_cubierta', $maquina->forzar_num_formas_verticales_cubierta) ?>">
</div>
<div class="col-md-12">
<label for="observaciones" class="form-label">
<?= lang('Maquinas.observaciones') ?>
</label>
<textarea rows="3" id="observaciones" name="observaciones"
class="form-control">
<?= old('observaciones', $maquina->observaciones) ?>
</textarea>
</div>
<div class="col-md-3 mt-4 mb-4">
<div class="form-check form-check-inline">
<input type="checkbox"
id="isPadre"
name="is_padre"
value="1"
class="form-check-input"<?= $maquina->is_padre == true ? 'checked' : ''; ?>
>
<label for="isPadre" class="form-check-label">
<?= lang('Maquinas.isPadre') ?>
</label>
</div>
</div>
<div id="selectVariante" class="col-md-3" style="display:none">
<select id="padreId" name="padre_id" class="form-control select2" style="width: 100%;">
<?php if (isset($maquinaList) && is_array($maquinaList) && !empty($maquinaList)) :
foreach ($maquinaList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $maquina->padre_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-3 mt-4 mb-4">
<div class="form-check form-check-inline">
<input type="checkbox"
id="isRotativa"
name="is_rotativa"
value="1"
class="form-check-input"<?= $maquina->is_rotativa == true ? 'checked' : ''; ?>
>
<label for="isPadre" class="form-check-label">
<?= lang('Maquinas.isRotativa') ?>
</label>
</div>
</div>
<div class="col-md-3 mt-4 mb-4">
<div class="form-check form-check-inline">
<input type="checkbox"
id="isTinta"
name="is_inkjet"
value="1"
class="form-check-input"<?= $maquina->is_inkjet == true ? 'checked' : ''; ?>
>
<label for="isPadre" class="form-check-label">
<?= lang('Maquinas.isTinta') ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-2 datosRotativa datosInkjet" style="display: none;">
<label for="precioTintaNegro" class="form-label">
<?= lang('Maquinas.precioTintaNegro') ?>
</label>
<input type="number" id="precioTintaNegro" name="precio_tinta_negro" placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_tinta_negro', $maquina->precio_tinta_negro) ?>">
</div>
<div class="col-md-2 datosRotativa datosInkjet" style="display: none;">
<label for="precioTintaColor" class="form-label">
<?= lang('Maquinas.precioTintaColor') ?>
</label>
<input type="number" id="precioTintaColor" name="precio_tinta_color" placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_tinta_color', $maquina->precio_tinta_color) ?>">
</div>
<div class="col-md-2 datosInkjet" style="display: none;">
<label for="precioTintaCG" class="form-label">
<?= lang('Maquinas.precioTintaCG') ?>
</label>
<input type="number" id="precioTintaCG" name="precio_tinta_cg" placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_tinta_cg', $maquina->precio_tinta_cg) ?>">
</div>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="velocidadCorte" class="form-label">
<?= lang('Maquinas.velocidadCorte') ?>
</label>
<input type="number" id="velocidadCorte" name="velocidad_corte" placeholder="0.00" maxLength="8"
step="0.01" class="form-control"
value="<?= old('velocidad_corte', $maquina->velocidad_corte) ?>">
</div>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="precioHoraCorte" class="form-label">
<?= lang('Maquinas.precioHoraCorte') ?>
</label>
<input type="number" id="precioHoraCorte" name="precio_hora_corte" placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_hora_corte', $maquina->precio_hora_corte) ?>">
</div>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="metrosxminuto" class="form-label">
<?= lang('Maquinas.metrosxminuto') ?>
</label>
<input type="number" id="metrosxminuto" name="metrosxminuto" placeholder="48" maxLength="31"
step="0.01" class="form-control"
value="<?= old('metrosxminuto', $maquina->metrosxminuto) ?>">
</div>
</div>

View File

@ -0,0 +1,84 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="tipo" class="form-label">
<?=lang('MaquinasPorDefecto.tipo') ?>*
</label>
<select tabindex="1" id="tipo" name="tipo" class="form-control select2bs" style="width: 100%;" >
<option value="" selected="selected"><?=lang('Basic.global.pleaseSelectOne') ?></option>
<option value="bn"<?=$maquinasDefectoEntity->tipo == 'bn' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.bn') ?></option>
<option value="bnhq"<?=$maquinasDefectoEntity->tipo == 'bnhq' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.bnhq') ?></option>
<option value="color"<?=$maquinasDefectoEntity->tipo == 'color' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.color') ?></option>
<option value="portada"<?=$maquinasDefectoEntity->tipo == 'portada' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.portada') ?></option>
<option value="cubierta"<?=$maquinasDefectoEntity->tipo == 'cubierta' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.cubierta') ?></option>
<option value="rotativa"<?=$maquinasDefectoEntity->tipo == 'rotativa' ? ' selected':'' ?>><?= lang('MaquinasPorDefecto.rotativa') ?></option>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="anchoMin" class="form-label">
<?=lang('MaquinasPorDefecto.anchoMin') ?>*
</label>
<input tabindex="3" type="number" id="anchoMin" name="ancho_min" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho_min', $maquinasDefectoEntity->ancho_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="altoMin" class="form-label">
<?=lang('MaquinasPorDefecto.altoMin') ?>*
</label>
<input tabindex="5" type="number" id="altoMin" name="alto_min" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_min', $maquinasDefectoEntity->alto_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiradaMin" class="form-label">
<?=lang('MaquinasPorDefecto.tiradaMin') ?>*
</label>
<input tabindex="7" type="number" id="tiradaMin" name="tirada_min" placeholder="1" maxLength="11" class="form-control" value="<?=old('tirada_min', $maquinasDefectoEntity->tirada_min) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="maquinaId" class="form-label">
<?=lang('MaquinasPorDefecto.maquinaId') ?>*
</label>
<select tabindex="2" id="maquinaId" name="maquina_id" class="form-control select2 form-select" style="width: 100%;" >
<?php if ( isset($maquinaList) && is_array($maquinaList) && !empty($maquinaList) ) :
foreach ($maquinaList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$maquinasDefectoEntity->maquina_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="anchoMax" class="form-label">
<?=lang('MaquinasPorDefecto.anchoMax') ?>*
</label>
<input tabindex="4" type="number" id="anchoMax" name="ancho_max" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho_max', $maquinasDefectoEntity->ancho_max) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="altoMax" class="form-label">
<?=lang('MaquinasPorDefecto.altoMax') ?>*
</label>
<input tabindex="6" type="number" id="altoMax" name="alto_max" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_max', $maquinasDefectoEntity->alto_max) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiradaMax" class="form-label">
<?=lang('MaquinasPorDefecto.tiradaMax') ?>*
</label>
<input tabindex="8" type="number" id="tiradaMax" name="tirada_max" placeholder="10000" maxLength="11" class="form-control" value="<?=old('tirada_max', $maquinasDefectoEntity->tirada_max) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,832 @@
<?= $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">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="maquinaForm" class="card-body" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/maquinas/_maquinaFormItems") ?>
</div><!-- /.card-body -->
<div class="py-4">
<input type="submit"
class="btn btn-primary float-start me-sm-3 me-1"
name="save"
value="<?= lang("Basic.global.Save") ?>"
/>
<?= anchor(route_to("maquinaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?php if(str_contains($formAction,'edit')): ?>
<div class="accordion mt-3" id="accordianTarifasImpresion">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
<h3><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordianTarifasImpresion">
<div class="accordion-body">
<table id="tableOfMaquinastarifasimpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
<th><?= lang('MaquinasTarifasImpresions.margen') ?></th>
<th>is_deleted</th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
<?php if(str_contains($formAction,'edit')): ?>
<div class="accordion mt-3" id="accordianPapelesCalles">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip3" aria-expanded="false" aria-controls="accordionTip3">
<h3><?= lang("MaquinasCalles.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip3" class="accordion-collapse collapse show" data-bs-parent="#accordianPapelesCalles">
<div class="accordion-body">
<table id="tableOfCalles" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('MaquinasCalles.formas') ?></th>
<th><?= lang('MaquinasCalles.internas') ?></th>
<th><?= lang('MaquinasCalles.externas') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
<?php if(str_contains($formAction,'edit')): ?>
<div class="accordion mt-3" id="accordianPapelesImpresion">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip2" aria-expanded="false" aria-controls="accordionTip2">
<h3><?= lang("MaquinasPapelImpresion.papel_impresion_maquinas") ?></h3>
</button>
</h2>
<div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordianPapelesImpresion">
<div class="accordion-body">
<table id="tableOfPapelesImpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('MaquinasPapelImpresion.activo') ?></th>
<th><?= lang('PapelGenerico.papelGenerico') ?></th>
<th><?= lang('PapelImpresion.nombre') ?></th>
<th><?= lang('PapelImpresion.gramaje') ?></th>
<th><?= lang('PapelImpresion.bn') ?></th>
<th><?= lang('PapelImpresion.color') ?></th>
<th><?= lang('PapelImpresion.cubierta') ?></th>
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
<th><?= lang('PapelImpresion.rotativa') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
<?php endif; ?>
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
<?php if($maquina->is_rotativa) { ?>
$(".datosInkjet").css('display', 'none');
$(".datosRotativa").css('display', 'inline');
<?php } ?>
<?php if($maquina->is_inkjet) { ?>
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'inline');
<?php } ?>
<?php if(!$maquina->is_inkjet && !$maquina->is_rotativa){ ?>
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'none');
<?php } ?>
const lastColNr2 = $('#tableOfPapelesImpresion').find("tr:first th").length - 1;
const actionBtns2 = function(data) {
return `
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit2 mx-2" data-id="${data.papel_impresion_id}"></i></a>
`;
};
$(document).on('click', '.btn-edit2', function(e) {
window.open(`/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`);
});
function watch(j) {
return new Proxy(JSON.parse ('{"watch":' + j + '}'), {
set: function(target, property, value) {
target[property] = value;
$('#tableOfPapelesImpresion').DataTable().ajax.reload(null,false);
theTable2.clearPipeline();
theTable2.draw();
}
});
}
isRotativa = watch(0);
$('#isRotativa').on("click",function(el){
asyncConfirmDialog('<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
'<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>', yesCallback, noCallback);
});
function yesCallback() {
if($('#isRotativa').is(':checked')){
$(".datosInkjet").css('display', 'none');
$('#isTinta').prop("checked", 0);
$(".datosRotativa").css('display', 'inline');
}else{
document.getElementById("precioTintaNegro").value = 0;
document.getElementById("precioTintaColor").value = 0;
document.getElementById("velocidadCorte").value = 0;
document.getElementById("precioHoraCorte").value = 0;
document.getElementById("metrosxminuto").value = 0;
$(".datosRotativa").css('display', 'none');
}
updatePapeles()
}
function noCallback() {
// Toggle behaviour
$('#isRotativa').prop("checked", !$('#isRotativa').prop("checked"));
}
$('#isTinta').on('click', function(){
asyncConfirmDialog('<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
'<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>', yesCallbackInkjet, noCallbackInkjet);
})
function yesCallbackInkjet() {
if($('#isTinta').is(':checked')){
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'inline');
$('#isRotativa').prop("checked", 0);
}else{
document.getElementById("precioTintaNegro").value = 0;
document.getElementById("precioTintaColor").value = 0;
document.getElementById("velocidadCorte").value = 0;
document.getElementById("precioHoraCorte").value = 0;
document.getElementById("metrosxminuto").value = 0;
$(".datosInkjet").css('display', 'inline');
}
updatePapeles()
}
function noCallbackInkjet() {
// Toggle behaviour
$('#isTinta').prop("checked", !$('#isTinta').prop("checked"));
}
function updatePapeles(){
//yeniden(json.<?= csrf_token() ?>);
$.ajax({
url: '<?= route_to('updateMaquinaPapelOnTarifasChange') ?>',
data: {
maquina_id: id,
isRotativa: isRotativa.watch,
isInkjet: $('#isTinta').prop('checked'),
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
success:function(response){
token=JSON.parse(response).<?= csrf_token() ?>;
yeniden(token);
theTable.clearPipeline();
theTable.draw();
theTable2.clearPipeline();
theTable2.draw();
}
});
}
$('#isPadre').on("click",function(el){
if($(this).is(':checked')){
$("#selectVariante").show();
}else{
$("#padreId").select2('val', -1);
$("#selectVariante").hide();
}
});
$('#padreId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
},
});
const lastColNr = $('#tableOfTarifamanipuladolineas').find("tr:first th").length - 1;
const url = window.location.href;
const url_parts = url.split('/');
let id = -1;
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
const actionBtns = function(data) {
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>
`;
};
usoTypes = [
{label:'<?= lang('MaquinasTarifasImpresions.interior') ?>', value:'interior'},
{label:'<?= lang('MaquinasTarifasImpresions.cubierta') ?>', value: 'cubierta'},
{label:'<?= lang('MaquinasTarifasImpresions.sobrecubierta') ?>', value: 'sobrecubierta'}
];
tipoTypes = [
{label:'<?= lang('MaquinasTarifasImpresions.negro') ?>', value:'negro'},
{label:'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', value: 'negrohq'},
{label:'<?= lang('MaquinasTarifasImpresions.bicolor') ?>', value: 'bicolor'},
{label:'<?= lang('MaquinasTarifasImpresions.color') ?>', value: 'color'},
{label:'<?= lang('MaquinasTarifasImpresions.colorhq') ?>', value: 'colorhq'},
];
editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfMaquinasTarifaImpresion') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfMaquinastarifasimpresion",
idSrc: 'id',
fields: [ {
name: "uso",
type: "select",
options: usoTypes
}, {
name: "tipo",
type: "select",
options: tipoTypes
}, {
name: "precio",
attr: {
type: "number"
}
}, {
name: "margen",
attr: {
type: "number"
}
}, {
"name": "maquina_id",
"type": "hidden"
},{
"name": "deleted_at",
"type": "hidden"
},{
"name": "is_deleted",
"type": "hidden"
},
]
} );
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['maquina_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['maquina_id'] = id;
}
}
});
editor.on( 'postSubmit', function ( e, json, data, action ) {
updatePapeles()
});
editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfMaquinasPapelImpresion') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfPapelesImpresion",
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,
});
}
});
var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
order: [[ 1, "asc" ]],
pageLength: 5,
lengthChange: false,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-end"B><"float-start"l><t>', //"Blt",
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinasTarifasImpresion') ?>',
data: {
id_maquina: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ 'data': 'uso', "render": function ( data, type, row, meta ) {
if(data=='interior')
return '<?= lang('MaquinasTarifasImpresions.interior') ?>';
else if (data=='cubierta')
return '<?= lang('MaquinasTarifasImpresions.cubierta') ?>';
else if (data=='sobrecubierta')
return '<?= lang('MaquinasTarifasImpresions.sobrecubierta') ?>';
}
},
{ 'data': 'tipo', "render": function ( data, type, row, meta ) {
if(data=='negro')
return '<?= lang('MaquinasTarifasImpresions.negro') ?>';
else if (data=='negrohq')
return '<?= lang('MaquinasTarifasImpresions.negrohq') ?>';
else if (data=='bicolor')
return '<?= lang('MaquinasTarifasImpresions.bicolor') ?>';
else if (data=='color')
return '<?= lang('MaquinasTarifasImpresions.color') ?>';
else if (data=='colorhq')
return '<?= lang('MaquinasTarifasImpresions.colorhq') ?>';
}
},
{ 'data': 'precio' },
{ 'data': 'margen' },
{ 'data': 'is_deleted',},
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
target: 4,
visible: false
},
{
orderable: false,
searchable: false,
targets: [lastColNr]
},
{"orderData": [ 0, 1 ], "targets": 0 },
],
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
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>',
}
} ]
} );
var theTable2 = $('#tableOfPapelesImpresion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250],
order: [[ 1, "asc" ]],
pageLength: 25,
lengthChange: true,
searching: true,
paging: true,
info: true,
stateSave: true,
dom: "lftp",
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinasPapelesImpresion') ?>',
data: function (d) {
d.maquina_id = id;
d.isRotativa = isRotativa.watch;
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': 'papel_generico'},
{ 'data': 'papel_impresion'},
{ 'data': 'gramaje'},
{ 'data': 'bn'},
{ 'data': 'color'},
{ 'data': 'cubierta'},
{ 'data': 'sobrecubierta'},
{ 'data': 'rotativa'},
{ data: actionBtns2,
className: 'row-edit dt-center'}
],
columnDefs: [
{
orderable: false,
targets: [lastColNr2]
},
{
searchable: false,
targets: [0,3,4,5,6,7,8,lastColNr2]
}
],
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: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
}
} );
// 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();
} );
// Activate an inline edit on click of a table cell
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
theTable.cells(this.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'
}
);
} );
theTable2.on( 'draw.dt', function () {
const boolCols = [4, 5, 6, 7, 8];
for (let coln of boolCols) {
theTable2.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
});
}
});
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
const row = $(this).closest('tr')[0]._DT_RowIndex;
if($(this).closest('table').attr('id').includes('tarifas')){
$(".btn-remove").attr('table', "tarifas");
$(".btn-remove").attr('row_index', row);
}
else if($(this).closest('table').attr('id').includes('Calles')){
$(".btn-remove").attr('table', "calles");
$(".btn-remove").attr('row_index', row);
}
else{
$(".btn-remove").attr('table', );
}
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).attr('row_index');
if ($.isNumeric(dataId)) {
if($(this).attr('table').includes('tarifas')){
remove_tarifas(dataId, row);
}
else if ($(this).attr('table').includes('calles')){
remove_calles(dataId, row);
}
}
});
function remove_calles(dataId, row){
$.ajax({
url: `/maquinascalles/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable3.clearPipeline();
theTable3.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
});
};
function remove_tarifas(dataId, row){
$.ajax({
url: `/maquinastarifasimpresion/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
});
}
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS para tabla calles -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
var editor3 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfMaquinascalles') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfCalles",
idSrc: 'id',
fields: [ {
name: "formas"
}, {
name: "internas"
}, {
name: "externas"
}, {
"name": "maquina_id",
"type": "hidden"
},{
"name": "deleted_at",
"type": "hidden"
},{
"name": "is_deleted",
"type": "hidden"
},
]
} );
editor3.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['maquina_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['maquina_id'] = id;
}
}
});
editor3.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor3.on( 'submitSuccess', function ( e, json, data, action ) {
theTable3.clearPipeline();
theTable3.draw();
});
theTable3 = $('#tableOfCalles').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5],
pageLength: 10,
lengthChange: false,
searching: false,
info: false,
"dom": '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
stateSave: true,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinascalles') ?>',
data: {
maquina_id: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns : [
{ 'data': 'formas' },
{ 'data': 'internas' },
{ 'data': 'externas' },
{ data: actionBtns,
className: 'row-edit dt-center'}
],
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
editor: editor3,
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
$('#tableOfCalles').on( 'click', 'tbody span.edit', function (e) {
editor3.inline(
theTable3.cells(this.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'
}
);
} );
<?= $this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<?=$this->endSection() ?>

View File

@ -0,0 +1,155 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Maquinas.maquinaList') ?></h3>
<?=anchor(route_to('newMaquina'), lang('Basic.global.addNew').' '.lang('Maquinas.maquina'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfMaquinas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Maquinas.nombre') ?></th>
<th><?= lang('Maquinas.tipo') ?></th>
<th><?= lang('Maquinas.anchoImpresion') ?></th>
<th><?= lang('Maquinas.altoImpresion') ?></th>
<th><?= lang('Maquinas.min') ?></th>
<th><?= lang('Maquinas.max') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfMaquinas').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<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>
</div>
</td>`;
};
theTable = $('#tableOfMaquinas').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[0, 'asc']],
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinas') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'tipo' },
{ 'data': 'ancho_impresion' },
{ 'data': 'alto_impresion' },
{ 'data': 'min' },
{ 'data': 'max' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="text-success bi bi-check-lg"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/configuracion/maquinas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
<?=$this->endSection() ?>

View File

@ -0,0 +1,66 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="maquinaPorDefectoForm" class="card-body" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/maquinas/_maquinaPorDefectoFormItems") ?>
<div class="pt-4">
<input
type="submit"
class="btn btn-primary float-start me-sm-3 me-1"
name="save"
value="<?= lang("Basic.global.Save") ?>"
/>
<?= anchor(route_to("maquinaPorDefectoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#maquinaId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfMaquinas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,162 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('MaquinasPorDefecto.maquinaPorDefectoList') ?></h3>
<?=anchor(route_to('newMaquinaPorDefecto'), lang('Basic.global.addNew').' '.lang('MaquinasPorDefecto.maquinaPorDefecto'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfMaquinaspordefecto" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('MaquinasPorDefecto.tipo') ?></th>
<th><?= lang('Maquinas.maquina') ?></th>
<th><?= lang('MaquinasPorDefecto.anchoMin') ?></th>
<th><?= lang('MaquinasPorDefecto.anchoMax') ?></th>
<th><?= lang('MaquinasPorDefecto.altoMin') ?></th>
<th><?= lang('MaquinasPorDefecto.altoMax') ?></th>
<th><?= lang('MaquinasPorDefecto.tiradaMin') ?></th>
<th><?= lang('MaquinasPorDefecto.tiradaMax') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfMaquinaspordefecto').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<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>
</div>
</td>`;
};
theTable = $('#tableOfMaquinaspordefecto').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfMaquinasPorDefecto') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'tipo', "render": function ( data, type, row, meta ) {
if(data=='bn')
return '<?= lang('MaquinasPorDefecto.bn') ?>';
else if(data=='bnhq')
return '<?= lang('MaquinasPorDefecto.bnhq') ?>';
else if(data=='color')
return '<?= lang('MaquinasPorDefecto.color') ?>';
else if(data=='cubierta')
return '<?= lang('MaquinasPorDefecto.cubierta') ?>';
else if(data=='portada')
return '<?= lang('MaquinasPorDefecto.portada') ?>';
else if(data=='rotativa')
return '<?= lang('MaquinasPorDefecto.rotativa') ?>';
}
},
{ 'data': 'maquina' },
{ 'data': 'ancho_min' },
{ 'data': 'ancho_max' },
{ 'data': 'alto_min' },
{ 'data': 'alto_max' },
{ 'data': 'tirada_min' },
{ 'data': 'tirada_max' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/configuracion/maquinasdefecto/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/configuracion/maquinasdefecto/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})
}
});
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
<?= $this->endSection() ?>