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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue (+56 lines)
Lines 95-100 Link Here
95
            </div>
95
            </div>
96
        </div>
96
        </div>
97
    </div>
97
    </div>
98
    <div
99
        class="component modal"
100
        role="dialog"
101
        v-if="componentDialog"
102
        id="component"
103
    >
104
        <div class="modal-dialog">
105
            <div class="modal-content modal-lg">
106
                <div class="modal-header alert-warning component">
107
                    <h1 v-html="componentDialog.title"></h1>
108
                </div>
109
                <div class="modal-body">
110
                    <component
111
                        v-if="requiredComponent"
112
                        :is="requiredComponent"
113
                        v-bind="componentDialog.componentProps"
114
                        v-on="componentDialog.componentListeners"
115
                    />
116
                </div>
117
                <div class="modal-footer">
118
                    <button
119
                        id="close_modal"
120
                        class="btn btn-default deny cancel"
121
                        type="button"
122
                        data-bs-dismiss="modal"
123
                        @click="removeConfirmationMessages"
124
                    >
125
                        <i class="fa fa-fw fa-remove"></i>
126
                        <span v-html="componentDialog.cancel_label"></span>
127
                    </button>
128
                </div>
129
            </div>
130
        </div>
131
    </div>
98
132
99
    <div class="modal_centered" v-if="is_submitting">
133
    <div class="modal_centered" v-if="is_submitting">
100
        <div class="spinner alert alert-warning">
134
        <div class="spinner alert alert-warning">
Lines 115-123 import { Link Here
115
    reactive,
149
    reactive,
116
    computed,
150
    computed,
117
    useTemplateRef,
151
    useTemplateRef,
152
    defineAsyncComponent,
118
} from "vue";
153
} from "vue";
119
import { storeToRefs } from "pinia";
154
import { storeToRefs } from "pinia";
120
import FormElement from "./FormElement.vue";
155
import FormElement from "./FormElement.vue";
156
import { loadComponent } from "@koha-vue/loaders/componentResolver";
121
157
122
export default {
158
export default {
123
    setup() {
159
    setup() {
Lines 127-132 export default { Link Here
127
            error,
163
            error,
128
            warning,
164
            warning,
129
            confirmation,
165
            confirmation,
166
            componentDialog,
130
            accept_callback,
167
            accept_callback,
131
            is_submitting,
168
            is_submitting,
132
            is_loading,
169
            is_loading,
Lines 186-196 export default { Link Here
186
            });
223
            });
187
        });
224
        });
188
225
226
        watch(componentDialog, newComponentDialog => {
227
            if (!newComponentDialog) {
228
                $("#component.modal").modal("hide");
229
                return;
230
            }
231
            nextTick(() => {
232
                $("#component.modal").modal("show");
233
            });
234
        });
235
236
        const requiredComponent = computed(() => {
237
            if (!componentDialog.value?.componentPath) return null;
238
            return defineAsyncComponent(
239
                loadComponent(componentDialog.value.componentPath)
240
            );
241
        });
242
189
        return {
243
        return {
190
            message,
244
            message,
191
            error,
245
            error,
192
            warning,
246
            warning,
193
            confirmation,
247
            confirmation,
248
            componentDialog,
194
            accept_callback,
249
            accept_callback,
195
            is_submitting,
250
            is_submitting,
196
            is_loading,
251
            is_loading,
Lines 199-204 export default { Link Here
199
            fp_config,
254
            fp_config,
200
            submit,
255
            submit,
201
            inputFields,
256
            inputFields,
257
            requiredComponent,
202
        };
258
        };
203
    },
259
    },
204
    components: {
260
    components: {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js (-1 / +6 lines)
Lines 10-15 export const useMainStore = defineStore("main", () => { Link Here
10
        accept_callback: null,
10
        accept_callback: null,
11
        previousMessage: null,
11
        previousMessage: null,
12
        previousError: null,
12
        previousError: null,
13
        componentDialog: null,
13
        displayed_already: false,
14
        displayed_already: false,
14
        is_submitting: false,
15
        is_submitting: false,
15
        is_loading: false,
16
        is_loading: false,
Lines 66-71 export const useMainStore = defineStore("main", () => { Link Here
66
            this.displayed_already =
67
            this.displayed_already =
67
                displayed; /* Is displayed on the current view */
68
                displayed; /* Is displayed on the current view */
68
        },
69
        },
70
        setComponentDialog(componentDialog, displayed = true) {
71
            this.componentDialog = componentDialog;
72
            this.displayed_already =
73
                displayed; /* Is displayed on the current view */
74
        },
69
        removeMessages() {
75
        removeMessages() {
70
            if (this.displayed_already) {
76
            if (this.displayed_already) {
71
                this.error = null;
77
                this.error = null;
72
- 

Return to bug 39320