Blame view

src/pages/School/school.vue 40.7 KB
37150e7c1   Neeraj Sharma   implement school ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  <template>
    <div>
      <v-tabs grow slider-color="gray">
        <v-tab
          ripple
          @click="activeTab('existing')"
          v-bind:class="{ active: isActive }"
          id="tab"
          class="subheading"
        >Existing School</v-tab>
        <v-tab
          ripple
          @click="activeTab('new')"
          v-bind:class="{ active: newActive }"
          id="tab1"
          User
          class="subheading"
        >Add New School</v-tab>
  
        <!-- ****** EDITS  STUDENTS DETAILS ****** -->
  
        <v-tab-item>
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
          <v-dialog v-model="dialog" max-width="1500px" scrollable>
            <v-card flat>
8233c5dd6   Shikha Mishra   Hide delete butto...
33
              <v-toolbar dark class="card-styles" flat>
37150e7c1   Neeraj Sharma   implement school ...
34
35
36
37
38
                <v-spacer></v-spacer>
                <v-toolbar-title>
                  <h3>Edit School</h3>
                </v-toolbar-title>
                <v-spacer></v-spacer>
57a3ca1d6   Shikha Mishra   show uploader nam...
39
                <v-icon size="24" class="right" @click="dialog = false">cancel</v-icon>
37150e7c1   Neeraj Sharma   implement school ...
40
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
87
88
89
90
91
92
93
94
95
96
97
98
99
              </v-toolbar>
              <v-card-text style="height: 686px;">
                <v-form ref="form">
                  <v-container fluid>
                    <v-layout>
                      <v-flex
                        xs12
                        class="text-xs-center text-sm-center text-md-center text-lg-center"
                      >
                        <v-avatar size="160px">
                          <img
                            src="/static/icon/user.png"
                            v-if="!editedItem.schoolLogoUrl && !imageUrl"
                          />
                          <img
                            :src="editedItem.schoolLogoUrl"
                            v-else-if="editedItem.schoolLogoUrl && !imageUrl"
                          />
                          <img
                            v-if="imageUrl"
                            :src="imageUrl"
                            height="150"
                            style="border-radius:50%; width:200px"
                          />
                        </v-avatar>
                        <input
                          type="file"
                          style="display: none"
                          ref="image"
                          accept="image/*"
                          @change="onFilePicked"
                        />
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Full Name:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field v-model="editedItem.name" placeholder="fill your full Name"></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Email ID:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">EmailID:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field placeholder="fill your email" v-model="editedItem.email"></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
66a5c3b75   Neeraj Sharma   implement gloabal...
100
                            <label class="right">Society Name:</label>
37150e7c1   Neeraj Sharma   implement school ...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              placeholder="fill your Society Name"
                              v-model="editedItem.societyName"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">City:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field v-model="editedItem.city" placeholder="fill your City Name"></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">State:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.state"
                              placeholder="fill your City Name"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Pincode:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.pinCode"
                              placeholder="fill your pincode"
                              type="number"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Fax No:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field v-model="editedItem.faxNo" placeholder="fill your fax No"></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Country:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.country"
                              placeholder="fill your Country"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.mobile"
                              placeholder="fill your MobileNo"
                              name="mobileNo"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">LandLine No:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >LandLineNo:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.landLineNo"
                              placeholder="fill your LandLine No"
                              type="number"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Registration No:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >Registration-No:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.registrationNo"
                              placeholder="fill your Registration No"
                              type="number"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              label="Select Image"
                              @click="pickFile"
                              v-model="imageName"
                              append-icon="attach_file"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">School Details:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >SchoolDetail:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.schoolDetails"
                              placeholder="fill your School Details"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Academic Year:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Year:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.establishmentYear"
                              placeholder="fill your Academic Year"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Web Site Url:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >WebSiteUrl:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.websiteUrl"
                              placeholder="fill your MobileNo"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm4>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Address:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="editedItem.address"
                              placeholder="Select your Address"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm12>
                        <v-layout>
                          <v-flex xs6>
8233c5dd6   Shikha Mishra   Hide delete butto...
309
                            <v-btn round dark @click.native="close" class="clear-button">Cancel</v-btn>
