diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 3e1e9adb..7cdc04d9 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -293,6 +293,8 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio $routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']); $routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']); $routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']); + $routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']); + }); $routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']); diff --git a/ci4/app/Controllers/Configuracion/Papelesimpresion.php b/ci4/app/Controllers/Configuracion/Papelesimpresion.php index e5beef97..253e2256 100755 --- a/ci4/app/Controllers/Configuracion/Papelesimpresion.php +++ b/ci4/app/Controllers/Configuracion/Papelesimpresion.php @@ -468,4 +468,10 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController } } + public function papel_impresion_select() + { + $q = $this->request->getGet('q'); + $data = $this->model->querySelect($q)->get()->getResultArray(); + return $this->response->setJSON($data); + } } diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index a6fe5e73..9a66de2c 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -194,6 +194,7 @@ class Ordentrabajo extends BaseController $q = $this->produccionService->papelGramajeDatatableQuery(); return DataTable::of($q) ->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600)) + ->add("action" , fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'),'data' => $q]) ->toJson(true); } public function reset_tareas(int $orden_trabajo_id) diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index eddedcd4..01772f79 100644 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -23,6 +23,7 @@ return [ "tiempo" => "Tiempo", "progreso" => "Progreso", "logo" => "Logo impresion", + "filter_by_task" => "Filtrar por tarea" ], "task" => [ diff --git a/ci4/app/Models/Configuracion/PapelImpresionModel.php b/ci4/app/Models/Configuracion/PapelImpresionModel.php index 3625daa7..4a7979d1 100755 --- a/ci4/app/Models/Configuracion/PapelImpresionModel.php +++ b/ci4/app/Models/Configuracion/PapelImpresionModel.php @@ -369,5 +369,16 @@ class PapelImpresionModel extends \App\Models\BaseModel return ""; } + public function querySelect(?string $query) + { + $q = $this->builder()->select([ + "id", + "nombre as name", + ]); + if ($query) { + $q->like("name", $query); + } + return $q; + } } diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index ff2a28d7..3098d825 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -110,7 +110,6 @@ class ProductionService extends BaseService { $auth_user = auth()->user(); - $ot = new OrdenTrabajoEntity(); $ot_exists = $this->pedido->orden_trabajo(); if ($ot_exists) { return $ot_exists; @@ -122,13 +121,10 @@ class ProductionService extends BaseService "total_tirada" => $this->pedido->total_tirada, "total_precio" => $this->pedido->total_precio ]; - $ot->fill($data); - $this->otModel->save($ot); - $ot_id = $this->otModel->getInsertID(); - $ot->id = $ot_id; + $ot_id = $this->otModel->insert($data); $this->init($ot_id); - $this->storeOrdenTrabajoUsers(); - $this->storeOrdenTrabajoDates(); + // $this->storeOrdenTrabajoUsers(); + // $this->storeOrdenTrabajoDates(); $this->storeAllTareas(); return $this->ot; } @@ -467,6 +463,7 @@ class ProductionService extends BaseService public function papelGramajeDatatableQuery() : BaseBuilder { $q = $this->otModel->builder()->select([ + "lg_papel_impresion.id as papelImpresionId", "lg_papel_impresion.nombre as papelImpresionNombre", "lg_papel_impresion.gramaje as papelImpresionGramaje", "COUNT(orden_trabajo_tareas.id) as tareasCount", @@ -692,5 +689,9 @@ class ProductionService extends BaseService } + protected function actionButtonFilterTask(int $id) + { + return ["title" => lang('ot.filter_by_task'),'id' => $id]; + } } diff --git a/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php b/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php index b6f75226..a30ad7d1 100644 --- a/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/planning_papel_gramaje_table.php @@ -8,6 +8,8 @@