Blame view

src/pages/Account/income.vue 23.5 KB
687e0b929   Neeraj Sharma   add user,attenden...
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
    <v-container fluid class="body-color">
      <!-- ****** EDIT Income DETAILS ****** -->
      <v-dialog v-model="editIncomeDialog" max-width="600px" scrollable>
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Income</label>
              <v-icon size="24" class="right" @click="editIncomeDialog = 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 my-4 mr-4"
              >
                <v-avatar size="160px">
                  <img src="/static/icon/user.png" v-if="!editedItem.fileUrl && !imageUrl" />
                  <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl && !imageUrl" />
                  <img
                    v-if="imageUrl"
                    :src="imageUrl"
                    height="150"
                    style="border-radius:50%; width:200px"
                  />
                </v-avatar>
                <input
                  type="file"
                  style="display:none"
                  ref="image"
                  accept="image/*"
                  @change="onFilePicked"
                />
              </v-flex>
            </v-layout>
            <v-layout wrap>
              <v-flex xs12 sm12>
f4df757fe   Neeraj Sharma   responsive vie in...
39
                <v-layout>
68d742034   Neeraj Sharma   implement new des...
40
41
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Name:</label>
f4df757fe   Neeraj Sharma   responsive vie in...
42
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
43
44
45
46
47
48
49
50
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      v-model="editedItem.name"
                      placeholder="fill your full Name"
                      name="name"
                      type="text"
                      required
                    ></v-text-field>
f4df757fe   Neeraj Sharma   responsive vie in...
51
52
                  </v-flex>
                </v-layout>
68d742034   Neeraj Sharma   implement new des...
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
              </v-flex>
            </v-layout>
            <v-layout wrap>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Date:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-menu
                      ref="menu"
                      :close-on-content-click="false"
                      v-model="menu3"
                      :nudge-right="40"
                      lazy
                      transition="scale-transition"
                      offset-y
                      full-width
                      min-width="290px"
                    >
                      <v-text-field
                        slot="activator"
                        v-model="editedItem.date"
                        placeholder="Select date"
                      ></v-text-field>
                      <v-date-picker
                        ref="picker"
                        v-model="editedItem.date"
                        @input="$refs.menu.save(editedItem.date)"
                      ></v-date-picker>
                    </v-menu>
f4df757fe   Neeraj Sharma   responsive vie in...
84
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
85
86
87
88
89
90
91
92
93
94
                </v-layout>
              </v-flex>
              <v-layout wrap>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Amount:</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-text-field v-model="editedItem.amount" required></v-text-field>
f4df757fe   Neeraj Sharma   responsive vie in...
95
96
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
97
98
99
100
101
102
103
                </v-flex>
              </v-layout>
              <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...
104
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
105
106
107
108
109
110
111
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      label="Select Image"
                      @click="pickFile"
                      v-model="imageName"
                      append-icon="attach_file"
                    ></v-text-field>
f4df757fe   Neeraj Sharma   responsive vie in...
112
113
                  </v-flex>
                </v-layout>
68d742034   Neeraj Sharma   implement new des...
114
115
              </v-flex>
              <v-flex xs12>
f4df757fe   Neeraj Sharma   responsive vie in...
116
                <v-layout>
68d742034   Neeraj Sharma   implement new des...
117
118
119
120
121
122
123
124
125
126
127
128
129
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Note:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-textarea
                      name="input-7-1"
                      v-model="editedItem.note"
                      placeholder="fill your Note"
                      type="text"
                      :rules="noteRules"
                      multi-line
                      required
                    ></v-textarea>
f4df757fe   Neeraj Sharma   responsive vie in...
130
131
                  </v-flex>
                </v-layout>
68d742034   Neeraj Sharma   implement new des...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
              </v-flex>
            </v-layout>
            <v-layout>
              <v-flex xs12 >
                <v-card-actions>
                  <v-spacer></v-spacer>
                  <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn>
                  <v-spacer></v-spacer>
                </v-card-actions>
              </v-flex>
            </v-layout>
          </v-card-text>
        </v-card>
      </v-dialog>
687e0b929   Neeraj Sharma   add user,attenden...
146

