Commit 57263a890483bb3f459905e9349c28f655ec195d
1 parent
036f779bfc
Exists in
master
and in
3 other branches
hide subject from sidenav and integrated update routine api
Showing
2 changed files
with
84 additions
and
151 deletions
Show diff stats
src/api/menu.js
... | ... | @@ -18,11 +18,11 @@ const adminMenu = [ |
18 | 18 | name: 'Section', |
19 | 19 | icon: '/static/icon/section.png', |
20 | 20 | }, |
21 | - { | |
22 | - title: 'Subjects', | |
23 | - name: 'Subject', | |
24 | - icon: '/static/icon/subject.png', | |
25 | - }, | |
21 | + // { | |
22 | + // title: 'Subjects', | |
23 | + // name: 'Subject', | |
24 | + // icon: '/static/icon/subject.png', | |
25 | + // }, | |
26 | 26 | { |
27 | 27 | title: 'Parents', |
28 | 28 | // group: 'apps', |
... | ... | @@ -254,8 +254,7 @@ const schoolMenu = [ |
254 | 254 | } |
255 | 255 | ]; |
256 | 256 | |
257 | -const teacherMenu = [ | |
258 | - { | |
257 | +const teacherMenu = [{ | |
259 | 258 | title: 'Dashboard', |
260 | 259 | name: 'School', |
261 | 260 | icon: '/static/icon/dashboard.png', | ... | ... |
src/pages/Academic/routine.vue
... | ... | @@ -12,47 +12,18 @@ |
12 | 12 | <v-container fluid> |
13 | 13 | <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation> |
14 | 14 | <v-layout> |
15 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
16 | - <label class="right">School Year :</label> | |
17 | - </v-flex> | |
18 | - <v-flex xs8 sm8 class="ml-3"> | |
19 | - <v-text-field v-model="editedItem.schoolYear" label="Select Year"></v-text-field> | |
20 | - </v-flex> | |
21 | - </v-layout> | |
22 | - <v-layout> | |
23 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
15 | + <v-flex xs3 sm4 class="pt-4 subheading"> | |
24 | 16 | <label class="right">Class :</label> |
25 | 17 | </v-flex> |
26 | - <v-flex xs8 sm8 class="ml-3"> | |
18 | + <v-flex xs8 sm8 class="ml-2"> | |
27 | 19 | <v-select |
28 | 20 | :items="classList" |
29 | - label="Select Class" | |
21 | + label="Select your Class" | |
22 | + v-model="editedItem.classId" | |
30 | 23 | item-text="classNum" |
31 | 24 | item-value="_id" |
32 | - v-model="editedItem.classId" | |
33 | - name="Select Class" | |
34 | 25 | :rules="classRules" |
35 | - @change="getSections(addRoutine.classId)" | |
36 | - class="pl-2" | |
37 | - required | |
38 | - ></v-select> | |
39 | - </v-flex> | |
40 | - </v-layout> | |
41 | - <v-layout> | |
42 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
43 | - <label class="right">Section :</label> | |
44 | - </v-flex> | |
45 | - <v-flex xs8 sm8 class="ml-3"> | |
46 | - <v-select | |
47 | - :items="addSection" | |
48 | - label="Select Section" | |
49 | - item-text="name" | |
50 | - item-value="_id" | |
51 | - v-model="editedItem.sectionId" | |
52 | - name="Select Section" | |
53 | - :rules="sectionRules" | |
54 | 26 | @change="getClassSubject(addRoutine.classId)" |
55 | - class="px-2" | |
56 | 27 | required |
57 | 28 | ></v-select> |
58 | 29 | </v-flex> |
... | ... | @@ -74,21 +45,6 @@ |
74 | 45 | </v-flex> |
75 | 46 | </v-layout> |
76 | 47 | <v-layout> |
77 | - <v-flex xs3 sm4 class="pt-4 subheading"> | |
78 | - <label class="right">Day :</label> | |
79 | - </v-flex> | |
80 | - <v-flex xs8 sm8 class="ml-2"> | |
81 | - <v-select | |
82 | - :items="day" | |
83 | - label="Select your day" | |
84 | - v-model="editedItem.day" | |
85 | - item-text="text" | |
86 | - :rules="dayRules" | |
87 | - required | |
88 | - ></v-select> | |
89 | - </v-flex> | |
90 | - </v-layout> | |
91 | - <v-layout> | |
92 | 48 | <v-flex xs4 sm4 class="pt-4 subheading"> |
93 | 49 | <label class="right">Teacher Name :</label> |
94 | 50 | </v-flex> |
... | ... | @@ -106,16 +62,15 @@ |
106 | 62 | </v-flex> |
107 | 63 | </v-layout> |
108 | 64 | <v-layout> |
109 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
65 | + <v-flex xs5 sm4 class="pt-4 subheading"> | |
110 | 66 | <label class="right">Starting time:</label> |
111 | 67 | </v-flex> |
112 | - <v-flex xs8 sm8 class="ml-3"> | |
68 | + <v-flex xs7 sm6 class="ml-3"> | |
113 | 69 | <v-menu |
114 | - ref="menuA" | |
70 | + ref="menuC" | |
115 | 71 | :close-on-content-click="false" |
116 | - v-model="menuB" | |
72 | + v-model="menu4" | |
117 | 73 | :nudge-right="40" |
118 | - :return-value.sync="addRoutine.startingTime" | |
119 | 74 | lazy |
120 | 75 | transition="scale-transition" |
121 | 76 | offset-y |
... | ... | @@ -126,29 +81,24 @@ |
126 | 81 | <v-text-field |
127 | 82 | slot="activator" |
128 | 83 | v-model="editedItem.startingTime" |
129 | - label="Select your starting time" | |
84 | + placeholder="Select your starting time" | |
130 | 85 | append-icon="access_time" |
131 | - :rules="timeInRules" | |
132 | 86 | readonly |
133 | 87 | ></v-text-field> |
134 | - <v-time-picker | |
135 | - v-model="editedItem.startingTime" | |
136 | - @change="$refs.menuA.save(addRoutine.startingTime)" | |
137 | - ></v-time-picker> | |
88 | + <v-time-picker v-model="editedItem.startingTime" @change="menu4= false"></v-time-picker> | |
138 | 89 | </v-menu> |
139 | 90 | </v-flex> |
140 | 91 | </v-layout> |
141 | 92 | <v-layout> |
142 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
93 | + <v-flex xs5 sm4 class="pt-4 subheading"> | |
143 | 94 | <label class="right">Ending Time:</label> |
144 | 95 | </v-flex> |
145 | - <v-flex xs8 sm8 class="ml-3"> | |
96 | + <v-flex xs7 sm6 class="ml-3"> | |
146 | 97 | <v-menu |
147 | - ref="menu" | |
98 | + ref="menuB" | |
148 | 99 | :close-on-content-click="false" |
149 | - v-model="menu1" | |
100 | + v-model="menu3" | |
150 | 101 | :nudge-right="40" |
151 | - :return-value.sync="addRoutine.endingTime" | |
152 | 102 | lazy |
153 | 103 | transition="scale-transition" |
154 | 104 | offset-y |
... | ... | @@ -159,15 +109,11 @@ |
159 | 109 | <v-text-field |
160 | 110 | slot="activator" |
161 | 111 | v-model="editedItem.endingTime" |
162 | - label="Select your end time" | |
112 | + placeholder="Select your end time" | |
163 | 113 | append-icon="access_time" |
164 | - :rules="timeOutRules" | |
165 | 114 | readonly |
166 | 115 | ></v-text-field> |
167 | - <v-time-picker | |
168 | - v-model="editedItem.endingTime" | |
169 | - @change="$refs.menu.save(addRoutine.endingTime)" | |
170 | - ></v-time-picker> | |
116 | + <v-time-picker v-model="editedItem.endingTime" @change="menu3 = false"></v-time-picker> | |
171 | 117 | </v-menu> |
172 | 118 | </v-flex> |
173 | 119 | </v-layout> |
... | ... | @@ -367,12 +313,6 @@ |
367 | 313 | <template slot="items" slot-scope="props"> |
368 | 314 | <tr class="tr"> |
369 | 315 | <td>{{ props.item.day }}</td> |
370 | - <!-- <td class="text-center"> --> | |
371 | - <!-- <br /> --> | |
372 | - <!-- {{ props.item.classId.classNum }} | |
373 | - <br /> | |
374 | - {{ props.item.sectionId.name }} --> | |
375 | - <!-- </td> --> | |
376 | 316 | <td class="text-center" v-for="list in props.item.lectureRoutine"> |
377 | 317 | {{ props.item.classId.classNum }} |
378 | 318 | <br /> |
... | ... | @@ -384,7 +324,7 @@ |
384 | 324 | <br /> |
385 | 325 | {{ list.subjectName }} |
386 | 326 | <br /> |
387 | - {{ list.teacherId .name}} | |
327 | + {{ list.teacherId.name}} | |
388 | 328 | <br /> |
389 | 329 | <span> |
390 | 330 | <v-tooltip top> |
... | ... | @@ -392,7 +332,7 @@ |
392 | 332 | slot="activator" |
393 | 333 | style="cursor:pointer; width:20px; height:18px; " |
394 | 334 | class="mr-3" |
395 | - @click="editItem()" | |
335 | + @click="editItem(list, props.item)" | |
396 | 336 | src="/static/icon/edit.png" |
397 | 337 | /> |
398 | 338 | <span>Edit</span> |
... | ... | @@ -541,14 +481,14 @@ |
541 | 481 | </v-flex> |
542 | 482 | </v-layout> |
543 | 483 | <v-layout> |
544 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
484 | + <v-flex xs4 class="pt-4 subheading"> | |
545 | 485 | <label class="right">Starting time:</label> |
546 | 486 | </v-flex> |
547 | - <v-flex xs8 sm8 class="ml-3"> | |
487 | + <v-flex xs8 sm6 class="ml-3"> | |
548 | 488 | <v-menu |
549 | 489 | ref="menuA" |
550 | 490 | :close-on-content-click="false" |
551 | - v-model="menuB" | |
491 | + v-model="menu2" | |
552 | 492 | :nudge-right="40" |
553 | 493 | :return-value.sync="addRoutine.startingTime" |
554 | 494 | lazy |
... | ... | @@ -574,10 +514,10 @@ |
574 | 514 | </v-flex> |
575 | 515 | </v-layout> |
576 | 516 | <v-layout> |
577 | - <v-flex xs4 sm4 class="pt-4 subheading"> | |
517 | + <v-flex xs4 class="pt-4 subheading"> | |
578 | 518 | <label class="right">Ending Time:</label> |
579 | 519 | </v-flex> |
580 | - <v-flex xs8 sm8 class="ml-3"> | |
520 | + <v-flex xs8 sm6 class="ml-3"> | |
581 | 521 | <v-menu |
582 | 522 | ref="menu" |
583 | 523 | :close-on-content-click="false" |
... | ... | @@ -700,8 +640,9 @@ export default { |
700 | 640 | token: "", |
701 | 641 | |
702 | 642 | menu1: false, |
703 | - menuB: false, | |
704 | 643 | menu2: false, |
644 | + menu4: false, | |
645 | + menu3: false, | |
705 | 646 | |
706 | 647 | schoolRules: [v => !!v || "School Year is required"], |
707 | 648 | classRules: [v => !!v || " Class Name is required"], |
... | ... | @@ -729,24 +670,15 @@ export default { |
729 | 670 | startingTime: "", |
730 | 671 | editedItem: {} |
731 | 672 | |
732 | - // editedItem: { | |
733 | - // schoolYear: "", | |
734 | - // day: "", | |
735 | - // teacherId: "", | |
736 | - // classId: "", | |
737 | - // sectionId: "", | |
738 | - // startingTime: "", | |
739 | - // endingTime: "", | |
740 | - // room: "", | |
741 | - // period: "", | |
742 | - // subjectName: "" | |
743 | - // } | |
744 | 673 | }), |
745 | 674 | methods: { |
746 | - editItem(item) { | |
675 | + editItem(item, routineData) { | |
676 | + console.log("routineData", routineData) | |
677 | + console.log("item", item) | |
747 | 678 | this.editedIndex = this.routineList; |
748 | 679 | this.editedItem = Object.assign({}, item); |
749 | - // this.editedItem.subjectName = item.lectureRoutine.subjectName; | |
680 | + this.editedItem.lectureRoutineId = item._id; | |
681 | + this.editedItem.routineId = routineData._id; | |
750 | 682 | this.dialog = true; |
751 | 683 | this.editRoutineDialog = true; |
752 | 684 | }, |
... | ... | @@ -818,52 +750,54 @@ export default { |
818 | 750 | }, |
819 | 751 | |
820 | 752 | update() { |
821 | - // if (this.$refs.formEditRoutine.validate()) { | |
822 | - // let editSubject = { | |
823 | - // classId: this.editedItem.classId, | |
824 | - // subjectId: this.editedItem._id, | |
825 | - // teacherId: this.editedItem.teacherId, | |
826 | - // type: this.editedItem.type, | |
827 | - // passMarks: this.editedItem.passMarks, | |
828 | - // finalMarks: this.editedItem.finalMarks, | |
829 | - // subjectAuthor: this.editedItem.subjectAuthor, | |
830 | - // subjectCode: this.editedItem.subjectCode, | |
831 | - // subjectName: this.editedItem.subjectName | |
832 | - // }; | |
833 | - // this.editLoading = true; | |
834 | - // http() | |
835 | - // .put("/updateSubject", editSubject) | |
836 | - // .then(response => { | |
837 | - // this.snackbar = true; | |
838 | - // this.text = "Successfully Edit Existing Subject"; | |
839 | - // this.color = "green"; | |
840 | - // this.editLoading = false; | |
841 | - // this.editRoutineDialog = false; | |
842 | - // http() | |
843 | - // .get( | |
844 | - // "/getParticularClass", | |
845 | - // { params: { classId: _id } }, | |
846 | - // { | |
847 | - // headers: { Authorization: "Bearer " + this.token } | |
848 | - // } | |
849 | - // ) | |
850 | - // .then(response => { | |
851 | - // this.subjectList = response.data.data; | |
852 | - // this.snackbar = true; | |
853 | - // this.color = "green"; | |
854 | - // this.text = response.data.message; | |
855 | - // this.close(); | |
856 | - // }) | |
857 | - // .catch(err => { | |
858 | - // console.log("err====>", err); | |
859 | - // }); | |
860 | - // }) | |
861 | - // .catch(error => { | |
862 | - // this.editLoading = false; | |
863 | - | |
864 | - // // console.log(error); | |
865 | - // }); | |
866 | - // } | |
753 | + if (this.$refs.formEditRoutine.validate()) { | |
754 | + let editRoutine = { | |
755 | + routineId: this.editedItem.routineId, | |
756 | + lectureRoutineId: this.editedItem.lectureRoutineId, | |
757 | + subjectName: this.editedItem.subjectName, | |
758 | + teacherId: this.editedItem.teacherId, | |
759 | + startingTime: this.editedItem.startingTime, | |
760 | + endingTime: this.editedItem.endingTime, | |
761 | + room: this.editedItem.room, | |
762 | + period: this.editedItem.period | |
763 | + }; | |
764 | + this.editLoading = true; | |
765 | + http() | |
766 | + .put("/updateRoutine", editRoutine) | |
767 | + .then(response => { | |
768 | + this.snackbar = true; | |
769 | + this.text = "Successfully Edit Existing Routine"; | |
770 | + this.color = "green"; | |
771 | + this.editLoading = false; | |
772 | + this.editRoutineDialog = false; | |
773 | + this.getRoutineList(); | |
774 | + // http() | |
775 | + // .get( | |
776 | + // "/getRoutineList", | |
777 | + // { | |
778 | + // params: { | |
779 | + // classId: this.addRoutine.classId, | |
780 | + // sectionId: this.addRoutine.sectionId | |
781 | + // } | |
782 | + // }, | |
783 | + // { | |
784 | + // headers: { Authorization: "Bearer " + this.token } | |
785 | + // } | |
786 | + // ) | |
787 | + // .then(response => { | |
788 | + // this.routineList = response.data.data; | |
789 | + // this.showLoader = false; | |
790 | + // this.showTable = true; | |
791 | + // this.hideTable = false; | |
792 | + // }) | |
793 | + // .catch(err => { | |
794 | + // console.log("err====>", err); | |
795 | + // }); | |
796 | + }) | |
797 | + .catch(error => { | |
798 | + this.editLoading = false; | |
799 | + }); | |
800 | + } | |
867 | 801 | }, |
868 | 802 | getClass() { |
869 | 803 | http() | ... | ... |