Blame view

src/pages/Dashboard.vue 9.91 KB
93a68cfa1   Jatinder Singh   first commit
1
2
  <template>
  <v-tabs
04e3fbc56   Jatinder Singh   minor fix
3
    slider-color="black"
93a68cfa1   Jatinder Singh   first commit
4
  >
04e3fbc56   Jatinder Singh   minor fix
5
   <v-spacer></v-spacer>
93a68cfa1   Jatinder Singh   first commit
6
7
8
9
10
11
12
13
14
    <v-tab ripple>
      Existing user
    </v-tab>
    <v-spacer></v-spacer>
    <v-tab ripple>
      Add New Users
    </v-tab>
    <v-spacer></v-spacer>
    <v-tab-item>
c35a8dafd   Jatinder Singh   minor changes
15
16
17
18
19
20
21
22
       <v-dialog v-model="dialog" max-width="500px">
       <v-toolbar color="white">
         <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>
8fc85e8ec   Jatinder Singh   data table changes
23
        <v-avatar size="50px" style="position:absolute; top:10px; "> 
269061695   Jatinder Singh   changes
24
        <img src="/static/icon/user.png"/> </v-avatar> 
c35a8dafd   Jatinder Singh   minor changes
25
26
27
28
29
30
31
32
       </v-flex>  
            <v-card-text>
            <v-container grid-list-md>
            <v-layout wrap justify-center>
            <v-flex xs12 sm9> 
            <v-form>
      <v-text-field
        v-model="editedItem.Name" 
269061695   Jatinder Singh   changes
33
        v-validate="'required'"
c35a8dafd   Jatinder Singh   minor changes
34
35
36
37
38
39
        :error-messages="errors.collect('Name')"
        label="First Name"
        data-vv-name="Name"
        required >
      </v-text-field>
        <v-text-field
269061695   Jatinder Singh   changes
40
        v-validate="'required'"
c35a8dafd   Jatinder Singh   minor changes
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
        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"
        :rules="[rules.required, rules.min]"
         >
      </v-text-field>
      <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>
      </v-form>
  </v-flex>
  </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>
8fc85e8ec   Jatinder Singh   data table changes
87
        <v-avatar size="50px" style="position:absolute; top:10px;"> 
269061695   Jatinder Singh   changes
88
        <img src="/static/icon/user.png"/> </v-avatar> 
c35a8dafd   Jatinder Singh   minor changes
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
       </v-flex>  
   <v-card-text>
      <v-container grid-list-md>
        <v-layout wrap justify-center>
          <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>
              
          
            </table>
          </v-flex>
        </v-layout>
      </v-container>
      </v-card-text>
      </v-card>
  </v-dialog>
c35a8dafd   Jatinder Singh   minor changes
118

269061695   Jatinder Singh   changes
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  <v-dialog v-model="dialog2" max-width="800px">
   
    <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">
           <v-btn flat>1 month</v-btn>
           <v-btn flat>3 Month</v-btn>
           <v-btn flat>6 Month</v-btn>
           <v-btn flat>12 Month</v-btn>
8fc85e8ec   Jatinder Singh   data table changes
134
           <img id="e" @click="close1" src="/static/avatar/email1.png"/>
269061695   Jatinder Singh   changes
135
      
8fc85e8ec   Jatinder Singh   data table changes
136
           <img id="d" @click="close1" src="/static/avatar/download1.png"/>
269061695   Jatinder Singh   changes
137
         </span>
8fc85e8ec   Jatinder Singh   data table changes
138
139
140
         <v-card-text>
           <h5 style="position: absolute; top:275px; left:270px"><b>Select month to generate report</b></h5>
         </v-card-text>
269061695   Jatinder Singh   changes
141
142
         </div>
      </v-card>
c35a8dafd   Jatinder Singh   minor changes
143
    
269061695   Jatinder Singh   changes
144
  </v-dialog>
93a68cfa1   Jatinder Singh   first commit
145
        <v-data-table
c35a8dafd   Jatinder Singh   minor changes
146
147
          :headers="headers"
          :items="desserts"
c35a8dafd   Jatinder Singh   minor changes
148
149
        >
          <template slot="items" slot-scope="props">
