@@ -, +, @@
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 @@
+