Merge branch 'mod/maquinas' into 'main'

comprobado ancho y alto > ancho y alto impresion. modificacion listado

See merge request jjimenez/safekat!38
This commit is contained in:
2023-07-21 10:35:12 +00:00
8 changed files with 47 additions and 38 deletions

View File

@ -176,12 +176,26 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { //JJO: comprobar alto y ancho impresion < alto y ancho
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); if($sanitizedData['alto'] < $sanitizedData['alto_impresion']){
} catch (\Exception $e) { $successfulResult = false;
$noException = false; $this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');;
$this->dealWithException($e); $this->session->setFlashdata('formErrors', $this->model->errors());
} }
else if ($sanitizedData['ancho'] < $sanitizedData['ancho_impresion']){
$successfulResult = false;
$this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');;
$this->session->setFlashdata('formErrors', $this->model->errors());
}
else{
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
}
else: else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]); $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
@ -190,7 +204,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
$maquina->fill($sanitizedData); $maquina->fill($sanitizedData);
$thenRedirect = true; $thenRedirect = false;
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $maquina->id ?? $id; $id = $maquina->id ?? $id;

View File

@ -5,10 +5,10 @@
return [ return [
'acabado' => 'finish', 'acabado' => 'finish',
'alto' => 'Height', 'alto' => 'Height',
'altoClick' => 'Height Click', 'altoClick' => 'Click Height',
'altoImpresion' => 'Height Printing', 'altoImpresion' => 'Printing Height',
'ancho' => 'Width', 'ancho' => 'Width',
'anchoImpresion' => 'Width Printing', 'anchoImpresion' => 'Printing Width',
'createdAt' => 'Created At', 'createdAt' => 'Created At',
'deletedAt' => 'Deleted At', 'deletedAt' => 'Deleted At',
'duracionJornada' => 'Working day duration', 'duracionJornada' => 'Working day duration',
@ -42,14 +42,16 @@ return [
'velocidad' => 'Speed', 'velocidad' => 'Speed',
'velocidadCorte' => 'Cut speed', 'velocidadCorte' => 'Cut speed',
'validation' => [ 'validation' => [
'alto_menor_alto_impresion' => '\'Printing Height\' field must be lower than \'Height\'',
'ancho_menor_ancho_impresion' => '\'Printing Width\' field must be lower than \'Width\'',
'alto' => [ 'alto' => [
'decimal' => 'The {field} field must contain a decimal number.', 'decimal' => 'The {field} field must contain a decimal number.',
'greater_than' => 'The field {field} must be greater than {param}',
], ],
'ancho' => [ 'ancho' => [
'decimal' => 'The {field} field must contain a decimal number.', 'decimal' => 'The {field} field must contain a decimal number.',
'greater_than' => 'The field {field} must be greater than {param}',
], ],
'forzar_num_formas_horizontales_portada' => [ 'forzar_num_formas_horizontales_portada' => [
@ -65,19 +67,20 @@ return [
'alto_click' => [ 'alto_click' => [
'decimal' => 'The {field} field must contain a decimal number.', 'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.', 'required' => 'The {field} field is required.',
'greater_than' => 'The field {field} must be greater than {param}',
], ],
'alto_impresion' => [ 'alto_impresion' => [
'decimal' => 'The {field} field must contain a decimal number.', 'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.', 'required' => 'The {field} field is required.',
'greater_than' => 'The field {field} must be greater than {param}',
], ],
'ancho_impresion' => [ 'ancho_impresion' => [
'decimal' => 'The {field} field must contain a decimal number.', 'decimal' => 'The {field} field must contain a decimal number.',
'required' => 'The {field} field is required.', 'required' => 'The {field} field is required.',
'greater_than' => 'The field {field} must be greater than {param}',
], ],
'duracion_jornada' => [ 'duracion_jornada' => [

View File

@ -3,6 +3,7 @@
return [ return [
'papel_impresion_maquinas' => 'Printing papers',
'activo' => 'Active', 'activo' => 'Active',
'gramaje_duplicado' => 'It can not be selected two pieces of paper with the same grammage', 'gramaje_duplicado' => 'It can not be selected two pieces of paper with the same grammage',
'sureToChangeRotativaTitle' => 'Are you sure to change this option?', 'sureToChangeRotativaTitle' => 'Are you sure to change this option?',

View File

@ -42,14 +42,16 @@ return [
'velocidad' => 'Velocidad', 'velocidad' => 'Velocidad',
'velocidadCorte' => 'Velocidad Corte', 'velocidadCorte' => 'Velocidad Corte',
'validation' => [ 'validation' => [
'alto_menor_alto_impresion' => 'El campo \'Alto impresión\' debe ser menor que \'Alto\'',
'ancho_menor_ancho_impresion' => '\'Ancho Impresión\' debe ser menor que \'Ancho\'',
'alto' => [ 'alto' => [
'decimal' => 'El campo {field} debe contener un número decimal.', 'decimal' => 'El campo {field} debe contener un número decimal.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
], ],
'ancho' => [ 'ancho' => [
'decimal' => 'El campo {field} debe contener un número decimal.', 'decimal' => 'El campo {field} debe contener un número decimal.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
], ],
'forzar_num_formas_horizontales_portada' => [ 'forzar_num_formas_horizontales_portada' => [
@ -65,19 +67,19 @@ return [
'alto_click' => [ 'alto_click' => [
'decimal' => 'El campo {field} debe contener un número decimal.', 'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.', 'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
], ],
'alto_impresion' => [ 'alto_impresion' => [
'decimal' => 'El campo {field} debe contener un número decimal.', 'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.', 'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
], ],
'ancho_impresion' => [ 'ancho_impresion' => [
'decimal' => 'El campo {field} debe contener un número decimal.', 'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.', 'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
], ],
'duracion_jornada' => [ 'duracion_jornada' => [

View File

@ -3,6 +3,7 @@
return [ return [
'papel_impresion_maquinas' => 'Papeles impresion',
'activo' => 'Activo', 'activo' => 'Activo',
'gramaje_duplicado' => 'No se pueden seleccionar dos papeles con el mismo gramaje', 'gramaje_duplicado' => 'No se pueden seleccionar dos papeles con el mismo gramaje',
'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?', 'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?',

View File

@ -72,23 +72,23 @@ class MaquinaModel extends \App\Models\GoBaseModel
protected $validationRules = [ protected $validationRules = [
"alto" => [ "alto" => [
"label" => "Maquinas.alto", "label" => "Maquinas.alto",
"rules" => "required|decimal", "rules" => "required|decimal|greater_than[0]",
], ],
"alto_click" => [ "alto_click" => [
"label" => "Maquinas.altoClick", "label" => "Maquinas.altoClick",
"rules" => "required|decimal", "rules" => "required|decimal|greater_than[0]",
], ],
"alto_impresion" => [ "alto_impresion" => [
"label" => "Maquinas.altoImpresion", "label" => "Maquinas.altoImpresion",
"rules" => "required|decimal", "rules" => "required|decimal|greater_than[0]",
], ],
"ancho" => [ "ancho" => [
"label" => "Maquinas.ancho", "label" => "Maquinas.ancho",
"rules" => "required|decimal", "rules" => "required|decimal|greater_than[0]",
], ],
"ancho_impresion" => [ "ancho_impresion" => [
"label" => "Maquinas.anchoImpresion", "label" => "Maquinas.anchoImpresion",
"rules" => "required|decimal", "rules" => "required|decimal|greater_than[0]",
], ],
"duracion_jornada" => [ "duracion_jornada" => [
"label" => "Maquinas.duracionJornada", "label" => "Maquinas.duracionJornada",

View File

@ -69,7 +69,7 @@
<div class="card accordion-item active"> <div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne"> <h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip2" aria-expanded="false" aria-controls="accordionTip2"> <button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip2" aria-expanded="false" aria-controls="accordionTip2">
<h3><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></h3> <h3><?= lang("MaquinasPapelImpresion.papel_impresion_maquinas") ?></h3>
</button> </button>
</h2> </h2>

View File

@ -18,15 +18,9 @@
<thead> <thead>
<tr> <tr>
<th><?= lang('Maquinas.nombre') ?></th> <th><?= lang('Maquinas.nombre') ?></th>
<th><?= lang('Maquinas.padreId') ?></th>
<th><?= lang('Maquinas.tipo') ?></th> <th><?= lang('Maquinas.tipo') ?></th>
<th><?= lang('Maquinas.velocidad') ?></th> <th><?= lang('Maquinas.anchoImpresion') ?></th>
<th><?= lang('Maquinas.duracionJornada') ?></th>
<th><?= lang('Maquinas.ancho') ?></th>
<th><?= lang('Maquinas.alto') ?></th>
<th><?= lang('Maquinas.anchoImpresion') ?></th>
<th><?= lang('Maquinas.altoImpresion') ?></th> <th><?= lang('Maquinas.altoImpresion') ?></th>
<th><?= lang('Maquinas.ordenPlanning') ?></th>
<th><?= lang('Maquinas.min') ?></th> <th><?= lang('Maquinas.min') ?></th>
<th><?= lang('Maquinas.max') ?></th> <th><?= lang('Maquinas.max') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
@ -95,15 +89,9 @@
], ],
columns : [ columns : [
{ 'data': 'nombre' }, { 'data': 'nombre' },
{ 'data': 'padre' },
{ 'data': 'tipo' }, { 'data': 'tipo' },
{ 'data': 'velocidad' },
{ 'data': 'duracion_jornada' },
{ 'data': 'ancho' },
{ 'data': 'alto' },
{ 'data': 'ancho_impresion' }, { 'data': 'ancho_impresion' },
{ 'data': 'alto_impresion' }, { 'data': 'alto_impresion' },
{ 'data': 'orden_planning' },
{ 'data': 'min' }, { 'data': 'min' },
{ 'data': 'max' }, { 'data': 'max' },
{ 'data': actionBtns } { 'data': actionBtns }