From dd9fa6e62608cc4ba3f7c0076807043f78a774bf Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 14 Sep 2023 12:35:08 +0000 Subject: [PATCH] Bug 34788: Add Vue components, api client and navigation route This patch adds a new component to handle the file import, a route to that component and the API client route needed to access the API Signed-off-by: Clemens Tubach --- .../ERM/EHoldingsLocalTitlesKBARTImport.vue | 124 ++++++++++++++++++ .../ERM/EHoldingsLocalTitlesList.vue | 17 +++ .../prog/js/vue/fetch/erm-api-client.js | 5 + .../intranet-tmpl/prog/js/vue/routes/erm.js | 9 ++ 4 files changed, 155 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue new file mode 100644 index 0000000000..6d2269db54 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue index 7a0dc98edc..3c261bc897 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue @@ -102,6 +102,23 @@ export default { }, }, cannot_search: false, + toolbar_options: [ + { + to: "EHoldingsLocalTitlesFormAdd", + icon: "plus", + button_title: this.$__("New title"), + }, + { + to: "EHoldingsLocalTitlesFormImport", + icon: "plus", + button_title: this.$__("Import from list"), + }, + { + to: "EHoldingsLocalTitlesKBARTImport", + icon: "plus", + button_title: this.$__("Import from KBART file"), + }, + ], } }, beforeRouteEnter(to, from, next) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js index f563f61701..c69dada53b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js @@ -189,6 +189,11 @@ export class ERMAPIClient extends HttpClient { endpoint: "eholdings/local/titles/import", body, }), + import_kbart: body => + this.post({ + endpoint: "eholdings/local/titles/import_kbart", + body, + }), }; } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js index 4f2331bdda..46c10babbf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js @@ -7,6 +7,7 @@ import AgreementsFormAdd from "../components/ERM/AgreementsFormAdd.vue"; import EHoldingsLocalPackagesFormAdd from "../components/ERM/EHoldingsLocalPackagesFormAdd.vue"; import EHoldingsLocalTitlesFormAdd from "../components/ERM/EHoldingsLocalTitlesFormAdd.vue"; import EHoldingsLocalTitlesFormImport from "../components/ERM/EHoldingsLocalTitlesFormImport.vue"; +import EHoldingsLocalTitlesKBARTImport from "../components/ERM/EHoldingsLocalTitlesKBARTImport.vue"; import EHoldingsLocalPackagesList from "../components/ERM/EHoldingsLocalPackagesList.vue"; import EHoldingsLocalPackagesShow from "../components/ERM/EHoldingsLocalPackagesShow.vue"; import EHoldingsLocalResourcesShow from "../components/ERM/EHoldingsLocalResourcesShow.vue"; @@ -200,6 +201,14 @@ export const routes = [ ), title: $__("Import from a list"), }, + { + path: "kbart-import", + name: "EHoldingsLocalTitlesKBARTImport", + component: markRaw( + EHoldingsLocalTitlesKBARTImport + ), + title: $__("Import from a KBART file"), + }, { path: "/cgi-bin/koha/erm/eholdings/local/resources/:resource_id", name: "EHoldingsLocalResourcesShow", -- 2.39.2