papel generico terminado. papel impresion a falta de maquinas y tipologias

This commit is contained in:
Jaime Jimenez
2023-05-28 12:33:07 +02:00
parent e8d733f39d
commit 1cfa5bd60b
29 changed files with 1902 additions and 381 deletions

View File

@ -1,3 +1,4 @@
<?php if (config('Basics')->theme['name'] == 'Bootstrap5') { ?>
<div class="modal fade" id="confirm2delete" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="confirm2deleteLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
@ -15,3 +16,24 @@
</div><!--//.modal-content -->
</div><!--//.modal-dialog -->
</div><!--//.modal -->
<?php } else { ?>
<div id="confirm2delete" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="confirm2deleteLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="confirm2deleteLabel">Confirm to delete record</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete this record?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a class="btn btn-danger btn-confirm"> Yes, Delete It! </a>
</div><!--//.modal-footer -->
</div><!--//.modal-content -->
</div><!--//.modal-dialog -->
</div><!--//.modal -->
<?php } ?>

View File

@ -1,3 +1,4 @@
<?php if (config('Basics')->theme['name'] == 'Bootstrap5') { ?>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
@ -17,3 +18,18 @@
</div>
</div>
<?php } else { ?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-dismissible alert-warning">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fas fa-exclamation-triangle"></i> Please correct the errors below:</h4>
<ul>
<?php foreach ($errors as $error) : ?>
<li><?= esc($error) ?></li>
<?php endforeach ?>
</ul>
</div><!--//.alert-->
</div><!--//.col-->
</div><!--//.row -->
<?php } ?>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,18 +1,17 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/dataTables.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?= $this->endSection() ?>
<?= $this->section('footerAdditions') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->endSection() ?>
<!-- Push additional js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment-with-locales.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<?= $this->endSection() ?>
@ -160,7 +159,7 @@
"scrollX": true,
"stateSave": true,
"language": {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
url: "//cdn.datatables.net/plug-ins/1.10.25/i18n/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
"columnDefs": [
{

View File

@ -1,27 +1,19 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/select2/select2.css') ?>"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.1.1/dist/select2-bootstrap-5-theme.min.css" />
<?= $this->endSection() ?>
<!-- Push additional js -->
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/select2/select2.js') ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.full.min.js"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
const select2 = $('.select2');
// Select2
// --------------------------------------------------------------------
if (select2.length) {
select2.each(function () {
var $this = $(this);
$this.wrap('<div class="position-relative"></div>').select2({
placeholder: 'Select value',
dropdownParent: $this.parent()
});
$('.select2bs').select2({
theme: "bootstrap-5",
allowClear: false,
});
}
<?= $this->endSection() ?>

View File

@ -1,26 +1,66 @@
<!-- Push section css -->
<?= $this->section('css') ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@9.7.2/dist/sweetalert2.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.css">
<style>
/* Toastr */
.colored-toast.swal2-icon-success {
background-color: #478921 !important;
}
.colored-toast.swal2-icon-error {
background-color: #c42a2a !important;
}
.colored-toast.swal2-icon-warning {
background-color: #f8bb86 !important;
}
.colored-toast.swal2-icon-info {
background-color: #3fc3ee !important;
}
.colored-toast.swal2-icon-question {
background-color: #87adbd !important;
}
.colored-toast .swal2-title {
color: white;
}
.colored-toast .swal2-close {
color: white;
}
.colored-toast .swal2-html-container {
color: white;
}
</style>
<?= $this->endSection() ?>
<!-- Push section js -->
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.7.2/dist/sweetalert2.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js"></script>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
var Toast = Swal.mixin({
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
position: 'top-right',
iconColor: 'white',
customClass: {
popup: 'colored-toast'
},
showConfirmButton: false,
timer: 6000,
timerProgressBar: true,
onOpen: (toast) => {
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}

View File

@ -0,0 +1,165 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('PapelImpresion.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?= old('nombre', $papelImpresion->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="referencia" class="form-label">
<?= lang('PapelImpresion.referencia') ?>*
</label>
<input type="text" id="referencia" name="referencia" required maxLength="13" class="form-control" value="<?= old('referencia', $papelImpresion->referencia) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ancho" class="form-label">
<?= lang('PapelImpresion.ancho') ?>*
</label>
<input type="number" id="ancho" name="ancho" required maxLength="8" step="0.01" class="form-control" value="<?= old('ancho', $papelImpresion->ancho) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="mano" class="form-label">
<?= lang('PapelImpresion.mano') ?>*
</label>
<input type="number" id="mano" name="mano" required maxLength="8" step="0.01" class="form-control" value="<?= old('mano', $papelImpresion->mano) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="pesoPorPliego" class="form-label">
<?= lang('PapelImpresion.pesoPorPliego') ?>*
</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) ?>">
</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">
<label for="bn" class="form-check-label">
<input type="checkbox" id="bn" name="bn" value="1" class="form-check-input" <?= $papelImpresion->bn == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.bn') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="portada" class="form-check-label">
<input type="checkbox" id="portada" name="portada" value="1" class="form-check-input" <?= $papelImpresion->portada == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.portada') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="rotativa" class="form-check-label">
<input type="checkbox" id="rotativa" name="rotativa" value="1" class="form-check-input" <?= $papelImpresion->rotativa == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.rotativa') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="papelGenericoId" class="form-label">
<?= lang('PapelImpresion.papelGenericoId') ?>*
</label>
<select id="papelGenericoId" name="papel_generico_id" required class="form-control select2bs2" style="width: 100%;">
<?php if (isset($papelGenericoList) && is_array($papelGenericoList) && !empty($papelGenericoList)) :
foreach ($papelGenericoList as $k => $v) : ?>
<option value="<?= $k ?>" <?= $k == $papelImpresion->papel_generico_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="gramaje" class="form-label">
<?= lang('PapelImpresion.gramaje') ?>*
</label>
<input type="number" id="gramaje" name="gramaje" required maxLength="31" step="0.01" class="form-control" value="<?= old('gramaje', $papelImpresion->gramaje) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="alto" class="form-label">
<?= lang('PapelImpresion.alto') ?>*
</label>
<input type="number" id="alto" name="alto" required maxLength="8" step="0.01" class="form-control" value="<?= old('alto', $papelImpresion->alto) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="espesor" class="form-label">
<?= lang('PapelImpresion.espesor') ?>*
</label>
<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') ?>*
</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) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precioTonelada" class="form-label">
<?= lang('PapelImpresion.precioTonelada') ?>*
</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) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="color" class="form-check-label">
<input type="checkbox" id="color" name="color" value="1" class="form-check-input" <?= $papelImpresion->color == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.color') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="cubierta" class="form-check-label">
<input type="checkbox" id="cubierta" name="cubierta" value="1" class="form-check-input" <?= $papelImpresion->cubierta == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.cubierta') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="defecto" class="form-check-label">
<input type="checkbox" id="defecto" name="defecto" value="1" class="form-check-input" <?= $papelImpresion->defecto == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.defecto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,26 +1,158 @@
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="papelGenericoForm" 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/papel/_papelGenericoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("papelGenericoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/papel/_papelGenericoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("papelGenericoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
<?php if(str_contains($formAction,'edit')): ?>
<div class="accordion mt-3" id="accordionExample">
<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="#accordionOne" aria-expanded="flase" aria-controls="accordionOne">
<?= lang("PapelGenerico.Form_acordion_title") ?>
</button>
</h2>
<div id="accordionOne" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
<div class="accordion-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfPapelesimpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('PapelImpresion.defecto') ?></th>
<th><?= lang('PapelImpresion.nombre') ?></th>
<th><?= lang('PapelImpresion.gramaje') ?></th>
<th class="text-nowrap"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
// JJO
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 lastColNr = $('#tableOfPapelesimpresion').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">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfPapelesimpresion').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', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
stateSave: true,
order: [[1, 'asc']],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPapelesImpresion') ?>',
data: {
id_PG: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr] //JJO añadidas bool cols
}
],
columns : [
{ 'data': 'defecto' },
{ 'data': 'nombre' },
{ 'data': 'gramaje' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [0];
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>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
//window.location.href = `<?= route_to('papelImpresionList') ?>/${$(this).attr('data-id')}/edit`;
window.location.href = `/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`;
});
<?=$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() ?>

View File

@ -106,7 +106,8 @@
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('papelGenericoList') ?>/${$(this).attr('data-id')}/edit`;
//window.location.href = `<?= route_to('papelGenericoList') ?>/edit/${$(this).attr('data-id')}`;
window.location.href = `/configuracion/papelesgenericos/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
@ -122,11 +123,13 @@ $(document).on('click', '.btn-delete', function(e) {
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('papelGenericoList') ?>/${dataId}`,
method: 'DELETE',
//url: `<?= route_to('papelGenericoList') ?>/${dataId}`,
//method: 'DELETE',
url: `/configuracion/papelesgenericos/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
Toast.fire({
icon: 'success',

View File

@ -0,0 +1,63 @@
<?= $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="papelImpresionForm" 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/papel/_papelImpresionFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("papelImpresionList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#papelGenericoId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPapelesGenericos") ?>',
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,183 @@
<?=$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('PapelImpresion.papelImpresionList') ?></h3>
<?=anchor(route_to('newPapelImpresion'), lang('Basic.global.addNew').' '.lang('PapelImpresion.papelImpresion'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfPapelesimpresion" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('PapelImpresion.nombre') ?></th>
<th><?= lang('PapelGenerico.papelGenerico') ?></th>
<th><?= lang('PapelImpresion.gramaje') ?></th>
<th><?= lang('PapelImpresion.bn') ?></th>
<th><?= lang('PapelImpresion.color') ?></th>
<th><?= lang('PapelImpresion.portada') ?></th>
<th><?= lang('PapelImpresion.cubierta') ?></th>
<th><?= lang('PapelImpresion.rotativa') ?></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 = $('#tableOfPapelesimpresion').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">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfPapelesimpresion').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', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPapelesImpresion') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [3, 4, 5, 6, 7, lastColNr] //JJO añadidas bool cols
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'papel_generico_id' },
{ 'data': 'gramaje' },
{ 'data': 'bn' },
{ 'data': 'color' },
{ 'data': 'portada' },
{ 'data': 'cubierta' },
{ 'data': 'rotativa' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [3, 4, 5, 6, 7];
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>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
//window.location.href = `<?= route_to('papelImpresionList') ?>/${$(this).attr('data-id')}/edit`;
window.location.href = `/configuracion/papelesimpresion/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
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) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
//url: `<?= route_to('papelImpresionList') ?>/${dataId}`,
//method: 'DELETE',
url: `/configuracion/papelesimpresion/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() ?>

View File

@ -57,7 +57,7 @@
<?php if (allowMenuSection($menus,
['Calendario', 'Correo', 'Formaspago', 'Imposiciones', 'Tipologias',
'Maquina', 'Papelgenerico', 'Seriefactura', 'Serviciocliente',
'Maquina', 'Papelesgenerico', 'Papelesimpresion', 'Seriefactura', 'Serviciocliente',
'Tamanioformatos', 'Tamaniolibros', 'Tareaservicio', 'Tiposimpresion', 'Trabajo'
],
'index')): ?>
@ -130,6 +130,15 @@
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Papelesimpresion')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_papelimpresion") ?>"><?= lang("App.menu_papelimpresion") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
<?php if (count($temp = getArrayItem($menus, 'name', 'Seriefactura')) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
<li class="menu-item">