@@ -, +, @@ Licenses --- .../js/vue/components/ERM/LicensesFormAdd.vue | 12 +++++ .../js/vue/components/ERM/LicensesList.vue | 51 ++++++++++++++++++- .../js/vue/components/ERM/LicensesShow.vue | 13 ++++- .../prog/js/vue/fetch/erm-api-client.js | 2 +- 4 files changed, 74 insertions(+), 4 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue +++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue @@ -109,6 +109,11 @@ + { - vm.getLicenseCount().then(() => (vm.initialized = true)) + vm.getLicenseCount().then(() => + vm + .getSearchableAdditionalFields() + .then(() => + vm + .getSearchableAVOptions() + .then(() => (vm.initialized = true)) + ) + ) }) }, methods: { @@ -102,6 +114,41 @@ export default { error => {} ) }, + async getSearchableAdditionalFields() { + const client = APIClient.additional_fields + await client.additional_fields.getAll("erm_licenses").then( + searchable_additional_fields => { + this.searchable_additional_fields = + searchable_additional_fields.filter( + field => field.searchable + ) + }, + error => {} + ) + }, + async getSearchableAVOptions() { + const client_av = APIClient.authorised_values + let av_cat_array = this.searchable_additional_fields + .filter(field => field.authorised_value_category) + .map(field => field.authorised_value_category) + + await client_av.values + .getCategoriesWithValues([ + ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')), + ]) // unique + .then(av_categories => { + av_cat_array.forEach(av_cat => { + let av_match = av_categories.find( + element => element.category_name == av_cat + ) + this.searchable_av_options[av_cat] = + av_match.authorised_values.map(av => ({ + value: av.value, + label: av.description, + })) + }) + }) + }, doShow: function ({ license_id }, dt, event) { event.preventDefault() this.$router.push({ name: "LicensesShow", params: { license_id } }) --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue +++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesShow.vue @@ -132,6 +132,12 @@ +
import { inject } from "vue" import { APIClient } from "../../fetch/api-client.js" +import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue" export default { setup() { @@ -177,6 +184,8 @@ export default { type: "", status: "", user_roles: [], + extended_attributes: [], + _strings: [], started_on: undefined, ended_on: undefined, }, @@ -227,7 +236,9 @@ export default { ) }, }, - components: {}, + components: { + AdditionalFieldsDisplay, + }, name: "LicensesShow", } --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js +++ a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js @@ -66,7 +66,7 @@ export class ERMAPIClient extends HttpClient { endpoint: "licenses/" + id, headers: { "x-koha-embed": - "user_roles,user_roles.patron,vendor,documents", + "user_roles,user_roles.patron,vendor,documents,extended_attributes,+strings", }, }), getAll: (query, params) => --