Bugzilla – Attachment 149676 Details for
Bug 33490
Agreements - Filter by expired results in error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33490: Use computed values
Bug-33490-Use-computed-values.patch (text/plain), 4.89 KB, created by
Jonathan Druart
on 2023-04-14 12:32:44 UTC
(
hide
)
Description:
Bug 33490: Use computed values
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-14 12:32:44 UTC
Size:
4.89 KB
patch
obsolete
>From 64d75063463ed9aeefa404baeb8a1c763f59a6ce Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 14 Apr 2023 12:05:44 +0200 >Subject: [PATCH] Bug 33490: Use computed values > >--- > .../js/vue/components/ERM/AgreementsList.vue | 65 ++++++++++--------- > 1 file changed, 34 insertions(+), 31 deletions(-) > >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 da59bb5743c..54271a09bad 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 >@@ -9,14 +9,13 @@ > id="expired_filter" > v-model="filters.by_expired" > @keyup.enter="filter_table" >- @change="updateMaxExpirationDate($event)" > /> > {{ $__("on") }} > <flat-pickr > id="max_expiration_date_filter" >- v-model="this.filters.max_expiration_date" >+ v-model="filters.max_expiration_date" > :config="fp_config" >- :disabled="is_fp_disabled" >+ :disabled="!filters.by_expired" > /> > > <label for="by_mine_filter">{{ $__("Show mine only") }}:</label> >@@ -53,7 +52,7 @@ > <script> > import flatPickr from "vue-flatpickr-component" > import Toolbar from "./AgreementsToolbar.vue" >-import { inject, ref, reactive } from "vue" >+import { inject, ref, reactive, computed } from "vue" > import { APIClient } from "../../fetch/api-client.js" > import { storeToRefs } from "pinia" > import { build_url } from "../../composables/datatables" >@@ -71,12 +70,30 @@ export default { > > const table = ref() > >+ const expiration_date = ref() >+ const by_expired = ref(false) >+ const by_mine = ref(false) >+ > const filters = reactive({ >- by_expired: false, >- max_expiration_date: "", >- by_mine: "", >+ by_expired, >+ max_expiration_date: computed({ >+ get() { >+ if (by_expired.value) { >+ if (!expiration_date.value) { >+ expiration_date.value = new Date() >+ .toISOString() >+ .substring(0, 10) >+ } >+ return expiration_date.value >+ } >+ return "" >+ }, >+ set(new_date) { >+ expiration_date.value = new_date >+ }, >+ }), >+ by_mine, > }) >- > return { > vendors, > get_lib_from_av, >@@ -91,18 +108,15 @@ export default { > } > }, > data: function () { >- this.filters = { >- by_expired: this.$route.query.by_expired === "true" || false, >- max_expiration_date: this.$route.query.max_expiration_date || "", >- by_mine: this.$route.query.by_mine || false, >- } >+ this.filters.by_expired = >+ this.$route.query.by_expired === "true" || false >+ this.filters.by_mine = this.$route.query.by_mine || false >+ > let filters = this.filters >- this.updateMaxExpirationDate() // Set date to today if empty > > let logged_in_user = this.logged_in_user > return { > fp_config: flatpickr_defaults, >- is_fp_disabled: !filters.by_expired, > agreement_count: 0, > initialized: false, > tableOptions: { >@@ -218,30 +232,19 @@ export default { > return url > }, > filter_table: async function () { >- this.updateMaxExpirationDate() > if (!this.embedded) { >+ let filters = Object.assign({}, this.filters) >+ if (!filters.by_expired) { >+ filters.max_expiration_date = null >+ } > let new_route = build_url( > "/cgi-bin/koha/erm/agreements", >- this.filters >+ filters > ) > this.$router.push(new_route) > } > this.$refs.table.redraw(this.table_url()) > }, >- updateMaxExpirationDate: function (event) { >- if (event) { >- this.is_fp_disabled = !event.target.checked >- } >- if ( >- this.filters.by_expired && >- (!this.filters.max_expiration_date || >- this.filters.max_expiration_date === "") >- ) { >- this.filters.max_expiration_date = new Date() >- .toISOString() >- .substring(0, 10) >- } >- }, > getTableColumns: function () { > let get_lib_from_av = this.get_lib_from_av > let escape_str = this.escape_str >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33490
:
149519
|
149521
|
149522
|
149523
|
149603
|
149604
|
149615
|
149643
|
149652
|
149661
|
149672
|
149673
|
149674
|
149675
|
149676
|
150038
|
150039
|
150040
|
150048
|
150194
|
150195
|
150196
|
150197
|
150198
|
150199
|
150200
|
150201