Merge branch 'main' into feat/backups

This commit is contained in:
2025-06-09 21:25:27 +02:00
7 changed files with 31 additions and 3 deletions

View File

@ -902,6 +902,8 @@ $routes->group('etiquetasTitulos', ['namespace' => 'App\Controllers\Logistica'],
*/ */
$routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) { $routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) {
$routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']); $routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']);
$routes->get('lang/(:segment)', 'Language::file/$1');
}); });
$routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']); $routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']);

View File

@ -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
}
} }

View File

@ -200,6 +200,7 @@ class OrdenTrabajoTareaEntity extends Entity
if ($date->action_at && $init) { if ($date->action_at && $init) {
$end = $date->action_at; $end = $date->action_at;
$intervals[] = $init->difference($end)->getSeconds(); $intervals[] = $init->difference($end)->getSeconds();
$init = null; // Reset init after calculating the interval
} }
} }
} }

View File

@ -157,6 +157,7 @@ return [
"tareas_hoy" => "Tareas para HOY", "tareas_hoy" => "Tareas para HOY",
"tareas_all" => "Todas", "tareas_all" => "Todas",
"tareas_delay" => "Aplazadas", "tareas_delay" => "Aplazadas",
'init_tarea' => 'Iniciar',
"play_tarea" => "Continuar", "play_tarea" => "Continuar",
"play_pause" => "Pausar", "play_pause" => "Pausar",
"play_stop" => "Aplazar", "play_stop" => "Aplazar",

View File

@ -41,7 +41,7 @@
</div> </div>
<div class="col-6 h-100"> <div class="col-6 h-100">
<div class="d-flex flex-column justify-content-evenly gap-2 h-100"> <div class="d-flex flex-column justify-content-evenly gap-2 h-100">
<button type="button" data-estado="I" id="btn-start-tarea" class="maquina-btn btn btn-success w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-play ti-lg"></span><?= lang('Produccion.maquinista.play_tarea') ?></button> <button type="button" data-estado="I" id="btn-start-tarea" class="maquina-btn btn btn-success w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-play ti-lg"></span><?= lang('Produccion.maquinista.init_tarea') ?></button>
<button type="button" data-estado="S" id="btn-pause-tarea" class="maquina-btn btn btn-info w-100 d-flex justify-content-evenly d-none action-btn"><span class="ti ti-player-pause ti-lg"></span><?= lang('Produccion.maquinista.play_pause') ?></button> <button type="button" data-estado="S" id="btn-pause-tarea" class="maquina-btn btn btn-info w-100 d-flex justify-content-evenly d-none action-btn"><span class="ti ti-player-pause ti-lg"></span><?= lang('Produccion.maquinista.play_pause') ?></button>
<button type="button" data-estado="D" id="btn-stop-tarea" class="maquina-btn btn btn-warning w-100 d-flex justify-content-evenly"><span class="ti ti-player-stop ti-lg"></span><?= lang('Produccion.maquinista.play_stop') ?></button> <button type="button" data-estado="D" id="btn-stop-tarea" class="maquina-btn btn btn-warning w-100 d-flex justify-content-evenly"><span class="ti ti-player-stop ti-lg"></span><?= lang('Produccion.maquinista.play_stop') ?></button>
<button type="button" data-estado="F" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn d-none"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button> <button type="button" data-estado="F" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn d-none"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button>

View File

@ -41,7 +41,7 @@
</div> </div>
<div class="col-6 h-100"> <div class="col-6 h-100">
<div class="d-flex flex-column justify-content-evenly gap-2 h-100"> <div class="d-flex flex-column justify-content-evenly gap-2 h-100">
<button type="button" data-estado="I" id="btn-start-tarea" class="maquina-btn btn btn-success w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-play ti-lg"></span><?= lang('Produccion.maquinista.play_tarea') ?></button> <button type="button" data-estado="I" id="btn-start-tarea" class="maquina-btn btn btn-success w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-play ti-lg"></span><?= lang('Produccion.maquinista.init_tarea') ?></button>
<button type="button" data-estado="S" id="btn-pause-tarea" class="maquina-btn btn btn-info w-100 d-flex justify-content-evenly d-none action-btn"><span class="ti ti-player-pause ti-lg"></span><?= lang('Produccion.maquinista.play_pause') ?></button> <button type="button" data-estado="S" id="btn-pause-tarea" class="maquina-btn btn btn-info w-100 d-flex justify-content-evenly d-none action-btn"><span class="ti ti-player-pause ti-lg"></span><?= lang('Produccion.maquinista.play_pause') ?></button>
<button type="button" data-estado="D" id="btn-stop-tarea" class="maquina-btn btn btn-warning w-100 d-flex justify-content-evenly"><span class="ti ti-player-stop ti-lg"></span><?= lang('Produccion.maquinista.play_stop') ?></button> <button type="button" data-estado="D" id="btn-stop-tarea" class="maquina-btn btn btn-warning w-100 d-flex justify-content-evenly"><span class="ti ti-player-stop ti-lg"></span><?= lang('Produccion.maquinista.play_stop') ?></button>
<button type="button" data-estado="F" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn d-none"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button> <button type="button" data-estado="F" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn d-none"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button>

View File

@ -15,8 +15,11 @@ class MaquinistaTareaView {
this.inputClick = $('.ot-tarea-click') this.inputClick = $('.ot-tarea-click')
this.btnPrintLabels = this.item.find('#btn-print-labels') this.btnPrintLabels = this.item.find('#btn-print-labels')
this.btnFicharEmbalaje = this.item.find('#btn-fichar-embalaje') 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.actionButtons.on('click', this.eventActionButton.bind(this))
this.btnDelay.on('click', this.delayEventActionButton.bind(this)) this.btnDelay.on('click', this.delayEventActionButton.bind(this))
this.btnDeleteProgress.on('click', this.handleDeleteTareaProgress.bind(this)) this.btnDeleteProgress.on('click', this.handleDeleteTareaProgress.bind(this))
@ -183,6 +186,12 @@ class MaquinistaTareaView {
showBasedOnStatus(status) { showBasedOnStatus(status) {
if (['P', 'S'].includes(status)) { if (['P', 'S'].includes(status)) {
if(status == 'P') {
this.btnPlay.html(`<span class="ti ti-player-play ti-lg"></span>` + this.lang.maquinista.init_tarea);
}
else{
this.btnPlay.html(`<span class="ti ti-player-play ti-lg"></span>` + this.lang.maquinista.play_tarea);
}
this.enableButtons() this.enableButtons()
this.showPlay() this.showPlay()
} }