This commit is contained in:
2022-09-24 00:23:30 -04:00
parent 9687d9638e
commit 7f42be2e64
2 changed files with 23 additions and 15 deletions

View File

@@ -18,7 +18,7 @@
<script>
import cookie from './cookie.mjs';
import { uniq, strHashHSL } from './util.mjs';
import { uniq, strHashHSL, debounce } from './util.mjs';
import Autocomplete from './Autocomplete.vue';
@@ -66,8 +66,8 @@
}
},
watch: {
async params(value) {
this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', datefm(value.date_begin), datefm(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : [];
params(value) {
this.debounced_params(value);
}
},
methods: {
@@ -80,6 +80,9 @@
cookie.set('vista.practitioner', JSON.stringify(this.practitioner), 1);
}
},
created() {
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', datefm(value.date_begin), datefm(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
},
async mounted() {
var practitioner = cookie.get('vista.practitioner');
if(practitioner) this.practitioner = JSON.parse(practitioner);