Merge branch 'main' into 'dev/ui-cliente_contactos'

# Conflicts:
#   ci4/app/Config/Routes.php
This commit is contained in:
Ignacio Martinez Navajas
2023-08-18 13:44:59 +00:00
87 changed files with 2989 additions and 349 deletions

View File

@ -4,7 +4,7 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control"
value="<?= old('nombre', $tarifaacabadoEntity->nombre) ?>">
</div><!--//.mb-3 -->
@ -12,7 +12,7 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control"
<input type="text" id="precio_min" name="precio_min" class="form-control"
value="<?= old('precio_min', $tarifaacabadoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
@ -20,10 +20,20 @@
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control"
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control"
value="<?= old('importe_fijo', $tarifaacabadoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaacabadoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifaacabado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,6 +1,7 @@
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
@ -44,12 +45,12 @@
<table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaAcabadoLineas.paginasMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.paginasMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.margen') ?></th>
<th></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
@ -79,10 +80,10 @@
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>
`;
<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>
`;
};
@ -96,11 +97,11 @@
table : "#tableOfTarifaacabadolineas",
idSrc: 'id',
fields: [ {
name: "paginas_min"
name: "tirada_min"
}, {
name: "precio_max"
}, {
name: "paginas_max"
name: "tirada_max"
}, {
name: "precio_min"
},{
@ -165,9 +166,9 @@
async: true,
}),
columns: [
{ 'data': 'paginas_min' },
{ 'data': 'tirada_min' },
{ 'data': 'precio_max' },
{ 'data': 'paginas_max' },
{ 'data': 'tirada_max' },
{ 'data': 'precio_min' },
{ 'data': 'margen' },
{
@ -193,7 +194,7 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
@ -205,9 +206,9 @@
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
@ -216,32 +217,29 @@
// Delete row
$('#tableOfTarifaacabadolineas').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();
}
});
$(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: `/tarifas/tarifaacabadolineas/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') ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifaacabado.nombre') ?></th>
<th><?= lang('Tarifaacabado.precioMin') ?></th>
<th><?= lang('Tarifaacabado.importeFijo') ?></th>
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -89,10 +90,19 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
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>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifaacabado/edit/${$(this).attr('data-id')}`;
@ -115,7 +125,7 @@
theTable.row($(row)).invalidate().draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
popErrorAlert(jqXHR.responseJSON.messages.error);
})
}
});

View File