68d742034   Neeraj Sharma   implement new des...
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
      <!-- ****** PROFILE VIEW INCOME DETAILS ******  -->
      <v-dialog v-model="profileIncomeDialog" max-width="400px">
        <v-card flat class="card-style pa-3" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Income</label>
              <v-icon size="24" class="right" @click="profileIncomeDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex>
                  <v-flex align-center justify-center layout text-xs-center>
                    <v-avatar size="80px" v-if="!editedItem.fileUrl">
                      <img src="/static/icon/user.png" />
                    </v-avatar>
                    <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" width="150" />
                  </v-flex>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Name:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.name }}</h5>
687e0b929   Neeraj Sharma   add user,attenden...
174
175
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Amount:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.amount }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Date:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ dates(editedItem.date) }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Note:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.note }}</h5>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
      <!-- ****** EXISTING-EXPENSE TABLE DATA****** -->
687e0b929   Neeraj Sharma   add user,attenden...
213

68d742034   Neeraj Sharma   implement new des...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
      <v-toolbar color="transparent" flat>
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addIncomeDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addIncomeDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Income
        </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">
              <img src="/static/icon/dashboard icons-49.png" alt="icon" />
            </v-avatar>
          </v-btn>
        </v-card-title>
        <v-flex xs8 sm8 md3 lg2 v-show="showSearch">
          <v-layout>
            <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field>
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="incomeList"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <tr class="tr">
            <td class="text-xs-center td td-row">{{ props.index + 1}}</td>
            <td class="text-xs-center td td-row">
              <v-avatar class="40">
                <img :src="props.item.fileUrl" v-if="props.item.fileUrl" />
                <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" />
              </v-avatar>
            </td>
            <td class="text-xs-center td td-row">{{ props.item.name}}</td>
            <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td>
            <td class="text-xs-center td td-row">{{ props.item.user }}</td>
            <td class="text-xs-center td td-row">{{ props.item.amount }}</td>
            <td class="text-xs-center td td-row">{{ props.item.note }}</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/dashboard icons-47.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/dashboard icons-50.png"
                  />
                  <span>Edit</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    @click="deleteItem(props.item)"
                    src="/static/icon/dashboard icons-51.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>
687e0b929   Neeraj Sharma   add user,attenden...
309

68d742034   Neeraj Sharma   implement new des...
310
311
312
313
314
315
316
      <!-- ****** Add Income Data****** -->
      <v-dialog v-model="addIncomeDialog" max-width="600px">
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Income</label>
              <v-icon size="24" class="right" @click="addIncomeDialog = false">cancel</v-icon>
687e0b929   Neeraj Sharma   add user,attenden...
317
            </v-flex>
68d742034   Neeraj Sharma   implement new des...
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
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
400
401
402
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
          </v-layout>
          <v-form ref="form" v-model="valid" lazy-validation>
            <v-container fluid>
              <v-layout>
                <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center">
                  <v-avatar size="80px">
                    <img src="/static/icon/user.png" v-if="!imageUrl" />
                  </v-avatar>
                  <img
                    :src="imageUrl"
                    height="150"
                    v-if="imageUrl"
                    style="border-radius:50%; width:200px"
                  />
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Name:</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-text-field
                        v-model="addIncome.name"
                        placeholder="fill your full Name"
                        name="name"
                        type="text"
                        :rules="nameRules"
                        required
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Amount:</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-text-field
                        v-model="addIncome.amount"
                        placeholder="fill your Amount"
                        name="name"
                        type="text"
                        :rules="amountRules"
                        required
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Date</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-menu
                        ref="menu1"
                        :close-on-content-click="false"
                        v-model="menu1"
                        :nudge-right="40"
                        lazy
                        transition="scale-transition"
                        offset-y
                        full-width
                        min-width="290px"
                      >
                        <v-text-field
                          slot="activator"
                          :rules="joinDateRules"
                          v-model="addIncome.date"
                          placeholder="Select date"
                        ></v-text-field>
                        <v-date-picker
                          ref="picker"
                          v-model="addIncome.date"
                          @input="$refs.menu1.save(addIncome.date)"
                        ></v-date-picker>
                      </v-menu>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">File:</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-text-field
                        label="Select file"
                        @click="pickFile"
                        v-model="imageName"
                        append-icon="attach_file"
                      ></v-text-field>
                      <input
                        type="file"
                        style="display:none"
                        ref="image"
                        accept="image/*"
                        @change="onFilePicked"
                      />
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right">Note:</label>
                    </v-flex>
                    <v-flex xs8 sm6 class="ml-3">
                      <v-textarea
                        name="input-7-1"
                        v-model="addIncome.note"
                        placeholder="fill your Note"
                        type="text"
                        :rules="noteRules"
                        multi-line
                        required
                      ></v-textarea>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm11>
                  <v-layout>
                    <v-spacer></v-spacer>
                    <v-btn @click="clear" round class="clear-button" dark>clear</v-btn>
                    <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-form>
        </v-card>
      </v-dialog>
