Blame view

src/pages/Section/section.vue 18.9 KB
76f4f9c78   Neeraj Sharma   all api add in se...
1
  <template>
68d742034   Neeraj Sharma   implement new des...
2
    <v-container fluid class="body-color">
db965de89   Amber Dev   added dialog pers...
3
      <v-dialog v-model="editSectionDialog" max-width="460px" persistent>
68d742034   Neeraj Sharma   implement new des...
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
33
34
35
36
37
38
39
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
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Section</label>
              <v-icon size="24" class="right" @click="editSectionDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-container fluid>
            <v-layout wrap justify-center>
              <v-flex xs12 sm12>
                <v-form>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <label class="right">Class :</label>
                    </v-flex>
                    <v-flex xs7 sm8>
                      <v-autocomplete
                        :items="addclass"
                        :label="editedItem.classData.classNum"
                        v-model="editItem.classId"
                        item-text="classNum"
                        item-value="_id"
                        class="ml-2"
                      ></v-autocomplete>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <h5 class="right my-1 hidden-xs-only hidden-sm-only">Section Name :</h5>
                      <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Name :</h5>
                    </v-flex>
                    <v-flex xs7 sm8>
                      <v-autocomplete
                        v-model="editedItem.name"
                        placeholder="fill your Section Name"
                        :items="SectionName"
                        class="ml-2"
                      ></v-autocomplete>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <h5 class="right my-1 hidden-xs-only hidden-sm-only">Incharge :</h5>
                      <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Incharge :</h5>
                    </v-flex>
                    <v-flex xs7 sm8>
                      <v-select
                        :items="teacherList"
                        v-model="editedItem.classInchargeId"
                        :label="editedItem.teacherData[0].name"
                        item-text="name"
                        item-value="_id"
                        class="ml-2"
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-flex xs12>
                    <v-card-actions>
                      <v-btn round dark @click.native="closeSectionDialog" class="add-button">Cancel</v-btn>
                      <v-spacer></v-spacer>
                      <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
                    </v-card-actions>
aa8fc5033   Neeraj Sharma   implenment all pa...
66
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
67
68
69
70
71
72
                </v-form>
              </v-flex>
            </v-layout>
          </v-container>
        </v-card>
      </v-dialog>
26ec38b66   Neeraj Sharma   added teacher lis...
73

68d742034   Neeraj Sharma   implement new des...
74
      <!-- ****** PROFILE VIEW SECTION DATA ******  -->
76f4f9c78   Neeraj Sharma   all api add in se...
75

db965de89   Amber Dev   added dialog pers...
76
      <v-dialog v-model="viewSectionDialog" max-width="500px" persistent>
68d742034   Neeraj Sharma   implement new des...
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
        <v-card flat class="card-style pa-3" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Section</label>
              <v-icon size="24" class="right" @click="viewSectionDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex>
                  <v-layout>
                    <v-flex xs7 sm6>
                      <h5 class="right my-1 hidden-xs-only hidden-sm-only">
                        <b>Class Name :</b>
                      </h5>
                      <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">
                        <b>Class :</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs5>
                      <h5 class="my-1">{{ editedItem.classData.classNum }}</h5>
5f1d4b444   Neeraj Sharma   fix design and fi...
99
                    </v-flex>
