@@ -43,24 +43,12 @@ className: "bg-danger",
4343 url: route,
4444 type: ' DELETE' ,
4545 success : function (result ) {
46- if (result != 1 ) {
47- // Show an error alert
48- swal ({
49- title: " {!! trans (' backpack::crud.delete_confirmation_not_title' ) ! !}" ,
50- text: result[' error' ] ? result[' error' ] : " {!! trans (' backpack::crud.delete_confirmation_not_message' ) ! !}" ,
51- icon: " error" ,
52- timer: 4000 ,
53- buttons: false ,
54- });
55- } else {
56- // Show a success message
57- swal ({
58- title: " {!! trans (' backpack::crud.delete_confirmation_title' ) ! !}" ,
59- text: " {!! trans (' backpack::crud.delete_confirmation_message' ) ! !}" ,
60- icon: " success" ,
61- timer: 4000 ,
62- buttons: false ,
63- });
46+ if (result == 1 ) {
47+ // Show a success notification bubble
48+ new Noty ({
49+ type: " success" ,
50+ text: " {!! ' <strong>' . trans (' backpack::crud.delete_confirmation_title' ). ' </strong><br>' . trans (' backpack::crud.delete_confirmation_message' ) ! !}"
51+ }).show ();
6452
6553 // Hide the modal, if any
6654 $ (' .modal' ).modal (' hide' );
@@ -72,13 +60,36 @@ className: "bg-danger",
7260
7361 // Remove the row from the datatable
7462 row .remove ();
63+ } else {
64+ // if the result is an array, it means
65+ // we have notification bubbles to show
66+ if (result instanceof Object ) {
67+ // trigger one or more bubble notifications
68+ Object .entries (result).forEach (function (entry , index ) {
69+ var type = entry[0 ];
70+ entry[1 ].forEach (function (message , i ) {
71+ new Noty ({
72+ type: type,
73+ text: message
74+ }).show ();
75+ });
76+ });
77+ } else {// Show an error alert
78+ swal ({
79+ title: " {!! trans (' backpack::crud.delete_confirmation_not_title' ) ! !}" ,
80+ text: " {!! trans (' backpack::crud.delete_confirmation_not_message' ) ! !}" ,
81+ icon: " error" ,
82+ timer: 4000 ,
83+ buttons: false ,
84+ });
85+ }
7586 }
7687 },
7788 error : function (result ) {
7889 // Show an alert with the result
7990 swal ({
8091 title: " {!! trans (' backpack::crud.delete_confirmation_not_title' ) ! !}" ,
81- text: result[ ' error ' ] ? result[ ' error ' ] : " {!! trans (' backpack::crud.delete_confirmation_not_message' ) ! !}" ,
92+ text: " {!! trans (' backpack::crud.delete_confirmation_not_message' ) ! !}" ,
8293 icon: " error" ,
8394 timer: 4000 ,
8495 buttons: false ,
0 commit comments