Blame view

src/pages/Payroll/manageSalary.vue 33 KB
7fea6db0b   Shikha Mishra   added feature of ...
1
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
43
44
45
46
47
48
49
50
51
52
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
84
85
86
87
88
  <template>
    <v-container fluid class="body-color">
      <v-layout wrap>
        <v-flex xs12 sm6>
          <v-layout>
            <v-flex xs4 class="pt-4 subheading">
              <label class="right hidden-sm-only hidden-xs-only">Role:</label>
              <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label>
            </v-flex>
            <v-flex xs8 class="ml-3">
              <v-autocomplete
                v-model="getReport.role"
                :rules="role"
                :items="getRoles"
                item-text="name"
                item-value="role"
                placeholder="Select Role"
                @change="getUserDetailWithRoles"
                required
              ></v-autocomplete>
            </v-flex>
          </v-layout>
        </v-flex>
      </v-layout>
  
      <!-- *** Salary Data *** -->
      <v-data-table
        :headers="headers"
        :items="roleList"
        :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.profilePicUrl" v-if="props.item.profilePicUrl" />
                <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" />
              </v-avatar>
            </td>
            <td class="td td-row text-xs-center">{{ props.item.name}}</td>
            <td class="td td-row text-xs-center">{{ dates(props.item.joinDate)}}</td>
            <td class="text-xs-center td td-row">
              <span>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px; "
                    class="mr-3"
                    @click="profile(props.item)"
                    src="/static/icon/view.png"
                  />
                  <span>View</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
                    src="/static/icon/edit.png"
                  />
                  <span>Edit</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    @click="deleteItem(props.item)"
                    src="/static/icon/delete.png"
                    class="mr-3"
                  />
                  <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>
  
      <!-- ****** PROFILE VIEW  ******  -->
db965de89   Amber Dev   added dialog pers...
89
      <v-dialog v-model="profileSalaryDialog" persistent>
7fea6db0b   Shikha Mishra   added feature of ...
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
        <v-card flat class="text-xs-center white--text">
          <v-layout>
            <v-flex xs12 class="card-style pa-2">
              <label class="title text-xs-center">View Manage Salary</label>
              <v-icon
                size="24"
                color="white"
                class="right"
                @click="profileSalaryDialog = false"
              >cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-layout wrap>
            <v-flex xs12 sm12 md4>
              <v-card flat>
                <h3 class="py-2 text-xs-center card-style white--text">Profile</h3>
                <v-card-text>
                  <v-container>
                    <v-layout wrap>
                      <v-flex xs12>
                        <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="!editedItem.profilePicUrl" />
                              <img
                                :src="editedItem.profilePicUrl"
                                v-else-if="editedItem.profilePicUrl"
                              />
                            </v-avatar>
                          </v-flex>
                        </v-layout>
                        <v-layout>
                          <v-flex xs12 sm12>
                            <h3 class="text-xs-center">
                              <b>{{ editedItem.name }}</b>
                            </h3>
                            <p class="text-xs-center grey--text">{{ editedItem.roleName }}</p>
                          </v-flex>
                        </v-layout>
                        <v-layout style="border: 1px solid lightgrey;">
                          <v-flex xs6 sm6 class="pa-0">
                            <h4 class="right">
                              <b>Join Date :</b>
                            </h4>
                          </v-flex>
                          <v-flex sm6 xs6 class="pa-0">
                            <h4>{{ editedItem.joinDate }}</h4>
                          </v-flex>
                        </v-layout>
                        <v-layout style="border: 1px solid lightgrey;">
                          <v-flex xs6 sm6 class="pa-0">
                            <h4 class="right">
                              <b>Date of Birth :</b>
                            </h4>
                          </v-flex>
                          <v-flex sm6 xs6 class="pa-0">
                            <h4>{{ editedItem.dob }}</h4>
                          </v-flex>
                        </v-layout>
                        <v-layout style="border: 1px solid lightgrey;">
                          <v-flex xs6 sm6 class="pa-0">
                            <h4 class="right">
                              <b>Phone No :</b>
                            </h4>
                          </v-flex>
                          <v-flex sm6 xs6 class="pa-0">
                            <h4>{{ editedItem.mobileNo }}</h4>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-card-text>
              </v-card>
            </v-flex>
            <v-flex xs12 sm12 md8 v-if="viewSalary">
              <v-card flat>
                <v-flex xs12 sm12>
                  <v-container fluid grid-list-md>
                    <v-layout wrap>
                      <v-flex xs12 sm12 md6>
                        <v-card flat>
                          <v-form ref="form" lazy-validation class="py-4">
                            <v-layout>
                              <v-flex xs4 class="pt-4 subheading">
                                <label class="right hidden-xs-only">Salary Grades :</label>
                              </v-flex>
                              <v-flex xs8 sm7 class="ml-3">
                                <v-flex xs8 sm7 class="ml-3">
                                  <v-text-field
                                    solo
                                    v-model="editedItem.salaryTemplate.salaryGrades"
                                    readonly
                                  ></v-text-field>
                                </v-flex>
                              </v-flex>
                            </v-layout>
                            <v-layout>
                              <v-flex xs4 class="pt-4 subheading">
                                <label class="right">Basic Salary :</label>
                              </v-flex>
                              <v-flex xs8 sm7 class="ml-3">
                                <v-flex xs8 sm7 class="ml-3">
                                  <v-text-field
                                    solo
                                    v-model="editedItem.salaryTemplate.basicSalary"
                                    readonly
                                  ></v-text-field>
                                </v-flex>
                              </v-flex>
                            </v-layout>
                          </v-form>
                        </v-card>
                      </v-flex>
                      <v-flex xs12 sm12 md5></v-flex>
                      <v-flex xs12 sm12 md6>
                        <v-card flat>
                          <v-toolbar>
                            <h3>Allowances</h3>
                          </v-toolbar>
