Blame view

src/pages/Payroll/salaryTemplate.vue 46.4 KB
7fea6db0b   Shikha Mishra   added feature of ...
1
2
3
  <template>
    <v-container fluid class="body-color" style="box-sizing: border-box;">
      <!-- ****** EDIT SALARY ****** -->
db965de89   Amber Dev   added dialog pers...
4
      <v-dialog v-model="editSalaryDialog" persistent>
7fea6db0b   Shikha Mishra   added feature of ...
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
213
214
215
216
217
218
219
220
221
222
223
        <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">Edit Salary</label>
              <v-icon size="24" color="white" class="right" @click="editSalaryDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
  
          <v-flex xs12 sm12>
            <v-container fluid grid-list-md>
              <v-layout wrap>
                <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Salary Template</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-form ref="form" v-model="valid" 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 :rules="salaryRules" v-model="editedItem.salaryGrades"></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 :rules="basicRules" v-model="editedItem.basicSalary"></v-text-field>
                          </v-flex>
                        </v-flex>
                      </v-layout>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Overtime Rate (Per Hour) :</label>
                        </v-flex>
                        <v-flex xs8 sm7 class="ml-3">
                          <v-flex xs8 sm7 class="ml-3">
                            <v-text-field :rules="overtimeRules" v-model="editedItem.overtimeRate"></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 dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Allowances</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          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
                          solo
                          v-model="editedItem.allowancesValue"
                          label="Enter Allowances Value"
                          v-on:keyup="addAllowancesValue"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-btn
                          color="white"
                          round
                          class="right mt-3"
                          @click="deleteallowancesAdd(index)"
                          v-if="index != 0"
                        >
                          <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                        <v-btn color="white" round class="right mt-3" @click="allowancesAdd">
                          <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                      </v-flex>
                    </v-layout>
                    <!-- <v-flex xs12 sm12 md6> -->
                    <v-card flat>
                      <v-toolbar dark class="card-styles" flat>
                        <v-spacer></v-spacer>
                        <h3>Deduction</h3>
                        <v-spacer></v-spacer>
                      </v-toolbar>
                      <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index">
                        <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-text-field
                            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
                            solo
                            label="Enter Deduction Value"
                            v-model="editedItem.deductionValue"
                            v-on:keyup="addDeductionValue"
                          ></v-text-field>
                        </v-flex>
                        <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-btn
                            color="white"
                            round
                            class="right mt-3"
                            @click="deletedeductionAdd(index)"
                            v-if="index != 0"
                          >
                            <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                          </v-btn>
                          <v-btn color="white" round class="right mt-3" @click="deductionAdd">
                            <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                          </v-btn>
                        </v-flex>
                      </v-layout>
                    </v-card>
                    <!-- </v-flex> -->
                  </v-card>
                </v-flex>
                <!-- <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Deduction</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          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
                          solo
                          label="Enter Deduction Value"
                          v-model="editedItem.deductionValue"
                          v-on:keyup="addDeductionValue"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-btn
                          color="white"
                          round
                          class="right mt-3"
                          @click="deletedeductionAdd(index)"
                          v-if="index != 0"
                        >
                          <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                        <v-btn color="white" round class="right mt-3" @click="deductionAdd">
                          <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                      </v-flex>
                    </v-layout>
                  </v-card>
                </v-flex>-->
                <!-- <v-flex xs12 sm12 md4></v-flex> -->
                <v-flex xs12 sm12 md12 style="padding-top: 1%;">
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Total Salary Details</h3>
                      <v-spacer></v-spacer>
                    </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.grossSalary" box 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.totalDeduction" box 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.netSalary" box readonly></v-text-field>
                        </v-flex>
                      </v-flex>
                    </v-layout>
                  </v-card>
                  <v-layout>
                    <v-flex xs12>
                      <v-card-actions>
                        <v-spacer class="hidden-xs-only"></v-spacer>
                        <v-btn
                          color="open-dialog-button"
                          dark
