Añadido clientes by Ozar y primeros fixes

This commit is contained in:
imnavajas
2023-07-10 10:05:06 +02:00
parent f67ba91b79
commit 42a20b93b0
25 changed files with 2737 additions and 52 deletions

View File

@ -0,0 +1,373 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('Clientes.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
value="<?= old('nombre', $clienteEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="alias" class="form-label">
<?= lang('Clientes.alias') ?>*
</label>
<input type="text" id="alias" name="alias" required maxLength="255" class="form-control"
value="<?= old('alias', $clienteEntity->alias) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="direccion" class="form-label">
<?= lang('Clientes.direccion') ?>
</label>
<textarea rows="3" id="direccion" name="direccion" style="height: 10em;"
class="form-control"><?= old('direccion', $clienteEntity->direccion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ciudad" class="form-label">
<?= lang('Clientes.ciudad') ?>
</label>
<input type="text" id="ciudad" name="ciudad" maxLength="100" class="form-control"
value="<?= old('ciudad', $clienteEntity->ciudad) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comunidadAutonomaId" class="form-label">
<?= lang('Clientes.comunidadAutonomaId') ?>
</label>
<select id="comunidadAutonomaId" name="comunidad_autonoma_id">
<option value="" selected="selected"><?= lang('Basic.global.pleaseSelectOne') ?></option>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="provincia" class="form-label">
<?= lang('Clientes.provincia') ?>
</label>
<input type="text" id="provincia" name="provincia" maxLength="100" class="form-control"
value="<?= old('provincia', $clienteEntity->provincia) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cp" class="form-label">
<?= lang('Clientes.cp') ?>
</label>
<input type="text" id="cp" name="cp" maxLength="10" class="form-control"
value="<?= old('cp', $clienteEntity->cp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?= lang('Clientes.paisId') ?>
</label>
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;">
<option value=""><?= lang('Basic.global.pleaseSelectA', [lang('Clientes.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>"<?= $item->id == $clienteEntity->pais_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="telefono" class="form-label">
<?= lang('Clientes.telefono') ?>
</label>
<input type="text" id="telefono" name="telefono" maxLength="60" class="form-control"
value="<?= old('telefono', $clienteEntity->telefono) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="email" class="form-label">
<?= lang('Clientes.email') ?>
</label>
<input type="email" id="email" name="email" maxLength="150" class="form-control"
value="<?= old('email', $clienteEntity->email) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="salesmanId" class="form-label">
<?= lang('Clientes.salesmanId') ?>*
</label>
<input type="number" id="salesmanId" name="salesman_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('salesman_id', $clienteEntity->salesman_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="soporteId" class="form-label">
<?= lang('Clientes.soporteId') ?>
</label>
<input type="number" id="soporteId" name="soporte_id" maxLength="10" class="form-control"
value="<?= old('soporte_id', $clienteEntity->soporte_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="formaPagoId" class="form-label">
<?= lang('Clientes.formaPagoId') ?>
</label>
<select id="formaPagoId" name="forma_pago_id" class="form-control select2bs" style="width: 100%;">
<option value=""><?= lang('Basic.global.pleaseSelectA', [lang('Clientes.formaPagoId')]) ?></option>
<?php foreach ($formaPagoList as $item) : ?>
<option value="<?= $item->id ?>"<?= $item->id == $clienteEntity->forma_pago_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="vencimiento" class="form-label">
<?= lang('Clientes.vencimiento') ?>*
</label>
<input type="number" id="vencimiento" name="vencimiento" required placeholder="15" maxLength="10"
class="form-control" value="<?= old('vencimiento', $clienteEntity->vencimiento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="fechavencimiento" class="form-label">
<?= lang('Clientes.fechavencimiento') ?>
</label>
<input type="text" id="fechavencimiento" name="fechaVencimiento" maxLength="100" class="form-control"
value="<?= old('fechaVencimiento', $clienteEntity->fechaVencimiento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margen" class="form-label">
<?= lang('Clientes.margen') ?>*
</label>
<input type="number" id="margen" name="margen" required placeholder="40.00" maxLength="8" step="0.01"
class="form-control" value="<?= old('margen', $clienteEntity->margen) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margenPod" class="form-label">
<?= lang('Clientes.margenPod') ?>
</label>
<input type="number" id="margenPod" name="margen_pod" maxLength="8" step="0.01" class="form-control"
value="<?= old('margen_pod', $clienteEntity->margen_pod) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="descuento" class="form-label">
<?= lang('Clientes.descuento') ?>*
</label>
<input type="number" id="descuento" name="descuento" required placeholder="0.00" maxLength="8" step="0.01"
class="form-control" value="<?= old('descuento', $clienteEntity->descuento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCredito" class="form-label">
<?= lang('Clientes.limiteCredito') ?>*
</label>
<input type="number" id="limiteCredito" name="limite_credito" required placeholder="0.00" maxLength="8"
step="0.01" class="form-control"
value="<?= old('limite_credito', $clienteEntity->limite_credito) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCreditoUserId" class="form-label">
<?= lang('Clientes.limiteCreditoUserId') ?>*
</label>
<input type="number" id="limiteCreditoUserId" name="limite_credito_user_id" required placeholder="1"
maxLength="10" class="form-control"
value="<?= old('limite_credito_user_id', $clienteEntity->limite_credito_user_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCreditoChangeAt" class="form-label">
<?= lang('Clientes.limiteCreditoChangeAt') ?>*
</label>
<input type="text" id="limiteCreditoChangeAt" name="limite_credito_change_at" required
placeholder="2017-02-13 12:38:03" maxLength="20" class="form-control"
value="<?= old('limite_credito_change_at', $clienteEntity->limite_credito_change_at) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="creditosolunion" class="form-label">
<?= lang('Clientes.creditosolunion') ?>
</label>
<input type="text" id="creditosolunion" name="creditoSolunion" maxLength="100" class="form-control"
value="<?= old('creditoSolunion', $clienteEntity->creditoSolunion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="creditoasegurado" class="form-check-label">
<input type="checkbox" id="creditoasegurado" name="creditoAsegurado" value="1"
class="form-check-input"<?= $clienteEntity->creditoAsegurado == true ? 'checked' : ''; ?>>
<?= lang('Clientes.creditoasegurado') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ccc" class="form-label">
<?= lang('Clientes.ccc') ?>
</label>
<input type="text" id="ccc" name="ccc" maxLength="100" class="form-control"
value="<?= old('ccc', $clienteEntity->ccc) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cccCustomer" class="form-label">
<?= lang('Clientes.cccCustomer') ?>
</label>
<input type="text" id="cccCustomer" name="ccc_customer" maxLength="100" class="form-control"
value="<?= old('ccc_customer', $clienteEntity->ccc_customer) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="numCuenta" class="form-label">
<?= lang('Clientes.numCuenta') ?>
</label>
<input type="text" id="numCuenta" name="num_cuenta" maxLength="10" class="form-control"
value="<?= old('num_cuenta', $clienteEntity->num_cuenta) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="disponibleFe" class="form-check-label">
<input type="checkbox" id="disponibleFe" name="disponible_fe" value="1"
class="form-check-input"<?= $clienteEntity->disponible_fe == true ? 'checked' : ''; ?>>
<?= lang('Clientes.disponibleFe') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="messageTracking" class="form-check-label">
<input type="checkbox" id="messageTracking" name="message_tracking" value="1"
class="form-check-input"<?= $clienteEntity->message_tracking == true ? 'checked' : ''; ?>>
<?= lang('Clientes.messageTracking') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="messageProductionStart" class="form-check-label">
<input type="checkbox" id="messageProductionStart" name="message_production_start" value="1"
class="form-check-input"<?= $clienteEntity->message_production_start == true ? 'checked' : ''; ?>>
<?= lang('Clientes.messageProductionStart') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="tiradaFlexible" class="form-check-label">
<input type="checkbox" id="tiradaFlexible" name="tirada_flexible" value="1"
class="form-check-input"<?= $clienteEntity->tirada_flexible == true ? 'checked' : ''; ?>>
<?= lang('Clientes.tiradaFlexible') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="descuentoTiradaFlexible" class="form-label">
<?= lang('Clientes.descuentoTiradaFlexible') ?>*
</label>
<input type="number" id="descuentoTiradaFlexible" name="descuento_tirada_flexible" required
placeholder="20.00" maxLength="8" step="0.01" class="form-control"
value="<?= old('descuento_tirada_flexible', $clienteEntity->descuento_tirada_flexible) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosTiradaFlexible" class="form-label">
<?= lang('Clientes.comentariosTiradaFlexible') ?>*
</label>
<textarea rows="3" id="comentariosTiradaFlexible" name="comentarios_tirada_flexible" required
style="height: 10em;"
class="form-control"><?= old('comentarios_tirada_flexible', $clienteEntity->comentarios_tirada_flexible) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="saturacion" class="form-label">
<?= lang('Clientes.saturacion') ?>*
</label>
<input type="number" id="saturacion" name="saturacion" required placeholder="100.00" maxLength="8"
step="0.01" class="form-control" value="<?= old('saturacion', $clienteEntity->saturacion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiendaId" class="form-label">
<?= lang('Clientes.tiendaId') ?>
</label>
<input type="number" id="tiendaId" name="tienda_id" maxLength="10" class="form-control"
value="<?= old('tienda_id', $clienteEntity->tienda_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margenPlantillaId" class="form-label">
<?= lang('Clientes.margenPlantillaId') ?>
</label>
<input type="number" id="margenPlantillaId" name="margen_plantilla_id" maxLength="10" class="form-control"
value="<?= old('margen_plantilla_id', $clienteEntity->margen_plantilla_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosProduccion" class="form-label">
<?= lang('Clientes.comentariosProduccion') ?>
</label>
<textarea rows="3" id="comentariosProduccion" name="comentarios_produccion" style="height: 10em;"
class="form-control"><?= old('comentarios_produccion', $clienteEntity->comentarios_produccion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="psCustomerId" class="form-label">
<?= lang('Clientes.psCustomerId') ?>
</label>
<input type="number" id="psCustomerId" name="ps_customer_id" maxLength="10" class="form-control"
value="<?= old('ps_customer_id', $clienteEntity->ps_customer_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="lineasenviofactura" class="form-check-label">
<input type="checkbox" id="lineasenviofactura" name="lineasEnvioFactura" value="1"
class="form-check-input"<?= $clienteEntity->lineasEnvioFactura == true ? 'checked' : ''; ?>>
<?= lang('Clientes.lineasenviofactura') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentarios" class="form-label">
<?= lang('Clientes.comentarios') ?>
</label>
<textarea rows="3" id="comentarios" name="comentarios" style="height: 10em;"
class="form-control"><?= old('comentarios', $clienteEntity->comentarios) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userCreatedId" class="form-label">
<?= lang('Clientes.userCreatedId') ?>*
</label>
<input type="number" id="userCreatedId" name="user_created_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('user_created_id', $clienteEntity->user_created_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userUpdateId" class="form-label">
<?= lang('Clientes.userUpdateId') ?>*
</label>
<input type="number" id="userUpdateId" name="user_update_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('user_update_id', $clienteEntity->user_update_id) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,27 @@
<?= $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="clienteForm" 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/clientes/_clienteFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("clienteList"), 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() ?>

View File

@ -0,0 +1,157 @@
<?=$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('Clientes.clienteList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfClientes" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Clientes.nombre') ?></th>
<th><?= lang('Clientes.alias') ?></th>
<th><?= lang('Clientes.email') ?></th>
<th><?= lang('Clientes.salesmanId') ?></th>
<th><?= lang('FormasPago.formaPago') ?></th>
<th><?= lang('Clientes.vencimiento') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newCliente'), lang('Basic.global.addNew').' '.lang('Clientes.cliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfClientes').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 = $('#tableOfClientes').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 10,
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[1, 'asc']],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= site_url('cliente/datatable') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'alias' },
{ 'data': 'email' },
{ 'data': 'salesman_id' },
{ 'data': 'forma_pago' },
{ 'data': 'vencimiento' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('clienteList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Clientes.cliente'))]) ?>',
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('clienteList') ?>/${dataId}`,
method: 'DELETE',
}).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.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() ?>

View File

@ -0,0 +1,27 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('ComunidadesAutonomas.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="100" class="form-control" value="<?=old('nombre', $comunidadesAutonomasEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('ComunidadesAutonomas.pais') ?>*
</label>
<select id="paisId" name="pais_id" required class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('ComunidadesAutonomas.pais')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$comunidadesAutonomasEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,28 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/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="comunidadAutonomaForm" 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/comunidades-autonomas/_comunidadAutonomaFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("comunidadAutonomaList"), 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() ?>

View File

@ -0,0 +1,159 @@
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/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('ComunidadesAutonomas.comunidadAutonomaList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfComunidadesautonomas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('ComunidadesAutonomas.id')?></th>
<th><?= lang('ComunidadesAutonomas.nombre') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th><?= lang('ComunidadesAutonomas.createdAt') ?></th>
<th><?= lang('ComunidadesAutonomas.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newComunidadAutonoma'), lang('Basic.global.addNew').' '.lang('ComunidadesAutonomas.comunidadAutonoma'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfComunidadesautonomas').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 = $('#tableOfComunidadesautonomas').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,
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfComunidadesAutonomas') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [0,lastColNr]
}
],
columns : [
{ 'data': actionBtns },
{ 'data': 'id' },
{ 'data': 'nombre' },
{ 'data': 'pais' },
{ 'data': 'created_at' },
{ 'data': 'updated_at' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const dateCols = [4, 5];
const shortDateFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY')?>';
const dateTimeFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY h:i a')?>';
for (let coln of dateCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
const datestr = cell.innerHTML;
const dateStrLen = datestr.toString().trim().length;
if (dateStrLen > 0) {
let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
const d = new Date(...dateTimeParts); // new Date(datestr);
const md = moment(d);
const usingThisFormat = dateStrLen > 11 ? dateTimeFormat : shortDateFormat;
const formattedDateStr = md.format(usingThisFormat);
cell.innerHTML = formattedDateStr;
}
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('comunidadAutonomaList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('ComunidadesAutonomas.comunidad autonoma'))]) ?>',
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('comunidadAutonomaList') ?>/${dataId}`,
method: 'DELETE',
}).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() ?>

