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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ButtonSubmit.vue (-6 / +1 lines)
Lines 1-16 Link Here
1
<template>
1
<template>
2
    <button
2
    <button
3
        v-if="form"
3
        @click="form && form.value.requestSubmit()"
4
        @click="form.value.requestSubmit()"
5
        class="btn btn-primary"
4
        class="btn btn-primary"
6
    >
5
    >
7
        <font-awesome-icon v-if="icon" :icon="icon" />
6
        <font-awesome-icon v-if="icon" :icon="icon" />
8
        {{ title }}
7
        {{ title }}
9
    </button>
8
    </button>
10
    <button v-else type="submit" class="btn btn-primary">
11
        <font-awesome-icon v-if="icon" :icon="icon" />
12
        {{ title }}
13
    </button>
14
</template>
9
</template>
15
10
16
<script>
11
<script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue (-6 / +6 lines)
Lines 810-827 export default { Link Here
810
            delete agreement.agreement_packages;
810
            delete agreement.agreement_packages;
811
811
812
            if (agreement_id) {
812
            if (agreement_id) {
813
                baseResource.apiClient.update(agreement, agreement_id).then(
813
                return baseResource.apiClient.update(agreement, agreement_id).then(
814
                    success => {
814
                    agreement => {
815
                        baseResource.setMessage($__("Agreement updated"));
815
                        baseResource.setMessage($__("Agreement updated"));
816
                        baseResource.router.push({ name: "AgreementsList" });
816
                        return agreement
817
                    },
817
                    },
818
                    error => {}
818
                    error => {}
819
                );
819
                );
820
            } else {
820
            } else {
821
                baseResource.apiClient.create(agreement).then(
821
                return baseResource.apiClient.create(agreement).then(
822
                    success => {
822
                    agreement => {
823
                        baseResource.setMessage($__("Agreement created"));
823
                        baseResource.setMessage($__("Agreement created"));
824
                        baseResource.router.push({ name: "AgreementsList" });
824
                        return agreement
825
                    },
825
                    },
826
                    error => {}
826
                    error => {}
827
                );
827
                );
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceFormSave.vue (-1 / +21 lines)
Lines 14-20 Link Here
14
            :componentPropData="{ ...$props, ...$data, resourceForm }"
14
            :componentPropData="{ ...$props, ...$data, resourceForm }"
15
        />
15
        />
16
        <form
16
        <form
17
            @submit="instancedResource.onFormSave($event, resourceToSave)"
17
            @submit="saveAndNavigate($event, resourceToSave)"
18
            ref="resourceForm"
18
            ref="resourceForm"
19
        >
19
        >
20
            <TabsWrapper
20
            <TabsWrapper
Lines 154-164 export default { Link Here
154
                initialized.value = true;
154
                initialized.value = true;
155
            }
155
            }
156
        });
156
        });
157
158
        const saveAndNavigate = ($event, resourceToSave) => {
159
            const { components, navigationOnFormSave, onFormSave, router, idAttr } = props.instancedResource
160
            // Default to show
161
            const navigationAction = navigationOnFormSave || components.show
162
            const idParamRequired = navigationAction === components.show || navigationAction === components.edit
163
            onFormSave($event, resourceToSave).then(resource => {
164
                if(resource) {
165
                    router.push({
166
                        name: navigationAction,
167
                        ...(idParamRequired && {
168
                            params: {
169
                                [idAttr]: resource[idAttr]
170
                            }
171
                        })
172
                    })
173
                }
174
            })
175
        }
157
        return {
176
        return {
158
            initialized,
177
            initialized,
159
            resource,
178
            resource,
160
            resourceToSave,
179
            resourceToSave,
161
            resourceForm,
180
            resourceForm,
181
            saveAndNavigate
162
        };
182
        };
163
    },
183
    },
164
    props: {
184
    props: {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SkeletonResource.vue (+2 lines)
Lines 108-113 export default { Link Here
108
            props: props,
108
            props: props,
109
            additionalToolbarButtons,
109
            additionalToolbarButtons,
110
            defaultToolbarButtons,
110
            defaultToolbarButtons,
111
            // The default behaviour for the below is the "show" component so is not necessary if this is the desired behaviour
112
            navigationOnFormSave: "SkeletonsList"
111
        });
113
        });
112
114
113
        /*
115
        /*
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js (-1 / +1 lines)
Lines 42-47 import { Link Here
42
 * @param {Function} resourceConfig.additionalToolbarButtons - A function to add additional buttons to the toolbar.
42
 * @param {Function} resourceConfig.additionalToolbarButtons - A function to add additional buttons to the toolbar.
43
 * @param {String} resourceConfig.formGroupsDisplayMode - The display mode for the form groups if not the default. Can be one of the following: "accordion", "tabs".
43
 * @param {String} resourceConfig.formGroupsDisplayMode - The display mode for the form groups if not the default. Can be one of the following: "accordion", "tabs".
44
 * @param {Array} resourceConfig.stickyToolbar - The names of the components with a toolbar that should be sticky.
44
 * @param {Array} resourceConfig.stickyToolbar - The names of the components with a toolbar that should be sticky.
45
 * @param {Array} resourceConfig.navigationOnFormSave - The name of the component that should be navigated to when saving the resource creation/edit form. Defaults to the show component
45
 *
46
 *
46
 * @return {Object} An object containing the utilities provided by this composable.
47
 * @return {Object} An object containing the utilities provided by this composable.
47
 */
48
 */
48
- 

Return to bug 40191