d10c26632   Shikha Mishra   Improve updateBoo...
224
                          class="right add-button"
7fea6db0b   Shikha Mishra   added feature of ...
225
226
227
228
229
230
231
232
233
234
235
236
237
                          @click="save"
                        >Update Salary Template</v-btn>
                      </v-card-actions>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-flex>
        </v-card>
      </v-dialog>
  
      <!-- ****** PROFILE VIEW  ******  -->
db965de89   Amber Dev   added dialog pers...
238
      <v-dialog v-model="profileSalaryDialog" persistent>
7fea6db0b   Shikha Mishra   added feature of ...
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
309
310
311
312
313
314
315
316
317
318
319
        <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 Salary</label>
              <v-icon
                size="24"
                color="white"
                class="right"
                @click="profileSalaryDialog = false"
              >cancel</v-icon>
            </v-flex>
          </v-layout>
  
          <v-flex xs12 sm12>
            <v-container fluid grid-list-md>
              <v-layout wrap>
                <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Salary Template</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-form ref="form" v-model="valid" 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
                              :rules="salaryRules"
                              v-model="editedItem.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
                              :rules="basicRules"
                              v-model="editedItem.basicSalary"
                              readonly
                            ></v-text-field>
                          </v-flex>
                        </v-flex>
                      </v-layout>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Overtime Rate (Per Hour) :</label>
                        </v-flex>
                        <v-flex xs8 sm7 class="ml-3">
                          <v-flex xs8 sm7 class="ml-3">
                            <v-text-field
                              :rules="overtimeRules"
                              v-model="editedItem.overtimeRate"
                              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 dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Allowances</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          solo
d5fcb1cd1   Shikha Mishra   issues resolved
320
                          readonly
7fea6db0b   Shikha Mishra   added feature of ...
321
322
323
324
325
326
327
                          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
                          solo
d5fcb1cd1   Shikha Mishra   issues resolved
328
                          readonly
7fea6db0b   Shikha Mishra   added feature of ...
329
330
331
332
333
334
                          v-model="editedItem.allowancesValue"
                          label="Enter Allowances Value"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                    <!-- <v-flex xs12 sm12 md6> -->
8e8d14254   Shikha Mishra   Cleared data whil...
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
                    <v-card flat>
                      <v-toolbar dark class="card-styles" flat>
                        <v-spacer></v-spacer>
                        <h3>Deduction</h3>
                        <v-spacer></v-spacer>
                      </v-toolbar>
                      <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index">
                        <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-text-field
                            solo
                            readonly
                            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
                            solo
                            readonly
                            label="Enter Deduction Value"
                            v-model="editedItem.deductionValue"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-card>
7fea6db0b   Shikha Mishra   added feature of ...
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
                    <!-- </v-flex> -->
                  </v-card>
                </v-flex>
                <!-- <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Deduction</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          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
                          solo
                          label="Enter Deduction Value"
                          v-model="editedItem.deductionValue"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                  </v-card>
                </v-flex>-->
d5fcb1cd1   Shikha Mishra   issues resolved
388
                <v-flex xs12 sm12 md4></v-flex>
7fea6db0b   Shikha Mishra   added feature of ...
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
                <v-flex xs12 sm12 md12 style="padding-top: 1%;">
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Total Salary Details</h3>
                      <v-spacer></v-spacer>
                    </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.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.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">
8e8d14254   Shikha Mishra   Cleared data whil...
422
423
424
                          <b>
                            <v-text-field v-model="editedItem.netSalary" solo readonly></v-text-field>
                          </b>
7fea6db0b   Shikha Mishra   added feature of ...
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-flex>
                      </v-flex>
                    </v-layout>
                  </v-card>
                </v-flex>
              </v-layout>
            </v-container>
          </v-flex>
        </v-card>
      </v-dialog>
      <!-- ****** EXAM 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="addSalaryDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addSalaryDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Salary
        </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/search.png" alt="icon" />
            </v-avatar>
          </v-btn>
        </v-card-title>
