Blame view
src/pages/Provider.vue
7.08 KB
93a68cfa1
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<template> <v-container grid-list-xl> <v-flex> <v-card> <v-card-title> <b><h5> Healthcare Providers </h5></b> <v-spacer></v-spacer> <v-flex xs6 sm4> <v-text-field justify-right prepend-icon="search" v-model="search" label="Find Yours Users" ></v-text-field></v-flex> </v-card-title> <v-data-table :headers="headers" :items="desserts" :search="search" > |
93a68cfa1
|
22 23 |
<template slot="items" slot-scope="props"> <td>{{ props.item.No }}</td> |
07095d4d8
|
24 |
<td>{{ props.item.Name+' '+props.item.LName }}</td> |
93a68cfa1
|
25 |
<td>{{ props.item.Email }}</td> |
a259e694f
|
26 |
<td><v-flex xs6 sm8> |
93a68cfa1
|
27 28 29 30 31 32 33 34 35 36 37 |
<v-select :items="status" v-model="e1" menu-props="auto" label="Select" hide-details single-line ></v-select> </v-flex></td> <td> <v-icon |
04e3fbc56
|
38 |
class="mr-2" |
a259e694f
|
39 |
@click="profile(props.item)" |
93a68cfa1
|
40 41 42 43 |
> visibility </v-icon> <v-icon |
a259e694f
|
44 |
|
04e3fbc56
|
45 |
class="mr-2" |
93a68cfa1
|
46 47 |
@click="editItem(props.item)" > |
04e3fbc56
|
48 |
edit |
93a68cfa1
|
49 50 |
</v-icon> <v-icon |
04e3fbc56
|
51 |
class="mr-2" |
93a68cfa1
|
52 53 |
@click="deleteItem(props.item)" > |
04e3fbc56
|
54 |
delete |
93a68cfa1
|
55 56 57 58 59 60 61 62 |
</v-icon> </td> </template> <!-- <v-alert slot="no-results" :value="true" color="error" icon="warning"> Your search for "{{ search }}" found no results. </v-alert> --> </v-data-table> |
04e3fbc56
|
63 |
|
93a68cfa1
|
64 |
<v-dialog v-model="dialog" max-width="500px"> |
04e3fbc56
|
65 |
<v-toolbar color="white"> |
93a68cfa1
|
66 67 68 69 70 71 |
<v-spacer></v-spacer> <v-toolbar-title>Edit Profile</v-toolbar-title> <v-spacer></v-spacer> </v-toolbar> <v-card> <v-flex align-center justify-center layout text-xs-center> |
04e3fbc56
|
72 |
<v-avatar size="40px" style="position:absolute; top:10px; "> |
93a68cfa1
|
73 74 75 76 77 78 79 80 |
<img src="/static/avatar/download.png"/> </v-avatar> </v-flex> <v-card-text> <v-container grid-list-md> <v-layout wrap justify-center> <v-flex xs12 sm9> <v-form> <v-text-field |
04e3fbc56
|
81 |
v-model="editedItem.Name" |
93a68cfa1
|
82 83 |
v-validate="'required|max:15'" :error-messages="errors.collect('Name')" |
a259e694f
|
84 |
label="First Name" |
93a68cfa1
|
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
data-vv-name="Name" required > </v-text-field> <v-text-field v-validate="'required|max:10'" v-model="editedItem.LName" :error-messages="errors.collect('name')" label="Last Name" data-vv-name="name" required> </v-text-field> <v-text-field v-model="editedItem.Email" v-validate="'required|email'" :error-messages="errors.collect('email')" label="E-mail" data-vv-name="email" required> </v-text-field> <v-text-field v-model="editedItem.DOB" label="Date of Birth" |
c35a8dafd
|
107 108 |
:rules="[rules.required, rules.min]" > |
93a68cfa1
|
109 110 |
</v-text-field> <v-card-actions> |
04e3fbc56
|
111 112 |
<v-btn round dark @click.native="close">Cancel</v-btn> |
93a68cfa1
|
113 |
<v-spacer></v-spacer> |
04e3fbc56
|
114 115 |
<v-btn round dark @click.native="save">Save</v-btn> |
93a68cfa1
|
116 117 118 119 120 121 |
</v-card-actions> </v-form> </v-flex> </v-layout> </v-container> </v-card-text> |
93a68cfa1
|
122 123 |
</v-card> </v-dialog> |
04e3fbc56
|
124 125 126 127 128 129 130 131 |
<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> |
a259e694f
|
132 |
|
04e3fbc56
|
133 134 135 136 137 138 139 140 141 |
<v-card> <v-flex align-center justify-center layout text-xs-center> <v-avatar size="40px" style="position:absolute; top:10px;"> <img src="/static/avatar/download.png"/> </v-avatar> </v-flex> <v-card-text> <v-container grid-list-md> <v-layout wrap justify-center> |
a259e694f
|
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
<v-flex offset-xs3> <br><br> <table> <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> |
c35a8dafd
|
159 |
|
a259e694f
|
160 |
</table> |
04e3fbc56
|
161 162 163 164 |
</v-flex> </v-layout> </v-container> </v-card-text> |
93a68cfa1
|
165 |
</v-card> |
04e3fbc56
|
166 167 168 169 |
</v-dialog> </v-card> </v-flex> |
93a68cfa1
|
170 171 172 173 174 |
</v-container> </template> <script> export default { data: () => ({ |
c35a8dafd
|
175 176 177 178 |
Name: '', LName: '', DOB: '', email: '', |
93a68cfa1
|
179 180 |
dialog: false, dialog1: false, |
04e3fbc56
|
181 |
status: ['Pending', 'Approved', 'Declined'], |
93a68cfa1
|
182 |
search: '', |
04e3fbc56
|
183 |
e1: '', |
c35a8dafd
|
184 185 186 187 |
rules: { required: value => !!value || 'This field is Required.', 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' }, |
93a68cfa1
|
188 189 190 191 192 |
headers: [ { text: 'No', align: 'left', sortable: false, |
07095d4d8
|
193 |
value: 'no' |
93a68cfa1
|
194 195 196 197 198 199 200 201 202 203 204 |
}, { text: 'Name', value: 'Name', sortable: false }, { text: 'Email', value: 'Email', sortable: false }, { text: 'Status', value: 'Status', sortable: false }, { text: '', value: '', sortable: false }, ], desserts: [], editedIndex: -1, editedItem: { No: '', |
c35a8dafd
|
205 |
Name: '', |
93a68cfa1
|
206 207 208 209 210 |
LName: '', Email: '', }, defaultItem: { No: '', |
c35a8dafd
|
211 |
Name: '', |
93a68cfa1
|
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
LName: '', Email: '', }, }), computed: { formTitle () { return this.editedIndex === -1 ? 'New Item' : 'Edit Item'; } }, watch: { dialog (val) { val || this.close(); } }, created () { this.initialize(); }, methods: { initialize () { this.desserts = [ { No: 1, |
07095d4d8
|
236 |
Name: 'Amit', |
93a68cfa1
|
237 238 239 240 241 242 |
LName: 'goyal', Email: 'jsi@gmail.com', DOB: '22/09/1996' }, { No: 2, |
07095d4d8
|
243 |
Name: 'Sumit', |
93a68cfa1
|
244 245 246 247 248 249 250 251 252 253 254 255 |
LName: 'kumar', Email: 'aasi@gmail.com', DOB: '16/09/1997' } ]; }, editItem (item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); this.dialog = true; }, |
a259e694f
|
256 257 258 |
profile (item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); |
04e3fbc56
|
259 260 |
this.dialog1 = true; }, |
93a68cfa1
|
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
deleteItem (item) { const index = this.desserts.indexOf(item); confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); }, close () { this.dialog = false; setTimeout(() => { this.editedItem = Object.assign({}, this.defaultItem); this.editedIndex = -1; }, 300); }, |
04e3fbc56
|
275 276 277 |
close1 () { this.dialog1 = false; }, |
93a68cfa1
|
278 279 280 281 282 283 284 285 286 287 288 |
save () { if (this.editedIndex > -1) { Object.assign(this.desserts[this.editedIndex], this.editedItem); } else { this.desserts.push(this.editedItem); } this.close(); } }, }; |
04e3fbc56
|
289 290 291 292 293 294 295 |
</script> <style scoped> .v-card__actions .v-btn { margin: 0px; min-width: 120px; } </style> |