687e0b929   Neeraj Sharma   add user,attenden...
463
464
465
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
466
    </v-container>
687e0b929   Neeraj Sharma   add user,attenden...
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import Util from "@/util";
  import moment from "moment";
  
  export default {
    data: () => ({
      component: "report-generate",
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
68d742034   Neeraj Sharma   implement new des...
483
484
      show: true,
      showSearch: false,
687e0b929   Neeraj Sharma   add user,attenden...
485
486
487
488
      showLoader: false,
      loading: false,
      date: null,
      search: "",
68d742034   Neeraj Sharma   implement new des...
489
      addIncomeDialog: false,
687e0b929   Neeraj Sharma   add user,attenden...
490
491
492
493
      menu: false,
      menu1: false,
      menu2: false,
      menu3: false,
68d742034   Neeraj Sharma   implement new des...
494
495
      editIncomeDialog: false,
      profileIncomeDialog: false,
687e0b929   Neeraj Sharma   add user,attenden...
496
      valid: true,
687e0b929   Neeraj Sharma   add user,attenden...
497
      pagination: {
68d742034   Neeraj Sharma   implement new des...
498
        rowsPerPage: 10
687e0b929   Neeraj Sharma   add user,attenden...
499
500
501
502
503
504
505
506
507
508
509
510
511
      },
      imageData: {},
      imageName: "",
      imageUrl: "",
      imageFile: "",
      nameRules: [v => !!v || " Full Name is required"],
      amountRules: [v => !!v || "Amount is required"],
      noteRules: [v => !!v || "Note Name is required"],
      joinDateRules: [v => !!v || "Date is required"],
      errorMessages: "",
      headers: [
        {
          text: "No",
68d742034   Neeraj Sharma   implement new des...
512
          align: "",
687e0b929   Neeraj Sharma   add user,attenden...
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
          sortable: false,
          value: "No"
        },
        {
          text: "Profile Pic",
          value: "profilePicUrl",
          sortable: false,
          align: "center"
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        { text: "Date", value: "date", sortable: false, align: "center" },
        { text: "User", value: "user", sortable: false, align: "center" },
        { text: "Amount", value: "amount", sortable: false, align: "center" },
        { text: "Note", value: "note", sortable: false, align: "center" },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
      incomeList: [],
      editedIndex: -1,
      upload: "",
      editedItem: {},
      addIncome: {}
    }),
    watch: {
      menu(val) {
        val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR"));
      },
      menu1(val) {
        val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR"));
      }
    },
    methods: {
      save(date) {
        this.$refs.menu.save(date);
      },
      save(date) {
        this.$refs.menu1.save(date);
      },
      pickFile() {
        this.$refs.image.click();
      },
      onFilePicked(e) {
        // console.log(e)
        const files = e.target.files;
        this.upload = e.target.files[0];
        console.log("imageData-upload========>", this.upload);
        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);
            // console.log("upload=======>", this.imageData.imageUrl);
            console.log("imageFile", this.imageUrl);
          });
        } else {
          this.imageName = "";
          this.imageFile = "";
          this.imageUrl = "";
        }
      },
      dates: function(date) {
        return moment(date).format("MMMM DD, YYYY");
      },
      getIncomeList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getIncomesList", {
99cd79184   Neeraj Sharma   implement all tas...
586
            params: { schoolId: this.$store.state.schoolId },