7bb043c06   Shikha Mishra   set validation in...
213
214
215
216
                          <v-layout
                            v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.allowances"
                            :key="index"
                          >
7fea6db0b   Shikha Mishra   added feature of ...
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field
                                readonly
                                solo
                                label="Enter Allowances Label"
                                v-model="editedItem.allowancesName"
                              ></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field
                                readonly
                                solo
                                v-model="editedItem.allowancesValue"
                                label="Enter Allowances Value"
                              ></v-text-field>
                            </v-flex>
                          </v-layout>
                        </v-card>
                      </v-flex>
                      <v-flex xs12 sm12 md6>
                        <v-card flat>
                          <v-toolbar>
                            <h3>Deduction</h3>
                          </v-toolbar>
7bb043c06   Shikha Mishra   set validation in...
241
242
243
244
                          <v-layout
                            v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.deduction"
                            :key="index"
                          >
7fea6db0b   Shikha Mishra   added feature of ...
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
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field
                                readonly
                                solo
                                label="Enter Deduction Label"
                                v-model="editedItem.deductionName"
                              ></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field
                                readonly
                                solo
                                label="Enter Deduction Value"
                                v-model="editedItem.deductionValue"
                              ></v-text-field>
                            </v-flex>
                          </v-layout>
                          <!-- <v-layout>
                            <v-flex xs4 class="pt-4 subheading">
                              <v-text-field
                                v-model="editedItem.salaryTemplate.deduction.deductionName"
                                readonly
                              ></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="ml-3">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.salaryTemplate.deduction.deductionValue"
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
7bb043c06   Shikha Mishra   set validation in...
277
                          </v-layout>-->
