Blame view

src/pages/Annoucement/annoucement.vue 27.2 KB
229463bd5   Neeraj Sharma   implement design ...
1
2
3
  <template>
    <v-container fluid class="body-color">
      <!-- ****** EDITS COURSES DETAILS ****** -->
db965de89   Amber Dev   added dialog pers...
4
      <v-dialog v-model="editStudentDialog" max-width="600px" scrollable persistent>
4dd422bef   Shikha Mishra   change ui of card...
5
        <v-card flat class="Card-style pa-2">
229463bd5   Neeraj Sharma   implement design ...
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
66
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Annoucement</label>
              <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <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="100px" v-if="!editedItem.attachementUrl && !editImageUrl">
                      <img src="/static/icon/user.png" />
                    </v-avatar>
                    <img
                      :src="editedItem.attachementUrl"
                      v-else-if="editedItem.attachementUrl && !editImageUrl"
                      height="150"
                      style="border-radius:50%; width:150px"
                    />
                    <img
                      v-if="editImageUrl"
                      :src="editImageUrl"
                      style="border-radius:50%; width:150px;height:150px"
                    />
                    <input
                      type="file"
                      style="display: none"
                      ref="editDataImage"
                      accept="image/*"
                      @change="onEditFilePicked"
                    />
                  </v-flex>
                </v-layout>
                <v-layout wrap>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 sm5 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
                        <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-select
                          :items="addclass"
                          label="Select Class"
                          v-model="editedItem.select"
                          item-text="classNum"
                          item-value="_id"
                          name="Select Class"
                          required
                        ></v-select>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs4 sm5 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Course Name:</label>
                        <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-select
                          :items="courseData"
0a5256600   Amber Dev   added events
67
                          item-text="courseName"
229463bd5   Neeraj Sharma   implement design ...
68
                          item-value="_id"
0a5256600   Amber Dev   added events
69
                          v-model="editedItem.courseName"
229463bd5   Neeraj Sharma   implement design ...
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
                          placeholder="fill your Course name"
                          type="text"
                          :rules="courseRules"
                          required
                        ></v-select>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs4 sm5 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label>
                        <label
                          class="right hidden-lg-only hidden-md-only hidden-xl-only"
                        >DiscussionType:</label>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-text-field
                          v-model="editedItem.discussionType"
                          placeholder="fill your Course Name"
                          type="text"
                          required
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs4 sm5 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label>
                        <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-text-field
                          label="Select Image"
                          @click="pickEditFile"
                          v-model="editImageName"
                          append-icon="attach_file"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                </v-layout>
                <v-layout>
                  <v-flex xs12 sm12 class="px-0 mx-0">
                    <v-layout class="right">
                      <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn>
                    </v-layout>
                  </v-flex>
                </v-layout>
              </v-container>
            </v-form>
          </v-card-text>
        </v-card>
      </v-dialog>
  
      <!-- ****** PROFILE VIEW STUDENTS DEATILS ******  -->
db965de89   Amber Dev   added dialog pers...
123
      <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable persistent>
4dd422bef   Shikha Mishra   change ui of card...
124
        <v-card flat class="Card-style pa-3">
229463bd5   Neeraj Sharma   implement design ...
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
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Annoucement</label>
              <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-flex align-center justify-center layout text-xs-center class="mt-3">
              <v-avatar size="100px">
                <img src="/static/icon/user.png" v-if="!editedItem.attachementUrl" />
                <img :src="editedItem.attachementUrl" v-else-if="editedItem.attachementUrl" />
              </v-avatar>
            </v-flex>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex xs12>
                  <v-layout>
                    <v-flex xs6 sm6>
                      <h5 class="right my-1">
                        <b>Discussion Type :</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs6>
                      <h5 class="my-1 left">{{ editedItem.discussionType }}</h5>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
  
      <!-- ****** Annoucement 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="addAnnoucementDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addAnnoucementDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Annoucement
        </v-btn>
        <v-card-actions class="hidden-xs-only hidden-sm-only">
          <v-flex md13 lg12>
            <v-layout>
              <v-flex lg6 md12>
                <v-layout>
                  <v-select
                    :items="addclass"
                    label="Select Class"
                    v-model="selectAnnoucement.classId"
                    item-text="classNum"
                    item-value="_id"
                    name="Select Class"
                    :rules="classRules"
                    required
                    class="ml-2"
                    @change="getCourses(selectAnnoucement.classId)"
                  ></v-select>
                  <v-select
                    :items="courseData"
                    label="Select Course"
                    v-model="selectAnnoucement.courseId"
