|
Lines 52-58
Link Here
|
| 52 |
<script> |
52 |
<script> |
| 53 |
import flatPickr from "vue-flatpickr-component" |
53 |
import flatPickr from "vue-flatpickr-component" |
| 54 |
import Toolbar from "./AgreementsToolbar.vue" |
54 |
import Toolbar from "./AgreementsToolbar.vue" |
| 55 |
import { inject, ref, reactive, computed } from "vue" |
55 |
import { inject, ref, reactive } from "vue" |
| 56 |
import { APIClient } from "../../fetch/api-client.js" |
56 |
import { APIClient } from "../../fetch/api-client.js" |
| 57 |
import { storeToRefs } from "pinia" |
57 |
import { storeToRefs } from "pinia" |
| 58 |
import { build_url } from "../../composables/datatables" |
58 |
import { build_url } from "../../composables/datatables" |
|
Lines 70-98
export default {
Link Here
|
| 70 |
|
70 |
|
| 71 |
const table = ref() |
71 |
const table = ref() |
| 72 |
|
72 |
|
| 73 |
const expiration_date = ref() |
|
|
| 74 |
const by_expired = ref(false) |
| 75 |
const by_mine = ref(false) |
| 76 |
|
| 77 |
const filters = reactive({ |
73 |
const filters = reactive({ |
| 78 |
by_expired, |
74 |
by_expired: false, |
| 79 |
max_expiration_date: computed({ |
75 |
max_expiration_date: "", |
| 80 |
get() { |
76 |
by_mine: false, |
| 81 |
if (by_expired.value) { |
|
|
| 82 |
if (!expiration_date.value) { |
| 83 |
expiration_date.value = new Date() |
| 84 |
.toISOString() |
| 85 |
.substring(0, 10) |
| 86 |
} |
| 87 |
return expiration_date.value |
| 88 |
} |
| 89 |
return "" |
| 90 |
}, |
| 91 |
set(new_date) { |
| 92 |
expiration_date.value = new_date |
| 93 |
}, |
| 94 |
}), |
| 95 |
by_mine, |
| 96 |
}) |
77 |
}) |
| 97 |
return { |
78 |
return { |
| 98 |
vendors, |
79 |
vendors, |
|
Lines 111-116
export default {
Link Here
|
| 111 |
this.filters.by_expired = |
92 |
this.filters.by_expired = |
| 112 |
this.$route.query.by_expired === "true" || false |
93 |
this.$route.query.by_expired === "true" || false |
| 113 |
this.filters.by_mine = this.$route.query.by_mine || false |
94 |
this.filters.by_mine = this.$route.query.by_mine || false |
|
|
95 |
this.filters.max_expiration_date = |
| 96 |
this.$route.query.max_expiration_date || "" |
| 114 |
|
97 |
|
| 115 |
let filters = this.filters |
98 |
let filters = this.filters |
| 116 |
|
99 |
|
|
Lines 224-229
export default {
Link Here
|
| 224 |
this.$emit("select-agreement", agreement.agreement_id) |
207 |
this.$emit("select-agreement", agreement.agreement_id) |
| 225 |
this.$emit("close") |
208 |
this.$emit("close") |
| 226 |
}, |
209 |
}, |
|
|
210 |
get_today_date: function () { |
| 211 |
return new Date().toISOString().substring(0, 10) |
| 212 |
}, |
| 227 |
table_url: function () { |
213 |
table_url: function () { |
| 228 |
let url = "/api/v1/erm/agreements" |
214 |
let url = "/api/v1/erm/agreements" |
| 229 |
if (this.filters.by_expired) |
215 |
if (this.filters.by_expired) |
|
Lines 233-245
export default {
Link Here
|
| 233 |
}, |
219 |
}, |
| 234 |
filter_table: async function () { |
220 |
filter_table: async function () { |
| 235 |
if (!this.embedded) { |
221 |
if (!this.embedded) { |
| 236 |
let filters = Object.assign({}, this.filters) |
222 |
if ( |
| 237 |
if (!filters.by_expired) { |
223 |
this.filters.by_expired && |
| 238 |
filters.max_expiration_date = null |
224 |
!this.filters.max_expiration_date |
|
|
225 |
) { |
| 226 |
this.filters.max_expiration_date = this.get_today_date() |
| 227 |
} |
| 228 |
if (!this.filters.by_expired) { |
| 229 |
this.filters.max_expiration_date = "" |
| 239 |
} |
230 |
} |
| 240 |
let new_route = build_url( |
231 |
let new_route = build_url( |
| 241 |
"/cgi-bin/koha/erm/agreements", |
232 |
"/cgi-bin/koha/erm/agreements", |
| 242 |
filters |
233 |
this.filters |
| 243 |
) |
234 |
) |
| 244 |
this.$router.push(new_route) |
235 |
this.$router.push(new_route) |
| 245 |
} |
236 |
} |
|
Lines 342-347
export default {
Link Here
|
| 342 |
this.getAgreementCount().then(() => (this.initialized = true)) |
333 |
this.getAgreementCount().then(() => (this.initialized = true)) |
| 343 |
} |
334 |
} |
| 344 |
}, |
335 |
}, |
|
|
336 |
watch: { |
| 337 |
"filters.by_expired": function (newVal, oldVal) { |
| 338 |
if (newVal) { |
| 339 |
this.filters.max_expiration_date = this.get_today_date() |
| 340 |
} else { |
| 341 |
this.filters.max_expiration_date = "" |
| 342 |
} |
| 343 |
}, |
| 344 |
}, |
| 345 |
components: { flatPickr, Toolbar, KohaTable }, |
345 |
components: { flatPickr, Toolbar, KohaTable }, |
| 346 |
props: { |
346 |
props: { |
| 347 |
embedded: { |
347 |
embedded: { |
| 348 |
- |
|
|