terminado con un mensaje de alerta cuando se duplican y tienen tipologías

This commit is contained in:
Jaime Jiménez
2024-03-09 18:48:35 +01:00
parent 6428224921
commit bd7ab73e75
9 changed files with 150 additions and 27 deletions

View File

@ -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() ?>

View File

@ -33,7 +33,6 @@
</div>
<!-- /Logo -->
<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">
<?= csrf_field() ?>

View File

@ -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();
@ -2768,7 +2768,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
datos.amarillo= $('#lp_rot_bn_cobAmarillo').val()
}
$.ajax({
await $.ajax({
type: "POST",
url: "/cosidotapablanda/datatable",
data: datos,
@ -2826,11 +2826,12 @@ function change_lp_rot_bn_tipologia(){
){
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 &&
parseInt($('#lp_rot_bn_papel option:selected').val())>0 &&
@ -2838,7 +2839,7 @@ function por_defecto_lp_rot_bn(){
parseInt($('#lp_rot_bn_papelImpresion option:selected').val())>0
){
calcularPresupuesto_rot_bn(false);
calcularPresupuesto_rot_bn(false);
}
}

View File

@ -57,6 +57,7 @@
</div><!--//.col -->
</div><!--//.row -->
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
<?= $this->endSection() ?>
@ -65,29 +66,44 @@
<!------------------------------------------->
<?php if (str_contains($formAction, 'edit')): ?>
<?= $this->section("additionalInlineJs") ?>
$('#cloneForm').on('click', function(e) {
$.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;
$('#cloneForm').on('click', async function(e) {
// se comprueba que no haya lineas de presupuesto en el que exista la variable gotaNegro
var gotaNegro = false
$("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rowData = this.data();
if(rowData.hasOwnProperty('gotaNegro')){
gotaNegro = true
return;
}
}).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)
});
})
}
});