|
a |
|
b/web-app/client/src/components/regpatient.vue |
|
|
1 |
|
|
|
2 |
<template> |
|
|
3 |
<div> |
|
|
4 |
|
|
|
5 |
<div class="regpatient" > |
|
|
6 |
<h1 id="pl">REGISTER NEW PATIENT</h1> |
|
|
7 |
<hr> |
|
|
8 |
<div class="formm" style="margin-left:6em; margin-top:2em;"> |
|
|
9 |
<form @submit="fs" enctype=multipart/form-data> |
|
|
10 |
<ul> |
|
|
11 |
<li> |
|
|
12 |
<label for="fname" class="label" >Name:</label><br> |
|
|
13 |
<input type="text" v-model="patientname" id="fname" name="patientname" class="inputfield" required><br><br> |
|
|
14 |
|
|
|
15 |
<li> |
|
|
16 |
<label for="fname" class="label">age:</label><br> |
|
|
17 |
<input type="text" v-model="age" id="fname" name="age" class="inputfield"><br><br> |
|
|
18 |
</li> |
|
|
19 |
|
|
|
20 |
<li> |
|
|
21 |
<label for="fname" class="label">Adhar no:</label><br> |
|
|
22 |
<input type="text" v-model="patientadno" id="fname" name="patientadno" class="inputfield"><br><br> |
|
|
23 |
</li> |
|
|
24 |
|
|
|
25 |
<li> |
|
|
26 |
<label for="fname" class="label">Ph no:</label><br> |
|
|
27 |
<input type="text" v-model="phno" id="fname" name="phno" class="inputfield"> |
|
|
28 |
</li> |
|
|
29 |
|
|
|
30 |
<!-- <li> |
|
|
31 |
<label for="fname" class="label upload">Upload prescription:</label> |
|
|
32 |
<input type="file" id="myFile" name="reportt" class="inputfield" ><br><br> |
|
|
33 |
</li> --> |
|
|
34 |
|
|
|
35 |
<li> |
|
|
36 |
|
|
|
37 |
</li> |
|
|
38 |
</ul> |
|
|
39 |
|
|
|
40 |
<input type="submit" value="Submit" name="patient" class="signup"> |
|
|
41 |
</form> |
|
|
42 |
</div> |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
</div> |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
<vue-instant-loading-spinner ref="Spinner"></vue-instant-loading-spinner> |
|
|
49 |
</div> |
|
|
50 |
</template> |
|
|
51 |
|
|
|
52 |
<script> |
|
|
53 |
//import PostsService from "@/services/apiService"; |
|
|
54 |
import VueInstantLoadingSpinner from "vue-instant-loading-spinner/src/components/VueInstantLoadingSpinner.vue"; |
|
|
55 |
import axios from "axios"; |
|
|
56 |
|
|
|
57 |
export default { |
|
|
58 |
name: "regpatient", |
|
|
59 |
data (){ |
|
|
60 |
return{ |
|
|
61 |
objj: { |
|
|
62 |
x:1 |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
}, |
|
|
66 |
|
|
|
67 |
patientname: '', |
|
|
68 |
age: '', |
|
|
69 |
patientadno: '', |
|
|
70 |
phno: '', |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
} |
|
|
75 |
}, |
|
|
76 |
components: { |
|
|
77 |
VueInstantLoadingSpinner |
|
|
78 |
}, |
|
|
79 |
methods: { |
|
|
80 |
fs(e) |
|
|
81 |
{ |
|
|
82 |
this.objj.y= this.age |
|
|
83 |
e.preventDefault(); |
|
|
84 |
console.log("submit pressed") |
|
|
85 |
const newTodo = { |
|
|
86 |
name: this.patientname, |
|
|
87 |
age : this.age , |
|
|
88 |
adharNo : this.patientadno , |
|
|
89 |
phNo : this.phno , |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
} |
|
|
93 |
console.log(newTodo) |
|
|
94 |
//construct object and emmit to parent |
|
|
95 |
// this.$emit('add-todo', newTodo); |
|
|
96 |
axios.post('http://localhost:8080/registerPatient', { |
|
|
97 |
name: this.patientname, |
|
|
98 |
age : this.age , |
|
|
99 |
adharNo : this.patientadno , |
|
|
100 |
phNo : this.phno , |
|
|
101 |
}) |
|
|
102 |
.then(res => this.objj = res.data) |
|
|
103 |
//this.objj = res.data |
|
|
104 |
.catch(e => { |
|
|
105 |
this.errors.push(e) |
|
|
106 |
}) |
|
|
107 |
}, |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
// created(){ |
|
|
111 |
|
|
|
112 |
// axios.get('https://jsonplaceholder.typicode.com/todos') |
|
|
113 |
// .then(res => console.log(res)) |
|
|
114 |
// .catch(err => console.log(err)) |
|
|
115 |
|
|
|
116 |
// } |
|
|
117 |
} |
|
|
118 |
} |
|
|
119 |
</script> |
|
|
120 |
|
|
|
121 |
<style scoped> |
|
|
122 |
|
|
|
123 |
.regpatient |
|
|
124 |
{ |
|
|
125 |
background-color: white; |
|
|
126 |
height: 480px; |
|
|
127 |
width: 500px; |
|
|
128 |
border-radius: 25px; |
|
|
129 |
padding: 2em; |
|
|
130 |
margin: 5em auto; |
|
|
131 |
|
|
|
132 |
-webkit-box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); |
|
|
133 |
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); |
|
|
134 |
} |
|
|
135 |
|
|
|
136 |
|
|
|
137 |
.signup{ |
|
|
138 |
background-color: #126597; /* Green */ |
|
|
139 |
border: none; |
|
|
140 |
color: white; |
|
|
141 |
padding: 12px; |
|
|
142 |
text-align: center; |
|
|
143 |
text-decoration: none; |
|
|
144 |
display: inline-block; |
|
|
145 |
font-size: 16px; |
|
|
146 |
/* margin: 4px 2px; */ |
|
|
147 |
margin-left: 6em; |
|
|
148 |
margin-top: 1.1em; |
|
|
149 |
cursor: pointer; |
|
|
150 |
border-radius: 12px; |
|
|
151 |
width: 100px; |
|
|
152 |
font-weight: bold; |
|
|
153 |
} |
|
|
154 |
#pl{ |
|
|
155 |
text-align: center; |
|
|
156 |
} |
|
|
157 |
.inputfield { |
|
|
158 |
width: 15em; |
|
|
159 |
padding: 0.8em; |
|
|
160 |
/* border-radius: 0.5em; */ |
|
|
161 |
border: none; |
|
|
162 |
border-bottom: 1px solid black; |
|
|
163 |
} |
|
|
164 |
ul,li{ |
|
|
165 |
list-style-type: none; |
|
|
166 |
text-align: left; |
|
|
167 |
} |
|
|
168 |
</style> |
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|