Blame view
src/pages/Account/expense.vue
24.9 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<v-container fluid class="body-color"> <!-- ****** EDIT EXPENSE ****** --> <v-dialog v-model="editExpenseDialog" max-width="600px" scrollable> <v-card flat class="card-style pa-2" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">Edit Expense Profile</label> <v-icon size="24" class="right" @click="editExpenseDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-card-text style="height: 600px;"> <v-layout> <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" > <v-avatar size="140px" v-if="!editedItem.fileUrl && !imageUrl"> <img src="/static/icon/user.png" /> </v-avatar> |
8e8d14254
|
21 22 23 24 25 |
<img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl && !imageUrl" style="border-radius:50%; width:150px" /> |
68d742034
|
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 57 58 59 60 61 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
<img v-if="imageUrl" :src="imageUrl" height="150" style="border-radius:50%; width:150px" /> <input type="file" style="display:none" ref="image" accept="image/*" @change="onFilePicked" /> </v-flex> </v-layout> <v-layout wrap> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Name:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field v-model="editedItem.name" placeholder="fill your full Name" name="name" type="text" required ></v-text-field> </v-flex> </v-layout> </v-flex> </v-layout> <v-layout wrap> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Date:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-menu ref="menu" :close-on-content-click="false" v-model="menu3" :nudge-right="40" lazy transition="scale-transition" offset-y full-width min-width="290px" > <v-text-field slot="activator" v-model="editedItem.date" placeholder="Select date" ></v-text-field> <v-date-picker ref="picker" v-model="editedItem.date" @input="$refs.menu.save(editedItem.date)" ></v-date-picker> </v-menu> </v-flex> </v-layout> </v-flex> <v-layout wrap> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Amount:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field v-model="editedItem.amount" required></v-text-field> </v-flex> </v-layout> </v-flex> </v-layout> <v-flex xs12> <v-layout wrap> <v-flex xs4 class="pt-4 subheading"> <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field label="Select Image" @click="pickFile" v-model="imageName" append-icon="attach_file" ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12> |
495e4037c
|
120 |
<v-layout> |
68d742034
|
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
<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="editedItem.note" placeholder="fill your Note" type="text" :rules="noteRules" multi-line required ></v-textarea> </v-flex> </v-layout> </v-flex> </v-layout> <v-layout> <v-flex xs12 sm12> <v-card-actions> <v-spacer></v-spacer> <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> </v-card-actions> </v-flex> </v-layout> </v-card-text> </v-card> </v-dialog> <!-- ****** PROFILE VIEW EXPENSE DETAILS ****** --> <v-dialog v-model="viewExpenseDialog" max-width="600px" scrollable> <v-card flat class="card-style pa-3" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">View Expense</label> <v-icon size="24" class="right" @click="viewExpenseDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-card-text> <v-container grid-list-md> <v-layout wrap> <v-flex> <v-flex align-center justify-center layout text-xs-center> |
495e4037c
|
165 |
<v-avatar size="160px"> |
68d742034
|
166 167 |
<img src="/static/icon/user.png" v-if="!editedItem.fileUrl" /> <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" /> |
495e4037c
|
168 |
</v-avatar> |
68d742034
|
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
</v-flex> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Name:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.name }}</h5> </v-flex> </v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Amount:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.amount }}</h5> </v-flex> </v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Date:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ dates(editedItem.date) }}</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-text> </v-card> </v-dialog> <!-- ****** EXPENSE 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="addExpenseDialog = true" > <v-icon dark>add</v-icon> </v-btn> <v-btn round class="open-dialog-button hidden-sm-only hidden-xs-only" dark @click="addExpenseDialog = true" > <v-icon class="white--text pr-1" size="20">add</v-icon>Add Expense </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
|
239 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
240 241 242 |
</v-avatar> </v-btn> </v-card-title> |
612b79bb4
|
243 |
<v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
68d742034
|
244 |
<v-layout> |
8e8d14254
|
245 246 247 248 249 250 251 |
<v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary" ></v-text-field> |
68d742034
|
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 277 278 279 280 281 282 283 |
<v-icon @click="closeSearch" color="error">close</v-icon> </v-layout> </v-flex> </v-toolbar> <v-data-table :headers="headers" :items="expenseList" :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"> <v-avatar> <img :src="props.item.fileUrl" v-if="props.item.fileUrl" /> <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" /> </v-avatar> </td> <td class="text-xs-center td td-row">{{ props.item.name}}</td> <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> <td class="text-xs-center td td-row">{{ props.item.user }}</td> <td class="text-xs-center td td-row">{{ props.item.amount }}</td> <td class="text-xs-center td td-row">{{ props.item.note }}</td> <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
|
284 |
src="/static/icon/view.png" |
68d742034
|
285 286 287 288 289 290 291 292 293 |
/> <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
|
294 |
src="/static/icon/edit.png" |
68d742034
|
295 296 297 298 299 300 301 302 |
/> <span>Edit</span> </v-tooltip> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:20px; " @click="deleteItem(props.item)" |
aa310d61a
|
303 |
src="/static/icon/delete.png" |
68d742034
|
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
/> <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> <!-- ****** Add Expense Data ****** --> |
8e8d14254
|
320 |
<v-dialog v-model="addExpenseDialog" max-width="600px" v-if="addExpenseDialog"> |
68d742034
|
321 322 323 |
<v-card flat class="card-style pa-2" dark> <v-layout> <v-flex xs12> |
8c3acf4a9
|
324 |
<label class="title text-xs-center">Add Expense</label> |
8e8d14254
|
325 |
<v-icon size="24" class="right" @click="closeAddExpenseModel">cancel</v-icon> |
68d742034
|
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
</v-flex> </v-layout> <v-flex xs12 sm12> <v-form ref="form" v-model="valid" lazy-validation> <v-container fluid> <v-layout> <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> <v-avatar size="80px"> <img src="/static/icon/user.png" v-if="!imageUrl" /> </v-avatar> <img :src="imageUrl" height="150" v-if="imageUrl" style="border-radius:50%; width:150px" |
495e4037c
|
341 342 343 |
/> </v-flex> </v-layout> |
68d742034
|
344 |
<v-layout> |
495e4037c
|
345 346 347 348 349 |
<v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Name:</label> </v-flex> |
68d742034
|
350 |
<v-flex xs8 sm6 class="ml-3"> |
495e4037c
|
351 |
<v-text-field |
68d742034
|
352 |
v-model="addExpense.name" |
495e4037c
|
353 354 355 |
placeholder="fill your full Name" name="name" type="text" |
68d742034
|
356 |
:rules="nameRules" |
495e4037c
|
357 358 359 360 361 362 |
required ></v-text-field> </v-flex> </v-layout> </v-flex> </v-layout> |
68d742034
|
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
<v-layout> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Amount:</label> </v-flex> <v-flex xs8 sm6 class="ml-3"> <v-text-field v-model="addExpense.amount" placeholder="fill your Amount" name="name" type="text" :rules="amountRules" required ></v-text-field> </v-flex> </v-layout> </v-flex> </v-layout> <v-layout> <v-flex xs12 sm12> |
495e4037c
|
384 385 |
<v-layout> <v-flex xs4 class="pt-4 subheading"> |
68d742034
|
386 |
<label class="right">Date</label> |
495e4037c
|
387 |
</v-flex> |
68d742034
|
388 |
<v-flex xs8 sm6 class="ml-3"> |
495e4037c
|
389 |
<v-menu |
68d742034
|
390 |
ref="menu1" |
495e4037c
|
391 |
:close-on-content-click="false" |
68d742034
|
392 |
v-model="menu1" |
495e4037c
|
393 394 395 396 397 398 399 |
:nudge-right="40" lazy transition="scale-transition" offset-y full-width min-width="290px" > |
f4df757fe
|
400 |
<v-text-field |
495e4037c
|
401 |
slot="activator" |
68d742034
|
402 403 |
:rules="joinDateRules" v-model="addExpense.date" |
495e4037c
|
404 |
placeholder="Select date" |
f4df757fe
|
405 |
></v-text-field> |
495e4037c
|
406 407 |
<v-date-picker ref="picker" |
68d742034
|
408 409 |
v-model="addExpense.date" @input="$refs.menu1.save(addExpense.date)" |
495e4037c
|
410 411 412 413 414 |
></v-date-picker> </v-menu> </v-flex> </v-layout> </v-flex> |
68d742034
|
415 416 417 418 |
</v-layout> <v-layout> <v-flex xs12 sm12> <v-layout> |
495e4037c
|
419 |
<v-flex xs4 class="pt-4 subheading"> |
68d742034
|
420 |
<label class="right">File:</label> |
495e4037c
|
421 |
</v-flex> |
68d742034
|
422 |
<v-flex xs8 sm6 class="ml-3"> |
495e4037c
|
423 |
<v-text-field |
68d742034
|
424 |
label="Select file" |
495e4037c
|
425 426 427 428 |
@click="pickFile" v-model="imageName" append-icon="attach_file" ></v-text-field> |
68d742034
|
429 430 431 432 433 434 435 |
<input type="file" style="display:none" ref="image" accept="image/*" @change="onFilePicked" /> |
687e0b929
|
436 437 |
</v-flex> </v-layout> |
495e4037c
|
438 |
</v-flex> |
68d742034
|
439 440 441 |
</v-layout> <v-layout> <v-flex xs12 sm12> |
495e4037c
|
442 443 444 445 |
<v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Note:</label> </v-flex> |
68d742034
|
446 |
<v-flex xs8 sm6 class="ml-3"> |
495e4037c
|
447 448 |
<v-textarea name="input-7-1" |
68d742034
|
449 |
v-model="addExpense.note" |
495e4037c
|
450 451 |
placeholder="fill your Note" type="text" |
495e4037c
|
452 453 454 455 456 457 458 459 |
multi-line required ></v-textarea> </v-flex> </v-layout> </v-flex> </v-layout> <v-layout> |
68d742034
|
460 461 |
<v-flex xs11> <v-layout> |
495e4037c
|
462 |
<v-spacer></v-spacer> |
68d742034
|
463 464 465 |
<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-layout> |
495e4037c
|
466 467 |
</v-flex> </v-layout> |
68d742034
|
468 469 470 471 472 |
</v-container> </v-form> </v-flex> </v-card> </v-dialog> |
687e0b929
|
473 474 475 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
68d742034
|
476 477 478 479 480 481 482 483 484 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> </v-container> |
687e0b929
|
485 486 487 488 |
</template> <script> import http from "@/Services/http.js"; |
687e0b929
|
489 490 491 492 493 494 495 496 497 |
import moment from "moment"; export default { data: () => ({ component: "report-generate", snackbar: false, y: "top", x: "right", mode: "", |
68d742034
|
498 |
timeout: 5000, |
687e0b929
|
499 |
text: "", |
68d742034
|
500 |
color: "", |
687e0b929
|
501 502 503 504 505 506 507 508 |
showLoader: false, loading: false, date: null, search: "", menu: false, menu1: false, menu2: false, menu3: false, |
68d742034
|
509 510 |
editExpenseDialog: false, viewExpenseDialog: false, |
687e0b929
|
511 |
valid: true, |
68d742034
|
512 513 514 |
show: true, addExpenseDialog: false, showSearch: false, |
687e0b929
|
515 |
pagination: { |
8e8d14254
|
516 |
rowsPerPage: 10, |
687e0b929
|
517 518 |
}, imageData: {}, |
68d742034
|
519 |
token: "", |
687e0b929
|
520 521 522 |
imageName: "", imageUrl: "", imageFile: "", |
8e8d14254
|
523 524 525 526 |
nameRules: [(v) => !!v || " Full Name is required"], amountRules: [(v) => !!v || "Amount is required"], noteRules: [(v) => !!v || "Note Name is required"], joinDateRules: [(v) => !!v || "Date is required"], |
687e0b929
|
527 528 529 530 531 532 |
errorMessages: "", headers: [ { text: "No", align: "center", sortable: false, |
8e8d14254
|
533 |
value: "No", |
687e0b929
|
534 535 536 537 538 |
}, { text: "Profile Pic", value: "profilePicUrl", sortable: false, |
8e8d14254
|
539 |
align: "center", |
687e0b929
|
540 541 542 543 544 545 |
}, { text: "Name", value: "name", sortable: false, align: "center" }, { text: "Date", value: "date", sortable: false, align: "center" }, { text: "User", value: "user", sortable: false, align: "center" }, { text: "Amount", value: "amount", sortable: false, align: "center" }, { text: "Note", value: "note", sortable: false, align: "center" }, |
8e8d14254
|
546 |
{ text: "Action", value: "", sortable: false, align: "center" }, |
687e0b929
|
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
], expenseList: [], editedIndex: -1, upload: "", editedItem: { role: "TEACHER", name: "", email: "", date: null, city: "", pincode: "", country: "", permanentAddress: "", presentAddress: "", mobileNo: "", state: "", |
8e8d14254
|
563 |
joinDate: null, |
687e0b929
|
564 |
}, |
8e8d14254
|
565 |
addExpense: {}, |
687e0b929
|
566 567 568 569 570 571 572 |
}), watch: { menu(val) { val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); }, menu1(val) { val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
8e8d14254
|
573 574 575 576 577 578 579 580 581 582 |
}, addExpenseDialog: function (val) { if (!val) { this.addExpense = []; this.menu1 = false; this.imageName = ""; this.imageFile = ""; this.imageUrl = ""; } }, |
687e0b929
|
583 584 585 586 587 588 589 590 591 592 593 |
}, methods: { save(date) { this.$refs.menu.save(date); }, save(date) { this.$refs.menu1.save(date); }, pickFile() { this.$refs.image.click(); }, |
8e8d14254
|
594 |
dates: function (date) { |
68d742034
|
595 596 |
return moment(date).format("MMMM DD, YYYY"); }, |
687e0b929
|
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
onFilePicked(e) { // console.log(e) const files = e.target.files; this.upload = e.target.files[0]; console.log("imageData-upload========>", this.upload); if (files[0] !== undefined) { this.imageName = files[0].name; if (this.imageName.lastIndexOf(".") <= 0) { return; } const fr = new FileReader(); fr.readAsDataURL(files[0]); fr.addEventListener("load", () => { this.imageUrl = fr.result; this.imageFile = files[0]; // this is an image file that can be sent to server... // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); // console.log("upload=======>", this.imageData.imageUrl); console.log("imageFile", this.imageUrl); }); } else { this.imageName = ""; this.imageFile = ""; this.imageUrl = ""; } }, |
687e0b929
|
622 |
getExpenseList() { |
687e0b929
|
623 624 |
http() .get("/getExpensesList", { |
99cd79184
|
625 |
params: { schoolId: this.$store.state.schoolId }, |
8e8d14254
|
626 |
headers: { Authorization: "Bearer " + this.token }, |
687e0b929
|
627 |
}) |
8e8d14254
|
628 |
.then((response) => { |
687e0b929
|
629 630 631 632 |
this.expenseList = response.data.data; this.showLoader = false; // console.log("getTeacherList=====>",this.expenseList) }) |
8e8d14254
|
633 |
.catch((error) => { |
687e0b929
|
634 |
this.showLoader = false; |
68d742034
|
635 636 637 638 639 |
// if (error.response.status === 401) { // this.$router.replace({ path: "/" }); // this.$store.dispatch("setToken", null); // this.$store.dispatch("Id", null); // } |
687e0b929
|
640 641 642 643 644 |
}); }, editItem(item) { this.editedIndex = this.expenseList.indexOf(item); this.editedItem = Object.assign({}, item); |
687e0b929
|
645 646 647 648 |
this.editedItem.date = this.editedItem.date != undefined ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) : (this.editedItem.date = ""); |
68d742034
|
649 |
this.editExpenseDialog = true; |
687e0b929
|
650 651 652 653 |
}, profile(item) { this.editedIndex = this.expenseList.indexOf(item); this.editedItem = Object.assign({}, item); |
68d742034
|
654 |
this.viewExpenseDialog = true; |
687e0b929
|
655 656 657 |
}, deleteItem(item) { let deleteExpense = { |
8e8d14254
|
658 |
expenseId: item._id, |
687e0b929
|
659 660 661 662 663 664 |
}; // console.log("deleteUers",deleteTeachers) http() .delete( "/deleteExpense", confirm("Are you sure you want to delete this?") && { |
8e8d14254
|
665 |
params: deleteExpense, |
687e0b929
|
666 667 |
} ) |
8e8d14254
|
668 |
.then((response) => { |
687e0b929
|
669 |
// console.log("deleteUers",deleteTeachers) |
99cd79184
|
670 |
this.snackbar = true; |
68d742034
|
671 672 |
this.text = response.data.message; this.color = "green"; |
687e0b929
|
673 674 |
this.getExpenseList(); }) |
8e8d14254
|
675 |
.catch((error) => { |
68d742034
|
676 677 678 |
this.snackbar = true; this.text = error.response.data.message; this.color = "error"; |
687e0b929
|
679 680 |
}); }, |
687e0b929
|
681 |
close() { |
68d742034
|
682 |
this.editExpenseDialog = false; |
687e0b929
|
683 |
}, |
8e8d14254
|
684 685 686 687 688 689 690 691 |
closeAddExpenseModel() { this.addExpenseDialog = false; this.addExpense = []; this.menu1 = false; this.imageName = ""; this.imageFile = ""; this.imageUrl = ""; }, |
687e0b929
|
692 693 694 695 696 697 698 699 |
submit() { if (this.$refs.form.validate()) { if (this.imageUrl) { var str = this.imageUrl; const [baseUrl, imageUrl] = str.split(/,/); this.addExpense.upload = imageUrl; } this.loading = true; |
68d742034
|
700 |
// this.addExpense = this.$store.state.schoolId; |
687e0b929
|
701 702 |
http() .post("/createExpense", this.addExpense) |
8e8d14254
|
703 |
.then((response) => { |
687e0b929
|
704 |
this.getExpenseList(); |
68d742034
|
705 706 707 |
this.snackbar = true; this.text = response.data.message; this.color = "green"; |
687e0b929
|
708 |
this.clear(); |
68d742034
|
709 |
this.imageUrl = ""; |
687e0b929
|
710 |
this.loading = false; |
68d742034
|
711 |
this.addExpenseDialog = false; |
687e0b929
|
712 |
}) |
8e8d14254
|
713 |
.catch((error) => { |
687e0b929
|
714 |
// console.log(error); |
68d742034
|
715 716 717 |
this.snackbar = true; this.color = "error"; this.text = error.response.data.message; |
687e0b929
|
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
this.loading = false; }); } }, clear() { this.$refs.form.reset(); }, save() { this.loading = true; this.editedItem.expenseId = this.editedItem._id; if (this.imageUrl) { var str = this.imageUrl; const [baseUrl, imageUrl] = str.split(/,/); this.editedItem.upload = imageUrl; } http() .put("/updateExpense", this.editedItem) |
8e8d14254
|
735 |
.then((response) => { |
68d742034
|
736 737 738 |
this.snackbar = true; this.text = response.data.message; this.color = "green"; |
687e0b929
|
739 740 741 742 |
this.loading = false; this.getExpenseList(); this.close(); }) |
8e8d14254
|
743 |
.catch((error) => { |
68d742034
|
744 745 746 |
this.snackbar = true; this.text = error.response.data.message; this.color = "error"; |
687e0b929
|
747 |
}); |
68d742034
|
748 749 750 751 752 753 754 755 |
}, displaySearch() { (this.show = false), (this.showSearch = true); }, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
8e8d14254
|
756 |
}, |
687e0b929
|
757 758 |
}, mounted() { |
68d742034
|
759 |
this.token = this.$store.state.token; |
687e0b929
|
760 |
this.getExpenseList(); |
8e8d14254
|
761 |
}, |
687e0b929
|
762 |
}; |
68d742034
|
763 |
</script> |