2022-09-22 07:10:08 -04:00
|
|
|
<template>
|
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" />
|
2022-09-22 07:10:08 -04:00
|
|
|
<div class="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>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
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';
|
2023-05-08 17:58:34 -04:00
|
|
|
import RouteLookup from './RouteLookup.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-03 01:41:34 -04:00
|
|
|
import RoutePlanner from './RoutePlanner.vue';
|
2022-09-23 23:59:55 -04:00
|
|
|
import RouteRecall from './RouteRecall.vue';
|
2022-09-22 07:10:08 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2023-05-01 19:32:23 -04:00
|
|
|
Navbar, Throbber, Login
|
2022-09-22 07:10:08 -04:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
secret: String
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
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: '',
|
|
|
|
authenticated: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
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 },
|
2023-05-08 17:58:34 -04:00
|
|
|
{ path: '/lookup', component: RouteLookup },
|
2022-09-27 19:22:57 -04:00
|
|
|
{ path: '/patient/:id', component: RoutePatientDetail },
|
2023-04-24 21:23:35 -04:00
|
|
|
{ path: '/patient/:id/visits', component: RoutePatientVisits },
|
2023-04-24 23:10:19 -04:00
|
|
|
{ path: '/patient/:id/orders', component: RoutePatientOrders },
|
2023-05-03 01:41:34 -04:00
|
|
|
{ path: '/planner', component: RoutePlanner },
|
2022-09-27 19:22:57 -04:00
|
|
|
{ path: '/recall', component: RouteRecall },
|
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>
|