View | Details | Raw Unified | Return to bug 32991
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue (-4 / +7 lines)
Lines 8-16 Link Here
8
            {{ $__("Close") }}
8
            {{ $__("Close") }}
9
        </button>
9
        </button>
10
    </div>
10
    </div>
11
    <div class="modal_centered" v-if="confirmation">
11
    <div class="modal_centered" v-if="confirmation_title">
12
        <div class="dialog alert confirmation">
12
        <div class="dialog alert confirmation">
13
            <h1 v-html="confirmation"></h1>
13
            <h1 v-html="confirmation_title"></h1>
14
            <p v-html="confirmation_message"></p>
14
            <button
15
            <button
15
                v-if="accept_callback"
16
                v-if="accept_callback"
16
                id="accept_modal"
17
                id="accept_modal"
Lines 46-52 export default { Link Here
46
            message,
47
            message,
47
            error,
48
            error,
48
            warning,
49
            warning,
49
            confirmation,
50
            confirmation_title,
51
            confirmation_message,
50
            accept_callback,
52
            accept_callback,
51
            is_submitting,
53
            is_submitting,
52
            is_loading,
54
            is_loading,
Lines 56-62 export default { Link Here
56
            message,
58
            message,
57
            error,
59
            error,
58
            warning,
60
            warning,
59
            confirmation,
61
            confirmation_title,
62
            confirmation_message,
60
            accept_callback,
63
            accept_callback,
61
            is_submitting,
64
            is_submitting,
62
            is_loading,
65
            is_loading,
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue (-5 / +9 lines)
Lines 49-55 export default { Link Here
49
        const AVStore = inject("AVStore")
49
        const AVStore = inject("AVStore")
50
        const { get_lib_from_av, map_av_dt_filter } = AVStore
50
        const { get_lib_from_av, map_av_dt_filter } = AVStore
51
51
52
        const { setConfirmation, setMessage } = inject("mainStore")
52
        const { setConfirmationDialog, setMessage } = inject("mainStore")
53
53
54
        const table_id = "agreement_list"
54
        const table_id = "agreement_list"
55
        useDataTable(table_id)
55
        useDataTable(table_id)
Lines 59-65 export default { Link Here
59
            get_lib_from_av,
59
            get_lib_from_av,
60
            map_av_dt_filter,
60
            map_av_dt_filter,
61
            table_id,
61
            table_id,
62
            setConfirmation,
62
            setConfirmationDialog,
63
            setMessage,
63
            setMessage,
64
        }
64
        }
65
    },
65
    },
Lines 114-122 export default { Link Here
114
                "/cgi-bin/koha/erm/agreements/edit/" + agreement_id
114
                "/cgi-bin/koha/erm/agreements/edit/" + agreement_id
115
            )
115
            )
116
        },
116
        },