7fea6db0b   Shikha Mishra   added feature of ...
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
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
                        </v-card>
                      </v-flex>
                      <v-flex xs12 sm12 md12 style="padding-top: 1%;">
                        <v-card>
                          <v-toolbar>
                            <h3>Total Salary Details</h3>
                          </v-toolbar>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Gross Salary"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.salaryTemplate.grossSalary"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Total Deduction"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.salaryTemplate.totalDeduction"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Net Salary"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.salaryTemplate.netSalary"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                        </v-card>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-flex>
              </v-card>
            </v-flex>
            <v-flex xs12 sm12 md8 v-if="viewHourly">
              <v-card flat>
                <v-flex xs12 sm12>
                  <v-container fluid grid-list-md>
                    <v-layout wrap>
                      <v-flex xs12 sm12 md6>
                        <v-card flat>
                          <v-form ref="form" lazy-validation class="py-4">
                            <v-layout>
                              <v-flex xs4 class="pt-4 subheading">
                                <label class="right hidden-xs-only">Hourly Grades :</label>
                              </v-flex>
                              <v-flex xs8 sm7 class="ml-3">
                                <v-flex xs8 sm7 class="ml-3">
                                  <v-text-field
                                    solo
                                    v-model="editedItem.hourlyTemplate.hourlyGrades"
                                    readonly
                                  ></v-text-field>
                                </v-flex>
                              </v-flex>
                            </v-layout>
                            <v-layout>
                              <v-flex xs4 class="pt-4 subheading">
                                <label class="right">Hourly Rate :</label>
                              </v-flex>
                              <v-flex xs8 sm7 class="ml-3">
                                <v-flex xs8 sm7 class="ml-3">
                                  <v-text-field
                                    solo
                                    v-model="editedItem.hourlyTemplate.hourlyRate"
                                    readonly
                                  ></v-text-field>
                                </v-flex>
                              </v-flex>
                            </v-layout>
                          </v-form>
                        </v-card>
                      </v-flex>
                      <v-flex xs12 sm12 md12 style="padding-top: 1%;">
                        <v-card>
                          <v-toolbar>
                            <h3>Total Salary Details</h3>
                          </v-toolbar>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Gross Salary"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.hourlyTemplate.grossSalary"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Total Deduction"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.hourlyTemplate.totalDeduction"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                          <v-layout>
                            <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-text-field solo value="Net Hourly Rate"></v-text-field>
                            </v-flex>
                            <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only">
                              <v-flex xs8 sm7 class="ml-3">
                                <v-text-field
                                  v-model="editedItem.hourlyTemplate.netSalary"
                                  solo
                                  readonly
                                ></v-text-field>
                              </v-flex>
                            </v-flex>
                          </v-layout>
                        </v-card>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-flex>
              </v-card>
            </v-flex>
          </v-layout>
        </v-card>
      </v-dialog>
  
      <!-- ****** Edit  Hourly Template  ****** -->
db965de89   Amber Dev   added dialog pers...
432
      <v-dialog v-model="editSalaryDialog" max-width="400px" persistent>
