diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index cf5efcbf..f9025a07 100644
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -224,6 +224,36 @@ $routes->group('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas']
$routes->resource('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaacabadolineas', 'except' => 'show,new,create,update']);
+$routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
+ $routes->get('', 'Maquinas::index', ['as' => 'maquinaList']);
+ $routes->get('add', 'Maquinas::add', ['as' => 'newMaquina']);
+ $routes->post('add', 'Maquinas::add', ['as' => 'createMaquina']);
+ $routes->post('create', 'Maquinas::create', ['as' => 'ajaxCreateMaquina']);
+ $routes->put('update/(:num)', 'Maquinas::update/$1', ['as' => 'ajaxUpdateMaquina']);
+ $routes->post('edit/(:num)', 'Maquinas::edit/$1', ['as' => 'updateMaquina']);
+ $routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
+ $routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
+ $routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
+});
+$routes->resource('maquinas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinas', 'except' => 'show,new,create,update']);
+
+
+$routes->group('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
+ $routes->get('', 'Maquinastarifasimpresion::index', ['as' => 'maquinasTarifaImpresionList']);
+ $routes->get('add', 'Maquinastarifasimpresion::add', ['as' => 'newMaquinasTarifaImpresion']);
+ $routes->post('add', 'Maquinastarifasimpresion::add', ['as' => 'createMaquinasTarifaImpresion']);
+ $routes->post('create', 'Maquinastarifasimpresion::create', ['as' => 'ajaxCreateMaquinasTarifaImpresion']);
+ $routes->put('(:num)/update', 'Maquinastarifasimpresion::update/$1', ['as' => 'ajaxUpdateMaquinasTarifaImpresion']);
+ $routes->post('(:num)/edit', 'Maquinastarifasimpresion::edit/$1', ['as' => 'updateMaquinasTarifaImpresion']);
+ $routes->post('datatable_editor', 'Maquinastarifasimpresion::datatable_editor', ['as' => 'editorOfMaquinasTarifaImpresion']);
+ $routes->post('datatable', 'Maquinastarifasimpresion::datatable', ['as' => 'dataTableOfMaquinasTarifasImpresion']);
+ $routes->post('allmenuitems', 'Maquinastarifasimpresion::allItemsSelect', ['as' => 'select2ItemsOfMaquinasTarifasImpresion']);
+ $routes->post('menuitems', 'Maquinastarifasimpresion::menuItems', ['as' => 'menuItemsOfMaquinasTarifasImpresion']);
+});
+$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
+
+
+
$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/Maquina.php b/ci4/app/Controllers/Configuracion/Maquina.php
deleted file mode 100644
index 2af78cb9..00000000
--- a/ci4/app/Controllers/Configuracion/Maquina.php
+++ /dev/null
@@ -1,35 +0,0 @@
-viewData['pageTitle'] = lang('Maquinas.moduleTitle');
+ $this->viewData['usingSweetAlert'] = true;
+
+ // Se indica que este controlador trabaja con soft_delete
+ $this->soft_delete = true;
+ // Se indica el flag para los ficheros borrados
+ $this->delete_flag = 1;
+
+ $this->viewData = ['usingServerSideDataTable' => true]; // JJO
+
+ parent::initController($request, $response, $logger);
+ }
+
+
+ public function index() {
+
+ $viewData = [
+ 'currentModule' => static::$controllerSlug,
+ 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Maquinas.maquina')]),
+ 'maquina' => new Maquina(),
+ 'usingServerSideDataTable' => true,
+
+ ];
+
+ $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
+
+ return view(static::$viewPath.'viewMaquinaList', $viewData);
+ }
+
+
+ public function add() {
+
+ // JJO
+ $session = session();
+
+ $requestMethod = $this->request->getMethod();
+
+ if ($requestMethod === 'post') :
+
+ $nullIfEmpty = true; // !(phpversion() >= '8.1');
+
+ $postData = $this->request->getPost();
+
+ $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
+
+ // JJO
+ $sanitizedData['user_created_id'] = $session->id_user;
+
+ $noException = true;
+ if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
+
+
+ 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('Maquinas.maquina'))]);
+ $this->session->setFlashdata('formErrors', $this->model->errors());
+ endif;
+
+ $thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
+ endif;
+ if ($noException && $successfulResult) :
+
+ $id = $this->model->db->insertID();
+
+ $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.';
+ $message .= anchor( "maquinas/{$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);
+ return redirect()->to(site_url('configuracion/maquinas/edit/'.$id))->with('sweet-success', $message);
+ else:
+ return $this->redirect2listView('sweet-success', $message);
+ endif;
+ else:
+ $this->session->setFlashData('sweet-success', $message);
+ endif;
+
+ endif; // $noException && $successfulResult
+
+ endif; // ($requestMethod === 'post')
+
+ $this->viewData['maquina'] = isset($sanitizedData) ? new Maquina($sanitizedData) : new Maquina();
+ $this->viewData['maquinaList'] = $this->getMaquinaListItems($maquina->padre_id ?? null);
+ $this->viewData['tipoList'] = $this->getTipoOptions();
+
+ $this->viewData['formAction'] = route_to('createMaquina');
+
+ $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Maquinas.moduleTitle').' '.lang('Basic.global.addNewSuffix');
+
+
+ return $this->displayForm(__METHOD__);
+ } // end function add()
+
+ public function edit($requestedId = null) {
+
+ // JJO
+ $session = session();
+
+ if ($requestedId == null) :
+ return $this->redirect2listView();
+ endif;
+ $id = filter_var($requestedId, FILTER_SANITIZE_URL);
+ $maquina = $this->model->find($id);
+
+ if ($maquina == false) :
+ $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Maquinas.maquina')), $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);
+ if ($this->request->getPost('is_padre') == null ) {
+ $sanitizedData['is_padre'] = false;
+ }
+ if ($this->request->getPost('is_rotativa') == null ) {
+ $sanitizedData['is_rotativa'] = false;
+ }
+ if ($this->request->getPost('is_tinta') == null ) {
+ $sanitizedData['is_tinta'] = false;
+ }
+
+ // JJO
+ $sanitizedData['user_updated_id'] = $session->id_user;
+ $noException = true;
+ if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
+
+ 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('Maquinas.maquina'))]);
+ $this->session->setFlashdata('formErrors', $this->model->errors());
+
+ endif;
+
+ $maquina->fill($sanitizedData);
+
+ $thenRedirect = true;
+ endif;
+ if ($noException && $successfulResult) :
+ $id = $maquina->id ?? $id;
+ $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.';
+ $message .= anchor( "maquinas/{$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);
+ endif;
+
+ endif; // $noException && $successfulResult
+ endif; // ($requestMethod === 'post')
+
+ $this->viewData['maquina'] = $maquina;
+ $this->viewData['maquinaList'] = $this->getMaquinaListItems($maquina->padre_id ?? null);
+ $this->viewData['tipoList'] = $this->getTipoOptions();
+
+ $this->viewData['formAction'] = route_to('updateMaquina', $id);
+
+ $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Maquinas.moduleTitle').' '.lang('Basic.global.edit3');
+
+
+ return $this->displayForm(__METHOD__, $id);
+ } // 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 = MaquinaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
+ $dir = $reqData['order']['0']['dir'] ?? 'asc';
+
+ $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
+ foreach ($resourceData as $item) :
+ if (isset($item->observaciones) && strlen($item->observaciones) > 100) :
+ $item->observaciones = character_limiter($item->observaciones, 100);
+ endif;
+ endforeach;
+
+ 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.', nombre', 'nombre', $onlyActiveOnes, false);
+ $nonItem = new \stdClass;
+ $nonItem->id = '';
+ $nonItem->nombre = '- '.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 ?? 'nombre'];
+ $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 getMaquinaListItems($selId = null) {
+ $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
+ if (!empty($selId)) :
+ $maquinaModel = model('App\Models\Configuracion\MaquinaModel');
+
+ $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
+ if (!empty($selOption)) :
+ $data[$selId] = $selOption[0];
+ endif;
+ endif;
+ return $data;
+ }
+
+
+ protected function getTipoOptions() {
+ $tipoOptions = [
+ '' => lang('Basic.global.pleaseSelect'),
+ 'impresion' => 'impresion',
+ 'manipulado' => 'manipulado',
+ 'acabado' => 'acabado',
+ ];
+ return $tipoOptions;
+ }
+
+
+}
diff --git a/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php b/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php
new file mode 100644
index 00000000..bee06924
--- /dev/null
+++ b/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php
@@ -0,0 +1,59 @@
+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 = MaquinasTarifasImpresionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
+ $dir = $reqData['order']['0']['dir'] ?? 'asc';
+
+ // el primer dato representa el uso y el segundo el tipo
+ $tarifas = $reqData['tarifas'] ?? null;
+ // Para saber si el papel que se tiene que mostrar es para rotativa
+ $isRotativa= $reqData['isRotativa'] ?? false;
+
+ $resourceData = $this->model->getResource("", $tarifas, $isRotativa)->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);
+ }
+ }
+
+ }
\ No newline at end of file
diff --git a/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php b/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
new file mode 100644
index 00000000..1d8a4b33
--- /dev/null
+++ b/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
@@ -0,0 +1,423 @@
+viewData['pageTitle'] = lang('MaquinasTarifasImpresions.moduleTitle');
+ $this->viewData['usingSweetAlert'] = true;
+ parent::initController($request, $response, $logger);
+ }
+
+
+ public function index() {
+
+ $viewData = [
+ 'currentModule' => static::$controllerSlug,
+ 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')]),
+ 'maquinasTarifasImpresion' => new MaquinasTarifasImpresion(),
+ 'usingServerSideDataTable' => true,
+
+ ];
+
+ $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
+
+ return view(static::$viewPath.'viewMaquinasTarifaImpresionList', $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;
+ if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
+
+
+ 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('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]);
+ $this->session->setFlashdata('formErrors', $this->model->errors());
+ endif;
+
+ $thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
+ endif;
+ if ($noException && $successfulResult) :
+
+ $id = $this->model->db->insertID();
+
+ $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.';
+ $message .= anchor( "maquinastarifasimpresion/{$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);
+ endif;
+
+ endif; // $noException && $successfulResult
+
+ endif; // ($requestMethod === 'post')
+
+ $this->viewData['maquinasTarifasImpresion'] = isset($sanitizedData) ? new MaquinasTarifasImpresion($sanitizedData) : new MaquinasTarifasImpresion();
+ $this->viewData['maquinaList'] = $this->getMaquinaListItems($maquinasTarifasImpresion->maquina_id ?? null);
+ $this->viewData['tipoList'] = $this->getTipoOptions();
+
+ $this->viewData['formAction'] = route_to('createMaquinasTarifaImpresion');
+
+ $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('MaquinasTarifasImpresions.moduleTitle').' '.lang('Basic.global.addNewSuffix');
+
+
+ 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);
+ $maquinasTarifasImpresion = $this->model->find($id);
+
+ if ($maquinasTarifasImpresion == false) :
+ $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')), $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);
+if ($this->request->getPost('predeterminado') == null ) {
+ $sanitizedData['predeterminado'] = false;
+ }
+
+
+
+ $noException = true;
+ if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
+
+
+
+ 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('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]);
+ $this->session->setFlashdata('formErrors', $this->model->errors());
+
+ endif;
+
+ $maquinasTarifasImpresion->fill($sanitizedData);
+
+ $thenRedirect = true;
+ endif;
+ if ($noException && $successfulResult) :
+ $id = $maquinasTarifasImpresion->id ?? $id;
+ $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.';
+ $message .= anchor( "maquinastarifasimpresion/{$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);
+ endif;
+
+ endif; // $noException && $successfulResult
+ endif; // ($requestMethod === 'post')
+
+ $this->viewData['maquinasTarifasImpresion'] = $maquinasTarifasImpresion;
+ $this->viewData['maquinaList'] = $this->getMaquinaListItems($maquinasTarifasImpresion->maquina_id ?? null);
+ $this->viewData['tipoList'] = $this->getTipoOptions();
+
+ $this->viewData['formAction'] = route_to('updateMaquinasTarifaImpresion', $id);
+
+ $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('MaquinasTarifasImpresions.moduleTitle').' '.lang('Basic.global.edit3');
+
+
+ return $this->displayForm(__METHOD__, $id);
+ } // end function edit(...)
+
+
+ public function datatable_editor() {
+ if ($this->request->isAJAX()) {
+
+ include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
+
+ // Build our Editor instance and process the data coming from _POST
+ $response = Editor::inst( $db, 'lg_maquinas_tarifas_impresion' )
+ ->fields(
+ Field::inst( 'uso' )
+ ->validator( 'Validate::notEmpty',array(
+ 'message' => lang('MaquinasTarifasImpresions.validation.uso.required') )
+ ),
+ Field::inst( 'tipo' )
+ ->validator( 'Validate::notEmpty',array(
+ 'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
+ ),
+ Field::inst( 'precio' )
+ ->validator( 'Validate::numeric', array(
+ 'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal') )
+ )
+ ->validator( 'Validate::notEmpty',array(
+ 'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
+ ),
+ Field::inst( 'predeterminado' )
+ ->validator( 'Validate::notEmpty',array(
+ 'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
+ ),
+ Field::inst( 'maquina_id' ),
+ Field::inst( 'user_created_id' ),
+ Field::inst( 'created_at' ),
+ Field::inst( 'user_updated_id' ),
+ Field::inst( 'updated_at' ),
+ Field::inst( 'is_deleted' ),
+ Field::inst( 'deleted_at' ),
+
+ )
+ ->validator( function($editor, $action, $data){
+ if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
+ foreach ($data['data'] as $pkey => $values ){
+ // Si no se quiere borrar...
+ if($data['data'][$pkey]['is_deleted'] != 1)
+ {
+
+ $builder = $this->model->select('*')
+ ->where(array(
+ 'maquina_id'=> $values['maquina_id'],
+ 'tipo'=> $values['tipo'],
+ 'uso'=> $values['uso'],
+ 'is_deleted'=> 0));
+
+ if ($builder->countAllResults() >= 1){
+ if(($action === Editor::ACTION_EDIT && $builder->get()->getFirstRow()->id != $pkey)
+ || $action === Editor::ACTION_CREATE)
+ return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
+
+ }
+ }
+ }
+ }
+ })
+ ->on( 'preCreate', function ( $editor, &$values ) {
+ $session = session();
+ $datetime = (new \CodeIgniter\I18n\Time("now"));
+ $editor
+ ->field( 'user_created_id' )
+ ->setValue( $session->id_user );
+ $editor
+ ->field( 'created_at' )
+ ->setValue( $datetime->format('Y-m-d H:i:s') );
+ } )
+ ->on( 'preEdit', function ( $editor, &$values ) {
+ $session = session();
+ $datetime = (new \CodeIgniter\I18n\Time("now"));
+ $editor
+ ->field( 'user_updated_id' )
+ ->setValue( $session->id_user );
+ $editor
+ ->field( 'updated_at' )
+ ->setValue( $datetime->format('Y-m-d H:i:s') );
+ } )
+ ->debug(true)
+ ->process( $_POST )
+ ->data();
+
+
+ /*// if unique key is set in DB
+ if(isset($response['error'])){
+ if(str_contains($response['error'], "tirada_min_tirada_max") &&
+ str_contains($response['error'], "Duplicate entry ")){
+ $response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
+ }
+ }*/
+ $newTokenHash = csrf_hash();
+ $csrfTokenName = csrf_token();
+
+ $response[$csrfTokenName] = $newTokenHash;
+
+ echo json_encode($response);
+
+ } else {
+ return $this->failUnauthorized('Invalid request', 403);
+ }
+ }
+
+ 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 = MaquinasTarifasImpresionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
+ $dir = $reqData['order']['0']['dir'] ?? 'asc';
+
+ $id_M = $reqData['id_maquina'] ?? -1;
+
+ $resourceData = $this->model->getResource("", $id_M)->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.', maquina_id', 'maquina_id', $onlyActiveOnes, false);
+ $nonItem = new \stdClass;
+ $nonItem->id = '';
+ $nonItem->maquina_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 ?? 'maquina_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 getMaquinaListItems($selId = null) {
+ $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
+ if (!empty($selId)) :
+ $maquinaModel = model('App\Models\Configuracion\MaquinaModel');
+
+ $selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
+ if (!empty($selOption)) :
+ $data[$selId] = $selOption[0];
+ endif;
+ endif;
+ return $data;
+ }
+
+
+ protected function getTipoOptions() {
+ $tipoOptions = [
+ '' => lang('Basic.global.pleaseSelect'),
+ 'negro' => 'negro',
+ 'color' => 'color',
+ 'negrohq' => 'negrohq',
+ 'bicolor' => 'bicolor',
+ ];
+ return $tipoOptions;
+ }
+
+
+}
diff --git a/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php b/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php
index 560173de..fdc45421 100644
--- a/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php
+++ b/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php
@@ -120,7 +120,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
$this->viewData['tarifaManipuladoEntity'] = isset($sanitizedData) ? new TarifaManipuladoEntity($sanitizedData) : new TarifaManipuladoEntity();
- $this->viewData['formAction'] = route_to('createTarifaManipulado');
+ $this->viewData['formAction'] = site_url('configuracion/maquinas/add');//route_to('createTarifaManipulado');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Tarifamanipulado.moduleTitle').' '.lang('Basic.global.addNewSuffix');
@@ -156,7 +156,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
// JJO
if(isset($this->model->user_update_id)){
- $sanitizedData['user_update_id'] = $session->id_user;
+ $sanitizedData['user_updated_id'] = $session->id_user;
}
$noException = true;
diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php
index 551026ca..3154cfeb 100644
--- a/ci4/app/Controllers/Test.php
+++ b/ci4/app/Controllers/Test.php
@@ -18,8 +18,8 @@ class Test extends BaseController
/*
$papel = new Papelesimpresion();
var_dump($papel->datatablePG());*/
- return redirect()->to(site_url('tarifas/tarifaacabado/edit/'. 30))->with('sweet-success', 'OK');
- //return redirect()->to('https://sk-jjo.imnavajas.es/tarifas/tarifaacabado/edit/30');
+ $session = session();
+ var_dump($session->id_user);
}
}
\ No newline at end of file
diff --git a/ci4/app/Entities/Configuracion/Maquina.php b/ci4/app/Entities/Configuracion/Maquina.php
new file mode 100644
index 00000000..2a4953dc
--- /dev/null
+++ b/ci4/app/Entities/Configuracion/Maquina.php
@@ -0,0 +1,65 @@
+ null,
+ "nombre" => null,
+ "is_padre" => false,
+ "tipo" => null,
+ "velocidad" => 0.0,
+ "ancho" => null,
+ "alto" => null,
+ "ancho_impresion" => 0.0,
+ "alto_impresion" => 0.0,
+ "alto_click" => 0.0,
+ "padre_id" => null,
+ "min" => 1,
+ "max" => 1000000,
+ "duracion_jornada" => 8,
+ "orden_planning" => 1,
+ "is_rotativa" => false,
+ "precio_tinta_negro" => 0.0,
+ "is_tinta" => false,
+ "precio_tinta_color" => 0.0,
+ "velocidad_corte" => 0.0,
+ "precio_hora_corte" => 0.0,
+ "metrosxminuto" => null,
+ "forzar_num_formas_horizontales_portada" => null,
+ "forzar_num_formas_verticales_portada" => null,
+ "observaciones" => null,
+ "is_deleted" => 0,
+ "created_at" => null,
+ "updated_at" => null,
+ "user_created_id" => 0,
+ "user_updated_id" => 0,
+ ];
+ protected $casts = [
+ "is_padre" => "boolean",
+ "velocidad" => "float",
+ "ancho" => "?float",
+ "alto" => "?float",
+ "ancho_impresion" => "float",
+ "alto_impresion" => "float",
+ "alto_click" => "float",
+ "padre_id" => "?int",
+ "min" => "int",
+ "max" => "int",
+ "duracion_jornada" => "int",
+ "orden_planning" => "int",
+ "is_rotativa" => "boolean",
+ "precio_tinta_negro" => "float",
+ "is_tinta" => "boolean",
+ "precio_tinta_color" => "float",
+ "velocidad_corte" => "float",
+ "precio_hora_corte" => "float",
+ "forzar_num_formas_horizontales_portada" => "?int",
+ "forzar_num_formas_verticales_portada" => "?int",
+ "is_deleted" => "int",
+ "user_created_id" => "int",
+ "user_updated_id" => "int",
+ ];
+}
diff --git a/ci4/app/Entities/Configuracion/MaquinasPapelesImpresionEntity.php b/ci4/app/Entities/Configuracion/MaquinasPapelesImpresionEntity.php
new file mode 100644
index 00000000..7c659702
--- /dev/null
+++ b/ci4/app/Entities/Configuracion/MaquinasPapelesImpresionEntity.php
@@ -0,0 +1,18 @@
+ null,
+ "papel_impresion_id" => null,
+ "active" => null,
+ ];
+ protected $casts = [
+ "maquina_id" => "int",
+ "papel_impresion_id" => "int",
+ "active" => "int",
+ ];
+}
\ No newline at end of file
diff --git a/ci4/app/Entities/Configuracion/MaquinasTarifasImpresionEntity.php b/ci4/app/Entities/Configuracion/MaquinasTarifasImpresionEntity.php
new file mode 100644
index 00000000..1425ccc2
--- /dev/null
+++ b/ci4/app/Entities/Configuracion/MaquinasTarifasImpresionEntity.php
@@ -0,0 +1,29 @@
+ null,
+ "maquina_id" => null,
+ "tipo" => null,
+ "precio" => null,
+ "uso" => null,
+ "predeterminado" => false,
+ "user_created_id" => 0,
+ "user_updated_id" => 0,
+ "is_deleted" => 0,
+ "created_at" => null,
+ "updated_at" => null,
+ ];
+ protected $casts = [
+ "maquina_id" => "int",
+ "precio" => "float",
+ "predeterminado" => "boolean",
+ "user_created_id" => "int",
+ "user_updated_id" => "int",
+ "is_deleted" => "int",
+ ];
+}
diff --git a/ci4/app/Language/en/Maquinas.php b/ci4/app/Language/en/Maquinas.php
new file mode 100644
index 00000000..ca28974c
--- /dev/null
+++ b/ci4/app/Language/en/Maquinas.php
@@ -0,0 +1,165 @@
+ 'finish',
+ 'alto' => 'Height',
+ 'altoClick' => 'Height Click',
+ 'altoImpresion' => 'Height Printing',
+ 'ancho' => 'Width',
+ 'anchoImpresion' => 'Width Printing',
+ 'createdAt' => 'Created At',
+ 'deletedAt' => 'Deleted At',
+ 'duracionJornada' => 'Working day duration',
+ 'forzarNumFormasHorizontalesPortada' => 'Force Number of Shapes Horizontal Cover',
+ 'forzarNumFormasVerticalesPortada' => 'Force Number of Shapes Vertical Cover',
+ 'id' => 'ID',
+ 'impresion' => 'Printing',
+ 'isDeleted' => 'Is Deleted',
+ 'isPadre' => 'Use for variant',
+ 'isRotativa' => 'Is Rotary?',
+ 'isTinta' => 'Is Ink',
+ 'manipulado' => 'handling',
+ 'maquina' => 'Machine',
+ 'maquinaList' => 'Maniches List',
+ 'maquinas' => 'Machines',
+ 'max' => 'Max POD',
+ 'metrosxminuto' => 'Meters x minute',
+ 'min' => 'Min POD',
+ 'moduleTitle' => 'Machines',
+ 'nombre' => 'Name',
+ 'observaciones' => 'Remarks',
+ 'ordenPlanning' => 'Planning order',
+ 'padreId' => 'Variante',
+ 'precioHoraCorte' => 'Price Hour cut',
+ 'precioTintaColor' => 'Price Ink Colour',
+ 'precioTintaNegro' => 'Price Ink black',
+ 'tipo' => 'Type',
+ 'updatedAt' => 'Updated At',
+ 'userCreatedId' => 'User Created ID',
+ 'userUpdatedId' => 'User Updated ID',
+ 'velocidad' => 'Speed',
+ 'velocidadCorte' => 'Cut speed',
+ 'validation' => [
+ 'alto' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+
+ ],
+
+ 'ancho' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+
+ ],
+
+ 'forzar_num_formas_horizontales_portada' => [
+ 'integer' => 'The {field} field must contain an integer.',
+
+ ],
+
+ 'forzar_num_formas_verticales_portada' => [
+ 'integer' => 'The {field} field must contain an integer.',
+
+ ],
+
+ 'alto_click' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'alto_impresion' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'ancho_impresion' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'duracion_jornada' => [
+ 'integer' => 'The {field} field must contain an integer.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'max' => [
+ 'integer' => 'The {field} field must contain an integer.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'metrosxminuto' => [
+ 'max_length' => 'The {field} field cannot exceed {param} characters in length.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'min' => [
+ 'integer' => 'The {field} field must contain an integer.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'nombre' => [
+ 'max_length' => 'The {field} field cannot exceed {param} characters in length.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'observaciones' => [
+ 'max_length' => 'The {field} field cannot exceed {param} characters in length.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'orden_planning' => [
+ 'integer' => 'The {field} field must contain an integer.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'precio_hora_corte' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'precio_tinta_color' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'precio_tinta_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.',
+
+ ],
+
+ 'velocidad' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+ 'velocidad_corte' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'The {field} field is required.',
+
+ ],
+
+
+ ],
+
+
+];
\ No newline at end of file
diff --git a/ci4/app/Language/en/MaquinasTarifasImpresions.php b/ci4/app/Language/en/MaquinasTarifasImpresions.php
new file mode 100644
index 00000000..a16e9586
--- /dev/null
+++ b/ci4/app/Language/en/MaquinasTarifasImpresions.php
@@ -0,0 +1,52 @@
+ 'Created At',
+ 'deletedAt' => 'Deleted At',
+ 'id' => 'ID',
+ 'isDeleted' => 'Is Deleted',
+ 'maquinaId' => 'Machine',
+ 'maquinasTarifaImpresion' => 'Printing rate',
+ 'maquinasTarifaImpresionList' => 'Printing rate List',
+ 'maquinasTarifasImpresion' => 'Printing rates',
+ 'maquinastarifasimpresion' => 'Printing rates',
+ 'moduleTitle' => 'Machine printing rates',
+ 'precio' => 'Price',
+ 'predeterminado' => 'Default',
+ 'tipo' => 'Type',
+ 'updatedAt' => 'Updated At',
+ 'userCreatedId' => 'User Created ID',
+ 'userUpdatedId' => 'User Updated ID',
+ 'uso' => 'Use',
+ 'interior' => 'inside',
+ 'portada' => 'cover',
+ 'negro' => 'black',
+ 'color' => 'color',
+ 'negrohq' => 'blackhq',
+ 'bicolor' => 'bicolor',
+ 'validation' => [
+ 'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",
+ 'tipo' => [
+ 'in_list' => 'The {field} field must be one of: {param}.',
+ 'required' => 'Required field.',
+ ],
+
+ 'precio' => [
+ 'decimal' => 'The {field} field must contain a decimal number.',
+ 'required' => 'Required field.',
+
+ ],
+
+ 'uso' => [
+ 'in_list' => 'The {field} field must be one of: {param}.',
+ 'required' => 'Required field.',
+
+ ],
+
+
+ ],
+
+
+];
\ No newline at end of file
diff --git a/ci4/app/Language/en/PapelImpresion.php b/ci4/app/Language/en/PapelImpresion.php
index 7cfd6d48..6fd0222e 100644
--- a/ci4/app/Language/en/PapelImpresion.php
+++ b/ci4/app/Language/en/PapelImpresion.php
@@ -31,6 +31,7 @@ return [
'referencia' => 'Reference',
'rotativa' => 'Rotary',
'updatedAt' => 'Updated At',
+ 'activo' => 'Active?',
'userUpdateId' => 'User Update ID',
'consumo_tintas_rotativas' => 'Rotary ink consumption',
diff --git a/ci4/app/Language/es/Maquinas.php b/ci4/app/Language/es/Maquinas.php
new file mode 100644
index 00000000..733d17d3
--- /dev/null
+++ b/ci4/app/Language/es/Maquinas.php
@@ -0,0 +1,165 @@
+ 'acabado',
+ 'alto' => 'Alto',
+ 'altoClick' => 'Alto Click',
+ 'altoImpresion' => 'Alto Impresion',
+ 'ancho' => 'Ancho',
+ 'anchoImpresion' => 'Ancho Impresion',
+ 'createdAt' => 'Created At',
+ 'deletedAt' => 'Deleted At',
+ 'duracionJornada' => 'Duracion Jornada',
+ 'forzarNumFormasHorizontalesPortada' => 'Forzar Num Formas Horizontales Portada',
+ 'forzarNumFormasVerticalesPortada' => 'Forzar Num Formas Verticales Portada',
+ 'id' => 'ID',
+ 'impresion' => 'impresion',
+ 'isDeleted' => 'Is Deleted',
+ 'isPadre' => 'Usar para variante?',
+ 'isRotativa' => 'Es Rotativa?',
+ 'isTinta' => 'Es Tinta?',
+ 'manipulado' => 'manipulado',
+ 'maquina' => 'Maquina',
+ 'maquinaList' => 'Lista Máquinas',
+ 'maquinas' => 'Máquinas',
+ 'max' => 'POD Max',
+ 'metrosxminuto' => 'Metros x minuto',
+ 'min' => 'POD Min',
+ 'moduleTitle' => 'Máquinas',
+ 'nombre' => 'Nombre',
+ 'observaciones' => 'Observaciones',
+ 'ordenPlanning' => 'Orden Planning',
+ 'padreId' => 'Variante',
+ 'precioHoraCorte' => 'Precio Hora Corte',
+ 'precioTintaColor' => 'Precio Tinta Color',
+ 'precioTintaNegro' => 'Precio Tinta Negro',
+ 'tipo' => 'Tipo',
+ 'updatedAt' => 'Updated At',
+ 'userCreatedId' => 'User Created ID',
+ 'userUpdatedId' => 'User Updated ID',
+ 'velocidad' => 'Velocidad',
+ 'velocidadCorte' => 'Velocidad Corte',
+ 'validation' => [
+ 'alto' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+
+ ],
+
+ 'ancho' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+
+ ],
+
+ 'forzar_num_formas_horizontales_portada' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+
+ ],
+
+ 'forzar_num_formas_verticales_portada' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+
+ ],
+
+ 'alto_click' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'alto_impresion' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'ancho_impresion' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'duracion_jornada' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'max' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'metrosxminuto' => [
+ 'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'min' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'nombre' => [
+ 'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'observaciones' => [
+ 'max_length' => 'El campo {field} no puede exeder de {param} caracteres de longitud.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'orden_planning' => [
+ 'integer' => 'El campo {field} debe contener un número entero.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'precio_hora_corte' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'precio_tinta_color' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'precio_tinta_negro' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'tipo' => [
+ 'in_list' => 'El campo {field} debe ser uno uno de: {param}.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'velocidad' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+ 'velocidad_corte' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'El campo {field} es obligatorio.',
+
+ ],
+
+
+ ],
+
+
+];
\ No newline at end of file
diff --git a/ci4/app/Language/es/MaquinasTarifasImpresions.php b/ci4/app/Language/es/MaquinasTarifasImpresions.php
new file mode 100644
index 00000000..0529bb09
--- /dev/null
+++ b/ci4/app/Language/es/MaquinasTarifasImpresions.php
@@ -0,0 +1,53 @@
+ 'Created At',
+ 'deletedAt' => 'Deleted At',
+ 'id' => 'ID',
+ 'isDeleted' => 'Is Deleted',
+ 'maquinaId' => 'Maquina',
+ 'maquinasTarifaImpresion' => 'Tarifa Impresion Máquinas ',
+ 'maquinasTarifaImpresionList' => 'Lista Tarifas Impresion Máquinas',
+ 'maquinasTarifasImpresion' => 'Tarifas Impresion Máquinas',
+ 'maquinastarifasimpresion' => 'Tarifas Impresion Máquinas',
+ 'moduleTitle' => 'Tarifas Impresion máquina',
+ 'precio' => 'Precio',
+ 'predeterminado' => 'Predeterminado',
+ 'tipo' => 'Tipo',
+ 'updatedAt' => 'Updated At',
+ 'userCreatedId' => 'User Created ID',
+ 'userUpdatedId' => 'User Updated ID',
+ 'uso' => 'Uso',
+ 'interior' => 'interior',
+ 'portada' => 'portada',
+ 'negro' => 'negro',
+ 'color' => 'color',
+ 'negrohq' => 'negrohq',
+ 'bicolor' => 'bicolor',
+ 'validation' => [
+ 'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",
+ 'tipo' => [
+ 'in_list' => 'El campo {field} debe contener uno de: {param}.',
+ 'required' => 'Campo obligatorio.',
+
+ ],
+
+ 'precio' => [
+ 'decimal' => 'El campo {field} debe contener un número decimal.',
+ 'required' => 'Campo obligatorio.',
+
+ ],
+
+ 'uso' => [
+ 'max_length' => 'El campo {field} no puede exceder de {param} caracteres de longitud.',
+ 'required' => 'Campo obligatorio.',
+
+ ],
+
+
+ ],
+
+
+];
\ No newline at end of file
diff --git a/ci4/app/Language/es/PapelImpresion.php b/ci4/app/Language/es/PapelImpresion.php
index 289bcff5..3524238e 100644
--- a/ci4/app/Language/es/PapelImpresion.php
+++ b/ci4/app/Language/es/PapelImpresion.php
@@ -31,6 +31,7 @@ return [
'referencia' => 'Referencia',
'rotativa' => 'Rotativa',
'updatedAt' => 'Actualizado en',
+ 'activo' => 'Activo?',
'userUpdateId' => 'ID usuario actualización',
'consumo_tintas_rotativas' => 'Consumo tintas rotativas',
diff --git a/ci4/app/Models/Configuracion/MaquinaModel.php b/ci4/app/Models/Configuracion/MaquinaModel.php
new file mode 100644
index 00000000..78540f6e
--- /dev/null
+++ b/ci4/app/Models/Configuracion/MaquinaModel.php
@@ -0,0 +1,325 @@
+ "t1.id",
+ 0 => "t1.nombre",
+ 1 => "t2.nombre",
+ 2 => "t1.tipo",
+ 3 => "t1.velocidad",
+ 4 => "t1.duracion_jornada",
+ 5 => "t1.ancho",
+ 6 => "t1.alto",
+ 7 => "t1.ancho_impresion",
+ 8 => "t1.alto_impresion",
+ 9 => "t1.orden_planning",
+ 10 => "t1.min",
+ 11 => "t1.max",
+
+
+ ];
+
+ protected $allowedFields = [
+ "nombre",
+ "is_padre",
+ "tipo",
+ "velocidad",
+ "ancho",
+ "alto",
+ "ancho_impresion",
+ "alto_impresion",
+ "alto_click",
+ "padre_id",
+ "min",
+ "max",
+ "duracion_jornada",
+ "orden_planning",
+ "is_rotativa",
+ "precio_tinta_negro",
+ "is_tinta",
+ "precio_tinta_color",
+ "velocidad_corte",
+ "precio_hora_corte",
+ "metrosxminuto",
+ "forzar_num_formas_horizontales_portada",
+ "forzar_num_formas_verticales_portada",
+ "observaciones",
+ "deleted_at",
+ "is_deleted",
+ "user_created_id",
+ "user_updated_id"
+ ];
+ protected $returnType = "App\Entities\Configuracion\Maquina";
+
+ protected $useTimestamps = true;
+ protected $useSoftDeletes = false;
+
+ protected $createdField = "created_at";
+
+ public static $labelField = "nombre";
+
+ protected $validationRules = [
+ "alto" => [
+ "label" => "Maquinas.alto",
+ "rules" => "required|decimal",
+ ],
+ "alto_click" => [
+ "label" => "Maquinas.altoClick",
+ "rules" => "required|decimal",
+ ],
+ "alto_impresion" => [
+ "label" => "Maquinas.altoImpresion",
+ "rules" => "required|decimal",
+ ],
+ "ancho" => [
+ "label" => "Maquinas.ancho",
+ "rules" => "required|decimal",
+ ],
+ "ancho_impresion" => [
+ "label" => "Maquinas.anchoImpresion",
+ "rules" => "required|decimal",
+ ],
+ "duracion_jornada" => [
+ "label" => "Maquinas.duracionJornada",
+ "rules" => "required|integer",
+ ],
+ "forzar_num_formas_horizontales_portada" => [
+ "label" => "Maquinas.forzarNumFormasHorizontalesPortada",
+ "rules" => "integer|permit_empty",
+ ],
+ "forzar_num_formas_verticales_portada" => [
+ "label" => "Maquinas.forzarNumFormasVerticalesPortada",
+ "rules" => "integer|permit_empty",
+ ],
+ "max" => [
+ "label" => "Maquinas.max",
+ "rules" => "required|integer",
+ ],
+ "metrosxminuto" => [
+ "label" => "Maquinas.metrosxminuto",
+ "rules" => "max_length[31]",
+ ],
+ "min" => [
+ "label" => "Maquinas.min",
+ "rules" => "required|integer",
+ ],
+ "nombre" => [
+ "label" => "Maquinas.nombre",
+ "rules" => "trim|required|max_length[255]",
+ ],
+ "observaciones" => [
+ "label" => "Maquinas.observaciones",
+ "rules" => "trim|max_length[16313]",
+ ],
+ "orden_planning" => [
+ "label" => "Maquinas.ordenPlanning",
+ "rules" => "required|integer",
+ ],
+ "precio_hora_corte" => [
+ "label" => "Maquinas.precioHoraCorte",
+ "rules" => "decimal",
+ ],
+ "precio_tinta_color" => [
+ "label" => "Maquinas.precioTintaColor",
+ "rules" => "decimal",
+ ],
+ "precio_tinta_negro" => [
+ "label" => "Maquinas.precioTintaNegro",
+ "rules" => "decimal",
+ ],
+ "tipo" => [
+ "label" => "Maquinas.tipo",
+ "rules" => "required|in_list[impresion,manipulado,acabado]",
+ ],
+ "velocidad" => [
+ "label" => "Maquinas.velocidad",
+ "rules" => "required|decimal",
+ ],
+ "velocidad_corte" => [
+ "label" => "Maquinas.velocidadCorte",
+ "rules" => "decimal",
+ ],
+ ];
+
+ protected $validationMessages = [
+ "alto" => [
+ "decimal" => "Maquinas.validation.alto.decimal",
+ ],
+ "alto_click" => [
+ "decimal" => "Maquinas.validation.alto_click.decimal",
+ "required" => "Maquinas.validation.alto_click.required",
+ ],
+ "alto_impresion" => [
+ "decimal" => "Maquinas.validation.alto_impresion.decimal",
+ "required" => "Maquinas.validation.alto_impresion.required",
+ ],
+ "ancho" => [
+ "decimal" => "Maquinas.validation.ancho.decimal",
+ ],
+ "ancho_impresion" => [
+ "decimal" => "Maquinas.validation.ancho_impresion.decimal",
+ "required" => "Maquinas.validation.ancho_impresion.required",
+ ],
+ "duracion_jornada" => [
+ "integer" => "Maquinas.validation.duracion_jornada.integer",
+ "required" => "Maquinas.validation.duracion_jornada.required",
+ ],
+ "forzar_num_formas_horizontales_portada" => [
+ "integer" => "Maquinas.validation.forzar_num_formas_horizontales_portada.integer",
+ ],
+ "forzar_num_formas_verticales_portada" => [
+ "integer" => "Maquinas.validation.forzar_num_formas_verticales_portada.integer",
+ ],
+ "max" => [
+ "integer" => "Maquinas.validation.max.integer",
+ "required" => "Maquinas.validation.max.required",
+ ],
+ "metrosxminuto" => [
+ "max_length" => "Maquinas.validation.metrosxminuto.max_length",
+ "required" => "Maquinas.validation.metrosxminuto.required",
+ ],
+ "min" => [
+ "integer" => "Maquinas.validation.min.integer",
+ "required" => "Maquinas.validation.min.required",
+ ],
+ "nombre" => [
+ "max_length" => "Maquinas.validation.nombre.max_length",
+ "required" => "Maquinas.validation.nombre.required",
+ ],
+ "observaciones" => [
+ "max_length" => "Maquinas.validation.observaciones.max_length",
+ "required" => "Maquinas.validation.observaciones.required",
+ ],
+ "orden_planning" => [
+ "integer" => "Maquinas.validation.orden_planning.integer",
+ "required" => "Maquinas.validation.orden_planning.required",
+ ],
+ "precio_hora_corte" => [
+ "decimal" => "Maquinas.validation.precio_hora_corte.decimal",
+ "required" => "Maquinas.validation.precio_hora_corte.required",
+ ],
+ "precio_tinta_color" => [
+ "decimal" => "Maquinas.validation.precio_tinta_color.decimal",
+ "required" => "Maquinas.validation.precio_tinta_color.required",
+ ],
+ "precio_tinta_negro" => [
+ "decimal" => "Maquinas.validation.precio_tinta_negro.decimal",
+ "required" => "Maquinas.validation.precio_tinta_negro.required",
+ ],
+ "tipo" => [
+ "in_list" => "Maquinas.validation.tipo.in_list",
+ "required" => "Maquinas.validation.tipo.required",
+ ],
+ "velocidad" => [
+ "decimal" => "Maquinas.validation.velocidad.decimal",
+ "required" => "Maquinas.validation.velocidad.required",
+ ],
+ "velocidad_corte" => [
+ "decimal" => "Maquinas.validation.velocidad_corte.decimal",
+ "required" => "Maquinas.validation.velocidad_corte.required",
+ ],
+ ];
+
+ public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
+ {
+ $sql =
+ "SELECT t1." .
+ $selcols .
+ ", t2.nombre AS padre FROM " .
+ $this->table .
+ " t1 LEFT JOIN lg_maquinas t2 ON t1.padre_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;
+ }
+
+ /**
+ * Get resource data.
+ *
+ * @param string $search
+ *
+ * @return \CodeIgniter\Database\BaseBuilder
+ */
+ public function getResource(string $search = "")
+ {
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.id AS id, t1.nombre AS nombre, t1.is_padre AS is_padre, t1.tipo AS tipo, t1.velocidad AS velocidad, t1.ancho AS ancho, t1.alto AS alto, t1.ancho_impresion AS ancho_impresion, t1.alto_impresion AS alto_impresion, t1.alto_click AS alto_click, t1.min AS min, t1.max AS max, t1.duracion_jornada AS duracion_jornada, t1.orden_planning AS orden_planning, t1.is_rotativa AS is_rotativa, t1.precio_tinta_negro AS precio_tinta_negro, t1.is_tinta AS is_tinta, t1.precio_tinta_color AS precio_tinta_color, t1.velocidad_corte AS velocidad_corte, t1.precio_hora_corte AS precio_hora_corte, t1.metrosxminuto AS metrosxminuto, t1.forzar_num_formas_horizontales_portada AS forzar_num_formas_horizontales_portada, t1.forzar_num_formas_verticales_portada AS forzar_num_formas_verticales_portada, t1.observaciones AS observaciones, t2.nombre AS padre"
+ );
+ $builder->join("lg_maquinas t2", "t1.padre_id = t2.id", "left");
+
+ //JJO
+ $builder->where("t1.is_deleted", 0);
+
+ return empty($search)
+ ? $builder
+ : $builder
+ ->groupStart()
+ ->like("t1.id", $search)
+ ->orLike("t1.nombre", $search)
+ ->orLike("t1.tipo", $search)
+ ->orLike("t1.velocidad", $search)
+ ->orLike("t1.ancho", $search)
+ ->orLike("t1.alto", $search)
+ ->orLike("t1.ancho_impresion", $search)
+ ->orLike("t1.alto_impresion", $search)
+ ->orLike("t1.alto_click", $search)
+ ->orLike("t1.min", $search)
+ ->orLike("t1.max", $search)
+ ->orLike("t1.duracion_jornada", $search)
+ ->orLike("t1.orden_planning", $search)
+ ->orLike("t1.precio_tinta_negro", $search)
+ ->orLike("t1.precio_tinta_color", $search)
+ ->orLike("t1.velocidad_corte", $search)
+ ->orLike("t1.precio_hora_corte", $search)
+ ->orLike("t1.metrosxminuto", $search)
+ ->orLike("t1.forzar_num_formas_horizontales_portada", $search)
+ ->orLike("t1.forzar_num_formas_verticales_portada", $search)
+ ->orLike("t1.observaciones", $search)
+ ->orLike("t2.id", $search)
+ ->orLike("t1.id", $search)
+ ->orLike("t1.nombre", $search)
+ ->orLike("t1.tipo", $search)
+ ->orLike("t1.velocidad", $search)
+ ->orLike("t1.ancho", $search)
+ ->orLike("t1.alto", $search)
+ ->orLike("t1.ancho_impresion", $search)
+ ->orLike("t1.alto_impresion", $search)
+ ->orLike("t1.alto_click", $search)
+ ->orLike("t1.padre_id", $search)
+ ->orLike("t1.min", $search)
+ ->orLike("t1.max", $search)
+ ->orLike("t1.duracion_jornada", $search)
+ ->orLike("t1.orden_planning", $search)
+ ->orLike("t1.precio_tinta_negro", $search)
+ ->orLike("t1.precio_tinta_color", $search)
+ ->orLike("t1.velocidad_corte", $search)
+ ->orLike("t1.precio_hora_corte", $search)
+ ->orLike("t1.metrosxminuto", $search)
+ ->orLike("t1.forzar_num_formas_horizontales_portada", $search)
+ ->orLike("t1.forzar_num_formas_verticales_portada", $search)
+ ->orLike("t1.observaciones", $search)
+ ->orLike("t2.nombre", $search)
+ ->groupEnd();
+ }
+}
diff --git a/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php b/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php
new file mode 100644
index 00000000..e9f0f099
--- /dev/null
+++ b/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php
@@ -0,0 +1,78 @@
+ "t1.maquina_id",
+ 2 => "t1.papel_impresion_id",
+ 3 => "t1.active",
+ ];
+
+ protected $allowedFields = ["maquina_id", "papel_impresion_id", "active"];
+ protected $returnType = "App\Entities\Configuracion\MaquinasPapelesImpresionEntity";
+
+
+ /**
+ * Get resource data.
+ *
+ * @param string $search
+ *
+ * @return \CodeIgniter\Database\BaseBuilder
+ */
+ public function getResource(string $search = "", $tarifas = null, $isRotativa = false)
+ {
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.maquina_id AS maquina_id, t1.papel_impresion_id AS papel_impresion_id, t1.active AS active, t2.nombre AS maquina, t3.nombre AS papel_impresion"
+ );
+
+ $builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
+ $builder->join("lg_papel_impresion t3", "t3.papel_impresion_id = t3.id", "left");
+
+ $isFirst = false;
+ $where_str = "";
+ if (!is_null($tarifas)){
+ foreach ($tarifas as $tarifa){
+ if (!$isFirst)
+ $where_str += ' OR ';
+ if ($tarifa->uso == 'portada')
+ $where_str += "t3.portada=1 AND ";
+ if ($tarifa->tipo == 'negro' || $tarifa->tipo == 'negrohq')
+ $where_str += "t3.bn=1";
+ else
+ $where_str += "t3.bn=1";
+ }
+
+ $builder->where($where_str);
+ }
+ if($isRotativa){
+ $builder->where("t3.rotativa", 1);
+ }
+ else{
+ $builder->where("t3.rotativa", 0);
+ }
+
+ $builder->where("t2.is_deleted", 0);
+ $builder->where("t3.is_deleted", 0);
+
+
+ return empty($search)
+ ? $builder
+ : $builder
+ ->groupStart()
+ ->like("t2.nombre", $search)
+ ->orLike("t3.nombre", $search)
+ ->groupEnd();
+ }
+}
diff --git a/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php b/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
new file mode 100644
index 00000000..4be922be
--- /dev/null
+++ b/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
@@ -0,0 +1,125 @@
+ "t1.id",
+ 2 => "t1.maquina_id",
+ 3 => "t1.tipo",
+ 4 => "t1.precio",
+ 5 => "t1.uso",
+ 6 => "t1.predeterminado",
+ 7 => "t2.nombre",
+ ];
+
+ protected $allowedFields = ["maquina_id", "tipo", "precio", "uso", "predeterminado"];
+ protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
+
+ protected $useTimestamps = true;
+ protected $useSoftDeletes = false;
+
+ protected $createdField = "created_at";
+
+ protected $updatedField = "updated_at";
+
+ public static $labelField = "maquina_id";
+
+ protected $validationRules = [
+ "precio" => [
+ "label" => "MaquinasTarifasImpresions.precio",
+ "rules" => "required|decimal",
+ ],
+ "tipo" => [
+ "label" => "MaquinasTarifasImpresions.tipo",
+ "rules" => "permit_empty|in_list[negro,color,negrohq,bicolor]",
+ ],
+ "uso" => [
+ "label" => "MaquinasTarifasImpresions.uso",
+ "rules" => "trim|required|max_length[255]",
+ ],
+ ];
+
+ protected $validationMessages = [
+ "precio" => [
+ "decimal" => "MaquinasTarifasImpresions.validation.precio.decimal",
+ "required" => "MaquinasTarifasImpresions.validation.precio.required",
+ ],
+ "tipo" => [
+ "in_list" => "MaquinasTarifasImpresions.validation.tipo.in_list",
+ ],
+ "uso" => [
+ "max_length" => "MaquinasTarifasImpresions.validation.uso.max_length",
+ "required" => "MaquinasTarifasImpresions.validation.uso.required",
+ ],
+ ];
+
+ public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
+ {
+ $sql =
+ "SELECT t1." .
+ $selcols .
+ ", t2.nombre AS maquina FROM " .
+ $this->table .
+ " t1 LEFT JOIN lg_maquinas t2 ON t1.maquina_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;
+ }
+
+ /**
+ * Get resource data.
+ *
+ * @param string $search
+ *
+ * @return \CodeIgniter\Database\BaseBuilder
+ */
+ public function getResource(string $search = "", $maquina_id=-1)
+ {
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t1.predeterminado AS predeterminado, t2.nombre AS maquina"
+ );
+
+ //JJO
+ $builder->where('maquina_id', $maquina_id);
+ $builder->where("t1.is_deleted", 0);
+
+ $builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
+
+ return empty($search)
+ ? $builder
+ : $builder
+ ->groupStart()
+ ->like("t1.id", $search)
+ ->orLike("t1.tipo", $search)
+ ->orLike("t1.precio", $search)
+ ->orLike("t1.uso", $search)
+ ->orLike("t2.id", $search)
+ ->orLike("t1.id", $search)
+ ->orLike("t1.maquina_id", $search)
+ ->orLike("t1.tipo", $search)
+ ->orLike("t1.precio", $search)
+ ->orLike("t1.uso", $search)
+ ->orLike("t2.nombre", $search)
+ ->groupEnd();
+ }
+}
diff --git a/ci4/app/Models/Configuracion/PapelImpresionModel.php b/ci4/app/Models/Configuracion/PapelImpresionModel.php
index 377ea3b4..be0b7714 100644
--- a/ci4/app/Models/Configuracion/PapelImpresionModel.php
+++ b/ci4/app/Models/Configuracion/PapelImpresionModel.php
@@ -66,6 +66,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
"portada",
"cubierta",
"rotativa",
+ "isActivo",
"deleted_at",
"is_deleted",
"user_update_id",
@@ -208,7 +209,7 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
- "t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.ancho AS ancho, t1.alto AS alto, t1.mano AS mano, t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada, t1.margen AS margen, t1.peso_por_pliego AS peso_por_pliego, t1.precio_pliego AS precio_pliego, t1.bn AS bn, t1.color AS color, t1.portada AS portada, t1.cubierta AS cubierta, t1.rotativa AS rotativa, t2.nombre AS papel_generico_id"
+ "t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.ancho AS ancho, t1.alto AS alto, t1.mano AS mano, t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada, t1.margen AS margen, t1.peso_por_pliego AS peso_por_pliego, t1.precio_pliego AS precio_pliego, t1.bn AS bn, t1.color AS color, t1.portada AS portada, t1.cubierta AS cubierta, t1.rotativa AS rotativa, t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
);
$builder->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left");
diff --git a/ci4/app/Models/Tarifas/TarifamanipuladoModel.php b/ci4/app/Models/Tarifas/TarifamanipuladoModel.php
index 97e95c09..35322769 100644
--- a/ci4/app/Models/Tarifas/TarifamanipuladoModel.php
+++ b/ci4/app/Models/Tarifas/TarifamanipuladoModel.php
@@ -21,7 +21,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel
"deleted_at",
"is_deleted",
"user_created_id",
- "user_update_id"
+ "user_updated_id"
];
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity";
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/_maquinaFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/_maquinaFormItems.php
new file mode 100644
index 00000000..fc9df714
--- /dev/null
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/_maquinaFormItems.php
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ is_rotativa== false): ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
new file mode 100644
index 00000000..acb1865d
--- /dev/null
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
@@ -0,0 +1,389 @@
+= $this->include("themes/_commonPartialsBs/datatables") ?>
+= $this->include("themes/_commonPartialsBs/select2bs5") ?>
+= $this->include("themes/_commonPartialsBs/sweetalert") ?>
+= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
+= $this->section("content") ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | = lang('MaquinasTarifasImpresions.uso') ?> |
+ = lang('MaquinasTarifasImpresions.tipo') ?> |
+ = lang('MaquinasTarifasImpresions.precio') ?> |
+ = lang('MaquinasTarifasImpresions.predeterminado') ?> |
+ = lang('Basic.global.Action') ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | = lang('MaquinasTarifasImpresions.uso') ?> |
+ = lang('MaquinasTarifasImpresions.tipo') ?> |
+ = lang('MaquinasTarifasImpresions.precio') ?> |
+ = lang('MaquinasTarifasImpresions.predeterminado') ?> |
+ = lang('Basic.global.Action') ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+= $this->endSection() ?>
+
+
+= $this->section("additionalInlineJs") ?>
+
+ $(document).ready(function () {
+ if($(this).is(':checked')){
+
+ $("#datosRotativa").show();
+ }
+ });
+
+ $('#isRotativa').on("click",function(el){
+ if($(this).is(':checked')){
+
+ $("#datosRotativa").show();
+ }else{
+ document.getElementById("precioTintaNegro").value = null;
+ document.getElementById("precioTintaColor").value = null;
+ document.getElementById("velocidadCorte").value = null;
+ document.getElementById("precioHoraCorte").value = null;
+ document.getElementById("metrosxminuto").value = null;
+ $("#datosRotativa").hide();
+ }
+ });
+
+ $('#isPadre').on("click",function(el){
+ if($(this).is(':checked')){
+
+ $("#selectVariante").show();
+ }else{
+
+ $("#padreId").select2('val', -1);
+ $("#selectVariante").hide();
+ }
+ });
+
+ $('#padreId').select2({
+ theme: 'bootstrap-5',
+ allowClear: false,
+ ajax: {
+ url: '= route_to("menuItemsOfMaquinas") ?>',
+ type: 'post',
+ dataType: 'json',
+
+ data: function (params) {
+ return {
+ id: 'id',
+ text: 'nombre',
+ searchTerm: params.term,
+ = csrf_token() ?? "token" ?> : = csrf_token() ?>v
+ };
+ },
+ delay: 60,
+ processResults: function (response) {
+
+ yeniden(response.= csrf_token() ?>);
+
+ return {
+ results: response.menu
+ };
+ },
+ cache: true
+ },
+
+ });
+
+ const lastColNr = $('#tableOfTarifamanipuladolineas').find("tr:first th").length - 1;
+ const url = window.location.href;
+ const url_parts = url.split('/');
+ if(url_parts[url_parts.length-2] == 'edit'){
+ id = url_parts[url_parts.length-1];
+ }
+ else{
+ id = -1;
+ }
+
+ const actionBtns = function(data) {
+ return `
+
+
+
+ `;
+ };
+
+
+ editor = new $.fn.dataTable.Editor( {
+ ajax: {
+ url: "= route_to('editorOfMaquinasTarifaImpresion') ?>",
+ headers: {
+ = csrf_token() ?? "token" ?> : = csrf_token() ?>v,
+ },
+ },
+ table : "#tableOfMaquinastarifasimpresion",
+ idSrc: 'id',
+ fields: [ {
+ name: "uso",
+ type: "select",
+ options: ['= lang('MaquinasTarifasImpresions.interior') ?>', '= lang('MaquinasTarifasImpresions.portada') ?>']
+ }, {
+ name: "tipo",
+ type: "select",
+ options: ['= lang('MaquinasTarifasImpresions.negro') ?>', '= lang('MaquinasTarifasImpresions.color') ?>',
+ '= lang('MaquinasTarifasImpresions.negrohq') ?>', '= lang('MaquinasTarifasImpresions.bicolor') ?>']
+ }, {
+ name: "precio",
+ attr: {
+ type: "number"
+ }
+ }, {
+ name: "predeterminado",
+ type: "checkbox",
+ separator: "",
+ options: [
+ { label: "", value: 1 }
+ ],
+ unselectedValue: 0
+
+ }, {
+ "name": "maquina_id",
+ "type": "hidden"
+ },{
+ "name": "deleted_at",
+ "type": "hidden"
+ },{
+ "name": "is_deleted",
+ "type": "hidden"
+ },
+ ]
+ } );
+
+ editor.on( 'preSubmit', function ( e, d, type ) {
+ if ( type === 'create'){
+ d.data[0]['maquina_id'] = id;
+ }
+ else if(type === 'edit' ) {
+ for (v in d.data){
+ d.data[v]['maquina_id'] = id;
+ }
+ }
+ });
+
+
+ editor.on( 'postSubmit', function ( e, json, data, action ) {
+
+ yeniden(json.= csrf_token() ?>);
+ });
+
+ editor.on( 'submitSuccess', function ( e, json, data, action ) {
+
+ theTable.clearPipeline();
+ theTable.draw();
+ });
+
+
+ var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
+ serverSide: true,
+ processing: true,
+ autoWidth: true,
+ responsive: true,
+ lengthMenu: [ 5, 10, 25],
+ order: [[ 0, "asc" ]],
+ pageLength: 10,
+ lengthChange: true,
+ searching: false,
+ paging: true,
+ info: false,
+ dom: "Bltp",
+ ajax : $.fn.dataTable.pipeline( {
+ url: '= route_to('dataTableOfMaquinasTarifasImpresion') ?>',
+ data: {
+ id_maquina: id,
+ },
+ method: 'POST',
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
+ async: true,
+ }),
+ columns: [
+ { 'data': 'uso' },
+ { 'data': 'tipo' },
+ { 'data': 'precio' },
+ { 'data': 'predeterminado' },
+ {
+ data: actionBtns,
+ className: 'row-edit dt-center'
+ }
+ ],
+ columnDefs: [
+ {
+ orderable: false,
+ searchable: false,
+ targets: [lastColNr]
+ },
+ {"orderData": [ 0, 1 ], "targets": 0 },
+
+ ],
+ language: {
+ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/= config('Basics')->i18n ?>.json"
+ },
+ buttons: [ {
+ className: 'btn btn-primary float-end me-sm-3 me-1',
+ extend: "createInline",
+ editor: editor,
+ formOptions: {
+ submitTrigger: -1,
+ submitHtml: '
'
+ }
+ } ]
+ } );
+
+
+
+ // Activate an inline edit on click of a table cell
+ $('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.edit', function (e) {
+ editor.inline(
+ theTable.cells(this.parentNode.parentNode, '*').nodes(),
+ {
+ cancelHtml: '
',
+ cancelTrigger: 'span.cancel',
+ submitHtml: '
',
+ submitTrigger: 'span.edit',
+ submit: 'allIfChanged'
+ }
+ );
+ } );
+
+
+ // Delete row
+ $('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.remove', function (e) {
+
+ Swal.fire({
+ title: '= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
+ 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) {
+ editor
+ .create( false )
+ .edit( this.parentNode, false)
+ .set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
+ .set( 'is_deleted', 1 )
+ .submit();
+
+ }
+ });
+ });
+
+ theTable.on( 'draw.dt', function () {
+ const boolCols = [3];
+ for (let coln of boolCols) {
+ theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
+ cell.innerHTML = cell.innerHTML == '1' ? '
' : '';
+ });
+ }
+
+ });
+
+
+
+= $this->endSection() ?>
+
+=$this->section('css') ?>
+
+
+
+=$this->endSection() ?>
+
+
+= $this->section('additionalExternalJs') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+=$this->endSection() ?>
\ No newline at end of file
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaList.php
new file mode 100644
index 00000000..35bc43c0
--- /dev/null
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaList.php
@@ -0,0 +1,190 @@
+=$this->include('themes/_commonPartialsBs/select2bs5') ?>
+=$this->include('themes/_commonPartialsBs/datatables') ?>
+=$this->include('themes/_commonPartialsBs/sweetalert') ?>
+= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
+=$this->section('content'); ?>
+
+
+
+
+
+
+ = view('themes/_commonPartialsBs/_alertBoxes'); ?>
+
+
+
+
+ | = lang('Maquinas.nombre') ?> |
+ = lang('Maquinas.padreId') ?> |
+ = lang('Maquinas.tipo') ?> |
+ = lang('Maquinas.velocidad') ?> |
+ = lang('Maquinas.duracionJornada') ?> |
+ = lang('Maquinas.ancho') ?> |
+ = lang('Maquinas.alto') ?> |
+ = lang('Maquinas.anchoImpresion') ?> |
+ = lang('Maquinas.altoImpresion') ?> |
+ = lang('Maquinas.ordenPlanning') ?> |
+ = lang('Maquinas.min') ?> |
+ = lang('Maquinas.max') ?> |
+ = lang('Basic.global.Action') ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+=$this->endSection() ?>
+
+
+=$this->section('additionalInlineJs') ?>
+
+ const lastColNr = $('#tableOfMaquinas').find("tr:first th").length - 1;
+ const actionBtns = function(data) {
+ return `
+
+
+
+
+ | `;
+ };
+ theTable = $('#tableOfMaquinas').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: [[0, 'asc']],
+ language: {
+ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/= config('Basics')->i18n ?>.json"
+ },
+ ajax : $.fn.dataTable.pipeline( {
+ url: '= route_to('dataTableOfMaquinas') ?>',
+ method: 'POST',
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
+ async: true,
+ }),
+ columnDefs: [
+ {
+ orderable: false,
+ searchable: false,
+ targets: [lastColNr]
+ }
+ ],
+ columns : [
+ { 'data': 'nombre' },
+ { 'data': 'padre' },
+ { 'data': 'tipo' },
+ { 'data': 'velocidad' },
+ { 'data': 'duracion_jornada' },
+ { 'data': 'ancho' },
+ { 'data': 'alto' },
+ { 'data': 'ancho_impresion' },
+ { 'data': 'alto_impresion' },
+ { 'data': 'orden_planning' },
+ { 'data': 'min' },
+ { 'data': 'max' },
+ { 'data': actionBtns }
+ ]
+ });
+
+
+ theTable.on( 'draw.dt', function () {
+ const boolCols = [];
+ for (let coln of boolCols) {
+ theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
+ cell.innerHTML = cell.innerHTML == '1' ? '
' : '';
+ });
+ }
+
+ });
+
+$(document).on('click', '.btn-edit', function(e) {
+ //window.location.href = `= route_to('maquinaList') ?>/${$(this).attr('data-id')}/edit`;
+ window.location.href = `/configuracion/maquinas/edit/${$(this).attr('data-id')}`;
+ });
+
+$(document).on('click', '.btn-delete', function(e) {
+ Swal.fire({
+ title: '= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Maquinas.maquina'))]) ?>',
+ 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('maquinaList') ?>/${dataId}`,
+ //method: 'DELETE',
+ url: `/configuracion/maquinas/delete/${dataId}`,
+ method: 'GET',
+ }).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') ?>
+
+=$this->endSection() ?>
+
+
+= $this->section('additionalExternalJs') ?>
+
+
+
+
+
+
+
+
+
+
+=$this->endSection() ?>
+
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/_papelImpresionFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/_papelImpresionFormItems.php
index c88cce57..3b5144e8 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/_papelImpresionFormItems.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/_papelImpresionFormItems.php
@@ -73,6 +73,16 @@
+
+
+
+
+
+
+
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionList.php
index 4609724e..4a476df1 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionList.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionList.php
@@ -25,6 +25,7 @@
= lang('PapelImpresion.portada') ?> |
= lang('PapelImpresion.cubierta') ?> |
= lang('PapelImpresion.rotativa') ?> |
+ = lang('PapelImpresion.activo') ?> |
= lang('Basic.global.Action') ?> |
@@ -99,13 +100,14 @@
{ 'data': 'portada' },
{ 'data': 'cubierta' },
{ 'data': 'rotativa' },
+ { 'data': 'isActivo' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
- const boolCols = [3, 4, 5, 6, 7];
+ const boolCols = [3, 4, 5, 6, 7, 8];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '' : '';