Order viewer emoji

This commit is contained in:
Jiang Yio 2023-04-24 21:43:11 -04:00
parent 5c75028a2a
commit 8794d27d08

View File

@ -1,104 +1,107 @@
<template> <template>
<table v-if="details.length > 0" class="table table-striped"> <table v-if="details.length > 0" class="table table-striped">
<template v-for="group in details"> <template v-for="group in details">
<thead> <thead>
<tr> <tr>
<th>{{map_groups[group.key].name}}</th> <th>{{map_groups[group.key].name}}</th>
<th>Practitioner</th> <th>Practitioner</th>
<th style="text-align: right;">Status</th> <th style="text-align: right;">Status</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in group.values"> <tr v-for="item in group.values">
<td><div v-for="line in item.text">{{line}}</div></td> <td><div v-for="line in item.text">{{line}}</div><div>{{item.IFN}}</div></td>
<td> <td>
<div v-if="item.PrvNam" :title="item.PrvID">{{item.PrvNam}}</div> <div v-if="item.PrvNam" :title="item.PrvID">{{item.PrvNam}}</div>
<div v-if="item.Nrs">Nurse: {{item.Nrs}}</div> <div v-if="item.Nrs">Nurse: {{item.Nrs}}</div>
<div v-if="item.Clk">Clerk: {{item.Clk}}</div> <div v-if="item.Clk">Clerk: {{item.Clk}}</div>
<div v-if="item.ChartRev">Chart: {{item.ChartRev}}</div> <div v-if="item.ChartRev">Chart: {{item.ChartRev}}</div>
<div v-if="item.LOC">{{item.LOC.split(':')[0]}}</div> <div v-if="item.LOC">{{item.LOC.split(':')[0]}}</div>
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<div v-if="item.Sts">{{name_of_status[item.Sts]}}</div> <div v-if="item.Sts">{{name_of_status[item.Sts]}}</div>
<div v-if="item.OrdTm">Ordered: {{strptime_vista(item.OrdTm).toLocaleDateString('sv-SE')}}</div> <div v-if="item.OrdTm">Ordered: {{strptime_vista(item.OrdTm).toLocaleDateString('sv-SE')}}</div>
<div v-if="item.StrtTm">Start: {{strptime_vista(item.StrtTm).toLocaleDateString('sv-SE')}}</div> <div v-if="item.StrtTm">Start: {{strptime_vista(item.StrtTm).toLocaleDateString('sv-SE')}}</div>
<div v-if="item.StopTm">Stop: {{strptime_vista(item.StopTm).toLocaleDateString('sv-SE')}}</div> <div v-if="item.StopTm">Stop: {{strptime_vista(item.StopTm).toLocaleDateString('sv-SE')}}</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</template> </template>
</table> </table>
</template> </template>
<style scoped> <style scoped>
th { th {
text-transform: lowercase; text-transform: lowercase;
} }
th::first-letter { th::first-letter {
text-transform: uppercase; text-transform: uppercase;
} }
</style> td:first-child {
max-width: 30rem;
<script> }
import { groupByArray, strftime_vista, strptime_vista } from './util.mjs'; </style>
const name_of_status = { <script>
0: 'Error', import { groupByArray, strftime_vista, strptime_vista } from './util.mjs';
1: 'Discontinued',
2: 'Complete', const name_of_status = {
3: 'Hold', 0: 'Error ⚠',
4: 'Flagged', 1: 'Discontinued ❌',
5: 'Pending', 2: 'Complete ✔️',
6: 'Active', 3: 'Hold ✋',
7: 'Expired', 4: 'Flagged 🚩',
8: 'Scheduled', 5: 'Pending ⏳',
9: 'Partial results', 6: 'Active ⭐',
10: 'Delayed', 7: 'Expired ❌',
11: 'Unreleased', 8: 'Scheduled ✔️',
12: 'DC/edit', 9: 'Partial results ⏳',
13: 'Cancelled', 10: 'Delayed 📅',
14: 'Lapsed', 11: 'Unreleased 🚧',
15: 'Renewed', 12: 'DC/edit ✎',
97: '', 13: 'Cancelled ❌',
98: 'New', 14: 'Lapsed ❌',
99: 'No status' 15: 'Renewed ⭐',
}; 97: '',
98: 'New ✨',
export default { 99: 'No status'
props: { };
client: Object,
dfn: String, export default {
filter: { default: 2 }, props: {
group: { default: 1 }, client: Object,
date_begin: Date, dfn: String,
date_end: Date filter: { default: 2 },
}, group: { default: 1 },
data() { date_begin: Date,
return { date_end: Date
orders: [], },
details: [], data() {
map_groups: {}, return {
name_of_status orders: [],
}; details: [],
}, map_groups: {},
computed: { name_of_status
params() { };
return { dfn: this.dfn, filter: this.filter, group: this.group, date_begin: strftime_vista(this.date_begin), date_end: strftime_vista(this.date_end) }; },
} computed: {
}, params() {
watch: { return { dfn: this.dfn, filter: this.filter, group: this.group, date_begin: strftime_vista(this.date_begin), date_end: strftime_vista(this.date_end) };
async params(value) { }
this.orders = await this.client.ORWORR_AGET(value.dfn, value.filter, value.group, value.date_begin, value.date_end); },
}, watch: {
async orders(value) { async params(value) {
this.details = this.orders.length > 0 ? groupByArray(await this.client.ORWORR_GET4LST(0, 0, value.map(x => x.ifn)), x => x.Grp) : []; this.orders = await this.client.ORWORR_AGET(value.dfn, value.filter, value.group, value.date_begin, value.date_end);
} },
}, async orders(value) {
methods: { this.details = this.orders.length > 0 ? groupByArray(await this.client.ORWORR_GET4LST(0, 0, value.map(x => x.ifn)), x => x.Grp) : [];
strptime_vista }
}, },
async mounted() { methods: {
this.map_groups = (await this.client.ORWORDG_ALLTREE()).reduce((acc, x) => (acc[x.ien] = x, acc), {}); strptime_vista
} },
}; async mounted() {
</script> this.map_groups = (await this.client.ORWORDG_ALLTREE()).reduce((acc, x) => (acc[x.ien] = x, acc), {});
}
};
</script>