mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
corregidos errores
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -12,8 +13,8 @@ use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
|
||||
class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
@ -69,9 +70,9 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -81,10 +82,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -98,14 +99,14 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -129,25 +130,25 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$maquinasTarifasImpresion = $this->model->find($id);
|
||||
|
||||
if ($maquinasTarifasImpresion == false) :
|
||||
if ($maquinasTarifasImpresion == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -160,10 +161,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
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 {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -180,12 +181,12 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $maquinasTarifasImpresion->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -220,30 +221,48 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
$response = Editor::inst($db, 'lg_maquinas_tarifas_impresion')
|
||||
->fields(
|
||||
Field::inst('uso')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.uso.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.uso.required')
|
||||
)
|
||||
),
|
||||
Field::inst('tipo')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('precio')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('margen')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('maquina_id'),
|
||||
Field::inst('user_created_id'),
|
||||
@ -269,16 +288,21 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
'maquina_id' => $values['maquina_id'],
|
||||
'tipo' => $values['tipo'],
|
||||
'uso' => $values['uso'],
|
||||
'is_deleted' => 0));
|
||||
'is_deleted' => 0
|
||||
));
|
||||
|
||||
$id = $builder->get()->getFirstRow()->id;
|
||||
$id = $builder->get()->getFirstRow();
|
||||
if ($id) {
|
||||
$id = $id->id;
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if ($builder->countAllResults() >= 1) {
|
||||
if (
|
||||
($action === Editor::ACTION_EDIT && $id != $pkey)
|
||||
|| $action === Editor::ACTION_CREATE
|
||||
) {
|
||||
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if ($builder->countAllResults() >= 1) {
|
||||
if (($action === Editor::ACTION_EDIT && $id != $pkey)
|
||||
|| $action === Editor::ACTION_CREATE) {
|
||||
|
||||
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
|
||||
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,11 +437,11 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
protected function getMaquinaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
|
||||
if (!empty($selId)) :
|
||||
if (!empty($selId)):
|
||||
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -132,7 +132,9 @@
|
||||
<div id="form_buttons" class="row col-sm-12 justify-content-center" style="display: none;">
|
||||
|
||||
</div>
|
||||
<?= view("themes/vuexy/components/chat_internal_presupuesto",data:["modelId" => $presupuestoId,"type" => "presupuesto"]) ?>
|
||||
<?php if($formAction == 'edit'): ?>
|
||||
<?= view("themes/vuexy/components/chat_internal_presupuesto",data:["modelId" => $presupuestoId,"type" => "presupuesto"]) ?>
|
||||
<?php endif; ?>
|
||||
</div><!--//.row -->
|
||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
|
||||
|
||||
@ -79,6 +79,7 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -145,9 +146,21 @@ class PresupuestoCliente {
|
||||
if (datos_to_check.direcciones) {
|
||||
delete datos_to_check.direcciones;
|
||||
}
|
||||
if (datos_to_check.posPaginasColor) {
|
||||
if (datos_to_check.posPaginasColor == "" || datos_to_check.posPaginasColor == null) {
|
||||
delete datos_to_check.posPaginasColor;
|
||||
}
|
||||
if(datos_to_check.cubierta.acabados.barniz == undefined){
|
||||
delete datos_to_check.cubierta.acabados.barniz;
|
||||
}
|
||||
if(datos_to_check.cubierta.acabados.plastificado == undefined){
|
||||
delete datos_to_check.cubierta.acabados.plastificado;
|
||||
}
|
||||
if(datos_to_check.cubierta.acabados.estampado == undefined){
|
||||
delete datos_to_check.cubierta.acabados.estampado;
|
||||
}
|
||||
if(datos_to_check.sobrecubierta.plastificado == undefined){
|
||||
delete datos_to_check.sobrecubierta.plastificado;
|
||||
}
|
||||
|
||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||
try {
|
||||
@ -352,7 +365,7 @@ class PresupuestoCliente {
|
||||
$(`#containerTiradasEnvios .tirada-envio input[tirada="${response.tiradas[0]}"]`).trigger('click');
|
||||
}, 0);
|
||||
}
|
||||
|
||||
$('#loader').modal('hide');
|
||||
// DEBUG
|
||||
//console.log(response);
|
||||
}
|
||||
@ -420,7 +433,6 @@ class PresupuestoCliente {
|
||||
|
||||
cubierta: {
|
||||
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||
lomoRedondo: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0,
|
||||
papelCubierta: this.disenioCubierta.getPapel(),
|
||||
gramajeCubierta: this.disenioCubierta.getGramaje(),
|
||||
cabezada: this.disenioCubierta.getCabezada(),
|
||||
@ -438,6 +450,10 @@ class PresupuestoCliente {
|
||||
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
},
|
||||
};
|
||||
let lomoRedondo = 0;
|
||||
if(this.disenioCubierta.disenioCubierta.filter('.selected').length > 0)
|
||||
lomoRedondo = this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0;
|
||||
this.datos.cubierta.lomoRedondo = lomoRedondo;
|
||||
|
||||
if (this.datos.tipo == "cosido") {
|
||||
this.datos.paginasCuadernillo = this.datosGenerales.paginasCuadernillo.val();
|
||||
|
||||
Reference in New Issue
Block a user