37150e7c1   Neeraj Sharma   implement school ...
310
311
                          </v-flex>
                          <v-flex xs6>
8233c5dd6   Shikha Mishra   Hide delete butto...
312
313
314
315
316
317
318
                            <v-btn
                              @click="save"
                              round
                              dark
                              :loading="loading"
                              class="right add-button"
                            >Save</v-btn>
37150e7c1   Neeraj Sharma   implement school ...
319
320
321
322
323
324
325
326
327
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card-text>
            </v-card>
          </v-dialog>
37150e7c1   Neeraj Sharma   implement school ...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
  
          <!-- ****** EXISTING-USERS STUDENTS TABLE ****** -->
          <v-data-table
            :headers="headers"
            :items="schoolList"
            :pagination.sync="pagination"
            :search="search"
          >
            <template slot="items" slot-scope="props">
7d0816758   Shikha Mishra   show dashboard wh...
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
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
              <tr class="tr">
                <td class="td td-row text-xs-center">{{ props.index + 1}}</td>
                <td class="td td-row text-xs-center">
                  <v-avatar>
                    <img :src="props.item.schoolLogoUrl" v-if="props.item.schoolLogoUrl" />
                    <img src="/static/icon/user.png" v-else-if="!props.item.schoolLogoUrl" />
                  </v-avatar>
                </td>
                <td class="td td-row text-xs-center">{{ props.item.name}}</td>
                <td class="td td-row text-xs-center">{{ props.item.email }}</td>
                <td class="td td-row text-xs-center">{{ props.item.city }}</td>
                <td class="td td-row text-xs-center">{{ props.item.state }}</td>
                <td class="td td-row text-xs-center">{{ props.item.mobile}}</td>
                <td class="td td-row text-xs-center">
                  <v-switch
                    class="pl-3"
                    v-model="props.item.status"
                    @change="suspendSchoolStatus(props.item.status,props.item._id)"
                  ></v-switch>
                </td>
                <td class="td td-row text-xs-center">
                  <span>
                    <!-- <router-link :to="{ name:'viewSchoolDashboard',params: { schoolId:props.item._id } }"> -->
                    <v-tooltip top>
                      <img
                        slot="activator"
                        style="cursor:pointer; width:25px; height:18px; "
                        class="mr5"
                        src="/static/icon/eye1.png"
                        @click="adminAccess(props.item)"
                      />
                      <span>View</span>
                    </v-tooltip>
                    <!-- </router-link> -->
                    <v-tooltip top>
                      <img
                        slot="activator"
                        style="cursor:pointer; width:20px; height:18px; "
                        class="mr5"
                        @click="editItem(props.item)"
                        src="/static/icon/edit1.png"
                      />
                      <span>Edit</span>
                    </v-tooltip>
                  </span>
                </td>
              </tr>
37150e7c1   Neeraj Sharma   implement school ...
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
            </template>
            <v-alert
              slot="no-results"
              :value="true"
              color="error"
              icon="warning"
            >Your search for "{{ search }}" found no results.</v-alert>
          </v-data-table>
        </v-tab-item>
  
        <!-- ****** ADD STUDENTS DETAILS****** -->
        <v-tab-item>
          <v-container fluid>
            <v-layout align-center justify-center fill-height>
              <v-flex xs12 sm12 md10 lg11>
                <!-- <v-container fluid> -->
                <v-snackbar
                  :timeout="timeout"
                  :top="y === 'top'"
                  :right="x === 'right'"
                  :vertical="mode === 'vertical'"
                  v-model="snackbar"
                  color="success"
                >{{ text }}</v-snackbar>
                <v-flex xs12 sm12>
                  <v-form ref="form" v-model="valid" lazy-validation>
