Blame view

src/pages/Provider.vue 8.64 KB
93a68cfa1   Jatinder Singh   first commit
1
  <template>
269061695   Jatinder Singh   changes
2
  <v-container grid-list-md>
93a68cfa1   Jatinder Singh   first commit
3
4
5
  <v-flex>
    <v-card>
      <v-card-title>
250d1e021   Jatinder Singh   datatable change
6
        <b><h5> Healthcare Providers </h5></b>
93a68cfa1   Jatinder Singh   first commit
7
8
9
10
11
12
        <v-spacer></v-spacer>
        <v-flex xs6 sm4>
        <v-text-field justify-right
          prepend-icon="search" 
          v-model="search"
          label="Find Yours Users"
4413a8d93   Jatinder Singh   changes
13
          color="black"
93a68cfa1   Jatinder Singh   first commit
14
15
        ></v-text-field></v-flex>
      </v-card-title>
04e3fbc56   Jatinder Singh   minor fix
16

93a68cfa1   Jatinder Singh   first commit
17
     <v-dialog v-model="dialog" max-width="500px">
250d1e021   Jatinder Singh   datatable change
18
         <v-toolbar color="white">
93a68cfa1   Jatinder Singh   first commit
19
20
21
22
         <v-spacer></v-spacer>
         <v-toolbar-title>Edit Profile</v-toolbar-title>
         <v-spacer></v-spacer>
         </v-toolbar>
250d1e021   Jatinder Singh   datatable change
23
24
25
26
27
         <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> 
         </v-flex>  
93a68cfa1   Jatinder Singh   first commit
28
29
30
31
            <v-card-text>
            <v-container grid-list-md>
            <v-layout wrap justify-center>
            <v-flex xs12 sm9> 
09f34e0c8   Jatinder Singh   notification page
32
            <v-form ref="form" v-model="valid" lazy-validation>
250d1e021   Jatinder Singh   datatable change
33
            <v-layout style="position:relative; top:15px; ">
e2e46164f   Jatinder Singh   edit profile changes
34
35
36
37
38
39
40
41
        <v-flex xs4 class="pt-4 subheading">
        <label>First Name: </label>
        </v-flex>
        <v-flex xs8>
        <v-text-field
        v-model="editedItem.Name"
        :rules="nameRules"
        required
250d1e021   Jatinder Singh   datatable change
42
43
44
45
        ></v-text-field>
        </v-flex>
        </v-layout>
        <v-layout>
e2e46164f   Jatinder Singh   edit profile changes
46
47
48
49
        <v-flex xs4 class="pt-4 subheading">
        <label>Last Name: </label>
        </v-flex>
        <v-flex xs8>
93a68cfa1   Jatinder Singh   first commit
50
        <v-text-field
93a68cfa1   Jatinder Singh   first commit
51
        v-model="editedItem.LName"
e2e46164f   Jatinder Singh   edit profile changes
52
53
        :rules="lnameRules"
        required
250d1e021   Jatinder Singh   datatable change
54
55
56
        ></v-text-field>
        </v-flex>
        </v-layout>
250d1e021   Jatinder Singh   datatable change
57
        <v-layout>
e2e46164f   Jatinder Singh   edit profile changes
58
59
60
61
62
63
        <v-flex xs4 class="pt-4 subheading">
        <label>Email ID: </label>
        </v-flex>
        <v-flex xs8>
        <v-text-field
        v-model="editedItem.Email"
7e8044568   Jatinder Singh   table header changes
64
        :rules="emailRules"
e2e46164f   Jatinder Singh   edit profile changes
65
66
67
        data-vv-name="E-mail"
        required
        ></v-text-field></v-flex></v-layout>
250d1e021   Jatinder Singh   datatable change
68
        <v-layout>
e2e46164f   Jatinder Singh   edit profile changes
69
70
71
72
73
74
75
76
77
        <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>
        <v-card-actions>
04e3fbc56   Jatinder Singh   minor fix
78
        <v-btn round dark @click.native="close">Cancel</v-btn>
93a68cfa1   Jatinder Singh   first commit
79
        <v-spacer></v-spacer>
04e3fbc56   Jatinder Singh   minor fix
80
81
        <v-btn round dark @click.native="save">Save</v-btn>
       
93a68cfa1   Jatinder Singh   first commit
82
83
84
85
86
87
        </v-card-actions>
      </v-form>
  </v-flex>
  </v-layout>
  </v-container>
  </v-card-text>
93a68cfa1   Jatinder Singh   first commit
88
89
  </v-card>
  </v-dialog>
04e3fbc56   Jatinder Singh   minor fix
90
91
92
93
94
95
96
97
  
  <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   Jatinder Singh   minor change
98
         
