nuVistA/htdocs/ViewSchedule.vue

76 lines
2.5 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>
<tr><th>Time</th><th>Clinic</th><th>Patient</th><th>Note</th><th>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>
<td v-if="production"><router-link :to="'/patient/$' + row.HRN">{{row.Name}} ${{row.HRN}}</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>
<td><Autocomplete :value="practitioner[row.Name]" @update:value="x => set_practitioner(row.Name, x)" :items="practitioner_list" /></td>
</tr>
</tbody>
</table>
</template>
<script>
import cookie from './cookie.mjs';
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: [],
practitioner: {},
production: true
};
},
computed: {
params() {
return { selection: this.selection, date_begin: this.date_begin, date_end: this.date_end };
},
practitioner_list() {
return this.practitioner ? uniq(Object.values(this.practitioner)).sort() : [];
}
},
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-09-24 00:42:06 -04:00
strtr_unscramble,
2022-09-22 07:10:08 -04:00
set_practitioner(patient, practitioner) {
this.practitioner[patient] = practitioner;
cookie.set('vista.practitioner', JSON.stringify(this.practitioner), 1);
}
},
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() {
var practitioner = cookie.get('vista.practitioner');
if(practitioner) this.practitioner = JSON.parse(practitioner);
this.production = (await this.client.serverinfo()).result.production == '1';
}
};
</script>