terminadas plantillas cliente y plantillas cliente lineas

This commit is contained in:
2024-01-02 10:14:45 +01:00
parent 3c9a08a726
commit 17885c29f9
17 changed files with 1123 additions and 451 deletions

View File

@ -0,0 +1,20 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('ClientePrecios.nombre') ?>*
</label>
<input
type="text"
id="nombre"
name="nombre"
required
maxLength="255"
class="form-control"
value="<?= old('nombre', $clienteplantillapreciosEntity->nombre) ?>"
>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,339 @@
<?= $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="clientePlantillaPreciosForm" method="post" class="card-body" action="<?= $formAction ?>">
<?= csrf_field() ?>
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/clientes/plantillaprecios/_ClienteplantillapreciosFormItems") ?>
<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("clienteplantillapreciosList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?php if(str_contains($formAction,'edit')): ?>
<div class="accordion mt-3" id="accordionPreciosLineas">
<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="#accordionPreciosLineas">
<div class="accordion-body">
<table id="tableOfPlantillasPreciosLineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('ClientePrecios.tipo') ?></th>
<th><?= lang('ClientePrecios.tipo_maquina') ?></th>
<th><?= lang('ClientePrecios.tipo_impresion') ?></th>
<th><?= lang('ClientePrecios.tiempo_min') ?></th>
<th><?= lang('ClientePrecios.tiempo_max') ?></th>
<th><?= lang('ClientePrecios.precio_hora') ?></th>
<th><?= lang('ClientePrecios.margen') ?></th>
<th><?= lang('ClientePrecios.user_updated_id') ?></th>
<th><?= lang('ClientePrecios.updated_at') ?></th>
<th class="text-nowrap" style="min-width:100px"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
<?= $this->endSection() ?>
<?php if(str_contains($formAction,'edit')): ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr_lineas = $('#tableOfPlantillasPreciosLineas').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_lineas = 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>
`;
};
const tipo_linea = [
{label:'<?= lang('ClientePrecios.interior') ?>', value:'interior'},
{label:'<?= lang('ClientePrecios.cubierta') ?>', value: 'cubierta'},
{label:'<?= lang('ClientePrecios.sobrecubierta') ?>', value: 'sobrecubierta'}
];
const tipo_maquina = [
{label: '<?= lang('ClientePrecios.toner') ?>', value:'toner'},
{label: '<?= lang('ClientePrecios.inkjet') ?>', value:'inkjet'},
];
const tipo_impresion = [
{label: '<?= lang('ClientePrecios.negro') ?>', value:'negro'},
{label: '<?= lang('ClientePrecios.negrohq') ?>', value:'negrohq'},
{label: '<?= lang('ClientePrecios.color') ?>', value:'color'},
{label: '<?= lang('ClientePrecios.colorhq') ?>', value:'colorhq'},
];
var editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfClienteplantillaprecioslineas') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfPlantillasPreciosLineas",
idSrc: 'id',
fields: [ {
name: "tipo",
type: "select",
options: tipo_linea
}, {
name: "tipo_maquina",
type: "select",
options: tipo_maquina
}, {
name: "tipo_impresion",
type: "select",
options: tipo_impresion
}, {
name: "tiempo_min"
}, {
name: "tiempo_max"
}, {
name: "precio_hora"
}, {
name: "margen"
}, {
name: "user_updated_id",
type:'hidden',
}, {
name: "updated_at",
type:'hidden',
}, {
"name": "plantilla_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]['plantilla_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['plantilla_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 = $('#tableOfPlantillasPreciosLineas').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 10, 25, 50, 100],
order: [[ 0, "asc" ], [ 1, "asc" ], [ 2, "asc" ], [ 3, "asc" ]],
pageLength: 50,
lengthChange: true,
searching: false,
paging: true,
info: false,
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClientesplantillaprecioslineas') ?>',
data: {
plantilla_id: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ 'data': 'tipo' ,
'render': function ( data, type, row, meta ) {
if(data=='interior')
return '<?= lang('ClientePrecios.interior') ?>';
else if(data=='cubierta')
return '<?= lang('ClientePrecios.cubierta') ?>';
else if(data=='sobrecubierta')
return '<?= lang('ClientePrecios.sobrecubierta') ?>';
}
},
{ 'data': 'tipo_maquina',
'render': function ( data, type, row, meta ) {
if(data=='toner')
return '<?= lang('ClientePrecios.toner') ?>';
else if(data=='inkjet')
return '<?= lang('ClientePrecios.inkjet') ?>';
}
},
{ 'data': 'tipo_impresion',
'render': function ( data, type, row, meta ) {
if(data=='negro')
return '<?= lang('ClientePrecios.negro') ?>';
else if(data=='negrohq')
return '<?= lang('ClientePrecios.negrohq') ?>';
else if(data=='color')
return '<?= lang('ClientePrecios.color') ?>';
else if(data=='colorhq')
return '<?= lang('ClientePrecios.colorhq') ?>';
}
},
{ 'data': 'tiempo_min' },
{ 'data': 'tiempo_max' },
{ 'data': 'precio_hora' },
{ 'data': 'margen' },
{ 'data': 'user_updated_id',
'render': function ( data, type, row, meta ) {
return row.user_updated
}
},
{ 'data': 'updated_at' },
{
data: actionBtns_lineas,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr_lineas]
},
{"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 me-sm-3 me-1',
extend: "createInline",
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
// Activate an inline edit on click of a table cell
$('#tableOfPlantillasPreciosLineas').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'
}
);
} );
// Delete row
$(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: `/clientes/clienteplantillaprecioslineas/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() ?>
<?php endif; ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.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.bootstrap5.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() ?>

View File

@ -0,0 +1,136 @@
<?=$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('ClientePrecios.plantillaPrecios_list') ?></h3>
<?=anchor(route_to('newClienteplantillaprecios'), lang('Basic.global.addNew').' '.lang('ClientePrecios.plantillaPrecios_name'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfClienteplantillaprecios" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
<thead>
<tr>
<th><?= lang('ClientePrecios.nombre') ?></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('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.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.bootstrap5.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() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
const actionBtns2 = 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>
`;
};
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/clientes/clienteplantillaprecios/edit/${$(this).attr('data-id')}`;
});
// Delete row
$(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: `/clientes/clienteplantillaprecios/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
tablePLantillaPrecios.clearPipeline();
tablePLantillaPrecios.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
});
}
});
var tablePLantillaPrecios = $('#tableOfClienteplantillaprecios').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250],
order: [[ 0, "asc" ]],
pageLength: 25,
lengthChange: true,
searching: true,
paging: true,
info: true,
stateSave: true,
dom: "lftp",
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClientesplantillaprecios') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ data: 'nombre'},
{ data: actionBtns2,
className: 'row-edit dt-center'}
],
columnDefs: [
{
orderable: false,
targets: [lastColNr2]
},
{
searchable: false,
targets: [lastColNr2]
}
],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
}
} );
<?=$this->endSection() ?>

View File

@ -41,8 +41,8 @@
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("clientes/cliente") ?>" class="menu-link">
<div data-i18n="<?= lang("menu_plantillas_tarifas_clientes") ?>"><?= lang("menu_plantillas_tarifas_clientes") ?></div>
<a href="<?= site_url("clientes/clienteplantillaprecios") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_plantillas_tarifas_clientes") ?>"><?= lang("App.menu_plantillas_tarifas_clientes") ?></div>
</a>
</li>
<?php endif; ?>

View File

@ -45,6 +45,11 @@
<div data-i18n="<?= lang("App.menu_clientes") ?>"><?= lang("App.menu_clientes") ?></div>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("clientes/clienteplantillaprecios") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_plantillas_tarifas_clientes") ?>"><?= lang("App.menu_plantillas_tarifas_clientes") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>

View File

@ -46,7 +46,7 @@
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("clientes/cliente") ?>" class="menu-link">
<a href="<?= site_url("clientes/clienteplantillaprecios") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_plantillas_tarifas_clientes") ?>"><?= lang("App.menu_plantillas_tarifas_clientes") ?></div>
</a>
</li>

View File

@ -45,6 +45,11 @@
<div data-i18n="<?= lang("App.menu_clientes") ?>"><?= lang("App.menu_clientes") ?></div>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("clientes/clienteplantillaprecios") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_plantillas_tarifas_clientes") ?>"><?= lang("App.menu_plantillas_tarifas_clientes") ?></div>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>