0a5256600   Amber Dev   added events
198
                    item-text="courseName"
229463bd5   Neeraj Sharma   implement design ...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
                    item-value="_id"
                    :rules="courseRules"
                    required
                    class="ml-4"
                  ></v-select>
                </v-layout>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-card-actions>
        <v-spacer></v-spacer>
        <v-btn
          @click="getAnnoucementes()"
          round
          dark
          :loading="loading"
b0e0491ab   Shikha Mishra   solve the issue o...
215
          class="open-dialog-button hidden-xs-only hidden-sm-only"
229463bd5   Neeraj Sharma   implement design ...
216
217
218
219
220
221
222
223
        >Find</v-btn>
        <v-card-title class="body-1" v-show="show">
          <v-btn icon large flat @click="displaySearch">
            <v-avatar size="27">
              <img src="/static/icon/search.png" alt="icon" />
            </v-avatar>
          </v-btn>
        </v-card-title>
612b79bb4   Amber Dev   made serch auto f...
224
        <v-flex xs8 sm7 lg2 md3 v-if="showSearch">
229463bd5   Neeraj Sharma   implement design ...
225
          <v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
226
227
228
229
230
231
232
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
229463bd5   Neeraj Sharma   implement design ...
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
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-card flat class="elevation-0 transparent">
        <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only">
          <v-layout>
            <v-flex xs12>
              <v-select
                :items="addclass"
                label="Select Class"
                v-model="selectAnnoucement.select"
                item-text="classNum"
                item-value="_id"
                name="Select Class"
                :rules="classRules"
                class="px-2"
              ></v-select>
            </v-flex>
          </v-layout>
          <v-layout>
            <v-flex xs5 class="mx-auto mb-2">
              <v-btn
                @click="getAnnoucementes()"
                block
                round
                dark
                :loading="loading"
                class="add-button"
              >Find</v-btn>
            </v-flex>
          </v-layout>
        </v-flex>
      </v-card>
      <v-data-table
        :headers="headers"
        :items="annoucementData"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
640ed7acb   Neeraj Sharma   implement annouce...
274
          <tr class="tr row-click" @click="rowAnnoucement(props.item._id)">
229463bd5   Neeraj Sharma   implement design ...
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
            <td class="text-xs-center td td-row">
              <v-avatar size="40">
                <img :src="props.item.attachementUrl" v-if="props.item.attachementUrl" />
                <img src="/static/icon/user.png" v-else-if="!props.item.attachementUrl" />
              </v-avatar>
            </td>
            <td class="text-xs-center td td-row">{{ props.item.discussionType}}</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)"
                    src="/static/icon/view.png"
                  />
                  <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)"
                    src="/static/icon/edit.png"
                  />
                  <span>Edit</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    class="mr-3"
                    @click="deleteItem(props.item)"
                    src="/static/icon/delete.png"
                  />
                  <span>Delete</span>
                </v-tooltip>
              </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>
      <!-- ****** Add Annoucement DETAILS******-->
db965de89   Amber Dev   added dialog pers...
326
      <v-dialog v-model="addAnnoucementDialog" max-width="500" v-if="addAnnoucementDialog" persistent>