37150e7c1   Neeraj Sharma   implement school ...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
                    <v-layout>
                      <v-flex
                        xs12
                        class="text-xs-center text-sm-center text-md-center text-lg-center"
                      >
                        <v-avatar size="100px">
                          <img src="/static/icon/user.png" v-if="!imageUrl" />
                        </v-avatar>
                        <input
                          type="file"
                          style="display: none"
                          ref="image"
                          accept="image/*"
                          @change="onFilePicked"
                        />
                        <img
                          :src="imageData.imageUrl"
                          height="150"
                          v-if="imageUrl"
                          style="border-radius:50%; width:200px"
                        />
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Full Name:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.name"
                              placeholder="fill your full Name"
                              name="name"
                              type="text"
                              :rules="nameRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right">Email ID:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              placeholder="fill your email"
                              :rules="emailRules"
                              v-model="addSchool.email"
                              type="text"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right hidden-sm-only hidden-xs-only">Society Name:</label>
                            <label
                              class="right hidden-lg-only hidden-xl-only hidden-md-only"
                            >SocietyName:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.societyName"
                              placeholder="fill your Society Name"
37150e7c1   Neeraj Sharma   implement school ...
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">City:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.city"
                              placeholder="fill your City Name"
                              name="City"
                              type="text"
                              :rules="cityRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">State:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.state"
                              placeholder="fill your State Name"
                              name="state"
                              type="text"
                              :rules="stateRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Pincode:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.pinCode"
                              placeholder="fill your pincode"
                              name="pincode"
                              type="number"
                              :rules="pincode"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right">Fax No:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field v-model="addSchool.faxNo" label="fill your Fax No" required></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Country:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-autocomplete
                              v-model="addSchool.country"
                              :items="countries"
                              :rules="country"
                              placeholder="Select Country Name"
                              required
                            ></v-autocomplete>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.mobile"
d9bb52b5b   Neeraj Sharma   implement trello ...
588
                              placeholder="fill your Mobile No"
37150e7c1   Neeraj Sharma   implement school ...
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
                              name="mobileNo"
                              type="number"
                              :rules="mobileNoRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">LandLine No:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >LandLineNo:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.landLineNo"
                              :items="countries"
37150e7c1   Neeraj Sharma   implement school ...
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
                              placeholder="fill your LandLine No"
                              type="number"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Registration No:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >Registration-No:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.registrationNo"
                              placeholder="Fill your Registration No"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">School Details:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >SchoolDetails:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.schoolDetails"
                              placeholder="Fill your School Details"
                              :rules="schoolDetailRule"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              label="Select Image"
                              @click="pickFile"
                              v-model="imageName"
                              append-icon="attach_file"
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Academic Year:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Year:</label>
                          </v-flex>
                          <v-flex xs8 class="ml-3">
                            <v-text-field
                              v-model="addSchool.establishmentYear"
                              placeholder="fill your Academic Year"
                              :rules="establishmentYearRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">WebSite Url:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >WebSiteUrl:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              name="input-4-3"
                              v-model="addSchool.websiteUrl"
d9bb52b5b   Neeraj Sharma   implement trello ...
701
                              placeholder="fill Your WebSite Url"
37150e7c1   Neeraj Sharma   implement school ...
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm6>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right">Address:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              name="input-4-3"
                              v-model="addSchool.address"
                              :rules="presentAddress"
                              placeholder="fill Your Address"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs12 sm11 offset-md1>
                        <v-layout>
                          <v-flex xs6>
8233c5dd6   Shikha Mishra   Hide delete butto...
728
                            <v-btn round dark @click="clear()" class="clear-button">Clear</v-btn>
37150e7c1   Neeraj Sharma   implement school ...
729
730
                          </v-flex>
                          <v-flex xs6>
8233c5dd6   Shikha Mishra   Hide delete butto...
731
732
733
734
735
736
737
                            <v-btn
                              @click="submit"
                              round
                              dark
                              :loading="loading"
                              class="right add-button"
                            >Add</v-btn>
