Terminada exposicion de tablas ubicacion y series

This commit is contained in:
imnavajas
2024-06-13 21:00:33 +02:00
parent 02ba5d75d1
commit 405afd0cf1
6 changed files with 96 additions and 42 deletions

View File

@ -2,13 +2,13 @@
use App\Controllers\BaseResourceController;
use App\Models\Collection;
use App\Entities\Configuracion\UbicacionesEntity;
use App\Models\Configuracion\UbicacionesModel;
use App\Entities\Configuracion\SeriesFacturasEntity;
use App\Models\Configuracion\SeriesFacturasModel;
class SeriesFacturas extends BaseResourceController
{
protected $modelName = UbicacionesModel::class;
protected $modelName = SeriesFacturasModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Series Facturas';
@ -31,7 +31,7 @@ class SeriesFacturas extends BaseResourceController
// Breadcrumbs (IMN)
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_ubicaciones"), 'route' => route_to('seriesFacturasList'), 'active' => true]
['title' => lang("App.menu_series_facturas"), 'route' => route_to('seriesFacturasList'), 'active' => true]
];
parent::initController($request, $response, $logger);
@ -44,14 +44,14 @@ class SeriesFacturas extends BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('SeriesFacturas.moduleTitle')]),
'ubicacionesEntity' => new UbicacionesEntity(),
'seriesFacturasEntity' => new SeriesFacturasEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewUbicacionesList', $viewData);
return view(static::$viewPath . 'viewSeriesFacturasList', $viewData);
}
@ -101,7 +101,7 @@ class SeriesFacturas extends BaseResourceController
endif; // ($requestMethod === 'post')
$this->viewData['ubicacionesEntity'] = isset($sanitizedData) ? new UbicacionesEntity($sanitizedData) : new UbicacionesEntity();
$this->viewData['seriesFacturasEntity'] = isset($sanitizedData) ? new SeriesFacturasEntity($sanitizedData) : new SeriesFacturasEntity();
$this->viewData['formAction'] = route_to('seriesFacturasAdd');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
@ -116,9 +116,9 @@ class SeriesFacturas extends BaseResourceController
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$ubicacionesEntity = $this->model->find($id);
$seriesFacturasEntity = $this->model->find($id);
if ($ubicacionesEntity == false) :
if ($seriesFacturasEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('SeriesFacturas.moduleTitle')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
@ -148,11 +148,11 @@ class SeriesFacturas extends BaseResourceController
endif;
$ubicacionesEntity->fill($sanitizedData);
$seriesFacturasEntity->fill($sanitizedData);
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
$id = $ubicacionesEntity->id ?? $id;
$id = $seriesFacturasEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
if ($thenRedirect) :
@ -168,7 +168,7 @@ class SeriesFacturas extends BaseResourceController
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['ubicacionesEntity'] = $ubicacionesEntity;
$this->viewData['seriesFacturasEntity'] = $seriesFacturasEntity;
$this->viewData['formAction'] = route_to('seriesFacturasEdit', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.edit3');
@ -189,7 +189,7 @@ class SeriesFacturas extends BaseResourceController
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = UbicacionesModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$order = SeriesFacturasModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();

View File

@ -688,7 +688,7 @@ return [
"menu_maquina_defecto" => "Maquinas por defecto",
"menu_papelgenerico" => "Papel generico",
"menu_papelimpresion" => "Papel impresión",
"menu_series_factura" => "Series facturas",
"menu_series_facturas" => "Series facturas",
"menu_ubicaciones" => "Ubicaciones",
"menu_serviciocliente" => "Servicio cliente",
"menu_tamanioformatos" => "Tamaño formatos",

View File

@ -1,21 +1,24 @@
<?php
return [
'id' => 'ID',
'moduleTitle' => 'Series Facturas',
'nombre' => 'Nombre',
'validation' => [
'id' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'id' => 'ID',
'moduleTitle' => 'Series Facturas',
'nombre' => 'Nombre',
'tipo' => 'Tipo',
'formato' => 'Formato',
'next' => 'Próxima',
'grupo' => 'Grupo',
'validation' => [
'id' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'nombre' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'nombre' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
],
],
];

View File

@ -1,12 +1,57 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Ubicaciones.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $ubicacionesEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('SeriesFacturas.nombre') ?>*
</label>
<input type="text"
id="nombre"
name="nombre"
maxLength="255"
class="form-control"
value="<?= old('nombre', $seriesFacturasEntity->nombre) ?>"
>
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="mb-3">
<label for="tipo" class="form-label">
<?= lang('SeriesFacturas.tipo') ?>*
</label>
<select id="tipo" name="tipo" required class="form-control select2" style="width: 100%;">
<option value="facturacion" <?= "facturacion" == $seriesFacturasEntity->tipo ? ' selected' : '' ?>>
Facturación
</option>
<option value="albaranes" <?= "albaranes" == $seriesFacturasEntity->tipo ? ' selected' : '' ?>>
Albaranes
</option>
</select>
</div><!--//.mb-3 -->
</div><!-- //.row -->
<div class="mb-3">
<label for="tipo" class="form-label">
<?= lang('SeriesFacturas.formato') ?>*
</label>
<input type="text"
id="formato"
name="formato"
maxLength="255"
class="form-control"
value="<?= old('formato', $seriesFacturasEntity->formato) ?>"
>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tipo" class="form-label">
<?= lang('SeriesFacturas.next') ?>*
</label>
<input type="text"
id="next"
name="next"
class="form-control"
value="<?= old('next', $seriesFacturasEntity->next) ?>"
>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -10,18 +10,18 @@
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="ubicacionesForm" class="card-body" method="post" action="<?= $formAction ?>">
<form id="seriesFacturasForm" class="card-body" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/vuexy/form/configuracion/ubicaciones/_ubicacionesFormItems") ?>
<?= view("themes/vuexy/form/configuracion/series-facturas/_seriesFacturasFormItems") ?>
<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("ubicacionesList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
<?= anchor(route_to("seriesFacturasList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
</div><!-- /.card-footer -->
</form>

View File

@ -9,7 +9,7 @@
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('SeriesFacturas.moduleTitle') ?></h3>
<?=anchor(route_to('ubicacionesAdd'), lang('Basic.global.addNew') . ' ' .lang('SeriesFacturas.moduleTitle'), ['class'=>'btn btn-primary float-end']); ?>
<?=anchor(route_to('seriesFacturasAdd'), lang('Basic.global.addNew') . ' ' .lang('SeriesFacturas.moduleTitle'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
@ -18,7 +18,10 @@
<thead>
<tr>
<th><?= lang('SeriesFacturas.nombre') ?></th>
<th><?= lang('SeriesFacturas.nombre') ?></th>
<th><?= lang('SeriesFacturas.tipo') ?></th>
<th><?= lang('SeriesFacturas.formato') ?></th>
<th><?= lang('SeriesFacturas.next') ?></th>
<th><?= lang('SeriesFacturas.grupo') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -87,6 +90,9 @@
columns : [
{ 'data': 'nombre' },
{ 'data': 'tipo' },
{ 'data': 'formato' },
{ 'data': 'next' },
{ 'data': 'grupo' },
{ 'data': actionBtns }
]
});