4dd422bef   Shikha Mishra   change ui of card...
327
        <v-card flat class="Card-style pa-2">
229463bd5   Neeraj Sharma   implement design ...
328
329
330
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Annoucement</label>
8e8d14254   Shikha Mishra   Cleared data whil...
331
332
333
334
335
              <v-icon
                size="24"
                class="right"
                @click="$refs.form.reset();addAnnoucementDialog = false"
              >cancel</v-icon>
229463bd5   Neeraj Sharma   implement design ...
336
337
338
339
340
341
342
343
344
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
392
393
394
395
396
397
398
399
            </v-flex>
          </v-layout>
          <v-container fluid>
            <v-layout align-center>
              <v-flex xs12>
                <v-flex xs12 sm12>
                  <v-form ref="form" v-model="valid" lazy-validation>
                    <v-layout>
                      <v-flex
                        xs12
                        class="text-xs-center text-sm-center text-md-center text-lg-center"
                      >
                        <v-avatar size="100px" v-if="!imageUrl">
                          <img src="/static/icon/user.png" />
                        </v-avatar>
                        <input
                          type="file"
                          style="display: none"
                          ref="image"
                          accept="image/*"
                          @change="onFilePicked"
                        />
                        <img
                          :src="imageData.imageUrl"
                          height="150"
                          width="150"
                          v-if="imageUrl"
                          style="border-radius:50%; width:200px"
                        />
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm12>
                        <v-layout>
                          <v-flex x4 sm4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-select
                              :items="addclass"
                              label="Select Class"
                              v-model="addAnnoucement.select"
                              item-text="classNum"
                              item-value="_id"
                              name="Select Class"
                              :rules="classRules"
                              @change="getCourses(addAnnoucement.select)"
                              required
                            ></v-select>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                    <v-layout wrap>
                      <v-flex xs12 sm12>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Course Name:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-select
                              :items="courseData"
0a5256600   Amber Dev   added events
400
                              item-text="courseName"
229463bd5   Neeraj Sharma   implement design ...
401
                              item-value="_id"
0a5256600   Amber Dev   added events
402
                              v-model="addAnnoucement.courseName"
