Commit 6ef5200204b13f0a0ed31c47d34bbc7bc4ecfe9b
1 parent
6c8f4ba9ad
Exists in
master
and in
3 other branches
implement all functionality of meetingEvent and enroll student
Showing
5 changed files
with
793 additions
and
31 deletions
Show diff stats
src/api/menu.js
... | ... | @@ -322,6 +322,12 @@ const teacherMenu = [{ |
322 | 322 | icon: '/static/icon/student.png', |
323 | 323 | }, |
324 | 324 | { |
325 | + title: 'Meeting Event', | |
326 | + // group: 'apps', | |
327 | + name: 'Meeting Event', | |
328 | + icon: '/static/icon/student.png', | |
329 | + }, | |
330 | + { | |
325 | 331 | title: 'Attendance', |
326 | 332 | group: 'Attendance', |
327 | 333 | component: 'Attendance', | ... | ... |
src/pages/Course/courseDetail.vue
src/pages/Course/enrollStudents.vue
... | ... | @@ -56,8 +56,8 @@ |
56 | 56 | <tr class="tr" :active="props.selected" @click="props.selected = !props.selected"> |
57 | 57 | <td class="text-xs-center td td-row"> |
58 | 58 | <v-checkbox |
59 | - :input-value="props.selected" | |
60 | - @change="selectParticularStudent(props.item._id)" | |
59 | + v-model="props.item.enroll" | |
60 | + @change="selectParticularStudent(props.item)" | |
61 | 61 | primary |
62 | 62 | hide-details |
63 | 63 | ></v-checkbox> |
... | ... | @@ -170,12 +170,7 @@ export default { |
170 | 170 | studentsData: [], |
171 | 171 | courseData: [], |
172 | 172 | addSection: [], |
173 | - selected: [], | |
174 | - SectionName: ["A", "B", "C", "D", "E", "F"], | |
175 | - classRules: [v => !!v || "Class is required"], | |
176 | - sectionRules: [v => !!v || "Class is required"], | |
177 | - studentRules: [v => !!v || "Student is required"], | |
178 | - dataValid: [v => !!v || "Date is required"] | |
173 | + selected: [] | |
179 | 174 | }), |
180 | 175 | methods: { |
181 | 176 | save(date) { |
... | ... | @@ -227,6 +222,7 @@ export default { |
227 | 222 | for (let i = 0; i < this.studentsData.length; i++) { |
228 | 223 | this.studentsData[i].attendence = true; |
229 | 224 | } |
225 | + this.getParticularCourse(); | |
230 | 226 | }) |
231 | 227 | .catch(error => { |
232 | 228 | console.log("err====>", error); |
... | ... | @@ -234,9 +230,8 @@ export default { |
234 | 230 | }); |
235 | 231 | }, |
236 | 232 | getStudentTable(id) { |
237 | - console.log("id", this.getReport.courseId); | |
233 | + // console.log("id", this.getReport.courseId); | |
238 | 234 | this.getStudents(); |
239 | - this.getParticularCourse(); | |
240 | 235 | }, |
241 | 236 | update() { |
242 | 237 | var studentsAttendence = []; |
... | ... | @@ -268,10 +263,11 @@ export default { |
268 | 263 | toggleAll() { |
269 | 264 | if (this.selected.length) this.selected = []; |
270 | 265 | else this.selected = this.studentsData.slice(); |
271 | - console.log("this.selected", this.selected); | |
272 | - console.log("selected====", selected); | |
273 | 266 | let selectedStudentsArray = []; |
274 | - selectedStudentsArray.push({ studentId: selected.id }); | |
267 | + for (let i = 0; i < this.selected.length; i++) { | |
268 | + selectedStudentsArray.push({ studentId: this.selected[i]._id }); | |
269 | + } | |
270 | + // console.log("selectedStudentsArray", selectedStudentsArray); | |
275 | 271 | var payload = { |
276 | 272 | courseId: this.getReport.courseId, |
277 | 273 | enrollStudents: selectedStudentsArray |
... | ... | @@ -281,6 +277,7 @@ export default { |
281 | 277 | .then(response => { |
282 | 278 | this.snackbar = true; |
283 | 279 | this.text = response.data.message; |
280 | + this.getParticularCourse() | |
284 | 281 | }) |
285 | 282 | .catch(error => { |
286 | 283 | this.snackbar = true; |
... | ... | @@ -288,23 +285,49 @@ export default { |
288 | 285 | }); |
289 | 286 | }, |
290 | 287 | selectParticularStudent(selected) { |
291 | - console.log("selected====", selected); | |
288 | + console.log("selected", selected); | |
292 | 289 | let selectedStudentsArray = []; |
293 | - selectedStudentsArray.push({ studentId: selected }); | |
294 | - var payload = { | |
295 | - courseId: this.getReport.courseId, | |
296 | - enrollStudents: selectedStudentsArray | |
297 | - }; | |
298 | - http() | |
299 | - .put("/enrollStudents", payload) | |
300 | - .then(response => { | |
301 | - this.snackbar = true; | |
302 | - this.text = response.data.message; | |
303 | - }) | |
304 | - .catch(error => { | |
305 | - this.snackbar = true; | |
306 | - this.text = error.response.data.message; | |
307 | - }); | |
290 | + selectedStudentsArray.push({ studentId: selected._id }); | |
291 | + if ( | |
292 | + selected.enroll === true && | |
293 | + selected.enroll === undefined && | |
294 | + selected.enroll === null | |
295 | + ) { | |
296 | + var payload = { | |
297 | + courseId: this.getReport.courseId, | |
298 | + enrollStudents: selectedStudentsArray | |
299 | + }; | |
300 | + http() | |
301 | + .put("/enrollStudents", payload) | |
302 | + .then(response => { | |
303 | + this.snackbar = true; | |
304 | + this.text = response.data.message; | |
305 | + }) | |
306 | + .catch(error => { | |
307 | + this.snackbar = true; | |
308 | + this.text = error.response.data.message; | |
309 | + }); | |
310 | + } | |
311 | + if ( | |
312 | + selected.enroll == false && | |
313 | + selected.enroll != undefined && | |
314 | + selected.enroll != null | |
315 | + ) { | |
316 | + var payloadDeleteStudents = { | |
317 | + courseId: this.getReport.courseId, | |
318 | + enrollStudentsId: selected.enrollId | |
319 | + }; | |
320 | + http() | |
321 | + .put("/deleteStudents", payloadDeleteStudents) | |
322 | + .then(response => { | |
323 | + this.snackbar = true; | |
324 | + this.text = response.data.message; | |
325 | + }) | |
326 | + .catch(error => { | |
327 | + this.snackbar = true; | |
328 | + this.text = error.response.data.message; | |
329 | + }); | |
330 | + } | |
308 | 331 | }, |
309 | 332 | getParticularCourse() { |
310 | 333 | var payload = { |
... | ... | @@ -315,7 +338,17 @@ export default { |
315 | 338 | params: payload |
316 | 339 | }) |
317 | 340 | .then(response => { |
318 | - conso.log("DTAAAAA", response.data.data); | |
341 | + for (let i = 0; i < response.data.data.enrollStudents.length; i++) { | |
342 | + var studentId = {}; | |
343 | + studentId = response.data.data.enrollStudents[i]; | |
344 | + for (let j = 0; j < this.studentsData.length; j++) { | |
345 | + if (studentId.studentId == this.studentsData[j]._id) { | |
346 | + console.log("studentId._id", studentId._id); | |
347 | + this.studentsData[j].enroll = true; | |
348 | + this.studentsData[j].enrollId = studentId._id; | |
349 | + } | |
350 | + } | |
351 | + } | |
319 | 352 | this.snackbar = true; |
320 | 353 | this.text = response.data.message; |
321 | 354 | }) | ... | ... |
src/pages/meetingEvent/meetingEvent.vue
... | ... | @@ -0,0 +1,711 @@ |
1 | +<template> | |
2 | + <v-container fluid class="body-color"> | |
3 | + <!-- ****** EDITS EVENT ****** --> | |
4 | + <v-dialog v-model="editEventdialog" max-width="500px"> | |
5 | + <v-card flat class="card-style pa-2" dark> | |
6 | + <v-layout> | |
7 | + <v-flex xs12> | |
8 | + <label class="title text-xs-center">Edit Meeting Event</label> | |
9 | + <v-icon size="24" class="right" @click="editEventdialog = false">cancel</v-icon> | |
10 | + </v-flex> | |
11 | + </v-layout> | |
12 | + <v-container fluid> | |
13 | + <v-flex xs12 sm12> | |
14 | + <v-layout> | |
15 | + <v-flex xs4 class="pt-4 subheading"> | |
16 | + <label class="right">Title:</label> | |
17 | + </v-flex> | |
18 | + <v-flex xs7 class="ml-3"> | |
19 | + <v-text-field v-model="editedItem.title" type="text"></v-text-field> | |
20 | + </v-flex> | |
21 | + </v-layout> | |
22 | + </v-flex> | |
23 | + <v-flex xs12 sm12> | |
24 | + <v-layout> | |
25 | + <v-flex xs4 class="pt-4 subheading"> | |
26 | + <label class="right">Date:</label> | |
27 | + </v-flex> | |
28 | + <v-flex xs7 class="ml-3"> | |
29 | + <v-menu | |
30 | + ref="menu" | |
31 | + :close-on-content-click="false" | |
32 | + v-model="menuEditDate" | |
33 | + :nudge-right="40" | |
34 | + lazy | |
35 | + transition="scale-transition" | |
36 | + offset-y | |
37 | + full-width | |
38 | + min-width="290px" | |
39 | + > | |
40 | + <v-text-field | |
41 | + slot="activator" | |
42 | + v-model="editedItem.dateOfEvent" | |
43 | + placeholder="Select date" | |
44 | + ></v-text-field> | |
45 | + <v-date-picker | |
46 | + color="info" | |
47 | + ref="picker" | |
48 | + v-model="editedItem.dateOfEvent" | |
49 | + @input="$refs.menu.save(editedItem.dateOfEvent)" | |
50 | + ></v-date-picker> | |
51 | + </v-menu> | |
52 | + </v-flex> | |
53 | + </v-layout> | |
54 | + </v-flex> | |
55 | + <v-flex xs12 sm12> | |
56 | + <v-layout> | |
57 | + <v-flex xs4 class="pt-4 subheading"> | |
58 | + <label class="right">Start Time:</label> | |
59 | + </v-flex> | |
60 | + <v-flex xs7 class="ml-3"> | |
61 | + <v-menu | |
62 | + ref="menuEdit" | |
63 | + :close-on-content-click="false" | |
64 | + v-model="menuEditTime" | |
65 | + :nudge-right="40" | |
66 | + :return-value.sync="editedItem.startTime" | |
67 | + lazy | |
68 | + transition="scale-transition" | |
69 | + offset-y | |
70 | + full-width | |
71 | + max-width="290px" | |
72 | + min-width="290px" | |
73 | + > | |
74 | + <v-text-field | |
75 | + slot="activator" | |
76 | + v-model="editedItem.startTime" | |
77 | + append-icon="access_time" | |
78 | + readonly | |
79 | + ></v-text-field> | |
80 | + <v-time-picker | |
81 | + v-model="editedItem.startTime" | |
82 | + @change="$refs.menuEdit.save(editedItem.startTime)" | |
83 | + ></v-time-picker> | |
84 | + </v-menu> | |
85 | + </v-flex> | |
86 | + </v-layout> | |
87 | + </v-flex> | |
88 | + <v-flex xs12 sm12> | |
89 | + <v-layout> | |
90 | + <v-flex xs4 class="pt-4 subheading"> | |
91 | + <label class="right">Duration:</label> | |
92 | + </v-flex> | |
93 | + <v-flex xs7 class="ml-3"> | |
94 | + <v-text-field v-model="editedItem.duration" type="text"></v-text-field> | |
95 | + </v-flex> | |
96 | + </v-layout> | |
97 | + </v-flex> | |
98 | + <v-layout> | |
99 | + <v-flex xs12> | |
100 | + <v-card-actions class="hidden-xs-only hidden-sm-only"> | |
101 | + <v-spacer></v-spacer> | |
102 | + <v-btn round dark @click="save" class="add-button">Save</v-btn> | |
103 | + </v-card-actions> | |
104 | + <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | |
105 | + <v-spacer></v-spacer> | |
106 | + <v-btn round dark @click="save" class="add-button">Save</v-btn> | |
107 | + <v-spacer></v-spacer> | |
108 | + </v-card-actions> | |
109 | + </v-flex> | |
110 | + </v-layout> | |
111 | + </v-container> | |
112 | + </v-card> | |
113 | + </v-dialog> | |
114 | + <!-- ****** PROFILE VIEW EVENT ****** --> | |
115 | + <v-dialog v-model="viewEventdialog" max-width="500px"> | |
116 | + <v-card flat class="card-style pa-3" dark> | |
117 | + <v-layout> | |
118 | + <v-flex xs12> | |
119 | + <label class="title text-xs-center">View Meeting Event</label> | |
120 | + <v-icon size="24" class="right" @click="viewEventdialog = false">cancel</v-icon> | |
121 | + </v-flex> | |
122 | + </v-layout> | |
123 | + <v-card-text> | |
124 | + <v-container grid-list-md> | |
125 | + <v-layout wrap> | |
126 | + <v-flex> | |
127 | + <v-layout> | |
128 | + <v-flex xs4 sm6> | |
129 | + <h5 class="right my-1"> | |
130 | + <b>Title:</b> | |
131 | + </h5> | |
132 | + </v-flex> | |
133 | + <v-flex sm6 xs8> | |
134 | + <h5 class="my-1">{{ editedItem.title }}</h5> | |
135 | + </v-flex> | |
136 | + </v-layout> | |
137 | + <v-layout> | |
138 | + <v-flex xs4 sm6> | |
139 | + <h5 class="right my-1"> | |
140 | + <b>Date:</b> | |
141 | + </h5> | |
142 | + </v-flex> | |
143 | + <v-flex sm6 xs8> | |
144 | + <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5> | |
145 | + </v-flex> | |
146 | + </v-layout> | |
147 | + <v-layout> | |
148 | + <v-flex xs4 sm6> | |
149 | + <h5 class="right my-1"> | |
150 | + <b>Start Time:</b> | |
151 | + </h5> | |
152 | + </v-flex> | |
153 | + <v-flex sm6 xs8> | |
154 | + <h5 class="my-1">{{ editedItem.startTime }}</h5> | |
155 | + </v-flex> | |
156 | + </v-layout> | |
157 | + <v-layout> | |
158 | + <v-flex xs4 sm6> | |
159 | + <h5 class="right my-1"> | |
160 | + <b>Type Of Event:</b> | |
161 | + </h5> | |
162 | + </v-flex> | |
163 | + <v-flex sm6 xs8> | |
164 | + <h5 class="my-1">{{ editedItem.typeOfEvent }}</h5> | |
165 | + </v-flex> | |
166 | + </v-layout> | |
167 | + <v-layout v-if="editedItem.classId"> | |
168 | + <v-flex xs4 sm6> | |
169 | + <h5 class="right my-1"> | |
170 | + <b>Class:</b> | |
171 | + </h5> | |
172 | + </v-flex> | |
173 | + <v-flex sm6 xs8> | |
174 | + <h5 class="my-1">{{ editedItem.classId.classNum }}</h5> | |
175 | + </v-flex> | |
176 | + </v-layout> | |
177 | + <v-layout> | |
178 | + <v-flex xs4 sm6> | |
179 | + <h5 class="right my-1"> | |
180 | + <b>Duration:</b> | |
181 | + </h5> | |
182 | + </v-flex> | |
183 | + <v-flex sm6 xs8> | |
184 | + <h5 class="my-1">{{ editedItem.duration }}</h5> | |
185 | + </v-flex> | |
186 | + </v-layout> | |
187 | + </v-flex> | |
188 | + </v-layout> | |
189 | + </v-container> | |
190 | + </v-card-text> | |
191 | + </v-card> | |
192 | + </v-dialog> | |
193 | + | |
194 | + <!-- ****** EVENT TABLE ****** --> | |
195 | + | |
196 | + <v-toolbar color="transparent" flat> | |
197 | + <v-btn | |
198 | + fab | |
199 | + dark | |
200 | + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | |
201 | + small | |
202 | + @click="meetEventDialog = true" | |
203 | + > | |
204 | + <v-icon dark>add</v-icon> | |
205 | + </v-btn> | |
206 | + <v-btn | |
207 | + round | |
208 | + class="open-dialog-button hidden-sm-only hidden-xs-only" | |
209 | + dark | |
210 | + @click="meetEventDialog = true" | |
211 | + > | |
212 | + <v-icon class="white--text pr-1" size="20">add</v-icon>Add Event | |
213 | + </v-btn> | |
214 | + <v-spacer></v-spacer> | |
215 | + <v-card-title class="body-1" v-show="show"> | |
216 | + <v-btn icon large flat @click="displaySearch"> | |
217 | + <v-avatar size="27"> | |
218 | + <img src="/static/icon/search.png" alt="icon" /> | |
219 | + </v-avatar> | |
220 | + </v-btn> | |
221 | + </v-card-title> | |
222 | + <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | |
223 | + <v-layout> | |
224 | + <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | |
225 | + <v-icon @click="closeSearch" color="error">close</v-icon> | |
226 | + </v-layout> | |
227 | + </v-flex> | |
228 | + </v-toolbar> | |
229 | + <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> | |
230 | + <template slot="items" slot-scope="props"> | |
231 | + <tr class="tr"> | |
232 | + <td class="td td-row">{{ props.index + 1}}</td> | |
233 | + <td | |
234 | + class="td td-row text-xs-center" | |
235 | + >{{ props.item.classId ? props.item.classId.classNum : "-" }}</td> | |
236 | + <td class="td td-row text-xs-center">{{ props.item.title }}</td> | |
237 | + <td class="td td-row text-xs-center">{{ dates(props.item.dateOfEvent) }}</td> | |
238 | + <td class="td td-row text-xs-center">{{ props.item.startTime }}</td> | |
239 | + <td class="td td-row text-xs-center"> | |
240 | + <span> | |
241 | + <v-tooltip top> | |
242 | + <img | |
243 | + slot="activator" | |
244 | + style="cursor:pointer; width:25px; height:25px; " | |
245 | + class="mr-3" | |
246 | + @click="profile(props.item)" | |
247 | + src="/static/icon/view.png" | |
248 | + /> | |
249 | + <span>View</span> | |
250 | + </v-tooltip> | |
251 | + <v-tooltip top> | |
252 | + <img | |
253 | + slot="activator" | |
254 | + style="cursor:pointer; width:20px; height:18px; " | |
255 | + class="mr-3" | |
256 | + @click="editItem(props.item)" | |
257 | + src="/static/icon/edit.png" | |
258 | + /> | |
259 | + <span>Edit</span> | |
260 | + </v-tooltip> | |
261 | + <v-tooltip top> | |
262 | + <img | |
263 | + slot="activator" | |
264 | + style="cursor:pointer; width:20px; height:20px; " | |
265 | + class="mr-3" | |
266 | + @click="deleteItem(props.item)" | |
267 | + src="/static/icon/delete.png" | |
268 | + /> | |
269 | + <span>Delete</span> | |
270 | + </v-tooltip> | |
271 | + </span> | |
272 | + </td> | |
273 | + </tr> | |
274 | + </template> | |
275 | + <v-alert | |
276 | + slot="no-results" | |
277 | + :value="true" | |
278 | + color="error" | |
279 | + icon="warning" | |
280 | + >Your search for "{{ search }}" found no results.</v-alert> | |
281 | + </v-data-table> | |
282 | + <!-- ****** ADD MULTIPLE EVENT ****** --> | |
283 | + <v-dialog v-model="meetEventDialog" max-width="500px"> | |
284 | + <v-card flat class="card-style pa-2" dark> | |
285 | + <v-layout> | |
286 | + <v-flex xs12> | |
287 | + <label class="title text-xs-center">Add Meeting Event</label> | |
288 | + <v-icon size="24" class="right" @click="meetEventDialog = false">cancel</v-icon> | |
289 | + </v-flex> | |
290 | + </v-layout> | |
291 | + <v-form ref="form" v-model="valid" lazy-validation> | |
292 | + <v-container fluid> | |
293 | + <v-flex xs12> | |
294 | + <v-layout> | |
295 | + <v-flex xs4 class="pt-4 subheading"> | |
296 | + <label class="right">Title:</label> | |
297 | + </v-flex> | |
298 | + <v-flex xs8 sm8 class="ml-3"> | |
299 | + <v-text-field | |
300 | + v-model="meetEvent.title" | |
301 | + placeholder="fill your Title" | |
302 | + type="text" | |
303 | + :rules="titleRules" | |
304 | + required | |
305 | + ></v-text-field> | |
306 | + </v-flex> | |
307 | + </v-layout> | |
308 | + </v-flex> | |
309 | + <v-flex xs12> | |
310 | + <v-layout> | |
311 | + <v-flex xs4 class="pt-4 subheading"> | |
312 | + <label class="right">Date:</label> | |
313 | + </v-flex> | |
314 | + <v-flex xs8 sm8 class="ml-3"> | |
315 | + <v-menu | |
316 | + ref="menu1" | |
317 | + :close-on-content-click="false" | |
318 | + v-model="menu1" | |
319 | + :nudge-right="40" | |
320 | + :return-value.sync="meetEvent.dateOfEvent" | |
321 | + app | |
322 | + lazy | |
323 | + transition="scale-transition" | |
324 | + offset-y | |
325 | + full-width | |
326 | + min-width="290px" | |
327 | + > | |
328 | + <v-text-field | |
329 | + slot="activator" | |
330 | + :rules="dateRules" | |
331 | + v-model="meetEvent.dateOfEvent" | |
332 | + append-icon="event" | |
333 | + placeholder="Select date" | |
334 | + ></v-text-field> | |
335 | + <v-date-picker | |
336 | + color="info" | |
337 | + v-model="meetEvent.dateOfEvent" | |
338 | + @input="$refs.menu1.save(meetEvent.dateOfEvent)" | |
339 | + ></v-date-picker> | |
340 | + </v-menu> | |
341 | + </v-flex> | |
342 | + </v-layout> | |
343 | + </v-flex> | |
344 | + <v-flex xs12> | |
345 | + <v-layout> | |
346 | + <v-flex xs4 class="pt-4 subheading"> | |
347 | + <label class="right">Start Time:</label> | |
348 | + </v-flex> | |
349 | + <v-flex xs8 sm8 class="ml-3"> | |
350 | + <v-menu | |
351 | + ref="menuA" | |
352 | + :close-on-content-click="false" | |
353 | + v-model="menu2" | |
354 | + :nudge-right="40" | |
355 | + :return-value.sync="meetEvent.startTime" | |
356 | + lazy | |
357 | + transition="scale-transition" | |
358 | + offset-y | |
359 | + full-width | |
360 | + max-width="290px" | |
361 | + min-width="290px" | |
362 | + > | |
363 | + <v-text-field | |
364 | + slot="activator" | |
365 | + v-model="meetEvent.startTime" | |
366 | + placeholder="Select Start time" | |
367 | + append-icon="access_time" | |
368 | + :rules="startTimeRules" | |
369 | + readonly | |
370 | + ></v-text-field> | |
371 | + <v-time-picker | |
372 | + v-model="meetEvent.startTime" | |
373 | + @change="$refs.menuA.save(meetEvent.startTime)" | |
374 | + ></v-time-picker> | |
375 | + </v-menu> | |
376 | + </v-flex> | |
377 | + </v-layout> | |
378 | + </v-flex> | |
379 | + <v-flex xs12> | |
380 | + <v-layout> | |
381 | + <v-flex xs4 class="pt-4 subheading"> | |
382 | + <label class="right">Type Of Event:</label> | |
383 | + </v-flex> | |
384 | + <v-flex xs8 sm8 class="ml-3"> | |
385 | + <v-select | |
386 | + :items="typeOfEvent" | |
387 | + label="Select Type Of Event" | |
388 | + v-model="meetEvent.typeOfEvent" | |
389 | + :rules="typeOfEventRules" | |
390 | + @change="getSelectOption(meetEvent.typeOfEvent)" | |
391 | + ></v-select> | |
392 | + </v-flex> | |
393 | + </v-layout> | |
394 | + </v-flex> | |
395 | + <v-flex xs12 v-show="classShow"> | |
396 | + <v-layout> | |
397 | + <v-flex xs4 class="pt-4 subheading"> | |
398 | + <label class="right">Class:</label> | |
399 | + </v-flex> | |
400 | + <v-flex xs8 sm8 class="ml-3"> | |
401 | + <v-select | |
402 | + :items="addclass" | |
403 | + label="Select Class" | |
404 | + v-model="meetEvent.classId" | |
405 | + item-text="classNum" | |
406 | + item-value="_id" | |
407 | + @change="getCourses(meetEvent.classNum)" | |
408 | + ></v-select> | |
409 | + </v-flex> | |
410 | + </v-layout> | |
411 | + </v-flex> | |
412 | + <v-flex xs12 v-show="courseShow"> | |
413 | + <v-layout> | |
414 | + <v-flex xs4 class="pt-4 subheading"> | |
415 | + <label class="right">Courses:</label> | |
416 | + </v-flex> | |
417 | + <v-flex xs8 sm8 class="ml-3"> | |
418 | + <v-select | |
419 | + :items="courseData" | |
420 | + label="Select Course" | |
421 | + v-model="meetEvent.courseId" | |
422 | + item-text="coursrName" | |
423 | + item-value="_id" | |
424 | + required | |
425 | + ></v-select> | |
426 | + </v-flex> | |
427 | + </v-layout> | |
428 | + </v-flex> | |
429 | + <v-flex xs12> | |
430 | + <v-layout> | |
431 | + <v-flex xs4 class="pt-4 subheading"> | |
432 | + <label class="right">Duration</label> | |
433 | + </v-flex> | |
434 | + <v-flex xs8 sm8 class="ml-3"> | |
435 | + <v-text-field | |
436 | + placeholder="fill your Description" | |
437 | + :rules="descriptionRules" | |
438 | + v-model="meetEvent.duration" | |
439 | + type="text" | |
440 | + required | |
441 | + ></v-text-field> | |
442 | + </v-flex> | |
443 | + </v-layout> | |
444 | + </v-flex> | |
445 | + <v-layout> | |
446 | + <v-flex xs12> | |
447 | + <v-layout class="right"> | |
448 | + <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | |
449 | + <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | |
450 | + </v-layout> | |
451 | + </v-flex> | |
452 | + </v-layout> | |
453 | + </v-container> | |
454 | + </v-form> | |
455 | + </v-card> | |
456 | + </v-dialog> | |
457 | + <v-snackbar | |
458 | + :timeout="timeout" | |
459 | + :top="y === 'top'" | |
460 | + :right="x === 'right'" | |
461 | + :vertical="mode === 'vertical'" | |
462 | + v-model="snackbar" | |
463 | + :color="color" | |
464 | + >{{ text }}</v-snackbar> | |
465 | + <div class="loader" v-if="showLoader"> | |
466 | + <v-progress-circular indeterminate color="white"></v-progress-circular> | |
467 | + </div> | |
468 | + </v-container> | |
469 | +</template> | |
470 | + | |
471 | +<script> | |
472 | +import http from "@/Services/http.js"; | |
473 | +import moment from "moment"; | |
474 | + | |
475 | +export default { | |
476 | + data: () => ({ | |
477 | + snackbar: false, | |
478 | + y: "top", | |
479 | + x: "right", | |
480 | + mode: "", | |
481 | + timeout: 5000, | |
482 | + text: "", | |
483 | + color: "", | |
484 | + loading: false, | |
485 | + date: null, | |
486 | + search: "", | |
487 | + color: "", | |
488 | + show: true, | |
489 | + meetEventDialog: false, | |
490 | + showSearch: false, | |
491 | + showLoader: false, | |
492 | + editEventdialog: false, | |
493 | + viewEventdialog: false, | |
494 | + valid: true, | |
495 | + addclass: [], | |
496 | + courseData: [], | |
497 | + pagination: { | |
498 | + rowsPerPage: 10 | |
499 | + }, | |
500 | + date: null, | |
501 | + menu1: false, | |
502 | + menu: false, | |
503 | + menuEditTime: false, | |
504 | + menuEditDate: false, | |
505 | + titleRules: [v => !!v || " Tilte is required"], | |
506 | + descriptionRules: [v => !!v || " Discription is required"], | |
507 | + dateRules: [v => !!v || "Date of event is required"], | |
508 | + startTimeRules: [v => !!v || "Start Time is required"], | |
509 | + typeOfEventRules: [v => !!v || "Type of event is required"], | |
510 | + headers: [ | |
511 | + { | |
512 | + text: "No", | |
513 | + align: "", | |
514 | + sortable: false, | |
515 | + value: "No" | |
516 | + }, | |
517 | + { | |
518 | + text: "Class", | |
519 | + value: "classNum", | |
520 | + sortable: false, | |
521 | + align: "center" | |
522 | + }, | |
523 | + { text: "Title", value: "title", sortable: false, align: "center" }, | |
524 | + { | |
525 | + text: "Date Of Event", | |
526 | + value: "dateOfEvent", | |
527 | + sortable: false, | |
528 | + align: "center" | |
529 | + }, | |
530 | + { | |
531 | + text: "Start Time", | |
532 | + value: "startTime", | |
533 | + sortable: false, | |
534 | + align: "center" | |
535 | + }, | |
536 | + { text: "Action", value: "", sortable: false, align: "center" } | |
537 | + ], | |
538 | + events: [], | |
539 | + typeOfEvent: ["Class", "Course"], | |
540 | + editedIndex: -1, | |
541 | + meetEvent: { | |
542 | + startTime: null | |
543 | + }, | |
544 | + editedItem: {}, | |
545 | + menu1: false, | |
546 | + menu2: false, | |
547 | + classShow: false, | |
548 | + courseShow: false, | |
549 | + loginId: "" | |
550 | + }), | |
551 | + methods: { | |
552 | + dates: function(date) { | |
553 | + return moment(date).format("MMMM DD, YYYY"); | |
554 | + }, | |
555 | + getEvents() { | |
556 | + this.showLoader = true; | |
557 | + var token = this.$store.state.token; | |
558 | + http() | |
559 | + .get("/getMeetingEventesList", { | |
560 | + params: { teacherId: this.loginId }, | |
561 | + headers: { Authorization: "Bearer " + token } | |
562 | + }) | |
563 | + .then(response => { | |
564 | + this.events = response.data.data; | |
565 | + this.showLoader = false; | |
566 | + }) | |
567 | + .catch(error => { | |
568 | + // console.log("err====>", err); | |
569 | + this.showLoader = false; | |
570 | + if (error.response.status === 401) { | |
571 | + this.$router.replace({ path: "/" }); | |
572 | + this.$store.dispatch("setToken", null); | |
573 | + this.$store.dispatch("Id", null); | |
574 | + } | |
575 | + }); | |
576 | + }, | |
577 | + editItem(item) { | |
578 | + this.editedIndex = this.events.indexOf(item); | |
579 | + this.editedItem = Object.assign({}, item); | |
580 | + this.editedItem.meetingEventId = item._id; | |
581 | + this.editEventdialog = true; | |
582 | + }, | |
583 | + profile(item) { | |
584 | + this.editedIndex = this.events.indexOf(item); | |
585 | + this.editedItem = Object.assign({}, item); | |
586 | + this.viewEventdialog = true; | |
587 | + }, | |
588 | + | |
589 | + deleteItem(item) { | |
590 | + let deleteEvent = { | |
591 | + meetingEventId: item._id | |
592 | + }; | |
593 | + http() | |
594 | + .delete( | |
595 | + "/deleteMeetingEvent", | |
596 | + confirm("Are you sure you want to delete this?") && { | |
597 | + params: deleteEvent | |
598 | + } | |
599 | + ) | |
600 | + .then(response => { | |
601 | + this.snackbar = true; | |
602 | + this.text = response.data.message; | |
603 | + this.getEvents(); | |
604 | + this.snackbar = true; | |
605 | + this.color = "green"; | |
606 | + this.text = response.data.message; | |
607 | + }) | |
608 | + .catch(error => { | |
609 | + this.snackbar = true; | |
610 | + this.text = error.response.data.message; | |
611 | + this.color = "error"; | |
612 | + this.loading = false; | |
613 | + }); | |
614 | + }, | |
615 | + getSelectOption(type) { | |
616 | + if (type == "Class") { | |
617 | + this.classShow = true; | |
618 | + this.courseShow = false; | |
619 | + } else if (type == "Course") { | |
620 | + this.courseShow = true; | |
621 | + } | |
622 | + }, | |
623 | + getAllClass() { | |
624 | + http() | |
625 | + .get("/getClassesList") | |
626 | + .then(response => { | |
627 | + this.addclass = response.data.data; | |
628 | + }) | |
629 | + .catch(error => { | |
630 | + // console.log("err====>", err); | |
631 | + // this.$router.replace({ path: "/" }); | |
632 | + }); | |
633 | + }, | |
634 | + getCourses(classId) { | |
635 | + this.showLoader = true; | |
636 | + http() | |
637 | + .get("/getCourseesList", { | |
638 | + params: { | |
639 | + classId: classId | |
640 | + } | |
641 | + }) | |
642 | + .then(response => { | |
643 | + this.courseData = response.data.data; | |
644 | + this.showLoader = false; | |
645 | + }) | |
646 | + .catch(err => { | |
647 | + console.log("err====>", err); | |
648 | + this.showLoader = false; | |
649 | + }); | |
650 | + }, | |
651 | + close() { | |
652 | + this.editEventdialog = false; | |
653 | + }, | |
654 | + submit() { | |
655 | + if (this.$refs.form.validate()) { | |
656 | + this.loading = true; | |
657 | + http() | |
658 | + .post("/createMeetingEvent", this.meetEvent) | |
659 | + .then(response => { | |
660 | + this.snackbar = true; | |
661 | + this.text = response.data.message; | |
662 | + this.color = "green"; | |
663 | + this.getEvents(); | |
664 | + this.clear(); | |
665 | + this.loading = false; | |
666 | + this.meetEventDialog = false; | |
667 | + }) | |
668 | + .catch(error => { | |
669 | + this.snackbar = true; | |
670 | + this.text = error.response.data.message; | |
671 | + this.color = "error"; | |
672 | + this.loading = false; | |
673 | + }); | |
674 | + } | |
675 | + }, | |
676 | + clear() { | |
677 | + this.$refs.form.reset(); | |
678 | + }, | |
679 | + save() { | |
680 | + delete this.editedItem.classId; | |
681 | + http() | |
682 | + .put("/updateMeetingEvent", this.editedItem) | |
683 | + .then(response => { | |
684 | + this.snackbar = true; | |
685 | + this.text = response.data.message; | |
686 | + this.color = "green"; | |
687 | + this.getEvents(); | |
688 | + this.close(); | |
689 | + }) | |
690 | + .catch(error => { | |
691 | + this.snackbar = true; | |
692 | + this.text = error.response.data.message; | |
693 | + this.color = "error"; | |
694 | + }); | |
695 | + }, | |
696 | + displaySearch() { | |
697 | + (this.show = false), (this.showSearch = true); | |
698 | + }, | |
699 | + closeSearch() { | |
700 | + this.showSearch = false; | |
701 | + this.show = true; | |
702 | + this.search = ""; | |
703 | + } | |
704 | + }, | |
705 | + mounted() { | |
706 | + this.loginId = this.$store.state.id; | |
707 | + this.getEvents(); | |
708 | + this.getAllClass(); | |
709 | + } | |
710 | +}; | |
711 | +</script> | |
0 | 712 | \ No newline at end of file | ... | ... |
src/router/paths.js
... | ... | @@ -853,6 +853,18 @@ export default [{ |
853 | 853 | `@/pages/Annoucement/annoucement.vue` |
854 | 854 | ) |
855 | 855 | }, |
856 | + { | |
857 | + path: '/meetingEvent', | |
858 | + meta: {}, | |
859 | + name: 'Meeting Event', | |
860 | + props: (route) => ({ type: route.query.type }), | |
861 | + component: () => | |
862 | + import ( | |
863 | + /* webpackChunkName: "routes" */ | |
864 | + /* webpackMode: "lazy-once" */ | |
865 | + `@/pages/meetingEvent/meetingEvent.vue` | |
866 | + ) | |
867 | + }, | |
856 | 868 | //////SCHOOL |
857 | 869 | |
858 | 870 | { | ... | ... |