mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado modulo tarifas acabado
This commit is contained in:
@ -70,7 +70,7 @@ $routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], func
|
|||||||
$routes->post('add', 'Tarifaacabado::add', ['as' => 'createTarifaAcabado']);
|
$routes->post('add', 'Tarifaacabado::add', ['as' => 'createTarifaAcabado']);
|
||||||
$routes->post('create', 'Tarifaacabado::create', ['as' => 'ajaxCreateTarifaAcabado']);
|
$routes->post('create', 'Tarifaacabado::create', ['as' => 'ajaxCreateTarifaAcabado']);
|
||||||
$routes->put('(:num)/update', 'Tarifaacabado::update/$1', ['as' => 'ajaxUpdateTarifaAcabado']);
|
$routes->put('(:num)/update', 'Tarifaacabado::update/$1', ['as' => 'ajaxUpdateTarifaAcabado']);
|
||||||
$routes->post('(:num)/edit', 'Tarifaacabado::edit/$1', ['as' => 'updateTarifaAcabado']);
|
$routes->post('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'updateTarifaAcabado']);
|
||||||
$routes->post('datatable', 'Tarifaacabado::datatable', ['as' => 'dataTableOfTarifasAcabado']);
|
$routes->post('datatable', 'Tarifaacabado::datatable', ['as' => 'dataTableOfTarifasAcabado']);
|
||||||
$routes->post('allmenuitems', 'Tarifaacabado::allItemsSelect', ['as' => 'select2ItemsOfTarifasAcabado']);
|
$routes->post('allmenuitems', 'Tarifaacabado::allItemsSelect', ['as' => 'select2ItemsOfTarifasAcabado']);
|
||||||
$routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasAcabado']);
|
$routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasAcabado']);
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
|
|||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
// JJO
|
// JJO
|
||||||
if(isset($this->model->user_update_id)){
|
if(isset($this->model->user_update_id)){
|
||||||
$sanitizedData['user_update_id'] = $session->id_user;
|
$sanitizedData['user_update_id'] = $session->id_user;
|
||||||
@ -180,6 +180,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
|
|||||||
|
|
||||||
$thenRedirect = true;
|
$thenRedirect = true;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult) :
|
||||||
$id = $tarifaacabadoEntity->id ?? $id;
|
$id = $tarifaacabadoEntity->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]).'.';
|
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]).'.';
|
||||||
@ -201,7 +202,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
|
|||||||
|
|
||||||
$this->viewData['tarifaacabadoEntity'] = $tarifaacabadoEntity;
|
$this->viewData['tarifaacabadoEntity'] = $tarifaacabadoEntity;
|
||||||
|
|
||||||
$this->viewData['formAction'] = route_to('updateTarifaAcabado', $id);
|
$this->viewData['formAction'] = route_to('updateTarifaAcabado', $id);
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Tarifaacabado.moduleTitle').' '.lang('Basic.global.edit3');
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Tarifaacabado.moduleTitle').' '.lang('Basic.global.edit3');
|
||||||
|
|
||||||
|
|||||||
@ -292,6 +292,18 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
|
|||||||
Field::inst( 'deleted_at' ),
|
Field::inst( 'deleted_at' ),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
->validator( function($editor, $action, $data){
|
||||||
|
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
|
||||||
|
foreach ($data['data'] as $pkey => $values ){
|
||||||
|
$count = $this->model->select('*')
|
||||||
|
->where(array('tirada_min'=> $values['tirada_min'], 'tirada_max'=> $values['tirada_max'], 'is_deleted'=> 0))
|
||||||
|
->countAllResults();
|
||||||
|
if ($count >= 1){
|
||||||
|
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
->on( 'preCreate', function ( $editor, &$values ) {
|
->on( 'preCreate', function ( $editor, &$values ) {
|
||||||
$session = session();
|
$session = session();
|
||||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||||
@ -316,6 +328,7 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
|
|||||||
->process( $_POST )
|
->process( $_POST )
|
||||||
->data();
|
->data();
|
||||||
|
|
||||||
|
// if unique key is set in DB
|
||||||
if(isset($response['error'])){
|
if(isset($response['error'])){
|
||||||
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
if(str_contains($response['error'], "tirada_min_tirada_max") &&
|
||||||
str_contains($response['error'], "Duplicate entry ")){
|
str_contains($response['error'], "Duplicate entry ")){
|
||||||
|
|||||||
@ -135,7 +135,7 @@
|
|||||||
yeniden(json.<?= csrf_token() ?>);
|
yeniden(json.<?= csrf_token() ?>);
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.on( 'submitComplete', function ( e, json, data, action ) {
|
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
@ -180,7 +180,9 @@
|
|||||||
orderable: false,
|
orderable: false,
|
||||||
searchable: false,
|
searchable: false,
|
||||||
targets: [lastColNr]
|
targets: [lastColNr]
|
||||||
}
|
},
|
||||||
|
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||||
|
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||||
@ -201,13 +203,14 @@
|
|||||||
// Activate an inline edit on click of a table cell
|
// Activate an inline edit on click of a table cell
|
||||||
$('#tableOfTarifaacabadolineas').on( 'click', 'tbody span.edit', function (e) {
|
$('#tableOfTarifaacabadolineas').on( 'click', 'tbody span.edit', function (e) {
|
||||||
editor.inline(
|
editor.inline(
|
||||||
theTable.cells(this.parentNode, '*').nodes(),
|
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||||
{
|
{
|
||||||
cancelHtml: '<i class="ti ti-x"></i>',
|
cancelHtml: '<i class="ti ti-x"></i>',
|
||||||
cancelTrigger: 'span.cancel',
|
cancelTrigger: 'span.cancel',
|
||||||
submitHtml: '<i class="ti ti-device-floppy"></i>',
|
submitHtml: '<i class="ti ti-device-floppy"></i>',
|
||||||
submitTrigger: 'span.edit',
|
submitTrigger: 'span.edit',
|
||||||
}
|
submit: 'allIfChanged'
|
||||||
|
}
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user