229463bd5   Neeraj Sharma   implement design ...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
                              placeholder="fill your Course name"
                              type="text"
                              :rules="courseRules"
                              required
                            ></v-select>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm12>
                        <v-layout>
                          <v-flex xs4 sm4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label>
                            <label
                              class="right hidden-lg-only hidden-md-only hidden-xl-only"
                            >DiscussionType:</label>
                          </v-flex>
                          <v-flex xs8 sm8 class="ml-3">
                            <v-text-field
                              v-model="addAnnoucement.discussionType"
                              placeholder="fill your Course name"
                              type="text"
                              :rules="courseRules"
                              required
                            ></v-text-field>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm12>
                        <v-layout>
                          <v-flex xs4 class="pt-4 subheading">
                            <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label>
                            <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</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 sm12>
                        <v-layout class="right">
                          <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                  </v-form>
                </v-flex>
              </v-flex>
            </v-layout>
          </v-container>
        </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>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  import countryList from "@/script/country.js";
  import parent from "@/script/parents.js";
  
  export default {
    data: () => ({
      showNext: false,
      snackbar: false,
      y: "top",
      x: "right",
      role: "",
      mode: "",
      append: "",
      timeout: 3000,
      text: "",
      show: true,
      color: "",
      showSearch: false,
      showLoader: false,
      loading: false,
      editLoading: false,
      date: null,
      search: "",
      menu: false,
      menu1: false,
      editStudentDialog: false,
      profileStudentDialog: false,
      addAnnoucementDialog: false,
      valid: true,
      addclass: [],
      addSection: [],
      pagination: {
b0e0491ab   Shikha Mishra   solve the issue o...
509
        rowsPerPage: 10,
229463bd5   Neeraj Sharma   implement design ...
510
511
512
513
514
515
516
      },
      imageData: {},
      imageName: "",
      imageUrl: "",
      imageFile: "",
      editImageName: "",
      editImageUrl: "",
b0e0491ab   Shikha Mishra   solve the issue o...
517
518
519
      courseRules: [(v) => !!v || " Course Name is required"],
      classRules: [(v) => !!v || " Class Name is required"],
      sectionRules: [(v) => !!v || "Section Name is required"],
229463bd5   Neeraj Sharma   implement design ...
520
521
522
523
524
525
      errorMessages: "",
      headers: [
        {
          text: "Image",
          value: "attachementUrl",
          sortable: false,
b0e0491ab   Shikha Mishra   solve the issue o...
526
          align: "center",
229463bd5   Neeraj Sharma   implement design ...
527
528
529
530
531
        },
        {
          text: "Discussion Type",
          value: "discussionType",
          sortable: false,
b0e0491ab   Shikha Mishra   solve the issue o...
532
          align: "center",
229463bd5   Neeraj Sharma   implement design ...
533
        },
b0e0491ab   Shikha Mishra   solve the issue o...
534
        { text: "Action", value: "", sortable: false, align: "center" },
229463bd5   Neeraj Sharma   implement design ...
535
536
537
538
      ],
      courseData: [],
      editedIndex: -1,
      addAnnoucement: {
b0e0491ab   Shikha Mishra   solve the issue o...
539
        select: "",
229463bd5   Neeraj Sharma   implement design ...
540
541
542
      },
      selectAnnoucement: {},
      editedItem: {},
b0e0491ab   Shikha Mishra   solve the issue o...
543
      annoucementData: [],
229463bd5   Neeraj Sharma   implement design ...
544
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
545
546
547
548
549
550
551
552
553
554
    watch: {
      addAnnoucementDialog: function (val) {
        if (!val) {
          this.addAnnoucement = [];
          this.imageName = "";
          this.imageFile = "";
          this.imageUrl = "";
        }
      },
    },
229463bd5   Neeraj Sharma   implement design ...
555
556
557
558
559
560
    methods: {
      getCourses(selectCourseId) {
        this.showLoader = true;
        http()
          .get("/getCourseesList", {
            params: {
b0e0491ab   Shikha Mishra   solve the issue o...
561
562
              classId: selectCourseId,
            },
229463bd5   Neeraj Sharma   implement design ...
563
          })
b0e0491ab   Shikha Mishra   solve the issue o...
564
          .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
565
566
567
            this.courseData = response.data.data;
            this.showLoader = false;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
568
          .catch((err) => {
860da881d   Shikha Mishra   comment all consoles
569
            //   console.log("err====>", err);
229463bd5   Neeraj Sharma   implement design ...
570
            this.showLoader = false;
860da881d   Shikha Mishra   comment all consoles
571
572
573
            this.snackbar = true;
            this.color = "error";
            this.text = error.response.data.message;
229463bd5   Neeraj Sharma   implement design ...
574
575
576
577
578
579
580
          });
      },
      getAnnoucementes() {
        this.showLoader = true;
        http()
          .get("/getAnnoucementesList", {
            params: {
3a557c5ae   Amber Dev   added reply annou...
581
              courseId: this.selectAnnoucement.courseId,
b0e0491ab   Shikha Mishra   solve the issue o...
582
583
              classId: this.selectAnnoucement.classId,
            },
229463bd5   Neeraj Sharma   implement design ...
584
          })
b0e0491ab   Shikha Mishra   solve the issue o...
585
          .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
586
587
588
            this.annoucementData = response.data.data;
            this.showLoader = false;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
589
          .catch((err) => {
860da881d   Shikha Mishra   comment all consoles
590
            //   console.log("err====>", err);
229463bd5   Neeraj Sharma   implement design ...
591
            this.showLoader = false;
860da881d   Shikha Mishra   comment all consoles
592
593
594
            this.snackbar = true;
            this.color = "error";
            this.text = error.response.data.message;
229463bd5   Neeraj Sharma   implement design ...
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
          });
      },
      // getSections(_id) {
      //   var token = this.$store.state.token;
      //   this.showLoader = true;
      //   http()
      //     .get(
      //       "/getSectionsList",
      //       { params: { classId: _id } },
      //       {
      //         headers: { Authorization: "Bearer " + token }
      //       }
      //     )
      //     .then(response => {
      //       this.addSection = response.data.data;
      //       this.showLoader = false;
      //     })
      //     .catch(err => {
      //       this.showLoader = false;
      //     });
      // },
      pickFile() {
        this.$refs.image.click();
      },
      pickEditFile() {
        this.$refs.editDataImage.click();
      },
b0e0491ab   Shikha Mishra   solve the issue o...
622
      dates: function (date) {
229463bd5   Neeraj Sharma   implement design ...
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
        return moment(date).format("MMMM DD, YYYY");
        return date;
      },
      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 = "";
        }
      },
      onEditFilePicked(e) {
860da881d   Shikha Mishra   comment all consoles
649
        //   console.log(e);
229463bd5   Neeraj Sharma   implement design ...
650
651
652
        const files = e.target.files;
        if (files[0] !== undefined) {
          this.editImageName = files[0].name;
229463bd5   Neeraj Sharma   implement design ...
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
          if (this.editImageName.lastIndexOf(".") <= 0) {
            return;
          }
          const fr = new FileReader();
          fr.readAsDataURL(files[0]);
          fr.addEventListener("load", () => {
            this.editImageUrl = fr.result;
            this.editiImageFile = files[0]; // this is an image file that can be sent to server...
          });
        } else {
          this.editImageName = "";
          this.editiImageFile = "";
        }
      },
      editItem(item) {
        this.editedIndex = this.courseData.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.editStudentDialog = true;
      },
      profile(item) {
        this.editedIndex = this.courseData.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.profileStudentDialog = true;
      },
      deleteItem(item) {
        let deleteAnnoucement = {
b0e0491ab   Shikha Mishra   solve the issue o...
679
          annoucementId: item._id,
229463bd5   Neeraj Sharma   implement design ...
680
681
682
683
684
        };
        http()
          .delete(
            "/deleteAnnoucement",
            confirm("Are you sure you want to delete this?") && {
b0e0491ab   Shikha Mishra   solve the issue o...
685
              params: deleteAnnoucement,
229463bd5   Neeraj Sharma   implement design ...
686
687
            }
          )
b0e0491ab   Shikha Mishra   solve the issue o...
688
          .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
689
690
691
692
693
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.getAnnoucementes();
          })
b0e0491ab   Shikha Mishra   solve the issue o...
694
          .catch((error) => {
229463bd5   Neeraj Sharma   implement design ...
695
696
697
698
699
700
701
702
703
704
705
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
      close() {
        this.editStudentDialog = false;
      },
      closeStudentProfile() {
        this.profileStudentDialog = false;
      },
640ed7acb   Neeraj Sharma   implement annouce...
706
      rowAnnoucement(id) {
c50650743   Amber Dev   added Announcemen...
707
        this.$router.push({
640ed7acb   Neeraj Sharma   implement annouce...
708
          name: "Annoucement Forum",
b0e0491ab   Shikha Mishra   solve the issue o...
709
          params: { annoucementId: id },
640ed7acb   Neeraj Sharma   implement annouce...
710
711
        });
      },
229463bd5   Neeraj Sharma   implement design ...
712
713
714
715
716
717
      submit() {
        if (this.$refs.form.validate()) {
          let addCourse = {
            classId: this.addAnnoucement.select,
            sectionId: this.addAnnoucement.selectSection,
            discussionType: this.addAnnoucement.discussionType,
b0e0491ab   Shikha Mishra   solve the issue o...
718
            courseId: this.addAnnoucement.courseName,
229463bd5   Neeraj Sharma   implement design ...
719
720
721
722
723
724
725
726
727
          };
          if (this.imageUrl) {
            var str = this.imageUrl;
            const [baseUrl, imageUrl] = str.split(/,/);
            addCourse.upload = imageUrl;
          }
          this.loading = true;
          http()
            .post("/createAnnoucement", addCourse)
b0e0491ab   Shikha Mishra   solve the issue o...
728
            .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
729
730
731
732
733
734
735
              this.snackbar = true;
              this.text = "New Annoucement added successfully";
              this.color = "green";
              this.addAnnoucementDialog = false;
              this.clear();
              this.loading = false;
            })
b0e0491ab   Shikha Mishra   solve the issue o...
736
            .catch((error) => {
229463bd5   Neeraj Sharma   implement design ...
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
              this.snackbar = true;
              this.text = error.response.data.message;
              this.color = "error";
              this.loading = false;
            });
        }
      },
      clear() {
        this.$refs.form.reset();
        this.imageUrl = "";
      },
      save() {
        let editAnnoucement = {
          annoucementId: this.editedItem._id,
          discussionType: this.editedItem.discussionType,
          classId: this.editedItem.select,
b0e0491ab   Shikha Mishra   solve the issue o...
753
          courseId: this.editedItem.courseName,
229463bd5   Neeraj Sharma   implement design ...
754
755
756
757
758
759
760
761
762
        };
        if (this.editImageUrl) {
          var str = this.editImageUrl;
          const [baseUrl, editImageUrl] = str.split(/,/);
          editAnnoucement.upload = editImageUrl;
        }
        this.editLoading = true;
        http()
          .put("/updateAnnoucement", editAnnoucement)
b0e0491ab   Shikha Mishra   solve the issue o...
763
          .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
764
765
766
767
768
769
770
771
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.imageUrl = "";
            this.getAnnoucementes();
            this.close();
            this.editLoading = false;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
772
          .catch((error) => {
229463bd5   Neeraj Sharma   implement design ...
773
774
775
776
777
778
779
780
781
782
783
784
785
786
            this.snackbar = true;
            this.text = error.response.data.statusText;
            this.color = "error";
            this.editLoading = false;
          });
      },
      displaySearch() {
        this.show = false;
        this.showSearch = true;
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
b0e0491ab   Shikha Mishra   solve the issue o...
787
      },
229463bd5   Neeraj Sharma   implement design ...
788
789
790
791
792
    },
    mounted() {
      var token = this.$store.state.token;
      http()
        .get("/getClassesList", {
b0e0491ab   Shikha Mishra   solve the issue o...
793
          headers: { Authorization: "Bearer " + token },
229463bd5   Neeraj Sharma   implement design ...
794
        })
b0e0491ab   Shikha Mishra   solve the issue o...
795
        .then((response) => {
229463bd5   Neeraj Sharma   implement design ...
796
797
          this.addclass = response.data.data;
        })
b0e0491ab   Shikha Mishra   solve the issue o...
798
        .catch((error) => {
229463bd5   Neeraj Sharma   implement design ...
799
800
801
802
803
804
805
806
          this.showLoader = false;
          if (error.response.status === 401) {
            this.$router.replace({ path: "/" });
            this.$store.dispatch("setToken", null);
            this.$store.dispatch("Id", null);
            this.$store.dispatch("Role", null);
          }
        });
b0e0491ab   Shikha Mishra   solve the issue o...
807
    },
229463bd5   Neeraj Sharma   implement design ...
808
809
  };
  </script>
640ed7acb   Neeraj Sharma   implement annouce...
810
811
812
  <style>
  .row-click {
    cursor: pointer;
229463bd5   Neeraj Sharma   implement design ...
813
814
  }
  </style>