@ -1,26 +1,36 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control" value="<?=old('precio_min', $tarifaEncuadernacionEntity->precio_min) ?>">
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaEncuadernacionEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifaencuadernacion.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control" value="<?=old('importe_fijo', $tarifaEncuadernacionEntity->importe_fijo) ?>">
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaEncuadernacionEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaEncuadernacionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,6 +1,7 @@
<?= $this->include("themes/_commonPartialsBs/datatables") ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
@ -28,49 +29,80 @@
</div><!-- //.card -->
</div><!--//.col -->
<?php if($formAction == site_url('tarifas/tarifasencuadernacion/add')): ?>
<div class="accordion mt-3" id="accordionEncuadernacionLineas" style="visibility:hidden" >
<?php else: ?>
<div class="accordion mt-3" id="accordionEncuadernacionLineas" style="visibility:visible" >
<?php endif; ?>
<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("TarifaEncuadernacionLineas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionLineas">
<div class="accordion-body">
<table id="tableOfTarifaencuadernacionlineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionLineas.paginasMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php if(str_contains($formAction, 'edit')): ?>
<div class="accordion mt-3" id="accordionEncuadernacionTiradas" style="visibility:visible" >
<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("TarifaEncuadernacionTiradas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionTiradas">
<div class="accordion-body">
<table id="tableOfTarifaencuadernaciontiradas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<div class="accordion mt-3" id="accordionEncuadernacionLineas" style="visibility:visible" >
<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("TarifaEncuadernacionLineas.moduleTitle") ?></h3>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionEncuadernacionLineas">
<div class="accordion-body">
<p><?= lang("TarifaEncuadernacionLineas.moduleExplanation") ?></p>
<table id="tableOfTarifaencuadernacionlineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaEncuadernacionLineas.paginasMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<?php endif; ?>
</div><!--//.row -->
<?= $this->endSection() ?>
<!------------------------------------------->
<!-- Código JS para general -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
const url = window.location.href;
const url_parts = url.split('/');
var id = -1;
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
@ -78,16 +110,59 @@
id = -1;
}
<?php if(str_contains($formAction, 'edit')): ?>
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>
`;
<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>
`;
};
// Delete row
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
if($(this).closest('table').attr('id').includes('tiradas')){
$(".btn-remove").attr('table', "tiradas");
}
else if($(this).closest('table').attr('id').includes('lineas')){
$(".btn-remove").attr('table', "lineas");
}
else{
$(".btn-remove").attr('table', );
}
});
editor = new $.fn.dataTable.Editor( {
var selected_tirada_id = -1;
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
if($(this).attr('table').includes('tiradas')){
remove_tiradas(dataId, row);
}
else if ($(this).attr('table').includes('lineas')){
remove_lineas(dataId, row);
}
}
});
<?php endif; ?>
<?= $this->endSection() ?>
<?php if(str_contains($formAction, 'edit')): ?>
<!------------------------------------------->
<!-- Código JS para tableOfTarifaencuadernacionlineas -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
var editor = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
headers: {
@ -107,7 +182,7 @@
}, {
name: "margen"
}, {
"name": "tarifa_encuadernacion_id",
"name": "tirada_encuadernacion_id",
"type": "hidden"
},{
"name": "deleted_at",
@ -119,13 +194,14 @@
]
} );
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['tarifa_encuadernacion_id'] = id;
d.data[0]['tirada_encuadernacion_id'] = selected_tirada_id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['tarifa_encuadernacion_id'] = id;
d.data[v]['tirada_encuadernacion_id'] = selected_tirada_id;
}
}
});
@ -136,6 +212,7 @@
yeniden(json.<?= csrf_token() ?>);
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {
theTable.clearPipeline();
@ -143,7 +220,7 @@
});
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable( {
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
@ -158,8 +235,8 @@
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
data: {
id_tarifaencuadernacion: id,
data: function ( d ) {
d.tirada_id = selected_tirada_id;
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@ -194,21 +271,223 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
}
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
},
action: function ( e, dt, node, config ) {
if(selected_tirada_id == -1){
popErrorAlert("<?= lang('TarifaEncuadernacionLineas.validation.error_seleccion_tiradas') ?>");
}
else{
formOptions= {
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
};
editor.inlineCreate(config.position, formOptions);
}
},
} ]
} );
// Activate an inline edit on click of a table cell
$('#tableOfTarifaencuadernacionlineas').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
);
} );
// Delete row
function remove_lineas(dataId, row){
$.ajax({
url: `/tarifas/tarifaencuadernacionlineas/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 tableOfTarifaencuadernaciontiradas -->
<!------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
// Definicion de la ultima columna de la tabla
const lastColNr2 = $('#tableOfTarifaencuadernaciontiradas').find("tr:first th").length - 1;
// Datatables Editor
var editor2 = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfTarifaencuadernaciontiradas",
idSrc: 'id',
fields: [ {
name: "proveedor_id",
"type": "select"
}, {
name: "tirada_min"
}, {
name: "tirada_max"
}, {
"name": "tarifa_encuadernacion_id",
"type": "hidden"
},{
name: "proveedor",
"type": "hidden"
}, {
"name": "deleted_at",
"type": "hidden"
},{
"name": "is_deleted",
"type": "hidden"
},
]
} );
// Generación de la lista de proveedores (id, nombre) para encuadernación
const suppliersList = <?php echo json_encode($proveedores); ?>;
editor2.field( 'proveedor_id' ).update( suppliersList );
editor2.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['tarifa_encuadernacion_id'] = id;
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['tarifa_encuadernacion_id'] = id;
}
}
});
editor2.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor2.on( 'submitSuccess', function ( e, json, data, action ) {
theTable2.clearPipeline();
theTable2.draw();
});
// Tabla de tiradas
var theTable2 = $('#tableOfTarifaencuadernaciontiradas').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
lengthMenu: [ 5, 10, 25],
order: [ 0, "asc" ],
pageLength: 10,
lengthChange: true,
searching: false,
paging: true,
select: 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('dataTableOfTarifaEncuadernacionTiradas') ?>',
data: {
id_tarifaencuadernacion: id,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columns: [
{ 'data': 'proveedor_id',
render: function(data, type, row, meta) {
var value = suppliersList.find(element => element.value === data);
return value['label'];
},
},
{ 'data': 'tirada_min' },
{ 'data': 'tirada_max' },
{
data: actionBtns,
className: 'row-edit dt-center'
}
],
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr2]
},
{"orderData": [ 0, 1 ], "targets": 1 },
],
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: editor2,
formOptions: {
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
// Obtener la id de la fila seleccionada o ponerla a -1 cuando no haya ninguna seleccionada
var selected_tirada_id = -1;
theTable2.on( 'select', function ( e, dt, type, indexes ) {
if ( type === 'row' ) {
selected_tirada_id = parseInt(theTable2.rows( indexes ).data().pluck( 'id' )[0]);
theTable.clearPipeline();
theTable.draw();
}
} );
theTable2.on( 'deselect', function ( e, dt, type, indexes ) {
if ( theTable2.rows( '.selected' ).count() == 0 ) {
selected_tirada_id = -1;
theTable.clearPipeline();
theTable.draw();
}
} );
// Activate an inline edit on click of a table cell
$('#tableOfTarifaencuadernaciontiradas').on( 'click', 'tbody span.edit', function (e) {
editor2.inline(
theTable2.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'
}
@ -217,47 +496,44 @@
// Delete row
$('#tableOfTarifaencuadernacionlineas').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();
}
function remove_tiradas(dataId, row){
$.ajax({
url: `/tarifas/tarifaencuadernaciontiradas/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');
theTable2.clearPipeline();
theTable2.row($(row)).invalidate().draw();
theTable.clearPipeline();
theTable.draw();
popSuccessAlert(data.msg ?? jqXHR.statusText);
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.statusText)
});
});
}
<?= $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/select/1.7.0/js/dataTables.select.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>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.js') ?>"></script>
<?=$this->endSection() ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifaencuadernacion.nombre') ?></th>
<th><?= lang('Tarifaencuadernacion.precioMin') ?></th>
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -89,10 +90,20 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
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>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifasencuadernacion/edit/${$(this).attr('data-id')}`;

View File

@ -4,23 +4,33 @@
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaManipuladoEntity->nombre) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaManipuladoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" required class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" required class="form-control" value="<?=old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -47,12 +47,12 @@
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaManipuladoLineas.paginasMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.paginasMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
<th><?= lang('TarifaManipuladoLineas.margen') ?></th>
<th></th>
<th style="min-width:100px"></th>
</tr>
</thead>
<tbody>
@ -80,10 +80,10 @@
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>
`;
<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>
`;
};
@ -97,11 +97,11 @@
table : "#tableOfTarifamanipuladolineas",
idSrc: 'id',
fields: [ {
name: "paginas_min"
name: "tirada_min"
}, {
name: "precio_max"
}, {
name: "paginas_max"
name: "tirada_max"
}, {
name: "precio_min"
}, {
@ -166,9 +166,9 @@
async: true,
}),
columns: [
{ 'data': 'paginas_min' },
{ 'data': 'tirada_min' },
{ 'data': 'precio_max' },
{ 'data': 'paginas_max' },
{ 'data': 'tirada_max' },
{ 'data': 'precio_min' },
{ 'data': 'margen' },
{
@ -194,7 +194,7 @@
editor: editor,
formOptions: {
submitTrigger: -1,
submitHtml: '<i class="ti ti-device-floppy"/>'
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} );
@ -206,9 +206,9 @@
editor.inline(
theTable.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<i class="ti ti-x"></i>',
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
cancelTrigger: 'span.cancel',
submitHtml: '<i class="ti ti-device-floppy"></i>',
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
submitTrigger: 'span.edit',
submit: 'allIfChanged'
}
@ -243,6 +243,30 @@
}
});
});
// 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: `/tarifas/tarifamanipuladolineas/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') ?>

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifamanipulado.nombre') ?></th>
<th><?= lang('Tarifamanipulado.precioMin') ?></th>
<th><?= lang('Tarifamanipulado.importeFijo') ?></th>
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -88,15 +89,27 @@
{ 'data': 'nombre' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': actionBtns }
]
});
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>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/tarifas/tarifasmanipulado/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});