04e3fbc56   Jatinder Singh   minor fix
99
100
101
  
        <v-card>
        <v-flex align-center justify-center layout text-xs-center>
8fc85e8ec   Jatinder Singh   data table changes
102
        <v-avatar size="50px" style="position:absolute; top:10px;"> 
269061695   Jatinder Singh   changes
103
        <img src="/static/icon/user.png"/> </v-avatar> 
04e3fbc56   Jatinder Singh   minor fix
104
105
106
107
       </v-flex>  
   <v-card-text>
      <v-container grid-list-md>
        <v-layout wrap justify-center>
a259e694f   Jatinder Singh   minor change
108
109
110
111
112
113
114
115
116
117
118
          <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>
250d1e021   Jatinder Singh   datatable change
119
120
121
122
                <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>
a259e694f   Jatinder Singh   minor change
123
124
              </th>
              
c35a8dafd   Jatinder Singh   minor changes
125
          
a259e694f   Jatinder Singh   minor change
126
            </table>
04e3fbc56   Jatinder Singh   minor fix
127
128
129
130
          </v-flex>
        </v-layout>
      </v-container>
      </v-card-text>
250d1e021   Jatinder Singh   datatable change
131
    </v-card>
04e3fbc56   Jatinder Singh   minor fix
132
  </v-dialog>
269061695   Jatinder Singh   changes
133
134
135
136
      <v-data-table
        :headers="headers"
        :items="desserts"
        :search="search"
8fc85e8ec   Jatinder Singh   data table changes
137
        class="elevation-1"
5ac5570a9   Jatinder Singh   datatable changes
138
        :pagination.sync="pagination"
269061695   Jatinder Singh   changes
139
140
141
      >
      
        <template slot="items" slot-scope="props">
e2e46164f   Jatinder Singh   edit profile changes
142
143
144
          <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>
c1fd43e24   Jatinder Singh   changes
145
146
147
148
149
150
151
152
153
154
155
156
          <td id="td" class="text-xs-center">
            <v-flex xs6 sm6>
              <v-select
              :items="status"
              v-model="props.item.e1"
              menu-props="auto"
              label="Select"
              hide-details
              single-line
              ></v-select>
              </v-flex>
              </td>
4413a8d93   Jatinder Singh   changes
157
          <td class="text-xs-center">
269061695   Jatinder Singh   changes
158
            <span>
4413a8d93   Jatinder Singh   changes
159
160
            <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   Jatinder Singh   changes
161
162
163
164
165
166
            <img style="cursor:pointer; height:20px; " class="mr-2" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/>
            </span>
      </td>
         
        </template>
      </v-data-table>
04e3fbc56   Jatinder Singh   minor fix
167
168
169
  
  </v-card>
  </v-flex>
93a68cfa1   Jatinder Singh   first commit
170
171
172
  </v-container>
  </template>
  <script>
e173bab21   Jatinder Singh   api
173
  import axios from 'axios';
93a68cfa1   Jatinder Singh   first commit
174
175
  export default {
    data: () => ({
c35a8dafd   Jatinder Singh   minor changes
176
177
178
179
      Name: '',
      LName: '',
      DOB: '',
      email: '',
09f34e0c8   Jatinder Singh   notification page
180
      valid: '',
93a68cfa1   Jatinder Singh   first commit
181
182
      dialog: false,
      dialog1: false,
04e3fbc56   Jatinder Singh   minor fix
183
      status: ['Pending', 'Approved', 'Declined'],
93a68cfa1   Jatinder Singh   first commit
184
      search: '',
04e3fbc56   Jatinder Singh   minor fix
185
      e1: '',
c35a8dafd   Jatinder Singh   minor changes
186
187
188
189
      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'
      },
e2e46164f   Jatinder Singh   edit profile changes
190
      nameRules: [v => !!v || ' First Name is required'],
09f34e0c8   Jatinder Singh   notification page
191
      lnameRules: [v => !!v || ' Last Name is required'],
e2e46164f   Jatinder Singh   edit profile changes
192
193
194
195
      emailRules: [
        v => !!v || 'E-mail is required',
        v => /.+@.+/.test(v) || 'E-mail must be valid'
      ],
5ac5570a9   Jatinder Singh   datatable changes
196
197
198
199
      pagination: {
        rowsPerPage: 10,
    
      },
93a68cfa1   Jatinder Singh   first commit
200
      headers: [
269061695   Jatinder Singh   changes
201
        { 
93a68cfa1   Jatinder Singh   first commit
202
          text: 'No',
e2e46164f   Jatinder Singh   edit profile changes
203
          align: 'center',
93a68cfa1   Jatinder Singh   first commit
204
          sortable: false,
07095d4d8   Jatinder Singh   regex
205
          value: 'no'
93a68cfa1   Jatinder Singh   first commit
206
        },
e2e46164f   Jatinder Singh   edit profile changes
207
208
209
        { text: 'Name', value: 'Name', sortable: false, align: 'center' },
        { text: 'Email', value: 'Email', sortable: false, align: 'center' },
        { text: 'Status', value: 'Status', sortable: false, align: 'center' },
93a68cfa1   Jatinder Singh   first commit
210
211
212
213
214
215
216
        { text: '', value: '', sortable: false },
  
      ],
      desserts: [],
      editedIndex: -1,
      editedItem: {
        No: '',
c35a8dafd   Jatinder Singh   minor changes
217
        Name: '',
93a68cfa1   Jatinder Singh   first commit
218
219
220
221
222
        LName: '',
        Email: '',
      },
      defaultItem: {
        No: '',
c35a8dafd   Jatinder Singh   minor changes
223
        Name: '',
93a68cfa1   Jatinder Singh   first commit
224
225
226
227
        LName: '',
        Email: '',
      },
    }),
