Blame view
src/pages/Account/paymentHistory.vue
8.69 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 |
<v-container fluid class="body-color"> |
acb6c9e2b
|
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<!-- ****** Edit Payment History ****** --> <v-dialog v-model="editPaymentDialog" max-width="400px"> <v-card flat class="card-style pa-2" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">Edit Payment History</label> <v-icon size="24" class="right" @click="editPaymentDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-form ref="form"> <v-container fluid> <v-flex xs12 sm12> <v-layout> <v-flex xs3 class="pt-4 subheading"> <label class="right">Amount:</label> </v-flex> <v-flex xs8 sm7 class="ml-3"> <v-text-field v-model="editedItem.totalPaidAmount" placeholder="please fill this field" ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12 sm12> <v-layout> <v-flex xs3 class="pt-4 subheading"> <label class="right">Method:</label> </v-flex> <v-flex xs8 sm7 class="ml-3"> <v-select :items="paymentMethod" v-model="editedItem.paymentMethod" label="please fill this field" required ></v-select> </v-flex> </v-layout> </v-flex> <v-layout> <v-flex xs12> <v-layout> <v-spacer></v-spacer> <v-btn round dark @click="save" class="add-button">Update Payment History</v-btn> <v-spacer></v-spacer> </v-layout> </v-flex> </v-layout> </v-container> </v-form> </v-card> </v-dialog> <!-- ****** PAYMENT HISTORY TABLE ****** --> |
68d742034
|
57 58 59 60 61 |
<v-toolbar color="transparent" flat> <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
|
62 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
63 64 65 66 |
</v-avatar> </v-btn> </v-card-title> <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> |
687e0b929
|
67 |
<v-layout> |
68d742034
|
68 69 |
<v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> <v-icon @click="closeSearch" color="error">close</v-icon> |
687e0b929
|
70 |
</v-layout> |
68d742034
|
71 72 |
</v-flex> </v-toolbar> |
687e0b929
|
73 74 75 76 77 78 79 |
<v-data-table :headers="headers" :items="paymentHistory" :pagination.sync="pagination" :search="search" > <template slot="items" slot-scope="props"> |
68d742034
|
80 |
<tr class="tr"> |
acb6c9e2b
|
81 82 |
<td class="td td-row">{{ props.index + 1 }}</td> <td class="td td-row text-xs-center">{{ props.item.studentId.name }}</td> |
68d742034
|
83 |
<td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td> |
acb6c9e2b
|
84 |
<td class="td td-row text-xs-center">{{ props.item.feeType.feeTypeName }}</td> |
68d742034
|
85 |
<td class="td td-row text-xs-center">{{ props.item.paymentMethod }}</td> |
0e46192a0
|
86 |
<td class="td td-row text-xs-center">{{ props.item.feeType.paidAmount }}</td> |
68d742034
|
87 |
<td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> |
acb6c9e2b
|
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
<td class="td td-row text-xs-center"> <span> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png" /> <span>Edit</span> </v-tooltip> <v-tooltip top> <img slot="activator" style="cursor:pointer;width:20px; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png" /> <span>Delete</span> </v-tooltip> </span> </td> |
68d742034
|
112 |
</tr> |
687e0b929
|
113 114 115 116 117 118 119 120 121 122 123 |
</template> <v-alert slot="no-results" :value="true" color="error" icon="warning" >Your search for "{{ search }}" found no results.</v-alert> </v-data-table> <div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
68d742034
|
124 |
</v-container> |
687e0b929
|
125 126 127 128 129 130 131 132 |
</template> <script> import http from "@/Services/http.js"; import moment from "moment"; export default { data: () => ({ |
acb6c9e2b
|
133 |
snackbar: false, |
687e0b929
|
134 135 |
showLoader: false, search: "", |
68d742034
|
136 137 |
show: true, showSearch: false, |
687e0b929
|
138 |
pagination: { |
68d742034
|
139 |
rowsPerPage: 10 |
687e0b929
|
140 |
}, |
acb6c9e2b
|
141 |
paymentMethod: ["Cash", "Cheque"], |
687e0b929
|
142 143 144 |
headers: [ { text: "No", |
68d742034
|
145 |
align: "", |
687e0b929
|
146 147 148 |
sortable: false, value: "No" }, |
acb6c9e2b
|
149 150 151 152 153 154 |
{ text: "Student", value: "name", sortable: false, align: "center" }, |
687e0b929
|
155 |
{ text: "Class", value: "class", sortable: false, align: "center" }, |
ab54b5656
|
156 157 158 159 160 161 162 163 164 165 166 167 |
{ text: "Fee Type", value: "feeTypeName", sortable: false, align: "center" }, { text: "Method", value: "paymentMethod", sortable: false, align: "center" }, |
687e0b929
|
168 169 170 171 172 173 174 175 176 177 178 |
{ text: "Paid Amount", value: "totalPaidAmount", sortable: false, align: "center" }, { text: "Date", value: "date", sortable: false, align: "center" |
acb6c9e2b
|
179 180 |
}, { text: "Action", value: "", sortable: false, align: "center" } |
687e0b929
|
181 |
], |
68d742034
|
182 |
paymentHistory: [], |
acb6c9e2b
|
183 184 185 |
addPaymentHistoryDialog: "", editPaymentDialog: false, editedItem: {} |
687e0b929
|
186 187 |
}), methods: { |
acb6c9e2b
|
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
editItem(item) { this.editedIndex = this.paymentHistory.indexOf(item); this.editedItem = Object.assign({}, item); this.editPaymentDialog = true; }, deleteItem(item) { let deleteGrade = { invoiceId: item._id, feeTypeId: item.feeType._id, }; http() .put( "/deleteFeeType", confirm("Are you sure you want to delete this?") && deleteGrade, { headers: { Authorization: "Bearer " + this.token } } ) .then(response => { this.snackbar = true; // this.text = "Successfully Delete Salary "; this.text = response.data.message; this.color = "green"; this.getPaymentHistory(); }) .catch(error => { console.log("error", error); this.snackbar = true; this.text = error.response.data.message; this.color = "red"; }); }, |
687e0b929
|
223 224 225 226 227 228 229 |
dates: function(date) { return moment(date).format("MMMM DD, YYYY"); }, getPaymentHistory() { this.showLoader = true; var token = this.$store.state.token; http() |
acb6c9e2b
|
230 |
.get("/getPaymentHistory", { |
99cd79184
|
231 232 233 234 |
params: { paymentStatus: "FULLY_PAID", schoolId: this.$store.state.schoolId }, |
687e0b929
|
235 236 237 238 239 240 241 242 243 244 245 246 |
headers: { Authorization: "Bearer " + token } }) .then(response => { this.paymentHistory = response.data.data; this.showLoader = false; }) .catch(error => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); |
00e4bc4e1
|
247 |
this.$store.dispatch("Role", null); |
687e0b929
|
248 249 |
} }); |
68d742034
|
250 |
}, |
acb6c9e2b
|
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 |
save() { var updatePayment = { invoiceId: this.editedItem._id, feeTypeId: this.editedItem.feeType._id, paidAmount: this.editedItem.totalPaidAmount, paymentMethod: this.editedItem.paymentMethod }; http() .put("/updateFeeType", updatePayment, { headers: { Authorization: "Bearer " + this.token } }) .then(response => { this.getPaymentHistory(); this.snackbar = true; this.text = response.data.message; this.color = "green"; this.editPaymentDialog = false; }) .catch(error => { console.log("error", error); this.snackbar = true; this.color = "red"; }); }, |
68d742034
|
277 278 279 280 281 282 283 |
displaySearch() { (this.show = false), (this.showSearch = true); }, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
687e0b929
|
284 |
} |
687e0b929
|
285 286 |
}, mounted() { |
acb6c9e2b
|
287 |
this.token = this.$store.state.token; |
687e0b929
|
288 |
this.getPaymentHistory(); |
687e0b929
|
289 290 |
} }; |
68d742034
|
291 |
</script> |