Commit 4ecd35af274c10198dfc04f4bda26da741435245
1 parent
4dfee99647
Exists in
master
and in
2 other branches
Resolve console error in manage salary screen
Showing
2 changed files
with
101 additions
and
106 deletions
Show diff stats
src/Services/http.js
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | import store from '@/store/store' | 2 | import store from '@/store/store' |
3 | import Vue from 'vue' | 3 | import Vue from 'vue' |
4 | import { vm1 } from "@/main.js" | 4 | import { vm1 } from "@/main.js" |
5 | 5 | ||
6 | const baseDomain = "https://api-dashboard.intrack.in/v1"; | 6 | const baseDomain = "https://api-dashboard.intrack.in/v1"; |
7 | 7 | ||
8 | const baseURL = `${baseDomain}`; | 8 | const baseURL = `${baseDomain}`; |
9 | // var token = "" | 9 | // var token = "" |
10 | // if (store.state.role === "ADMIN") { | 10 | // if (store.state.role === "ADMIN") { |
11 | // token = `${store.state.token}` | 11 | // token = `${store.state.token}` |
12 | // } else if (store.state.schoolRole === "SUPERADMIN") { | 12 | // } else if (store.state.schoolRole === "SUPERADMIN") { |
13 | // token = `${store.state.schoolToken}` | 13 | // token = `${store.state.schoolToken}` |
14 | // } | 14 | // } |
15 | 15 | ||
16 | // console.log("role",`${store.state.schoolRole}`); | 16 | // console.log("role",`${store.state.schoolRole}`); |
17 | // console.log("token",`${store.state.schoolToken}`); | 17 | // console.log("token",`${store.state.schoolToken}`); |
18 | 18 | ||
19 | export default () => { | 19 | export default () => { |
20 | // return axios.create({ | 20 | // return axios.create({ |
21 | // // baseURL: 'http://192.168.2.221:3002/v1', | 21 | // // baseURL: 'http://192.168.2.221:3002/v1', |
22 | // baseURL, | 22 | // baseURL, |
23 | // headers: { | 23 | // headers: { |
24 | // Authorization: `Bearer ${store.state.token}` | 24 | // Authorization: `Bearer ${store.state.token}` |
25 | // } | 25 | // } |
26 | // }) | 26 | // }) |
27 | let instance = axios.create({ | 27 | let instance = axios.create({ |
28 | // LIVE | 28 | // LIVE |
29 | //baseURL: 'https://annadata.patanjaliayurved.org/api', | 29 | //baseURL: 'https://annadata.patanjaliayurved.org/api', |
30 | // DEVELOPMENT | 30 | // DEVELOPMENT |
31 | baseURL: baseURL, | 31 | baseURL: baseURL, |
32 | 32 | ||
33 | headers: { | 33 | headers: { |
34 | Authorization: `Bearer ${store.state.token}`, | 34 | Authorization: `Bearer ${store.state.token}`, |
35 | // Authorization: `Bearer sdfsdfsfsdf`, | 35 | // Authorization: `Bearer sdfsdfsfsdf`, |
36 | // 'Access-Control-Allow-Origin': '*' | 36 | // 'Access-Control-Allow-Origin': '*' |
37 | 37 | ||
38 | } | 38 | } |
39 | }) | 39 | }) |
40 | 40 | ||
41 | instance.interceptors.request.use((config) => { | 41 | instance.interceptors.request.use((config) => { |
42 | // Do something before request is sent | 42 | // Do something before request is sent |
43 | 43 | ||
44 | return config | 44 | return config |
45 | }, error => { | 45 | }, error => { |
46 | return Promise.reject(error) | 46 | return Promise.reject(error) |
47 | }) | 47 | }) |
48 | instance.interceptors.response.use((response) => { | 48 | instance.interceptors.response.use((response) => { |
49 | // do something with the response data | 49 | // do something with the response data |
50 | return response; | ||
51 | }, error => { | ||
52 | // handle the response error | ||
53 | console.log("error in interceptor - ", error.response.status) | ||
54 | var customError | ||
55 | const errorNo = error.response.status | ||
50 | 56 | ||
57 | switch (errorNo) { | ||
58 | case 401: | ||
59 | customError = "Session expired" | ||
60 | vm1.$store.dispatch("RESET_STORE", { | ||
61 | token: null, | ||
62 | data: null, | ||
63 | isUserLoggedIn: false, | ||
64 | isSchoolLoggedIn: false, | ||
65 | id: null, | ||
66 | role: null, | ||
67 | // schoolId: null, | ||
68 | schoolToken: null, | ||
69 | schoolRole: null, | ||
70 | studentsData: [], | ||
71 | }); | ||
72 | window.getApp.$emit("APP_LOGOUT"); | ||
73 | console.log("store is - ", vm1.$store.state) | ||
74 | vm1.$router.push({ name: "Login" }); | ||
75 | // vm1.$store.dispatch("Id", null); | ||
51 | 76 | ||
52 | return response; | 77 | break; |
53 | }, error => { | 78 | } |
54 | // handle the response error | ||
55 | console.log("error in interceptor - ", error.response.status) | ||
56 | var customError | ||
57 | const errorNo = error.response.status | ||
58 | 79 | ||
59 | switch (errorNo) { | 80 | return Promise.reject(error); |
60 | case 401: | 81 | }) |
61 | customError = "Session expired" | 82 | // response parse |
62 | vm1.$store.dispatch("RESET_STORE", { |
src/pages/Payroll/manageSalary.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <v-layout wrap> | 3 | <v-layout wrap> |
4 | <v-flex xs12 sm6> | 4 | <v-flex xs12 sm6> |
5 | <v-layout> | 5 | <v-layout> |
6 | <v-flex xs4 class="pt-4 subheading"> | 6 | <v-flex xs4 class="pt-4 subheading"> |
7 | <label class="right hidden-sm-only hidden-xs-only">Role:</label> | 7 | <label class="right hidden-sm-only hidden-xs-only">Role:</label> |
8 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> | 8 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> |
9 | </v-flex> | 9 | </v-flex> |
10 | <v-flex xs8 class="ml-3"> | 10 | <v-flex xs8 class="ml-3"> |
11 | <v-autocomplete | 11 | <v-autocomplete |
12 | v-model="getReport.role" | 12 | v-model="getReport.role" |
13 | :rules="role" | 13 | :rules="role" |
14 | :items="getRoles" | 14 | :items="getRoles" |
15 | item-text="name" | 15 | item-text="name" |
16 | item-value="role" | 16 | item-value="role" |
17 | placeholder="Select Role" | 17 | placeholder="Select Role" |
18 | @change="getUserDetailWithRoles" | 18 | @change="getUserDetailWithRoles" |
19 | required | 19 | required |
20 | ></v-autocomplete> | 20 | ></v-autocomplete> |
21 | </v-flex> | 21 | </v-flex> |
22 | </v-layout> | 22 | </v-layout> |
23 | </v-flex> | 23 | </v-flex> |
24 | </v-layout> | 24 | </v-layout> |
25 | 25 | ||
26 | <!-- *** Salary Data *** --> | 26 | <!-- *** Salary Data *** --> |
27 | <v-data-table | 27 | <v-data-table |
28 | :headers="headers" | 28 | :headers="headers" |
29 | :items="roleList" | 29 | :items="roleList" |
30 | :pagination.sync="pagination" | 30 | :pagination.sync="pagination" |
31 | :search="search" | 31 | :search="search" |
32 | > | 32 | > |
33 | <template slot="items" slot-scope="props"> | 33 | <template slot="items" slot-scope="props"> |
34 | <tr class="tr"> | 34 | <tr class="tr"> |
35 | <td class="td td-row">{{ props.index + 1}}</td> | 35 | <td class="td td-row">{{ props.index + 1}}</td> |
36 | <td class="td td-row text-xs-center"> | 36 | <td class="td td-row text-xs-center"> |
37 | <v-avatar size="40"> | 37 | <v-avatar size="40"> |
38 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 38 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
39 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 39 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
40 | </v-avatar> | 40 | </v-avatar> |
41 | </td> | 41 | </td> |
42 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 42 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
43 | <td class="td td-row text-xs-center">{{ dates(props.item.joinDate)}}</td> | 43 | <td class="td td-row text-xs-center">{{ dates(props.item.joinDate)}}</td> |
44 | <td class="text-xs-center td td-row"> | 44 | <td class="text-xs-center td td-row"> |
45 | <span> | 45 | <span> |
46 | <v-tooltip top> | 46 | <v-tooltip top> |
47 | <img | 47 | <img |
48 | slot="activator" | 48 | slot="activator" |
49 | style="cursor:pointer; width:25px; height:25px; " | 49 | style="cursor:pointer; width:25px; height:25px; " |
50 | class="mr-3" | 50 | class="mr-3" |
51 | @click="profile(props.item)" | 51 | @click="profile(props.item)" |
52 | src="/static/icon/view.png" | 52 | src="/static/icon/view.png" |
53 | /> | 53 | /> |
54 | <span>View</span> | 54 | <span>View</span> |
55 | </v-tooltip> | 55 | </v-tooltip> |
56 | <v-tooltip top> | 56 | <v-tooltip top> |
57 | <img | 57 | <img |
58 | slot="activator" | 58 | slot="activator" |
59 | style="cursor:pointer; width:20px; height:18px; " | 59 | style="cursor:pointer; width:20px; height:18px; " |
60 | class="mr-3" | 60 | class="mr-3" |
61 | @click="editItem(props.item)" | 61 | @click="editItem(props.item)" |
62 | src="/static/icon/edit.png" | 62 | src="/static/icon/edit.png" |
63 | /> | 63 | /> |
64 | <span>Edit</span> | 64 | <span>Edit</span> |
65 | </v-tooltip> | 65 | </v-tooltip> |
66 | <v-tooltip top> | 66 | <v-tooltip top> |
67 | <img | 67 | <img |
68 | slot="activator" | 68 | slot="activator" |
69 | style="cursor:pointer; width:20px; height:20px; " | 69 | style="cursor:pointer; width:20px; height:20px; " |
70 | @click="deleteItem(props.item)" | 70 | @click="deleteItem(props.item)" |
71 | src="/static/icon/delete.png" | 71 | src="/static/icon/delete.png" |
72 | class="mr-3" | 72 | class="mr-3" |
73 | /> | 73 | /> |
74 | <span>Delete</span> | 74 | <span>Delete</span> |
75 | </v-tooltip> | 75 | </v-tooltip> |
76 | </span> | 76 | </span> |
77 | </td> | 77 | </td> |
78 | </tr> | 78 | </tr> |
79 | </template> | 79 | </template> |
80 | <v-alert | 80 | <v-alert |
81 | slot="no-results" | 81 | slot="no-results" |
82 | :value="true" | 82 | :value="true" |
83 | color="error" | 83 | color="error" |
84 | icon="warning" | 84 | icon="warning" |
85 | >Your search for "{{ search }}" found no results.</v-alert> | 85 | >Your search for "{{ search }}" found no results.</v-alert> |
86 | </v-data-table> | 86 | </v-data-table> |
87 | 87 | ||
88 | <!-- ****** PROFILE VIEW ****** --> | 88 | <!-- ****** PROFILE VIEW ****** --> |
89 | 89 | ||
90 | <v-dialog v-model="profileSalaryDialog" persistent> | 90 | <v-dialog v-model="profileSalaryDialog" persistent> |
91 | <v-card flat class="text-xs-center white--text"> | 91 | <v-card flat class="text-xs-center white--text"> |
92 | <v-layout> | 92 | <v-layout> |
93 | <v-flex xs12 class="card-style pa-2"> | 93 | <v-flex xs12 class="card-style pa-2"> |
94 | <label class="title text-xs-center">View Manage Salary</label> | 94 | <label class="title text-xs-center">View Manage Salary</label> |
95 | <v-icon | 95 | <v-icon |
96 | size="24" | 96 | size="24" |
97 | color="white" | 97 | color="white" |
98 | class="right" | 98 | class="right" |
99 | @click="profileSalaryDialog = false" | 99 | @click="profileSalaryDialog = false" |
100 | >cancel</v-icon> | 100 | >cancel</v-icon> |
101 | </v-flex> | 101 | </v-flex> |
102 | </v-layout> | 102 | </v-layout> |
103 | <v-layout wrap> | 103 | <v-layout wrap> |
104 | <v-flex xs12 sm12 md4> | 104 | <v-flex xs12 sm12 md4> |
105 | <v-card flat> | 105 | <v-card flat> |
106 | <h3 class="py-2 text-xs-center card-style white--text">Profile</h3> | 106 | <h3 class="py-2 text-xs-center card-style white--text">Profile</h3> |
107 | <v-card-text> | 107 | <v-card-text> |
108 | <v-container> | 108 | <v-container> |
109 | <v-layout wrap> | 109 | <v-layout wrap> |
110 | <v-flex xs12> | 110 | <v-flex xs12> |
111 | <v-layout> | 111 | <v-layout> |
112 | <v-flex | 112 | <v-flex |
113 | xs12 | 113 | xs12 |
114 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 114 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
115 | > | 115 | > |
116 | <v-avatar size="80px"> | 116 | <v-avatar size="80px"> |
117 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 117 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
118 | <img | 118 | <img |
119 | :src="editedItem.profilePicUrl" | 119 | :src="editedItem.profilePicUrl" |
120 | v-else-if="editedItem.profilePicUrl" | 120 | v-else-if="editedItem.profilePicUrl" |
121 | /> | 121 | /> |
122 | </v-avatar> | 122 | </v-avatar> |
123 | </v-flex> | 123 | </v-flex> |
124 | </v-layout> | 124 | </v-layout> |
125 | <v-layout> | 125 | <v-layout> |
126 | <v-flex xs12 sm12> | 126 | <v-flex xs12 sm12> |
127 | <h3 class="text-xs-center"> | 127 | <h3 class="text-xs-center"> |
128 | <b>{{ editedItem.name }}</b> | 128 | <b>{{ editedItem.name }}</b> |
129 | </h3> | 129 | </h3> |
130 | <p class="text-xs-center grey--text">{{ editedItem.roleName }}</p> | 130 | <p class="text-xs-center grey--text">{{ editedItem.roleName }}</p> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | <v-layout style="border: 1px solid lightgrey;"> | 133 | <v-layout style="border: 1px solid lightgrey;"> |
134 | <v-flex xs6 sm6 class="pa-0"> | 134 | <v-flex xs6 sm6 class="pa-0"> |
135 | <h4 class="right"> | 135 | <h4 class="right"> |
136 | <b>Join Date :</b> | 136 | <b>Join Date :</b> |
137 | </h4> | 137 | </h4> |
138 | </v-flex> | 138 | </v-flex> |
139 | <v-flex sm6 xs6 class="pa-0"> | 139 | <v-flex sm6 xs6 class="pa-0"> |
140 | <h4>{{ editedItem.joinDate }}</h4> | 140 | <h4>{{ editedItem.joinDate }}</h4> |
141 | </v-flex> | 141 | </v-flex> |
142 | </v-layout> | 142 | </v-layout> |
143 | <v-layout style="border: 1px solid lightgrey;"> | 143 | <v-layout style="border: 1px solid lightgrey;"> |
144 | <v-flex xs6 sm6 class="pa-0"> | 144 | <v-flex xs6 sm6 class="pa-0"> |
145 | <h4 class="right"> | 145 | <h4 class="right"> |
146 | <b>Date of Birth :</b> | 146 | <b>Date of Birth :</b> |
147 | </h4> | 147 | </h4> |
148 | </v-flex> | 148 | </v-flex> |
149 | <v-flex sm6 xs6 class="pa-0"> | 149 | <v-flex sm6 xs6 class="pa-0"> |
150 | <h4>{{ editedItem.dob }}</h4> | 150 | <h4>{{ editedItem.dob }}</h4> |
151 | </v-flex> | 151 | </v-flex> |
152 | </v-layout> | 152 | </v-layout> |
153 | <v-layout style="border: 1px solid lightgrey;"> | 153 | <v-layout style="border: 1px solid lightgrey;"> |
154 | <v-flex xs6 sm6 class="pa-0"> | 154 | <v-flex xs6 sm6 class="pa-0"> |
155 | <h4 class="right"> | 155 | <h4 class="right"> |
156 | <b>Phone No :</b> | 156 | <b>Phone No :</b> |
157 | </h4> | 157 | </h4> |
158 | </v-flex> | 158 | </v-flex> |
159 | <v-flex sm6 xs6 class="pa-0"> | 159 | <v-flex sm6 xs6 class="pa-0"> |
160 | <h4>{{ editedItem.mobileNo }}</h4> | 160 | <h4>{{ editedItem.mobileNo }}</h4> |
161 | </v-flex> | 161 | </v-flex> |
162 | </v-layout> | 162 | </v-layout> |
163 | </v-flex> | 163 | </v-flex> |
164 | </v-layout> | 164 | </v-layout> |
165 | </v-container> | 165 | </v-container> |
166 | </v-card-text> | 166 | </v-card-text> |
167 | </v-card> | 167 | </v-card> |
168 | </v-flex> | 168 | </v-flex> |
169 | <v-flex xs12 sm12 md8 v-if="viewSalary"> | 169 | <v-flex xs12 sm12 md8 v-if="viewSalary"> |
170 | <v-card flat> | 170 | <v-card flat> |
171 | <v-flex xs12 sm12> | 171 | <v-flex xs12 sm12> |
172 | <v-container fluid grid-list-md> | 172 | <v-container fluid grid-list-md> |
173 | <v-layout wrap> | 173 | <v-layout wrap> |
174 | <v-flex xs12 sm12 md6> | 174 | <v-flex xs12 sm12 md6> |
175 | <v-card flat> | 175 | <v-card flat> |
176 | <v-form ref="form" lazy-validation class="py-4"> | 176 | <v-form ref="form" lazy-validation class="py-4"> |
177 | <v-layout> | 177 | <v-layout> |
178 | <v-flex xs4 class="pt-4 subheading"> | 178 | <v-flex xs4 class="pt-4 subheading"> |
179 | <label class="right hidden-xs-only">Salary Grades :</label> | 179 | <label class="right hidden-xs-only">Salary Grades :</label> |
180 | </v-flex> | 180 | </v-flex> |
181 | <v-flex xs8 sm7 class="ml-3"> | 181 | <v-flex xs8 sm7 class="ml-3"> |
182 | <v-flex xs8 sm7 class="ml-3"> | 182 | <v-flex xs8 sm7 class="ml-3"> |
183 | <v-text-field | 183 | <v-text-field |
184 | solo | 184 | solo |
185 | v-model="editedItem.salaryTemplate.salaryGrades" | 185 | v-model="editedItem.salaryTemplate.salaryGrades" |
186 | readonly | 186 | readonly |
187 | ></v-text-field> | 187 | ></v-text-field> |
188 | </v-flex> | 188 | </v-flex> |
189 | </v-flex> | 189 | </v-flex> |
190 | </v-layout> | 190 | </v-layout> |
191 | <v-layout> | 191 | <v-layout> |
192 | <v-flex xs4 class="pt-4 subheading"> | 192 | <v-flex xs4 class="pt-4 subheading"> |
193 | <label class="right">Basic Salary :</label> | 193 | <label class="right">Basic Salary :</label> |
194 | </v-flex> | 194 | </v-flex> |
195 | <v-flex xs8 sm7 class="ml-3"> | 195 | <v-flex xs8 sm7 class="ml-3"> |
196 | <v-flex xs8 sm7 class="ml-3"> | 196 | <v-flex xs8 sm7 class="ml-3"> |
197 | <v-text-field | 197 | <v-text-field |
198 | solo | 198 | solo |
199 | v-model="editedItem.salaryTemplate.basicSalary" | 199 | v-model="editedItem.salaryTemplate.basicSalary" |
200 | readonly | 200 | readonly |
201 | ></v-text-field> | 201 | ></v-text-field> |
202 | </v-flex> | 202 | </v-flex> |
203 | </v-flex> | 203 | </v-flex> |
204 | </v-layout> | 204 | </v-layout> |
205 | </v-form> | 205 | </v-form> |
206 | </v-card> | 206 | </v-card> |
207 | </v-flex> | 207 | </v-flex> |
208 | <v-flex xs12 sm12 md5></v-flex> | 208 | <v-flex xs12 sm12 md5></v-flex> |
209 | <v-flex xs12 sm12 md6> | 209 | <v-flex xs12 sm12 md6> |
210 | <v-card flat> | 210 | <v-card flat> |
211 | <v-toolbar> | 211 | <v-toolbar> |
212 | <h3>Allowances</h3> | 212 | <h3>Allowances</h3> |
213 | </v-toolbar> | 213 | </v-toolbar> |
214 | <v-layout | 214 | <v-layout |
215 | v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.allowances" | 215 | v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.allowances" |
216 | :key="index" | 216 | :key="index" |
217 | > | 217 | > |
218 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 218 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
219 | <v-text-field | 219 | <v-text-field |
220 | readonly | 220 | readonly |
221 | solo | 221 | solo |
222 | label="Enter Allowances Label" | 222 | label="Enter Allowances Label" |
223 | v-model="editedItem.allowancesName" | 223 | v-model="editedItem.allowancesName" |
224 | ></v-text-field> | 224 | ></v-text-field> |
225 | </v-flex> | 225 | </v-flex> |
226 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 226 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
227 | <v-text-field | 227 | <v-text-field |
228 | readonly | 228 | readonly |
229 | solo | 229 | solo |
230 | v-model="editedItem.allowancesValue" | 230 | v-model="editedItem.allowancesValue" |
231 | label="Enter Allowances Value" | 231 | label="Enter Allowances Value" |
232 | ></v-text-field> | 232 | ></v-text-field> |
233 | </v-flex> | 233 | </v-flex> |
234 | </v-layout> | 234 | </v-layout> |
235 | </v-card> | 235 | </v-card> |
236 | </v-flex> | 236 | </v-flex> |
237 | <v-flex xs12 sm12 md6> | 237 | <v-flex xs12 sm12 md6> |
238 | <v-card flat> | 238 | <v-card flat> |
239 | <v-toolbar> | 239 | <v-toolbar> |
240 | <h3>Deduction</h3> | 240 | <h3>Deduction</h3> |
241 | </v-toolbar> | 241 | </v-toolbar> |
242 | <v-layout | 242 | <v-layout |
243 | v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.deduction" | 243 | v-for="(editedItem,salaryTemplate,index) in editedItem.salaryTemplate.deduction" |
244 | :key="index" | 244 | :key="index" |
245 | > | 245 | > |
246 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 246 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
247 | <v-text-field | 247 | <v-text-field |
248 | readonly | 248 | readonly |
249 | solo | 249 | solo |
250 | label="Enter Deduction Label" | 250 | label="Enter Deduction Label" |
251 | v-model="editedItem.deductionName" | 251 | v-model="editedItem.deductionName" |
252 | ></v-text-field> | 252 | ></v-text-field> |
253 | </v-flex> | 253 | </v-flex> |
254 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 254 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
255 | <v-text-field | 255 | <v-text-field |
256 | readonly | 256 | readonly |
257 | solo | 257 | solo |
258 | label="Enter Deduction Value" | 258 | label="Enter Deduction Value" |
259 | v-model="editedItem.deductionValue" | 259 | v-model="editedItem.deductionValue" |
260 | ></v-text-field> | 260 | ></v-text-field> |
261 | </v-flex> | 261 | </v-flex> |
262 | </v-layout> | 262 | </v-layout> |
263 | <!-- <v-layout> | 263 | <!-- <v-layout> |
264 | <v-flex xs4 class="pt-4 subheading"> | 264 | <v-flex xs4 class="pt-4 subheading"> |
265 | <v-text-field | 265 | <v-text-field |
266 | v-model="editedItem.salaryTemplate.deduction.deductionName" | 266 | v-model="editedItem.salaryTemplate.deduction.deductionName" |
267 | readonly | 267 | readonly |
268 | ></v-text-field> | 268 | ></v-text-field> |
269 | </v-flex> | 269 | </v-flex> |
270 | <v-flex xs8 sm7 class="ml-3"> | 270 | <v-flex xs8 sm7 class="ml-3"> |
271 | <v-flex xs8 sm7 class="ml-3"> | 271 | <v-flex xs8 sm7 class="ml-3"> |
272 | <v-text-field | 272 | <v-text-field |
273 | v-model="editedItem.salaryTemplate.deduction.deductionValue" | 273 | v-model="editedItem.salaryTemplate.deduction.deductionValue" |
274 | readonly | 274 | readonly |
275 | ></v-text-field> | 275 | ></v-text-field> |
276 | </v-flex> | 276 | </v-flex> |
277 | </v-flex> | 277 | </v-flex> |
278 | </v-layout>--> | 278 | </v-layout>--> |
279 | </v-card> | 279 | </v-card> |
280 | </v-flex> | 280 | </v-flex> |
281 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> | 281 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> |
282 | <v-card> | 282 | <v-card> |
283 | <v-toolbar> | 283 | <v-toolbar> |
284 | <h3>Total Salary Details</h3> | 284 | <h3>Total Salary Details</h3> |
285 | </v-toolbar> | 285 | </v-toolbar> |
286 | <v-layout> | 286 | <v-layout> |
287 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 287 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
288 | <v-text-field solo value="Gross Salary"></v-text-field> | 288 | <v-text-field solo value="Gross Salary"></v-text-field> |
289 | </v-flex> | 289 | </v-flex> |
290 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 290 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
291 | <v-flex xs8 sm7 class="ml-3"> | 291 | <v-flex xs8 sm7 class="ml-3"> |
292 | <v-text-field | 292 | <v-text-field |
293 | v-model="editedItem.salaryTemplate.grossSalary" | 293 | v-model="editedItem.salaryTemplate.grossSalary" |
294 | solo | 294 | solo |
295 | readonly | 295 | readonly |
296 | ></v-text-field> | 296 | ></v-text-field> |
297 | </v-flex> | 297 | </v-flex> |
298 | </v-flex> | 298 | </v-flex> |
299 | </v-layout> | 299 | </v-layout> |
300 | <v-layout> | 300 | <v-layout> |
301 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 301 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
302 | <v-text-field solo value="Total Deduction"></v-text-field> | 302 | <v-text-field solo value="Total Deduction"></v-text-field> |
303 | </v-flex> | 303 | </v-flex> |
304 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 304 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
305 | <v-flex xs8 sm7 class="ml-3"> | 305 | <v-flex xs8 sm7 class="ml-3"> |
306 | <v-text-field | 306 | <v-text-field |
307 | v-model="editedItem.salaryTemplate.totalDeduction" | 307 | v-model="editedItem.salaryTemplate.totalDeduction" |
308 | solo | 308 | solo |
309 | readonly | 309 | readonly |
310 | ></v-text-field> | 310 | ></v-text-field> |
311 | </v-flex> | 311 | </v-flex> |
312 | </v-flex> | 312 | </v-flex> |
313 | </v-layout> | 313 | </v-layout> |
314 | <v-layout> | 314 | <v-layout> |
315 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 315 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
316 | <v-text-field solo value="Net Salary"></v-text-field> | 316 | <v-text-field solo value="Net Salary"></v-text-field> |
317 | </v-flex> | 317 | </v-flex> |
318 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 318 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
319 | <v-flex xs8 sm7 class="ml-3"> | 319 | <v-flex xs8 sm7 class="ml-3"> |
320 | <v-text-field | 320 | <v-text-field |
321 | v-model="editedItem.salaryTemplate.netSalary" | 321 | v-model="editedItem.salaryTemplate.netSalary" |
322 | solo | 322 | solo |
323 | readonly | 323 | readonly |
324 | ></v-text-field> | 324 | ></v-text-field> |
325 | </v-flex> | 325 | </v-flex> |
326 | </v-flex> | 326 | </v-flex> |
327 | </v-layout> | 327 | </v-layout> |
328 | </v-card> | 328 | </v-card> |
329 | </v-flex> | 329 | </v-flex> |
330 | </v-layout> | 330 | </v-layout> |
331 | </v-container> | 331 | </v-container> |
332 | </v-flex> | 332 | </v-flex> |
333 | </v-card> | 333 | </v-card> |
334 | </v-flex> | 334 | </v-flex> |
335 | <v-flex xs12 sm12 md8 v-if="viewHourly"> | 335 | <v-flex xs12 sm12 md8 v-if="viewHourly"> |
336 | <v-card flat> | 336 | <v-card flat> |
337 | <v-flex xs12 sm12> | 337 | <v-flex xs12 sm12> |
338 | <v-container fluid grid-list-md> | 338 | <v-container fluid grid-list-md> |
339 | <v-layout wrap> | 339 | <v-layout wrap> |
340 | <v-flex xs12 sm12 md6> | 340 | <v-flex xs12 sm12 md6> |
341 | <v-card flat> | 341 | <v-card flat> |
342 | <v-form ref="form" lazy-validation class="py-4"> | 342 | <v-form ref="form" lazy-validation class="py-4"> |
343 | <v-layout> | 343 | <v-layout> |
344 | <v-flex xs4 class="pt-4 subheading"> | 344 | <v-flex xs4 class="pt-4 subheading"> |
345 | <label class="right hidden-xs-only">Hourly Grades :</label> | 345 | <label class="right hidden-xs-only">Hourly Grades :</label> |
346 | </v-flex> | 346 | </v-flex> |
347 | <v-flex xs8 sm7 class="ml-3"> | 347 | <v-flex xs8 sm7 class="ml-3"> |
348 | <v-flex xs8 sm7 class="ml-3"> | 348 | <v-flex xs8 sm7 class="ml-3"> |
349 | <v-text-field | 349 | <v-text-field |
350 | solo | 350 | solo |
351 | v-model="editedItem.hourlyTemplate.hourlyGrades" | 351 | v-model="editedItem.hourlyTemplate.hourlyGrades" |
352 | readonly | 352 | readonly |
353 | ></v-text-field> | 353 | ></v-text-field> |
354 | </v-flex> | 354 | </v-flex> |
355 | </v-flex> | 355 | </v-flex> |
356 | </v-layout> | 356 | </v-layout> |
357 | <v-layout> | 357 | <v-layout> |
358 | <v-flex xs4 class="pt-4 subheading"> | 358 | <v-flex xs4 class="pt-4 subheading"> |
359 | <label class="right">Hourly Rate :</label> | 359 | <label class="right">Hourly Rate :</label> |
360 | </v-flex> | 360 | </v-flex> |
361 | <v-flex xs8 sm7 class="ml-3"> | 361 | <v-flex xs8 sm7 class="ml-3"> |
362 | <v-flex xs8 sm7 class="ml-3"> | 362 | <v-flex xs8 sm7 class="ml-3"> |
363 | <v-text-field | 363 | <v-text-field |
364 | solo | 364 | solo |
365 | v-model="editedItem.hourlyTemplate.hourlyRate" | 365 | v-model="editedItem.hourlyTemplate.hourlyRate" |
366 | readonly | 366 | readonly |
367 | ></v-text-field> | 367 | ></v-text-field> |
368 | </v-flex> | 368 | </v-flex> |
369 | </v-flex> | 369 | </v-flex> |
370 | </v-layout> | 370 | </v-layout> |
371 | </v-form> | 371 | </v-form> |
372 | </v-card> | 372 | </v-card> |
373 | </v-flex> | 373 | </v-flex> |
374 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> | 374 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> |
375 | <v-card> | 375 | <v-card> |
376 | <v-toolbar> | 376 | <v-toolbar> |
377 | <h3>Total Salary Details</h3> | 377 | <h3>Total Salary Details</h3> |
378 | </v-toolbar> | 378 | </v-toolbar> |
379 | <v-layout> | 379 | <v-layout> |
380 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 380 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
381 | <v-text-field solo value="Gross Salary"></v-text-field> | 381 | <v-text-field solo value="Gross Salary"></v-text-field> |
382 | </v-flex> | 382 | </v-flex> |
383 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 383 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
384 | <v-flex xs8 sm7 class="ml-3"> | 384 | <v-flex xs8 sm7 class="ml-3"> |
385 | <v-text-field | 385 | <v-text-field |
386 | v-model="editedItem.hourlyTemplate.grossSalary" | 386 | v-model="editedItem.hourlyTemplate.grossSalary" |
387 | solo | 387 | solo |
388 | readonly | 388 | readonly |
389 | ></v-text-field> | 389 | ></v-text-field> |
390 | </v-flex> | 390 | </v-flex> |
391 | </v-flex> | 391 | </v-flex> |
392 | </v-layout> | 392 | </v-layout> |
393 | <v-layout> | 393 | <v-layout> |
394 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 394 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
395 | <v-text-field solo value="Total Deduction"></v-text-field> | 395 | <v-text-field solo value="Total Deduction"></v-text-field> |
396 | </v-flex> | 396 | </v-flex> |
397 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 397 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
398 | <v-flex xs8 sm7 class="ml-3"> | 398 | <v-flex xs8 sm7 class="ml-3"> |
399 | <v-text-field | 399 | <v-text-field |
400 | v-model="editedItem.hourlyTemplate.totalDeduction" | 400 | v-model="editedItem.hourlyTemplate.totalDeduction" |
401 | solo | 401 | solo |
402 | readonly | 402 | readonly |
403 | ></v-text-field> | 403 | ></v-text-field> |
404 | </v-flex> | 404 | </v-flex> |
405 | </v-flex> | 405 | </v-flex> |
406 | </v-layout> | 406 | </v-layout> |
407 | <v-layout> | 407 | <v-layout> |
408 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 408 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
409 | <v-text-field solo value="Net Hourly Rate"></v-text-field> | 409 | <v-text-field solo value="Net Hourly Rate"></v-text-field> |
410 | </v-flex> | 410 | </v-flex> |
411 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 411 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
412 | <v-flex xs8 sm7 class="ml-3"> | 412 | <v-flex xs8 sm7 class="ml-3"> |
413 | <v-text-field | 413 | <v-text-field |
414 | v-model="editedItem.hourlyTemplate.netSalary" | 414 | v-model="editedItem.hourlyTemplate.netSalary" |
415 | solo | 415 | solo |
416 | readonly | 416 | readonly |
417 | ></v-text-field> | 417 | ></v-text-field> |
418 | </v-flex> | 418 | </v-flex> |
419 | </v-flex> | 419 | </v-flex> |
420 | </v-layout> | 420 | </v-layout> |
421 | </v-card> | 421 | </v-card> |
422 | </v-flex> | 422 | </v-flex> |
423 | </v-layout> | 423 | </v-layout> |
424 | </v-container> | 424 | </v-container> |
425 | </v-flex> | 425 | </v-flex> |
426 | </v-card> | 426 | </v-card> |
427 | </v-flex> | 427 | </v-flex> |
428 | </v-layout> | 428 | </v-layout> |
429 | </v-card> | 429 | </v-card> |
430 | </v-dialog> | 430 | </v-dialog> |
431 | 431 | ||
432 | <!-- ****** Edit Hourly Template ****** --> | 432 | <!-- ****** Edit Hourly Template ****** --> |
433 | <v-dialog v-model="editSalaryDialog" max-width="400px" persistent> | 433 | <v-dialog v-model="editSalaryDialog" max-width="400px" persistent> |
434 | <v-card flat class="card-style pa-2" dark> | 434 | <v-card flat class="card-style pa-2" dark> |
435 | <v-layout> | 435 | <v-layout> |
436 | <v-flex xs12> | 436 | <v-flex xs12> |
437 | <label class="title text-xs-center">Edit Manage Salary</label> | 437 | <label class="title text-xs-center">Edit Manage Salary</label> |
438 | <v-icon size="24" class="right" @click="editSalaryDialog = false">cancel</v-icon> | 438 | <v-icon size="24" class="right" @click="editSalaryDialog = false">cancel</v-icon> |
439 | </v-flex> | 439 | </v-flex> |
440 | </v-layout> | 440 | </v-layout> |
441 | <v-form ref="form"> | 441 | <v-form ref="form"> |
442 | <v-container fluid> | 442 | <v-container fluid> |
443 | <v-flex xs12 sm12> | 443 | <v-flex xs12 sm12> |
444 | <v-layout> | 444 | <v-layout> |
445 | <v-flex xs3 class="pt-4 subheading"> | 445 | <v-flex xs3 class="pt-4 subheading"> |
446 | <label class="right">Salary:</label> | 446 | <label class="right">Salary:</label> |
447 | </v-flex> | 447 | </v-flex> |
448 | <v-flex xs8 sm7 class="ml-3"> | 448 | <v-flex xs8 sm7 class="ml-3"> |
449 | <v-select | 449 | <v-select |
450 | :items="salary" | 450 | :items="salary" |
451 | v-model="editedItem.salary" | 451 | v-model="editedItem.salary" |
452 | placeholder="please fill this field" | 452 | placeholder="please fill this field" |
453 | @change="selectSalary()" | 453 | @change="selectSalary()" |
454 | ></v-select> | 454 | ></v-select> |
455 | </v-flex> | 455 | </v-flex> |
456 | </v-layout> | 456 | </v-layout> |
457 | </v-flex> | 457 | </v-flex> |
458 | <v-flex xs12 sm12> | 458 | <v-flex xs12 sm12> |
459 | <v-layout> | 459 | <v-layout> |
460 | <v-flex xs3 class="pt-4 subheading"> | 460 | <v-flex xs3 class="pt-4 subheading"> |
461 | <label class="right">Template:</label> | 461 | <label class="right">Template:</label> |
462 | </v-flex> | 462 | </v-flex> |
463 | <v-flex xs8 sm7 class="ml-3" v-if="monthlyGrade"> | 463 | <v-flex xs8 sm7 class="ml-3" v-if="monthlyGrade"> |
464 | <v-autocomplete | 464 | <v-autocomplete |
465 | v-model="editedItem.salaryId" | 465 | v-model="editedItem.salaryId" |
466 | :items="salaryData" | 466 | :items="salaryData" |
467 | item-text="salaryGrades" | 467 | item-text="salaryGrades" |
468 | item-value="_id" | 468 | item-value="_id" |
469 | placeholder="please fill this field" | 469 | placeholder="please fill this field" |
470 | @change="selectGrade()" | 470 | @change="selectGrade()" |
471 | required | 471 | required |
472 | ></v-autocomplete> | 472 | ></v-autocomplete> |
473 | </v-flex> | 473 | </v-flex> |
474 | <v-flex xs8 sm7 class="ml-3" v-if="hourlyGrades"> | 474 | <v-flex xs8 sm7 class="ml-3" v-if="hourlyGrades"> |
475 | <v-autocomplete | 475 | <v-autocomplete |
476 | v-model="editedItem.salaryId" | 476 | v-model="editedItem.salaryId" |
477 | :items="hourlyData" | 477 | :items="hourlyData" |
478 | item-text="hourlyGrades" | 478 | item-text="hourlyGrades" |
479 | item-value="_id" | 479 | item-value="_id" |
480 | placeholder="please fill this field" | 480 | placeholder="please fill this field" |
481 | @change="selectGrade()" | 481 | @change="selectGrade()" |
482 | required | 482 | required |
483 | ></v-autocomplete> | 483 | ></v-autocomplete> |
484 | </v-flex> | 484 | </v-flex> |
485 | </v-layout> | 485 | </v-layout> |
486 | </v-flex> | 486 | </v-flex> |
487 | <v-layout> | 487 | <v-layout> |
488 | <v-flex xs12> | 488 | <v-flex xs12> |
489 | <v-layout> | 489 | <v-layout> |
490 | <v-spacer></v-spacer> | 490 | <v-spacer></v-spacer> |
491 | <v-btn round dark @click="save" class="add-button">Update Salary Template</v-btn> | 491 | <v-btn round dark @click="save" class="add-button">Update Salary Template</v-btn> |
492 | <v-spacer></v-spacer> | 492 | <v-spacer></v-spacer> |
493 | </v-layout> | 493 | </v-layout> |
494 | </v-flex> | 494 | </v-flex> |
495 | </v-layout> | 495 | </v-layout> |
496 | </v-container> | 496 | </v-container> |
497 | </v-form> | 497 | </v-form> |
498 | </v-card> | 498 | </v-card> |
499 | </v-dialog> | 499 | </v-dialog> |
500 | </v-container> | 500 | </v-container> |
501 | </template> | 501 | </template> |
502 | 502 | ||
503 | <script> | 503 | <script> |
504 | import http from "@/Services/http.js"; | 504 | import http from "@/Services/http.js"; |
505 | import Util from "@/util"; | 505 | import Util from "@/util"; |
506 | import moment from "moment"; | 506 | import moment from "moment"; |
507 | export default { | 507 | export default { |
508 | data: () => ({ | 508 | data: () => ({ |
509 | search: "", | 509 | search: "", |
510 | pagination: { | 510 | pagination: { |
511 | rowsPerPage: 10 | 511 | rowsPerPage: 10, |
512 | }, | 512 | }, |
513 | 513 | ||
514 | role: [v => !!v || "Role Name is required"], | 514 | role: [(v) => !!v || "Role Name is required"], |
515 | getRoles: [], | 515 | getRoles: [], |
516 | teacherList: [], | 516 | teacherList: [], |
517 | roleList: [], | 517 | roleList: [], |
518 | salaryData: [], | 518 | salaryData: [], |
519 | hourlyData: [], | 519 | hourlyData: [], |
520 | salary: ["Monthly", "Hourly"], | 520 | salary: ["Monthly", "Hourly"], |
521 | 521 | ||
522 | salaryItem: "", | 522 | salaryItem: "", |
523 | 523 | ||
524 | getReport: { | 524 | getReport: { |
525 | role: "" | 525 | role: "", |
526 | }, | 526 | }, |
527 | 527 | ||
528 | showTeacher: false, | 528 | showTeacher: false, |
529 | editSalaryDialog: false, | 529 | editSalaryDialog: false, |
530 | profileSalaryDialog: false, | 530 | profileSalaryDialog: false, |
531 | monthlyGrade: false, | 531 | monthlyGrade: false, |
532 | hourlyGrades: false, | 532 | hourlyGrades: false, |
533 | viewSalary: false, | 533 | viewSalary: false, |
534 | viewHourly: false, | 534 | viewHourly: false, |
535 | 535 | ||
536 | editedItem: { | 536 | editedItem: { |
537 | salaryTemplate: { | 537 | salaryTemplate: { |
538 | allowances: {}, | 538 | allowances: {}, |
539 | deduction: {} | 539 | deduction: {}, |
540 | }, | 540 | }, |
541 | hourlyTemplate: {} | 541 | hourlyTemplate: {}, |
542 | }, | 542 | }, |
543 | 543 | ||
544 | // salaryGrades: {}, | 544 | // salaryGrades: {}, |
545 | // salaryTemplate: { | 545 | // salaryTemplate: { |
546 | // salaryGrades: "" | 546 | // salaryGrades: "" |
547 | // }, | 547 | // }, |
548 | // salaryTemplate :{ | 548 | // salaryTemplate :{ |
549 | // allowances: { | 549 | // allowances: { |
550 | // allowancesName: "", | 550 | // allowancesName: "", |
551 | // allowancesValue: "" | 551 | // allowancesValue: "" |
552 | // }, | 552 | // }, |
553 | // deduction: { | 553 | // deduction: { |
554 | // deductionName: "", | 554 | // deductionName: "", |
555 | // deductionValue: "" | 555 | // deductionValue: "" |
556 | // } | 556 | // } |
557 | // }, | 557 | // }, |
558 | 558 | ||
559 | headers: [ | 559 | headers: [ |
560 | { | 560 | { |
561 | text: "No", | 561 | text: "No", |
562 | align: "", | 562 | align: "", |
563 | sortable: false, | 563 | sortable: false, |
564 | value: "No" | 564 | value: "No", |
565 | }, | 565 | }, |
566 | { | 566 | { |
567 | text: "Profile Pic", | 567 | text: "Profile Pic", |
568 | value: "profilePicUrl", | 568 | value: "profilePicUrl", |
569 | sortable: false, | 569 | sortable: false, |
570 | align: "center" | 570 | align: "center", |
571 | }, | 571 | }, |
572 | { text: "Name", value: "name", sortable: false, align: "center" }, | 572 | { text: "Name", value: "name", sortable: false, align: "center" }, |
573 | { | 573 | { |
574 | text: "Join Date", | 574 | text: "Join Date", |
575 | value: "joinDate", | 575 | value: "joinDate", |
576 | sortable: false, | 576 | sortable: false, |
577 | align: "center" | 577 | align: "center", |
578 | }, | 578 | }, |
579 | { text: "Action", value: "", sortable: false, align: "center" } | 579 | { text: "Action", value: "", sortable: false, align: "center" }, |
580 | ], | 580 | ], |
581 | desserts: [] | 581 | desserts: [], |
582 | }), | 582 | }), |
583 | 583 | ||
584 | methods: { | 584 | methods: { |
585 | close() { | 585 | close() { |
586 | this.editHourDialog = false; | 586 | this.editHourDialog = false; |
587 | }, | 587 | }, |
588 | dates: function(date) { | 588 | dates: function (date) { |
589 | return moment(date).format("MMMM DD, YYYY"); | 589 | return moment(date).format("MMMM DD, YYYY"); |
590 | }, | 590 | }, |
591 | editItem(item) { | 591 | editItem(item) { |
592 | this.editedIndex = this.roleList.indexOf(item); | 592 | this.editedIndex = this.roleList.indexOf(item); |
593 | this.editedItem = Object.assign({}, item); | 593 | this.editedItem = Object.assign({}, item); |
594 | this.editSalaryDialog = true; | 594 | this.editSalaryDialog = true; |
595 | }, | 595 | }, |
596 | profile(item) { | 596 | profile(item) { |
597 | this.editedIndex = this.roleList.indexOf(item); | 597 | this.editedIndex = this.roleList.indexOf(item); |
598 | this.editedItem = Object.assign({}, item); | 598 | this.editedItem = Object.assign({}, item); |
599 | this.profileSalaryDialog = true; | 599 | this.profileSalaryDialog = true; |
600 | // console.log("item", item); | 600 | // console.log("item", item); |
601 | if (item.salaryTemplate) { | 601 | if (item.salaryTemplate) { |
602 | this.viewSalary = true; | 602 | this.viewSalary = true; |
603 | this.viewHourly = false; | 603 | this.viewHourly = false; |
604 | } else { | 604 | } else { |
605 | this.viewHourly = true; | 605 | this.viewHourly = true; |
606 | this.viewSalary = false; | 606 | this.viewSalary = false; |
607 | } | 607 | } |
608 | }, | 608 | }, |
609 | getRole() { | 609 | getRole() { |
610 | this.showLoader = true; | 610 | this.showLoader = true; |
611 | var token = this.$store.state.token; | 611 | var token = this.$store.state.token; |
612 | http() | 612 | http() |
613 | .get("/getRolesList", { | 613 | .get("/getRolesList", { |
614 | headers: { Authorization: "Bearer " + token } | 614 | headers: { Authorization: "Bearer " + token }, |
615 | }) | 615 | }) |
616 | .then(response => { | 616 | .then((response) => { |
617 | this.getRoles = response.data.data; | 617 | this.getRoles = response.data.data; |
618 | // if (this.getRoles[2].role !== 3) { | 618 | // if (this.getRoles[2].role !== 3) { |
619 | // this.getRoles = response.data.data; | 619 | // this.getRoles = response.data.data; |
620 | // console.log("roles", this.getRoles[2].role); | 620 | // console.log("roles", this.getRoles[2].role); |
621 | // } | 621 | // } |
622 | this.getRoles = response.data.data; | 622 | |
623 | var removedRoles = _.remove(this.getRoles, function(c) { | 623 | // var removedRoles = _.remove(this.getRoles, function (c) { |
624 | //remove if color is green or yellow | 624 | // //remove if color is green or yellow |
625 | return c.role === 1 || c.role === 4 || c.role === 5; | 625 | // return c.role === 1 || c.role === 4 || c.role === 5; |
626 | // console.log(c); | 626 | // // console.log(c); |
627 | }); | 627 | // }); |
628 | this.showLoader = false; | 628 | this.showLoader = false; |
629 | }) | 629 | }) |
630 | .catch(error => { | 630 | .catch((error) => { |
631 | this.showLoader = false; | 631 | this.showLoader = false; |
632 | if (error.response.status === 401) { | ||
633 | this.$router.replace({ path: "/" }); | ||
634 | this.$store.dispatch("setToken", null); | ||
635 | this.$store.dispatch("Id", null); | ||
636 | } | ||
637 | }); | 632 | }); |
638 | }, | 633 | }, |
639 | 634 | ||
640 | getRoleInputs(role) { | 635 | getRoleInputs(role) { |
641 | // console.log("role", role); | 636 | // console.log("role", role); |
642 | if (role === 3) { | 637 | if (role === 3) { |
643 | this.showTeacher = true; | 638 | this.showTeacher = true; |
644 | this.getTeacherList(); | 639 | this.getTeacherList(); |
645 | } | 640 | } |
646 | }, | 641 | }, |
647 | 642 | ||
648 | getTeacherList() { | 643 | getTeacherList() { |
649 | this.showLoader = true; | 644 | this.showLoader = true; |
650 | var token = this.$store.state.token; | 645 | var token = this.$store.state.token; |
651 | http() | 646 | http() |
652 | .get("/getTeachersList", { | 647 | .get("/getTeachersList", { |
653 | headers: { Authorization: "Bearer " + token } | 648 | headers: { Authorization: "Bearer " + token }, |
654 | }) | 649 | }) |
655 | .then(response => { | 650 | .then((response) => { |
656 | this.teacherList = response.data.data; | 651 | this.teacherList = response.data.data; |
657 | this.showTeacher = true; | 652 | this.showTeacher = true; |
658 | this.showLoader = false; | 653 | this.showLoader = false; |
659 | }) | 654 | }) |
660 | .catch(error => { | 655 | .catch((error) => { |
661 | this.showLoader = false; | 656 | this.showLoader = false; |
662 | if (error.response.status === 401) { | 657 | if (error.response.status === 401) { |
663 | this.$router.replace({ path: "/" }); | 658 | this.$router.replace({ path: "/" }); |
664 | this.$store.dispatch("setToken", null); | 659 | this.$store.dispatch("setToken", null); |
665 | this.$store.dispatch("Id", null); | 660 | this.$store.dispatch("Id", null); |
666 | } | 661 | } |
667 | }); | 662 | }); |
668 | }, | 663 | }, |
669 | 664 | ||
670 | getUserDetailWithRoles() { | 665 | getUserDetailWithRoles() { |
671 | this.showLoader = true; | 666 | this.showLoader = true; |
672 | http() | 667 | http() |
673 | .get( | 668 | .get( |
674 | "/getUserDetailWithRoles", | 669 | "/getUserDetailWithRoles", |
675 | { params: { role: this.getReport.role } }, | 670 | { params: { role: this.getReport.role } }, |
676 | { | 671 | { |
677 | headers: { Authorization: "Bearer " + this.token } | 672 | headers: { Authorization: "Bearer " + this.token }, |
678 | } | 673 | } |
679 | ) | 674 | ) |
680 | .then(response => { | 675 | .then((response) => { |
681 | this.roleList = response.data.data; | 676 | this.roleList = response.data.data; |
682 | this.showLoader = false; | 677 | this.showLoader = false; |
683 | }) | 678 | }) |
684 | .catch(err => { | 679 | .catch((err) => { |
685 | this.showLoader = false; | 680 | this.showLoader = false; |
686 | }); | 681 | }); |
687 | }, | 682 | }, |
688 | getSalaryList() { | 683 | getSalaryList() { |
689 | this.showLoader = true; | 684 | this.showLoader = true; |
690 | this.loadingSearch = true; | 685 | this.loadingSearch = true; |
691 | http() | 686 | http() |
692 | .get("/getSalaryList", { | 687 | .get("/getSalaryList", { |
693 | headers: { Authorization: "Bearer " + this.token } | 688 | headers: { Authorization: "Bearer " + this.token }, |
694 | }) | 689 | }) |
695 | .then(response => { | 690 | .then((response) => { |
696 | this.salaryData = response.data.data; | 691 | this.salaryData = response.data.data; |
697 | this.showLoader = false; | 692 | this.showLoader = false; |
698 | this.loadingSearch = false; | 693 | this.loadingSearch = false; |
699 | }) | 694 | }) |
700 | .catch(error => { | 695 | .catch((error) => { |
701 | // console.log("err====>", err); | 696 | // console.log("err====>", err); |
702 | this.showLoader = false; | 697 | this.showLoader = false; |
703 | this.loadingSearch = false; | 698 | this.loadingSearch = false; |
704 | this.snackbar = true; | 699 | this.snackbar = true; |
705 | this.text = error.response.data.message; | 700 | this.text = error.response.data.message; |
706 | if (error.response.status === 401) { | 701 | if (error.response.status === 401) { |
707 | this.$router.replace({ path: "/" }); | 702 | this.$router.replace({ path: "/" }); |
708 | this.$store.dispatch("setToken", null); | 703 | this.$store.dispatch("setToken", null); |
709 | this.$store.dispatch("Id", null); | 704 | this.$store.dispatch("Id", null); |
710 | } | 705 | } |
711 | }); | 706 | }); |
712 | }, | 707 | }, |
713 | getHourlyList() { | 708 | getHourlyList() { |
714 | this.showLoader = true; | 709 | this.showLoader = true; |
715 | this.loadingSearch = true; | 710 | this.loadingSearch = true; |
716 | http() | 711 | http() |
717 | .get("/getHourlyList", { | 712 | .get("/getHourlyList", { |
718 | headers: { Authorization: "Bearer " + this.token } | 713 | headers: { Authorization: "Bearer " + this.token }, |
719 | }) | 714 | }) |
720 | .then(response => { | 715 | .then((response) => { |
721 | this.hourlyData = response.data.data; | 716 | this.hourlyData = response.data.data; |
722 | this.showLoader = false; | 717 | this.showLoader = false; |
723 | this.loadingSearch = false; | 718 | this.loadingSearch = false; |
724 | }) | 719 | }) |
725 | .catch(error => { | 720 | .catch((error) => { |
726 | // console.log("err====>", err); | 721 | // console.log("err====>", err); |
727 | this.showLoader = false; | 722 | this.showLoader = false; |
728 | this.loadingSearch = false; | 723 | this.loadingSearch = false; |
729 | this.snackbar = true; | 724 | this.snackbar = true; |
730 | this.text = error.response.data.message; | 725 | this.text = error.response.data.message; |
731 | if (error.response.status === 401) { | 726 | if (error.response.status === 401) { |
732 | this.$router.replace({ path: "/" }); | 727 | this.$router.replace({ path: "/" }); |
733 | this.$store.dispatch("setToken", null); | 728 | this.$store.dispatch("setToken", null); |
734 | this.$store.dispatch("Id", null); | 729 | this.$store.dispatch("Id", null); |
735 | } | 730 | } |
736 | }); | 731 | }); |
737 | }, | 732 | }, |
738 | editItem(item) { | 733 | editItem(item) { |
739 | this.editedIndex = this.salaryData.indexOf(item); | 734 | this.editedIndex = this.salaryData.indexOf(item); |
740 | this.editedIndex = this.hourlyData.indexOf(item); | 735 | this.editedIndex = this.hourlyData.indexOf(item); |
741 | this.editedItem = Object.assign({}, item); | 736 | this.editedItem = Object.assign({}, item); |
742 | this.editedItem.date = | 737 | this.editedItem.date = |
743 | this.editedItem.date != undefined | 738 | this.editedItem.date != undefined |
744 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 739 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
745 | : (this.editedItem.date = ""); | 740 | : (this.editedItem.date = ""); |
746 | this.editSalaryDialog = true; | 741 | this.editSalaryDialog = true; |
747 | }, | 742 | }, |
748 | selectSalary() { | 743 | selectSalary() { |
749 | if (this.editedItem.salary === "Monthly") { | 744 | if (this.editedItem.salary === "Monthly") { |
750 | this.monthlyGrade = true; | 745 | this.monthlyGrade = true; |
751 | this.hourlyGrades = false; | 746 | this.hourlyGrades = false; |
752 | } else { | 747 | } else { |
753 | this.monthlyGrade = false; | 748 | this.monthlyGrade = false; |
754 | this.hourlyGrades = true; | 749 | this.hourlyGrades = true; |
755 | } | 750 | } |
756 | }, | 751 | }, |
757 | selectGrade() { | 752 | selectGrade() { |
758 | console.log("this.editedItem", this.editedItem); | 753 | // console.log("this.editedItem", this.editedItem); |
759 | }, | 754 | }, |
760 | selectView() { | 755 | selectView() { |
761 | if (this.editedItem.view.png === "Monthly") { | 756 | if (this.editedItem.view.png === "Monthly") { |
762 | this.viewSalary = true; | 757 | this.viewSalary = true; |
763 | this.viewHourly = false; | 758 | this.viewHourly = false; |
764 | } else { | 759 | } else { |
765 | this.viewSalary = false; | 760 | this.viewSalary = false; |
766 | this.viewHourly = true; | 761 | this.viewHourly = true; |
767 | } | 762 | } |
768 | }, | 763 | }, |
769 | 764 | ||
770 | save() { | 765 | save() { |
771 | var updateSalary = { | 766 | var updateSalary = { |
772 | role: this.editedItem.role, | 767 | role: this.editedItem.role, |
773 | userId: this.editedItem._id, | 768 | userId: this.editedItem._id, |
774 | templateName: this.editedItem.salary, | 769 | templateName: this.editedItem.salary, |
775 | templateId: this.editedItem.salaryId | 770 | templateId: this.editedItem.salaryId, |
776 | }; | 771 | }; |
777 | http() | 772 | http() |
778 | .put("/updateUserSalary", updateSalary, { | 773 | .put("/updateUserSalary", updateSalary, { |
779 | headers: { | 774 | headers: { |
780 | Authorization: "Bearer " + this.token | 775 | Authorization: "Bearer " + this.token, |
781 | } | 776 | }, |
782 | }) | 777 | }) |
783 | .then(response => { | 778 | .then((response) => { |
784 | this.getUserDetailWithRoles(); | 779 | this.getUserDetailWithRoles(); |
785 | this.close(); | 780 | this.close(); |
786 | this.snackbar = true; | 781 | this.snackbar = true; |
787 | this.text = response.data.message; | 782 | this.text = response.data.message; |
788 | this.color = "green"; | 783 | this.color = "green"; |
789 | this.editSalaryDialog = false; | 784 | this.editSalaryDialog = false; |
790 | }) | 785 | }) |
791 | .catch(error => { | 786 | .catch((error) => { |
792 | console.log("error", error); | 787 | // console.log("error", error); |
788 | this.snackbar = true; | ||
793 | this.snackbar = true; | 789 | this.snackbar = true; |
794 | this.color = "red"; | 790 | this.color = "error"; |
791 | this.text = error.response.data.message; | ||
795 | }); | 792 | }); |
796 | }, | 793 | }, |
797 | 794 | ||
798 | deleteItem(item) { | 795 | deleteItem(item) { |
799 | // let deleteGrade = { | 796 | // let deleteGrade = { |
800 | // hourlyId: item._id | 797 | // hourlyId: item._id |
801 | // }; | 798 | // }; |
802 | // http() | 799 | // http() |
803 | // .delete( | 800 | // .delete( |
804 | // "/deleteHourly", | 801 | // "/deleteHourly", |
805 | // confirm("Are you sure you want to delete this?") && { | 802 | // confirm("Are you sure you want to delete this?") && { |
806 | // params: deleteGrade | 803 | // params: deleteGrade |
807 | // }, | 804 | // }, |
808 | // { | 805 | // { |
809 | // headers: { | 806 | // headers: { |
810 | // Authorization: "Bearer " + this.token | 807 | // Authorization: "Bearer " + this.token |
811 | // } | 808 | // } |
812 | // } | 809 | // } |
813 | // ) | 810 | // ) |
814 | // .then(response => { | 811 | // .then(response => { |
815 | // this.snackbar = true; | 812 | // this.snackbar = true; |
816 | // // this.text = "Successfully Delete Salary "; | 813 | // // this.text = "Successfully Delete Salary "; |
817 | // this.text = response.data.message; | 814 | // this.text = response.data.message; |
818 | // this.color = "green"; | 815 | // this.color = "green"; |
819 | // this.getUserDetailWithRoles(); | 816 | // this.getUserDetailWithRoles(); |
820 | // }) | 817 | // }) |
821 | // .catch(error => { | 818 | // .catch(error => { |
822 | // console.log("error", error); | 819 | // console.log("error", error); |
823 | // this.snackbar = true; | 820 | // this.snackbar = true; |
824 | // this.text = error.response.data.message; | 821 | // this.text = error.response.data.message; |
825 | // this.color = "red"; | 822 | // this.color = "red"; |
826 | // }); | 823 | // }); |
827 | } | 824 | }, |
828 | 825 | ||
829 | // selectAllowances() { | 826 | // selectAllowances() { |
830 | // this.salaryTypeData.push({ | 827 | // this.salaryTypeData.push({ |
831 | // allowancesValue: (this.salaryType.allowancesValue = "") | 828 | // allowancesValue: (this.salaryType.allowancesValue = "") |
832 | // }); | 829 | // }); |
833 | // // console.log("this.salaryTypeData", this.salaryTypeData); | 830 | // // console.log("this.salaryTypeData", this.salaryTypeData); |
834 | // var totalAllowances = ""; | 831 | // var totalAllowances = ""; |
835 | // this.salaryTypeData.forEach(allowancesValue_ => { | 832 | // this.salaryTypeData.forEach(allowancesValue_ => { |
836 | // if (allowancesValue_.allowancesValue != "") { | 833 | // if (allowancesValue_.allowancesValue != "") { |
837 | // // console.log("allowances", allowancesValue_.allowancesValue); | 834 | // // console.log("allowances", allowancesValue_.allowancesValue); |
838 | // totalAllowances = | 835 | // totalAllowances = |
839 | // Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 836 | // Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
840 | // } | 837 | // } |
841 | // this.grossSalary = | 838 | // this.grossSalary = |
842 | // totalAllowances + Number(this.salaryType.basicSalary); | 839 | // totalAllowances + Number(this.salaryType.basicSalary); |
843 | // }); | 840 | // }); |
844 | // }, | 841 | // }, |
845 | // allowancesAdd() { | 842 | // allowancesAdd() { |
846 | // this.editedItem.allowances.push({ | 843 | // this.editedItem.allowances.push({ |
847 | // allowancesValue: (this.salaryType.allowancesValue = "") | 844 | // allowancesValue: (this.salaryType.allowancesValue = "") |
848 | // }); | 845 | // }); |
849 | // var totalAllowances = ""; | 846 | // var totalAllowances = ""; |
850 | // this.editedItem.allowances.forEach(allowancesValue_ => { | 847 | // this.editedItem.allowances.forEach(allowancesValue_ => { |
851 | // if (allowancesValue_.allowancesValue != "") { | 848 | // if (allowancesValue_.allowancesValue != "") { |
852 | // // console.log("allowances", allowancesValue_.allowancesValue); | 849 | // // console.log("allowances", allowancesValue_.allowancesValue); |
853 | // totalAllowances = | 850 | // totalAllowances = |
854 | // Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 851 | // Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
855 | // console.log("totalAllowances", totalAllowances); | 852 | // console.log("totalAllowances", totalAllowances); |
856 | // } | 853 | // } |
857 | // this.editedItem.grossSalary = | 854 | // this.editedItem.grossSalary = |
858 | // totalAllowances + Number(this.editedItem.basicSalary); | 855 | // totalAllowances + Number(this.editedItem.basicSalary); |
859 | // console.log("this.editedItem.grossSalary", this.editedItem.grossSalary); | 856 | // console.log("this.editedItem.grossSalary", this.editedItem.grossSalary); |
860 | // }); | 857 | // }); |
861 | // }, | 858 | // }, |
862 | // selectDeduction() { | 859 | // selectDeduction() { |
863 | // this.salaryTypeDeductionData.push({ | 860 | // this.salaryTypeDeductionData.push({ |
864 | // deductionValue: (this.salaryType.deductionValue = "") | 861 | // deductionValue: (this.salaryType.deductionValue = "") |
865 | // }); | 862 | // }); |
866 | // var totalDeductions = ""; | 863 | // var totalDeductions = ""; |
867 | // this.salaryTypeDeductionData.forEach(deductionValue_ => { | 864 | // this.salaryTypeDeductionData.forEach(deductionValue_ => { |
868 | // if (deductionValue_.deductionValue != "") { | 865 | // if (deductionValue_.deductionValue != "") { |
869 | // // console.log("deduction", deductionValue_.deductionValue); | 866 | // // console.log("deduction", deductionValue_.deductionValue); |
870 | // totalDeductions = | 867 | // totalDeductions = |
871 | // Number(totalDeductions) + Number(deductionValue_.deductionValue); | 868 | // Number(totalDeductions) + Number(deductionValue_.deductionValue); |
872 | // } | 869 | // } |
873 | // }); | 870 | // }); |
874 | // }, | 871 | // }, |
875 | // deductionAdd() { | 872 | // deductionAdd() { |
876 | // this.editedItem.deduction.push({ | 873 | // this.editedItem.deduction.push({ |
877 | // deductionValue: (this.salaryType.deductionValue = "") | 874 | // deductionValue: (this.salaryType.deductionValue = "") |
878 | // }); | 875 | // }); |
879 | // var totalDeductions = ""; | 876 | // var totalDeductions = ""; |
880 | // this.editedItem.deduction.forEach(deductionValue_ => { | 877 | // this.editedItem.deduction.forEach(deductionValue_ => { |
881 | // if (deductionValue_.deductionValue != "") { | 878 | // if (deductionValue_.deductionValue != "") { |
882 | // // console.log("deduction", deductionValue_.deductionValue); | 879 | // // console.log("deduction", deductionValue_.deductionValue); |
883 | // totalDeductions = | 880 | // totalDeductions = |
884 | // Number(totalDeductions) + Number(deductionValue_.deductionValue); | 881 | // Number(totalDeductions) + Number(deductionValue_.deductionValue); |
885 | // console.log("this.totalDeductions", totalDeductions); | 882 | // console.log("this.totalDeductions", totalDeductions); |
886 | // } | 883 | // } |
887 | // // this.editedItem.totalDeduction = totalDeductions; | 884 | // // this.editedItem.totalDeduction = totalDeductions; |
888 | // // console.log("this.totalDeduction", this.editedItem.totalDeduction); | 885 | // // console.log("this.totalDeduction", this.editedItem.totalDeduction); |
889 | // }); | 886 | // }); |
890 | // }, | 887 | // }, |
891 | // deleteSelectAllowances: function(index) { | 888 | // deleteSelectAllowances: function(index) { |
892 | // this.salaryTypeData.splice(index, 1); | 889 | // this.salaryTypeData.splice(index, 1); |
893 | // }, | 890 | // }, |
894 | // deleteallowancesAdd: function(index) { | 891 | // deleteallowancesAdd: function(index) { |
895 | // this.editedItem.allowances.splice(index, 1); | 892 | // this.editedItem.allowances.splice(index, 1); |
896 | // }, | 893 | // }, |
897 | // deleteSelectDeduction: function(index) { | 894 | // deleteSelectDeduction: function(index) { |
898 | // this.salaryTypeDeductionData.splice(index, 1); | 895 | // this.salaryTypeDeductionData.splice(index, 1); |
899 | // }, | 896 | // }, |
900 | // deletedeductionAdd: function(index) { | 897 | // deletedeductionAdd: function(index) { |
901 | // this.editedItem.deduction.splice(index, 1); | 898 | // this.editedItem.deduction.splice(index, 1); |
902 | // }, | 899 | // }, |
903 | // clear() { | 900 | // clear() { |
904 | // this.$refs.form.reset(); | 901 | // this.$refs.form.reset(); |
905 | // this.disable = false; | 902 | // this.disable = false; |
906 | // } | 903 | // } |
907 | }, | 904 | }, |
908 | 905 | ||
909 | mounted() { | 906 | mounted() { |
910 | this.token = this.$store.state.token; | 907 | this.token = this.$store.state.token; |
911 | this.getRole(); | 908 | this.getRole(); |
912 | this.getSalaryList(); | 909 | this.getSalaryList(); |
913 | this.getHourlyList(); | 910 | this.getHourlyList(); |
914 | } | 911 | }, |