Skip to content

Commit

Permalink
add custom type notificatio in ajax del
Browse files Browse the repository at this point in the history
  • Loading branch information
yaza-putu committed Mar 5, 2023
1 parent d9410a8 commit 5ce2363
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion helper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const versioningCdnUrl = "V2.0.2";
const versioningCdnUrl = "V2.0.3";
const confirmSweetFinishDefault = {
text : "Click the ? button to return to the previous page",
cancelButtonFirst : "Continue",
Expand Down Expand Up @@ -412,7 +412,7 @@ function ajaxGet(url, blockUi = false) {
}

// ajax Delete
function ajaxDel(url, id,reload = false, table = null, confirmSweetDelete = null) {
function ajaxDel(url, id,reload = false,typeNotification = 'sweetSuccess', table = null, confirmSweetDelete = null) {
const title = confirmSweetDelete == null ? confirmSweetDeleteDefault.title : confirmSweetDelete.title;
const body = confirmSweetDelete == null ? confirmSweetDeleteDefault.body : confirmSweetDelete.body;
const buttonLabel = confirmSweetDelete == null ? confirmSweetDeleteDefault.buttonLabel : confirmSweetDelete.buttonLabel;
Expand All @@ -434,7 +434,22 @@ function ajaxDel(url, id,reload = false, table = null, confirmSweetDelete = null
dataType: 'json',
success: function (res) {
if (res.success == true) {
new notifySuccess(res.message);
if(typeNotification == 'sweetSuccess') {
sweetSuccess(res.message);
}

if (typeNotification == 'notifySuccess') {
notifySuccess(res.message);
}

if (typeNotification == 'toastSuccess') {
toastSuccess(res.message);
}

if (typeNotification == 'snackbarSuccess') {
snackbarSuccess(res.message);
}

if(table !== null)
{
reloadTable(table);
Expand Down

0 comments on commit 5ce2363

Please sign in to comment.