From 0aeeafba2826b3902b4bfc6c50c498204419aa27 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 20 Oct 2020 13:32:03 -0300 Subject: [PATCH] Bug 15522: (Vue alternative) Add vue scripts This patch adds vue scripts for circulation rules To test: 1. Apply all patches 2. restart_all 3. yarn install 4. yarn run build 5. go to circulation rules in staff interface You'll notice the working area is divided in 3 parts.. On the left you've got a list area. That list area has a combo where you can choose between libraries, patron categories and item types. What you choose there are the rules you'll be watching and editing. The middle area is where rules are shown. That area is divided by circulation rules, fines rules and hold rules, and each of that sections are divided by rules specific for libraries, libraries and categories, libraries and item types or libraries, categories and item types. To edit a rule click on the pencil icon in the section title. If you're editing default values (Values for all libraries, categories or item types) the corresponding edit control (input, select, etc) is shown. If you are editing for a particular library, category or item type, above the editing control you get a checkbox to use default value or to overwrite that rule. In the area to the right you've got a label with the currently selected library, category or item type. If when selecting items in the list area you do ctrl+click (cmd+click on mac) you can select multiple elements from the list. All selected elements will appear in the right area. Notice that only one of them is still selected. You can rapidly change from one selected item to the other by clicking on those labels --- .../js/src/admin/components/datepicker.vue | 33 ++ .../admin/policy/components/policyMain.vue | 351 ++++++++++++++++++ .../admin/policy/components/policySidebar.vue | 102 +++++ .../admin/policy/components/policyTags.vue | 68 ++++ .../prog/js/src/admin/policy/main.d.ts | 22 ++ .../prog/js/src/admin/policy/main.ts | 73 ++++ 6 files changed, 649 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/components/datepicker.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyMain.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policySidebar.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyTags.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.d.ts create mode 100644 koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.ts diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/components/datepicker.vue b/koha-tmpl/intranet-tmpl/prog/js/src/admin/components/datepicker.vue new file mode 100644 index 0000000000..60fdf9605e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/components/datepicker.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyMain.vue b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyMain.vue new file mode 100644 index 0000000000..901dbdbbaa --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyMain.vue @@ -0,0 +1,351 @@ + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policySidebar.vue b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policySidebar.vue new file mode 100644 index 0000000000..51cf2798a2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policySidebar.vue @@ -0,0 +1,102 @@ + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyTags.vue b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyTags.vue new file mode 100644 index 0000000000..1ddb64aacb --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/components/policyTags.vue @@ -0,0 +1,68 @@ + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.d.ts b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.d.ts new file mode 100644 index 0000000000..3ad6aec7e3 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.d.ts @@ -0,0 +1,22 @@ +declare function _ (text: string, ...params: any[]): string +declare function $ (text: string, ...params: any[]): any +declare function validate_date (date: string, obj: object): void +declare function is_valid_date (date: string): boolean + +type KOHA = { + BRANCHES: object, + ITEM_TYPES: object, + PATRON_CATEGORIES: object +} + +declare interface String { + format(...string):string +} + +type HUMANMSG = { + displayMsg(string, any): void, + displayAlert(string, any): void +} + +declare var Koha: KOHA + declare var humanMsg:HUMANMSG \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.ts b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.ts new file mode 100644 index 0000000000..7d0b07ff7e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/src/admin/policy/main.ts @@ -0,0 +1,73 @@ +/// + +import {createApp} from "vue/dist/vue.esm-bundler"; +// @ts-ignore +import PolicySidebar from "./components/policySidebar.vue"; +// @ts-ignore +import PolicyMain from "./components/policyMain.vue"; +// @ts-ignore +import PolicyTags from "./components/policyTags.vue"; + + +createApp({ + template: ` +
+
+

{{title}}

+
+ + +
+
+
+
+ + + +
+
+ `, + data() { + return { + title: _('Circulation, fines, and holds rules'), + current: {}, + selected: {}, + doSave: false, + doClear: false, + edited: [], + saved: false + } + }, + computed: { + libraries() { + const libs = Object.keys(Koha.BRANCHES).map(code => { + return {code, name: Koha.BRANCHES[code].branchname, show: true} + }) + return [{code: '', name: _('All libraries'), show: true}].concat(libs) + }, + categories() { + const cats = Object.keys(Koha.PATRON_CATEGORIES).map(code => { + return {code, name: Koha.PATRON_CATEGORIES[code].description, show: true} + }) + return [{code: '', name: _('All categories'), show: true}].concat(cats) + }, + itemtypes() { + const itypes = Object.keys(Koha.ITEM_TYPES).map(code => { + return {code, name: Koha.ITEM_TYPES[code].description, show: true} + }) + return [{code: '', name: _('All item types'), show: true}].concat(itypes) + } + }, + methods: { + setEdited(edited) { + this.edited = edited + this.doSave = false + this.doClear = false + } + }, + components: { + PolicySidebar, + PolicyMain, + PolicyTags + } +}).mount("#vue-base"); \ No newline at end of file -- 2.25.0