nuVistA/htdocs/ViewSchedule.vue

71 lines
2.3 KiB
Vue
Raw Normal View History

2022-09-22 07:10:08 -04:00
<template>
<table class="table" style="font-family: monospace;" v-if="appointments && appointments.length > 0">
<thead>
2023-04-24 21:30:14 -04:00
<tr><th>Time</th><th>Clinic</th><th>Patient</th><th>Note</th><th style="width: 16rem;">Assignee</th></tr>
2022-09-24 00:12:36 -04:00
</thead>
2022-09-22 07:10:08 -04:00
<tbody>
<tr v-for="row in appointments" :style="{ backgroundColor: strHashHSL(row.Clinic, '90%') }">
<td>{{row.ApptDate}}</td>
<td>{{row.Clinic}}</td>
2022-10-01 01:40:21 -04:00
<td v-if="production"><router-link :to="'/patient/$' + row.HRN">{{row.Name}} <span :title="row.HRN">{{row.HRN.slice(-4)}}</span></router-link></td>
2022-09-24 00:42:06 -04:00
<td v-else><router-link :title="strtr_unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.HRN.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.HRN}}</router-link></td>
2022-09-22 07:10:08 -04:00
<td>{{row.NOTE}} [{{row.APPT_MADE_BY}} on {{row.DATE_APPT_MADE}}]</td>
2023-04-24 21:30:14 -04:00
<td><Autocomplete :modelValue="practitioner[row.Name]" @update:modelValue="x => practitioner[row.Name] = x" :items="practitioner_list" /></td>
2022-09-22 07:10:08 -04:00
</tr>
</tbody>
</table>
</template>
<script>
2022-09-24 00:42:06 -04:00
import { uniq, strtr_unscramble, strHashHSL, strfdate_vista, debounce } from './util.mjs';
2022-09-22 07:10:08 -04:00
import Autocomplete from './Autocomplete.vue';
export default {
components: {
Autocomplete
},
props: {
client: Object,
selection: {
type: Array,
default: []
},
2022-09-24 00:42:06 -04:00
date_begin: Date,
date_end: Date
2022-09-22 07:10:08 -04:00
},
data() {
return {
appointments: [],
production: true
};
},
computed: {
params() {
return { selection: this.selection, date_begin: this.date_begin, date_end: this.date_end };
},
2022-10-01 07:05:12 -04:00
practitioner() {
return this.client.remotestate.practitioner || (this.client.remotestate.practitioner = {});
},
2022-09-22 07:10:08 -04:00
practitioner_list() {
2023-04-24 21:30:14 -04:00
return this.practitioner ? uniq(Object.values(this.practitioner).filter(x => x)).sort() : [];
2022-09-22 07:10:08 -04:00
}
},
watch: {
2022-09-24 00:23:30 -04:00
params(value) {
this.debounced_params(value);
2022-09-22 07:10:08 -04:00
}
},
methods: {
strHashHSL,
2022-10-01 07:05:12 -04:00
strtr_unscramble
2022-09-22 07:10:08 -04:00
},
2022-09-24 00:23:30 -04:00
created() {
2022-09-24 00:42:06 -04:00
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', strfdate_vista(value.date_begin), strfdate_vista(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
2022-09-24 00:23:30 -04:00
},
2022-09-22 07:10:08 -04:00
async mounted() {
this.production = (await this.client.serverinfo()).result.production == '1';
}
};
</script>