mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el formulario maquinas
This commit is contained in:
@ -0,0 +1,299 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 px-4">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 col-lg-4 px-4">
|
||||
<div class="mb-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><!--//.col -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="tipo" class="form-label">
|
||||
<?=lang('Maquinas.tipo') ?>*
|
||||
</label>
|
||||
<select id="tipo" name="tipo" required class="form-control select2bs" 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>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-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><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="forzarNumFormasHorizontalesPortada" class="form-label">
|
||||
<?=lang('Maquinas.forzarNumFormasHorizontalesPortada') ?>
|
||||
</label>
|
||||
<input type="number" id="forzarNumFormasHorizontalesPortada" name="forzar_num_formas_horizontales_portada" maxLength="11" class="form-control" value="<?=old('forzar_num_formas_horizontales_portada', $maquina->forzar_num_formas_horizontales_portada) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="forzarNumFormasVerticalesPortada" class="form-label">
|
||||
<?=lang('Maquinas.forzarNumFormasVerticalesPortada') ?>
|
||||
</label>
|
||||
<input type="number" id="forzarNumFormasVerticalesPortada" name="forzar_num_formas_verticales_portada" maxLength="11" class="form-control" value="<?=old('forzar_num_formas_verticales_portada', $maquina->forzar_num_formas_verticales_portada) ?>">
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-1 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isTinta" class="form-label">
|
||||
<?=lang('Maquinas.isRotativa') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isRotativa" class="form-check-label">
|
||||
<input type="checkbox" id="isRotativa" name="is_rotativa" value="1" class="form-check-input"<?=$maquina->is_rotativa== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-1 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isTinta" class="form-label">
|
||||
<?=lang('Maquinas.isTinta') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isTinta" class="form-check-label">
|
||||
<input type="checkbox" id="isTinta" name="is_tinta" value="1" class="form-check-input"<?=$maquina->is_tinta== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-6">
|
||||
<div class="mb-3">
|
||||
<label for="isPadre" class="form-label">
|
||||
<?=lang('Maquinas.isPadre') ?>
|
||||
</label>
|
||||
<div class="form-check">
|
||||
<label for="isPadre" class="form-check-label">
|
||||
<input type="checkbox" id="isPadre" name="is_padre" value="1" class="form-check-input"<?=$maquina->is_padre== true ? 'checked' : ''; ?>>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div id="selectVariante" class="mb-3" style="display:none">
|
||||
<label for="padreId" class="form-label">
|
||||
<?=lang('Maquinas.padreId') ?>
|
||||
</label>
|
||||
|
||||
<select id="padreId" name="padre_id" class="form-control select2bs2" 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><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
|
||||
<?php if($maquina->is_rotativa== false): ?>
|
||||
<div class="row" id="datosRotativa" style="display:none">
|
||||
<?php else: ?>
|
||||
<div class="row" id="datosRotativa">
|
||||
<?php endif; ?>
|
||||
<div class="col-lg-2 px-4">
|
||||
|
||||
<div class="mb-3">
|
||||
<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><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<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><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 px-4">
|
||||
<label for="observaciones" class="form-label">
|
||||
<?=lang('Maquinas.observaciones') ?>
|
||||
</label>
|
||||
<textarea rows="2" id="observaciones" name="observaciones" style="height: 5em;" class="form-control"><?=old('observaciones', $maquina->observaciones) ?></textarea>
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -0,0 +1,389 @@
|
||||
<?= $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" 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="card-footer">
|
||||
<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">
|
||||
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
||||
</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.predeterminado') ?></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="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionTip1" 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('MaquinasTarifasImpresions.uso') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
||||
<th><?= lang('MaquinasTarifasImpresions.predeterminado') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$(document).ready(function () {
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#datosRotativa").show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#isRotativa').on("click",function(el){
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#datosRotativa").show();
|
||||
}else{
|
||||
document.getElementById("precioTintaNegro").value = null;
|
||||
document.getElementById("precioTintaColor").value = null;
|
||||
document.getElementById("velocidadCorte").value = null;
|
||||
document.getElementById("precioHoraCorte").value = null;
|
||||
document.getElementById("metrosxminuto").value = null;
|
||||
$("#datosRotativa").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#isPadre').on("click",function(el){
|
||||
if($(this).is(':checked')){
|
||||
|
||||
$("#selectVariante").show();
|
||||
}else{
|
||||
|
||||
$("#padreId").select2('val', -1);
|
||||
$("#selectVariante").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#padreId').select2({
|
||||
theme: 'bootstrap-5',
|
||||
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('/');
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
else{
|
||||
id = -1;
|
||||
}
|
||||
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
<span class="edit"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></span>
|
||||
<span class="cancel"></span>
|
||||
<span class="remove"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></span>
|
||||
`;
|
||||
};
|
||||
|
||||
|
||||
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: ['<?= lang('MaquinasTarifasImpresions.interior') ?>', '<?= lang('MaquinasTarifasImpresions.portada') ?>']
|
||||
}, {
|
||||
name: "tipo",
|
||||
type: "select",
|
||||
options: ['<?= lang('MaquinasTarifasImpresions.negro') ?>', '<?= lang('MaquinasTarifasImpresions.color') ?>',
|
||||
'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', '<?= lang('MaquinasTarifasImpresions.bicolor') ?>']
|
||||
}, {
|
||||
name: "precio",
|
||||
attr: {
|
||||
type: "number"
|
||||
}
|
||||
}, {
|
||||
name: "predeterminado",
|
||||
type: "checkbox",
|
||||
separator: "",
|
||||
options: [
|
||||
{ label: "", value: 1 }
|
||||
],
|
||||
unselectedValue: 0
|
||||
|
||||
}, {
|
||||
"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 ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
});
|
||||
|
||||
|
||||
var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 0, "asc" ]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: "Bltp",
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfMaquinasTarifasImpresion') ?>',
|
||||
data: {
|
||||
id_maquina: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'uso' },
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'precio' },
|
||||
{ 'data': 'predeterminado' },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
},
|
||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||
|
||||
],
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
buttons: [ {
|
||||
className: 'btn btn-primary float-end me-sm-3 me-1',
|
||||
extend: "createInline",
|
||||
editor: editor,
|
||||
formOptions: {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<i class="ti ti-device-floppy"/>'
|
||||
}
|
||||
} ]
|
||||
} );
|
||||
|
||||
|
||||
|
||||
// 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: '<i class="ti ti-x"></i>',
|
||||
cancelTrigger: 'span.cancel',
|
||||
submitHtml: '<i class="ti ti-device-floppy"></i>',
|
||||
submitTrigger: 'span.edit',
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.remove', function (e) {
|
||||
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||
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');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
editor
|
||||
.create( false )
|
||||
.edit( this.parentNode, false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
|
||||
|
||||
<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.min.js') ?>"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
@ -0,0 +1,190 @@
|
||||
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $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.padreId') ?></th>
|
||||
<th><?= lang('Maquinas.tipo') ?></th>
|
||||
<th><?= lang('Maquinas.velocidad') ?></th>
|
||||
<th><?= lang('Maquinas.duracionJornada') ?></th>
|
||||
<th><?= lang('Maquinas.ancho') ?></th>
|
||||
<th><?= lang('Maquinas.alto') ?></th>
|
||||
<th><?= lang('Maquinas.anchoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.altoImpresion') ?></th>
|
||||
<th><?= lang('Maquinas.ordenPlanning') ?></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">
|
||||
<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>
|
||||
</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: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.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': 'padre' },
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'velocidad' },
|
||||
{ 'data': 'duracion_jornada' },
|
||||
{ 'data': 'ancho' },
|
||||
{ 'data': 'alto' },
|
||||
{ 'data': 'ancho_impresion' },
|
||||
{ 'data': 'alto_impresion' },
|
||||
{ 'data': 'orden_planning' },
|
||||
{ '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 = `<?= route_to('maquinaList') ?>/${$(this).attr('data-id')}/edit`;
|
||||
window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Maquinas.maquina'))]) ?>',
|
||||
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');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
//url: `<?= route_to('maquinaList') ?>/${dataId}`,
|
||||
//method: 'DELETE',
|
||||
url: `/configuracion/maquinas/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
|
||||
|
||||
<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>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
@ -73,6 +73,16 @@
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
<label for="isActivo" class="form-check-label">
|
||||
<input type="checkbox" id="isActivo" name="isActivo" value="1" class="form-check-input" <?= $papelImpresion->isActivo == true ? 'checked' : ''; ?>>
|
||||
<?= lang('PapelImpresion.activo') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
<th><?= lang('PapelImpresion.portada') ?></th>
|
||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||
<th><?= lang('PapelImpresion.activo') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -99,13 +100,14 @@
|
||||
{ 'data': 'portada' },
|
||||
{ 'data': 'cubierta' },
|
||||
{ 'data': 'rotativa' },
|
||||
{ 'data': 'isActivo' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3, 4, 5, 6, 7];
|
||||
const boolCols = [3, 4, 5, 6, 7, 8];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
Reference in New Issue
Block a user