nuVistA/htdocs/App.vue

112 lines
4.2 KiB
Vue
Raw Normal View History

2022-09-22 07:10:08 -04:00
<template>
2023-05-08 20:19:10 -04:00
<Submenu :value="menu" />
2023-05-01 18:58:48 -04:00
<div class="container-fluid" style="padding-top: 5rem;">
2022-09-26 17:38:27 -04:00
<Navbar v-model:server="server" :user="user" />
2023-05-01 19:32:23 -04:00
<Throbber :client="client" />
2023-05-16 23:19:36 -04:00
<div :class="localstate.fullwidth ? 'container-fluid' : 'container'">
2022-09-26 17:38:27 -04:00
<Login :secret="secret" v-model:client="client" v-model:server="server" v-model:user="user" />
2022-09-27 19:22:57 -04:00
<router-view v-if="user" :client="client"></router-view>
2022-09-22 07:10:08 -04:00
</div>
2023-05-16 23:19:36 -04:00
<button class="control-fullwidth btn btn-light" @click="localstate.fullwidth = !localstate.fullwidth"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi" viewBox="0 0 16 16"><path v-if="localstate.fullwidth" d="M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5zm5 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 10 4.5v-4a.5.5 0 0 1 .5-.5zM0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zm10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4z" /><path v-else d="M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1h-4zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zM.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5z" /></svg></button>
2022-09-22 07:10:08 -04:00
</div>
</template>
2023-05-16 23:19:36 -04:00
<style>
.bi {
display: inline-block;
vertical-align: -.125em;
fill: currentcolor;
}
</style>
<style scoped>
button.control-fullwidth {
display: none;
}
@media (min-width: 576px) {
button.control-fullwidth {
display: inline-block;
position: fixed;
bottom: 0.5rem;
right: 0.5rem;
}
}
</style>
2022-09-22 07:10:08 -04:00
<script>
2023-05-16 23:19:36 -04:00
import { localstate } from './vistax.mjs';
2023-05-08 20:19:10 -04:00
import Submenu from './Submenu.vue';
2022-09-22 07:10:08 -04:00
import Navbar from './Navbar.vue';
2023-05-01 19:32:23 -04:00
import Throbber from './Throbber.vue';
2022-09-22 07:10:08 -04:00
import Login from './Login.vue';
import RouteSchedule from './RouteSchedule.vue';
import RouteLookup from './RouteLookup.vue';
2023-05-08 18:48:29 -04:00
import RoutePatient from './RoutePatient.vue';
2022-09-22 07:10:08 -04:00
import RoutePatientDetail from './RoutePatientDetail.vue';
2023-04-24 21:23:35 -04:00
import RoutePatientVisits from './RoutePatientVisits.vue';
2023-04-24 23:10:19 -04:00
import RoutePatientOrders from './RoutePatientOrders.vue';
2023-05-08 22:55:20 -04:00
import RoutePatientReports from './RoutePatientReports.vue';
2023-05-10 21:55:15 -04:00
import RoutePatientDocuments from './RoutePatientDocuments.vue';
import RoutePlanner from './RoutePlanner.vue';
2022-09-23 23:59:55 -04:00
import RouteRecall from './RouteRecall.vue';
2023-05-08 22:52:55 -04:00
import RouteInbox from './RouteInbox.vue';
2023-05-16 22:04:37 -04:00
import RouteSettings from './RouteSettings.vue';
2022-09-22 07:10:08 -04:00
export default {
components: {
2023-05-08 20:19:10 -04:00
Submenu, Navbar, Throbber, Login
2022-09-22 07:10:08 -04:00
},
props: {
secret: String
},
data() {
return {
2023-05-16 23:19:36 -04:00
localstate,
2022-09-22 07:10:08 -04:00
client: null,
2022-09-26 17:38:27 -04:00
server: null,
2022-09-22 07:10:08 -04:00
user: null,
heartbeat: null,
banner: '',
2023-05-08 20:19:10 -04:00
authenticated: false,
menu: {
name: 'Main',
items: [
{ name: 'Schedule', href: '/' },
{ name: 'Lookup', href: '/lookup' },
{ name: 'Planner', href: '/planner' },
2023-05-08 22:52:55 -04:00
{ name: 'Recall', href: '/recall' },
{ name: 'Inbox', href: '/inbox' },
2023-05-16 22:04:37 -04:00
{ name: 'Settings', href: '/settings' },
2023-05-08 20:19:10 -04:00
]
}
2022-09-22 07:10:08 -04:00
};
},
watch: {
2022-09-26 17:38:27 -04:00
async client(value, oldvalue) {
2022-09-22 07:10:08 -04:00
if(this.heartbeat) window.clearInterval(this.heartbeat);
else {
[
2022-09-27 19:22:57 -04:00
{ path: '/', component: RouteSchedule },
{ path: '/lookup', component: RouteLookup },
2023-05-08 18:48:29 -04:00
{ path: '/patient/:id', component: RoutePatient, children: [
{ path: '', component: RoutePatientDetail },
{ path: 'visits', component: RoutePatientVisits },
{ path: 'orders', component: RoutePatientOrders },
2023-05-08 22:55:20 -04:00
{ path: 'reports', component: RoutePatientReports },
2023-05-10 21:55:15 -04:00
{ path: 'document', component: RoutePatientDocuments },
{ path: 'document/:tiu_da', component: RoutePatientDocuments },
2023-05-08 18:48:29 -04:00
] },
{ path: '/planner', component: RoutePlanner },
2022-09-27 19:22:57 -04:00
{ path: '/recall', component: RouteRecall },
2023-05-08 22:52:55 -04:00
{ path: '/inbox', component: RouteInbox },
2023-05-16 22:04:37 -04:00
{ path: '/settings', component: RouteSettings },
2022-09-22 07:10:08 -04:00
].forEach(route => this.$root.$router.addRoute(route));
await this.$root.$router.replace(this.$route);
}
2022-09-27 21:39:27 -04:00
if(value) this.heartbeat = await value.heartbeat();
2022-09-22 07:10:08 -04:00
}
}
};
</script>