diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 5a096f89..471136c8 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -902,6 +902,8 @@ $routes->group('etiquetasTitulos', ['namespace' => 'App\Controllers\Logistica'], */ $routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) { $routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']); + $routes->get('lang/(:segment)', 'Language::file/$1'); + }); $routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']); diff --git a/ci4/app/Controllers/Language.php b/ci4/app/Controllers/Language.php index f9c32e5d..7d5953f9 100755 --- a/ci4/app/Controllers/Language.php +++ b/ci4/app/Controllers/Language.php @@ -39,4 +39,19 @@ class Language extends BaseController } } + + public function file(string $file) + { + $locale = $this->request->getLocale(); // es, en, fr… + $path = APPPATH."Language/{$locale}/{$file}.php"; + + if (! is_file($path)) { + return $this->response->setStatusCode(404); + } + + /** @var array $lines */ + $lines = require $path; // el array que devuelve tu lang-file + + return $this->response->setJSON($lines); // Content-Type: application/json + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php index c01a327f..7f7e97ee 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php @@ -200,6 +200,7 @@ class OrdenTrabajoTareaEntity extends Entity if ($date->action_at && $init) { $end = $date->action_at; $intervals[] = $init->difference($end)->getSeconds(); + $init = null; // Reset init after calculating the interval } } } diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index 7e47cd7c..e3f1c84a 100755 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -157,6 +157,7 @@ return [ "tareas_hoy" => "Tareas para HOY", "tareas_all" => "Todas", "tareas_delay" => "Aplazadas", + 'init_tarea' => 'Iniciar', "play_tarea" => "Continuar", "play_pause" => "Pausar", "play_stop" => "Aplazar", diff --git a/ci4/app/Views/themes/vuexy/components/cards/tarea_card_actions.php b/ci4/app/Views/themes/vuexy/components/cards/tarea_card_actions.php index bd119b74..85e173b7 100644 --- a/ci4/app/Views/themes/vuexy/components/cards/tarea_card_actions.php +++ b/ci4/app/Views/themes/vuexy/components/cards/tarea_card_actions.php @@ -41,7 +41,7 @@
- + diff --git a/ci4/app/Views/themes/vuexy/components/cards/tarea_multiple_card_actions.php b/ci4/app/Views/themes/vuexy/components/cards/tarea_multiple_card_actions.php index 58e362c9..999240eb 100644 --- a/ci4/app/Views/themes/vuexy/components/cards/tarea_multiple_card_actions.php +++ b/ci4/app/Views/themes/vuexy/components/cards/tarea_multiple_card_actions.php @@ -41,7 +41,7 @@
- + diff --git a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js index 574b9b32..553ff4ad 100644 --- a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js +++ b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js @@ -15,8 +15,11 @@ class MaquinistaTareaView { this.inputClick = $('.ot-tarea-click') this.btnPrintLabels = this.item.find('#btn-print-labels') this.btnFicharEmbalaje = this.item.find('#btn-fichar-embalaje') + this.lang = {}; } - init() { + async init() { + const res = await fetch("/translate/lang/Produccion"); + this.lang = await res.json(); this.actionButtons.on('click', this.eventActionButton.bind(this)) this.btnDelay.on('click', this.delayEventActionButton.bind(this)) this.btnDeleteProgress.on('click', this.handleDeleteTareaProgress.bind(this)) @@ -183,6 +186,12 @@ class MaquinistaTareaView { showBasedOnStatus(status) { if (['P', 'S'].includes(status)) { + if(status == 'P') { + this.btnPlay.html(`` + this.lang.maquinista.init_tarea); + } + else{ + this.btnPlay.html(`` + this.lang.maquinista.play_tarea); + } this.enableButtons() this.showPlay() }