mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado con un mensaje de alerta cuando se duplican y tienen tipologías
This commit is contained in:
@ -383,6 +383,69 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
} // end function edit(...)
|
} // end function edit(...)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the designated resource object from the model.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return array an array
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
|
||||||
|
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc).'.'.static::$singularObjectNameCc));
|
||||||
|
} else {
|
||||||
|
$objName = lang('Basic.global.record');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->soft_delete){
|
||||||
|
|
||||||
|
if (!$this->model->delete($id)) {
|
||||||
|
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||||
|
$rawResult = $this->model->where('id',$id)
|
||||||
|
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||||
|
'is_deleted' => $this->delete_flag])
|
||||||
|
->update();
|
||||||
|
if (!$rawResult) {
|
||||||
|
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se borran las lineas de presupuesto
|
||||||
|
$model = new PresupuestoLineaModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran las direcciones de presupuesto
|
||||||
|
$model = new PresupuestoDireccionesModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran los servicios de acabado
|
||||||
|
$model = new PresupuestoAcabadosModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran los servicios de preimpresion
|
||||||
|
$model = new PresupuestoPreimpresionesModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran los servicios de encuadernacion
|
||||||
|
$model = new PresupuestoEncuadernacionesModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// Se borran los servicios de manipulado
|
||||||
|
$model = new PresupuestoManipuladosModel();
|
||||||
|
$model->where("presupuesto_id", $id)->delete();
|
||||||
|
|
||||||
|
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||||
|
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||||
|
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function datatable()
|
public function datatable()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -156,6 +156,8 @@ return [
|
|||||||
'cantidad' => 'Quantity',
|
'cantidad' => 'Quantity',
|
||||||
'duplicado' => 'DUPLICATED',
|
'duplicado' => 'DUPLICATED',
|
||||||
|
|
||||||
|
'duplicarConTipologias' => 'The budget contains budget lines with typology data. The budget will be duplicated with the same typologies',
|
||||||
|
|
||||||
'validation' => [
|
'validation' => [
|
||||||
'decimal' => 'The {field} field must contain a decimal number.',
|
'decimal' => 'The {field} field must contain a decimal number.',
|
||||||
'integer' => 'The {field} field must contain an integer.',
|
'integer' => 'The {field} field must contain an integer.',
|
||||||
|
|||||||
@ -248,6 +248,8 @@ return [
|
|||||||
'tiradaImpresion' => 'Coste Impresión',
|
'tiradaImpresion' => 'Coste Impresión',
|
||||||
'duplicado' => 'DUPLICADO',
|
'duplicado' => 'DUPLICADO',
|
||||||
|
|
||||||
|
'duplicarConTipologias' => 'El presupuesto contiene lineas de presupuesto con datos de tipologías. Se va a duplicar el presupuesto con las mismas tipologías',
|
||||||
|
|
||||||
|
|
||||||
'validation' => [
|
'validation' => [
|
||||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||||
|
|||||||
@ -424,6 +424,8 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -196,12 +196,14 @@ class PresupuestoService extends BaseService
|
|||||||
|
|
||||||
$resultado_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, is_array($tipo) ? 'color' : $tipo);
|
$resultado_tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, is_array($tipo) ? 'color' : $tipo);
|
||||||
if($resultado_tarifa == null){
|
if($resultado_tarifa == null){
|
||||||
|
/*
|
||||||
$info = [
|
$info = [
|
||||||
'maquina_id' => $maquina->maquina_id,
|
'maquina_id' => $maquina->maquina_id,
|
||||||
'uso' => $uso,
|
'uso' => $uso,
|
||||||
'tipo' => is_array($tipo) ? 'color' : $tipo
|
'tipo' => is_array($tipo) ? 'color' : $tipo
|
||||||
];
|
];
|
||||||
log_message("error","No se ha encontrado tarifa para la maquina {maquina_id} y el uso {uso} y el tipo {tipo}", $info);
|
log_message("error","No se ha encontrado tarifa para la maquina {maquina_id} y el uso {uso} y el tipo {tipo}", $info);
|
||||||
|
*/
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
<div id="modalMessage" class="modal fade">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 id="labelTitleMessageDialog" class="modal-title"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p id="labelMsgMessageDialog"></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button id="okButton"
|
||||||
|
type="button"
|
||||||
|
class="btn btn-primary"
|
||||||
|
><?= lang('Basic.global.ok') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
|
|
||||||
|
function asyncMessageDialog(title, msg, callback) {
|
||||||
|
var $messageDialog = $("#modalMessage");
|
||||||
|
$messageDialog.modal('show');
|
||||||
|
$("#labelTitleMessageDialog").html(title);
|
||||||
|
$("#labelMsgMessageDialog").html(msg);
|
||||||
|
$("#okButton").off('click').click(function () {
|
||||||
|
callback();
|
||||||
|
$confirmDialog.modal("hide");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +33,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /Logo -->
|
<!-- /Logo -->
|
||||||
<h3 class="mb-1 fw-bold"><?= lang("App.login_title") ?> 👋</h3>
|
<h3 class="mb-1 fw-bold"><?= lang("App.login_title") ?> 👋</h3>
|
||||||
<p class="mb-4"><?= lang("App.login_subtitle") ?></p>
|
|
||||||
|
|
||||||
<form id="formAuthentication" class="mb-3" action="<?= site_url('login/authenticate'); ?>" method="POST">
|
<form id="formAuthentication" class="mb-3" action="<?= site_url('login/authenticate'); ?>" method="POST">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
|
|||||||
@ -2722,7 +2722,7 @@ function change_lp_rot_bn_aFavorFibra(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=false, input_data={}){
|
async function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=false, input_data={}){
|
||||||
|
|
||||||
const dimension = getDimensionLibro();
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
@ -2768,7 +2768,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
|
|||||||
datos.amarillo= $('#lp_rot_bn_cobAmarillo').val()
|
datos.amarillo= $('#lp_rot_bn_cobAmarillo').val()
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
await $.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/cosidotapablanda/datatable",
|
url: "/cosidotapablanda/datatable",
|
||||||
data: datos,
|
data: datos,
|
||||||
@ -2826,11 +2826,12 @@ function change_lp_rot_bn_tipologia(){
|
|||||||
){
|
){
|
||||||
|
|
||||||
calcularPresupuesto_rot_bn(false,true);
|
calcularPresupuesto_rot_bn(false,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function por_defecto_lp_rot_bn(){
|
function por_defecto_lp_rot_bn(wait_result = false){
|
||||||
|
|
||||||
if( parseInt($('#lp_rot_bn_paginas').val())>0 &&
|
if( parseInt($('#lp_rot_bn_paginas').val())>0 &&
|
||||||
parseInt($('#lp_rot_bn_papel option:selected').val())>0 &&
|
parseInt($('#lp_rot_bn_papel option:selected').val())>0 &&
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
|
||||||
|
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
@ -65,29 +66,44 @@
|
|||||||
<!------------------------------------------->
|
<!------------------------------------------->
|
||||||
<?php if (str_contains($formAction, 'edit')): ?>
|
<?php if (str_contains($formAction, 'edit')): ?>
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
$('#cloneForm').on('click', function(e) {
|
$('#cloneForm').on('click', async function(e) {
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
|
|
||||||
|
|
||||||
data: {
|
// se comprueba que no haya lineas de presupuesto en el que exista la variable gotaNegro
|
||||||
tipo: 'duplicar',
|
var gotaNegro = false
|
||||||
presupuesto_id: id,
|
$("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
var rowData = this.data();
|
||||||
},
|
if(rowData.hasOwnProperty('gotaNegro')){
|
||||||
dataType: 'json',
|
gotaNegro = true
|
||||||
success:function(response){
|
return;
|
||||||
|
|
||||||
token=response.<?= csrf_token() ?>;
|
|
||||||
yeniden(token);
|
|
||||||
// redirect
|
|
||||||
new_location = '<?= site_url("presupuestos/cosidotapablanda/edit/") ?>' + response.id
|
|
||||||
window.location.href = new_location;
|
|
||||||
}
|
}
|
||||||
}).fail(function (jqXHR, textStatus, error) {
|
})
|
||||||
// Handle error here
|
|
||||||
console.log(jqXHR)
|
if(gotaNegro){
|
||||||
});
|
asyncMessageDialog('<?= lang("Basic.global.Warning") ?>', '<?= lang("Presupuestos.duplicarConTipologias") ?>', function() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
|
||||||
|
|
||||||
|
data: {
|
||||||
|
tipo: 'duplicar',
|
||||||
|
presupuesto_id: id,
|
||||||
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success:function(response){
|
||||||
|
|
||||||
|
token=response.<?= csrf_token() ?>;
|
||||||
|
yeniden(token);
|
||||||
|
// redirect
|
||||||
|
new_location = '<?= site_url("presupuestos/cosidotapablanda/edit/") ?>' + response.id
|
||||||
|
window.location.href = new_location;
|
||||||
|
}
|
||||||
|
}).fail(function (jqXHR, textStatus, error) {
|
||||||
|
// Handle error here
|
||||||
|
console.log(jqXHR)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user