117
        delete_agreement: function (agreement_id) {
117
        delete_agreement: function (agreement_id, agreement_name) {
118
            this.setConfirmation(
118
            this.setConfirmationDialog(
119
                this.$__("Are you sure you want to remove this agreement?"),
119
                this.$__("Are you sure you want to remove this agreement?"),
120
                agreement_name,
120
                () => {
121
                () => {
121
                    const client = APIClient.erm
122
                    const client = APIClient.erm
122
                    client.agreements.delete(agreement_id).then(
123
                    client.agreements.delete(agreement_id).then(
Lines 338-344 export default { Link Here
338
                                            class: "btn btn-default btn-xs",
339
                                            class: "btn btn-default btn-xs",
339
                                            role: "button",
340
                                            role: "button",
340
                                            onClick: () => {
341
                                            onClick: () => {
341
                                                delete_agreement(agreement_id)
342
                                                delete_agreement(
343
                                                    agreement_id,
344
                                                    api.row(tr).data().name
345
                                                )
342
                                            },
346
                                            },
343
                                        },
347
                                        },
344
                                        [
348
                                        [
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js (-10 / +18 lines)
Lines 5-11 export const useMainStore = defineStore("main", { Link Here
5
        _message: null,
5
        _message: null,
6
        _error: null,
6
        _error: null,
7
        _warning: null,
7
        _warning: null,
8
        _confirmation: null,
8
        _confirmation_title: null,
9
        _confirmation_message: null,
9
        _accept_callback: null,
10
        _accept_callback: null,
10
        previousMessage: null,
11
        previousMessage: null,
11
        previousError: null,
12
        previousError: null,
Lines 18-41 export const useMainStore = defineStore("main", { Link Here
18
            this._error = null;
19
            this._error = null;
19
            this._warning = null;
20
            this._warning = null;
20
            this._message = message;
21
            this._message = message;
21
            this._confirmation = null;
22
            this._confirmation_title = null;
23
            this._confirmation_message = null;
22
            this.displayed_already = displayed; /* Will be displayed on the next view */
24
            this.displayed_already = displayed; /* Will be displayed on the next view */
23
        },
25
        },
24
        setError(error, displayed = true) {
26
        setError(error, displayed = true) {
25
            this._error = error;
27
            this._error = error;
26
            this._warning = null;
28
            this._warning = null;
27
            this._message = null;
29
            this._message = null;
28
            this._confirmation = null;
30
            this._confirmation_title = null;
31
            this._confirmation_message = null;
29
            this.displayed_already = displayed; /* Is displayed on the current view */
32
            this.displayed_already = displayed; /* Is displayed on the current view */
30
        },
33
        },
31
        setWarning(warning, displayed = true) {
34
        setWarning(warning, displayed = true) {
32
            this._error = null;
35
            this._error = null;
33
            this._warning = warning;
36
            this._warning = warning;
34
            this._message = null;
37
            this._message = null;
35
            this._confirmation = null;
38
            this._confirmation_title = null;
39
            this._confirmation_message = null;
36
            this.displayed_already = displayed; /* Is displayed on the current view */
40
            this.displayed_already = displayed; /* Is displayed on the current view */
37
        },
41
        },
38
        setConfirmation(confirmation, accept_callback, displayed = true){
42
        setConfirmationDialog(confirmation_title, confirmation_message, accept_callback, displayed = true){
39
            if(accept_callback) {
43
            if(accept_callback) {
40
                this._accept_callback = async () => {
44
                this._accept_callback = async () => {
41
                    await accept_callback()
45
                    await accept_callback()
Lines 45-51 export const useMainStore = defineStore("main", { Link Here
45
            this._error = null;
49
            this._error = null;
46
            this._warning = null;
50
            this._warning = null;
47
            this._message = null;
51
            this._message = null;
48
            this._confirmation = confirmation;
52
            this._confirmation_title = confirmation_title;
53
            this._confirmation_message = confirmation_message;
49
            this.displayed_already = displayed; /* Is displayed on the current view */
54
            this.displayed_already = displayed; /* Is displayed on the current view */
50
        },
55
        },
51
        removeMessages() {
56
        removeMessages() {
Lines 53-59 export const useMainStore = defineStore("main", { Link Here
53
                this._error = null;
58
                this._error = null;
54
                this._warning = null;
59
                this._warning = null;
55
                this._message = null;
60
                this._message = null;
56
                this._confirmation = null;
61
                this._confirmation_title = null;
62
                this._confirmation_message = null;
57
                this._accept_callback = null;
63
                this._accept_callback = null;
58
            }
64
            }
59
            this.displayed_already = true;
65
            this.displayed_already = true;
Lines 81-88 export const useMainStore = defineStore("main", { Link Here
81
        message() {
87
        message() {
82
            return this._message
88
            return this._message
83
        },
89
        },
84
        confirmation() {
90
        confirmation_title() {
85
            return this._confirmation
91
            return this._confirmation_title
92
        },
93
        confirmation_message() {
94
            return this._confirmation_message
86
        },
95
        },
87
        accept_callback() {
96
        accept_callback() {
88
            return this._accept_callback
97
            return this._accept_callback
89
- 

Return to bug 32991