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 @@ (HH:MM) + + diff --git a/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php b/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php index 883d34f6..c9dfca15 100644 --- a/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/planning_rot_table.php @@ -25,7 +25,7 @@ - + diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php index 44177691..1856fd08 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/viewPlanningRotativa.php @@ -14,22 +14,57 @@ -
- - +
- + + + + endSection() ?> diff --git a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/index.js b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/index.js index d16243f7..ee3b61eb 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/index.js +++ b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/index.js @@ -3,5 +3,4 @@ import PlanningRotativa from "./planning_rotativa.js"; $(function(){ const planningRotativa = new PlanningRotativa($("#planning-rotativa-page")); planningRotativa.init(); - console.log("PL") }) \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js index ac2a232f..199573d6 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js +++ b/httpdocs/assets/js/safekat/pages/produccion/planning_rotativa/planning_rotativa.js @@ -25,15 +25,26 @@ class PlanningRotativa { { data: 'tareasCount', searchable: true, sortable: true }, { data: 'totalTirada', searchable: false, sortable: false }, { data: 'tiempoReal', searchable: false, sortable: false }, + { + data: 'action', searchable: false, sortable: false, render: (d) => { + return `` + } + }, + ] this.maquinaSelectFilter = new ClassSelect($("#maquina-select-filter"), `/maquinas/select`, "Seleccione una maquina", true); + this.papelImpresionFilter = new ClassSelect($("#papel-impresion-select-filter"), `/papelesimpresion/select`, "Seleccione un papel", true); this.maquinaSelectFilter.config.dropdownParent = this.item } init() { this.maquinaSelectFilter.init() + this.papelImpresionFilter.init() + this.papelGramajeTablePlanning.on('click','.papel-gramaje-btn',this.filterPapelGramaje.bind(this)) + this.datatablePlanningRot = this.tablePlanningRot.DataTable({ processing: true, + orderCellsTop : true, layout: { topStart: 'pageLength', topEnd: 'search', @@ -52,6 +63,7 @@ class PlanningRotativa { }); this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({ processing: true, + orderCellsTop : true, layout: { topStart: 'pageLength', topEnd: 'search', @@ -77,14 +89,27 @@ class PlanningRotativa { let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name")) this.datatablePlanningRot.column(columnIndex).search(this.maquinaSelectFilter.getText()).draw() }) + this.item.on("change", "#papel-impresion-select-filter", (event) => { + let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name")) + this.datatablePlanningRot.column(columnIndex).search(this.papelImpresionFilter.getText()).draw() + }) } _renderBtnAction(d) { - return ` Ver orden` + return `` } _columnFiltering() { this.api().columns() console.log(this.api().columns()) } + filterPapelGramaje(event) + { + const papelImpresionId = $(event.currentTarget).data('id') + const papelImpresionName = $(event.currentTarget).data('name') + + + this.papelImpresionFilter.setOption(papelImpresionId,papelImpresionName) + + } } export default PlanningRotativa; \ No newline at end of file