From b278c541d480cca7dc961eec4d84be08b073803f Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 17 Oct 2024 11:34:23 +0000 Subject: [PATCH] Bug 37930: Modify AgreementsList and FormAdd to support new AV concept Test plan 1) Navigate to ERM module 2) Click into agreements, page should load as normal 3) Click New agreement, form should load as expected 4) Fill in the required fields - note that the Status field is correctly populated with authorised values 5) Save new agreeement 6) Note that the status column in the table is correctly populated --- .../vue/components/ERM/AgreementsFormAdd.vue | 46 +++++++++---------- .../js/vue/components/ERM/AgreementsList.vue | 27 ++++++++--- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue index 645a13b5bef..6a0b8381c11 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue @@ -51,7 +51,9 @@ v-model="agreement.status" label="description" :reduce="av => av.value" - :options="av_agreement_statuses" + :options=" + authorisedValues['av_agreement_statuses'] + " @option:selected="onStatusChanged" :required="!agreement.status" > @@ -75,7 +77,11 @@ v-model="agreement.closure_reason" label="description" :reduce="av => av.value" - :options="av_agreement_closure_reasons" + :options=" + authorisedValues[ + 'av_agreement_closure_reasons' + ] + " :disabled=" agreement.status == 'closed' ? false : true " @@ -117,7 +123,11 @@ v-model="agreement.renewal_priority" label="description" :reduce="av => av.value" - :options="av_agreement_renewal_priorities" + :options=" + authorisedValues[ + 'av_agreement_renewal_priorities' + ] + " />
  • @@ -136,21 +146,23 @@
    @@ -182,25 +194,11 @@ import { storeToRefs } from "pinia" export default { setup() { - const AVStore = inject("AVStore") - const { - av_agreement_statuses, - av_agreement_closure_reasons, - av_agreement_renewal_priorities, - av_user_roles, - av_agreement_license_statuses, - av_agreement_license_location, - av_agreement_relationships, - } = storeToRefs(AVStore) + const ERMStore = inject("ERMStore") + const { authorisedValues } = storeToRefs(ERMStore) return { - av_agreement_statuses, - av_agreement_closure_reasons, - av_agreement_renewal_priorities, - av_user_roles, - av_agreement_license_statuses, - av_agreement_license_location, - av_agreement_relationships, + authorisedValues, max_allowed_packet, } }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index a22e14819af..66e10aaee3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -76,7 +76,6 @@ export default { const { setConfirmationDialog, setMessage } = inject("mainStore") const { authorisedValues } = inject("ERMStore") - console.log(authorisedValues) const table = ref() @@ -96,6 +95,7 @@ export default { escape_str, agreement_table_settings, filters, + authorisedValues, } }, data: function () { @@ -125,16 +125,25 @@ export default { e["_str"] = e["name"] return e }), - 3: () => this.map_av_dt_filter("av_agreement_statuses"), + 3: () => + this.map_av_dt_filter( + this.authorisedValues["av_agreement_statuses"] + ), 4: () => - this.map_av_dt_filter("av_agreement_closure_reasons"), + this.map_av_dt_filter( + this.authorisedValues[ + "av_agreement_closure_reasons" + ] + ), 5: [ { _id: 0, _str: this.$__("No") }, { _id: 1, _str: this.$__("Yes") }, ], 6: () => this.map_av_dt_filter( - "av_agreement_renewal_priorities" + this.authorisedValues[ + "av_agreement_renewal_priorities" + ] ), }, actions: { @@ -251,6 +260,7 @@ export default { getTableColumns: function () { let get_lib_from_av = this.get_lib_from_av let escape_str = this.escape_str + let AVs = this.authorisedValues return [ { @@ -296,7 +306,10 @@ export default { orderable: true, render: function (data, type, row, meta) { return escape_str( - get_lib_from_av("av_agreement_statuses", row.status) + get_lib_from_av( + AVs["av_agreement_statuses"], + row.status + ) ) }, }, @@ -308,7 +321,7 @@ export default { render: function (data, type, row, meta) { return escape_str( get_lib_from_av( - "av_agreement_closure_reasons", + AVs["av_agreement_closure_reasons"], row.closure_reason ) ) @@ -333,7 +346,7 @@ export default { render: function (data, type, row, meta) { return escape_str( get_lib_from_av( - "av_agreement_renewal_priorities", + AVs["av_agreement_renewal_priorities"], row.renewal_priority ) ) -- 2.39.3 (Apple Git-146)