7fea6db0b   Shikha Mishra   added feature of ...
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Manage Salary</label>
              <v-icon size="24" class="right" @click="editSalaryDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-form ref="form">
            <v-container fluid>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs3 class="pt-4 subheading">
                    <label class="right">Salary:</label>
                  </v-flex>
                  <v-flex xs8 sm7 class="ml-3">
                    <v-select
                      :items="salary"
                      v-model="editedItem.salary"
                      placeholder="please fill this field"
                      @change="selectSalary()"
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs3 class="pt-4 subheading">
                    <label class="right">Template:</label>
                  </v-flex>
                  <v-flex xs8 sm7 class="ml-3" v-if="monthlyGrade">
                    <v-autocomplete
                      v-model="editedItem.salaryId"
                      :items="salaryData"
                      item-text="salaryGrades"
                      item-value="_id"
                      placeholder="please fill this field"
                      @change="selectGrade()"
                      required
                    ></v-autocomplete>
                  </v-flex>
                  <v-flex xs8 sm7 class="ml-3" v-if="hourlyGrades">
                    <v-autocomplete
                      v-model="editedItem.salaryId"
                      :items="hourlyData"
                      item-text="hourlyGrades"
                      item-value="_id"
                      placeholder="please fill this field"
                      @change="selectGrade()"
                      required
                    ></v-autocomplete>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-layout>
                <v-flex xs12>
                  <v-layout>
                    <v-spacer></v-spacer>
                    <v-btn round dark @click="save" class="add-button">Update Salary Template</v-btn>
                    <v-spacer></v-spacer>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-form>
        </v-card>
      </v-dialog>
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import Util from "@/util";
  import moment from "moment";
  export default {
    data: () => ({
      search: "",
      pagination: {
4ecd35af2   Shikha Mishra   Resolve console e...
510
        rowsPerPage: 10,
7fea6db0b   Shikha Mishra   added feature of ...
511
      },
4ecd35af2   Shikha Mishra   Resolve console e...
512
      role: [(v) => !!v || "Role Name is required"],
7fea6db0b   Shikha Mishra   added feature of ...
513
514
515
516
517
518
519
520
521
522
      getRoles: [],
      teacherList: [],
      roleList: [],
      salaryData: [],
      hourlyData: [],
      salary: ["Monthly", "Hourly"],
  
      salaryItem: "",
  
      getReport: {
4ecd35af2   Shikha Mishra   Resolve console e...
523
        role: "",
7fea6db0b   Shikha Mishra   added feature of ...
524
525
526
527
528
529
530
531
532
533
534
535
      },
  
      showTeacher: false,
      editSalaryDialog: false,
      profileSalaryDialog: false,
      monthlyGrade: false,
      hourlyGrades: false,
      viewSalary: false,
      viewHourly: false,
  
      editedItem: {
        salaryTemplate: {
7bb043c06   Shikha Mishra   set validation in...
536
          allowances: {},
4ecd35af2   Shikha Mishra   Resolve console e...
537
          deduction: {},
7fea6db0b   Shikha Mishra   added feature of ...
538
        },
4ecd35af2   Shikha Mishra   Resolve console e...
539
        hourlyTemplate: {},
7fea6db0b   Shikha Mishra   added feature of ...
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
      },
  
      // salaryGrades: {},
      // salaryTemplate: {
      //   salaryGrades: ""
      // },
      // salaryTemplate :{
      //   allowances: {
      //     allowancesName: "",
      //     allowancesValue: ""
      //   },
      //   deduction: {
      //     deductionName: "",
      //     deductionValue: ""
      //   }
      // },
  
      headers: [
        {
          text: "No",
          align: "",
          sortable: false,
4ecd35af2   Shikha Mishra   Resolve console e...
562
          value: "No",
7fea6db0b   Shikha Mishra   added feature of ...
563
564
565
566
567
        },
        {
          text: "Profile Pic",
          value: "profilePicUrl",
          sortable: false,
4ecd35af2   Shikha Mishra   Resolve console e...
568
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
569
570
571
572
573
574
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        {
          text: "Join Date",
          value: "joinDate",
          sortable: false,
4ecd35af2   Shikha Mishra   Resolve console e...
575
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
576
        },
4ecd35af2   Shikha Mishra   Resolve console e...
577
        { text: "Action", value: "", sortable: false, align: "center" },
7fea6db0b   Shikha Mishra   added feature of ...
578
      ],
4ecd35af2   Shikha Mishra   Resolve console e...
579
      desserts: [],
7fea6db0b   Shikha Mishra   added feature of ...
580
581
582
583
584
585
    }),
  
    methods: {
      close() {
        this.editHourDialog = false;
      },
4ecd35af2   Shikha Mishra   Resolve console e...
586
      dates: function (date) {
7fea6db0b   Shikha Mishra   added feature of ...
587
588
589
590
591
592
593
594
595
596
597
598
        return moment(date).format("MMMM DD, YYYY");
      },
      editItem(item) {
        this.editedIndex = this.roleList.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.editSalaryDialog = true;
      },
      profile(item) {
        this.editedIndex = this.roleList.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.profileSalaryDialog = true;
        // console.log("item", item);
7bb043c06   Shikha Mishra   set validation in...
599
        if (item.salaryTemplate) {
7fea6db0b   Shikha Mishra   added feature of ...
600
          this.viewSalary = true;
7bb043c06   Shikha Mishra   set validation in...
601
          this.viewHourly = false;
7fea6db0b   Shikha Mishra   added feature of ...
602
603
        } else {
          this.viewHourly = true;
7bb043c06   Shikha Mishra   set validation in...
604
          this.viewSalary = false;
7fea6db0b   Shikha Mishra   added feature of ...
605
606
607
608
609
610
611
        }
      },
      getRole() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getRolesList", {
4ecd35af2   Shikha Mishra   Resolve console e...
612
            headers: { Authorization: "Bearer " + token },
7fea6db0b   Shikha Mishra   added feature of ...
613
          })
4ecd35af2   Shikha Mishra   Resolve console e...
614
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
615
            this.getRoles = response.data.data;
7bb043c06   Shikha Mishra   set validation in...
616
617
618
619
            // if (this.getRoles[2].role !== 3) {
            //   this.getRoles = response.data.data;
            //   console.log("roles", this.getRoles[2].role);
            // }
4ecd35af2   Shikha Mishra   Resolve console e...
620
621
622
623
624
625
  
            //   var removedRoles = _.remove(this.getRoles, function (c) {
            //     //remove if color is green or yellow
            //     return c.role === 1 || c.role === 4 || c.role === 5;
            //     // console.log(c);
            //   });
7fea6db0b   Shikha Mishra   added feature of ...
626
627
            this.showLoader = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
628
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
629
            this.showLoader = false;
7fea6db0b   Shikha Mishra   added feature of ...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
          });
      },
  
      getRoleInputs(role) {
        // console.log("role", role);
        if (role === 3) {
          this.showTeacher = true;
          this.getTeacherList();
        }
      },
  
      getTeacherList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTeachersList", {
