mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadido CRUD para formas de pago
This commit is contained in:
@ -70,7 +70,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
|
||||
/* Series Factura */
|
||||
$routes->group('series-facturas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
|
||||
$routes->get('', 'SeriesFacturas::index', ['as' => 'seriesFacturasList']);
|
||||
$routes->match(['get', 'post'], 'add', 'SeriesFacturas::add', ['as' => 'seriesFacturasAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'SeriesFacturas::edit/$1', ['as' => 'seriesFacturasEdit']);
|
||||
@ -79,6 +78,15 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
|
||||
});
|
||||
|
||||
/* Formas de Pago */
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -395,7 +395,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected function getFormaDePagoListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])];
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPago.formaDePago'))])];
|
||||
if (!empty($selId)) :
|
||||
$formaPagoModel = model('App\Models\Configuracion\FormaPagoModel');
|
||||
|
||||
|
||||
55
ci4/app/Controllers/Configuracion/Formaspagos.php → ci4/app/Controllers/Configuracion/FormasPago.php
Executable file → Normal file
55
ci4/app/Controllers/Configuracion/Formaspagos.php → ci4/app/Controllers/Configuracion/FormasPago.php
Executable file → Normal file
@ -9,7 +9,7 @@ use App\Entities\Configuracion\FormaPagoEntity;
|
||||
|
||||
use App\Models\Configuracion\FormaPagoModel;
|
||||
|
||||
class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
class FormasPago extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = FormaPagoModel::class;
|
||||
@ -22,15 +22,22 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected static $controllerSlug = 'formas-pagos';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/formasPagoViews/';
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/formas-pago/';
|
||||
|
||||
protected $indexRoute = 'formaDePagoList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
|
||||
$this->viewData['pageTitle'] = lang('FormasPago.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_formas_pago"), 'route' => route_to('formasPagoList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
@ -40,7 +47,7 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaDePago')]),
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPago.formaDePago')]),
|
||||
'formaPagoEntity' => new FormaPagoEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
@ -55,22 +62,15 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
@ -93,7 +93,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('/configuracion/formas-pago/edit/' . $id))->with('sweet-success', $message);
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -106,11 +107,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formaPagoEntity'] = isset($sanitizedData) ? new FormaPagoEntity($sanitizedData) : new FormaPagoEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createFormaDePago');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
$this->viewData['formAction'] = route_to('formasPagoAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
@ -125,25 +123,18 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
$formaPagoEntity = $this->model->find($id);
|
||||
|
||||
if ($formaPagoEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaDePago')), $id]);
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPago.formaDePago')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
@ -152,13 +143,12 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaDePago'))]);
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPago.formaDePago'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$formaPagoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
@ -179,11 +169,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formaPagoEntity'] = $formaPagoEntity;
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateFormaDePago', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
$this->viewData['formAction'] = route_to('formasPagoEdit', $id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
@ -66,7 +66,6 @@ class SeriesFacturas extends BaseResourceController
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
@ -105,7 +104,6 @@ class SeriesFacturas extends BaseResourceController
|
||||
$this->viewData['formAction'] = route_to('seriesFacturasAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
@ -126,7 +124,6 @@ class SeriesFacturas extends BaseResourceController
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
if ($this->request->getPost('show_erp') == null) {
|
||||
$sanitizedData['show_erp'] = false;
|
||||
|
||||
@ -679,7 +679,7 @@ return [
|
||||
"menu_calendario" => "Calendar",
|
||||
"menu_paises" => "Countries",
|
||||
"menu_correo" => "Mail",
|
||||
"menu_formaspago" => "Payment methods",
|
||||
"menu_formas_pago" => "Payment methods",
|
||||
"menu_imposiciones" => "Impositions",
|
||||
"menu_maquina" => "Machines",
|
||||
"menu_papelgenerico" => "Generic paper",
|
||||
|
||||
1
ci4/app/Language/en/FormasPagoes.php → ci4/app/Language/en/FormasPago.php
Executable file → Normal file
1
ci4/app/Language/en/FormasPagoes.php → ci4/app/Language/en/FormasPago.php
Executable file → Normal file
@ -11,7 +11,6 @@ return [
|
||||
'formasDePagos' => 'Formas de Pagos',
|
||||
'formasPago' => 'Formas Pago',
|
||||
'formasPagoList' => 'Formas Pago List',
|
||||
'formasPagoes' => 'Formas Pagoes',
|
||||
'id' => 'ID',
|
||||
'moduleTitle' => 'Formas Pagoes',
|
||||
'nombre' => 'Nombre',
|
||||
@ -682,7 +682,7 @@ return [
|
||||
"menu_calendario" => "Calendario",
|
||||
"menu_paises" => "Paises",
|
||||
"menu_correo" => "Correo",
|
||||
"menu_formaspago" => "Metodos de pago",
|
||||
"menu_formas_pago" => "Formas de pago",
|
||||
"menu_imposiciones" => "Imposiciones",
|
||||
"menu_maquina" => "Maquinas",
|
||||
"menu_maquina_defecto" => "Maquinas por defecto",
|
||||
|
||||
@ -37,6 +37,7 @@ return [
|
||||
'tarifaExtraSection' => 'Tarifas extra',
|
||||
'proveedoresSection' => 'Proveedores',
|
||||
'paisesSection' => 'Países',
|
||||
'formasPagoSection' => 'Formas de Pago',
|
||||
'maquinasSection' => 'Máquinas',
|
||||
'maquinasDefectoSection' => 'Máquinas por defecto',
|
||||
'papelGenericoSection' => 'Papel genérico',
|
||||
|
||||
@ -257,7 +257,7 @@ class ClienteModel extends \App\Models\BaseModel
|
||||
LEFT JOIN lg_paises t4 ON t1.pais_id = t4.id
|
||||
LEFT JOIN users t5 ON t1.comercial_id = t5.id
|
||||
LEFT JOIN users t6 ON t1.soporte_id = t6.id
|
||||
LEFT JOIN lg_formas_pago t7 ON t1.forma_pago_id = t7.id";
|
||||
LEFT JOIN formas_pago t7 ON t1.forma_pago_id = t7.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . intval($limit);
|
||||
}
|
||||
@ -287,7 +287,7 @@ class ClienteModel extends \App\Models\BaseModel
|
||||
)
|
||||
->where("is_deleted", 0);;
|
||||
$builder->join("users t5", "t1.comercial_id = t5.id", "left");
|
||||
$builder->join("lg_formas_pago t7", "t1.forma_pago_id = t7.id", "left");
|
||||
$builder->join("formas_pago t7", "t1.forma_pago_id = t7.id", "left");
|
||||
|
||||
|
||||
return empty($search)
|
||||
|
||||
@ -15,8 +15,6 @@ class FormaPagoModel extends \App\Models\BaseModel
|
||||
const SORTABLE = [
|
||||
1 => "t1.id",
|
||||
2 => "t1.nombre",
|
||||
3 => "t1.created_at",
|
||||
4 => "t1.updated_at",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre"];
|
||||
@ -26,15 +24,15 @@ class FormaPagoModel extends \App\Models\BaseModel
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "FormasPagoes.nombre",
|
||||
"label" => "FormasPago.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "FormasPagoes.validation.nombre.max_length",
|
||||
"required" => "FormasPagoes.validation.nombre.required",
|
||||
"max_length" => "FormasPago.validation.nombre.max_length",
|
||||
"required" => "FormasPago.validation.nombre.required",
|
||||
],
|
||||
];
|
||||
|
||||
@ -61,7 +59,7 @@ class FormaPagoModel extends \App\Models\BaseModel
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t1.id AS id, t1.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at");
|
||||
->select("t1.id AS id, t1.nombre AS nombre");
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
@ -69,12 +67,6 @@ class FormaPagoModel extends \App\Models\BaseModel
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
", t2.nombre AS cliente, t3.nombre AS forma_pago, t4.nombre AS tipo_impresion, t5.nombre AS tipologia, t6.nombre AS pais, t7.estado AS estado, t8.id AS papel_formato, t9.first_name AS total_confirmado_user, t10.first_name AS aprobado_user FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN clientes
|
||||
t2 ON t1.cliente_id = t2.id LEFT JOIN lg_formas_pago
|
||||
t2 ON t1.cliente_id = t2.id LEFT JOIN formas_pago
|
||||
t3 ON t1.forma_pago_id = t3.id LEFT JOIN lg_tipos_impresion
|
||||
t4 ON t1.tipo_impresion_id = t4.id LEFT JOIN lg_tipologias_libros
|
||||
t5 ON t1.tipologia_id = t5.id LEFT JOIN lg_paises
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<th><?= lang('Clientes.cif') ?></th>
|
||||
<th><?= lang('Clientes.email') ?></th>
|
||||
<th><?= lang('Users.comercial') ?></th>
|
||||
<th><?= lang('FormasPagoes.formaDePago') ?></th>
|
||||
<th><?= lang('FormasPago.formaDePago') ?></th>
|
||||
<th><?= lang('Clientes.vencimiento') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
<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', $formaPagoEntity->nombre) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?= lang('FormasPago.nombre') ?>*
|
||||
</label>
|
||||
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
|
||||
value="<?= old('nombre', $formaPagoEntity->nombre) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div><!-- //.row -->
|
||||
@ -1,26 +1,45 @@
|
||||
<?= $this->include("themes_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/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="formaDePagoForm" method="post" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<div class="card-body">
|
||||
<?= view("themes_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?= view("themes/vuexy/form/configuracion/formasPagoViews/_formaDePagoFormItems") ?>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<?= anchor(route_to("formaDePagoList"), 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 class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<form id="formaDePagoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<div class="card-body">
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?= view("themes/vuexy/form/configuracion/formas-pago/_formaDePagoFormItems") ?>
|
||||
</div><!-- /.card-body -->
|
||||
<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("formasPagoList"),
|
||||
lang("Basic.global.Cancel"),
|
||||
["class" => "btn btn-secondary float-start",]
|
||||
) ?>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -1,25 +1,23 @@
|
||||
<?=$this->include('themes_commonPartialsBs/datatables') ?>
|
||||
<?=$this->include('themes_commonPartialsBs/sweetalert') ?>
|
||||
<?=$this->extend('themes'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/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('FormasPagoes.formaDePagoList') ?></h3>
|
||||
<h3 class="card-title"><?=lang('FormasPago.formaPagoList') ?></h3>
|
||||
<?=anchor(route_to('formasPagoAdd'), lang('Basic.global.addNew').' '.lang('FormasPago.formaPago'), ['class'=>'btn btn-primary float-end']); ?>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes_commonPartialsBs/_alertBoxes'); ?>
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableOfFormasdepagos" class="table table-striped table-hover" 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><?= lang('FormasPago.nombre') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -29,7 +27,7 @@
|
||||
</table>
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
<?=anchor(route_to('newFormaDePago'), lang('Basic.global.addNew').' '.lang('FormasPagoes.formaDePago'), ['class'=>'btn btn-primary float-end']); ?>
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
@ -40,125 +38,83 @@
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr = $('#tableOfFormasdepagos').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 = $('#tableOfFormasdepagos').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": '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'
|
||||
}
|
||||
],
|
||||
stateSave: true,
|
||||
order: [[1, 'asc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfFormasDePagos') ?>',
|
||||
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': 'created_at' },
|
||||
{ 'data': 'updated_at' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
const lastColNr = $('#tableOfFormasdepagos').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">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<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>
|
||||
</div>
|
||||
</td>`;
|
||||
};
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
|
||||
const dateCols = [3, 4];
|
||||
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;
|
||||
}
|
||||
});
|
||||
theTable = $('#tableOfFormasdepagos').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: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('formasPagoDT') ?>',
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [0,lastColNr]
|
||||
}
|
||||
],
|
||||
columns : [
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
window.location.href = `<?= route_to('formaDePagoList') ?>/${$(this).attr('data-id')}/edit`;
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
window.location.href = `/configuracion/formas-pago/edit/${$(this).attr('data-id')}`;
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('FormasPagoes.forma de 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) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: `<?= route_to('formaDePagoList') ?>/${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,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(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: `/configuracion/formas-pago/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)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,26 +6,29 @@
|
||||
<?= $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="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/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("seriesFacturasList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
|
||||
</div><!-- /.card-footer -->
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<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/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("seriesFacturasList"),
|
||||
lang("Basic.global.Cancel"),
|
||||
["class" => "btn btn-secondary float-start",]
|
||||
) ?>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!--//.row -->
|
||||
@ -33,20 +36,22 @@
|
||||
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?=$this->endSection() ?>
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet"
|
||||
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<?=$this->endSection() ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
const row = $(this).closest('tr');
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/configuracion/series-facturas//delete/${dataId}`,
|
||||
url: `/configuracion/series-facturas/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle');
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
*/
|
||||
if (
|
||||
auth()->user()->can('paises.menu') ||
|
||||
auth()->user()->can('formas-pago.menu') ||
|
||||
auth()->user()->can('papel-genericosk .menu') ||
|
||||
auth()->user()->can('papel-impresion.menu') ||
|
||||
auth()->user()->can('maquinas.menu') ||
|
||||
@ -11,7 +12,7 @@ if (
|
||||
auth()->user()->can('usuarios.menu') ||
|
||||
auth()->user()->can('roles-permisos.menu')
|
||||
) {
|
||||
?>
|
||||
?>
|
||||
<li class="menu-item">
|
||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
|
||||
@ -25,6 +26,13 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
|
||||
<?= lang("App.menu_formas_pago") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
|
||||
@ -40,32 +48,32 @@ if (
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('maquinas.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
|
||||
<?= lang("App.menu_maquina") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
|
||||
<?= lang("App.menu_maquina") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
|
||||
<?= lang("App.menu_maquina_defecto") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
|
||||
<?= lang("App.menu_maquina_defecto") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('usuarios.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
||||
<?= lang("App.menu_users") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
||||
<?= lang("App.menu_users") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
|
||||
<?= lang("App.menu_permission_group") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
|
||||
<?= lang("App.menu_permission_group") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
|
||||
Reference in New Issue
Block a user