Blame view

src/pages/NoticeBoard/noticeBoard.vue 21.2 KB
beb598536   Neeraj Sharma   design and functi...
1
  <template>
68d742034   Neeraj Sharma   implement new des...
2
3
    <v-container fluid class="body-color">
      <!-- ****** Edit  Notice Board ****** -->
db965de89   Amber Dev   added dialog pers...
4
      <v-dialog v-model="editNoticeBoardDialog" max-width="500px" scrollable persistent>
68d742034   Neeraj Sharma   implement new des...
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
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Notice Board</label>
              <v-icon size="24" class="right" @click="editNoticeBoardDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-layout>
              <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center">
                <img
                  src="/static/icon/user.png"
                  v-if="!editedItem.eventImageUrl && !imageUrl"
                  width="100px"
                />
                <img
                  :src="editedItem.eventImageUrl"
                  height="150"
                  v-else-if="editedItem.eventImageUrl && !imageUrl"
                  width="150px"
                />
                <img
                  v-if="imageUrl"
                  :src="imageUrl"
                  height="150"
                  style="border-radius:50%; width:150px"
                />
                <input
                  type="file"
                  style="display: none"
                  ref="image"
                  accept="image/*"
                  @change="onFilePicked"
                />
              </v-flex>
            </v-layout>
            <v-layout wrap>
              <v-flex xs12>
f4df757fe   Neeraj Sharma   responsive vie in...
43
                <v-layout>
68d742034   Neeraj Sharma   implement new des...
44
45
46
47
48
49
50
51
52
53
54
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Title:</label>
                  </v-flex>
                  <v-flex xs8 class="ml-3">
                    <v-text-field
                      v-model="editedItem.title"
                      placeholder="fill your Title"
                      name="name"
                      type="text"
                      required
                    ></v-text-field>
f4df757fe   Neeraj Sharma   responsive vie in...
55
56
                  </v-flex>
                </v-layout>
68d742034   Neeraj Sharma   implement new des...
57
58
59
60
61
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Description:</label>
f4df757fe   Neeraj Sharma   responsive vie in...
62
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
63
64
65
66
67
68
69
70
                  <v-flex xs7 class="ml-3">
                    <v-text-field
                      placeholder="fill your Description"
                      v-model="editedItem.description"
                      type="text"
                      name="email"
                      required
                    ></v-text-field>
f4df757fe   Neeraj Sharma   responsive vie in...
71
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
72
73
74
75
76
77
78
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <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>
f4df757fe   Neeraj Sharma   responsive vie in...
79
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
80
81
82
83
84
85
86
                  <v-flex xs7 class="ml-3">
                    <v-text-field
                      label="Select Image"
                      @click="pickFile"
                      v-model="imageName"
                      append-icon="attach_file"
                    ></v-text-field>
d10c26632   Shikha Mishra   Improve updateBoo...
87
88
89
90
91
92
93
                    <input
                      type="file"
                      style="display: none"
                      ref="image"
                      accept="image/*"
                      @change="onFilePicked"
                    />
f4df757fe   Neeraj Sharma   responsive vie in...
94
95
                  </v-flex>
                </v-layout>
68d742034   Neeraj Sharma   implement new des...
96
97
98
99
100
101
102
103
104
105
106
              </v-flex>
              <v-flex xs12>
                <v-card-actions>
                  <v-spacer></v-spacer>
                  <v-btn round dark @click="save" class="add-button">Save</v-btn>
                </v-card-actions>
              </v-flex>
            </v-layout>
          </v-card-text>
        </v-card>
      </v-dialog>
beb598536   Neeraj Sharma   design and functi...
107

68d742034   Neeraj Sharma   implement new des...
108
      <!-- ****** VIEW PROFIL NOTICE BOARD ******  -->
beb598536   Neeraj Sharma   design and functi...
109

db965de89   Amber Dev   added dialog pers...
110
      <v-dialog v-model="viewNoticeBoardDialog" max-width="600px" scrollable persistent>
68d742034   Neeraj Sharma   implement new des...
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
        <v-card flat class="card-style pa-3" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Notice Board</label>
              <v-icon size="24" class="right" @click="viewNoticeBoardDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-layout>
              <v-flex align-center justify-center layout text-xs-center>
                <img src="/static/icon/user.png" v-if="!editedItem.eventImageUrl" width="80" />
                <img
                  :src="editedItem.eventImageUrl"
                  v-else-if="editedItem.eventImageUrl"
                  class="img"
                  width="200"
                />
              </v-flex>
            </v-layout>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Title:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.title }}</h5>
