Skip to content

Commit

Permalink
#73 Added Bootstrap,jquery,popper to page, added login, admin home, a…
Browse files Browse the repository at this point in the history
…dding doctors, doctor home, and updated api and icpc to use es5 class notation
  • Loading branch information
TareqK committed Sep 25, 2020
1 parent 2759656 commit ec5242d
Show file tree
Hide file tree
Showing 44 changed files with 26,380 additions and 62 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/openmymed/accessmd/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static void startServer() {
ctx.result(e.getMessage());
});
app.config.sessionHandler(() -> fileSessionHandler());

app.config.addStaticFiles("/web");
}

private static SessionHandler fileSessionHandler() {
Expand Down
106 changes: 106 additions & 0 deletions core/src/main/resources/vue/components/add-doctor-modal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<template id="add-doctor-modal">
<div
class="modal fade"
id="exampleModal"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Add Doctor
</h5>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body text-left container-fluid">
<div class="form-group container-fluid">
<label for="username">Username</label>
<input
class="form-control"
id="username"
type="text"
v-model="username"
></input>
</div>
<div class="form-group container-fluid">
<label for="password">Password</label>
<input
class="form-control"
id="password"
type="password"
v-model="password"
></input>
</div>
<div class="form-group container-fluid">
<label for="firstName">First Name</label>
<input
class="form-control"
id="firstName"
type="text"
v-model="firstName"
></input>
</div>
<div class="form-group container-fluid">
<label for="lastName">Last Name</label>
<input
class="form-control"
id="lastName"
type="text"
v-model="lastName"
></input>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-dismiss="modal"
>
Close
</button>
<button
class="btn btn-primary"
data-dismiss="modal"
v-on:click="addDoctor"
>
Add
</button>
</div>
</div>
</div>
</div>;
</template>
<script>
Vue.component('add-doctor-modal', {
template: '#add-doctor-modal',
data : () =>({
username : "",
password : "",
firstName:"",
lastName:""
}),
methods: {
addDoctor: function () {
window.apiService.addDoctor({
username: this.username,
password: this.password,
firstName: this.firstName,
lastName: this.lastName
});
},
show: function () {
$(this.$el).modal({backdrop: false});
}
}
});
</script>
42 changes: 42 additions & 0 deletions core/src/main/resources/vue/components/add-patient-modal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template id="add-patient-modal">
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Patient</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body container-fluid">
<div class="col-12">
<div class="form-group">
<label for="code-field">Secret Code</label>
<input class="form-control" id="code-field" type="text" v-model="code"></input>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button class="btn btn-primary" data-dismiss="modal" v-on:click="addPatient">Add</button>
</div>
</div>
</div>
</div>;
</template>
<script>
Vue.component("add-patient-modal",{
template:"#add-patient-modal",
data:()=>({
code:""
}),
methods:{
show:function(){
$(this.$el).modal({backdrop:false});
},
addPatient:function(){
window.apiService.assignPatientToMyself(this.code);
}
}
})
</script>
36 changes: 36 additions & 0 deletions core/src/main/resources/vue/components/admin-sidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template id="admin-sidebar">
<div class="col-xl-2 col-lg-3 col-md-4 sidebar fixed-top text-center" >
<a href="/admin/dashboard" class="navbar-brand text-white bg-blue-primary d-block mx-auto text-center py-4 mb-5">
Admin Dashboard
</a>
<div class="row">
<ul class="navbar-nav flex-column text-left col-centered">
<li class="nav-item">
<a href="/admin/dashboard" class="sidebar-link active nav-link p-3 mb-2">
<i class="fa fa-home fa-lg mr-3"></i>Home
</a>
</li>
<li class="nav-item">
<a href="/admin/doctors" class="sidebar-link nav-link p-3 mb-2 ">
<i class="fa fa-user fa-lg mr-3"></i>Doctor List
</a>
</li>
</ul>
</div>
<button type="button" class="btn btn-primary btn-md col-centered mt-5" v-on:click="showDoctorModal">
<i class="fa fa-plus fa-lg mr-3"></i>Add Doctor
</button>
<add-doctor-modal ref="addDoctor"></add-doctor-modal>
</div>;
</template>
<script>
Vue.component("admin-sidebar", {
template: "#admin-sidebar",
methods: {
showDoctorModal: function () {
this.$refs.addDoctor.show();
}
}
})
</script>
20 changes: 20 additions & 0 deletions core/src/main/resources/vue/components/card.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template id="card">
<div class="col-lg-4 col-sm-12 p-2">
<div class="card card-common rounded-lg">
<div class="card-body">
<div class="d-flex justify-content-center">
<div class="flex-column">
<h6 class="font-weight-bold">{{title}}</h6>
<h1 class="pt-2 text-info font-weight-bold">{{number}}</h1>
</div>
</div>
</div>
</div>
</div>;
</template>
<script>
Vue.component('card',{
template:"#card",
props:["title","number"]
})
</script>
55 changes: 55 additions & 0 deletions core/src/main/resources/vue/components/doctor-feed-item.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template id="doctor-feed-item">
<tr>
<th scope="row" class="text-left">
{{feedItem.patientName}}
</th>
<td this="updateType" class="text-center">
{{updateType}}
</td>
<td this="time" class="text-center">
{{feedItem.time}}
</td>
<td this="value" class="text-center">
{{content}}
</td>
<td class="text-right">
<button class="btn btn-danger btn-sm" v-on:click="dismiss">Dismiss</button>
<a class="btn btn-primary btn-sm" v-bind:href="profileLink">Profile</a>
</td>
</tr>
</template>
<script>
Vue.component("doctor-feed-item", {
template: "#doctor-feed-item",
props: ["feedItem"],
computed: {
profileLink: function () {
return "/patient/" + this.feedItem.patientId;
},
updateType: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
return "Symptom";
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
return "Answer";
}
},
content: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
return window.icpcService.getTitle(this.feedItem.value)
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
return "Question : " + this.feedItem.value;
}
}
},
methods: {
dismiss: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
window.apiService.archiveSymptom(this.data.patientId, this.data.entityId);
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
window.apiService.archiveAnswer(this.data.patientId, this.data.entityId);
}
this.$emit("dismiss");
}
}
})
</script>
37 changes: 37 additions & 0 deletions core/src/main/resources/vue/components/doctor-feed.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template id="doctor-feed">
<div class="container-fluid mt-3">
<h4>Last Activities</h4>
<div class="col-12">
<table class="table" this="table">
<thead>
<th scope="col" class="text-left">Patient Name</th>
<th scope="col" class="text-center">Update Type</th>
<th scope="col" class="text-center">Time</th>
<th scope="col" class="text-center">Details</th>
<th scope="col" class="text-right"></th>
</thead>
<tbody>
<doctor-feed-item v-for="(update, index) in updates" :key="update.entityId" v-bind="update" v-on:dismiss="dismissRow(index)"></doctor-feed-item>
</tbody>
</table>
</div>
</div>
</template>
<script>
Vue.component("doctor-feed", {
template: "#doctor-feed",
data: () => ({
updates: []
}),
methods: {
dismissRow: function (index) {
this.updates.splice(index, 1);
}
},
created() {
window.apiService.getDoctorFeed().then((json) => {
this.updates = json;
});
}
})
</script>
35 changes: 35 additions & 0 deletions core/src/main/resources/vue/components/doctor-sidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template id="doctor-sidebar">
<div class="col-xl-2 col-lg-3 col-md-4 sidebar fixed-top text-center">
<a href="/dashboard"class="navbar-brand text-white bg-blue-primary d-block mx-auto text-center py-4 mb-5">
ACCESS.MD
</a>
<div class="row">
<ul class="navbar-nav flex-column text-left col-centered">
<li class="nav-item">
<a href="/dashboard" class="sidebar-link active nav-link p-3 mb-2">
<i class="fa fa-home fa-lg mr-3"></i>Dashboard
</a>
</li>
<li class="nav-item">
<a href="/patient" class="sidebar-link nav-link p-3 mb-2 ">
<i class="fa fa-user fa-lg mr-3"></i>My Patients
</a>
</li>
</ul>
</div>
<button type="button" class="btn btn-primary btn-md col-centered mt-5" v-on:click="showPatientModal">
<i class="fa fa-plus fa-lg mr-3"></i>Add Patient
</button>
<add-patient-modal ref="addPatient"></add-patient-modal>
</div>;
</template>
<script>
Vue.component("doctor-sidebar",{
template:"#doctor-sidebar",
methods:{
showPatientModal:function(){
this.$refs.addPatient.show();
}
}
});
</script>
Loading

0 comments on commit ec5242d

Please sign in to comment.