Blame view
src/pages/Dashboard.vue
12.7 KB
93a68cfa1
|
1 2 |
<template> <v-tabs |
ee83012b3
|
3 4 |
grow slider-color="black" |
93a68cfa1
|
5 |
> |
ee83012b3
|
6 7 |
<v-tab ripple @click="activeTab('existing')" v-bind:class="{ active: isActive }" id="tab"> |
93a68cfa1
|
8 9 |
Existing user </v-tab> |
ee83012b3
|
10 11 |
<v-tab ripple @click="activeTab('new')" v-bind:class="{ active: newActive }" id="tab1"> |
93a68cfa1
|
12 13 |
Add New Users </v-tab> |
ee83012b3
|
14 |
|
93a68cfa1
|
15 |
<v-tab-item> |
c35a8dafd
|
16 |
<v-dialog v-model="dialog" max-width="500px"> |
250d1e021
|
17 |
<v-toolbar color="white"> |
c35a8dafd
|
18 19 20 21 |
<v-spacer></v-spacer> <v-toolbar-title>Edit Profile</v-toolbar-title> <v-spacer></v-spacer> </v-toolbar> |
250d1e021
|
22 23 24 25 |
<v-card> <v-flex align-center justify-center layout text-xs-center> <v-avatar size="50px" style="position:absolute; top:10px; "> <img src="/static/icon/user.png"/></v-avatar> |
c35a8dafd
|
26 27 |
</v-flex> <v-card-text> |
e2e46164f
|
28 |
<v-container> |
c35a8dafd
|
29 |
<v-layout wrap justify-center> |
250d1e021
|
30 31 |
<v-flex xs12 sm9> <v-form> |
e2e46164f
|
32 |
|
250d1e021
|
33 |
<v-layout style="position:relative; top:15px;"> |
e2e46164f
|
34 35 36 37 38 39 |
<v-flex xs4 class="pt-4 subheading"> <label>First Name: </label> </v-flex> <v-flex xs8> <v-text-field v-model="editedItem.Name" |
269061695
|
40 |
v-validate="'required'" |
e2e46164f
|
41 |
:rules="nameRules" |
c35a8dafd
|
42 |
data-vv-name="Name" |
e2e46164f
|
43 44 |
required ></v-text-field></v-flex></v-layout> |
250d1e021
|
45 |
<v-layout> |
e2e46164f
|
46 47 48 49 |
<v-flex xs4 class="pt-4 subheading"> <label>Last Name: </label> </v-flex> <v-flex xs8> |
c35a8dafd
|
50 |
<v-text-field |
c35a8dafd
|
51 |
v-model="editedItem.LName" |
e2e46164f
|
52 53 54 55 56 57 58 59 60 61 62 63 64 |
v-validate="'required'" :rules="lnameRules" data-vv-name="Name" required ></v-text-field></v-flex></v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label>Email ID: </label> </v-flex> <v-flex xs8> <v-text-field v-model="editedItem.Email" |
c35a8dafd
|
65 |
v-validate="'required|email'" |
e2e46164f
|
66 67 68 69 70 71 72 73 74 75 76 77 78 |
:rules="emailRules" data-vv-name="E-mail" required ></v-text-field></v-flex></v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label>Date of Birth: </label> </v-flex> <v-flex xs8> <v-text-field v-model="editedItem.DOB" :rules="[rules.required, rules.min]" ></v-text-field></v-flex></v-layout> |
c35a8dafd
|
79 80 81 82 83 84 85 |
<v-card-actions> <v-btn round dark @click.native="close">Cancel</v-btn> <v-spacer></v-spacer> <v-btn round dark @click.native="save">Save</v-btn> </v-card-actions> |
250d1e021
|
86 87 |
</v-form> </v-flex> |
c35a8dafd
|
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
</v-layout> </v-container> </v-card-text> </v-card> </v-dialog> <v-dialog v-model="dialog1" max-width="500px"> <v-toolbar color="white"> <v-spacer></v-spacer> <v-toolbar-title>Profile</v-toolbar-title> <v-spacer></v-spacer> <v-icon @click="close1">close</v-icon> </v-toolbar> <v-card> <v-flex align-center justify-center layout text-xs-center> |
e2e46164f
|
105 |
<v-avatar size="50px" style="position:absolute; top:20px;"> |
269061695
|
106 |
<img src="/static/icon/user.png"/> </v-avatar> |
c35a8dafd
|
107 108 109 110 |
</v-flex> <v-card-text> <v-container grid-list-md> <v-layout wrap justify-center> |
e2e46164f
|
111 |
<v-flex offset-xs3 id="flex"> |
c35a8dafd
|
112 113 |
<br><br> |
e2e46164f
|
114 |
<table style="position:absolute; top:110px;"> |
c35a8dafd
|
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
<th> <tr><h5><b>First Name:</b></h5></tr><br> <tr><h5><b>Last Name:</b></h5></tr><br> <tr><h5><b>Email:</b></h5></tr><br> <tr><h5><b>Date Of Birth:</b></h5></tr> </th> <th> <tr><td><h5><b>{{ editedItem.Name }}</b></h5></td></tr><br> <tr> <td><h5><b>{{ editedItem.LName }}</b></h5></td></tr><br> <tr><td><h5><b>{{ editedItem.Email }}</b></h5></td></tr><br> <tr><td><h5><b>{{ editedItem.DOB }}</b></h5></td></tr> </th> </table> </v-flex> </v-layout> </v-container> </v-card-text> </v-card> </v-dialog> |
c35a8dafd
|
136 |
|
c1fd43e24
|
137 |
<v-dialog v-model="dialog2" max-width="700px"> |
269061695
|
138 139 140 141 142 143 144 145 146 147 |
<v-card> <div id="dialog"> <h4><b> Report </b> </h4> <h5 id="name"><b>Patient Name:</b> {{ editedItem.Name+' '+editedItem.LName }}</h5> <h5 id="m">Select Month:</h5> <v-btn flat id="G">Generate</v-btn> <v-spacer></v-spacer> <v-icon id="icon" @click="close2">close</v-icon> <span id="bt"> |
defcc5da3
|
148 |
<v-btn flat>1 month</v-btn> |
269061695
|
149 150 |
<v-btn flat>3 Month</v-btn> <v-btn flat>6 Month</v-btn> |
defcc5da3
|
151 152 |
<v-btn flat>9 Month</v-btn> <!-- <v-flex xs10> |
c1fd43e24
|
153 154 155 156 157 158 |
<v-tabs slider-color="transparent" > <v-tab ripple>1 Month</v-tab> <v-tab ripple>3 Month</v-tab> <v-tab ripple>6 Month</v-tab> |
defcc5da3
|
159 |
<v-tab ripple>9 Month</v-tab> --> |
789f8298f
|
160 |
<img id="e" @click="mail" src="/static/icon/email1.png"/> |
789f8298f
|
161 |
<img id="d" @click="download" src="/static/icon/download1.png"/> |
defcc5da3
|
162 |
<!-- </v-tabs></v-flex> --> |
269061695
|
163 |
</span> |
8fc85e8ec
|
164 |
<v-card-text> |
c1fd43e24
|
165 |
<h5 style="position: absolute; top:275px; left:230px"><b>Select month to generate report</b></h5> |
8fc85e8ec
|
166 |
</v-card-text> |
269061695
|
167 168 |
</div> </v-card> |
269061695
|
169 |
</v-dialog> |
93a68cfa1
|
170 |
<v-data-table |
c35a8dafd
|
171 172 |
:headers="headers" :items="desserts" |
5ac5570a9
|
173 |
:pagination.sync="pagination" |
c35a8dafd
|
174 175 |
> <template slot="items" slot-scope="props"> |
e2e46164f
|
176 177 178 |
<td id="td" class="text-xs-center">{{ props.item.No }}</td> <td id="td" class="text-xs-center">{{ props.item.Name+' '+props.item.LName }}</td> <td id="td" class="text-xs-center">{{ props.item.Email }}</td> |
269061695
|
179 180 |
|
4413a8d93
|
181 |
<td class="text-xs-center"> |
269061695
|
182 183 |
<span> |
4413a8d93
|
184 185 186 |
<img style="cursor:pointer; height:20px; " class="mr-5" @click="report(props.item)" src="/static/icon/List1.png"/> <img style="cursor:pointer; width:25px; height:18px; " class="mr-5" @click="profile(props.item)" src="/static/icon/eye1.png"/> <img style="cursor:pointer; width:20px; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> |
269061695
|
187 188 |
<img style="cursor:pointer; height:20px; " class="mr-2" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> </span> |
c35a8dafd
|
189 |
</td> |
269061695
|
190 |
|
c35a8dafd
|
191 |
</template> |
4413a8d93
|
192 |
|
c35a8dafd
|
193 |
</v-data-table> |
e2e46164f
|
194 |
|
93a68cfa1
|
195 196 197 198 199 |
</v-tab-item> <v-tab-item> <v-flex xs12 sm6 offset-sm3> |
04e3fbc56
|
200 |
<v-card flat> |
04e3fbc56
|
201 |
<v-container fluid fill-height> |
93a68cfa1
|
202 |
<v-layout align-center> |
04e3fbc56
|
203 204 |
<v-flex xs12 sm8 offset-sm2> <v-flex offset-sm5> |
269061695
|
205 206 |
<v-avatar size="55px"> <img src="/static/icon/user.png"/> </v-avatar> |
04e3fbc56
|
207 |
</v-flex> |
c35a8dafd
|
208 |
<v-form ref="form" v-model="valid" lazy-validation> |
4413a8d93
|
209 210 |
<v-layout> <v-flex xs4 class="pt-4 subheading"> |
e2e46164f
|
211 |
<label>First Name: </label> |
4413a8d93
|
212 213 214 |
</v-flex> <v-flex xs8> <v-text-field |
b34ed827a
|
215 |
v-model="AddUsercredentials.firstName" |
4413a8d93
|
216 217 218 219 220 221 222 223 224 225 |
:rules="nameRules" required ></v-text-field> </v-flex> </v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label>Last Name: </label> </v-flex> <v-flex xs8> |
c35a8dafd
|
226 |
<v-text-field |
4413a8d93
|
227 |
:rules="lnameRules" |
b34ed827a
|
228 |
v-model="AddUsercredentials.lastName" |
c35a8dafd
|
229 230 |
required ></v-text-field> |
4413a8d93
|
231 232 233 234 |
</v-flex> </v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> |
e2e46164f
|
235 |
<label>Email ID: </label> |
4413a8d93
|
236 237 |
</v-flex> <v-flex xs8> |
c35a8dafd
|
238 |
<v-text-field |
c35a8dafd
|
239 |
:rules="emailRules" |
b34ed827a
|
240 |
v-model="AddUsercredentials.email" |
c35a8dafd
|
241 |
required |
4413a8d93
|
242 243 244 245 246 247 248 249 250 |
></v-text-field> </v-flex> </v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label>Date of Birth: </label> </v-flex> <v-flex xs8> |
93a68cfa1
|
251 |
<v-text-field |
04e3fbc56
|
252 |
:rules="[rules.required, rules.min]" |
b34ed827a
|
253 |
v-model="AddUsercredentials.dob" |
4413a8d93
|
254 255 256 257 258 |
required ></v-text-field> </v-flex> </v-layout> <v-card-actions> |
c35a8dafd
|
259 260 261 262 263 264 |
<v-btn @click="clear" round dark>clear</v-btn> <v-spacer></v-spacer> <v-btn @click="submit" round dark> Add </v-btn> </v-card-actions> </v-form> |
93a68cfa1
|
265 266 267 268 269 |
</v-flex> </v-layout> </v-container> </v-card> </v-flex> |
c35a8dafd
|
270 |
</v-tab-item> |
93a68cfa1
|
271 272 273 274 275 276 |
</v-tabs> </template> <script> |
c35a8dafd
|
277 |
import axios from 'axios'; |
93a68cfa1
|
278 |
export default { |
93a68cfa1
|
279 |
data: () => ({ |
c35a8dafd
|
280 281 |
No: '', Name: '', |
04e3fbc56
|
282 |
LName: '', |
c35a8dafd
|
283 |
Email: '', |
93a68cfa1
|
284 |
DOB: '', |
93a68cfa1
|
285 |
search: '', |
b34ed827a
|
286 287 288 289 |
firstName: '', lastName: '', email: '', dob: '', |
93a68cfa1
|
290 |
dialog: false, |
c35a8dafd
|
291 292 293 |
dialog1: false, dialog2: false, valid: true, |
ee83012b3
|
294 295 |
isActive: true, newActive: false, |
defcc5da3
|
296 297 298 299 300 |
loader: null, loading: false, loading2: false, loading3: false, loading4: false, |
b34ed827a
|
301 |
AddUsercredentials: {}, |
5ac5570a9
|
302 303 304 |
pagination: { rowsPerPage: 10 }, |
04e3fbc56
|
305 |
rules: { |
5ac5570a9
|
306 |
required: value => !!value || 'Date of Birth is Required.', |
ee83012b3
|
307 308 309 310 311 312 |
min: v => (/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/.test( v ) && v.length > 0) || 'Please enter a date in the format dd/mm/yyyy' |
04e3fbc56
|
313 |
}, |
4413a8d93
|
314 |
nameRules: [v => !!v || ' First Name is required'], |
c35a8dafd
|
315 316 317 318 |
emailRules: [ v => !!v || 'E-mail is required', v => /.+@.+/.test(v) || 'E-mail must be valid' ], |
4413a8d93
|
319 |
lnameRules: [v => !!v || ' Last Name is required'], |
93a68cfa1
|
320 321 322 |
headers: [ { text: 'No', |
e2e46164f
|
323 |
align: 'center', |
93a68cfa1
|
324 |
sortable: false, |
c35a8dafd
|
325 |
value: 'No' |
93a68cfa1
|
326 |
}, |
e2e46164f
|
327 328 329 |
{ text: 'Name', value: 'Name', sortable: false, align: 'center' }, { text: 'Email', value: 'Email', sortable: false, align: 'center' }, { text: '', value: '', sortable: false, align: 'center' } |
c35a8dafd
|
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
], desserts: [ { No: 1, Name: 'Amit', LName: 'goyal', Email: 'jsi@gmail.com', DOB: '22/09/1996' }, { No: 2, Name: 'Sumit', LName: 'kumar', Email: 'aasi@gmail.com', DOB: '16/09/1997' |
e2e46164f
|
345 |
} |
93a68cfa1
|
346 |
], |
93a68cfa1
|
347 348 349 350 |
editedIndex: -1, editedItem: { No: '', Name: '', |
c35a8dafd
|
351 |
LName: '', |
ee83012b3
|
352 |
Email: '' |
93a68cfa1
|
353 354 355 356 |
}, defaultItem: { No: '', Name: '', |
c35a8dafd
|
357 |
LName: '', |
ee83012b3
|
358 |
Email: '' |
c35a8dafd
|
359 |
} |
93a68cfa1
|
360 |
}), |
4413a8d93
|
361 362 363 364 365 366 367 368 |
// computed: { // pages () { // if (this.pagination.rowsPerPage == null || // this.pagination.totalItems == null // ) return 0; // return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage); // } // }, |
93a68cfa1
|
369 |
methods: { |
93a68cfa1
|
370 371 372 373 374 |
editItem (item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); this.dialog = true; }, |
c35a8dafd
|
375 376 377 378 379 380 381 382 383 |
profile (item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); this.dialog1 = true; }, report (item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); this.dialog2 = true; |
a259e694f
|
384 |
}, |
93a68cfa1
|
385 386 387 388 389 390 |
deleteItem (item) { const index = this.desserts.indexOf(item); confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); }, |
ee83012b3
|
391 392 393 394 395 396 397 398 399 400 401 402 403 |
activeTab (type) { switch (type) { case 'existing': this.newActive = false; this.isActive = true; break; default: this.newActive = true; this.isActive = false; break; } }, |
93a68cfa1
|
404 405 406 407 408 409 410 411 |
close () { this.dialog = false; setTimeout(() => { this.editedItem = Object.assign({}, this.defaultItem); this.editedIndex = -1; }, 300); }, |
c35a8dafd
|
412 413 414 415 416 417 418 419 |
close1 () { this.dialog1 = false; }, close2 () { this.dialog2 = false; }, submit () { if (this.$refs.form.validate()) { |
b34ed827a
|
420 |
console.log('=clicked==', this.AddUsercredentials); |
c35a8dafd
|
421 |
// Native form submission is not yet supported |
b34ed827a
|
422 423 424 425 426 427 |
// axios.post('/api/submit', { // Name: this.Name, // LName: this.LName, // Email: this.Email, // DOB: this.DOB // }); |
c35a8dafd
|
428 429 |
} }, |
789f8298f
|
430 |
mail () { |
4413a8d93
|
431 |
// this.editedIndex = this.desserts.indexOf(); |
789f8298f
|
432 433 |
}, download () { |
4413a8d93
|
434 435 |
// this.editedIndex = this.desserts.indexOf(); |
789f8298f
|
436 |
}, |
ee83012b3
|
437 438 439 |
clear () { this.$refs.form.reset(); }, |
93a68cfa1
|
440 |
save () { |
defcc5da3
|
441 |
console.log('editedItem', this.editedItem); |
93a68cfa1
|
442 443 444 445 446 447 448 |
if (this.editedIndex > -1) { Object.assign(this.desserts[this.editedIndex], this.editedItem); } else { this.desserts.push(this.editedItem); } this.close(); } |
4413a8d93
|
449 |
}, |
93a68cfa1
|
450 |
}; |
93a68cfa1
|
451 |
</script> |
04e3fbc56
|
452 |
<style scoped> |
ee83012b3
|
453 |
.v-card__actions .v-btn { |
04e3fbc56
|
454 455 456 |
margin: 0 15px; min-width: 120px; } |
8fc85e8ec
|
457 |
|
ee83012b3
|
458 459 460 461 462 |
h4 { background-repeat: no-repeat; padding: 8px; margin: auto; font-size: 25px; |
269061695
|
463 |
} |
ee83012b3
|
464 465 466 467 |
#name { position: absolute; left: 100px; top: 17px; |
269061695
|
468 |
} |
ee83012b3
|
469 |
#icon { |
269061695
|
470 471 472 473 |
position: absolute; right: 8px; top: 8px; } |
ee83012b3
|
474 |
#m { |
269061695
|
475 476 |
position: relative; left: 135px; |
c1fd43e24
|
477 |
top: -15px; |
269061695
|
478 |
} |
ee83012b3
|
479 480 481 |
#G { position: absolute; top: 38px; |
269061695
|
482 |
} |
ee83012b3
|
483 |
#bt { |
269061695
|
484 |
position: relative; |
ee83012b3
|
485 486 |
top: -20px; left: 115px; |
269061695
|
487 |
} |
ee83012b3
|
488 489 |
#e { position: relative; |
defcc5da3
|
490 491 |
top: 5px; right: -30px; |
269061695
|
492 493 494 |
height: 17px; cursor: pointer; } |
ee83012b3
|
495 496 |
#d { position: relative; |
defcc5da3
|
497 498 |
top: 5px; right: -70px; |
ee83012b3
|
499 500 |
height: 17px; cursor: pointer; |
269061695
|
501 502 |
} #td { |
ee83012b3
|
503 504 505 |
border: 1px solid #dddddd; text-align: left; padding: 8px; |
269061695
|
506 |
} |
ee83012b3
|
507 508 509 510 511 512 |
#dialog { height: 550px; } .active { background-color: black; color: white !important; |
269061695
|
513 |
} |
e2e46164f
|
514 |
#flex{ |
250d1e021
|
515 |
height: 300px; |
e2e46164f
|
516 |
} |
04e3fbc56
|
517 |
</style> |