269061695   Jatinder Singh   changes
150
151
152
153
154
155
156
157
158
159
160
161
162
            <td id="td">{{ props.item.No }}</td>
            <td id="td">{{ props.item.Name+' '+props.item.LName }}</td>
            <td id="td">{{ props.item.Email }}</td>
            
        
            <td id="td" class="justify-center align-center layout px-0">
            
             <span>
            <img style="cursor:pointer; height:20px; " class="mr-2" @click="report(props.item)" src="/static/icon/List1.png"/>
            <img style="cursor:pointer; width:25px; height:18px; " class="mr-2" @click="profile(props.item)" src="/static/icon/eye1.png"/>
            <img style="cursor:pointer; width:20px; height:18px; " class="mr-2" @click="editItem(props.item)" src="/static/icon/edit1.png"/>
            <img style="cursor:pointer; height:20px; " class="mr-2" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/>
            </span>
c35a8dafd   Jatinder Singh   minor changes
163
            </td>
269061695   Jatinder Singh   changes
164
            
c35a8dafd   Jatinder Singh   minor changes
165
166
          </template>
        </v-data-table>
93a68cfa1   Jatinder Singh   first commit
167
168
169
170
171
    </v-tab-item>
    <v-tab-item>
         <v-flex xs12 sm6 offset-sm3>
   
   
04e3fbc56   Jatinder Singh   minor fix
172
  <v-card flat>
c35a8dafd   Jatinder Singh   minor changes
173
       <!-- <v-card-text>Contents for Item 2 go here</v-card-text> -->
04e3fbc56   Jatinder Singh   minor fix
174
    <v-container fluid fill-height>
93a68cfa1   Jatinder Singh   first commit
175
      <v-layout align-center>
04e3fbc56   Jatinder Singh   minor fix
176
177
        <v-flex xs12 sm8 offset-sm2> 
         <v-flex offset-sm5>
269061695   Jatinder Singh   changes
178
179
          <v-avatar size="55px"> 
          <img src="/static/icon/user.png"/> </v-avatar> 
04e3fbc56   Jatinder Singh   minor fix
180
        </v-flex>
c35a8dafd   Jatinder Singh   minor changes
181
182
183
184
  <v-form ref="form" v-model="valid" lazy-validation>
      <v-text-field
        v-model="Name"
        :rules="nameRules"
269061695   Jatinder Singh   changes
185
        label="First Name"
c35a8dafd   Jatinder Singh   minor changes
186
        required
93a68cfa1   Jatinder Singh   first commit
187
188
      ></v-text-field>
      <v-text-field
c35a8dafd   Jatinder Singh   minor changes
189
190
191
192
193
194
        :rules="nameRules"
        v-model="LName"
        label="Last name"
        required
        ></v-text-field>
      <v-text-field
93a68cfa1   Jatinder Singh   first commit
195
        v-model="email"
c35a8dafd   Jatinder Singh   minor changes
196
        :rules="emailRules"
93a68cfa1   Jatinder Singh   first commit
197
        label="E-mail"
c35a8dafd   Jatinder Singh   minor changes
198
199
        required
      ></v-text-field>
93a68cfa1   Jatinder Singh   first commit
200
      <v-text-field
04e3fbc56   Jatinder Singh   minor fix
201
        :rules="[rules.required, rules.min]"
c35a8dafd   Jatinder Singh   minor changes
202
203
204
205
206
207
208
209
210
211
212
        label="Date of Birth"
        v-model="DOB"
        required >
        </v-text-field>
  <v-card-actions>
      <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   Jatinder Singh   first commit
213
214
215
216
217
  </v-flex>
  </v-layout>
  </v-container>
      </v-card>
         </v-flex>
c35a8dafd   Jatinder Singh   minor changes
218
    </v-tab-item> 
93a68cfa1   Jatinder Singh   first commit
219
220
221
222
223
224
  </v-tabs>
  
   
  </template>
  
  <script>
c35a8dafd   Jatinder Singh   minor changes
225
  import axios from 'axios';
