I have a legacy system of record control and it is working perfectly with regards to recording the data in a bank, but I am trying to adapt it and I am not getting it.
The current script shows dialog
more, I only need to show only dialog
which informs if the record was inserted successfully or if an error occurred, I would like to delete the first one that is presented.
I'm using this project: Bootstrap 3 Dialog
I already have this:
function DlgInserirFase() {
//Dialog de inserção de dados
BootstrapDialog.show({
//title: 'Fase',
// message: $('<div id="divNotas"></div>').load('frmMural.html'),
closable: false,
buttons: [{
//icon: 'glyphicon glyphicon-send',
//label: 'Gravar',
//cssClass: 'btn-primary',
//autospin: true,
action: function(dialogRef){
//Chama o validate do formulário
// $('#frmFase').validate();
//if ($('#frmFase').valid() == true) {
//dialogRef.enableButtons(false);
// dialogRef.setClosable(false);
var params = {
Operacao: 'Inserir',
dTipoFase: $('#dTipoFase').val(),
dData: $('#dData').val(),
dHora: $('#dHora').val(),
dDescricao: $('#dDescricao').val(),
IdContrato: $("input[name=IdContrato]").val(),
};
// GravaFase(params);
$.post(
'ProcessoFase.php',
params,
function( json, textStatus, jQxhr ){
if (json.status != "ERRO") {
var dialogInstance = BootstrapDialog.show({
title: 'SUCESSO',
type: BootstrapDialog.TYPE_SUCCESS,
message: json.msg,
closable: false,
buttons: [
{
label: 'Fechar',
cssClass: 'btn-success',
action: function(dialogRef){
dialogRef.close();
location.reload();
}
}
]
});
} else {
var dialogInstance = BootstrapDialog.show({
title: 'ERRO',
type: BootstrapDialog.TYPE_DANGER,
message: json.msg,
closable: false,
buttons: [
{
label: 'Fechar',
cssClass: 'btn-danger',
action: function(dialogRef){
dialogRef.close();
// location.reload();
}
}
]
});
}
},
'json'
)
.fail(function( jqXhr, textStatus, errorThrown ){
try {
var json = $.parseJSON(jqXHR.responseText);
var dialogInstance = BootstrapDialog.show({
title: 'ERRO',
type: BootstrapDialog.TYPE_DANGER,
message: json.msg
});
} catch(e) {
var dialogInstance = BootstrapDialog.show({
title: 'ERRO',
type: BootstrapDialog.TYPE_DANGER,
message: json.msg
});
}
});
dialogRef.close();
//}
}
},
{
label: 'Cancelar',
cssClass: 'btn-danger',
action: function(dialogRef){
dialogRef.close();
}
}]
});
}