View File

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

View File

@ -0,0 +1,26 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/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="formaPagoForm" 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/formas-pago/_formaPagoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("formaPagoList2"), 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() ?>

View File

@ -0,0 +1,144 @@
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/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('FormasPagoes.formaPagoList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfFormaspago" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?= lang('FormasPagoes.id') ?></th>
<th><?= lang('FormasPagoes.nombre') ?></th>
<th><?= lang('FormasPagoes.createdAt') ?></th>
<th><?= lang('FormasPagoes.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($formaPagoList as $item ) : ?>
<tr>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
<td class="align-middle text-center">
<?=$item->id ?>
</td>
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->created_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->created_at)) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->updated_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->updated_at)) ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newFormaPago'), lang('Basic.global.addNew').' '.lang('FormasPagoes.formaPago'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
theTable = $('.using-exportable-data-table').DataTable({
"responsive": true,
"paging": true,
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
"pageLength": 10,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"dom": 'lfrtipB', // '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'
}
],
"autoWidth": true,
"scrollX": true,
"stateSave": true,
"language": {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [0,lastColNr2]
}
]
});
$(document).on('click', '.btn-delete', function(e) {
e.preventDefault();
const dataHref = $(this).data('href');
Swal.fire({
title: "<?= lang('Basic.global.sweet.sureToDeleteTitle', [lang('FormasPagoes.forma pago')]) ?>",
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) => {
if (result.value) {
window.location.href = `${dataHref}`;
}
});
});
<?=$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() ?>