beb598536   Neeraj Sharma   design and functi...
141
142
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
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
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Description:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.description }}</h5>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
      <!-- ****** EXISTING Notice Board 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="addNoticeBoardDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addNoticeBoardDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Notice Board
        </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...
182
              <img src="/static/icon/search.png" alt="icon" />
68d742034   Neeraj Sharma   implement new des...
183
184
185
            </v-avatar>
          </v-btn>
        </v-card-title>
612b79bb4   Amber Dev   made serch auto f...
186
        <v-flex xs8 sm8 md3 lg2 v-if="showSearch">
68d742034   Neeraj Sharma   implement new des...
187
          <v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
188
189
190
191
192
193
194
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
68d742034   Neeraj Sharma   implement new des...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="notices"
        :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="td td-row text-xs-center">
              <v-avatar size="40">
                <img :src="props.item.eventImageUrl" v-if="props.item.eventImageUrl" />
                <img src="/static/icon/user.png" v-else-if="!props.item.eventImageUrl" />
              </v-avatar>
            </td>
            <td class="text-xs-center td td-row">{{ props.item.title}}</td>
            <td class="text-xs-center td td-row">
ba420d0d1   Shikha Mishra   Solve add subject...
216
              <!-- <v-btn
b9759239c   Shikha Mishra   shown invoice det...
217
218
219
220
                class="add-button"
                @click="generatePDF2Canvas(props.item)"
                :loading="loadingPdf"
                dark
ba420d0d1   Shikha Mishra   Solve add subject...
221
222
223
224
225
226
227
228
229
              >{{ props.item.fileType }}</v-btn>-->
              <a
                class="hover"
                :href="props.item.eventImageUrl"
                target="_blank"
                style="text-decoration: none!important; color: grey"
              >
                <h5>{{props.item.fileName}}</h5>
              </a>
b9759239c   Shikha Mishra   shown invoice det...
230
231
            </td>
            <td class="text-xs-center td td-row">
68d742034   Neeraj Sharma   implement new des...
232
233
234
235
236
237
238
              <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...
239
                    src="/static/icon/view.png"
68d742034   Neeraj Sharma   implement new des...
240
241
242
243
244
245
246
247
248
                  />
                  <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...
249
                    src="/static/icon/edit.png"
68d742034   Neeraj Sharma   implement new des...
250
251
252
253
254
255
256
257
                  />
                  <span>Edit</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    @click="deleteItem(props.item)"
aa310d61a   Shikha Mishra   added functionali...
258
                    src="/static/icon/delete.png"
68d742034   Neeraj Sharma   implement new des...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
                  />
                  <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  Notice Board ****** -->
ba420d0d1   Shikha Mishra   Solve add subject...
274
275
276
277
278
279
      <v-dialog
        v-model="addNoticeBoardDialog"
        max-width="600px"
        v-if="addNoticeBoardDialog"
        persistent
      >
68d742034   Neeraj Sharma   implement new des...
280
281
282
283
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Notice Board</label>
8e8d14254   Shikha Mishra   Cleared data whil...
284
              <v-icon size="24" class="right" @click="closeNoticeBoardModel">cancel</v-icon>
68d742034   Neeraj Sharma   implement new des...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
            </v-flex>
          </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 xs12 class="text-xs-center text-sm-center text-md-center text-lg-center">
                      <v-avatar size="80px" v-if="!imageUrl">
                        <img src="/static/icon/user.png" />
                      </v-avatar>
                      <input
                        type="file"
                        style="display: none"
                        ref="image"
                        accept="image/*"
                        @change="onFilePicked"
                      />
beb598536   Neeraj Sharma   design and functi...
303

