Blame view

src/pages/NoticeBoard/noticeBoard.vue 20.7 KB
beb598536   Neeraj Sharma   design and functi...
1
  <template>
68d742034   Neeraj Sharma   implement new des...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    <v-container fluid class="body-color">
      <!-- ****** Edit  Notice Board ****** -->
      <v-dialog v-model="editNoticeBoardDialog" max-width="500px" scrollable>
        <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

68d742034   Neeraj Sharma   implement new des...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
      <v-dialog v-model="viewNoticeBoardDialog" max-width="600px" scrollable>
        <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">
b9759239c   Shikha Mishra   shown invoice det...
216
217
218
219
220
221
222
223
              <v-btn
                class="add-button"
                @click="generatePDF2Canvas(props.item)"
                :loading="loadingPdf"
                dark
              >{{ props.item.fileType }}</v-btn>
            </td>
            <td class="text-xs-center td td-row">
68d742034   Neeraj Sharma   implement new des...
224
225
226
227
228
229
230
              <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...
231
                    src="/static/icon/view.png"
68d742034   Neeraj Sharma   implement new des...
232
233
234
235
236
237
238
239
240
                  />
                  <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...
241
                    src="/static/icon/edit.png"
68d742034   Neeraj Sharma   implement new des...
242
243
244
245
246
247
248
249
                  />
                  <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...
250
                    src="/static/icon/delete.png"
68d742034   Neeraj Sharma   implement new des...
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
                  />
                  <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 ****** -->
8e8d14254   Shikha Mishra   Cleared data whil...
266
      <v-dialog v-model="addNoticeBoardDialog" max-width="600px" v-if="addNoticeBoardDialog">
68d742034   Neeraj Sharma   implement new des...
267
268
269
270
        <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...
271
              <v-icon size="24" class="right" @click="closeNoticeBoardModel">cancel</v-icon>
68d742034   Neeraj Sharma   implement new des...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
            </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...
290

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