26ec38b66   Neeraj Sharma   added teacher lis...
100
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
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
                  <v-layout>
                    <v-flex xs7 sm6>
                      <h5 class="right my-1">
                        <b>Section Name :</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs5>
                      <h5 class="my-1">{{ editedItem.name }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs7 sm6>
                      <h5 class="right my-1 hidden-xs-only hidden-sm-only">
                        <b>Class Incharge :</b>
                      </h5>
                      <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">
                        <b>Incharge :</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs5>
                      <h5 class="my-1">{{ editedItem.teacherData[0].name }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs7 sm6>
                      <h5 class="right my-1">
                        <b>Session :</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs5>
                      <h5 class="my-1">{{ editedItem.session }}</h5>
26ec38b66   Neeraj Sharma   added teacher lis...
132
133
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
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
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
      <!-- ****** Section Table ****** -->
      <v-toolbar color="transparent" flat>
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addSectionDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addSectionDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Section
        </v-btn>
        <v-spacer></v-spacer>
        <v-card-title class="body-1" v-show="show">
          <v-btn icon large flat @click="displaySearch">
            <v-avatar size="27">
aa310d61a   Shikha Mishra   added functionali...
163
              <img src="/static/icon/search.png" alt="icon" />
68d742034   Neeraj Sharma   implement new des...
164
165
166
            </v-avatar>
          </v-btn>
        </v-card-title>
612b79bb4   Amber Dev   made serch auto f...
167
        <v-flex xs8 v-if="showSearch">
68d742034   Neeraj Sharma   implement new des...
168
169
          <v-layout>
            <v-text-field
8e8d14254   Shikha Mishra   Cleared data whil...
170
              autofocus
68d742034   Neeraj Sharma   implement new des...
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
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
              style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important"
            ></v-text-field>
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="sectionList"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <tr class="tr">
            <td class="td td-row">{{ props.index + 1 }}</td>
            <td class="text-xs-center td td-row">{{ props.item.classData.classNum }}</td>
            <td class="text-xs-center td td-row">{{ props.item.name }}</td>
            <td class="text-xs-center td td-row">{{ props.item.session }}</td>
            <td class="text-xs-center td td-row">
              <span>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px;"
                    class="mr-3"
                    @click="profile(props.item)"
aa310d61a   Shikha Mishra   added functionali...
201
                    src="/static/icon/view.png"
68d742034   Neeraj Sharma   implement new des...
202
203
204
205
206
207
208
209
210
                  />
                  <span>View</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
aa310d61a   Shikha Mishra   added functionali...
211
                    src="/static/icon/edit.png"
68d742034   Neeraj Sharma   implement new des...
212
213
214
                  />
                  <span>Edit</span>
                </v-tooltip>
b039d39fb   Shikha Mishra   Hide Edit functio...
215
                <!-- <v-tooltip top>
68d742034   Neeraj Sharma   implement new des...
216
217
218
219
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    @click="deleteItem(props.item)"
aa310d61a   Shikha Mishra   added functionali...
220
                    src="/static/icon/delete.png"
68d742034   Neeraj Sharma   implement new des...
221
222
223
                    class="mr-3"
                  />
                  <span>Delete</span>
8e8d14254   Shikha Mishra   Cleared data whil...
224
                </v-tooltip>-->
68d742034   Neeraj Sharma   implement new des...
225
226
227
228
229
230
231
232
233
234
235
236
              </span>
            </td>
          </tr>
        </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> -->
7efe02762   Amber Dev   made forms reset
237
      <!-- DIALOG BOX - ADD Students Dialog box -->
db965de89   Amber Dev   added dialog pers...
238
      <v-dialog v-model="addSectionDialog" max-width="400px" v-if="addSectionDialog" persistent>
68d742034   Neeraj Sharma   implement new des...
239
240
241
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
8c3acf4a9   Shikha Mishra   improve details
242
              <label class="title text-xs-center">Add Section</label>
8e8d14254   Shikha Mishra   Cleared data whil...
243
244
245
246
247
              <v-icon
                size="24"
                class="right"
                @click="$refs.form.reset();addSectionDialog = false"
              >cancel</v-icon>
26ec38b66   Neeraj Sharma   added teacher lis...
248
            </v-flex>
68d742034   Neeraj Sharma   implement new des...
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
          </v-layout>
          <v-container fluid fill-height>
            <v-layout align-center>
              <v-flex xs12>
                <v-form ref="form" v-model="valid" lazy-validation>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Section :</label>
                    </v-flex>
                    <v-flex xs8 class="ml-3">
                      <v-autocomplete
                        v-model="sectionData.name"
                        placeholder="fill your Section Name"
                        :items="SectionName"
                        :rules="nameRules"
                        required
                      ></v-autocomplete>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Class :</label>
                    </v-flex>
                    <v-flex xs8 class="ml-3">
                      <v-select
                        :items="addclass"
                        label="Select Class"
                        v-model="sectionData.classNum"
                        item-text="classNum"
                        item-value="_id"
                        name="Select Class"
                        :rules="classRules"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Incharge :</label>
                    </v-flex>
                    <v-flex xs8 class="ml-3">
                      <v-select
                        :items="teacherList"
                        label="Select Incharge"
                        v-model="sectionData.sectionId"
                        item-text="name"
                        item-value="_id"
                        name="Select Class"
                        :rules="inchargeRules"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Session:</label>
                    </v-flex>
                    <v-flex xs8 class="ml-3">
                      <v-text-field
                        v-model="sectionData.session"
                        placeholder="fill your Session"
                        name="name"
                        type="text"
                        :rules="sessionRules"
                        required
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs12 sm12>
                      <v-card-actions>
                        <v-btn @click="clear" class="add-button" round dark>Clear</v-btn>
                        <v-spacer></v-spacer>
                        <v-btn @click="submit" class="add-button" round dark :loading="loading">Add</v-btn>
                      </v-card-actions>
                    </v-flex>
                  </v-layout>
                </v-form>
              </v-flex>
            </v-layout>
26ec38b66   Neeraj Sharma   added teacher lis...
329
          </v-container>
68d742034   Neeraj Sharma   implement new des...
330
331
332
333
334
335
336
337
338
339
        </v-card>
      </v-dialog>
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
26ec38b66   Neeraj Sharma   added teacher lis...
340
      <div class="loader" v-if="showLoader">
76f4f9c78   Neeraj Sharma   all api add in se...
341
        <v-progress-circular indeterminate color="white"></v-progress-circular>
26ec38b66   Neeraj Sharma   added teacher lis...
342
      </div>
68d742034   Neeraj Sharma   implement new des...
343
    </v-container>
76f4f9c78   Neeraj Sharma   all api add in se...
344
345
346
347
  </template>
  
  <script>
  import http from "@/Services/http.js";
29ac0dbb2   Neeraj Sharma   something changes
348
349
  // import { apiCollection } from "@/schoolApi/apiCollection";
  // const getSectionData = apiCollection.get("posts");
76f4f9c78   Neeraj Sharma   all api add in se...
350
351
352
353
354
355
356
  
  export default {
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
68d742034   Neeraj Sharma   implement new des...
357
      timeout: 5000,
76f4f9c78   Neeraj Sharma   all api add in se...
358
      text: "",
68d742034   Neeraj Sharma   implement new des...
359
360
361
      color: "",
      show: true,
      showSearch: false,
26ec38b66   Neeraj Sharma   added teacher lis...
362
      showLoader: false,
76f4f9c78   Neeraj Sharma   all api add in se...
363
      loading: false,
26ec38b66   Neeraj Sharma   added teacher lis...
364
365
      date: null,
      search: "",
68d742034   Neeraj Sharma   implement new des...
366
367
      editSectionDialog: false,
      viewSectionDialog: false,
76f4f9c78   Neeraj Sharma   all api add in se...
368
      valid: true,
26ec38b66   Neeraj Sharma   added teacher lis...
369
      validEdit: true,
68d742034   Neeraj Sharma   implement new des...
370
      addSectionDialog: false,
dc4d6088a   Neeraj Sharma   add loader in sav...
371
      editLoading: false,
76f4f9c78   Neeraj Sharma   all api add in se...
372
      details: [],
76f4f9c78   Neeraj Sharma   all api add in se...
373
      pagination: {
8e8d14254   Shikha Mishra   Cleared data whil...
374
        rowsPerPage: 10,
76f4f9c78   Neeraj Sharma   all api add in se...
375
      },
8e8d14254   Shikha Mishra   Cleared data whil...
376
377
378
379
      nameRules: [(v) => !!v || " Section Name is required"],
      classRules: [(v) => !!v || " Class Name is required"],
      sessionRules: [(v) => !!v || " Session is required"],
      inchargeRules: [(v) => !!v || " Incharge Name is required"],
26ec38b66   Neeraj Sharma   added teacher lis...
380
      SectionName: ["A", "B", "C", "D", "E", "F"],
76f4f9c78   Neeraj Sharma   all api add in se...
381
382
383
      headers: [
        {
          text: "No",
68d742034   Neeraj Sharma   implement new des...
384
          align: "",
76f4f9c78   Neeraj Sharma   all api add in se...
385
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
386
          value: "No",
76f4f9c78   Neeraj Sharma   all api add in se...
387
        },
26ec38b66   Neeraj Sharma   added teacher lis...
388
389
390
391
        {
          text: "Class Name",
          value: "classData.classNum",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
392
          align: "center",
26ec38b66   Neeraj Sharma   added teacher lis...
393
        },
55f72b7d7   Neeraj Sharma   add new page are ...
394
        { text: "Section Name", value: "name", sortable: false, align: "center" },
5f1d4b444   Neeraj Sharma   fix design and fi...
395
        { text: "Session", value: "session", sortable: false, align: "center" },
8e8d14254   Shikha Mishra   Cleared data whil...
396
        { text: "Action", value: "", sortable: false, align: "center" },
76f4f9c78   Neeraj Sharma   all api add in se...
397
      ],
68d742034   Neeraj Sharma   implement new des...
398
      sectionList: [],
26ec38b66   Neeraj Sharma   added teacher lis...
399
400
401
402
403
      addclass: [],
      teacherList: [],
      select: "",
      selectId: "",
      token: "",
76f4f9c78   Neeraj Sharma   all api add in se...
404
405
      editedIndex: -1,
      editedItem: {
26ec38b66   Neeraj Sharma   added teacher lis...
406
        classData: {
8e8d14254   Shikha Mishra   Cleared data whil...
407
          classNum: "",
76f4f9c78   Neeraj Sharma   all api add in se...
408
        },
caa79cee0   Neeraj Sharma   added teacher lis...
409
410
        teacherData: [
          {
8e8d14254   Shikha Mishra   Cleared data whil...
411
412
413
            name: "",
          },
        ],
d9bb52b5b   Neeraj Sharma   implement trello ...
414
415
        // name: "",
        // session: new Date().getFullYear()
76f4f9c78   Neeraj Sharma   all api add in se...
416
      },
26ec38b66   Neeraj Sharma   added teacher lis...
417
      sectionData: {
8e8d14254   Shikha Mishra   Cleared data whil...
418
419
        session: new Date().getFullYear(),
      },
76f4f9c78   Neeraj Sharma   all api add in se...
420
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
421
422
423
424
425
426
427
    watch: {
      addSectionDialog: function (val) {
        if (!val) {
          this.sectionData = [];
        }
      },
    },
55f72b7d7   Neeraj Sharma   add new page are ...
428
    methods: {
dc4d6088a   Neeraj Sharma   add loader in sav...
429
      getSectionList() {
29ac0dbb2   Neeraj Sharma   something changes
430
        // const { data } = await getSectionData.get();
76f4f9c78   Neeraj Sharma   all api add in se...
431
        this.showLoader = true;
dc4d6088a   Neeraj Sharma   add loader in sav...
432
        http()
26ec38b66   Neeraj Sharma   added teacher lis...
433
          .get("/getAllSections", {
8e8d14254   Shikha Mishra   Cleared data whil...
434
            headers: { Authorization: "Bearer " + this.token },
26ec38b66   Neeraj Sharma   added teacher lis...
435
          })
8e8d14254   Shikha Mishra   Cleared data whil...
436
          .then((response) => {
68d742034   Neeraj Sharma   implement new des...
437
            this.sectionList = response.data.data;
76f4f9c78   Neeraj Sharma   all api add in se...
438
439
            this.showLoader = false;
            // console.log("getAllSections=====>",response.data.data)
76f4f9c78   Neeraj Sharma   all api add in se...
440
          })
8e8d14254   Shikha Mishra   Cleared data whil...
441
          .catch((error) => {
76f4f9c78   Neeraj Sharma   all api add in se...
442
            this.showLoader = false;
00e4bc4e1   Neeraj Sharma   fixed auntentication
443
            if (error.response.status === 401) {
a17c68a03   Neeraj Sharma   implement two rou...
444
445
446
447
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
76f4f9c78   Neeraj Sharma   all api add in se...
448
449
450
          });
      },
      editItem(item) {
68d742034   Neeraj Sharma   implement new des...
451
        this.editedIndex = this.sectionList.indexOf(item);
76f4f9c78   Neeraj Sharma   all api add in se...
452
        this.editedItem = Object.assign({}, item);
68d742034   Neeraj Sharma   implement new des...
453
        this.editSectionDialog = true;
76f4f9c78   Neeraj Sharma   all api add in se...
454
455
      },
      profile(item) {
68d742034   Neeraj Sharma   implement new des...
456
        this.editedIndex = this.sectionList.indexOf(item);
76f4f9c78   Neeraj Sharma   all api add in se...
457
        this.editedItem = Object.assign({}, item);
68d742034   Neeraj Sharma   implement new des...
458
        this.viewSectionDialog = true;
76f4f9c78   Neeraj Sharma   all api add in se...
459
460
461
      },
      deleteItem(item) {
        let deleteStudent = {
8e8d14254   Shikha Mishra   Cleared data whil...
462
          sectionId: item._id,
76f4f9c78   Neeraj Sharma   all api add in se...
463
464
        };
        http()
26ec38b66   Neeraj Sharma   added teacher lis...
465
466
467
          .delete(
            "/deleteSection",
            confirm("Are you sure you want to delete this?") && {
8e8d14254   Shikha Mishra   Cleared data whil...
468
              params: deleteStudent,
26ec38b66   Neeraj Sharma   added teacher lis...
469
470
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
471
          .then((response) => {
d9bb52b5b   Neeraj Sharma   implement trello ...
472
            this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
473
474
            this.text = response.data.message;
            this.color = "green";
76f4f9c78   Neeraj Sharma   all api add in se...
475
476
            this.getSectionList();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
477
          .catch((error) => {
68d742034   Neeraj Sharma   implement new des...
478
479
480
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "green";
76f4f9c78   Neeraj Sharma   all api add in se...
481
482
          });
      },
68d742034   Neeraj Sharma   implement new des...
483
484
      closeSectionDialog() {
        this.editSectionDialog = false;
76f4f9c78   Neeraj Sharma   all api add in se...
485
      },
68d742034   Neeraj Sharma   implement new des...
486
487
      closeviewSectionDialog() {
        this.viewSectionDialog = false;
76f4f9c78   Neeraj Sharma   all api add in se...
488
489
      },
      submit() {
26ec38b66   Neeraj Sharma   added teacher lis...
490
491
492
493
494
        if (this.$refs.form.validate()) {
          let addSection = {
            name: this.sectionData.name,
            classId: this.sectionData.classNum,
            session: this.sectionData.session,
8e8d14254   Shikha Mishra   Cleared data whil...
495
            classInchargeId: this.sectionData.sectionId,
76f4f9c78   Neeraj Sharma   all api add in se...
496
          };
5f1d4b444   Neeraj Sharma   fix design and fi...
497
          this.loading = true;
76f4f9c78   Neeraj Sharma   all api add in se...
498
499
          http()
            .post("/createSection", addSection)
8e8d14254   Shikha Mishra   Cleared data whil...
500
            .then((response) => {
2b0e316ee   Neeraj Sharma   upload mytiple im...
501
              this.getSectionList();
d9bb52b5b   Neeraj Sharma   implement trello ...
502
              this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
503
              this.color = "green";
d9bb52b5b   Neeraj Sharma   implement trello ...
504
              this.text = "New Section added successfully";
26ec38b66   Neeraj Sharma   added teacher lis...
505
              this.clear();
68d742034   Neeraj Sharma   implement new des...
506
              this.addSectionDialog = false;
26ec38b66   Neeraj Sharma   added teacher lis...
507
              this.loading = false;
76f4f9c78   Neeraj Sharma   all api add in se...
508
            })
8e8d14254   Shikha Mishra   Cleared data whil...
509
            .catch((error) => {
d9bb52b5b   Neeraj Sharma   implement trello ...
510
              this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
511
              this.color = "error";
d9bb52b5b   Neeraj Sharma   implement trello ...
512
              this.text = error.response.data.message;
26ec38b66   Neeraj Sharma   added teacher lis...
513
              this.loading = false;
76f4f9c78   Neeraj Sharma   all api add in se...
514
515
516
            });
        }
      },
76f4f9c78   Neeraj Sharma   all api add in se...
517
518
519
520
      clear() {
        this.$refs.form.reset();
      },
      save() {
a17c68a03   Neeraj Sharma   implement two rou...
521
        this.editedItem.sectionId = this.editedItem._id;
dc4d6088a   Neeraj Sharma   add loader in sav...
522
        this.editLoading = true;
76f4f9c78   Neeraj Sharma   all api add in se...
523
        http()
caa79cee0   Neeraj Sharma   added teacher lis...
524
          .put("/updateSection", this.editedItem)
8e8d14254   Shikha Mishra   Cleared data whil...
525
          .then((response) => {
dc4d6088a   Neeraj Sharma   add loader in sav...
526
            this.editLoading = false;
d9bb52b5b   Neeraj Sharma   implement trello ...
527
            this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
528
529
            this.color = "green";
            this.text = response.data.message;
26ec38b66   Neeraj Sharma   added teacher lis...
530
            this.getSectionList();
68d742034   Neeraj Sharma   implement new des...
531
            this.closeSectionDialog();
76f4f9c78   Neeraj Sharma   all api add in se...
532
          })
8e8d14254   Shikha Mishra   Cleared data whil...
533
          .catch((error) => {
dc4d6088a   Neeraj Sharma   add loader in sav...
534
            this.editLoading = false;
68d742034   Neeraj Sharma   implement new des...
535
536
            this.snackbar = true;
            this.color = "error";
26ec38b66   Neeraj Sharma   added teacher lis...
537
            this.text = error.response.data.message;
76f4f9c78   Neeraj Sharma   all api add in se...
538
          });
76f4f9c78   Neeraj Sharma   all api add in se...
539
      },
26ec38b66   Neeraj Sharma   added teacher lis...
540
541
542
      getAllTeacher() {
        http()
          .get("/getTeachersList", {
8e8d14254   Shikha Mishra   Cleared data whil...
543
            headers: { Authorization: "Bearer " + this.token },
26ec38b66   Neeraj Sharma   added teacher lis...
544
          })
8e8d14254   Shikha Mishra   Cleared data whil...
545
          .then((response) => {
26ec38b66   Neeraj Sharma   added teacher lis...
546
547
548
            this.teacherList = response.data.data;
            this.showLoader = false;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
549
          .catch((err) => {
26ec38b66   Neeraj Sharma   added teacher lis...
550
551
552
553
554
555
556
            // console.log("err====>", err);
            this.showLoader = false;
          });
      },
      getAllClasses() {
        http()
          .get("/getClassesList", {
8e8d14254   Shikha Mishra   Cleared data whil...
557
            headers: { Authorization: "Bearer " + this.token },
26ec38b66   Neeraj Sharma   added teacher lis...
558
          })
8e8d14254   Shikha Mishra   Cleared data whil...
559
          .then((response) => {
76f4f9c78   Neeraj Sharma   all api add in se...
560
            this.addclass = response.data.data;
76f4f9c78   Neeraj Sharma   all api add in se...
561
          })
8e8d14254   Shikha Mishra   Cleared data whil...
562
          .catch((err) => {
76f4f9c78   Neeraj Sharma   all api add in se...
563
            // console.log("err====>", err);
a17c68a03   Neeraj Sharma   implement two rou...
564
            // this.$router.replace({ path: "/" });
76f4f9c78   Neeraj Sharma   all api add in se...
565
          });
68d742034   Neeraj Sharma   implement new des...
566
567
568
569
570
571
572
573
      },
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
8e8d14254   Shikha Mishra   Cleared data whil...
574
      },
26ec38b66   Neeraj Sharma   added teacher lis...
575
576
577
578
579
580
    },
    mounted() {
      this.token = this.$store.state.token;
      this.getSectionList();
      this.getAllClasses();
      this.getAllTeacher();
8e8d14254   Shikha Mishra   Cleared data whil...
581
    },
76f4f9c78   Neeraj Sharma   all api add in se...
582
583
  };
  </script>