68d742034   Neeraj Sharma   implement new des...
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
                      <v-avatar size="150px" v-if="imageUrl">
                        <img :src="imageUrl" height="150" />
                      </v-avatar>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Title:</label>
                    </v-flex>
                    <v-flex xs7 class="ml-3">
                      <v-text-field
                        v-model="addNoticeBoard.title"
                        placeholder="fill your Title"
                        name="name"
                        type="text"
                        :rules="titleRules"
                        required
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Description:</label>
                    </v-flex>
                    <v-flex xs7 class="ml-3">
                      <v-text-field
                        v-model="addNoticeBoard.description"
                        placeholder="fill your Description"
                        name="name"
                        type="text"
                        :rules="descriptionRules"
                        required
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <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 xs7 class="ml-3">
                      <v-text-field
                        label="Select Image"
                        @click="pickFile"
                        v-model="imageName"
                        append-icon="attach_file"
                      ></v-text-field>
b9759239c   Shikha Mishra   shown invoice det...
351
352
353
354
355
356
357
                      <input
                        type="file"
                        style="display:none"
                        ref="image"
                        accept="image/*"
                        @change="onFilePicked"
                      />
68d742034   Neeraj Sharma   implement new des...
358
359
360
                    </v-flex>
                  </v-layout>
                  <v-layout>
beb598536   Neeraj Sharma   design and functi...
361
                    <v-flex xs12>
68d742034   Neeraj Sharma   implement new des...
362
363
364
365
366
                      <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn @click="clear" round dark class="clear-button">clear</v-btn>
                        <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
                      </v-card-actions>
beb598536   Neeraj Sharma   design and functi...
367
368
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
369
370
371
                </v-form>
              </v-flex>
            </v-layout>
beb598536   Neeraj Sharma   design and functi...
372
          </v-container>
68d742034   Neeraj Sharma   implement new des...
373
374
375
376
377
378
379
380
381
382
        </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>
36fc987df   Neeraj Sharma   add loader in all...
383
384
385
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
386
    </v-container>
beb598536   Neeraj Sharma   design and functi...
387
388
389
390
  </template>
  
  <script>
  import http from "@/Services/http.js";