612b79bb4   Amber Dev   made serch auto f...
463
        <v-flex xs8 sm8 md3 lg2 v-if="showSearch">
7fea6db0b   Shikha Mishra   added feature of ...
464
          <v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
465
466
467
468
469
470
471
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
7fea6db0b   Shikha Mishra   added feature of ...
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="salaryData"
        :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">{{ props.item.salaryGrades}}</td>
            <td class="td td-row text-xs-center">{{ props.item.basicSalary}}</td>
            <td class="td td-row text-xs-center">{{ props.item.overtimeRate}}</td>
            <td class="td td-row text-xs-center">
              <span>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px; "
                    class="mr-3"
                    @click="profile(props.item)"
                    src="/static/icon/view.png"
                  />
                  <span>View</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
                    src="/static/icon/edit.png"
                  />
                  <span>Edit</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    class="mr-3"
                    @click="deleteItem(props.item)"
                    src="/static/icon/delete.png"
                  />
                  <span>Delete</span>
                </v-tooltip>
              </span>
            </td>
          </tr>
        </template>
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
      </v-data-table>
  
      <!-- ****** ADD SALARY ****** -->
db965de89   Amber Dev   added dialog pers...
533
      <v-dialog v-model="addSalaryDialog" v-if="addSalaryDialog" persistent>
7fea6db0b   Shikha Mishra   added feature of ...
534
535
536
537
        <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">Add Salary</label>
8e8d14254   Shikha Mishra   Cleared data whil...
538
              <v-icon size="24" color="white" class="right" @click="closeAddSalaryModel">cancel</v-icon>
7fea6db0b   Shikha Mishra   added feature of ...
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
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
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
751
752
753
754
755
756
            </v-flex>
          </v-layout>
  
          <v-flex xs12 sm12>
            <v-container fluid grid-list-md>
              <v-layout wrap>
                <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Salary Template</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-form ref="form" v-model="valid" 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 :rules="salaryRules" v-model="salaryType.salaryGrades"></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
                              :rules="basicRules"
                              v-on:keyup="addSalary"
                              v-model="salaryType.basicSalary"
                            ></v-text-field>
                          </v-flex>
                        </v-flex>
                      </v-layout>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Overtime Rate (Per Hour) :</label>
                        </v-flex>
                        <v-flex xs8 sm7 class="ml-3">
                          <v-flex xs8 sm7 class="ml-3">
                            <v-text-field :rules="overtimeRules" v-model="salaryType.overtimeRate"></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 dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Allowances</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(salaryType,index) in salaryTypeData" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          solo
                          label="Enter Allowances Label"
                          v-model="salaryType.allowancesName"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          solo
                          v-model="salaryType.allowancesValue"
                          label="Enter Allowances Value"
                          v-on:keyup="addAllowances"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-btn
                          color="white"
                          round
                          class="right mt-3"
                          @click="deleteSelectAllowances(index)"
                          v-if="index != 0"
                        >
                          <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                        <v-btn color="white" round class="right mt-3" @click="selectAllowances">
                          <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                      </v-flex>
                    </v-layout>
                    <!-- <v-flex xs12 sm12 md6> -->
                    <v-card flat>
                      <v-toolbar dark class="card-styles" flat>
                        <v-spacer></v-spacer>
                        <h3>Deduction</h3>
                        <v-spacer></v-spacer>
                      </v-toolbar>
                      <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index">
                        <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-text-field
                            solo
                            label="Enter Deduction Label"
                            v-model="salaryType.deductionName"
                          ></v-text-field>
                        </v-flex>
                        <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-text-field
                            solo
                            label="Enter Deduction Value"
                            v-model="salaryType.deductionValue"
                            v-on:keyup="addDeduction"
                          ></v-text-field>
                        </v-flex>
                        <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                          <v-btn
                            color="white"
                            round
                            class="right mt-3"
                            @click="deleteSelectDeduction(index)"
                            v-if="index != 0"
                          >
                            <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                          </v-btn>
                          <v-btn color="white" round class="right mt-3" @click="selectDeduction">
                            <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                          </v-btn>
                        </v-flex>
                      </v-layout>
                    </v-card>
                    <!-- </v-flex> -->
                  </v-card>
                </v-flex>
                <!-- <v-flex xs12 sm12 md6>
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Deduction</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index">
                      <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          solo
                          label="Enter Deduction Label"
                          v-model="salaryType.deductionName"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-text-field
                          solo
                          label="Enter Deduction Value"
                          v-model="salaryType.deductionValue"
                          v-on:keyup="addDeduction"
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only">
                        <v-btn
                          color="white"
                          round
                          class="right mt-3"
                          @click="deleteSelectDeduction(index)"
                          v-if="index != 0"
                        >
                          <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                        <v-btn color="white" round class="right mt-3" @click="selectDeduction">
                          <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" />
                        </v-btn>
                      </v-flex>
                    </v-layout>
                  </v-card>
                </v-flex>-->
                <!-- <v-flex xs12 sm12 md4></v-flex> -->
                <v-flex xs12 sm12 md12 style="padding-top: 1%;">
                  <v-card flat>
                    <v-toolbar dark class="card-styles" flat>
                      <v-spacer></v-spacer>
                      <h3>Total Salary Details</h3>
                      <v-spacer></v-spacer>
                    </v-toolbar>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <v-text-field solo value="Gross Salary"></v-text-field>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-flex xs8 sm7 class="ml-3">
                          <v-text-field v-model="grossSalary" box readonly></v-text-field>
                        </v-flex>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <v-text-field solo value="Total Deduction"></v-text-field>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-flex xs8 sm7 class="ml-3">
                          <v-text-field v-model="totalDeduction" box readonly></v-text-field>
                        </v-flex>
                      </v-flex>
                    </v-layout>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <v-text-field solo value="Net Salary"></v-text-field>
                      </v-flex>
                      <v-flex xs8 sm7 class="ml-3">
                        <v-flex xs8 sm7 class="ml-3">
                          <v-text-field v-model="salaryType.netSalary" box readonly></v-text-field>
                        </v-flex>
                      </v-flex>
                    </v-layout>
                  </v-card>
                  <v-layout>
                    <v-flex xs12>
                      <v-card-actions>
                        <v-spacer class="hidden-xs-only"></v-spacer>
                        <v-btn
                          color="open-dialog-button"
                          dark
d10c26632   Shikha Mishra   Improve updateBoo...
757
                          class="right add-button"
7fea6db0b   Shikha Mishra   added feature of ...
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
                          @click="submit"
                        >Add Salary Template</v-btn>
                      </v-card-actions>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-flex>
        </v-card>
      </v-dialog>
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  
  export default {
    data: () => ({
      snackbar: false,
      date: null,
      color: "",
      y: "top",
      x: "right",
      mode: "",
      timeout: 10000,
      text: "",
      show: true,
      showSearch: false,
      addSalaryDialog: false,
      loading: false,
      loadingSearch: false,
      search: "",
      showLoader: false,
      editSalaryDialog: false,
      profileSalaryDialog: false,
      valid: true,
      disabled: true,
      showAllowances: false,
      showDeduction: false,
      pagination: {
8e8d14254   Shikha Mishra   Cleared data whil...
811
        rowsPerPage: 10,
7fea6db0b   Shikha Mishra   added feature of ...
812
813
814
815
816
817
      },
      salaryTypes: [],
      salaryTypeData: [
        {
          allowancesValue: "",
          allowancesName: "House Rent",
8e8d14254   Shikha Mishra   Cleared data whil...
818
819
          totalAllowances: 0,
        },
7fea6db0b   Shikha Mishra   added feature of ...
820
821
822
823
824
      ],
      salaryTypeDeductionData: [
        {
          deductionValue: "",
          deductionName: "Provident fund",
8e8d14254   Shikha Mishra   Cleared data whil...
825
826
          totalDeductions: 0,
        },
7fea6db0b   Shikha Mishra   added feature of ...
827
828
829
830
831
832
833
834
      ],
      grossSalary: 0,
      totalDeduction: 0,
      salaryType: {
        netSalary: 0,
        salaryGrades: "",
        allowancesValue: "",
        deductionValue: "",
8e8d14254   Shikha Mishra   Cleared data whil...
835
        overtimeRate: "",
7fea6db0b   Shikha Mishra   added feature of ...
836
      },
8e8d14254   Shikha Mishra   Cleared data whil...
837
838
839
      basicRules: [(v) => !!v || " Basic Salary is required"],
      salaryRules: [(v) => !!v || "Salary Grades is required"],
      overtimeRules: [(v) => !!v || "Overtime Rate is required"],
7fea6db0b   Shikha Mishra   added feature of ...
840
841
842
843
844
845
  
      headers: [
        {
          align: "",
          text: "No",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
846
          value: "No",
7fea6db0b   Shikha Mishra   added feature of ...
847
848
849
850
851
        },
        {
          text: "Salary Grades",
          value: "salaryGrades",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
852
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
853
854
855
856
857
        },
        {
          text: "Basic Salary",
          value: "basicSalary",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
858
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
859
860
861
862
863
        },
        {
          text: "Overtime Rate",
          value: "overtimeRate",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
864
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
865
        },
8e8d14254   Shikha Mishra   Cleared data whil...
866
        { text: "Action", value: "", sortable: false, align: "center" },
7fea6db0b   Shikha Mishra   added feature of ...
867
868
869
      ],
      salaryData: [],
      editedItem: {},
8e8d14254   Shikha Mishra   Cleared data whil...
870
      token: "",
7fea6db0b   Shikha Mishra   added feature of ...
871
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
    watch: {
      addSalaryDialog: function (val) {
        if (!val) {
          this.salaryType = [];
          this.grossSalary = 0;
          this.totalDeduction = 0;
          (this.salaryTypeData = [
            {
              allowancesValue: "",
              allowancesName: "",
              totalAllowances: 0,
            },
          ]),
            (this.salaryTypeDeductionData = [
              {
                deductionValue: "",
                deductionName: "",
                totalDeductions: 0,
              },
            ]);
        }
      },
    },
7fea6db0b   Shikha Mishra   added feature of ...
895
896
897
898
899
900
    methods: {
      getSalaryList() {
        this.showLoader = true;
        this.loadingSearch = true;
        http()
          .get("/getSalaryList", {
8e8d14254   Shikha Mishra   Cleared data whil...
901
            headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
902
          })
8e8d14254   Shikha Mishra   Cleared data whil...
903
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
904
905
906
907
            this.salaryData = response.data.data;
            this.showLoader = false;
            this.loadingSearch = false;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
908
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
            // 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.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;
      },
      profile(item) {
        this.editedIndex = this.salaryData.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.profileSalaryDialog = true;
      },
      deleteItem(item) {
        let Salary = {
8e8d14254   Shikha Mishra   Cleared data whil...
937
          salaryId: item._id,
7fea6db0b   Shikha Mishra   added feature of ...
938
939
940
941
942
        };
        http()
          .delete(
            "/deleteSalary",
            confirm("Are you sure you want to Delete this?") && {
8e8d14254   Shikha Mishra   Cleared data whil...
943
              params: Salary,
7fea6db0b   Shikha Mishra   added feature of ...
944
945
            },
            {
8e8d14254   Shikha Mishra   Cleared data whil...
946
              headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
947
948
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
949
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
950
951
952
953
954
955
            this.snackbar = true;
            this.text = "Successfully Delete Salary ";
            this.text = response.data.message;
            this.color = "green";
            this.getSalaryList();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
956
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
957
958
959
960
961
962
963
964
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
          });
      },
      close() {
        this.editSalaryDialog = false;
      },
8e8d14254   Shikha Mishra   Cleared data whil...
965
966
      closeAddSalaryModel() {
        this.addSalaryDialog = false;
01a4a5246   Shikha Mishra   When the modal wa...
967
        //   this.salaryData = [];
8e8d14254   Shikha Mishra   Cleared data whil...
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
        this.salaryType = [];
        this.grossSalary = 0;
        this.totalDeduction = 0;
        (this.salaryTypeData = [
          {
            allowancesValue: "",
            allowancesName: "",
            totalAllowances: 0,
          },
        ]),
          (this.salaryTypeDeductionData = [
            {
              deductionValue: "",
              deductionName: "",
              totalDeductions: 0,
            },
          ]);
      },
7fea6db0b   Shikha Mishra   added feature of ...
986
987
988
989
990
991
992
993
994
      submit() {
        var salary = {
          salaryGrades: this.salaryType.salaryGrades,
          basicSalary: this.salaryType.basicSalary,
          overtimeRate: this.salaryType.overtimeRate,
          allowances: this.salaryTypeData,
          deduction: this.salaryTypeDeductionData,
          grossSalary: this.grossSalary,
          totalDeduction: this.totalDeduction,
8e8d14254   Shikha Mishra   Cleared data whil...
995
          netSalary: this.salaryType.netSalary,
7fea6db0b   Shikha Mishra   added feature of ...
996
997
998
999
1000
1001
        };
        if (this.$refs.form.validate()) {
          this.loading = true;
          //   console.log("api data", this.salaryType);
          http()
            .post("/createSalary", salary)
8e8d14254   Shikha Mishra   Cleared data whil...
1002
            .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
              // console.log("response", response);
              this.snackbar = true;
              this.text = "Successfully Created Salary ";
              this.text = response.data.message;
              this.color = "green";
              this.addSalaryDialog = false;
              this.getSalaryList();
              this.color = "success";
              this.salaryTypeData = [];
              this.salaryTypeDeductionData = [];
              this.salaryType = "";
              this.grossSalary = "";
              this.totalDeduction = "";
              this.loading = false;
              this.clear();
            })
8e8d14254   Shikha Mishra   Cleared data whil...
1019
            .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
              console.log("error", error);
              this.snackbar = true;
              this.text = error.response.data.message;
              this.color = "red";
              this.loading = false;
            });
        }
      },
      selectAllowances() {
        this.salaryTypeData.push({
8e8d14254   Shikha Mishra   Cleared data whil...
1030
          allowancesValue: (this.salaryType.allowancesValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1031
1032
1033
        });
        //   console.log("this.salaryTypeData", this.salaryTypeData);
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1034
        this.salaryTypeData.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
          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({
8e8d14254   Shikha Mishra   Cleared data whil...
1046
          allowancesValue: (this.salaryType.allowancesValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1047
1048
        });
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1049
        this.editedItem.allowances.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1050
1051
1052
1053
1054
1055
1056
1057
          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);
8e8d14254   Shikha Mishra   Cleared data whil...
1058
          console.log("this.editedItem.grossSalary", this.editedItem.grossSalary);
7fea6db0b   Shikha Mishra   added feature of ...
1059
1060
1061
1062
        });
      },
      selectDeduction() {
        this.salaryTypeDeductionData.push({
8e8d14254   Shikha Mishra   Cleared data whil...
1063
          deductionValue: (this.salaryType.deductionValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1064
1065
        });
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1066
        this.salaryTypeDeductionData.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1067
1068
1069
1070
1071
1072
1073
1074
1075
          if (deductionValue_.deductionValue != "") {
            //   console.log("deduction", deductionValue_.deductionValue);
            totalDeductions =
              Number(totalDeductions) + Number(deductionValue_.deductionValue);
          }
        });
      },
      deductionAdd() {
        this.editedItem.deduction.push({
8e8d14254   Shikha Mishra   Cleared data whil...
1076
          deductionValue: (this.salaryType.deductionValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1077
1078
        });
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1079
        this.editedItem.deduction.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
          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);
        });
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1090
      deleteSelectAllowances: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1091
1092
        this.salaryTypeData.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1093
      deleteallowancesAdd: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1094
1095
        this.editedItem.allowances.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1096
      deleteSelectDeduction: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1097
1098
        this.salaryTypeDeductionData.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1099
      deletedeductionAdd: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
        this.editedItem.deduction.splice(index, 1);
      },
      clear() {
        this.$refs.form.reset();
        this.disable = false;
      },
      save() {
        var updateSalary = {
          salaryId: this.editedItem._id,
          salaryGrades: this.editedItem.salaryGrades,
          basicSalary: this.editedItem.basicSalary,
          overtimeRate: this.editedItem.overtimeRate,
          allowances: this.salaryTypeData,
          deduction: this.salaryTypeDeductionData,
          grossSalary: this.editedItem.grossSalary,
          totalDeduction: this.editedItem.totalDeduction,
8e8d14254   Shikha Mishra   Cleared data whil...
1116
          netSalary: this.editedItem.netSalary,
7fea6db0b   Shikha Mishra   added feature of ...
1117
1118
1119
        };
        http()
          .put("/updateSalary", updateSalary)
8e8d14254   Shikha Mishra   Cleared data whil...
1120
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
1121
1122
1123
1124
1125
1126
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.getSalaryList();
            this.close();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
1127
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
          });
      },
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1141
      addSalary: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1142
1143
1144
1145
        var showSalary = this.salaryType.basicSalary;
        this.grossSalary = showSalary;
        //   console.log("salary", this.grossSalary);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1146
      addAllowances: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1147
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1148
        this.salaryTypeData.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
          if (allowancesValue_.allowancesValue != "") {
            totalAllowances =
              Number(totalAllowances) + Number(allowancesValue_.allowancesValue);
          }
          this.grossSalary =
            totalAllowances +
            Number(this.salaryType.basicSalary) +
            Number(this.salaryType.allowancesValue);
        });
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1159
      addAllowancesValue: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1160
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1161
        this.editedItem.allowances.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
          if (allowancesValue_.allowancesValue != "") {
            totalAllowances =
              Number(totalAllowances) + Number(allowancesValue_.allowancesValue);
          }
          this.grossSalary =
            totalAllowances +
            Number(this.editedItem.basicSalary) +
            Number(this.editedItem.allowancesValue);
        });
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1172
      addDeduction: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1173
1174
1175
1176
1177
        //   console.log(
        //     "this.salaryType.deductionValue",
        //     this.salaryType.deductionValue
        //   );
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1178
        this.salaryTypeDeductionData.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1179
1180
1181
1182
1183
1184
1185
1186
1187
          if (deductionValue_.deductionValue != "") {
            totalDeductions =
              Number(totalDeductions) + Number(deductionValue_.deductionValue);
          }
        });
        //   console.log("deduction", totalDeductions);
        this.totalDeduction = totalDeductions;
        this.salaryType.netSalary = this.grossSalary - this.totalDeduction;
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1188
      addDeductionValue: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1189
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1190
        this.editedItem.deduction.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
          if (deductionValue_.deductionValue != "") {
            totalDeductions =
              Number(totalDeductions) + Number(deductionValue_.deductionValue);
          }
          // this.totalDeduction = totalDeductions;
          // console.log("this.totalDeductions", this.totalDeduction);
        });
        this.editedItem.totalDeduction = totalDeductions;
        this.editedItem.netSalary =
          this.editedItem.grossSalary - this.editedItem.totalDeduction;
8e8d14254   Shikha Mishra   Cleared data whil...
1201
      },
7fea6db0b   Shikha Mishra   added feature of ...
1202
1203
1204
1205
1206
    },
  
    mounted() {
      this.token = this.$store.state.token;
      this.getSalaryList();
8e8d14254   Shikha Mishra   Cleared data whil...
1207
    },
7fea6db0b   Shikha Mishra   added feature of ...
1208
1209
1210
1211
1212
  };
  </script>
  
  <style scoped>
  </style>