diff --git a/src/api/menu.js b/src/api/menu.js index 873e2ec..9a21691 100644 --- a/src/api/menu.js +++ b/src/api/menu.js @@ -184,6 +184,35 @@ const adminMenu = [ } ]; +const libraryMenu = [{ + title: 'Library', + group: 'Library', + component: 'Library', + icon: '/static/schoolIcons/Library.png', + items: [ + { name: 'libraryMember', title: ' Library Member', component: 'libraryMember', action: '', }, + { name: 'Books', title: 'Books', component: 'Books', action: '', }, + { name: 'Issue', title: ' Issue', component: 'Issue', action: '', }, + { name: 'eBooks', title: 'E-Books', component: 'eBooks', action: '', } + + ] +}]; + +const accountMenu = [{ + title: 'Account', + group: 'Account', + component: 'Account', + icon: '/static/schoolIcons/Account.png', + items: [ + { name: 'feeTypes', title: 'Fee Types', component: 'feeTypes', action: '', }, + { name: 'Invoice', title: 'Invoice', component: 'Invoice', action: '', }, + { name: 'paymentHistory', title: 'Payment History', component: 'paymentHistory', action: '', }, + { name: 'Expense', title: 'Expense', component: 'Expense', action: '', }, + { name: 'Income', title: 'Income', component: 'Income', action: '', }, + { name: 'GlobalPayment', title: 'Global Payment', component: 'GlobalPayment', action: '', } + ] +}]; + const schoolMenu = [ // { header: 'Apps' }, { @@ -205,4 +234,4 @@ const schoolMenu = [ // } // }); -export default { adminMenu, schoolMenu }; \ No newline at end of file +export default { adminMenu, schoolMenu, libraryMenu, accountMenu }; \ No newline at end of file diff --git a/src/components/pageHeader/AppDrawer.vue b/src/components/pageHeader/AppDrawer.vue index 1803bb3..815bde0 100644 --- a/src/components/pageHeader/AppDrawer.vue +++ b/src/components/pageHeader/AppDrawer.vue @@ -151,6 +151,10 @@ export default { this.menus = menu.adminMenu; } else if (this.$store.state.role === "SUPERADMIN") { this.menus = menu.schoolMenu; + } else if (this.$store.state.role === "LIBRARIAN") { + this.menus = menu.libraryMenu; + } else if (this.$store.state.role === "ACCOUNTANT") { + this.menus = menu.accountMenu; } window.getApp.$on("APP_DRAWER_TOGGLED", () => { this.drawer = !this.drawer; diff --git a/src/components/pageHeader/AppToolbar.vue b/src/components/pageHeader/AppToolbar.vue index 9b27ef2..780b87d 100644 --- a/src/components/pageHeader/AppToolbar.vue +++ b/src/components/pageHeader/AppToolbar.vue @@ -27,8 +27,9 @@ - account_circle + account_circle + diff --git a/src/pages/Account/expense.vue b/src/pages/Account/expense.vue index e1b81d0..31a8b82 100644 --- a/src/pages/Account/expense.vue +++ b/src/pages/Account/expense.vue @@ -614,6 +614,7 @@ export default { var token = this.$store.state.token; http() .get("/getExpensesList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + token } }) .then(response => { @@ -633,10 +634,6 @@ export default { editItem(item) { this.editedIndex = this.expenseList.indexOf(item); this.editedItem = Object.assign({}, item); - // this.editedItem.dob = - // this.editedItem.dob != undefined - // ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) - // : (this.editedItem.dob = ""); this.editedItem.date = this.editedItem.date != undefined ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) @@ -663,9 +660,8 @@ export default { ) .then(response => { // console.log("deleteUers",deleteTeachers) - if ((this.snackbar = true)) { - this.text = "Successfully delete Existing Expense"; - } + this.snackbar = true; + this.text = "Successfully delete Existing Expense"; this.getExpenseList(); }) .catch(error => { @@ -703,6 +699,7 @@ export default { this.addExpense.upload = imageUrl; } this.loading = true; + this.addExpense = this.$store.state.schoolId; http() .post("/createExpense", this.addExpense) .then(response => { diff --git a/src/pages/Account/feeTypes.vue b/src/pages/Account/feeTypes.vue index 43caa6f..6e9177f 100644 --- a/src/pages/Account/feeTypes.vue +++ b/src/pages/Account/feeTypes.vue @@ -36,45 +36,45 @@ - - - - - - - - - - - - - - - - - - - - - Cancel - - Save - - - - + + + + + + + + + + + + + + + + + + + + + Cancel + + Save + + + + @@ -330,6 +330,7 @@ export default { this.showLoader = true; http() .get("/getFeesList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -408,23 +409,20 @@ export default { submit() { if (this.$refs.form.validate()) { this.loading = true; + this.schoolId = this.$store.state.schoolId; http() .post("/createFee", this.feeTypeData) .then(response => { - console.log(response); this.getFeeTypeList(); - if ((this.snackbar = true)) { - this.text = "New feetype added successfully"; - } - + this.snackbar = true; + this.text = "New feetype added successfully"; this.clear(); this.loading = false; }) .catch(error => { // console.log(error); - if ((this.snackbar = true)) { - this.text = error.response.data.message; - } + this.snackbar = true; + this.text = error.response.data.message; this.loading = false; }); } diff --git a/src/pages/Account/globalPayment.vue b/src/pages/Account/globalPayment.vue index d94e661..b7b2264 100644 --- a/src/pages/Account/globalPayment.vue +++ b/src/pages/Account/globalPayment.vue @@ -252,7 +252,12 @@ export default { http() .get( "/getSectionsList", - { params: { classId: this.selectStudents.selectClassId } }, + { + params: { + classId: this.selectStudents.selectClassId, + schoolId: this.$store.state.schoolId + } + }, { headers: { Authorization: "Bearer " + token } } @@ -274,7 +279,8 @@ export default { .get("/getStudentWithClass", { params: { classId: this.selectStudents.selectClassId, - sectionId: this.selectStudents.selectSection + sectionId: this.selectStudents.selectSection, + schoolId: this.$store.state.schoolId } }) .then(response => { @@ -293,7 +299,8 @@ export default { .get("/getInvoicesList", { params: { classId: this.selectStudents.selectClassId, - studentId: this.selectStudents.selectId + studentId: this.selectStudents.selectId, + schoolId: this.$store.state.schoolId } }) .then(response => { @@ -311,6 +318,9 @@ export default { var token = this.$store.state.token; http() .get("/getClassesList", { + params: { + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + token } }) .then(response => { diff --git a/src/pages/Account/income.vue b/src/pages/Account/income.vue index f676d8a..9596a15 100644 --- a/src/pages/Account/income.vue +++ b/src/pages/Account/income.vue @@ -596,6 +596,7 @@ export default { var token = this.$store.state.token; http() .get("/getIncomesList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + token } }) .then(response => { @@ -680,6 +681,7 @@ export default { this.addIncome.upload = imageUrl; } this.loading = true; + this.addIncome = this.$store.state.schoolId; http() .post("/createIncome", this.addIncome) .then(response => { diff --git a/src/pages/Account/invoice.vue b/src/pages/Account/invoice.vue index e04ac2d..64cb7a9 100644 --- a/src/pages/Account/invoice.vue +++ b/src/pages/Account/invoice.vue @@ -622,9 +622,8 @@ export default { }) .catch(error => { // console.log(error); - if ((this.snackbar = true)) { - this.text = error.response.data.message; - } + this.snackbar = true; + this.text = error.response.data.message; this.loading = false; }); } @@ -636,6 +635,7 @@ export default { this.showLoader = true; http() .get("/getInvoicesList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -655,12 +655,9 @@ export default { selectFeeType() { this.showFeeType = true; this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName }); - // console.log("this.feeType.feeTypeListC", this.feeTypeData.feeTypeName); }, deleteSelectFee: function(index) { this.feeTypeData.splice(index, 1); - // console.log("this.feeTypeData", this.feeTypeData); - // if (index === 1) for (let i = 0; i < this.feeTypeData.length; i++) { this.feeType = this.feeTypeData[i]; } @@ -677,6 +674,7 @@ export default { getAllClasses() { http() .get("/getClassesList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -690,7 +688,10 @@ export default { getAllStudents() { http() .get("/getStudentsList", { - params: { classId: this.invoiceData.classNum }, + params: { + classId: this.invoiceData.classNum, + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -704,6 +705,9 @@ export default { getfeeType() { http() .get("/getFeesList", { + params: { + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { diff --git a/src/pages/Account/paymentHistory.vue b/src/pages/Account/paymentHistory.vue index cc6581c..472a331 100644 --- a/src/pages/Account/paymentHistory.vue +++ b/src/pages/Account/paymentHistory.vue @@ -47,7 +47,7 @@ Delete - --> + --> { diff --git a/src/pages/Account/viewInvoice.vue b/src/pages/Account/viewInvoice.vue index b2c427e..5a541ed 100644 --- a/src/pages/Account/viewInvoice.vue +++ b/src/pages/Account/viewInvoice.vue @@ -1,6 +1,6 @@ { @@ -543,6 +546,7 @@ export default { }, submit() { this.BooksData.quantity = Number(this.BooksData.quantity); + this.BooksData.schoolId = this.$store.state.schoolId; if (this.$refs.form.validate()) { this.loading = true; http() diff --git a/src/pages/Library/eBook.vue b/src/pages/Library/eBook.vue index 5c5676a..1b62e09 100644 --- a/src/pages/Library/eBook.vue +++ b/src/pages/Library/eBook.vue @@ -55,14 +55,14 @@ /> - + eBooks @@ -537,6 +537,7 @@ export default { this.showLoader = true; http() .get("/getEBooksList", { + params: { schoolId: this.$store.state.schoolId }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -642,6 +643,7 @@ export default { this.addEBooks.uploadFile = fileUrl; // console.log("anyFile.split(/,/)", this.addEBooks.uploadFile); } + this.addEBooks = this.$store.state.schoolId; http() .post("/createEBook", this.addEBooks) .then(response => { diff --git a/src/pages/Library/issue.vue b/src/pages/Library/issue.vue index 4e578ee..2756868 100644 --- a/src/pages/Library/issue.vue +++ b/src/pages/Library/issue.vue @@ -306,7 +306,7 @@ >{{ props.item.bookId.status}} - + { @@ -747,6 +751,9 @@ export default { this.showLoader = true; http() .get("/getBooksList", { + params: { + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -765,10 +772,8 @@ export default { }); }, getParticularBookData(books) { - console.log("books", books); for (let i = 0; i < this.books.length; i++) { if (books == this.books[i]._id) { - console.log("books", this.books[i].remaining); if (this.books[i].remaining <= 0) { this.snackbar = true; this.text = "Book is unavailable"; diff --git a/src/pages/Library/member.vue b/src/pages/Library/member.vue index a865cc0..211392d 100644 --- a/src/pages/Library/member.vue +++ b/src/pages/Library/member.vue @@ -626,7 +626,10 @@ export default { this.showLoader = true; http() .get("/getStudentsList", { - params: { classId: this.selectStudents }, + params: { + classId: this.selectStudents, + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { @@ -693,6 +696,7 @@ export default { submit() { if (this.$refs.form.validate()) { this.loading = true; + this.addBook.schoolId = this.$store.state.schoolId; http() .put("/addLibrary", this.addBook) .then(response => { @@ -732,6 +736,9 @@ export default { getAllClass() { http() .get("/getClassesList", { + params: { + schoolId: this.$store.state.schoolId + }, headers: { Authorization: "Bearer " + this.token } }) .then(response => { diff --git a/src/pages/Subjects/subjects.vue b/src/pages/Subjects/subjects.vue index acdf332..c98f210 100644 --- a/src/pages/Subjects/subjects.vue +++ b/src/pages/Subjects/subjects.vue @@ -433,6 +433,10 @@ export default { ) .then(response => { this.subjectList = response.data.data; + this.getClassSubject(); + this.snackbar = true; + this.color = "green"; + this.text = response.data.message; }) .catch(err => { console.log("err====>", err); diff --git a/src/pages/User/user.vue b/src/pages/User/user.vue index 3710448..31a88df 100644 --- a/src/pages/User/user.vue +++ b/src/pages/User/user.vue @@ -708,23 +708,6 @@ - - - - - - - - - - - - @@ -995,9 +978,8 @@ export default { }, deleteItem(item) { let deleteUser = { - UserId: item._id + userId: item._id }; - // console.log("deleteUers",deleteUser) http() .delete( "/deleteUser", @@ -1007,9 +989,8 @@ export default { ) .then(response => { // console.log("deleteUers",deleteUser) - if ((this.snackbar = true)) { - this.text = "Successfully delete Existing User"; - } + this.snackbar = true; + this.text = "Successfully delete Existing User"; this.getUsersList(); }) .catch(error => { diff --git a/src/store/store.js b/src/store/store.js index 63ae331..4cf32ac 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -14,7 +14,8 @@ export default new Vuex.Store({ data: null, isUserLoggedIn: false, id: null, - role: null + role: null, + schoolId: null }, // serve as the one and only way to change the state of the data in the state object mutations: { @@ -35,6 +36,9 @@ export default new Vuex.Store({ }, Role(state, role) { state.role = role + }, + SchoolId(state, schoolId) { + state.schoolId = schoolId } }, //Action methods are referred to as being "dispatched" @@ -50,6 +54,9 @@ export default new Vuex.Store({ }, Role({ commit }, role) { commit('Role', role) + }, + SchoolId({ commit }, schoolId) { + commit('SchoolId', schoolId) } }