75 lines
2.2 KiB
Vue
75 lines
2.2 KiB
Vue
<template>
|
|
<Submenu :value="menu" />
|
|
<div class="container-fluid" style="padding-top: 5rem;">
|
|
<Navbar v-model:server="server" :user="user" />
|
|
<Throbber :client="client" />
|
|
<div class="container">
|
|
<Login :secret="secret" v-model:client="client" v-model:server="server" v-model:user="user" />
|
|
<router-view v-if="user" :client="client"></router-view>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Submenu from './Submenu.vue';
|
|
import Navbar from './Navbar.vue';
|
|
import Throbber from './Throbber.vue';
|
|
import Login from './Login.vue';
|
|
import RouteSchedule from './RouteSchedule.vue';
|
|
import RouteLookup from './RouteLookup.vue';
|
|
import RoutePatient from './RoutePatient.vue';
|
|
import RoutePatientDetail from './RoutePatientDetail.vue';
|
|
import RoutePatientVisits from './RoutePatientVisits.vue';
|
|
import RoutePatientOrders from './RoutePatientOrders.vue';
|
|
import RoutePlanner from './RoutePlanner.vue';
|
|
import RouteRecall from './RouteRecall.vue';
|
|
|
|
export default {
|
|
components: {
|
|
Submenu, Navbar, Throbber, Login
|
|
},
|
|
props: {
|
|
secret: String
|
|
},
|
|
data() {
|
|
return {
|
|
client: null,
|
|
server: null,
|
|
user: null,
|
|
heartbeat: null,
|
|
banner: '',
|
|
authenticated: false,
|
|
menu: {
|
|
name: 'Main',
|
|
items: [
|
|
{ name: 'Schedule', href: '/' },
|
|
{ name: 'Lookup', href: '/lookup' },
|
|
{ name: 'Planner', href: '/planner' },
|
|
{ name: 'Recall', href: '/recall' }
|
|
]
|
|
}
|
|
};
|
|
},
|
|
watch: {
|
|
async client(value, oldvalue) {
|
|
if(this.heartbeat) window.clearInterval(this.heartbeat);
|
|
else {
|
|
[
|
|
{ path: '/', component: RouteSchedule },
|
|
{ path: '/lookup', component: RouteLookup },
|
|
{ path: '/patient/:id', component: RoutePatient, children: [
|
|
{ path: '', component: RoutePatientDetail },
|
|
{ path: 'visits', component: RoutePatientVisits },
|
|
{ path: 'orders', component: RoutePatientOrders },
|
|
] },
|
|
{ path: '/planner', component: RoutePlanner },
|
|
{ path: '/recall', component: RouteRecall },
|
|
].forEach(route => this.$root.$router.addRoute(route));
|
|
await this.$root.$router.replace(this.$route);
|
|
}
|
|
if(value) this.heartbeat = await value.heartbeat();
|
|
}
|
|
}
|
|
};
|
|
</script>
|