Commit 7bb043c068b5e70767dcb75948e8b526c55d1981

Authored by Shikha Mishra
1 parent 7151b71ec9

set validation in roles

src/pages/Payroll/manageSalary.vue
... ... @@ -211,7 +211,10 @@
211 211 <v-toolbar>
212 212 <h3>Allowances</h3>
213 213 </v-toolbar>
214   - <v-layout v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.allowances" :key="index">
  214 + <v-layout
  215 + v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.allowances"
  216 + :key="index"
  217 + >
215 218 <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
216 219 <v-text-field
217 220 readonly
... ... @@ -236,7 +239,10 @@
236 239 <v-toolbar>
237 240 <h3>Deduction</h3>
238 241 </v-toolbar>
239   - <v-layout v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.deduction" :key="index">
  242 + <v-layout
  243 + v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.deduction"
  244 + :key="index"
  245 + >
240 246 <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only">
241 247 <v-text-field
242 248 readonly
... ... @@ -269,7 +275,7 @@
269 275 ></v-text-field>
270 276 </v-flex>
271 277 </v-flex>
272   - </v-layout> -->
  278 + </v-layout>-->
273 279 </v-card>
274 280 </v-flex>
275 281 <v-flex xs12 sm12 md12 style="padding-top: 1%;">
... ... @@ -529,12 +535,8 @@ export default {
529 535  
530 536 editedItem: {
531 537 salaryTemplate: {
532   - allowances: {
533   -
534   - },
535   - deduction: {
536   -
537   - }
  538 + allowances: {},
  539 + deduction: {}
538 540 },
539 541 hourlyTemplate: {}
540 542 },
... ... @@ -576,7 +578,7 @@ export default {
576 578 },
577 579 { text: "Action", value: "", sortable: false, align: "center" }
578 580 ],
579   - desserts: [],
  581 + desserts: []
580 582 }),
581 583  
582 584 methods: {
... ... @@ -596,12 +598,12 @@ export default {
596 598 this.editedItem = Object.assign({}, item);
597 599 this.profileSalaryDialog = true;
598 600 // console.log("item", item);
599   - if(item.salaryTemplate) {
  601 + if (item.salaryTemplate) {
600 602 this.viewSalary = true;
601   - this.viewHourly = false
  603 + this.viewHourly = false;
602 604 } else {
603 605 this.viewHourly = true;
604   - this.viewSalary = false
  606 + this.viewSalary = false;
605 607 }
606 608 },
607 609 getRole() {
... ... @@ -613,10 +615,16 @@ export default {
613 615 })
614 616 .then(response => {
615 617 this.getRoles = response.data.data;
616   - if (this.getRoles[2].role !== 3) {
617   - this.getRoles = response.data.data;
618   - console.log("roles", this.getRoles[2].role);
619   - }
  618 + // if (this.getRoles[2].role !== 3) {
  619 + // this.getRoles = response.data.data;
  620 + // console.log("roles", this.getRoles[2].role);
  621 + // }
  622 + this.getRoles = response.data.data;
  623 + var removedRoles = _.remove(this.getRoles, function(c) {
  624 + //remove if color is green or yellow
  625 + return c.role === 1 || c.role === 4 || c.role === 5;
  626 + // console.log(c);
  627 + });
620 628 this.showLoader = false;
621 629 })
622 630 .catch(error => {
... ...
src/pages/User/user.vue
... ... @@ -1092,6 +1092,12 @@ export default {
1092 1092 .then(response => {
1093 1093 this.userRole = response.data.data;
1094 1094 this.showLoader = false;
  1095 + this.userRole = response.data.data;
  1096 + var removedRoles = _.remove(this.userRole, function(c) {
  1097 + //remove if color is green or yellow
  1098 + return c.role === 1 || c.role === 3 || c.role === 4 || c.role === 5;
  1099 + // console.log(c);
  1100 + });
1095 1101 })
1096 1102 .catch(error => {
1097 1103 this.showLoader = false;
... ...