37150e7c1   Neeraj Sharma   implement school ...
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                  </v-form>
                </v-flex>
              </v-flex>
            </v-layout>
          </v-container>
        </v-tab-item>
      </v-tabs>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </div>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  import countryList from "@/script/country.js";
  
  export default {
    data: () => ({
      e2: 0,
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      showLoader: false,
      loading: false,
      date: null,
      search: "",
      menu: false,
      menu1: false,
      dialog: false,
37150e7c1   Neeraj Sharma   implement school ...
776
777
778
779
      valid: true,
      isActive: true,
      newActive: false,
      pagination: {
8233c5dd6   Shikha Mishra   Hide delete butto...
780
        rowsPerPage: 15,
37150e7c1   Neeraj Sharma   implement school ...
781
782
783
784
785
      },
      imageData: {},
      imageName: "",
      imageUrl: "",
      imageFile: "",
8233c5dd6   Shikha Mishra   Hide delete butto...
786
787
788
789
790
791
792
793
794
795
796
797
798
      nameRules: [(v) => !!v || "Full Name is required"],
      dateRules: [(v) => !!v || "DOB is required"],
      cityRules: [(v) => !!v || "City Name is required"],
      pincode: [(v) => !!v || " Pincode is required"],
      country: [(v) => !!v || " Country Name is required"],
      permanentAddress: [(v) => !!v || " Permanent Address is requiclearred"],
      presentAddress: [(v) => !!v || " Present Address  is required"],
      mobileNoRules: [(v) => !!v || "Mobile Number is required"],
      stateRules: [(v) => !!v || "State Name is required"],
      schoolDetailRule: [(v) => !!v || "school Detail is required"],
      sectionRules: [(v) => !!v || " Section Name is required"],
      genderRules: [(v) => !!v || " Select Gender is required"],
      establishmentYearRules: [(v) => !!v || " Academic Year  is required"],
37150e7c1   Neeraj Sharma   implement school ...
799
800
      errorMessages: "",
      emailRules: [
8233c5dd6   Shikha Mishra   Hide delete butto...
801
802
        (v) => !!v || "E-mail is required",
        (v) =>
37150e7c1   Neeraj Sharma   implement school ...
803
          /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
8233c5dd6   Shikha Mishra   Hide delete butto...
804
          "E-mail must be valid",
37150e7c1   Neeraj Sharma   implement school ...
805
806
807
808
809
810
811
      ],
      countries: [],
      headers: [
        {
          text: "No.",
          align: "center",
          sortable: false,
8233c5dd6   Shikha Mishra   Hide delete butto...
812
          value: "rollNo",
37150e7c1   Neeraj Sharma   implement school ...
813
814
815
816
817
        },
        {
          text: "school Logo",
          value: "schoolLogoUrl",
          sortable: false,
8233c5dd6   Shikha Mishra   Hide delete butto...
818
          align: "center",
37150e7c1   Neeraj Sharma   implement school ...
819
820
821
822
823
824
825
826
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        { text: "Email", value: "email", sortable: false, align: "center" },
        { text: "City", value: "city", sortable: false, align: "center" },
        {
          text: "State",
          value: "state",
          sortable: false,
8233c5dd6   Shikha Mishra   Hide delete butto...
827
          align: "center",
37150e7c1   Neeraj Sharma   implement school ...
828
829
830
831
832
        },
        {
          text: "Mobile",
          value: "mobile",
          sortable: false,
8233c5dd6   Shikha Mishra   Hide delete butto...
833
          align: "center",
37150e7c1   Neeraj Sharma   implement school ...
834
        },
8233c5dd6   Shikha Mishra   Hide delete butto...
835
        { text: "Action", value: "", sortable: false, align: "center" },
37150e7c1   Neeraj Sharma   implement school ...
836
837
838
839
      ],
      schoolList: [],
      editedIndex: -1,
      addSchool: {
8233c5dd6   Shikha Mishra   Hide delete butto...
840
        role: "ADMIN",
37150e7c1   Neeraj Sharma   implement school ...
841
      },
68d742034   Neeraj Sharma   implement new des...
842
      editedItem: {},
8233c5dd6   Shikha Mishra   Hide delete butto...
843
      schoolToken: {},
37150e7c1   Neeraj Sharma   implement school ...
844
    }),
37150e7c1   Neeraj Sharma   implement school ...
845
846
847
848
849
    methods: {
      getSchool() {
        this.showLoader = true;
        http()
          .get("/getSchoolList", {
8233c5dd6   Shikha Mishra   Hide delete butto...
850
            headers: { Authorization: "Bearer " + this.$store.state.schoolToken },
37150e7c1   Neeraj Sharma   implement school ...
851
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
852
          .then((response) => {
37150e7c1   Neeraj Sharma   implement school ...
853
854
855
            this.schoolList = response.data.data;
            this.showLoader = false;
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
856
          .catch((error) => {
37150e7c1   Neeraj Sharma   implement school ...
857
            this.showLoader = false;
7d0816758   Shikha Mishra   show dashboard wh...
858
859
860
861
862
863
            // if (error.response.status === 401) {
            //   this.$router.replace({ path: "/" });
            //   this.$store.dispatch("setToken", null);
            //   this.$store.dispatch("Id", null);
            //   this.$store.dispatch("Role", null);
            // }
37150e7c1   Neeraj Sharma   implement school ...
864
865
866
867
868
          });
      },
      pickFile() {
        this.$refs.image.click();
      },
8233c5dd6   Shikha Mishra   Hide delete butto...
869
      dates: function (date) {
37150e7c1   Neeraj Sharma   implement school ...
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
        return moment(date).format("MMMM DD, YYYY");
      },
      onFilePicked(e) {
        // console.log(e)
        const files = e.target.files;
        this.imageData.upload = e.target.files[0];
        if (files[0] !== undefined) {
          this.imageName = files[0].name;
          if (this.imageName.lastIndexOf(".") <= 0) {
            return;
          }
          const fr = new FileReader();
          fr.readAsDataURL(files[0]);
          fr.addEventListener("load", () => {
            this.imageUrl = fr.result;
            this.imageFile = files[0]; // this is an image file that can be sent to server...
            this.imageData.imageUrl = URL.createObjectURL(this.imageFile);
          });
        } else {
          this.imageName = "";
          this.imageFile = "";
          this.imageUrl = "";
        }
      },
      editItem(item) {
        this.editedIndex = this.schoolList.indexOf(item);
        this.editedItem = Object.assign({}, item);
37150e7c1   Neeraj Sharma   implement school ...
897
898
        this.dialog = true;
      },
37150e7c1   Neeraj Sharma   implement school ...
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
      activeTab(type) {
        switch (type) {
          case "existing":
            this.newActive = false;
            this.isActive = true;
            break;
  
          default:
            this.newActive = true;
            this.isActive = false;
            break;
        }
      },
      close() {
        this.dialog = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
37150e7c1   Neeraj Sharma   implement school ...
919
920
921
922
923
924
925
926
927
      submit() {
        if (this.$refs.form.validate()) {
          if (this.imageUrl) {
            var str = this.imageUrl;
            const [baseUrl, imageUrl] = str.split(/,/);
            this.addSchool.upload = imageUrl;
          }
          this.loading = true;
          http()
7d0816758   Shikha Mishra   show dashboard wh...
928
            .post("/createSchool", this.addSchool, {
8233c5dd6   Shikha Mishra   Hide delete butto...
929
              headers: { Authorization: "Bearer " + this.schoolToken },
7d0816758   Shikha Mishra   show dashboard wh...
930
            })
8233c5dd6   Shikha Mishra   Hide delete butto...
931
            .then((response) => {
37150e7c1   Neeraj Sharma   implement school ...
932
933
934
935
936
937
              this.snackbar = true;
              this.text = "New School added successfully";
              this.clear();
              this.getSchool();
              this.loading = false;
            })
8233c5dd6   Shikha Mishra   Hide delete butto...
938
            .catch((error) => {
37150e7c1   Neeraj Sharma   implement school ...
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
              this.snackbar = true;
              this.text = error.response.data.message;
              this.loading = false;
            });
        }
      },
      clear() {
        this.$refs.form.reset();
        this.imageUrl = "";
      },
      save() {
        if (this.imageUrl) {
          var str = this.imageUrl;
          const [baseUrl, imageUrl] = str.split(/,/);
          this.editedItem.upload = imageUrl;
        }
        this.editedItem.schoolId = this.editedItem._id;
        http()
036f779bf   Shikha Mishra   pass token in upd...
957
          .put("/updateSchool", this.editedItem, {
8233c5dd6   Shikha Mishra   Hide delete butto...
958
            headers: { Authorization: "Bearer " + this.schoolToken },
036f779bf   Shikha Mishra   pass token in upd...
959
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
960
          .then((response) => {
37150e7c1   Neeraj Sharma   implement school ...
961
962
963
964
965
966
            this.snackbar = true;
            this.text = "Successfully School Existing User";
            this.imageUrl = "";
            this.getSchool();
            this.close();
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
967
          .catch((error) => {
37150e7c1   Neeraj Sharma   implement school ...
968
969
970
971
972
            // console.log(error);
            if ((this.snackbar = true)) {
              this.text = error.response.data.statusText;
            }
          });
68d742034   Neeraj Sharma   implement new des...
973
974
975
976
977
978
979
      },
      adminAccess(data) {
        // console.log("dataaaaaaaaaaaaaa", data);
        this.showLoader = true;
        http()
          .get("/getAdminAccess", {
            params: { schoolId: data._id },
8233c5dd6   Shikha Mishra   Hide delete butto...
980
            headers: { Authorization: "Bearer " + this.schoolToken },
68d742034   Neeraj Sharma   implement new des...
981
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
982
          .then((response) => {
68d742034   Neeraj Sharma   implement new des...
983
984
985
            this.$store.dispatch("setToken", response.data.data.token);
            this.$store.dispatch("Id", response.data.data.id);
            this.$store.dispatch("Role", response.data.data.role);
46993dc1d   Shikha Mishra   solve issue login
986
            this.$router.push("/dashboard");
68d600c97   Shikha Mishra   improve dashboard...
987
988
989
            setTimeout(() => {
              location.reload();
            }, 1000);
46993dc1d   Shikha Mishra   solve issue login
990
991
992
993
            // let routeData = this.$router.resolve({
            //   name: "dashboardAdmin"
            // });
            // window.open(routeData.href, "_blank");
68d742034   Neeraj Sharma   implement new des...
994
995
            this.showLoader = false;
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
996
          .catch((error) => {
68d742034   Neeraj Sharma   implement new des...
997
998
999
1000
1001
1002
            this.showLoader = false;
          });
      },
      suspendSchoolStatus(suspendStatus, id) {
        let suspendStatusData = {
          schoolId: id,
8233c5dd6   Shikha Mishra   Hide delete butto...
1003
          status: suspendStatus,
68d742034   Neeraj Sharma   implement new des...
1004
1005
1006
        };
        http()
          .put("/suspendSchoolAccount", suspendStatusData, {
8233c5dd6   Shikha Mishra   Hide delete butto...
1007
            headers: { Authorization: "Bearer " + this.schoolToken },
68d742034   Neeraj Sharma   implement new des...
1008
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
1009
          .then((response) => {
68d742034   Neeraj Sharma   implement new des...
1010
1011
1012
1013
            this.getSchool();
            this.text = response.data.message;
            this.snackbar = true;
          })
8233c5dd6   Shikha Mishra   Hide delete butto...
1014
          .catch((error) => {
68d742034   Neeraj Sharma   implement new des...
1015
1016
1017
1018
            // console.log(error.response.data.data);
            this.snackbar = true;
            this.text = error.response.data.message;
          });
8233c5dd6   Shikha Mishra   Hide delete butto...
1019
      },
37150e7c1   Neeraj Sharma   implement school ...
1020
1021
1022
1023
1024
    },
    mounted() {
      const getCountryList = countryList();
      this.countries = getCountryList;
      this.token = this.$store.state.token;
68d742034   Neeraj Sharma   implement new des...
1025
      this.schoolToken = this.$store.state.schoolToken;
37150e7c1   Neeraj Sharma   implement school ...
1026
1027
1028
      this.getSchool();
    },
    created() {
8233c5dd6   Shikha Mishra   Hide delete butto...
1029
      this.$root.$on("app:search", (search) => {
37150e7c1   Neeraj Sharma   implement school ...
1030
1031
1032
1033
1034
1035
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
8233c5dd6   Shikha Mishra   Hide delete butto...
1036
    },
37150e7c1   Neeraj Sharma   implement school ...
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
  };
  </script>
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  </style>