Blame view
src/pages/Account/feeTypes.vue
14.3 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 3 |
<v-container fluid class="body-color"> <!-- ****** EDIT SECTION ****** --> |
db965de89
|
4 |
<v-dialog v-model="editFeeTypeDialog" max-width="600px" persistent> |
4dd422bef
|
5 |
<v-card flat class="Card-style pa-2"> |
68d742034
|
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<v-layout> <v-flex xs12> <label class="title text-xs-center">Edit Fee Type</label> <v-icon size="24" class="right" @click="editFeeTypeDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-container fluid> <v-layout wrap justify-center> <v-flex xs12 sm11> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Fee Type:</label> </v-flex> <v-flex xs8> <v-text-field class="ml-3" v-model="editedItem.feeType" placeholder="fill your Fee Type" required ></v-text-field> |
99cd79184
|
26 27 |
</v-flex> </v-layout> |
68d742034
|
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Note:</label> </v-flex> <v-flex xs8> <v-textarea name="input-7-1" class="ml-3" v-model="editedItem.note" placeholder="fill your Note" multi-line required ></v-textarea> </v-flex> </v-layout> |
8e8d14254
|
43 |
<v-card-actions class="hidden-xs-only hidden-sm-only"> |
68d742034
|
44 45 46 |
<v-spacer></v-spacer> <v-btn round dark @click="save" class="add-button">Save</v-btn> </v-card-actions> |
8e8d14254
|
47 |
<v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
68d742034
|
48 49 50 51 52 53 54 55 56 |
<v-spacer></v-spacer> <v-btn round dark @click="save" class="add-button">Save</v-btn> <v-spacer></v-spacer> </v-card-actions> </v-flex> </v-layout> </v-container> </v-card> </v-dialog> |
687e0b929
|
57 |
|
68d742034
|
58 |
<!-- ****** PROFILE VIEW FEE TYPE DATA ****** --> |
687e0b929
|
59 |
|
db965de89
|
60 |
<v-dialog v-model="viewFeeTypeDialog" max-width="400px" persistent> |
4dd422bef
|
61 |
<v-card flat class="Card-style pa-3"> |
68d742034
|
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 |
<v-layout> <v-flex xs12> <label class="title text-xs-center">View Fee Type</label> <v-icon size="24" class="right" @click="viewFeeTypeDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-container grid-list-md> <v-layout wrap> <v-flex> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Fee Type:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.feeType }}</h5> </v-flex> </v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Note:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.note }}</h5> </v-flex> </v-layout> </v-flex> </v-layout> </v-container> </v-card> </v-dialog> |
687e0b929
|
96 |
|
68d742034
|
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
<!-- ****** EXISTING-FEETYPE 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="addFeeTypeDialog = true" > <v-icon dark>add</v-icon> </v-btn> <v-btn round class="open-dialog-button hidden-sm-only hidden-xs-only" dark @click="addFeeTypeDialog = true" > <v-icon class="white--text pr-1" size="20">add</v-icon>Add Fee Type </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"> |
aa310d61a
|
120 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
121 122 123 |
</v-avatar> </v-btn> </v-card-title> |
612b79bb4
|
124 |
<v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
68d742034
|
125 |
<v-layout> |
8e8d14254
|
126 127 128 129 130 131 132 |
<v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary" ></v-text-field> |
68d742034
|
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
<v-icon @click="closeSearch" color="error">close</v-icon> </v-layout> </v-flex> </v-toolbar> <v-data-table :headers="headers" :items="feeTypeList" :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="text-xs-center td td-row">{{ props.item.feeType }}</td> <td class="text-xs-center td td-row">{{ props.item.note }}</td> <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> --> |
687e0b929
|
149 |
|
68d742034
|
150 151 152 153 154 155 156 157 |
<td class="text-xs-center td td-row"> <!-- <span> --> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:25px; height:25px; " class="mr-3" @click="profile(props.item)" |
aa310d61a
|
158 |
src="/static/icon/view.png" |
68d742034
|
159 160 161 162 163 164 165 166 167 |
/> <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)" |
aa310d61a
|
168 |
src="/static/icon/edit.png" |
68d742034
|
169 170 171 172 173 174 175 176 177 |
/> <span>Edit</span> </v-tooltip> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:20px; " @click="deleteItem(props.item)" class="mr-3" |
aa310d61a
|
178 |
src="/static/icon/delete.png" |
68d742034
|
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
/> <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> |
687e0b929
|
193 |
|
68d742034
|
194 |
<!-- ****** ADD Fee Type ****** --> |
db965de89
|
195 |
<v-dialog v-model="addFeeTypeDialog" max-width="500px" v-if="addFeeTypeDialog" persistent> |
4dd422bef
|
196 |
<v-card flat class="Card-style pa-2"> |
68d742034
|
197 198 199 |
<v-layout> <v-flex xs12> <label class="title text-xs-center">Add Fee Type</label> |
8e8d14254
|
200 |
<v-icon size="24" class="right" @click="closeAddFeeTypeModel">cancel</v-icon> |
68d742034
|
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
</v-flex> </v-layout> <v-container fluid fill-height> <v-layout align-center> <v-flex xs12 class="mt-4"> <v-form ref="form" v-model="valid" lazy-validation> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Fee Type:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field v-model="feeTypeData.feeType" placeholder="fill your Fee Type" type="text" :rules="feetTypeRules" required ></v-text-field> </v-flex> </v-layout> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Note:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-textarea name="input-7-1" v-model="feeTypeData.note" placeholder="fill your Note" type="text" multi-line required ></v-textarea> </v-flex> </v-layout> <!-- <v-layout> |
687e0b929
|
237 238 239 240 241 242 243 244 245 246 247 |
<v-flex xs4 class="pt-4 subheading"> <label class="right">Monthly:</label> </v-flex> <v-flex xs6 class="ml-3"> <v-checkbox v-model="feeTypeData.monthly" :rules="monthlyRules" multi-line required ></v-checkbox> </v-flex> |
68d742034
|
248 249 250 251 252 253 254 255 |
</v-layout>--> <v-layout> <v-flex xs12> <v-card-actions> <v-spacer></v-spacer> <v-btn @click="clear" round dark class="clear-button">clear</v-btn> <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> </v-card-actions> |
687e0b929
|
256 257 |
</v-flex> </v-layout> |
68d742034
|
258 259 260 |
</v-form> </v-flex> </v-layout> |
687e0b929
|
261 |
</v-container> |
68d742034
|
262 263 |
</v-card> </v-dialog> |
687e0b929
|
264 265 266 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
68d742034
|
267 268 269 270 271 272 273 274 275 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> </v-container> |
687e0b929
|
276 277 278 279 |
</template> <script> import http from "@/Services/http.js"; |
687e0b929
|
280 281 282 283 284 285 286 |
export default { data: () => ({ snackbar: false, y: "top", x: "right", mode: "", |
68d742034
|
287 |
timeout: 5000, |
687e0b929
|
288 |
text: "", |
68d742034
|
289 |
color: "", |
687e0b929
|
290 291 292 293 |
showLoader: false, loading: false, date: null, search: "", |
68d742034
|
294 295 |
editFeeTypeDialog: false, viewFeeTypeDialog: false, |
687e0b929
|
296 |
valid: true, |
68d742034
|
297 298 299 |
show: true, showSearch: false, addFeeTypeDialog: false, |
687e0b929
|
300 |
validEdit: true, |
687e0b929
|
301 |
pagination: { |
8e8d14254
|
302 |
rowsPerPage: 10, |
687e0b929
|
303 |
}, |
8e8d14254
|
304 305 306 |
feetTypeRules: [(v) => !!v || " Fee Type Name is required"], monthlyRules: [(v) => !!v || " Select Monthly"], noteRules: [(v) => !!v || " Note is required"], |
687e0b929
|
307 308 309 |
headers: [ { text: "No", |
68d742034
|
310 |
align: "", |
687e0b929
|
311 |
sortable: false, |
8e8d14254
|
312 |
value: "No", |
687e0b929
|
313 314 315 316 317 |
}, { text: "fee Type", value: "feeType", sortable: false, |
8e8d14254
|
318 |
align: "center", |
687e0b929
|
319 320 321 |
}, { text: "Note", value: "note", sortable: false, align: "center" }, // { text: "Session", value: "session", sortable: false, align: "center" }, |
8e8d14254
|
322 |
{ text: "Action", value: "", sortable: false, align: "center" }, |
687e0b929
|
323 324 325 326 327 |
], feeTypeList: [], select: "", token: "", editedItem: {}, |
8e8d14254
|
328 |
feeTypeData: {}, |
687e0b929
|
329 |
}), |
8e8d14254
|
330 331 332 333 334 335 336 |
watch: { addFeeTypeDialog: function (val) { if (!val) { this.feeTypeData = []; } }, }, |
687e0b929
|
337 338 339 340 341 |
methods: { getFeeTypeList() { this.showLoader = true; http() .get("/getFeesList", { |
99cd79184
|
342 |
params: { schoolId: this.$store.state.schoolId }, |
8e8d14254
|
343 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
344 |
}) |
8e8d14254
|
345 |
.then((response) => { |
687e0b929
|
346 347 |
this.feeTypeList = response.data.data; this.showLoader = false; |
687e0b929
|
348 |
}) |
8e8d14254
|
349 |
.catch((error) => { |
687e0b929
|
350 351 352 353 354 |
this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); |
00e4bc4e1
|
355 |
this.$store.dispatch("Role", null); |
687e0b929
|
356 357 358 359 360 361 |
} }); }, editItem(item) { this.editedIndex = this.feeTypeList.indexOf(item); this.editedItem = Object.assign({}, item); |
68d742034
|
362 |
this.editFeeTypeDialog = true; |
687e0b929
|
363 364 365 366 |
}, profile(item) { this.editedIndex = this.feeTypeList.indexOf(item); this.editedItem = Object.assign({}, item); |
68d742034
|
367 |
this.viewFeeTypeDialog = true; |
687e0b929
|
368 369 |
}, deleteItem(item) { |
006544386
|
370 |
let deleteFeeType = { |
8e8d14254
|
371 |
feeId: item._id, |
687e0b929
|
372 373 374 375 376 |
}; http() .delete( "/deleteFee", confirm("Are you sure you want to delete this?") && { |
8e8d14254
|
377 |
params: deleteFeeType, |
687e0b929
|
378 379 |
} ) |
8e8d14254
|
380 |
.then((response) => { |
68d742034
|
381 382 383 |
this.snackbar = true; this.text = response.data.message; this.color = "green"; |
687e0b929
|
384 385 |
this.getFeeTypeList(); }) |
8e8d14254
|
386 |
.catch((error) => { |
68d742034
|
387 388 389 |
this.snackbar = true; this.color = "error"; this.text = error.response.data.message; |
687e0b929
|
390 391 |
}); }, |
687e0b929
|
392 393 |
close() { this.dialog = false; |
687e0b929
|
394 395 396 397 398 399 400 |
}, close1() { this.dialog1 = false; }, close2() { this.dialog2 = false; }, |
8e8d14254
|
401 402 403 404 |
closeAddFeeTypeModel() { this.addFeeTypeDialog = false; this.feeTypeData = []; }, |
687e0b929
|
405 406 407 |
submit() { if (this.$refs.form.validate()) { this.loading = true; |
99cd79184
|
408 |
this.schoolId = this.$store.state.schoolId; |
687e0b929
|
409 410 |
http() .post("/createFee", this.feeTypeData) |
8e8d14254
|
411 |
.then((response) => { |
687e0b929
|
412 |
this.getFeeTypeList(); |
99cd79184
|
413 |
this.snackbar = true; |
68d742034
|
414 415 |
this.text = response.data.message; this.color = "green"; |
687e0b929
|
416 |
this.clear(); |
68d742034
|
417 |
this.addFeeTypeDialog = false; |
687e0b929
|
418 419 |
this.loading = false; }) |
8e8d14254
|
420 |
.catch((error) => { |
687e0b929
|
421 |
// console.log(error); |
99cd79184
|
422 |
this.snackbar = true; |
68d742034
|
423 |
this.color = "error"; |
99cd79184
|
424 |
this.text = error.response.data.message; |
687e0b929
|
425 426 427 428 429 430 431 432 433 434 435 |
this.loading = false; }); } }, clear() { this.$refs.form.reset(); }, save() { this.editedItem.feeId = this.editedItem._id; http() .put("/updateFee", this.editedItem) |
8e8d14254
|
436 |
.then((response) => { |
68d742034
|
437 438 439 |
this.snackbar = true; this.text = response.data.message; this.color = "green"; |
687e0b929
|
440 |
this.getFeeTypeList(); |
acb6c9e2b
|
441 |
this.editFeeTypeDialog = false; |
687e0b929
|
442 443 |
this.close(); }) |
8e8d14254
|
444 |
.catch((error) => { |
68d742034
|
445 446 |
this.snackbar = true; this.color = "error"; |
687e0b929
|
447 |
this.text = error.response.data.message; |
687e0b929
|
448 |
}); |
68d742034
|
449 450 451 452 453 454 455 456 |
}, displaySearch() { (this.show = false), (this.showSearch = true); }, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
8e8d14254
|
457 |
}, |
687e0b929
|
458 459 460 461 |
}, mounted() { this.token = this.$store.state.token; this.getFeeTypeList(); |
8e8d14254
|
462 |
}, |
687e0b929
|
463 |
}; |
68d742034
|
464 |
</script> |