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

This commit is contained in:
Jaime Jimenez
2023-07-21 12:32:29 +02:00
parent 80e6739bf8
commit 25deec2017
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 ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
//JJO: comprobar alto y ancho impresion < alto y ancho
if($sanitizedData['alto'] < $sanitizedData['alto_impresion']){
$successfulResult = false;
$this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');;
$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:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
@ -190,7 +204,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
$maquina->fill($sanitizedData);
$thenRedirect = true;
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
$id = $maquina->id ?? $id;

View File

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

View File

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

View File

@ -42,14 +42,16 @@ return [
'velocidad' => 'Velocidad',
'velocidadCorte' => 'Velocidad Corte',
'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' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
],
'ancho' => [
'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' => [
@ -65,19 +67,19 @@ return [
'alto_click' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
],
'alto_impresion' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
],
'ancho_impresion' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
'greater_than' => 'El campo {field} debe ser mayor que {param}',
],
'duracion_jornada' => [

View File

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

View File

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

View File

@ -69,7 +69,7 @@
<div class="card accordion-item active">
<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">
<h3><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></h3>
<h3><?= lang("MaquinasPapelImpresion.papel_impresion_maquinas") ?></h3>
</button>
</h2>

View File

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