Blame view
src/pages/Account/invoice.vue
40.6 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 |
<v-container fluid class="body-color"> |
81d876b5d
|
3 4 5 6 7 8 9 10 11 |
<!-- ****** Edit INVOICE ****** --> <v-dialog v-model="editInvoiceDialog"> <v-card flat class="text-xs-center white--text"> <v-layout> <v-flex xs12 class="card-styles pa-2"> <label class="title text-xs-center">Edit Invoice</label> <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon> </v-flex> </v-layout> |
88868752b
|
12 |
<editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" /> |
81d876b5d
|
13 14 15 16 17 18 19 20 21 22 23 24 |
</v-card> </v-dialog> <!-- ****PAYMENT INVOICE DIALOG --> <v-dialog v-model="paymentInvoiceDialog"> <v-card flat class="text-xs-center white--text"> <v-layout> <v-flex xs12 class="card-styles pa-2"> <label class="title text-xs-center">Payment Template</label> <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon> </v-flex> </v-layout> |
e03bf1f92
|
25 |
<paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" /> |
81d876b5d
|
26 27 28 29 |
</v-card> </v-dialog> <!-- ****** PROFILE VIEW SECTION DATA ****** --> |
c765369af
|
30 |
|
81d876b5d
|
31 32 33 34 35 36 37 38 |
<v-dialog v-model="dialog1" max-width="800px"> <v-card flat class="text-xs-center white--text"> <v-layout> <v-flex xs12 class="card-style pa-2"> <label class="title text-xs-center">View Payments</label> <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon> </v-flex> </v-layout> |
c62132b75
|
39 |
<table class="feeTypeTable tableRsponsive"> |
81d876b5d
|
40 41 42 43 44 45 46 47 |
<tr style="color: black"> <th>#</th> <th>Date</th> <th>Paid By</th> <th>Payment Amount</th> <th>Weaver</th> <th>Action</th> </tr> |
abce86599
|
48 |
<tr v-if="editedItem.paymentStatus != 'NOT_PAID'"> |
b9759239c
|
49 50 51 |
<td style="width:40px ; color:black" class="tdFeeType">1</td> <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td> <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td> |
b3860f8e6
|
52 |
<td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td> |
b9759239c
|
53 |
<td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td> |
81d876b5d
|
54 55 56 57 |
<td class="text-xs-center td td-row"> <router-link :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }" > |
c62132b75
|
58 |
<v-tooltip top> |
81d876b5d
|
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
<img slot="activator" style="cursor:pointer; width:25px; height:25px; " class="mr-3" src="/static/icon/view.png" /> <span>View</span> </v-tooltip> </router-link> <v-tooltip top> <img slot="activator" style="cursor:pointer;width:20px; height:20px; " class="mr-3" |
b3860f8e6
|
73 |
@click="deletePayment(editedItem)" |
81d876b5d
|
74 75 76 77 78 79 |
src="/static/icon/delete.png" /> <span>Delete</span> </v-tooltip> </td> </tr> |
abce86599
|
80 81 82 83 84 85 86 87 |
<tr v-if="editedItem.paymentStatus == 'NOT_PAID'"> <td style="width:40px ; color:black" class="tdFeeType'">-</td> <td style="width:120px; color:black" class="tdFeeType">-</td> <td style="width:120px; color:black" class="tdFeeType">-</td> <td style="width:120px; color:black" class="tdFeeType">-</td> <td style="width:120px; color:black" class="tdFeeType">-</td> <td class="text-xs-center td td-row"></td> </tr> |
b9759239c
|
88 |
</table> |
68d742034
|
89 |
</v-card> |
81d876b5d
|
90 |
</v-dialog> |
687e0b929
|
91 |
|
b9759239c
|
92 |
<!-- ****** Invoice Table ****** --> |
68d742034
|
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
<v-toolbar color="transparent" flat> <v-btn fab dark class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" small @click="addInvoiceDialog = true" > <v-icon dark>add</v-icon> </v-btn> <v-btn round class="open-dialog-button hidden-sm-only hidden-xs-only" dark @click="addInvoiceDialog = true" > <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice </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
|
115 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
116 117 118 |
</v-avatar> </v-btn> </v-card-title> |
612b79bb4
|
119 |
<v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
68d742034
|
120 |
<v-layout> |
8e8d14254
|
121 122 123 124 125 126 127 |
<v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary" ></v-text-field> |
68d742034
|
128 129 130 131 132 133 134 135 136 137 138 139 140 |
<v-icon @click="closeSearch" color="error">close</v-icon> </v-layout> </v-flex> </v-toolbar> <v-data-table :headers="headers" :items="invoiceList" :pagination.sync="pagination" :search="search" > <template slot="items" slot-scope="props"> <tr class="tr"> <td class="td td-row">{{ props.index + 1 }}</td> |
81d876b5d
|
141 |
<td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td> |
68d742034
|
142 143 |
<td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td> <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td> |
c62132b75
|
144 |
<td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td> |
68d742034
|
145 146 147 148 149 |
<td class="text-xs-center td td-row" >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td> <td class="text-xs-center td td-row" |
81d876b5d
|
150 |
>{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td> |
68d742034
|
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
<td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'"> <span class="red lighten-1 py-1 px-2 white--text paymentStatus" >{{ props.item.paymentStatus }}</span> </td> <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'"> <span class="green lighten-1 py-1 px-2 white--text paymentStatus" >{{ props.item.paymentStatus }}</span> </td> <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> <span class="yellow darken-3 py-1 px-2 white--text paymentStatus" >{{ props.item.paymentStatus }}</span> </td> <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> <td class="text-xs-center td td-row"> |
aa310d61a
|
168 |
<router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }"> |
68d742034
|
169 170 171 172 173 |
<v-tooltip top> <img slot="activator" style="cursor:pointer; width:25px; height:25px; " class="mr-3" |
aa310d61a
|
174 |
src="/static/icon/view.png" |
68d742034
|
175 176 177 178 179 |
/> <span>View</span> </v-tooltip> </router-link> <span v-if="props.item.paymentStatus === 'NOT_PAID'"> |
c62132b75
|
180 181 182 183 184 185 186 187 188 189 190 191 |
<!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }"> <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> </router-link>--> |
81d876b5d
|
192 193 194 195 196 197 198 199 200 201 |
<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> |
68d742034
|
202 203 204 205 206 207 |
<v-tooltip top> <img slot="activator" style="cursor:pointer;width:20px; height:20px; " class="mr-3" @click="deleteItem(props.item)" |
aa310d61a
|
208 |
src="/static/icon/delete.png" |
68d742034
|
209 210 211 |
/> <span>Delete</span> </v-tooltip> |
81d876b5d
|
212 213 214 215 216 217 218 219 220 221 |
<v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:18px; " class="mr-3" @click="paymentItem(props.item)" src="/static/schoolIcons/Account.png" /> <span>Payment</span> </v-tooltip> |
68d742034
|
222 |
</span> |
81d876b5d
|
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
<span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:18px; " class="mr-3" @click="paymentItem(props.item)" src="/static/schoolIcons/Account.png" /> <span>Payment</span> </v-tooltip> </span> <v-tooltip top> <img slot="activator" |
ff30cbe86
|
238 |
style="cursor:pointer; width:18px; height:17px;" |
81d876b5d
|
239 240 241 242 243 |
@click="profile(props.item)" src="/static/icon/eye1.png" /> <span>View Payment</span> </v-tooltip> |
68d742034
|
244 245 246 247 248 249 250 251 252 253 |
</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> |
b9759239c
|
254 |
|
68d742034
|
255 |
<!-- ****** ADD INVOICE ****** --> |
81d876b5d
|
256 257 258 259 260 261 262 263 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> |
8e8d14254
|
264 |
<v-dialog v-model="addInvoiceDialog" v-if="addInvoiceDialog"> |
68d742034
|
265 266 |
<v-card flat class="text-xs-center white--text"> <v-layout> |
81d876b5d
|
267 268 |
<v-flex xs12 class="card-styles pa-2"> <label class="title text-xs-center">Add Invoice</label> |
8e8d14254
|
269 |
<v-icon size="24" class="right white--text" @click="closeAddInvoiceModel">cancel</v-icon> |
68d742034
|
270 271 272 273 274 275 276 277 278 |
</v-flex> </v-layout> <v-flex xs12 sm12> <v-container fluid grid-list-md> <v-layout wrap> <v-flex xs12 sm12 md5> <v-card flat> <v-toolbar dark class="card-styles" flat> <v-spacer></v-spacer> |
81d876b5d
|
279 |
<h3>Invoice</h3> |
68d742034
|
280 281 282 |
<v-spacer></v-spacer> </v-toolbar> <v-form ref="form" v-model="valid" lazy-validation class="py-4"> |
687e0b929
|
283 |
<v-layout> |
68d742034
|
284 285 286 |
<v-flex xs4 class="pt-4 subheading"> <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
687e0b929
|
287 |
</v-flex> |
68d742034
|
288 289 290 291 292 293 294 295 296 297 298 |
<v-flex xs6 class="ml-3"> <v-select :items="addclass" label="Select Class" v-model="invoiceData.classNum" item-text="classNum" item-value="_id" @change="getAllStudents()" :rules="classRules" required ></v-select> |
687e0b929
|
299 300 301 |
</v-flex> </v-layout> <v-layout> |
68d742034
|
302 303 304 |
<v-flex xs4 class="pt-4 subheading"> <label class="right hidden-xs-only hidden-sm-only">Select Student:</label> <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label> |
687e0b929
|
305 |
</v-flex> |
68d742034
|
306 307 308 309 310 311 312 313 314 315 316 |
<v-flex xs6 class="ml-3"> <v-select :items="studentList" label="Select Student" v-model="invoiceData.studentId" item-text="name" item-value="_id" :rules="inchargeRules" @change="selectAllStudent()" required ></v-select> |
687e0b929
|
317 318 319 |
</v-flex> </v-layout> <v-layout> |
68d742034
|
320 321 |
<v-flex xs4 class="pt-4 subheading"> <label class="right">Date:</label> |
687e0b929
|
322 |
</v-flex> |
68d742034
|
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
<v-flex xs6 class="ml-3"> <v-menu ref="menu1" :close-on-content-click="false" v-model="menu1" :nudge-right="40" lazy :return-value.sync="invoiceData.date" transition="scale-transition" offset-y full-width min-width="290px" > <v-text-field slot="activator" :rules="dateRules" v-model="invoiceData.date" placeholder="Select date" ></v-text-field> <v-date-picker v-model="invoiceData.date" @input="$refs.menu1.save(invoiceData.date)" ></v-date-picker> </v-menu> |
687e0b929
|
347 348 349 |
</v-flex> </v-layout> <v-layout> |
68d742034
|
350 351 352 |
<v-flex xs4 class="pt-4 subheading"> <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label> <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label> |
687e0b929
|
353 |
</v-flex> |
68d742034
|
354 355 356 357 358 359 360 361 362 363 364 |
<v-flex xs6 class="ml-3"> <v-select :items="paymentStatus" v-model="invoiceData.paymentStatus" item-text="name" item-value="value" label="Select Payment Status" @change="getPayMethodList" :rules="paymentStatusRules" required ></v-select> |
687e0b929
|
365 366 |
</v-flex> </v-layout> |
68d742034
|
367 368 369 |
<v-layout v-show="showPayMethods"> <v-flex xs4 class="pt-4 subheading"> <label class="right">Payment Method:</label> |
687e0b929
|
370 |
</v-flex> |
68d742034
|
371 |
<v-flex xs6 class="ml-3"> |
687e0b929
|
372 |
<v-select |
68d742034
|
373 374 |
:items="paymentMethods" v-model="invoiceData.paymentMethod" |
728b5d417
|
375 |
:rules="paymentMethodRules" |
68d742034
|
376 377 |
label="Select Payment Method" required |
687e0b929
|
378 379 |
></v-select> </v-flex> |
68d742034
|
380 381 382 383 384 385 |
</v-layout> <v-layout> <v-flex xs12 sm11> <v-card-actions> <v-spacer></v-spacer> <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
81d876b5d
|
386 387 388 389 390 391 392 |
<v-btn @click="submit" round dark :loading="loading" class="add-button" >Add</v-btn> |
68d742034
|
393 |
</v-card-actions> |
687e0b929
|
394 395 |
</v-flex> </v-layout> |
68d742034
|
396 397 398 399 400 |
</v-form> </v-card> </v-flex> <v-flex xs12 sm12 md7> <v-card> |
81d876b5d
|
401 |
<v-toolbar dark class="card-styles" flat> |
68d742034
|
402 |
<v-spacer></v-spacer> |
81d876b5d
|
403 |
<h3>Fee Type List</h3> |
68d742034
|
404 405 406 407 |
<v-spacer></v-spacer> </v-toolbar> <v-layout> <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only"> |
81d876b5d
|
408 |
<label class="right title">Fee Type:</label> |
68d742034
|
409 410 411 412 413 414 415 416 |
</v-flex> <v-flex xs8 sm4> <v-select :items="feeTypes" v-model="feeType.feeTypeName" item-text="feeType" item-value="feeType" label="Select Fee Type" |
81d876b5d
|
417 |
required |
68d742034
|
418 419 420 |
></v-select> </v-flex> <v-flex xs4 sm6> |
d10c26632
|
421 |
<v-btn round dark class="right add-button" @click="selectFeeType">ADD</v-btn> |
68d742034
|
422 423 424 425 426 427 428 |
</v-flex> </v-layout> <table class="feeTypeTable tableRsponsive"> <tr class="info white--text"> <th>#</th> <th>Fee Type</th> <th>Amount</th> |
ff30cbe86
|
429 |
<th>Discount</th> |
68d742034
|
430 431 432 433 434 435 436 437 438 439 440 |
<th>Subtotal</th> <th>Paid Amount</th> <th>Action</th> </tr> <tr v-show="showFeeType" v-for="(feeType, index) in feeTypeData" :key="index" v-on:keyup="getAmmountDetails(feeType)" > <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td> |
81d876b5d
|
441 442 443 444 445 |
<td style="width:120px" class="tdFeeType" :rules="feeTypeNameRules" >{{ feeType.feeTypeName }}</td> |
68d742034
|
446 447 448 449 450 |
<td class="tdFeeType"> <v-text-field placeholder="fill your Amount" v-model="feeType.amount" type="number" |
81d876b5d
|
451 452 |
:rules="amountRules" required |
68d742034
|
453 454 455 456 457 458 459 |
></v-text-field> </td> <td class="tdFeeType"> <v-text-field placeholder="fill your Discount" v-model="feeType.discount" type="number" |
81d876b5d
|
460 461 |
:rules="discountRules" required |
68d742034
|
462 463 |
></v-text-field> </td> |
81d876b5d
|
464 465 |
<td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td> <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'"> |
68d742034
|
466 467 468 469 470 471 |
<v-text-field placeholder="fill your Paid Amount" v-model="feeType.paidAmount" type="number" :disabled="disabled" ></v-text-field> |
81d876b5d
|
472 |
</td> |
68d742034
|
473 474 475 476 477 478 479 480 481 482 483 |
<td class="tdFeeType" v-if="invoiceData.paymentStatus == ''"> <v-text-field placeholder="fill your Paid Amount" v-model="feeType.paidAmount" type="number" :disabled="disabled" ></v-text-field> </td> <td class="tdFeeType" v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''" |
687e0b929
|
484 |
> |
68d742034
|
485 486 487 488 489 490 491 |
<v-text-field placeholder="fill your Paid Amount" v-model="feeType.paidAmount" type="number" ></v-text-field> </td> <td class="tdFeeType"> |
11f495070
|
492 |
<v-icon color="error" @click="deleteSelectFee(index,feeType)">delete</v-icon> |
68d742034
|
493 494 495 496 497 |
</td> </tr> <tfoot> <tr> <td colspan="2" class="tdFeeType">Total:</td> |
b9759239c
|
498 499 500 501 |
<td class="tdFeeType">{{ feeType.amount }}</td> <td class="tdFeeType">{{ feeType.discount }}</td> <td class="tdFeeType">{{ feeType.subTotal }}</td> <td class="tdFeeType">{{ feeType.paidAmount }}</td> |
11f495070
|
502 |
<!-- <td class="tdFeeType"> |
81d876b5d
|
503 |
<v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon> |
11f495070
|
504 |
</td>--> |
687e0b929
|
505 |
</tr> |
68d742034
|
506 507 508 509 510 511 512 513 514 |
</tfoot> </table> </v-card> </v-flex> </v-layout> </v-container> </v-flex> </v-card> </v-dialog> |
687e0b929
|
515 516 517 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
68d742034
|
518 |
</v-container> |
687e0b929
|
519 520 521 522 |
</template> <script> import http from "@/Services/http.js"; |
88868752b
|
523 |
import editInvoice from "./editInvoice"; |
3e79b2f9f
|
524 |
import paymentTemplate from "./paymentTemplate.vue"; |
687e0b929
|
525 526 527 |
import moment from "moment"; export default { |
88868752b
|
528 |
components: { |
3e79b2f9f
|
529 |
editInvoice: editInvoice, |
8e8d14254
|
530 |
paymentTemplate: paymentTemplate, |
88868752b
|
531 |
}, |
687e0b929
|
532 533 534 535 536 537 |
data: () => ({ snackbar: false, showPayMethods: false, y: "top", x: "right", mode: "", |
d9bb52b5b
|
538 |
timeout: 5000, |
687e0b929
|
539 |
text: "", |
d9bb52b5b
|
540 |
color: "", |
68d742034
|
541 542 |
show: true, showSearch: false, |
687e0b929
|
543 544 545 546 547 548 549 550 551 552 |
showLoader: false, loading: false, date: null, search: "", dialog: false, dialog1: false, valid: true, validEdit: true, isActive: true, newActive: false, |
b9759239c
|
553 |
showFeeType: true, |
68d742034
|
554 |
addInvoiceDialog: false, |
81d876b5d
|
555 556 |
editInvoiceDialog: false, paymentInvoiceDialog: false, |
687e0b929
|
557 558 559 |
disabled: true, details: [], feeTypes: [], |
81d876b5d
|
560 |
invoiceData: [], |
879451281
|
561 |
editData: [], |
b9759239c
|
562 |
invoiceList: [], |
879451281
|
563 564 |
editPayment: { studentId: { |
c62132b75
|
565 |
name: "", |
8e8d14254
|
566 |
rollNo: "", |
879451281
|
567 568 |
}, classId: { |
8e8d14254
|
569 570 |
classNum: "", }, |
879451281
|
571 |
}, |
687e0b929
|
572 573 574 575 576 |
menu1: false, paymentMethods: ["Cash", "Cheque"], feeType: { amount: "0.00", discount: "0.00", |
687e0b929
|
577 |
subTotal: "0.00", |
6df6faccd
![]() |
578 |
paidAmount: "0.00", |
8e8d14254
|
579 |
feeTypeName: "", |
687e0b929
|
580 |
}, |
c62132b75
|
581 |
|
687e0b929
|
582 |
feeTypeData: [], |
88868752b
|
583 584 |
editFeeTypeData: [], paymentFeeTypeData: [], |
687e0b929
|
585 |
pagination: { |
8e8d14254
|
586 |
rowsPerPage: 10, |
687e0b929
|
587 |
}, |
8e8d14254
|
588 589 590 591 592 593 594 595 596 597 598 599 |
classRules: [(v) => !!v || " Class Name is required"], inchargeRules: [(v) => !!v || "Student Name is required"], dateRules: [(v) => !!v || " Date is required"], paymentStatusRules: [(v) => !!v || "Payment Status is required"], paymentMethodsRules: [(v) => !!v || "payment Method is required"], feeTypeRules: [(v) => !!v || "Fee Type is required"], feeTypeNameRules: [(v) => !!v || "Fee Type Name is required"], amountRules: [(v) => !!v || "Amount is required"], discountRules: [(v) => !!v || "Discount is required"], subtotalRules: [(v) => !!v || "Subtotal is required"], paymentRules: [(v) => !!v || "Payment is required"], paidAmountRules: [(v) => !!v || "Paid Amount is required"], |
728b5d417
|
600 |
paymentMethodRules: [], |
687e0b929
|
601 602 603 |
headers: [ { text: "No", |
68d742034
|
604 |
align: "", |
687e0b929
|
605 |
sortable: false, |
8e8d14254
|
606 |
value: "No", |
687e0b929
|
607 |
}, |
81d876b5d
|
608 609 610 611 |
{ text: "Student", value: "name", sortable: false, |
8e8d14254
|
612 |
align: "center", |
81d876b5d
|
613 |
}, |
687e0b929
|
614 615 |
{ text: "Class", value: "class", sortable: false, align: "center" }, { text: "Total", value: "subtotal", sortable: false, align: "center" }, |
c62132b75
|
616 |
{ |
ff30cbe86
|
617 |
text: "Discount", |
c62132b75
|
618 619 |
value: "discount", sortable: false, |
8e8d14254
|
620 |
align: "center", |
c62132b75
|
621 |
}, |
687e0b929
|
622 623 624 625 |
{ text: "Paid Amount", value: "paidAmount", sortable: false, |
8e8d14254
|
626 |
align: "center", |
687e0b929
|
627 628 629 630 631 |
}, { text: "Balance", value: "Balance", sortable: false, |
8e8d14254
|
632 |
align: "center", |
687e0b929
|
633 634 635 636 637 |
}, { text: "Status", value: "paymentStatus", sortable: false, |
8e8d14254
|
638 |
align: "center", |
687e0b929
|
639 640 641 642 643 |
}, { text: "Date", value: "date", sortable: false, |
8e8d14254
|
644 |
align: "center", |
687e0b929
|
645 |
}, |
8e8d14254
|
646 |
{ text: "Action", value: "", sortable: false, align: "center" }, |
687e0b929
|
647 |
], |
b9759239c
|
648 |
|
81d876b5d
|
649 |
studentId: { |
8e8d14254
|
650 |
name: "", |
81d876b5d
|
651 |
}, |
687e0b929
|
652 653 654 |
token: "", editedItem: {}, invoiceData: { |
d45ffc6fa
|
655 |
paymentStatus: "", |
8e8d14254
|
656 |
students: [], |
687e0b929
|
657 658 659 660 661 662 |
}, addclass: [], studentList: [], paymentStatus: [ { name: "Not Paid", |
8e8d14254
|
663 |
value: "NOT_PAID", |
687e0b929
|
664 665 666 |
}, { name: "Partially Paid", |
8e8d14254
|
667 |
value: "PARTIALLY_PAID", |
687e0b929
|
668 669 670 |
}, { name: "Fully Paid", |
8e8d14254
|
671 672 673 |
value: "FULLY_PAID", }, ], |
687e0b929
|
674 |
}), |
8e8d14254
|
675 676 677 678 679 680 681 682 683 684 |
watch: { addInvoiceDialog: function (val) { if (!val) { this.invoiceData = []; this.menu1 = false; this.feeType = []; this.feeTypeData = []; } }, }, |
687e0b929
|
685 686 687 688 |
methods: { save(date) { this.$refs.menu1.save(date); }, |
8e8d14254
|
689 |
dates: function (date) { |
687e0b929
|
690 691 |
return moment(date).format("MMMM DD, YYYY"); }, |
81d876b5d
|
692 |
profile(item) { |
b9759239c
|
693 |
// console.log("item", item); |
81d876b5d
|
694 |
this.editedIndex = this.invoiceList.indexOf(item); |
da153da77
|
695 |
this.editedItem = Object.assign({}, item); |
88868752b
|
696 |
console.log("editedItem", this.editedItem); |
81d876b5d
|
697 698 699 700 |
this.dialog1 = true; }, editItem(item) { this.editedIndex = this.invoiceList.indexOf(item); |
879451281
|
701 |
this.editData = Object.assign({}, item); |
88868752b
|
702 703 704 |
this.editData.date = this.editData.date.slice(0, 10); // console.log("invoiceData", this.editData); this.editFeeTypeData = this.editData.feeType; |
81d876b5d
|
705 706 707 |
this.editInvoiceDialog = true; }, paymentItem(item) { |
879451281
|
708 |
// console.log("item", item); |
81d876b5d
|
709 |
this.editedIndex = this.invoiceList.indexOf(item); |
b9759239c
|
710 |
this.editPayment = Object.assign({}, item); |
3e79b2f9f
|
711 |
this.editPayment.date = this.editPayment.date.slice(0, 10); |
c765369af
|
712 713 714 715 716 717 |
if (this.editPayment.paymentStatus == "NOT_PAID") { for (let i = 0; i < this.editPayment.feeType.length; i++) { this.editPayment.feeType[i].paidAmount = "0.00"; } } // console.log("this.editPayment", this.editPayment); |
88868752b
|
718 |
this.paymentFeeTypeData = this.editPayment.feeType; |
81d876b5d
|
719 720 |
this.paymentInvoiceDialog = true; }, |
687e0b929
|
721 722 |
deleteItem(item) { let deleteInvoice = { |
8e8d14254
|
723 |
invoiceId: item._id, |
687e0b929
|
724 725 726 727 728 |
}; http() .delete( "/deleteInvoice", confirm("Are you sure you want to delete this?") && { |
8e8d14254
|
729 |
params: deleteInvoice, |
687e0b929
|
730 731 |
} ) |
8e8d14254
|
732 |
.then((response) => { |
d9bb52b5b
|
733 734 |
this.snackbar = true; this.text = "Successfully delete Existing Invoice"; |
b3860f8e6
|
735 736 737 738 |
this.color = "green"; this.dialog1 = false; this.getInvoiceList(); }) |
8e8d14254
|
739 |
.catch((error) => { |
b3860f8e6
|
740 741 742 743 744 |
// console.log(error); }); }, deletePayment(editedItem) { let deleteInvoice = { |
8e8d14254
|
745 |
invoiceId: editedItem._id, |
b3860f8e6
|
746 747 |
}; http() |
c62132b75
|
748 749 750 751 752 |
.put( "/removePayment", deleteInvoice, confirm("Are you sure you want to delete this?") && { headers: { |
8e8d14254
|
753 754 |
Authorization: "Bearer " + this.token, }, |
b3860f8e6
|
755 |
} |
c62132b75
|
756 |
) |
8e8d14254
|
757 |
.then((response) => { |
b3860f8e6
|
758 759 |
this.snackbar = true; this.text = "Successfully delete Existing Invoice"; |
d9bb52b5b
|
760 |
this.color = "green"; |
81d876b5d
|
761 |
this.dialog1 = false; |
687e0b929
|
762 763 |
this.getInvoiceList(); }) |
8e8d14254
|
764 |
.catch((error) => { |
687e0b929
|
765 766 767 |
// console.log(error); }); }, |
687e0b929
|
768 769 |
close() { this.dialog = false; |
687e0b929
|
770 |
}, |
8e8d14254
|
771 772 773 774 775 776 777 |
closeAddInvoiceModel() { this.addInvoiceDialog = false; this.invoiceData = []; this.menu1 = false; this.feeType = []; this.feeTypeData = []; }, |
d9bb52b5b
|
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
// totalAmount() { // // console.log("this.feeType.paidAmount ", this.feeType.paidAmount); // // console.log( // // "this.feeType.subTotalAAAAAAAAAAAAAAA ", // // this.feeType.subTotal // // ); // if (this.feeType.paidAmount < this.feeType.subTotal) { // console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal); // this.feeType.paidAmount = this.feeType.subTotal; // console.log( // "this.feeType.paidAmount BBBBBBBBBBB", // this.feeType.paidAmount // ); // } // }, |
687e0b929
|
795 796 797 798 799 800 801 |
submit() { let feeTypeId = ""; for (let i = 0; i < this.feeTypes.length; i++) { if (this.feeTypes[i].feeType === this.feeType.feeTypeName) { feeTypeId = this.feeTypes[i]._id; } } |
88868752b
|
802 803 804 805 806 807 808 809 |
if (this.$refs.form.validate()) { let invoiceData = { classId: this.invoiceData.classNum, students: this.invoiceData.students, date: this.invoiceData.date, paymentStatus: this.invoiceData.paymentStatus, paymentMethod: this.invoiceData.paymentMethod, feeType: this.feeTypeData, |
c765369af
|
810 811 |
totalAmount: this.feeType.amount.toString(), totalDiscount: this.feeType.discount.toString(), |
11f495070
|
812 |
totalSubTotal: this.feeType.subTotal.toString(), |
8e8d14254
|
813 |
totalPaidAmount: this.feeType.paidAmount, |
88868752b
|
814 |
}; |
11f495070
|
815 816 817 818 |
if (invoiceData.paymentStatus == "NOT_PAID") { delete invoiceData.paymentMethod; } |
c765369af
|
819 820 821 |
if (this.feeType.paidAmount != "0.00") { if (this.feeType.subTotal == this.feeType.paidAmount) { invoiceData.paymentStatus = "FULLY_PAID"; |
d650dbf7d
|
822 |
// console.log("FULLY_PAID"); |
c765369af
|
823 824 825 826 |
} if (invoiceData.totalPaidAmount) { if (this.feeType.subTotal != this.feeType.paidAmount) { invoiceData.paymentStatus = "PARTIALLY_PAID"; |
d650dbf7d
|
827 |
// console.log("PARTIALLY_PAID"); |
c765369af
|
828 |
} |
e03bf1f92
|
829 |
} |
11f495070
|
830 831 832 833 834 835 836 837 838 |
} if (invoiceData.totalSubTotal == "0.00") { invoiceData.paymentStatus = "FULLY_PAID"; } else if (invoiceData.totalSubTotal != "0.00") { if (this.feeType.paidAmount === "0.00") { invoiceData.paymentStatus = "NOT_PAID"; delete invoiceData.paymentMethod; } |
e03bf1f92
|
839 |
} |
88868752b
|
840 841 |
http() .post("/createInvoice", invoiceData) |
8e8d14254
|
842 |
.then((response) => { |
88868752b
|
843 844 845 846 847 848 849 850 851 852 853 854 |
this.getInvoiceList(); this.snackbar = true; this.text = "New Invoice added successfully"; this.color = "green"; this.clear(); this.feeTypeData = []; if (this.feeTypeData.length == 0) { this.feeType = { amount: "0.00", discount: "0.00", paidAmount: "0.00", subTotal: "0.00", |
8e8d14254
|
855 |
feeTypeList: "", |
88868752b
|
856 857 858 859 860 |
}; } this.loading = false; this.addInvoiceDialog = false; }) |
8e8d14254
|
861 |
.catch((error) => { |
88868752b
|
862 863 864 865 866 |
this.snackbar = true; this.text = error.response.data.errors[0].messages[0]; this.color = "error"; this.loading = false; }); |
81d876b5d
|
867 |
} |
81d876b5d
|
868 |
}, |
687e0b929
|
869 870 871 872 |
clear() { this.$refs.form.reset(); }, getInvoiceList() { |
6ae46ca27
|
873 |
this.showLoader = true; |
687e0b929
|
874 875 |
http() .get("/getInvoicesList", { |
99cd79184
|
876 |
params: { schoolId: this.$store.state.schoolId }, |
8e8d14254
|
877 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
878 |
}) |
8e8d14254
|
879 |
.then((response) => { |
687e0b929
|
880 881 882 |
this.invoiceList = response.data.data; this.showLoader = false; }) |
8e8d14254
|
883 |
.catch((error) => { |
687e0b929
|
884 885 886 887 888 889 890 891 892 893 894 895 |
// console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } }); }, selectFeeType() { this.showFeeType = true; this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName }); |
687e0b929
|
896 |
}, |
8e8d14254
|
897 |
deleteSelectFee: function (index, feeTyp) { |
11f495070
|
898 |
console.log("---index----", index); |
687e0b929
|
899 |
this.feeTypeData.splice(index, 1); |
11f495070
|
900 |
this.getAmmountDetails(feeTyp); |
687e0b929
|
901 902 903 904 905 906 |
if (this.feeTypeData.length == 0) { this.feeType = { amount: "0.00", discount: "0.00", paidAmount: "0.00", subTotal: "0.00", |
8e8d14254
|
907 |
feeTypeName: "", |
687e0b929
|
908 909 910 911 912 913 |
}; } }, getAllClasses() { http() .get("/getClassesList", { |
99cd79184
|
914 |
params: { schoolId: this.$store.state.schoolId }, |
8e8d14254
|
915 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
916 |
}) |
8e8d14254
|
917 |
.then((response) => { |
687e0b929
|
918 919 |
this.addclass = response.data.data; }) |
8e8d14254
|
920 |
.catch((err) => { |
687e0b929
|
921 922 923 924 925 |
// console.log("err====>", err); // this.$router.replace({ path: "/" }); }); }, getAllStudents() { |
d9bb52b5b
|
926 |
this.showLoader = true; |
687e0b929
|
927 928 |
http() .get("/getStudentsList", { |
99cd79184
|
929 930 |
params: { classId: this.invoiceData.classNum, |
8e8d14254
|
931 |
schoolId: this.$store.state.schoolId, |
99cd79184
|
932 |
}, |
8e8d14254
|
933 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
934 |
}) |
8e8d14254
|
935 |
.then((response) => { |
ba110dd21
|
936 937 |
this.studentList = response.data.data.filter((item) => item.status); this.studentList.unshift({ |
d45ffc6fa
|
938 |
name: "Select All", |
8e8d14254
|
939 |
_id: "Select All", |
d45ffc6fa
|
940 |
}); |
ba110dd21
|
941 |
console.log("=======studentist====", this.studentList); |
d9bb52b5b
|
942 |
this.showLoader = false; |
687e0b929
|
943 |
}) |
8e8d14254
|
944 |
.catch((err) => { |
d9bb52b5b
|
945 |
this.showLoader = false; |
687e0b929
|
946 947 948 949 950 951 952 |
// console.log("err====>", err); // this.$router.replace({ path: "/" }); }); }, getfeeType() { http() .get("/getFeesList", { |
99cd79184
|
953 |
params: { |
8e8d14254
|
954 |
schoolId: this.$store.state.schoolId, |
99cd79184
|
955 |
}, |
8e8d14254
|
956 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
957 |
}) |
8e8d14254
|
958 |
.then((response) => { |
687e0b929
|
959 960 |
this.feeTypes = response.data.data; }) |
8e8d14254
|
961 |
.catch((err) => { |
687e0b929
|
962 963 964 965 |
// console.log("err====>", err); // this.$router.replace({ path: "/" }); }); }, |
c62132b75
|
966 |
|
e03bf1f92
|
967 |
getAmmountDetails(feeTyp) { |
687e0b929
|
968 |
let feeType = { |
de5a79260
|
969 970 971 972 |
amount: "0.00", discount: "0.00", subTotal: "0.00", subParticularTotal: "0.00", |
8e8d14254
|
973 |
paidAmount: "", |
687e0b929
|
974 975 976 |
}; for (let i = 0; i < this.feeTypeData.length; i++) { // *********** AMOUNT *********** |
c765369af
|
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 |
if (this.feeTypeData[i].amount) { feeType.amount = Number(feeType.amount) + Number(this.feeTypeData[i].amount); this.feeType.amount = feeType.amount; this.feeType.subTotal = feeType.amount; this.feeTypeData[i].subTotal = this.feeTypeData[i].amount; } else if (this.feeTypeData[0].amount == "") { this.feeType.amount = "0.00"; this.feeTypeData[i].subTotal = "0.00"; this.feeType.subTotal = "0.00"; } else if (this.feeTypeData[i].amount == "") { this.feeType.amount = Number(feeType.amount) + Number(this.feeTypeData[i].amount); this.feeTypeData[i].subTotal = Number(feeType.amount) + Number(this.feeTypeData[i].amount); this.feeType.subTotal = Number(feeType.amount) + Number(this.feeTypeData[i].amount); } |
687e0b929
|
995 |
// *********** DISCOUNT *********** |
de5a79260
|
996 |
if (this.feeTypeData[i].discount) { |
ff30cbe86
|
997 998 999 |
if ( Number(this.feeTypeData[i].discount) < this.feeTypeData[i].amount ) { |
11f495070
|
1000 1001 1002 1003 |
feeType.discount = Number(feeType.discount) + Number(this.feeTypeData[i].discount); this.feeType.discount = feeType.discount; feeType.subParticularTotal = |
ff30cbe86
|
1004 |
this.feeTypeData[i].amount - this.feeTypeData[i].discount; |
11f495070
|
1005 1006 1007 |
this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed( 2 ); |
ff30cbe86
|
1008 1009 1010 1011 |
} else if ( Number(this.feeTypeData[i].discount) >= this.feeTypeData[i].amount ) { this.feeTypeData[i].discount = this.feeTypeData[i].amount; |
11f495070
|
1012 1013 1014 1015 |
feeType.discount = Number(feeType.discount) + Number(this.feeTypeData[i].discount); this.feeType.discount = feeType.discount.toString(); feeType.subParticularTotal = |
ff30cbe86
|
1016 |
this.feeTypeData[i].amount - this.feeTypeData[i].discount; |
11f495070
|
1017 1018 1019 1020 |
this.feeTypeData[ i ].subTotal = feeType.subParticularTotal.toString(); } |
c765369af
|
1021 1022 |
} else if (this.feeTypeData[0].discount == "") { this.feeType.discount = "0.00"; |
de5a79260
|
1023 |
} |
ff30cbe86
|
1024 1025 1026 1027 |
// else if (this.feeTypeData[i].discount == "") { // this.feeType.discount = // Number(feeType.discount) + Number(this.feeTypeData[i].discount); // } |
687e0b929
|
1028 1029 |
// *********** SUBTOTAL *********** |
c765369af
|
1030 1031 1032 1033 1034 |
if (this.feeTypeData[i].subTotal) { feeType.subTotal = Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal); this.feeType.subTotal = feeType.subTotal.toFixed(2); } |
687e0b929
|
1035 1036 |
// *********** PAID-AMOUNT *********** |
de5a79260
|
1037 1038 1039 1040 |
if (this.feeTypeData[i].paidAmount) { feeType.paidAmount = Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); this.feeType.paidAmount = feeType.paidAmount.toFixed(2); |
c765369af
|
1041 1042 1043 1044 1045 |
} else if (this.feeTypeData[0].paidAmount == "") { this.feeType.paidAmount = "0.00"; } else if (this.feeTypeData[i].paidAmount == "") { this.feeType.paidAmount = feeType.paidAmount = Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); |
de5a79260
|
1046 |
} |
c765369af
|
1047 |
|
d9bb52b5b
|
1048 1049 1050 1051 1052 |
// if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value. if (feeType.paidAmount > feeType.subTotal) { this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal; this.feeType.paidAmount = feeType.subTotal; } |
687e0b929
|
1053 1054 1055 1056 1057 |
} }, getPayMethodList() { if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") { this.showPayMethods = true; |
8e8d14254
|
1058 |
this.paymentMethodRules = [(v) => !!v || "Payment Method is required"]; |
687e0b929
|
1059 1060 |
} else if (this.invoiceData.paymentStatus == "FULLY_PAID") { this.showPayMethods = true; |
8e8d14254
|
1061 |
this.paymentMethodRules = [(v) => !!v || "Payment Method is required"]; |
c765369af
|
1062 1063 1064 1065 1066 |
} else if (this.invoiceData.paymentStatus == "NOT_PAID") { for (let i = 0; i < this.feeTypeData.length; i++) { this.feeTypeData[i].paidAmount = "0.00"; this.feeType.paidAmount = "0.00"; } |
728b5d417
|
1067 1068 |
this.paymentMethodRules = ""; this.showPayMethods = false; |
879451281
|
1069 1070 1071 1072 |
} else { this.showPayMethods = false; } }, |
d45ffc6fa
|
1073 |
selectAllStudent() { |
d45ffc6fa
|
1074 1075 1076 1077 |
this.invoiceData.students = []; if (this.invoiceData.studentId === "Select All") { for (let i = 1; i < this.studentList.length; i++) { this.invoiceData.students.push(this.studentList[i]._id); |
ba110dd21
|
1078 |
// console.log("data", this.invoiceData.students); |
d45ffc6fa
|
1079 1080 1081 1082 1083 1084 |
// data.push(this.studentList[i]._id); // console.log("data", data); } } else { this.invoiceData.students.push(this.invoiceData.studentId); } |
68d742034
|
1085 1086 |
}, displaySearch() { |
c765369af
|
1087 1088 |
this.show = false; this.showSearch = true; |
68d742034
|
1089 1090 1091 1092 1093 |
}, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
88868752b
|
1094 1095 1096 1097 |
}, updateDoneInvoice() { this.editInvoiceDialog = false; this.getInvoiceList(); |
e03bf1f92
|
1098 1099 1100 1101 1102 1103 1104 |
}, updatePayment() { this.paymentInvoiceDialog = false; this.getInvoiceList(); this.snackbar = true; this.text = "Payment added successfully"; this.color = "green"; |
8e8d14254
|
1105 |
}, |
687e0b929
|
1106 1107 1108 1109 1110 1111 |
}, mounted() { this.token = this.$store.state.token; this.getInvoiceList(); this.getAllClasses(); this.getfeeType(); |
81d876b5d
|
1112 |
this.getAllStudents(); |
8e8d14254
|
1113 |
}, |
687e0b929
|
1114 1115 1116 1117 1118 |
}; </script> <style scoped> |
687e0b929
|
1119 1120 1121 1122 1123 1124 |
table { border-collapse: collapse; border: 1px solid #e2e7eb; } th, |
68d742034
|
1125 |
.tdFeeType { |
687e0b929
|
1126 1127 1128 1129 1130 1131 1132 1133 |
border: 1px solid #e2e7eb; padding: 10px; text-align: center; } table.feeTypeTable { table-layout: auto !important; width: 100% !important; } |
00e0f1a63
|
1134 |
.card-style { |
abce86599
|
1135 1136 1137 1138 1139 |
background: #7f62f8 !important; border-color: #7f62f8 !important; border-radius: 12px; text-align: center !important; padding-top: 10px !important; |
00e0f1a63
|
1140 1141 |
} .add-button { |
abce86599
|
1142 1143 1144 1145 1146 |
background: #feb83c !important; border-color: #feb83c !important; text-transform: none !important; -webkit-box-shadow: none !important; box-shadow: none !important; |
00e0f1a63
|
1147 1148 |
} .clear-button { |
abce86599
|
1149 1150 1151 1152 1153 |
background: #fa7676 !important; border-color: #fa7676 !important; text-transform: none !important; -webkit-box-shadow: none !important; box-shadow: none !important; |
00e0f1a63
|
1154 1155 |
} .card-styles { |
abce86599
|
1156 1157 |
background: #7f62f8 !important; border-color: #7f62f8 !important; |
00e0f1a63
|
1158 1159 |
} .v-card__actions .v-btn { |
abce86599
|
1160 1161 |
margin: 0 15px !important; min-width: 96px !important; |
00e0f1a63
|
1162 |
} |
687e0b929
|
1163 |
</style> |