View File

@ -21,13 +21,13 @@
</label>
<input
type="number"
id="precio"
name="precio"
id="precio_pagina"
name="precio_pagina"
required
maxLength="31"
step="0.01"
class="form-control"
value="<?= old('precio', $tarifapreimpresionEntity->precio) ?>"
value="<?= old('precio', $tarifapreimpresionEntity->precio_pagina) ?>"
>
</div><!--//.mb-3 -->
@ -72,6 +72,22 @@
value="<?= old('margen', $tarifapreimpresionEntity->margen) ?>"
>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"
id="mostrar_en_presupuesto"
name="mostrar_en_presupuesto"
value="1"
class="form-check-input"<?= $tarifapreimpresionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>
>
<label for="mostrar_en_presupuesto" class="form-check-label">
<?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?>
</label>
</div>
</div>
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,4 +1,5 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">

View File

@ -20,6 +20,7 @@
<th><?= lang('Tarifapreimpresion.precioMin') ?></th>
<th><?= lang('Tarifapreimpresion.importeFijo') ?></th>
<th><?= lang('Tarifapreimpresion.margen') ?></th>
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -41,6 +42,9 @@
<td class="align-middle">
<?= esc($item->margen) ?>
</td>
<td class="align-middle">
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifapreimpresion', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>