@@ -18,23 +18,32 @@ function deleteEntry(button) {
18
18
url: route,
19
19
type: ' DELETE' ,
20
20
success : function (result ) {
21
- // Show an alert with the result
22
- new PNotify ({
23
- title: " {{ trans (' backpack::crud.delete_confirmation_title' ) } }" ,
24
- text: " {{ trans (' backpack::crud.delete_confirmation_message' ) } }" ,
25
- type: " success"
26
- });
21
+ if (result != 1 ) {
22
+ // Show an error alert
23
+ new PNotify ({
24
+ title: " {{ trans (' backpack::crud.delete_confirmation_not_title' ) } }" ,
25
+ text: " {{ trans (' backpack::crud.delete_confirmation_not_message' ) } }" ,
26
+ type: " warning"
27
+ });
28
+ } else {
29
+ // Show a success alert with the result
30
+ new PNotify ({
31
+ title: " {{ trans (' backpack::crud.delete_confirmation_title' ) } }" ,
32
+ text: " {{ trans (' backpack::crud.delete_confirmation_message' ) } }" ,
33
+ type: " success"
34
+ });
27
35
28
- // Hide the modal, if any
29
- $ (' .modal' ).modal (' hide' );
36
+ // Hide the modal, if any
37
+ $ (' .modal' ).modal (' hide' );
30
38
31
- // Remove the details row, if it is open
32
- if (row .hasClass (" shown" )) {
33
- row .next ().remove ();
34
- }
39
+ // Remove the details row, if it is open
40
+ if (row .hasClass (" shown" )) {
41
+ row .next ().remove ();
42
+ }
35
43
36
- // Remove the row from the datatable
37
- row .remove ();
44
+ // Remove the row from the datatable
45
+ row .remove ();
46
+ }
38
47
},
39
48
error : function (result ) {
40
49
// Show an alert with the result
0 commit comments