1
|
|
|
jaxon.dialogs.jconfirm = { |
2
|
|
|
dialog: null, |
3
|
|
|
show: (args) => { |
4
|
|
|
// Add buttons |
5
|
|
|
for(key in args.data.buttons) |
6
|
|
|
{ |
7
|
|
|
button = args.data.buttons[key]; |
8
|
|
|
button.action = button.action !== 'close' ? new Function(button.action) : |
9
|
|
|
() => jaxon.dialogs.jconfirm.dialog.close(); |
10
|
|
|
} |
11
|
|
|
args.data.closeIcon = true; |
12
|
|
|
if((jaxon.dialogs.jconfirm.dialog)) |
13
|
|
|
{ |
14
|
|
|
jaxon.dialogs.jconfirm.dialog.close(); |
15
|
|
|
} |
16
|
|
|
jaxon.dialogs.jconfirm.dialog = $.confirm(args.data); |
17
|
|
|
}, |
18
|
|
|
hide: (args) => { |
19
|
|
|
if((jaxon.dialogs.jconfirm.dialog)) |
20
|
|
|
{ |
21
|
|
|
jaxon.dialogs.jconfirm.dialog.close(); |
22
|
|
|
} |
23
|
|
|
jaxon.dialogs.jconfirm.dialog = null; |
24
|
|
|
}, |
25
|
|
|
success: (content, title) => $.alert({content: content, title: title, type: 'green', icon: 'fa fa-success'}), |
26
|
|
|
info: (content, title) => $.alert({content: content, title: title, type: 'blue', icon: 'fa fa-info'}), |
27
|
|
|
warning: (content, title) => $.alert({content: content, title: title, type: 'orange', icon: 'fa fa-warning'}), |
28
|
|
|
error: (content, title) => $.alert({content: content, title: title, type: 'red', icon: 'fa fa-error'}), |
29
|
|
|
confirm: (question, title, yesCallback, noCallback) => $.confirm({ |
30
|
|
|
title: title, |
31
|
|
|
content: question, |
32
|
|
|
buttons: { |
33
|
|
|
yes: { |
34
|
|
|
btnClass: "btn-blue", |
35
|
|
|
text: "<?php echo $this->yes ?>", |
36
|
|
|
action: yesCallback |
37
|
|
|
}, |
38
|
|
|
no: { |
39
|
|
|
text: "<?php echo $this->no ?>", |
40
|
|
|
action: noCallback ?? (() => {}), |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
}), |
44
|
|
|
}; |
45
|
|
|
|