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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue (-8 / +19 lines)
Lines 181-195 export default { Link Here
181
            av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE",
181
            av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE",
182
            av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE",
182
            av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE",
183
        }
183
        }
184
        let promises = []
184
185
        Object.entries(authorised_values).forEach(([av_var, av_cat]) => {
185
        let av_cat_array = Object.keys(authorised_values).map(function (
186
            promises.push(
186
            av_cat
187
                av_client.values.getAll(av_cat).then(av => {
187
        ) {
188
                    this.AVStore[av_var] = av
188
            return '"' + authorised_values[av_cat] + '"'
189
                })
190
            )
191
        })
189
        })
192
        Promise.all(promises).then(() => (this.mainStore.is_loading = false))
190
191
        av_client.values
192
            .getCategoriesWithValues(av_cat_array)
193
            .then(av_categories => {
194
                Object.entries(authorised_values).forEach(
195
                    ([av_var, av_cat]) => {
196
                        const av_match = av_categories.find(
197
                            element => element.category_name == av_cat
198
                        )
199
                        this.AVStore[av_var] = av_match.authorised_values
200
                    }
201
                )
202
            })
203
            .then(() => (this.mainStore.is_loading = false))
193
    },
204
    },
194
    components: {
205
    components: {
195
        Breadcrumb,
206
        Breadcrumb,
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values.js (-5 / +8 lines)
Lines 3-18 import HttpClient from "./http-client"; Link Here
3
export class AVAPIClient extends HttpClient {
3
export class AVAPIClient extends HttpClient {
4
    constructor() {
4
    constructor() {
5
        super({
5
        super({
6
            baseURL: "/api/v1/authorised_value_categories/",
6
            baseURL: "/api/v1/authorised_value_categories",
7
        });
7
        });
8
    }
8
    }
9
9
10
    get values() {
10
    get values() {
11
        return {
11
        return {
12
            getAll: (category_name, query) =>
12
            getCategoriesWithValues: (cat_array) =>
13
                this.get({
13
                this.get({
14
                    endpoint: category_name + "/values?" + (query || "_per_page=-1"),
14
                    endpoint: "?q={\"me.category_name\":["+(cat_array.join(", "))+"]}",
15
                }),
15
                    headers: {
16
                        "x-koha-embed":
17
                            "authorised_values",
18
                    },
19
            }),
16
        };
20
        };
17
    }
21
    }
18
}
22
}
19
- 

Return to bug 32983