mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'bug/tamanio_personalizado' into 'main'
resuelto el bug See merge request jjimenez/safekat!136
This commit is contained in:
@ -188,6 +188,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
$postData['updated_at'] = gmdate('Y-m-d H:m:s', time());
|
$postData['updated_at'] = gmdate('Y-m-d H:m:s', time());
|
||||||
|
|
||||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||||
|
|
||||||
|
|
||||||
// JJO
|
// JJO
|
||||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||||
@ -197,7 +198,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
}
|
}
|
||||||
if ($this->request->getPost('retractilado5') == null) {
|
if ($this->request->getPost('retractilado5') == null) {
|
||||||
$sanitizedData['retractilado5'] = false;
|
$sanitizedData['retractilado5'] = false;
|
||||||
}
|
}
|
||||||
if ($this->request->getPost('ferro') == null) {
|
if ($this->request->getPost('ferro') == null) {
|
||||||
$sanitizedData['ferro'] = false;
|
$sanitizedData['ferro'] = false;
|
||||||
}
|
}
|
||||||
@ -213,29 +214,51 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
if ($this->request->getPost('faja_color') == null) {
|
if ($this->request->getPost('faja_color') == null) {
|
||||||
$sanitizedData['faja_color'] = false;
|
$sanitizedData['faja_color'] = false;
|
||||||
}
|
}
|
||||||
|
if ($this->request->getPost('papel_formato_personalizado') == null) {
|
||||||
|
$sanitizedData['papel_formato_personalizado'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if($sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null
|
||||||
|
&& $sanitizedData['papel_formato_alto'] == null){
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
$data = [
|
||||||
|
'errorMensaje' => lang('Presupuestos.errores.formato_papel'),
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
return $this->respond($data);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->session->setFlashData('errorMessage', lang('Presupuestos.errores.formato_papel'));
|
||||||
|
}
|
||||||
|
$successfulResult = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) )
|
||||||
|
|
||||||
|
if ($this->canValidate()) :
|
||||||
if ($this->canValidate()) :
|
try {
|
||||||
try {
|
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
} catch (\Exception $e) {
|
||||||
} catch (\Exception $e) {
|
$noException = false;
|
||||||
$noException = false;
|
$this->dealWithException($e);
|
||||||
$this->dealWithException($e);
|
}
|
||||||
}
|
else :
|
||||||
else :
|
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]);
|
||||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Presupuestos.presupuesto'))]);
|
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$presupuestoEntity->fill($sanitizedData);
|
||||||
|
|
||||||
|
$thenRedirect = false;
|
||||||
endif;
|
endif;
|
||||||
|
}
|
||||||
|
|
||||||
$presupuestoEntity->fill($sanitizedData);
|
|
||||||
|
|
||||||
$thenRedirect = false;
|
|
||||||
endif;
|
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult) :
|
||||||
$id = $presupuestoEntity->id ?? $id;
|
$id = $presupuestoEntity->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
|
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
|
||||||
|
|||||||
@ -230,7 +230,8 @@ return [
|
|||||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
||||||
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
|
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
|
||||||
'error_servicios_anadidos' => 'Hay servicios sin datos',
|
'error_servicios_anadidos' => 'Hay servicios sin datos',
|
||||||
'error_servicios_duplicados' => 'El servicio seleccionado ya está añadido'
|
'error_servicios_duplicados' => 'El servicio seleccionado ya está añadido',
|
||||||
|
'formato_papel' => 'Debe seleccionar un formato de papel'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<div class="form-check form-switch mb-2">
|
<div class="form-check form-switch mb-2">
|
||||||
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
||||||
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
<label class="form-check-label" for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
@ -70,13 +70,13 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 col-lg-6">
|
<div class="col-md-12 col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<input style="display: none" type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
|
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|
||||||
<div class="col-md-12 col-lg-6">
|
<div class="col-md-12 col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<input style="display: none" type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
</div>
|
</div>
|
||||||
@ -341,6 +341,13 @@ $('#papelFormatoId').select2({
|
|||||||
allowClear: false,
|
allowClear: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let initTamanioPersonalizado = <?php echo ($presupuestoEntity->papel_formato_personalizado==true?1:0); ?>;
|
||||||
|
if(initTamanioPersonalizado != null){
|
||||||
|
if ( initTamanioPersonalizado){
|
||||||
|
$('#papelFormatoId').next(".select2-container").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#papelFormatoPersonalizado').on("click",function(){
|
$('#papelFormatoPersonalizado').on("click",function(){
|
||||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||||
if(checkbox.checked == true){
|
if(checkbox.checked == true){
|
||||||
|
|||||||
@ -120,38 +120,42 @@ const url_parts = url.split('/');
|
|||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
if(url_parts[url_parts.length-2] == 'edit'){
|
if(url_parts[url_parts.length-2] == 'edit'){
|
||||||
id = url_parts[url_parts.length-1];
|
id = url_parts[url_parts.length-1];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
id = -1;
|
id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#presupuestoForm').on( "submit", function( event ) {
|
$('#presupuestoForm').on( "submit", function( event ) {
|
||||||
event.preventDefault();
|
|
||||||
save_servicios();
|
event.preventDefault();
|
||||||
save_datos_envios();
|
save_servicios();
|
||||||
|
save_datos_envios();
|
||||||
|
|
||||||
|
|
||||||
$.when(fill_bbdd_from_lp(id).then(function (data, textStatus, jqXHR){
|
$.when(fill_bbdd_from_lp(id).then(function (data, textStatus, jqXHR){
|
||||||
generateCompJSON()
|
generateCompJSON()
|
||||||
form = $('#presupuestoForm').serialize()
|
form = $('#presupuestoForm').serialize()
|
||||||
form += getValuesResumenForm()
|
form += getValuesResumenForm()
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo $formAction; ?>",
|
url: "<?php echo $formAction; ?>",
|
||||||
data: form,
|
data: form,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
yeniden(data.<?= csrf_token() ?>)
|
yeniden(data.<?= csrf_token() ?>)
|
||||||
popSuccessAlert(data.mensaje)
|
if('errorMensaje' in data)
|
||||||
}
|
popErrorAlert(data.errorMensaje)
|
||||||
}).fail(function (jqXHR, textStatus, error) {
|
else
|
||||||
// Handle error here
|
popSuccessAlert(data.mensaje)
|
||||||
console.log(jqXHR)
|
}
|
||||||
});;
|
}).fail(function (jqXHR, textStatus, error) {
|
||||||
}))
|
// Handle error here
|
||||||
|
console.log(jqXHR)
|
||||||
|
});;
|
||||||
|
}))
|
||||||
|
|
||||||
return false; //stop the actual form post !important!
|
return false; //stop the actual form post !important!
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user