93a68cfa1   Jatinder Singh   first commit
228
229
230
231
232
233
234
235
236
    watch: {
      dialog (val) {
        val || this.close();
      }
    },
  
    created () {
      this.initialize();
    },
e173bab21   Jatinder Singh   api
237
238
239
    mounted(){
      this.getProviderList();
    },
93a68cfa1   Jatinder Singh   first commit
240
    methods: {
e173bab21   Jatinder Singh   api
241
242
243
244
245
246
247
248
249
       getProviderList(){
        var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjViZWQyYTRkMDRlZGE3ZTBiNzcwYjg5YiIsImVtYWlsIjoiYWRtaW5AZ21haWwuY29tIiwiaWF0IjoxNTQyMzQzNzg3LCJleHAiOjE1NDIzNDM5MDd9.diDjMkhRXvpdpXxibfsE9EmIb5G-39Bcy3qdzA0rREg"
         axios.get('http://18.208.28.55:3000/v1/provider-list',{headers: {Authorization: 'Bearer '+ token}})
          .then(response => {
            console.log("response=====>",response.data);
         }).catch(err => {
             console.log("err====>",err);
         })
      },
93a68cfa1   Jatinder Singh   first commit
250
251
252
253
      initialize () {
        this.desserts = [
          {
            No: 1,
07095d4d8   Jatinder Singh   regex
254
            Name: 'Amit',
93a68cfa1   Jatinder Singh   first commit
255
256
257
258
259
260
            LName: 'goyal',
            Email: 'jsi@gmail.com',
            DOB: '22/09/1996'
          },
          {
            No: 2,
07095d4d8   Jatinder Singh   regex
261
            Name: 'Sumit',
93a68cfa1   Jatinder Singh   first commit
262
263
264
265
            LName: 'kumar',
            Email: 'aasi@gmail.com',
            DOB: '16/09/1997'
          }
4413a8d93   Jatinder Singh   changes
266
          
93a68cfa1   Jatinder Singh   first commit
267
268
269
270
271
272
273
274
        ];
      },
  
      editItem (item) {
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog = true;
      },
a259e694f   Jatinder Singh   minor change
275
276
277
      profile (item) {
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
04e3fbc56   Jatinder Singh   minor fix
278
279
        this.dialog1 = true;
      },
93a68cfa1   Jatinder Singh   first commit
280
281
282
283
284
285
286
287
288
289
290
291
292
293
  
      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   Jatinder Singh   minor fix
294
295
296
      close1 () {
        this.dialog1 = false;
      },
93a68cfa1   Jatinder Singh   first commit
297
298
  
      save () {
09f34e0c8   Jatinder Singh   notification page
299
300
301
302
303
304
305
306
        if (this.$refs.form.validate()) {
          console.log('editedItem', this.editedItem);
          if (this.editedIndex > -1) {
            Object.assign(this.desserts[this.editedIndex], this.editedItem);
          } else {
            this.desserts.push(this.editedItem);
          }
          this.close();
93a68cfa1   Jatinder Singh   first commit
307
        }
93a68cfa1   Jatinder Singh   first commit
308
309
310
      }
    }, 
  };
04e3fbc56   Jatinder Singh   minor fix
311
312
313
314
315
316
  </script>
  <style scoped>
  .v-card__actions .v-btn {
  margin: 0px;
  min-width: 120px;
  }
269061695   Jatinder Singh   changes
317
318
  #td {
      border: 1px solid #dddddd;
269061695   Jatinder Singh   changes
319
320
      padding: 8px;
  }
789f8298f   Jatinder Singh   change
321

04e3fbc56   Jatinder Singh   minor fix
322
  </style>