4ecd35af2   Shikha Mishra   Resolve console e...
646
            headers: { Authorization: "Bearer " + token },
7fea6db0b   Shikha Mishra   added feature of ...
647
          })
4ecd35af2   Shikha Mishra   Resolve console e...
648
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
649
650
651
652
            this.teacherList = response.data.data;
            this.showTeacher = true;
            this.showLoader = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
653
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
  
      getUserDetailWithRoles() {
        this.showLoader = true;
        http()
          .get(
            "/getUserDetailWithRoles",
            { params: { role: this.getReport.role } },
            {
4ecd35af2   Shikha Mishra   Resolve console e...
670
              headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
671
672
            }
          )
4ecd35af2   Shikha Mishra   Resolve console e...
673
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
674
675
676
            this.roleList = response.data.data;
            this.showLoader = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
677
          .catch((err) => {
7fea6db0b   Shikha Mishra   added feature of ...
678
679
680
681
682
683
684
685
            this.showLoader = false;
          });
      },
      getSalaryList() {
        this.showLoader = true;
        this.loadingSearch = true;
        http()
          .get("/getSalaryList", {
4ecd35af2   Shikha Mishra   Resolve console e...
686
            headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
687
          })
4ecd35af2   Shikha Mishra   Resolve console e...
688
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
689
690
691
692
            this.salaryData = response.data.data;
            this.showLoader = false;
            this.loadingSearch = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
693
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
            // console.log("err====>", err);
            this.showLoader = false;
            this.loadingSearch = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      getHourlyList() {
        this.showLoader = true;
        this.loadingSearch = true;
        http()
          .get("/getHourlyList", {
4ecd35af2   Shikha Mishra   Resolve console e...
711
            headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
712
          })
4ecd35af2   Shikha Mishra   Resolve console e...
713
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
714
715
716
717
            this.hourlyData = response.data.data;
            this.showLoader = false;
            this.loadingSearch = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
718
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
            // console.log("err====>", err);
            this.showLoader = false;
            this.loadingSearch = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      editItem(item) {
        this.editedIndex = this.salaryData.indexOf(item);
        this.editedIndex = this.hourlyData.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 = "");
        this.editSalaryDialog = true;
      },
      selectSalary() {
        if (this.editedItem.salary === "Monthly") {
          this.monthlyGrade = true;
          this.hourlyGrades = false;
        } else {
          this.monthlyGrade = false;
          this.hourlyGrades = true;
        }
      },
      selectGrade() {
4ecd35af2   Shikha Mishra   Resolve console e...
751
        //   console.log("this.editedItem", this.editedItem);
7fea6db0b   Shikha Mishra   added feature of ...
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
      },
      selectView() {
        if (this.editedItem.view.png === "Monthly") {
          this.viewSalary = true;
          this.viewHourly = false;
        } else {
          this.viewSalary = false;
          this.viewHourly = true;
        }
      },
  
      save() {
        var updateSalary = {
          role: this.editedItem.role,
          userId: this.editedItem._id,
          templateName: this.editedItem.salary,
4ecd35af2   Shikha Mishra   Resolve console e...
768
          templateId: this.editedItem.salaryId,
7fea6db0b   Shikha Mishra   added feature of ...
769
770
771
772
        };
        http()
          .put("/updateUserSalary", updateSalary, {
            headers: {
4ecd35af2   Shikha Mishra   Resolve console e...
773
774
              Authorization: "Bearer " + this.token,
            },
7fea6db0b   Shikha Mishra   added feature of ...
775
          })
4ecd35af2   Shikha Mishra   Resolve console e...
776
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
777
778
779
780
781
782
783
            this.getUserDetailWithRoles();
            this.close();
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.editSalaryDialog = false;
          })
