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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue (-9 / +10 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(av_cat){return "\""+authorised_values[av_cat]+"\""});
186
            promises.push(
186
187
                av_client.values.getAll(av_cat).then(av => {
187
        av_client.values.getCategoriesWithValues(av_cat_array).then(av_categories => {
188
                    this.AVStore[av_var] = av
188
            Object.entries(authorised_values).forEach(([av_var, av_cat]) => {
189
                })
189
                const av_match = av_categories.find(element => element.category_name ==  av_cat);
190
            )
190
                this.AVStore[av_var] = av_match.authorised_values;
191
        })
191
192
        Promise.all(promises).then(() => (this.mainStore.is_loading = false))
192
            })
193
        }).then(() => (this.mainStore.is_loading = false));
193
    },
194
    },
194
    components: {
195
    components: {
195
        Breadcrumb,
196
        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