beb598536   Neeraj Sharma   design and functi...
391
392
393
394
395
396
397
398
399
  
  export default {
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
68d742034   Neeraj Sharma   implement new des...
400
401
402
      color: "",
      show: true,
      showSearch: false,
fc82ac667   Neeraj Sharma   fix design and re...
403
      showLoader: false,
beb598536   Neeraj Sharma   design and functi...
404
405
406
      loading: false,
      date: null,
      search: "",
68d742034   Neeraj Sharma   implement new des...
407
408
409
      addNoticeBoardDialog: false,
      editNoticeBoardDialog: false,
      viewNoticeBoardDialog: false,
beb598536   Neeraj Sharma   design and functi...
410
      valid: true,
beb598536   Neeraj Sharma   design and functi...
411
412
413
      addclass: [],
      addSection: [],
      gender: ["Male", "Female"],
beb598536   Neeraj Sharma   design and functi...
414
      pagination: {
8e8d14254   Shikha Mishra   Cleared data whil...
415
        rowsPerPage: 10,
beb598536   Neeraj Sharma   design and functi...
416
      },
ba420d0d1   Shikha Mishra   Solve add subject...
417
      imageData: {},
beb598536   Neeraj Sharma   design and functi...
418
419
420
      imageName: "",
      imageUrl: "",
      imageFile: "",
46db0a3b5   Neeraj Sharma   add sunbject and ...
421
      upload: "",
b9759239c   Shikha Mishra   shown invoice det...
422
      loadingPdf: false,
8e8d14254   Shikha Mishra   Cleared data whil...
423
424
      titleRules: [(v) => !!v || " Title is required"],
      descriptionRules: [(v) => !!v || " Description is required"],
beb598536   Neeraj Sharma   design and functi...
425
426
427
      headers: [
        {
          text: "No",
68d742034   Neeraj Sharma   implement new des...
428
          align: "",
beb598536   Neeraj Sharma   design and functi...
429
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
430
          value: "No",
beb598536   Neeraj Sharma   design and functi...
431
        },
fc82ac667   Neeraj Sharma   fix design and re...
432
        {
68d742034   Neeraj Sharma   implement new des...
433
434
          text: "Event Image",
          align: "center",
fc82ac667   Neeraj Sharma   fix design and re...
435
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
436
          value: "eventImageUrl",
fc82ac667   Neeraj Sharma   fix design and re...
437
        },
68d742034   Neeraj Sharma   implement new des...
438
        { text: "Title", value: "title", sortable: false, align: "center" },
b9759239c   Shikha Mishra   shown invoice det...
439
440
441
442
        {
          text: "File",
          value: "eventImageUrl",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
443
          align: "center",
b9759239c   Shikha Mishra   shown invoice det...
444
        },
8e8d14254   Shikha Mishra   Cleared data whil...
445
        { text: "Action", value: "", sortable: false, align: "center" },
beb598536   Neeraj Sharma   design and functi...
446
      ],
68d742034   Neeraj Sharma   implement new des...
447
      notices: [],
beb598536   Neeraj Sharma   design and functi...
448
      editedIndex: -1,
46db0a3b5   Neeraj Sharma   add sunbject and ...
449
      addNoticeBoard: {},
beb598536   Neeraj Sharma   design and functi...
450
451
      editedItem: {
        title: "",
8e8d14254   Shikha Mishra   Cleared data whil...
452
453
        description: "",
      },
beb598536   Neeraj Sharma   design and functi...
454
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
455
    watch: {
ba420d0d1   Shikha Mishra   Solve add subject...
456
457
458
459
460
461
462
463
      // addNoticeBoardDialog: function (val) {
      //   if (!val) {
      //     this.addNoticeBoard = [];
      //     this.imageName = "";
      //     this.imageFile = "";
      //     this.imageUrl = "";
      //   }
      // },
8e8d14254   Shikha Mishra   Cleared data whil...
464
    },
beb598536   Neeraj Sharma   design and functi...
465
466
467
468
    methods: {
      pickFile() {
        this.$refs.image.click();
      },
46db0a3b5   Neeraj Sharma   add sunbject and ...
469
      getNoticeDataList() {
36fc987df   Neeraj Sharma   add loader in all...
470
        this.showLoader = true;
beb598536   Neeraj Sharma   design and functi...
471
472
473
        var token = this.$store.state.token;
        http()
          .get("/getEventsList", {
8e8d14254   Shikha Mishra   Cleared data whil...
474
            headers: { Authorization: "Bearer " + token },
beb598536   Neeraj Sharma   design and functi...
475
          })
8e8d14254   Shikha Mishra   Cleared data whil...
476
          .then((response) => {
68d742034   Neeraj Sharma   implement new des...
477
            this.notices = response.data.data;
36fc987df   Neeraj Sharma   add loader in all...
478
            this.showLoader = false;
beb598536   Neeraj Sharma   design and functi...
479
          })
8e8d14254   Shikha Mishra   Cleared data whil...
480
          .catch((error) => {
36fc987df   Neeraj Sharma   add loader in all...
481
            this.showLoader = false;
a17c68a03   Neeraj Sharma   implement two rou...
482
483
484
485
486
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
beb598536   Neeraj Sharma   design and functi...
487
488
489
          });
      },
      editItem(item) {
68d742034   Neeraj Sharma   implement new des...
490
        this.editedIndex = this.notices.indexOf(item);
beb598536   Neeraj Sharma   design and functi...
491
        this.editedItem = Object.assign({}, item);
68d742034   Neeraj Sharma   implement new des...
492
        this.editNoticeBoardDialog = true;
beb598536   Neeraj Sharma   design and functi...
493
494
      },
      profile(item) {
68d742034   Neeraj Sharma   implement new des...
495
        this.editedIndex = this.notices.indexOf(item);
beb598536   Neeraj Sharma   design and functi...
496
        this.editedItem = Object.assign({}, item);
68d742034   Neeraj Sharma   implement new des...
497
        this.viewNoticeBoardDialog = true;
beb598536   Neeraj Sharma   design and functi...
498
499
500
      },
      deleteItem(item) {
        let deleteEvent = {
8e8d14254   Shikha Mishra   Cleared data whil...
501
          eventId: item._id,
beb598536   Neeraj Sharma   design and functi...
502
503
504
505
506
        };
        http()
          .delete(
            "/deleteEvent",
            confirm("Are you sure you want to delete this?") && {
8e8d14254   Shikha Mishra   Cleared data whil...
507
              params: deleteEvent,
beb598536   Neeraj Sharma   design and functi...
508
509
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
510
          .then((response) => {
beb598536   Neeraj Sharma   design and functi...
511
512
            // console.log("deleteUers",deleteEvent)
            if ((this.snackbar = true)) {
46db0a3b5   Neeraj Sharma   add sunbject and ...
513
              this.text = "Successfully delete Existing Notice Data";
beb598536   Neeraj Sharma   design and functi...
514
            }
b9759239c   Shikha Mishra   shown invoice det...
515
516
            this.snackbar = true;
            this.color = "green";
2d0fc1144   Neeraj Sharma   upload dynamic im...
517
            this.getNoticeDataList();
beb598536   Neeraj Sharma   design and functi...
518
          })
8e8d14254   Shikha Mishra   Cleared data whil...
519
          .catch((error) => {
beb598536   Neeraj Sharma   design and functi...
520
            // console.log(error);
b9759239c   Shikha Mishra   shown invoice det...
521
522
523
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
beb598536   Neeraj Sharma   design and functi...
524
525
          });
      },
beb598536   Neeraj Sharma   design and functi...
526
      close() {
68d742034   Neeraj Sharma   implement new des...
527
        this.editNoticeBoardDialog = false;
beb598536   Neeraj Sharma   design and functi...
528
      },
8e8d14254   Shikha Mishra   Cleared data whil...
529
530
531
532
533
534
535
      closeNoticeBoardModel() {
        this.addNoticeBoardDialog = false;
        this.addNoticeBoard = [];
        this.imageName = "";
        this.imageFile = "";
        this.imageUrl = "";
      },
beb598536   Neeraj Sharma   design and functi...
536
      submit() {
b9759239c   Shikha Mishra   shown invoice det...
537
        var signatures = {
ba420d0d1   Shikha Mishra   Solve add subject...
538
539
540
541
542
543
544
          // JVBERi0: "other",
          // iVBORw0KGgo: "image",
          // UEsDBBQ: "other",
          // "/": "image",
          // AAABAA: "image",
          // IywiV2hhdC: "other",
          // bmFtZSxl: "other",
b9759239c   Shikha Mishra   shown invoice det...
545
546
547
548
549
550
551
552
        };
        function detectMimeType(b64) {
          for (var s in signatures) {
            if (b64.indexOf(s) === 0) {
              return signatures[s];
            }
          }
        }
beb598536   Neeraj Sharma   design and functi...
553
        if (this.$refs.form.validate()) {
2d0fc1144   Neeraj Sharma   upload dynamic im...
554
555
556
557
          if (this.imageUrl) {
            var str = this.imageUrl;
            const [baseUrl, imageUrl] = str.split(/,/);
            this.addNoticeBoard.upload = imageUrl;
b9759239c   Shikha Mishra   shown invoice det...
558
            this.addNoticeBoard.fileType = detectMimeType(imageUrl);
8e8d14254   Shikha Mishra   Cleared data whil...
559
            this.addNoticeBoard.fileName = this.imageName;
2d0fc1144   Neeraj Sharma   upload dynamic im...
560
          }
beb598536   Neeraj Sharma   design and functi...
561
          http()
46db0a3b5   Neeraj Sharma   add sunbject and ...
562
            .post("/createEvent", this.addNoticeBoard)
8e8d14254   Shikha Mishra   Cleared data whil...
563
            .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
564
565
              this.imageUrl = "";
              this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
566
567
              this.color = "green";
              this.text = response.data.message;
2d0fc1144   Neeraj Sharma   upload dynamic im...
568
              this.getNoticeDataList();
68d742034   Neeraj Sharma   implement new des...
569
              this.addNoticeBoardDialog = false;
beb598536   Neeraj Sharma   design and functi...
570
571
              this.clear();
            })
8e8d14254   Shikha Mishra   Cleared data whil...
572
            .catch((error) => {
0551a0f15   Neeraj Sharma   implemnet functio...
573
574
              this.snackbar = true;
              this.text = error.response.data.message;
68d742034   Neeraj Sharma   implement new des...
575
              this.color = "error";
beb598536   Neeraj Sharma   design and functi...
576
577
578
            });
        }
      },
b9759239c   Shikha Mishra   shown invoice det...
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
      onFilePicked(e) {
        const files = e.target.files;
        this.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 = "";
        }
      },
beb598536   Neeraj Sharma   design and functi...
600
601
      clear() {
        this.$refs.form.reset();
0551a0f15   Neeraj Sharma   implemnet functio...
602
        this.imageUrl = "";
beb598536   Neeraj Sharma   design and functi...
603
604
      },
      save() {
2d0fc1144   Neeraj Sharma   upload dynamic im...
605
        let editNoticeBoard = {
beb598536   Neeraj Sharma   design and functi...
606
607
          eventId: this.editedItem._id,
          title: this.editedItem.title,
ef672f260   Neeraj Sharma   add file name in ...
608
          description: this.editedItem.description,
8e8d14254   Shikha Mishra   Cleared data whil...
609
          fileName: this.imageName,
beb598536   Neeraj Sharma   design and functi...
610
        };
b9759239c   Shikha Mishra   shown invoice det...
611
        var signatures = {
ba420d0d1   Shikha Mishra   Solve add subject...
612
613
614
615
616
617
          // JVBERi0: "other",
          // iVBORw0KGgo: "image",
          // UEsDBBQ: "other",
          // "/": "image",
          // AAABAA: "image",
          // IywiV2hhdC: "other",
b9759239c   Shikha Mishra   shown invoice det...
618
619
620
621
622
623
624
625
        };
        function detectMimeType(b64) {
          for (var s in signatures) {
            if (b64.indexOf(s) === 0) {
              return signatures[s];
            }
          }
        }
2d0fc1144   Neeraj Sharma   upload dynamic im...
626
627
628
629
        if (this.imageUrl) {
          var str = this.imageUrl;
          const [baseUrl, imageUrl] = str.split(/,/);
          editNoticeBoard.upload = imageUrl;
b9759239c   Shikha Mishra   shown invoice det...
630
          editNoticeBoard.fileType = detectMimeType(imageUrl);
2d0fc1144   Neeraj Sharma   upload dynamic im...
631
        }
beb598536   Neeraj Sharma   design and functi...
632
        http()
2d0fc1144   Neeraj Sharma   upload dynamic im...
633
          .put("/updateEvent", editNoticeBoard)
8e8d14254   Shikha Mishra   Cleared data whil...
634
          .then((response) => {
beb598536   Neeraj Sharma   design and functi...
635
            if ((this.snackbar = true)) {
46db0a3b5   Neeraj Sharma   add sunbject and ...
636
              this.text = "Successfully Edit Existing Notice Data";
beb598536   Neeraj Sharma   design and functi...
637
            }
d5fcb1cd1   Shikha Mishra   issues resolved
638
639
            this.color = "green";
            this.snackbar = true;
2d0fc1144   Neeraj Sharma   upload dynamic im...
640
            this.getNoticeDataList();
a17c68a03   Neeraj Sharma   implement two rou...
641
            this.close();
beb598536   Neeraj Sharma   design and functi...
642
          })
8e8d14254   Shikha Mishra   Cleared data whil...
643
          .catch((error) => {
beb598536   Neeraj Sharma   design and functi...
644
            // console.log(error);
d5fcb1cd1   Shikha Mishra   issues resolved
645
646
647
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
beb598536   Neeraj Sharma   design and functi...
648
          });
68d742034   Neeraj Sharma   implement new des...
649
650
651
652
653
654
655
656
      },
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
b9759239c   Shikha Mishra   shown invoice det...
657
658
659
660
661
662
663
664
665
666
667
668
      },
      async generatePDF2Canvas(item) {
        var dataType = "";
        var type = "";
        if (item.fileType == "image") {
          dataType = "file.jpg";
        } else if (item.fileType == "other") {
          dataType = "file.pdf";
          type = "application/pdf";
        }
        var FileSaver = require("file-saver");
        FileSaver.saveAs(item.eventImageUrl, "image.jpg");
8e8d14254   Shikha Mishra   Cleared data whil...
669
      },
beb598536   Neeraj Sharma   design and functi...
670
671
    },
    mounted() {
46db0a3b5   Neeraj Sharma   add sunbject and ...
672
      this.getNoticeDataList();
8e8d14254   Shikha Mishra   Cleared data whil...
673
    },
beb598536   Neeraj Sharma   design and functi...
674
  };
ba420d0d1   Shikha Mishra   Solve add subject...
675
676
677
678
679
680
681
682
  </script>
  
  <style scoped>
  a:hover :hover {
    text-decoration: underline !important;
    color: blue;
  }
  </style>