|
| 1 | +<template> |
| 2 | + <div class="patient-view view" style="width: 460px; margin-left: auto; margin-right: auto;"> |
| 3 | + <div v-if="loaded" style="float: left;"> |
| 4 | + <input v-model="data.first_name" style="width: 200px" placeholder="First Name"> |
| 5 | + <input v-model="data.last_name" style="width: 200px" placeholder="First Name"> |
| 6 | + <br> |
| 7 | + <input v-model="data.address" style="width: 430px" placeholder="Address"> |
| 8 | + <br> |
| 9 | + <br> |
| 10 | + <span class="field">Medication:</span> |
| 11 | + <br> |
| 12 | + <input v-model="data.medication" style="width: 430px" placeholder="None"> |
| 13 | + <br> |
| 14 | + <span class="field">Conditions:</span> |
| 15 | + <br> |
| 16 | + <input v-model="data.conditions" style="width: 430px" placeholder="None"> |
| 17 | + |
| 18 | + <br><br> |
| 19 | + |
| 20 | + <div v-if="data.physician_id && physician"> |
| 21 | + Physician: |
| 22 | + <a v-bind:href="'/physician/' + data.physician_id">Dr. {{ physician.first_name }} {{ physician.last_name }}</a> |
| 23 | + </div> |
| 24 | + |
| 25 | + <br><br> |
| 26 | + |
| 27 | + <button>Assign Physician</button> |
| 28 | + <button>Assign Room</button> |
| 29 | + |
| 30 | + <input v-model="data.physician_id"> |
| 31 | + |
| 32 | + |
| 33 | + <br><br> |
| 34 | + <button v-bind:disabled="!modified" style="text-align: center;">Save Changes</button> |
| 35 | + <br> |
| 36 | + <div v-if="modified" v-on:click="reset" style="cursor: pointer;">Undo Edits</div> |
| 37 | + <div v-else style="opacity: 0;">No changes made</div> |
| 38 | + </div> |
| 39 | + </div> |
| 40 | +</template> |
| 41 | + |
| 42 | +<script> |
| 43 | +import ViewBase from './'; |
| 44 | +
|
| 45 | +export default { |
| 46 | + extends: ViewBase, |
| 47 | + name: 'PatientView', |
| 48 | + props: { |
| 49 | + id: String, |
| 50 | + }, |
| 51 | + data() { |
| 52 | + return { |
| 53 | + table: 'patients', |
| 54 | + path: '/api/db/patients/${this.id}.json', |
| 55 | + data: {}, |
| 56 | + loaded: false, |
| 57 | + query: false, |
| 58 | + physician: false, |
| 59 | + } |
| 60 | + }, |
| 61 | + methods: { |
| 62 | + async getPhysician() { |
| 63 | + if (this.physician) { |
| 64 | + if (this.physician.physician_id === this.data.physician_id) { |
| 65 | + return this.physician; |
| 66 | + } |
| 67 | + }; |
| 68 | + if (this.data.physician_id) { |
| 69 | + this.physician = (await this.fetchData(`/api/db/physicians/${this.data.physician_id}.json`)).results; |
| 70 | + } else { |
| 71 | + this.physician = false; |
| 72 | + } |
| 73 | + return this.physician; |
| 74 | + }, |
| 75 | + async afterFetch() { |
| 76 | + await this.getPhysician(); |
| 77 | + //console.log(this.physician); |
| 78 | + } |
| 79 | + }, |
| 80 | + components: { |
| 81 | +
|
| 82 | + }, |
| 83 | +} |
| 84 | +</script> |
| 85 | + |
| 86 | + |
| 87 | +<style scoped lang="scss"> |
| 88 | +@import './'; |
| 89 | +
|
| 90 | +</style> |
0 commit comments