|
Lines 1-7
Link Here
|
| 1 |
<template> |
1 |
<template> |
| 2 |
<div v-if="!initialized">{{ $__("Loading") }}</div> |
2 |
<div v-if="!initialized">{{ $__("Loading") }}</div> |
| 3 |
<div v-else id="agreements_list"> |
3 |
<div v-else id="agreements_list"> |
| 4 |
<Toolbar v-if="before_route_entered" /> |
4 |
<Toolbar v-if="!embedded" /> |
| 5 |
<fieldset v-if="agreement_count > 0" class="filters"> |
5 |
<fieldset v-if="agreement_count > 0" class="filters"> |
| 6 |
<label for="expired_filter">{{ $__("Filter by expired") }}:</label> |
6 |
<label for="expired_filter">{{ $__("Filter by expired") }}:</label> |
| 7 |
<input |
7 |
<input |
|
Lines 100-107
export default {
Link Here
|
| 100 |
fp_config: flatpickr_defaults, |
100 |
fp_config: flatpickr_defaults, |
| 101 |
agreement_count: 0, |
101 |
agreement_count: 0, |
| 102 |
initialized: false, |
102 |
initialized: false, |
| 103 |
before_route_entered: false, |
|
|
| 104 |
building_table: false, |
| 105 |
tableOptions: { |
103 |
tableOptions: { |
| 106 |
columns: this.getTableColumns(), |
104 |
columns: this.getTableColumns(), |
| 107 |
options: { embed: "user_roles,vendor" }, |
105 |
options: { embed: "user_roles,vendor" }, |
|
Lines 143-153
export default {
Link Here
|
| 143 |
}, |
141 |
}, |
| 144 |
beforeRouteEnter(to, from, next) { |
142 |
beforeRouteEnter(to, from, next) { |
| 145 |
next(vm => { |
143 |
next(vm => { |
| 146 |
vm.before_route_entered = true // FIXME This is ugly, but we need to distinguish when it's used as main component or child component (from EHoldingsEBSCOPAckagesShow for instance) |
144 |
vm.getAgreementCount().then(() => (vm.initialized = true)) |
| 147 |
if (!vm.building_table) { |
|
|
| 148 |
vm.building_table = true |
| 149 |
vm.getAgreementCount().then(() => (vm.initialized = true)) |
| 150 |
} |
| 151 |
}) |
145 |
}) |
| 152 |
}, |
146 |
}, |
| 153 |
methods: { |
147 |
methods: { |
|
Lines 210-216
export default {
Link Here
|
| 210 |
this.$emit("close") |
204 |
this.$emit("close") |
| 211 |
}, |
205 |
}, |
| 212 |
filter_table: async function () { |
206 |
filter_table: async function () { |
| 213 |
if (this.before_route_entered) { |
207 |
if (!embedded) { |
| 214 |
let new_route = build_url( |
208 |
let new_route = build_url( |
| 215 |
"/cgi-bin/koha/erm/agreements", |
209 |
"/cgi-bin/koha/erm/agreements", |
| 216 |
this.filters |
210 |
this.filters |
|
Lines 314-326
export default {
Link Here
|
| 314 |
}, |
308 |
}, |
| 315 |
}, |
309 |
}, |
| 316 |
mounted() { |
310 |
mounted() { |
| 317 |
// We this component is mounted from EHoldingsEBSCOPackageAgreements |
311 |
if (this.embedded) { |
| 318 |
if (!this.building_table) { |
|
|
| 319 |
this.building_table = true |
| 320 |
this.getAgreementCount().then(() => (this.initialized = true)) |
312 |
this.getAgreementCount().then(() => (this.initialized = true)) |
| 321 |
} |
313 |
} |
| 322 |
}, |
314 |
}, |
| 323 |
components: { flatPickr, Toolbar, KohaTable }, |
315 |
components: { flatPickr, Toolbar, KohaTable }, |
|
|
316 |
props: { |
| 317 |
embedded: { |
| 318 |
type: Boolean, |
| 319 |
default: false, |
| 320 |
}, |
| 321 |
}, |
| 324 |
name: "AgreementsList", |
322 |
name: "AgreementsList", |
| 325 |
emits: ["select-agreement", "close"], |
323 |
emits: ["select-agreement", "close"], |
| 326 |
} |
324 |
} |