2022-09-22 07:10:08 -04:00
|
|
|
<template>
|
2023-04-25 18:21:32 -04:00
|
|
|
<div v-if="(age === undefined) || (age > 0)" class="alert alert-warning">⚠ update error<template v-if="age >= 90000">; last updated {{Math.round(age/60000)}} minutes ago</template></div>
|
2022-09-22 07:10:08 -04:00
|
|
|
<table class="table" style="font-family: monospace;" v-if="appointments && appointments.length > 0">
|
|
|
|
<thead>
|
2023-04-25 18:21:32 -04:00
|
|
|
<tr><th style="width: 7rem;">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>
|
2023-04-25 18:21:32 -04:00
|
|
|
<tbody class="striped">
|
|
|
|
<tr v-for="row in appointments" :class="{ voided: (row.CANCELLED != '0') || (row.NOSHOW != '0') }" :style="{ backgroundColor: strHashHSL(row.RESOURCENAME, '90%') }">
|
|
|
|
<td v-if="row.CANCELLED != '0'" title="Cancelled"><div><span class="emoji">❌</span> {{row.START_TIME.match(/\d\d:\d\d/)[0]}}</div><div class="date">{{row.START_TIME.match(/\w{3} \d+, \d{4}/)[0]}}</div></td>
|
|
|
|
<td v-else-if="row.NOSHOW != '0'" title="No show"><div><span class="emoji">❓</span> {{row.START_TIME.match(/\d\d:\d\d/)[0]}}</div><div class="date">{{row.START_TIME.match(/\w{3} \d+, \d{4}/)[0]}}</div></td>
|
|
|
|
<td v-else-if="row.CHECKOUT" :title="'Checked out ' + row.CHECKOUT"><div><span class="emoji">✅</span> {{row.START_TIME.match(/\d\d:\d\d/)[0]}}</div><div class="date">{{row.START_TIME.match(/\w{3} \d+, \d{4}/)[0]}}</div></td>
|
|
|
|
<td v-else-if="row.CHECKIN" :title="'Checked in ' + row.CHECKIN"><div><span class="emoji">✔</span> {{row.START_TIME.match(/\d\d:\d\d/)[0]}}</div><div class="date">{{row.START_TIME.match(/\w{3} \d+, \d{4}/)[0]}}</div></td>
|
|
|
|
<td v-else title="Scheduled"><div><span class="emoji">⌛</span> {{row.START_TIME.match(/\d\d:\d\d/)[0]}}</div><div class="date">{{row.START_TIME.match(/\w{3} \d+, \d{4}/)[0]}}</div></td>
|
|
|
|
<td>{{row.RESOURCENAME}}</td>
|
|
|
|
<td><router-link :to="'/patient/' + row.PATIENTID">{{row.PATIENTNAME}} <span :title="row.HRN">{{row.HRN.slice(-4)}}</span></router-link></td>
|
|
|
|
<td><template v-if="row.WALKIN != '0'">[Walk-in] </template>{{row.NOTE}}</td>
|
|
|
|
<td><Autocomplete :modelValue="practitioner[row.PATIENTNAME]" @update:modelValue="x => practitioner[row.PATIENTNAME] = x" :items="practitioner_list" /></td>
|
2022-09-22 07:10:08 -04:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
|
2023-04-25 18:21:32 -04:00
|
|
|
<style scoped>
|
|
|
|
.striped {
|
|
|
|
background-image: repeating-linear-gradient(
|
|
|
|
-45deg,
|
|
|
|
rgba(255, 255, 255, 0.1),
|
|
|
|
rgba(255, 255, 255, 0.1) 10px,
|
|
|
|
rgba(0, 0, 0, 0.1) 10px,
|
|
|
|
rgba(0, 0, 0, 0.1) 20px
|
|
|
|
);
|
|
|
|
}
|
|
|
|
.voided {
|
|
|
|
opacity: 0.8;
|
|
|
|
}
|
|
|
|
.date {
|
|
|
|
font-size: 80%;
|
|
|
|
}
|
|
|
|
.emoji {
|
|
|
|
font-family:
|
|
|
|
"Twemoji Mozilla",
|
|
|
|
"Apple Color Emoji",
|
|
|
|
"Segoe UI Emoji",
|
|
|
|
"Segoe UI Symbol",
|
|
|
|
"Noto Color Emoji",
|
|
|
|
"EmojiOne Color",
|
|
|
|
"Android Emoji",
|
|
|
|
sans-serif;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2022-09-22 07:10:08 -04:00
|
|
|
<script>
|
2023-04-25 18:21:32 -04:00
|
|
|
import { uniq, 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: [],
|
2023-04-25 18:21:32 -04:00
|
|
|
ts: null,
|
|
|
|
age: 0
|
2022-09-22 07:10:08 -04:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
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
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
strHashHSL,
|
2023-04-25 18:21:32 -04:00
|
|
|
async update() {
|
|
|
|
try {
|
|
|
|
this.appointments = (await this.client.SDEC_CRSCHED(this.selection.join('|') + '|', strfdate_vista(this.date_begin), strfdate_vista(this.date_end) + '@2359')).sort((a, b) => (new Date(a.START_TIME)) - (new Date(b.START_TIME)));
|
|
|
|
this.ts = new Date();
|
|
|
|
this.age = 0;
|
|
|
|
} catch(ex) {
|
|
|
|
this.age = this.ts ? (new Date()) - this.ts : undefined;
|
|
|
|
console.warn(ex);
|
|
|
|
}
|
|
|
|
}
|
2022-09-22 07:10:08 -04:00
|
|
|
},
|
2023-04-25 18:21:32 -04:00
|
|
|
mounted() {
|
|
|
|
this.$watch(
|
|
|
|
() => (this.client, this.selection, this.date_begin, this.date_end, {}),
|
|
|
|
debounce(async () => {
|
|
|
|
window.clearInterval(this.timer);
|
|
|
|
this.update();
|
|
|
|
this.timer = window.setInterval(this.update, 60000);
|
|
|
|
}, 500)
|
|
|
|
);
|
2022-09-24 00:23:30 -04:00
|
|
|
},
|
2023-04-25 18:21:32 -04:00
|
|
|
unmounted() {
|
|
|
|
window.clearInterval(this.timer);
|
2022-09-22 07:10:08 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|