687e0b929   Neeraj Sharma   add user,attenden...
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.incomeList = response.data.data;
            this.showLoader = false;
            // console.log("getTeacherList=====>",this.incomeList)
          })
          .catch(error => {
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      editItem(item) {
        this.editedIndex = this.incomeList.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.editedItem.date =
          this.editedItem.date != undefined
            ? (this.editedItem.date = this.editedItem.date.substring(0, 10))
            : (this.editedItem.date = "");
68d742034   Neeraj Sharma   implement new des...
610
        this.editIncomeDialog = true;
687e0b929   Neeraj Sharma   add user,attenden...
611
612
613
614
      },
      profile(item) {
        this.editedIndex = this.incomeList.indexOf(item);
        this.editedItem = Object.assign({}, item);
68d742034   Neeraj Sharma   implement new des...
615
        this.profileIncomeDialog = true;
687e0b929   Neeraj Sharma   add user,attenden...
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
      },
      deleteItem(item) {
        let deleteIncome = {
          incomeId: item._id
        };
        http()
          .delete(
            "/deleteIncome",
            confirm("Are you sure you want to delete this?") && {
              params: deleteIncome
            }
          )
          .then(response => {
            // console.log("deleteUers",deleteTeachers)
            if ((this.snackbar = true)) {
              this.text = "Successfully delete Existing Income";
            }
            this.getIncomeList();
          })
          .catch(error => {
            console.log(error);
          });
      },
687e0b929   Neeraj Sharma   add user,attenden...
639
      close() {
68d742034   Neeraj Sharma   implement new des...
640
        this.editIncomeDialog = false;
687e0b929   Neeraj Sharma   add user,attenden...
641
642
643
644
645
646
647
648
649
650
651
652
      },
      close1() {
        this.dialog1 = false;
      },
      submit() {
        if (this.$refs.form.validate()) {
          if (this.imageUrl) {
            var str = this.imageUrl;
            const [baseUrl, imageUrl] = str.split(/,/);
            this.addIncome.upload = imageUrl;
          }
          this.loading = true;
68d742034   Neeraj Sharma   implement new des...
653
          // this.addIncome = this.$store.state.schoolId;
687e0b929   Neeraj Sharma   add user,attenden...
654
655
656
657
          http()
            .post("/createIncome", this.addIncome)
            .then(response => {
              this.getIncomeList();
68d742034   Neeraj Sharma   implement new des...
658
659
660
661
              this.snackbar = true;
              this.text = response.data.message;
              this.color = "green";
              this.addIncomeDialog = false;
687e0b929   Neeraj Sharma   add user,attenden...
662
663
664
665
666
              this.clear();
              this.loading = false;
            })
            .catch(error => {
              // console.log(error);
687e0b929   Neeraj Sharma   add user,attenden...
667
              this.loading = false;
68d742034   Neeraj Sharma   implement new des...
668
669
670
              this.snackbar = true;
              this.color = "error";
              this.text = error.response.data.message;
687e0b929   Neeraj Sharma   add user,attenden...
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
            });
        }
      },
      clear() {
        this.$refs.form.reset();
      },
      save() {
        this.loading = true;
        this.editedItem.incomeId = this.editedItem._id;
        if (this.imageUrl) {
          var str = this.imageUrl;
          const [baseUrl, imageUrl] = str.split(/,/);
          this.editedItem.upload = imageUrl;
        }
        http()
          .put("/updateIncome", this.editedItem)
          .then(response => {
68d742034   Neeraj Sharma   implement new des...
688
689
690
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
687e0b929   Neeraj Sharma   add user,attenden...
691
692
693
694
695
            this.loading = false;
            this.getIncomeList();
            this.close();
          })
          .catch(error => {
68d742034   Neeraj Sharma   implement new des...
696
697
698
            this.loading = false;
            this.snackbar = true;
            this.color = "error";
687e0b929   Neeraj Sharma   add user,attenden...
699
700
            this.loading = false;
          });
68d742034   Neeraj Sharma   implement new des...
701
702
703
704
705
706
707
708
709
      },
  
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
687e0b929   Neeraj Sharma   add user,attenden...
710
711
712
713
      }
    },
    mounted() {
      this.getIncomeList();
687e0b929   Neeraj Sharma   add user,attenden...
714
715
    }
  };
68d742034   Neeraj Sharma   implement new des...
716
  </script>