-
-
Save theprincy/3a04d54329cf19b9502247f47d5341c0 to your computer and use it in GitHub Desktop.
Mensagem de Confirmação - Scriptcase e Sweet Alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
?> | |
<style> | |
/*CSS PARA OCULTAR DOIS CAMPOS E DOIS LABELS*/ | |
.css_qtd_min__label, .css_qtd_max__label, .css_qtd_min__line, .css_qtd_max__line { | |
display: none !important; | |
} | |
</style> | |
<script> | |
/*FUNÇÃO DO SCRIPTCASE ALTERADA*/ | |
function cm_atualiza_line(x, y) { | |
if (Nm_Proc_Atualiz) { | |
return; | |
} | |
z = document.getElementById("idVertRow" + y).rowIndex; | |
document.F1.nmgp_parms.value = ""; | |
document.F1.target = "_self"; | |
document.F1.nmgp_opcao.value = x; | |
var qtdMin = parseInt($("#id_sc_field_qtd_min_"+y).val()); | |
var qtdMax = parseInt($("#id_sc_field_qtd_max_"+y).val()); | |
var qtdAtual = parseInt($("#id_sc_field_qtd_"+y).val()); | |
if (x == "excluir") { | |
Swal.fire({ | |
title: 'Cuidado!', | |
text: 'Deseja mesmo excluir este registro?', | |
type: 'warning', | |
showCancelButton: true, | |
confirmButtonColor: '#59b479', | |
cancelButtonColor: '#e36e6e', | |
cancelButtonText: 'Desistir', | |
confirmButtonText: 'Sim, excluir agora!' | |
}).then((result) => { | |
if (result.value) { | |
Swal.fire( | |
'Pronto!', | |
'O registro foi excluído com sucesso.', | |
'success' | |
) | |
Nm_Proc_Atualiz = true; | |
do_ajax_cadastro_inventario_submit_form(y, z); | |
} else { | |
return; | |
} | |
Nm_Proc_Atualiz = false; | |
}); | |
} | |
if (x == "alterar") { | |
if((qtdAtual < qtdMin) || (qtdAtual > qtdMax)) { | |
Swal.fire( | |
'Ops!', | |
'Este produto não pode ter sua quantidade menor que ' + qtdMin + ' e maior que ' + qtdMax + '.', | |
'error' | |
); | |
} else { | |
Swal.fire({ | |
title: 'Cuidado!', | |
text: "Deseja mesmo atualizar este registro ?", | |
type: 'warning', | |
showCancelButton: true, | |
confirmButtonColor: '#59b479', | |
cancelButtonColor: '#e36e6e', | |
cancelButtonText: 'Cancelar', | |
confirmButtonText: 'Sim, atualizar agora!' | |
}).then((result) => { | |
if (result.value) { | |
Swal.fire( | |
'Pronto!', | |
'O registro foi atualizado com sucesso.', | |
'success' | |
) | |
Nm_Proc_Atualiz = true; | |
do_ajax_cadastro_inventario_submit_form(y, z); | |
} else { | |
return; | |
} | |
Nm_Proc_Atualiz = false; | |
}); | |
} | |
} | |
if (x == "incluir") { | |
if((qtdAtual < qtdMin) || (qtdAtual > qtdMax)) { | |
Swal.fire( | |
'Ops!', | |
'Este produto não pode ter sua quantidade menor que ' + qtdMin + ' e maior que ' + qtdMax + '.', | |
'error' | |
); | |
} else { | |
Nm_Proc_Atualiz = true; | |
do_ajax_cadastro_inventario_submit_form(y, z); | |
} | |
} | |
} | |
$(function(){ | |
/*FUNÇÃO PARA ALTERAR O NOME DAS FUNÇÕES ATRIBUIDAS NO EVENTO ONCLICK DOS ÍCONES*/ | |
setInterval(function(){ | |
$( "td.scFormDataOddMult a" ).each(function( index ) { | |
if($(this).attr("onclick")) { | |
var strOnClick = $(this).attr("onclick"); | |
var newAtributo = strOnClick.replace("nm_atualiza_line", "cm_atualiza_line"); | |
$(this).attr("onclick", newAtributo); | |
} | |
}); | |
}, 1000); | |
}); | |
</script> | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment