Blame view

src/pages/Payroll/salaryTemplate.vue 46.3 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>
4dd422bef   Shikha Mishra   change ui of card...
5
        <v-card flat class="text-xs-center">
7fea6db0b   Shikha Mishra   added feature of ...
6
          <v-layout>
4dd422bef   Shikha Mishra   change ui of card...
7
            <v-flex xs12 class="Card-style pa-2">
7fea6db0b   Shikha Mishra   added feature of ...
8
              <label class="title text-xs-center">Edit Salary</label>
4dd422bef   Shikha Mishra   change ui of card...
9
              <v-icon size="24" class="right" @click="editSalaryDialog = false">cancel</v-icon>
7fea6db0b   Shikha Mishra   added feature of ...
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
            </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
4dd422bef   Shikha Mishra   change ui of card...
222
                          round
7fea6db0b   Shikha Mishra   added feature of ...
223
                          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>
4dd422bef   Shikha Mishra   change ui of card...
239
        <v-card flat class="text-xs-center">
7fea6db0b   Shikha Mishra   added feature of ...
240
          <v-layout>
4dd422bef   Shikha Mishra   change ui of card...
241
            <v-flex xs12 class="Card-style pa-2">
7fea6db0b   Shikha Mishra   added feature of ...
242
              <label class="title text-xs-center">View Salary</label>
4dd422bef   Shikha Mishra   change ui of card...
243
              <v-icon size="24" class="right" @click="profileSalaryDialog = false">cancel</v-icon>
7fea6db0b   Shikha Mishra   added feature of ...
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
            </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
315
                          readonly
7fea6db0b   Shikha Mishra   added feature of ...
316
317
318
319
320
321
322
                          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
323
                          readonly
7fea6db0b   Shikha Mishra   added feature of ...
324
325
326
327
328
329
                          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...
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
                    <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 ...
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
                    <!-- </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
383
                <v-flex xs12 sm12 md4></v-flex>
7fea6db0b   Shikha Mishra   added feature of ...
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
                <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...
417
418
419
                          <b>
                            <v-text-field v-model="editedItem.netSalary" solo readonly></v-text-field>
                          </b>
7fea6db0b   Shikha Mishra   added feature of ...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
                        </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...
458
        <v-flex xs8 sm8 md3 lg2 v-if="showSearch">
7fea6db0b   Shikha Mishra   added feature of ...
459
          <v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
460
461
462
463
464
465
466
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
7fea6db0b   Shikha Mishra   added feature of ...
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
            <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...
528
      <v-dialog v-model="addSalaryDialog" v-if="addSalaryDialog" persistent>
4dd422bef   Shikha Mishra   change ui of card...
529
        <v-card flat class="text-xs-center">
7fea6db0b   Shikha Mishra   added feature of ...
530
          <v-layout>
4dd422bef   Shikha Mishra   change ui of card...
531
            <v-flex xs12 class="Card-style pa-2">
7fea6db0b   Shikha Mishra   added feature of ...
532
              <label class="title text-xs-center">Add Salary</label>
4dd422bef   Shikha Mishra   change ui of card...
533
              <v-icon size="24" class="right" @click="closeAddSalaryModel">cancel</v-icon>
7fea6db0b   Shikha Mishra   added feature of ...
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
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
            </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"
4dd422bef   Shikha Mishra   change ui of card...
751
                          round
7fea6db0b   Shikha Mishra   added feature of ...
752
                          dark
d10c26632   Shikha Mishra   Improve updateBoo...
753
                          class="right add-button"
7fea6db0b   Shikha Mishra   added feature of ...
754
755
756
757
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
                          @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...
807
        rowsPerPage: 10,
7fea6db0b   Shikha Mishra   added feature of ...
808
809
810
811
812
813
      },
      salaryTypes: [],
      salaryTypeData: [
        {
          allowancesValue: "",
          allowancesName: "House Rent",
8e8d14254   Shikha Mishra   Cleared data whil...
814
815
          totalAllowances: 0,
        },
7fea6db0b   Shikha Mishra   added feature of ...
816
817
818
819
820
      ],
      salaryTypeDeductionData: [
        {
          deductionValue: "",
          deductionName: "Provident fund",
8e8d14254   Shikha Mishra   Cleared data whil...
821
822
          totalDeductions: 0,
        },
7fea6db0b   Shikha Mishra   added feature of ...
823
824
825
826
827
828
829
830
      ],
      grossSalary: 0,
      totalDeduction: 0,
      salaryType: {
        netSalary: 0,
        salaryGrades: "",
        allowancesValue: "",
        deductionValue: "",
8e8d14254   Shikha Mishra   Cleared data whil...
831
        overtimeRate: "",
7fea6db0b   Shikha Mishra   added feature of ...
832
      },
8e8d14254   Shikha Mishra   Cleared data whil...
833
834
835
      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 ...
836
837
838
839
840
841
  
      headers: [
        {
          align: "",
          text: "No",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
842
          value: "No",
7fea6db0b   Shikha Mishra   added feature of ...
843
844
845
846
847
        },
        {
          text: "Salary Grades",
          value: "salaryGrades",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
848
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
849
850
851
852
853
        },
        {
          text: "Basic Salary",
          value: "basicSalary",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
854
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
855
856
857
858
859
        },
        {
          text: "Overtime Rate",
          value: "overtimeRate",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
860
          align: "center",
7fea6db0b   Shikha Mishra   added feature of ...
861
        },
8e8d14254   Shikha Mishra   Cleared data whil...
862
        { text: "Action", value: "", sortable: false, align: "center" },
7fea6db0b   Shikha Mishra   added feature of ...
863
864
865
      ],
      salaryData: [],
      editedItem: {},
8e8d14254   Shikha Mishra   Cleared data whil...
866
      token: "",
7fea6db0b   Shikha Mishra   added feature of ...
867
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
    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 ...
891
892
893
894
895
896
    methods: {
      getSalaryList() {
        this.showLoader = true;
        this.loadingSearch = true;
        http()
          .get("/getSalaryList", {
8e8d14254   Shikha Mishra   Cleared data whil...
897
            headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
898
          })
8e8d14254   Shikha Mishra   Cleared data whil...
899
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
900
901
902
903
            this.salaryData = response.data.data;
            this.showLoader = false;
            this.loadingSearch = false;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
904
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
            // 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...
933
          salaryId: item._id,
7fea6db0b   Shikha Mishra   added feature of ...
934
935
936
937
938
        };
        http()
          .delete(
            "/deleteSalary",
            confirm("Are you sure you want to Delete this?") && {
8e8d14254   Shikha Mishra   Cleared data whil...
939
              params: Salary,
7fea6db0b   Shikha Mishra   added feature of ...
940
941
            },
            {
8e8d14254   Shikha Mishra   Cleared data whil...
942
              headers: { Authorization: "Bearer " + this.token },
7fea6db0b   Shikha Mishra   added feature of ...
943
944
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
945
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
946
947
948
949
950
951
            this.snackbar = true;
            this.text = "Successfully Delete Salary ";
            this.text = response.data.message;
            this.color = "green";
            this.getSalaryList();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
952
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
953
954
955
956
957
958
959
960
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
          });
      },
      close() {
        this.editSalaryDialog = false;
      },
8e8d14254   Shikha Mishra   Cleared data whil...
961
962
      closeAddSalaryModel() {
        this.addSalaryDialog = false;
01a4a5246   Shikha Mishra   When the modal wa...
963
        //   this.salaryData = [];
8e8d14254   Shikha Mishra   Cleared data whil...
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
        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 ...
982
983
984
985
986
987
988
989
990
      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...
991
          netSalary: this.salaryType.netSalary,
7fea6db0b   Shikha Mishra   added feature of ...
992
993
994
995
996
997
        };
        if (this.$refs.form.validate()) {
          this.loading = true;
          //   console.log("api data", this.salaryType);
          http()
            .post("/createSalary", salary)
8e8d14254   Shikha Mishra   Cleared data whil...
998
            .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
              // 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...
1015
            .catch((error) => {
860da881d   Shikha Mishra   comment all consoles
1016
              // console.log("error", error);
7fea6db0b   Shikha Mishra   added feature of ...
1017
1018
1019
1020
1021
1022
1023
1024
1025
              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...
1026
          allowancesValue: (this.salaryType.allowancesValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1027
1028
1029
        });
        //   console.log("this.salaryTypeData", this.salaryTypeData);
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1030
        this.salaryTypeData.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
          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...
1042
          allowancesValue: (this.salaryType.allowancesValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1043
1044
        });
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1045
        this.editedItem.allowances.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1046
1047
1048
1049
          if (allowancesValue_.allowancesValue != "") {
            //   console.log("allowances", allowancesValue_.allowancesValue);
            totalAllowances =
              Number(totalAllowances) + Number(allowancesValue_.allowancesValue);
860da881d   Shikha Mishra   comment all consoles
1050
            //   console.log("totalAllowances", totalAllowances);
7fea6db0b   Shikha Mishra   added feature of ...
1051
1052
1053
          }
          this.editedItem.grossSalary =
            totalAllowances + Number(this.editedItem.basicSalary);
860da881d   Shikha Mishra   comment all consoles
1054
          // console.log("this.editedItem.grossSalary", this.editedItem.grossSalary);
7fea6db0b   Shikha Mishra   added feature of ...
1055
1056
1057
1058
        });
      },
      selectDeduction() {
        this.salaryTypeDeductionData.push({
8e8d14254   Shikha Mishra   Cleared data whil...
1059
          deductionValue: (this.salaryType.deductionValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1060
1061
        });
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1062
        this.salaryTypeDeductionData.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1063
1064
1065
1066
1067
1068
1069
1070
1071
          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...
1072
          deductionValue: (this.salaryType.deductionValue = ""),
7fea6db0b   Shikha Mishra   added feature of ...
1073
1074
        });
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1075
        this.editedItem.deduction.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1076
1077
1078
1079
          if (deductionValue_.deductionValue != "") {
            //   console.log("deduction", deductionValue_.deductionValue);
            totalDeductions =
              Number(totalDeductions) + Number(deductionValue_.deductionValue);
860da881d   Shikha Mishra   comment all consoles
1080
            //   console.log("this.totalDeductions", totalDeductions);
7fea6db0b   Shikha Mishra   added feature of ...
1081
1082
1083
1084
1085
          }
          // this.editedItem.totalDeduction = totalDeductions;
          // console.log("this.totalDeduction", this.editedItem.totalDeduction);
        });
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1086
      deleteSelectAllowances: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1087
1088
        this.salaryTypeData.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1089
      deleteallowancesAdd: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1090
1091
        this.editedItem.allowances.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1092
      deleteSelectDeduction: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1093
1094
        this.salaryTypeDeductionData.splice(index, 1);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1095
      deletedeductionAdd: function (index) {
7fea6db0b   Shikha Mishra   added feature of ...
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
        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...
1112
          netSalary: this.editedItem.netSalary,
7fea6db0b   Shikha Mishra   added feature of ...
1113
1114
1115
        };
        http()
          .put("/updateSalary", updateSalary)
8e8d14254   Shikha Mishra   Cleared data whil...
1116
          .then((response) => {
7fea6db0b   Shikha Mishra   added feature of ...
1117
1118
1119
1120
1121
1122
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.getSalaryList();
            this.close();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
1123
          .catch((error) => {
7fea6db0b   Shikha Mishra   added feature of ...
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
            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...
1137
      addSalary: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1138
1139
1140
1141
        var showSalary = this.salaryType.basicSalary;
        this.grossSalary = showSalary;
        //   console.log("salary", this.grossSalary);
      },
8e8d14254   Shikha Mishra   Cleared data whil...
1142
      addAllowances: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1143
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1144
        this.salaryTypeData.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
          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...
1155
      addAllowancesValue: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1156
        var totalAllowances = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1157
        this.editedItem.allowances.forEach((allowancesValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
          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...
1168
      addDeduction: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1169
1170
1171
1172
1173
        //   console.log(
        //     "this.salaryType.deductionValue",
        //     this.salaryType.deductionValue
        //   );
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1174
        this.salaryTypeDeductionData.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1175
1176
1177
1178
1179
1180
1181
1182
1183
          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...
1184
      addDeductionValue: function () {
7fea6db0b   Shikha Mishra   added feature of ...
1185
        var totalDeductions = "";
8e8d14254   Shikha Mishra   Cleared data whil...
1186
        this.editedItem.deduction.forEach((deductionValue_) => {
7fea6db0b   Shikha Mishra   added feature of ...
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
          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...
1197
      },
7fea6db0b   Shikha Mishra   added feature of ...
1198
1199
1200
1201
1202
    },
  
    mounted() {
      this.token = this.$store.state.token;
      this.getSalaryList();
8e8d14254   Shikha Mishra   Cleared data whil...
1203
    },
7fea6db0b   Shikha Mishra   added feature of ...
1204
1205
1206
1207
1208
  };
  </script>
  
  <style scoped>
  </style>