93a68cfa1   Jatinder Singh   first commit
226
  export default {
93a68cfa1   Jatinder Singh   first commit
227
    data: () => ({
c35a8dafd   Jatinder Singh   minor changes
228
229
      No: '',
      Name: '',
04e3fbc56   Jatinder Singh   minor fix
230
      LName: '',
c35a8dafd   Jatinder Singh   minor changes
231
      Email: '',
93a68cfa1   Jatinder Singh   first commit
232
      DOB: '',
04e3fbc56   Jatinder Singh   minor fix
233
      clear: '',
93a68cfa1   Jatinder Singh   first commit
234
235
      search: '',
      dialog: false,
c35a8dafd   Jatinder Singh   minor changes
236
237
238
      dialog1: false,
      dialog2: false,
      valid: true,
04e3fbc56   Jatinder Singh   minor fix
239
240
241
      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'
04e3fbc56   Jatinder Singh   minor fix
242
      },
c35a8dafd   Jatinder Singh   minor changes
243
244
245
246
247
248
249
250
      nameRules: [
        v => !!v || 'Name is required',
      ],
      email: '',
      emailRules: [
        v => !!v || 'E-mail is required',
        v => /.+@.+/.test(v) || 'E-mail must be valid'
      ],
93a68cfa1   Jatinder Singh   first commit
251
252
253
254
255
      headers: [
        {
          text: 'No',
          align: 'left',
          sortable: false,
c35a8dafd   Jatinder Singh   minor changes
256
          value: 'No'
93a68cfa1   Jatinder Singh   first commit
257
258
259
        },
        { text: 'Name', value: 'Name', sortable: false },
        { text: 'Email', value: 'Email', sortable: false },
8fc85e8ec   Jatinder Singh   data table changes
260
        { text: '', value: '', sortable: false },
c35a8dafd   Jatinder Singh   minor changes
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
      ],
      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'
        }
93a68cfa1   Jatinder Singh   first commit
277
      ],
93a68cfa1   Jatinder Singh   first commit
278
279
280
281
      editedIndex: -1,
      editedItem: {
        No: '',
        Name: '',
c35a8dafd   Jatinder Singh   minor changes
282
        LName: '',
93a68cfa1   Jatinder Singh   first commit
283
284
285
286
287
        Email: '',
      },
      defaultItem: {
        No: '',
        Name: '',
c35a8dafd   Jatinder Singh   minor changes
288
        LName: '',
93a68cfa1   Jatinder Singh   first commit
289
        Email: '',
c35a8dafd   Jatinder Singh   minor changes
290
      }
93a68cfa1   Jatinder Singh   first commit
291
    }),
93a68cfa1   Jatinder Singh   first commit
292
    methods: {
93a68cfa1   Jatinder Singh   first commit
293
294
295
296
297
      editItem (item) {
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog = true;
      },
c35a8dafd   Jatinder Singh   minor changes
298
299
300
301
302
303
304
305
306
      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   Jatinder Singh   minor change
307
      },
93a68cfa1   Jatinder Singh   first commit
308
309
310
311
312
313
314
315
316
317
318
319
320
321
  
      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);
      },
c35a8dafd   Jatinder Singh   minor changes
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
      close1 () {
        this.dialog1 = false;
      },
      close2 () {
        this.dialog2 = false;
      },
      submit () {
        if (this.$refs.form.validate()) {
          // Native form submission is not yet supported
          axios.post('/api/submit', {
            Name: this.Name,
            LName: this.LName,
            Email: this.Email,
            DOB: this.DOB,
  
          });
        }
      },
269061695   Jatinder Singh   changes
340
341
342
      // clear () {
      //   this.$refs.form.reset();
      // },
c35a8dafd   Jatinder Singh   minor changes
343
   
93a68cfa1   Jatinder Singh   first commit
344
345
346
347
348
349
350
351
352
  
      save () {
        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
353
354
355
356
    }
  };
  
  </script>
04e3fbc56   Jatinder Singh   minor fix
357
358
359
360
361
  <style scoped>
  .v-card__actions .v-btn{
    margin: 0 15px;
    min-width: 120px;
  }
8fc85e8ec   Jatinder Singh   data table changes
362

269061695   Jatinder Singh   changes
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
  h4{
      background-repeat: no-repeat;
      padding: 8px;
      margin: auto;
      font-size: 25px;
  }
  #name{
  position: absolute;
  left: 100px;
  top: 17px
  }
  #icon{
    position: absolute;
    right: 8px;
    top: 8px;
  }
  #m{
    position: relative;
    left: 135px;
    top: -11px;
  }
  #G{
   position: absolute;
   top: 38px;
  }
  #bt{
    position: relative;
     top: -20px;
     left:115px;
  }
  #e{
   position: relative;
   right: -110px;
    height: 17px;
    cursor: pointer;
  }
  #d{
   position: relative;
   right: -150px;
   height: 17px;
   cursor: pointer;
  }
  #td {
      border: 1px solid #dddddd;
      text-align: left;
      padding: 8px;
  }
  #dialog{
    height:550px;
    
  }
04e3fbc56   Jatinder Singh   minor fix
414
  </style>