diff --git a/ci4/.env b/ci4/.env index 8ff726fd..ed0e9172 100644 --- a/ci4/.env +++ b/ci4/.env @@ -146,3 +146,4 @@ themef.path = 'themes/frontend/tivo/' api.return = 'json' demo.mode = false purchase.code = '1234' + diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 4c206ee7..89d2a0be 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -44,6 +44,7 @@ $routes->post('api/user/', 'Api::user/add'); $routes->put('api/user/(:segment)', 'Api::user/edit/$1'); $routes->delete('api/user/(:segment)', 'Api::user/delete/$1'); + /* * -------------------------------------------------------------------- * Route Definitions @@ -174,12 +175,23 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio $routes->put('(:num)/update', 'Papelesimpresion::update/$1', ['as' => 'ajaxUpdatePapelImpresion']); $routes->post('edit/(:num)', 'Papelesimpresion::edit/$1', ['as' => 'updatePapelImpresion']); $routes->post('datatable', 'Papelesimpresion::datatable', ['as' => 'dataTableOfPapelesImpresion']); - $routes->post('datatablePG', 'Papelesimpresion::datatablePG', ['as' => 'dataTableOfPapelesImpresionPG']); + $routes->post('datatable_editor', 'Papelesimpresion::datatable_editor', ['as' => 'dataTableEditor']); + $routes->post('fetch_single_data', 'Papelesimpresion::fetch_single_data', ['as' => 'fetchTipologia']); $routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']); $routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']); }); $routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']); +$routes->group('papelimpresiontipologias', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('add', 'Papelimpresiontipologias::add', ['as' => 'newPapelImpresionTipologia']); + $routes->post('add', 'Papelimpresiontipologias::add', ['as' => 'createPapelImpresionTipologia']); + $routes->get('edit/(:num)', 'Papelimpresiontipologias::edit/$1', ['as' => 'editPapelImpresionTipologia']); + $routes->post('edit/(:num)', 'Papelimpresiontipologias::edit/$1', ['as' => 'updatePapelImpresionTipologia']); + $routes->get('delete/(:num)', 'Papelimpresiontipologias::delete/$1', ['as' => 'deletePapelImpresionTipologia']); +}); + + + $routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) { $routes->get('', 'Profile::index', ['as' => 'profileList']); $routes->get('index', 'Profile::index', ['as' => 'profileIndex']); diff --git a/ci4/app/Controllers/Configuracion/Papelesimpresion.php b/ci4/app/Controllers/Configuracion/Papelesimpresion.php index 02e7e920..e8bfdbea 100644 --- a/ci4/app/Controllers/Configuracion/Papelesimpresion.php +++ b/ci4/app/Controllers/Configuracion/Papelesimpresion.php @@ -5,14 +5,35 @@ namespace App\Controllers\Configuracion; use App\Controllers\GoBaseResourceController; +// DataTables PHP library + + +// Alias Editor classes so they are easy to use +use + DataTables\Editor, + DataTables\Database, + DataTables\Editor\Field, + DataTables\Editor\Format, + DataTables\Editor\Mjoin, + DataTables\Editor\Options, + DataTables\Editor\Upload, + DataTables\Editor\Validate, + DataTables\Editor\ValidateOptions; + + use App\Models\Collection; + + use App\Entities\Configuracion\PapelImpresion; use App\Models\Configuracion\PapelImpresionModel; use App\Models\Configuracion\PapelGenericoModel; +use App\Models\Configuracion\PapelImpresionTipologiaModel; + + class Papelesimpresion extends \App\Controllers\GoBaseResourceController { @@ -30,8 +51,6 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController protected $indexRoute = 'papelImpresionList'; - - public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { $this->viewData['pageTitle'] = lang('PapelImpresion.moduleTitle'); @@ -42,6 +61,8 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController // Se indica el flag para los ficheros borrados $this->delete_flag = 1; + $this->tpModel = new PapelImpresionTipologiaModel(); + parent::initController($request, $response, $logger); } @@ -230,6 +251,7 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('PapelImpresion.moduleTitle') . ' ' . lang('Basic.global.edit3'); + $this->viewData['usingServerSideDataTable'] = true; //JJO return $this->displayForm(__METHOD__, $id); } // end function edit(...) @@ -239,72 +261,118 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController public function datatable() { if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); if (!isset($reqData['draw']) || !isset($reqData['columns'])) { $errstr = 'No data available in response to this specific request.'; $response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr); return $response; } - $id_PG = $reqData['id_PG'] ?? -1; - $start = $reqData['start'] ?? 0; - $length = $reqData['length'] ?? 5; - $search = $reqData['search']['value']; - $requestedOrder = $reqData['order']['0']['column'] ?? 1; - $order = PapelImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1]; - $dir = $reqData['order']['0']['dir'] ?? 'asc'; - if($id_PG<0){ + if(isset($reqData['id_PI'])){ - $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $id_PI = $reqData['id_PI'] ?? -1; + + if($id_PI>=0){ - return $this->respond(Collection::datatable( - $resourceData, - $this->model->getResource()->countAllResults(), - $this->model->getResource($search)->countAllResults() - )); - }else{ - $resourceData = $this->model->getResource($search, $id_PG)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $data = $this->tpModel->findTipologiasForPapelImpresion($id_PI); + $resourceData = $data->get()->getResultObject(); - return $this->respond(Collection::datatable( - $resourceData, - $this->model->getResource("", $id_PG)->countAllResults(), - $this->model->getResource($search, $id_PG)->countAllResults() - )); + return $this->respond(Collection::datatable( + $resourceData, + $this->tpModel->findTipologiasForPapelImpresion($id_PI)->countAllResults(), + $this->tpModel->findTipologiasForPapelImpresion($id_PI)->countAllResults() + )); + } + } + else{ + + $id_PG = $reqData['id_PG'] ?? -1; + $start = $reqData['start'] ?? 0; + $length = $reqData['length'] ?? 5; + $search = $reqData['search']['value']; + $requestedOrder = $reqData['order']['0']['column'] ?? 1; + $order = PapelImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1]; + $dir = $reqData['order']['0']['dir'] ?? 'asc'; + + if($id_PG<0){ + + $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource()->countAllResults(), + $this->model->getResource($search)->countAllResults() + )); + }else{ + $resourceData = $this->model->getResource($search, $id_PG)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource("", $id_PG)->countAllResults(), + $this->model->getResource($search, $id_PG)->countAllResults() + )); + } } } else { return $this->failUnauthorized('Invalid request', 403); } } - public function datatablePG() - { + + public function datatable_editor(){ + /*if ($this->request->isAJAX()) { + + $reqData = $this->request->getPost(); + $rows_id = array_keys($reqData['data']); + echo '
' ; + var_dump($reqData['data'][$keys[0]]) ; + echo ''; + }*/ + if ($this->request->isAJAX()) { - $reqData = $this->request->getPost(); - if (!isset($reqData['draw']) || !isset($reqData['columns'])) { - $errstr = 'No data available in response to this specific request.'; - $response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr); - return $response; - } - $generico_id = $reqData['id'] ?? null; - $start = $reqData['start'] ?? 0; - $length = $reqData['length'] ?? 5; - $search = $reqData['search']['value']; - $requestedOrder = $reqData['order']['0']['column'] ?? 1; - $order = PapelImpresionModel::SORTABLE2[$requestedOrder >= 0 ? $requestedOrder : 1]; - $dir = $reqData['order']['0']['dir'] ?? 'asc'; - $resourceData = $this->model->getResource($search, $generico_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $sql_details = array( + "type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle" + "user" => "sk_jjo", // Database user name + "pass" => "61tv&G1Zf^XY", // Database password + "host" => "localhost", // Database host + "port" => "", // Database connection port (can be left empty for default) + "db" => "sk_jjo", // Database name + "dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL + "pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options + ); - return $this->respond(Collection::datatable( - $resourceData, - $this->model->getResource("", $generico_id)->countAllResults(), - $this->model->getResource($search, $generico_id)->countAllResults() - )); - } else { - return $this->failUnauthorized('Invalid request', 403); + $db = new Database( array( + "type" => "Mysql", + "pdo" => $sql_details + ) ); + + + // Build our Editor instance and process the data coming from _POST + Editor::inst( $db, 'lg_papel_impresion_tipologias' ) + ->fields( + Field::inst( 'tipo' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ),//->validator( Validate::values( array('negro', 'color', 'bicolor') ) ), + Field::inst( 'negro' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + Field::inst( 'cyan' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + Field::inst( 'magenta' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + Field::inst( 'amarillo' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + Field::inst( 'gota_negro' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + Field::inst( 'got_color' ), + //->validator( Validate::notEmpty( ValidateOptions::inst()) ), + ) + ->process( $_POST ) + ->json(); } } + public function allItemsSelect() { if ($this->request->isAJAX()) { @@ -355,6 +423,24 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController } } + function fetch_single_data() + { + if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); + if(isset($reqData['id'])) + { + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + + $data = [ + 'data' => $this->tpModel->getResource($reqData['id'])->get()->getResultObject()[0], + $csrfTokenName => $newTokenHash + ]; + echo json_encode($data); + } + } + } + protected function getPapelGenericoListItems($selId = null) { diff --git a/ci4/app/Controllers/Configuracion/Papelimpresiontipologias.php b/ci4/app/Controllers/Configuracion/Papelimpresiontipologias.php new file mode 100644 index 00000000..22d151d6 --- /dev/null +++ b/ci4/app/Controllers/Configuracion/Papelimpresiontipologias.php @@ -0,0 +1,326 @@ +viewData['pageTitle'] = lang('ImpresionTipologias.moduleTitle'); + $this->viewData['usingSweetAlert'] = true; + parent::initController($request, $response, $logger); + } + + + public function index() { + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('ImpresionTipologias.papelImpresionTipologia')]), + 'papelImpresionTipologia' => new PapelImpresionTipologia(), + 'usingServerSideDataTable' => true, + + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + //return view(static::$viewPath.'viewPapelImpresionTipologiaList', $viewData); + } + + + public function add() { + + + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + + $noException = true; + $successfulResult = false; // for now + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); + } catch (\Exception $e) { + + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + endif; + + $thenRedirect = false; // Change this to false if you want your user to stay on the form after submission + + if ($noException && $successfulResult) : + + $id = $this->model->db->insertID(); + + $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]).'.'; + $message .= anchor( "papelimpresiontipologias/{$id}/edit" , lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); + else: + return $this->redirect2listView('sweet-success', $message); + endif; + else: + //$this->session->setFlashData('sweet-success', $message); + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $output = array( + 'success' => 'yes', + $csrfTokenName => $newTokenHash + ); + return json_encode($output); + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['papelImpresionTipologia'] = isset($sanitizedData) ? new PapelImpresionTipologia($sanitizedData) : new PapelImpresionTipologia(); + $this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($papelImpresionTipologia->papel_impresion_id ?? null); + $this->viewData['tipoList'] = $this->getTipoOptions(); + + $this->viewData['formAction'] = route_to('createPapelImpresionTipologia'); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('ImpresionTipologias.moduleTitle').' '.lang('Basic.global.addNewSuffix'); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $output = array( + 'success' => 'no', + $csrfTokenName => $newTokenHash + ); + return json_encode($output); + //return $this->displayForm(__METHOD__); + } // end function add() + + public function edit($requestedId = null) { + + if ($requestedId == null) : + return $this->redirect2listView(); + endif; + $id = filter_var($requestedId, FILTER_SANITIZE_URL); + $papelImpresionTipologia = $this->model->find($id); + + if ($papelImpresionTipologia == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia')), $id]); + return $this->redirect2listView('sweet-error', $message); + endif; + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + + $noException = true; + $successfulResult = false; // for now + + if ($this->canValidate()) : + try { + + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $papelImpresionTipologia->fill($sanitizedData); + + $thenRedirect = false; + + if ($noException && $successfulResult) : + $id = $papelImpresionTipologia->id ?? $id; + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]).'.'; + $message .= anchor( "papelimpresiontipologias/{$id}/edit" , lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); + else: + return $this->redirect2listView('sweet-success', $message); + endif; + else: + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $output = array( + 'success' => 'yes', + $csrfTokenName => $newTokenHash + ); + + return json_encode($output); + //$this->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['papelImpresionTipologia'] = $papelImpresionTipologia; + $this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($papelImpresionTipologia->papel_impresion_id ?? null); + $this->viewData['tipoList'] = $this->getTipoOptions(); + + $this->viewData['formAction'] = route_to('updatePapelImpresionTipologia', $id); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('ImpresionTipologias.moduleTitle').' '.lang('Basic.global.edit3'); + + //return $this->displayForm(__METHOD__, $id); + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $output = array( + 'success' => 'no', + $csrfTokenName => $newTokenHash + ); + return json_encode($output); + } // end function edit(...) + + + + public function datatable() { + if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { + $errstr = 'No data available in response to this specific request.'; + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); + return $response; + } + $start = $reqData['start'] ?? 0; + $length = $reqData['length'] ?? 5; + $search = $reqData['search']['value']; + $requestedOrder = $reqData['order']['0']['column'] ?? 1; + $order = PapelImpresionTipologiaModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $dir = $reqData['order']['0']['dir'] ?? 'asc'; + + $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource()->countAllResults(), + $this->model->getResource($search)->countAllResults() + )); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + public function allItemsSelect() { + if ($this->request->isAJAX()) { + $onlyActiveOnes = true; + $reqVal = $this->request->getPost('val') ?? 'id'; + $menu = $this->model->getAllForMenu($reqVal.', papel_impresion_id', 'papel_impresion_id', $onlyActiveOnes, false); + $nonItem = new \stdClass; + $nonItem->id = ''; + $nonItem->papel_impresion_id = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + public function menuItems() { + if ($this->request->isAJAX()) { + $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; + $reqId = goSanitize($this->request->getPost('id'))[0]; + $reqText = goSanitize($this->request->getPost('text'))[0]; + $onlyActiveOnes = false; + $columns2select = [$reqId ?? 'id', $reqText ?? 'papel_impresion_id']; + $onlyActiveOnes = false; + $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); + $nonItem = new \stdClass; + $nonItem->id = ''; + $nonItem->text = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + + protected function getPapelImpresionListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('PapelImpresions.papelImpresion'))])]; + if (!empty($selId)) : + $papelImpresionModel = model('App\Models\Configuracion\PapelImpresionModel'); + + $selOption = $papelImpresionModel->where('id', $selId)->findColumn('id'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + + protected function getTipoOptions() { + $tipoOptions = [ + '' => lang('Basic.global.pleaseSelect'), + 'negro' => 'negro', + 'color' => 'color', + 'bicolor' => 'bicolor', + ]; + return $tipoOptions; + } + + +} diff --git a/ci4/app/Entities/Configuracion/PapelImpresionTipologia.php b/ci4/app/Entities/Configuracion/PapelImpresionTipologia.php new file mode 100644 index 00000000..c6f2cb16 --- /dev/null +++ b/ci4/app/Entities/Configuracion/PapelImpresionTipologia.php @@ -0,0 +1,28 @@ + null, + "papel_impresion_id" => null, + "tipo" => null, + "negro" => 0.0, + "cyan" => 0.0, + "magenta" => 0.0, + "amarillo" => 0.0, + "gota_negro" => 0.0, + "gota_color" => 0.0, + ]; + protected $casts = [ + "papel_impresion_id" => "int", + "negro" => "float", + "cyan" => "float", + "magenta" => "float", + "amarillo" => "float", + "gota_negro" => "float", + "gota_color" => "float", + ]; +} diff --git a/ci4/app/Filters/LoginAuthFilter.php b/ci4/app/Filters/LoginAuthFilter.php index 36c9b871..705ecd49 100644 --- a/ci4/app/Filters/LoginAuthFilter.php +++ b/ci4/app/Filters/LoginAuthFilter.php @@ -177,7 +177,9 @@ class LoginAuthFilter implements FilterInterface 'allItemsSelect', 'menuItems', 'datatable', - 'datatablePG', + 'datatable_editor', + 'fetch_single_data', + 'datatableTintas', 'collect', 'cast', ]; diff --git a/ci4/app/Language/en/Basic.php b/ci4/app/Language/en/Basic.php index af3e20a9..d7e6aea9 100644 --- a/ci4/app/Language/en/Basic.php +++ b/ci4/app/Language/en/Basic.php @@ -79,10 +79,10 @@ return [ 'sureToDeleteTitle' => 'Are you sure you want to delete this {0}?', 'text' => 'This action cannot be undone.', 'title' => 'Are you sure?', - + 'maxRowsReached' => 'No more lines can be added.' ], - - + 'ok' => 'Ok', + 'wait' => 'Wait', ], diff --git a/ci4/app/Language/en/ImpresionTipologias.php b/ci4/app/Language/en/ImpresionTipologias.php new file mode 100644 index 00000000..44c14d23 --- /dev/null +++ b/ci4/app/Language/en/ImpresionTipologias.php @@ -0,0 +1,63 @@ + 'Yellow', + 'bicolor' => 'Bicolor', + 'color' => 'Color', + 'cyan' => 'Cyan', + 'gotaColor' => 'Color Drop', + 'gotaNegro' => 'Black Drop', + 'magenta' => 'Magenta', + 'negro' => 'Black', + 'tipo' => 'Type', + 'errorTipo' => 'Typology type already exists', + 'validation' => [ + 'amarillo' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'cyan' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'gota_color' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'gota_negro' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'magenta' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'negro' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'tipo' => [ + 'in_list' => 'The {field} field must be one of: {param}.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/en/PapelGenerico.php b/ci4/app/Language/en/PapelGenerico.php index 1570fdba..2b3585da 100644 --- a/ci4/app/Language/en/PapelGenerico.php +++ b/ci4/app/Language/en/PapelGenerico.php @@ -18,8 +18,6 @@ return [ 'showInClient' => 'Show in Client', 'updatedAt' => 'Updated At', - 'Form_acordion_title' => 'Print papers associated', - 'validation' => [ 'code' => [ 'max_length' => 'The {field} field cannot exceed {param} characters in length.', diff --git a/ci4/app/Language/en/PapelImpresion.php b/ci4/app/Language/en/PapelImpresion.php index baf1a64f..7cfd6d48 100644 --- a/ci4/app/Language/en/PapelImpresion.php +++ b/ci4/app/Language/en/PapelImpresion.php @@ -32,6 +32,9 @@ return [ 'rotativa' => 'Rotary', 'updatedAt' => 'Updated At', 'userUpdateId' => 'User Update ID', + + 'consumo_tintas_rotativas' => 'Rotary ink consumption', + 'validation' => [ 'espesor_update' => [ 'max_length' => 'The {field} field cannot exceed {param} characters in length.', diff --git a/ci4/app/Language/es/Basic.php b/ci4/app/Language/es/Basic.php index 30bb24db..a6d6094f 100644 --- a/ci4/app/Language/es/Basic.php +++ b/ci4/app/Language/es/Basic.php @@ -79,9 +79,11 @@ return [ 'sureToDeleteTitle' => 'Está seguro de borrar {0}?', 'text' => 'Esta acción no se puede deshacer.', 'title' => 'Está seguro?', + 'maxRowsReached' => 'No se pueden añadir más líneas.' ], - + 'ok' => 'Ok', + 'wait' => 'Espere', ], diff --git a/ci4/app/Language/es/ImpresionTipologias.php b/ci4/app/Language/es/ImpresionTipologias.php new file mode 100644 index 00000000..851b4ef9 --- /dev/null +++ b/ci4/app/Language/es/ImpresionTipologias.php @@ -0,0 +1,64 @@ + 'Amarillo', + 'bicolor' => 'Bicolor', + 'color' => 'Color', + 'cyan' => 'Cyan', + 'gotaColor' => 'Gota Color', + 'gotaNegro' => 'Gota Negro', + 'magenta' => 'Magenta', + 'moduleTitle' => 'Papel Impresion Tipologias', + 'negro' => 'Negro', + 'tipo' => 'Tipo', + 'errorTipo' => 'El tipo de tipología ya existe', + 'validation' => [ + 'amarillo' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'cyan' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'gota_color' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'gota_negro' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'magenta' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'negro' => [ + 'decimal' => 'El campo {field} debe ser un número entero.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'tipo' => [ + 'in_list' => 'El campo {field} debe ser uno de: {param}.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/es/PapelGenerico.php b/ci4/app/Language/es/PapelGenerico.php index 785f5d5d..65381d56 100644 --- a/ci4/app/Language/es/PapelGenerico.php +++ b/ci4/app/Language/es/PapelGenerico.php @@ -18,8 +18,6 @@ return [ 'showInClient' => 'Mostrar en cliente', 'updatedAt' => 'Updated At', - 'Form_acordion_title' => 'Papeles impresion asociados', - 'validation' => [ 'code' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', diff --git a/ci4/app/Language/es/PapelImpresion.php b/ci4/app/Language/es/PapelImpresion.php index de4fc726..289bcff5 100644 --- a/ci4/app/Language/es/PapelImpresion.php +++ b/ci4/app/Language/es/PapelImpresion.php @@ -32,6 +32,9 @@ return [ 'rotativa' => 'Rotativa', 'updatedAt' => 'Actualizado en', 'userUpdateId' => 'ID usuario actualización', + + 'consumo_tintas_rotativas' => 'Consumo tintas rotativas', + 'validation' => [ 'espesor_update' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', diff --git a/ci4/app/Models/Configuracion/PapelImpresionTipologiaModel.php b/ci4/app/Models/Configuracion/PapelImpresionTipologiaModel.php new file mode 100644 index 00000000..857ac5a1 --- /dev/null +++ b/ci4/app/Models/Configuracion/PapelImpresionTipologiaModel.php @@ -0,0 +1,134 @@ + [ + "label" => "ImpresionTipologias.amarillo", + "rules" => "required|decimal", + ], + "cyan" => [ + "label" => "ImpresionTipologias.cyan", + "rules" => "required|decimal", + ], + "gota_color" => [ + "label" => "ImpresionTipologias.gotaColor", + "rules" => "required|decimal", + ], + "gota_negro" => [ + "label" => "ImpresionTipologias.gotaNegro", + "rules" => "required|decimal", + ], + "magenta" => [ + "label" => "ImpresionTipologias.magenta", + "rules" => "required|decimal", + ], + "negro" => [ + "label" => "ImpresionTipologias.negro", + "rules" => "required|decimal", + ], + "tipo" => [ + "label" => "ImpresionTipologias.tipo", + "rules" => "required|in_list[negro,color,bicolor]", + ], + ]; + + protected $validationMessages = [ + "amarillo" => [ + "decimal" => "ImpresionTipologias.validation.amarillo.decimal", + "required" => "ImpresionTipologias.validation.amarillo.required", + ], + "cyan" => [ + "decimal" => "ImpresionTipologias.validation.cyan.decimal", + "required" => "ImpresionTipologias.validation.cyan.required", + ], + "gota_color" => [ + "decimal" => "ImpresionTipologias.validation.gota_color.decimal", + "required" => "ImpresionTipologias.validation.gota_color.required", + ], + "gota_negro" => [ + "decimal" => "ImpresionTipologias.validation.gota_negro.decimal", + "required" => "ImpresionTipologias.validation.gota_negro.required", + ], + "magenta" => [ + "decimal" => "ImpresionTipologias.validation.magenta.decimal", + "required" => "ImpresionTipologias.validation.magenta.required", + ], + "negro" => [ + "decimal" => "ImpresionTipologias.validation.negro.decimal", + "required" => "ImpresionTipologias.validation.negro.required", + ], + "tipo" => [ + "in_list" => "ImpresionTipologias.validation.tipo.in_list", + "required" => "ImpresionTipologias.validation.tipo.required", + ], + ]; + + public function findAllWithPapelImpresion(string $selcols = "*", int $limit = null, int $offset = 0) + { + $sql = + "SELECT t1." . + $selcols . + ", t2.nombre AS papel_impresion_id FROM " . + $this->table . + " t1 LEFT JOIN lg_papel_impresion t2 ON t1.papel_impresion_id = t2.id"; + if (!is_null($limit) && intval($limit) > 0) { + $sql .= " LIMIT " . $limit; + } + + if (!is_null($offset) && intval($offset) > 0) { + $sql .= " OFFSET " . $offset; + } + + $query = $this->db->query($sql); + $result = $query->getResultObject(); + return $result; + } + + public function findTipologiasForPapelImpresion(int $papelImpresionID){ + + $builder = $this->db + ->table($this->table ) + ->select("*") + ->where("papel_impresion_id", $papelImpresionID); + + + return $builder; + + } + + public function getResource($id) + { + $builder = $this->db + ->table($this->table) + ->select("*") + ->where("id", $id); + + return $builder; + + } +} diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php index e21b318f..f76f8707 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php @@ -1,3 +1,4 @@ += $this->include('themes/_commonPartialsBs/datatables') ?> = $this->include("themes/_commonPartialsBs/select2bs5") ?> = $this->include("themes/_commonPartialsBs/sweetalert") ?> = $this->extend('themes/backend/vuexy/main/defaultlayout') ?> @@ -16,23 +17,468 @@ = view("themes/backend/vuexy/form/configuracion/papel/_papelImpresionFormItems") ?> + + + rotativa == true): ?> +
| = lang('ImpresionTipologias.tipo') ?> | += lang('ImpresionTipologias.negro') ?> | += lang('ImpresionTipologias.cyan') ?> | += lang('ImpresionTipologias.magenta') ?> | += lang('ImpresionTipologias.amarillo') ?> | += lang('ImpresionTipologias.gotaNegro') ?> | += lang('ImpresionTipologias.gotaColor') ?> | += lang('Basic.global.Action') ?> | +
|---|