4ecd35af2   Shikha Mishra   Resolve console e...
784
785
786
          .catch((error) => {
            //   console.log("error", error);
            this.snackbar = true;
7fea6db0b   Shikha Mishra   added feature of ...
787
            this.snackbar = true;
4ecd35af2   Shikha Mishra   Resolve console e...
788
789
            this.color = "error";
            this.text = error.response.data.message;
7fea6db0b   Shikha Mishra   added feature of ...
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
          });
      },
  
      deleteItem(item) {
        // let deleteGrade = {
        //   hourlyId: item._id
        // };
        // http()
        //   .delete(
        //     "/deleteHourly",
        //     confirm("Are you sure you want to delete this?") && {
        //       params: deleteGrade
        //     },
        //     {
        //       headers: {
        //         Authorization: "Bearer " + this.token
        //       }
        //     }
        //   )
        //   .then(response => {
        //     this.snackbar = true;
        //   //   this.text = "Successfully Delete Salary ";
        //     this.text = response.data.message;
        //     this.color = "green";
        //     this.getUserDetailWithRoles();
        //   })
        //   .catch(error => {
        //     console.log("error", error);
        //     this.snackbar = true;
        //     this.text = error.response.data.message;
        //     this.color = "red";
        //   });
4ecd35af2   Shikha Mishra   Resolve console e...
822
      },
7fea6db0b   Shikha Mishra   added feature of ...
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
  
      // selectAllowances() {
      //   this.salaryTypeData.push({
      //     allowancesValue: (this.salaryType.allowancesValue = "")
      //   });
      //   //   console.log("this.salaryTypeData", this.salaryTypeData);
      //   var totalAllowances = "";
      //   this.salaryTypeData.forEach(allowancesValue_ => {
      //     if (allowancesValue_.allowancesValue != "") {
      //       // console.log("allowances", allowancesValue_.allowancesValue);
      //       totalAllowances =
      //         Number(totalAllowances) + Number(allowancesValue_.allowancesValue);
      //     }
      //     this.grossSalary =
      //       totalAllowances + Number(this.salaryType.basicSalary);
      //   });
      // },
      // allowancesAdd() {
      //   this.editedItem.allowances.push({
      //     allowancesValue: (this.salaryType.allowancesValue = "")
      //   });
      //   var totalAllowances = "";
      //   this.editedItem.allowances.forEach(allowancesValue_ => {
      //     if (allowancesValue_.allowancesValue != "") {
      //       //   console.log("allowances", allowancesValue_.allowancesValue);
      //       totalAllowances =
      //         Number(totalAllowances) + Number(allowancesValue_.allowancesValue);
      //       console.log("totalAllowances", totalAllowances);
      //     }
      //     this.editedItem.grossSalary =
      //       totalAllowances + Number(this.editedItem.basicSalary);
      //     console.log("this.editedItem.grossSalary", this.editedItem.grossSalary);
      //   });
      // },
      // selectDeduction() {
      //   this.salaryTypeDeductionData.push({
      //     deductionValue: (this.salaryType.deductionValue = "")
      //   });
      //   var totalDeductions = "";
      //   this.salaryTypeDeductionData.forEach(deductionValue_ => {
      //     if (deductionValue_.deductionValue != "") {
      //       //   console.log("deduction", deductionValue_.deductionValue);
      //       totalDeductions =
      //         Number(totalDeductions) + Number(deductionValue_.deductionValue);
      //     }
      //   });
      // },
      // deductionAdd() {
      //   this.editedItem.deduction.push({
      //     deductionValue: (this.salaryType.deductionValue = "")
      //   });
      //   var totalDeductions = "";
      //   this.editedItem.deduction.forEach(deductionValue_ => {
      //     if (deductionValue_.deductionValue != "") {
      //       //   console.log("deduction", deductionValue_.deductionValue);
      //       totalDeductions =
      //         Number(totalDeductions) + Number(deductionValue_.deductionValue);
      //       console.log("this.totalDeductions", totalDeductions);
      //     }
      //     // this.editedItem.totalDeduction = totalDeductions;
      //     // console.log("this.totalDeduction", this.editedItem.totalDeduction);
      //   });
      // },
      // deleteSelectAllowances: function(index) {
      //   this.salaryTypeData.splice(index, 1);
      // },
      // deleteallowancesAdd: function(index) {
      //   this.editedItem.allowances.splice(index, 1);
      // },
      // deleteSelectDeduction: function(index) {
      //   this.salaryTypeDeductionData.splice(index, 1);
      // },
      // deletedeductionAdd: function(index) {
      //   this.editedItem.deduction.splice(index, 1);
      // },
      // clear() {
      //   this.$refs.form.reset();
      //   this.disable = false;
      // }
    },
  
    mounted() {
      this.token = this.$store.state.token;
      this.getRole();
      this.getSalaryList();
      this.getHourlyList();
4ecd35af2   Shikha Mishra   Resolve console e...
909
    },
7fea6db0b   Shikha Mishra   added feature of ...
910
911
  };
  </script>