Commit 229463bd5fc4490deef9e0cef59f62a39b41d33e
1 parent
531728c2ef
Exists in
master
and in
3 other branches
implement design and functionality of enrollStudents,parents,annoucement,course
Showing
10 changed files
with
1951 additions
and
89 deletions
Show diff stats
src/api/menu.js
... | ... | @@ -270,7 +270,7 @@ const schoolMenu = [ |
270 | 270 | |
271 | 271 | const teacherMenu = [{ |
272 | 272 | title: 'Dashboard', |
273 | - name: 'School', | |
273 | + name: 'Dashboard', | |
274 | 274 | icon: '/static/icon/dashboard.png', |
275 | 275 | }, |
276 | 276 | { |
... | ... | @@ -304,6 +304,24 @@ const teacherMenu = [{ |
304 | 304 | ] |
305 | 305 | }, |
306 | 306 | { |
307 | + title: 'Course', | |
308 | + group: 'Course', | |
309 | + component: 'Course', | |
310 | + icon: '/static/icon/school.png', | |
311 | + items: [ | |
312 | + { name: 'Course', title: 'Course', component: 'Course', action: '', }, | |
313 | + { name: 'Enroll Students', title: 'Enroll Students', component: 'Enroll Students', action: '', }, | |
314 | + // { name: 'Assignment', title: 'Assignment', component: 'Assignment', action: '', }, | |
315 | + // { name: 'Routine', title: 'Routine', component: 'Routine', action: '', }, | |
316 | + ] | |
317 | + }, | |
318 | + { | |
319 | + title: 'Annoucement', | |
320 | + // group: 'apps', | |
321 | + name: 'Annoucement', | |
322 | + icon: '/static/icon/student.png', | |
323 | + }, | |
324 | + { | |
307 | 325 | title: 'Attendance', |
308 | 326 | group: 'Attendance', |
309 | 327 | component: 'Attendance', | ... | ... |
src/pages/Annoucement/annoucement.vue
... | ... | @@ -0,0 +1,788 @@ |
1 | +<template> | |
2 | + <v-container fluid class="body-color"> | |
3 | + <!-- ****** EDITS COURSES DETAILS ****** --> | |
4 | + <v-dialog v-model="editStudentDialog" max-width="600px" scrollable> | |
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 Annoucement</label> | |
9 | + <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon> | |
10 | + </v-flex> | |
11 | + </v-layout> | |
12 | + <v-card-text> | |
13 | + <v-form ref="form"> | |
14 | + <v-container fluid> | |
15 | + <v-layout> | |
16 | + <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | |
17 | + <v-avatar size="100px" v-if="!editedItem.attachementUrl && !editImageUrl"> | |
18 | + <img src="/static/icon/user.png" /> | |
19 | + </v-avatar> | |
20 | + <img | |
21 | + :src="editedItem.attachementUrl" | |
22 | + v-else-if="editedItem.attachementUrl && !editImageUrl" | |
23 | + height="150" | |
24 | + style="border-radius:50%; width:150px" | |
25 | + /> | |
26 | + <img | |
27 | + v-if="editImageUrl" | |
28 | + :src="editImageUrl" | |
29 | + style="border-radius:50%; width:150px;height:150px" | |
30 | + /> | |
31 | + <input | |
32 | + type="file" | |
33 | + style="display: none" | |
34 | + ref="editDataImage" | |
35 | + accept="image/*" | |
36 | + @change="onEditFilePicked" | |
37 | + /> | |
38 | + </v-flex> | |
39 | + </v-layout> | |
40 | + <v-layout wrap> | |
41 | + <v-flex xs12 sm12> | |
42 | + <v-layout> | |
43 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
44 | + <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | |
45 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | |
46 | + </v-flex> | |
47 | + <v-flex xs8 sm7 class="ml-3"> | |
48 | + <v-select | |
49 | + :items="addclass" | |
50 | + label="Select Class" | |
51 | + v-model="editedItem.select" | |
52 | + item-text="classNum" | |
53 | + item-value="_id" | |
54 | + name="Select Class" | |
55 | + required | |
56 | + ></v-select> | |
57 | + </v-flex> | |
58 | + </v-layout> | |
59 | + <v-layout> | |
60 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
61 | + <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | |
62 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | |
63 | + </v-flex> | |
64 | + <v-flex xs8 sm7 class="ml-3"> | |
65 | + <v-select | |
66 | + :items="courseData" | |
67 | + item-text="coursrName" | |
68 | + item-value="_id" | |
69 | + v-model="editedItem.coursrName" | |
70 | + placeholder="fill your Course name" | |
71 | + type="text" | |
72 | + :rules="courseRules" | |
73 | + required | |
74 | + ></v-select> | |
75 | + </v-flex> | |
76 | + </v-layout> | |
77 | + <v-layout> | |
78 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
79 | + <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> | |
80 | + <label | |
81 | + class="right hidden-lg-only hidden-md-only hidden-xl-only" | |
82 | + >DiscussionType:</label> | |
83 | + </v-flex> | |
84 | + <v-flex xs8 sm7 class="ml-3"> | |
85 | + <v-text-field | |
86 | + v-model="editedItem.discussionType" | |
87 | + placeholder="fill your Course Name" | |
88 | + type="text" | |
89 | + required | |
90 | + ></v-text-field> | |
91 | + </v-flex> | |
92 | + </v-layout> | |
93 | + <v-layout> | |
94 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
95 | + <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | |
96 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> | |
97 | + </v-flex> | |
98 | + <v-flex xs8 sm7 class="ml-3"> | |
99 | + <v-text-field | |
100 | + label="Select Image" | |
101 | + @click="pickEditFile" | |
102 | + v-model="editImageName" | |
103 | + append-icon="attach_file" | |
104 | + ></v-text-field> | |
105 | + </v-flex> | |
106 | + </v-layout> | |
107 | + </v-flex> | |
108 | + </v-layout> | |
109 | + <v-layout> | |
110 | + <v-flex xs12 sm12 class="px-0 mx-0"> | |
111 | + <v-layout class="right"> | |
112 | + <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> | |
113 | + </v-layout> | |
114 | + </v-flex> | |
115 | + </v-layout> | |
116 | + </v-container> | |
117 | + </v-form> | |
118 | + </v-card-text> | |
119 | + </v-card> | |
120 | + </v-dialog> | |
121 | + | |
122 | + <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> | |
123 | + | |
124 | + <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> | |
125 | + <v-card flat class="card-style pa-3" dark> | |
126 | + <v-layout> | |
127 | + <v-flex xs12> | |
128 | + <label class="title text-xs-center">View Annoucement</label> | |
129 | + <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> | |
130 | + </v-flex> | |
131 | + </v-layout> | |
132 | + <v-card-text> | |
133 | + <v-flex align-center justify-center layout text-xs-center class="mt-3"> | |
134 | + <v-avatar size="100px"> | |
135 | + <img src="/static/icon/user.png" v-if="!editedItem.attachementUrl" /> | |
136 | + <img :src="editedItem.attachementUrl" v-else-if="editedItem.attachementUrl" /> | |
137 | + </v-avatar> | |
138 | + </v-flex> | |
139 | + <v-container grid-list-md> | |
140 | + <v-layout wrap> | |
141 | + <v-flex xs12> | |
142 | + <v-layout> | |
143 | + <v-flex xs6 sm6> | |
144 | + <h5 class="right my-1"> | |
145 | + <b>Discussion Type :</b> | |
146 | + </h5> | |
147 | + </v-flex> | |
148 | + <v-flex sm6 xs6> | |
149 | + <h5 class="my-1 left">{{ editedItem.discussionType }}</h5> | |
150 | + </v-flex> | |
151 | + </v-layout> | |
152 | + </v-flex> | |
153 | + </v-layout> | |
154 | + </v-container> | |
155 | + </v-card-text> | |
156 | + </v-card> | |
157 | + </v-dialog> | |
158 | + | |
159 | + <!-- ****** Annoucement TABLE ****** --> | |
160 | + <v-toolbar color="transparent" flat> | |
161 | + <v-btn | |
162 | + fab | |
163 | + dark | |
164 | + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | |
165 | + small | |
166 | + @click="addAnnoucementDialog = true" | |
167 | + > | |
168 | + <v-icon dark>add</v-icon> | |
169 | + </v-btn> | |
170 | + <v-btn | |
171 | + round | |
172 | + class="open-dialog-button hidden-sm-only hidden-xs-only" | |
173 | + dark | |
174 | + @click="addAnnoucementDialog = true" | |
175 | + > | |
176 | + <v-icon class="white--text pr-1" size="20">add</v-icon>Add Annoucement | |
177 | + </v-btn> | |
178 | + <v-card-actions class="hidden-xs-only hidden-sm-only"> | |
179 | + <v-flex md13 lg12> | |
180 | + <v-layout> | |
181 | + <v-flex lg6 md12> | |
182 | + <v-layout> | |
183 | + <v-select | |
184 | + :items="addclass" | |
185 | + label="Select Class" | |
186 | + v-model="selectAnnoucement.classId" | |
187 | + item-text="classNum" | |
188 | + item-value="_id" | |
189 | + name="Select Class" | |
190 | + :rules="classRules" | |
191 | + required | |
192 | + class="ml-2" | |
193 | + @change="getCourses(selectAnnoucement.classId)" | |
194 | + ></v-select> | |
195 | + <v-select | |
196 | + :items="courseData" | |
197 | + label="Select Course" | |
198 | + v-model="selectAnnoucement.courseId" | |
199 | + item-text="coursrName" | |
200 | + item-value="_id" | |
201 | + :rules="courseRules" | |
202 | + required | |
203 | + class="ml-4" | |
204 | + ></v-select> | |
205 | + </v-layout> | |
206 | + </v-flex> | |
207 | + </v-layout> | |
208 | + </v-flex> | |
209 | + </v-card-actions> | |
210 | + <v-spacer></v-spacer> | |
211 | + <v-btn | |
212 | + @click="getAnnoucementes()" | |
213 | + round | |
214 | + dark | |
215 | + :loading="loading" | |
216 | + class="add-button hidden-xs-only hidden-sm-only" | |
217 | + >Find</v-btn> | |
218 | + <v-card-title class="body-1" v-show="show"> | |
219 | + <v-btn icon large flat @click="displaySearch"> | |
220 | + <v-avatar size="27"> | |
221 | + <img src="/static/icon/search.png" alt="icon" /> | |
222 | + </v-avatar> | |
223 | + </v-btn> | |
224 | + </v-card-title> | |
225 | + <v-flex xs8 sm7 lg2 md3 v-show="showSearch"> | |
226 | + <v-layout> | |
227 | + <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | |
228 | + <v-icon @click="closeSearch" color="error">close</v-icon> | |
229 | + </v-layout> | |
230 | + </v-flex> | |
231 | + </v-toolbar> | |
232 | + <v-card flat class="elevation-0 transparent"> | |
233 | + <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> | |
234 | + <v-layout> | |
235 | + <v-flex xs12> | |
236 | + <v-select | |
237 | + :items="addclass" | |
238 | + label="Select Class" | |
239 | + v-model="selectAnnoucement.select" | |
240 | + item-text="classNum" | |
241 | + item-value="_id" | |
242 | + name="Select Class" | |
243 | + :rules="classRules" | |
244 | + class="px-2" | |
245 | + ></v-select> | |
246 | + </v-flex> | |
247 | + </v-layout> | |
248 | + <v-layout> | |
249 | + <v-flex xs5 class="mx-auto mb-2"> | |
250 | + <v-btn | |
251 | + @click="getAnnoucementes()" | |
252 | + block | |
253 | + round | |
254 | + dark | |
255 | + :loading="loading" | |
256 | + class="add-button" | |
257 | + >Find</v-btn> | |
258 | + </v-flex> | |
259 | + </v-layout> | |
260 | + </v-flex> | |
261 | + </v-card> | |
262 | + <v-data-table | |
263 | + :headers="headers" | |
264 | + :items="annoucementData" | |
265 | + :pagination.sync="pagination" | |
266 | + :search="search" | |
267 | + > | |
268 | + <template slot="items" slot-scope="props"> | |
269 | + <tr class="tr"> | |
270 | + <td class="text-xs-center td td-row"> | |
271 | + <v-avatar size="40"> | |
272 | + <img :src="props.item.attachementUrl" v-if="props.item.attachementUrl" /> | |
273 | + <img src="/static/icon/user.png" v-else-if="!props.item.attachementUrl" /> | |
274 | + </v-avatar> | |
275 | + </td> | |
276 | + <td class="text-xs-center td td-row">{{ props.item.discussionType}}</td> | |
277 | + <td class="text-xs-center td td-row"> | |
278 | + <span> | |
279 | + <v-tooltip top> | |
280 | + <img | |
281 | + slot="activator" | |
282 | + style="cursor:pointer; width:25px; height:25px; " | |
283 | + class="mr-3" | |
284 | + @click="profile(props.item)" | |
285 | + src="/static/icon/view.png" | |
286 | + /> | |
287 | + <span>View</span> | |
288 | + </v-tooltip> | |
289 | + <v-tooltip top> | |
290 | + <img | |
291 | + slot="activator" | |
292 | + style="cursor:pointer; width:20px; height:18px; " | |
293 | + class="mr-3" | |
294 | + @click="editItem(props.item)" | |
295 | + src="/static/icon/edit.png" | |
296 | + /> | |
297 | + <span>Edit</span> | |
298 | + </v-tooltip> | |
299 | + <v-tooltip top> | |
300 | + <img | |
301 | + slot="activator" | |
302 | + style="cursor:pointer; width:20px; height:20px; " | |
303 | + class="mr-3" | |
304 | + @click="deleteItem(props.item)" | |
305 | + src="/static/icon/delete.png" | |
306 | + /> | |
307 | + <span>Delete</span> | |
308 | + </v-tooltip> | |
309 | + </span> | |
310 | + </td> | |
311 | + </tr> | |
312 | + </template> | |
313 | + <v-alert | |
314 | + slot="no-results" | |
315 | + :value="true" | |
316 | + color="error" | |
317 | + icon="warning" | |
318 | + >Your search for "{{ search }}" found no results.</v-alert> | |
319 | + </v-data-table> | |
320 | + <!-- ****** Add Annoucement DETAILS******--> | |
321 | + <v-dialog v-model="addAnnoucementDialog" max-width="500"> | |
322 | + <v-card flat class="card-style pa-2" dark> | |
323 | + <v-layout> | |
324 | + <v-flex xs12> | |
325 | + <label class="title text-xs-center">Add Annoucement</label> | |
326 | + <v-icon size="24" class="right" @click="addAnnoucementDialog = false">cancel</v-icon> | |
327 | + </v-flex> | |
328 | + </v-layout> | |
329 | + <v-container fluid> | |
330 | + <v-layout align-center> | |
331 | + <v-flex xs12> | |
332 | + <v-flex xs12 sm12> | |
333 | + <v-form ref="form" v-model="valid" lazy-validation> | |
334 | + <v-layout> | |
335 | + <v-flex | |
336 | + xs12 | |
337 | + class="text-xs-center text-sm-center text-md-center text-lg-center" | |
338 | + > | |
339 | + <v-avatar size="100px" v-if="!imageUrl"> | |
340 | + <img src="/static/icon/user.png" /> | |
341 | + </v-avatar> | |
342 | + <input | |
343 | + type="file" | |
344 | + style="display: none" | |
345 | + ref="image" | |
346 | + accept="image/*" | |
347 | + @change="onFilePicked" | |
348 | + /> | |
349 | + <img | |
350 | + :src="imageData.imageUrl" | |
351 | + height="150" | |
352 | + width="150" | |
353 | + v-if="imageUrl" | |
354 | + style="border-radius:50%; width:200px" | |
355 | + /> | |
356 | + </v-flex> | |
357 | + </v-layout> | |
358 | + <v-layout wrap> | |
359 | + <v-flex xs12 sm12> | |
360 | + <v-layout> | |
361 | + <v-flex x4 sm4 class="pt-4 subheading"> | |
362 | + <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | |
363 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | |
364 | + </v-flex> | |
365 | + <v-flex xs8 sm8 class="ml-3"> | |
366 | + <v-select | |
367 | + :items="addclass" | |
368 | + label="Select Class" | |
369 | + v-model="addAnnoucement.select" | |
370 | + item-text="classNum" | |
371 | + item-value="_id" | |
372 | + name="Select Class" | |
373 | + :rules="classRules" | |
374 | + @change="getCourses(addAnnoucement.select)" | |
375 | + required | |
376 | + ></v-select> | |
377 | + </v-flex> | |
378 | + </v-layout> | |
379 | + </v-flex> | |
380 | + </v-layout> | |
381 | + <v-layout wrap> | |
382 | + <v-flex xs12 sm12> | |
383 | + <v-layout> | |
384 | + <v-flex xs4 sm4 class="pt-4 subheading"> | |
385 | + <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | |
386 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | |
387 | + </v-flex> | |
388 | + <v-flex xs8 sm8 class="ml-3"> | |
389 | + <v-select | |
390 | + :items="courseData" | |
391 | + item-text="coursrName" | |
392 | + item-value="_id" | |
393 | + v-model="addAnnoucement.coursrName" | |
394 | + placeholder="fill your Course name" | |
395 | + type="text" | |
396 | + :rules="courseRules" | |
397 | + required | |
398 | + ></v-select> | |
399 | + </v-flex> | |
400 | + </v-layout> | |
401 | + </v-flex> | |
402 | + <v-flex xs12 sm12> | |
403 | + <v-layout> | |
404 | + <v-flex xs4 sm4 class="pt-4 subheading"> | |
405 | + <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> | |
406 | + <label | |
407 | + class="right hidden-lg-only hidden-md-only hidden-xl-only" | |
408 | + >DiscussionType:</label> | |
409 | + </v-flex> | |
410 | + <v-flex xs8 sm8 class="ml-3"> | |
411 | + <v-text-field | |
412 | + v-model="addAnnoucement.discussionType" | |
413 | + placeholder="fill your Course name" | |
414 | + type="text" | |
415 | + :rules="courseRules" | |
416 | + required | |
417 | + ></v-text-field> | |
418 | + </v-flex> | |
419 | + </v-layout> | |
420 | + </v-flex> | |
421 | + <v-flex xs12 sm12> | |
422 | + <v-layout> | |
423 | + <v-flex xs4 class="pt-4 subheading"> | |
424 | + <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | |
425 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> | |
426 | + </v-flex> | |
427 | + <v-flex xs8 class="ml-3"> | |
428 | + <v-text-field | |
429 | + label="Select Image" | |
430 | + @click="pickFile" | |
431 | + v-model="imageName" | |
432 | + append-icon="attach_file" | |
433 | + ></v-text-field> | |
434 | + </v-flex> | |
435 | + </v-layout> | |
436 | + </v-flex> | |
437 | + </v-layout> | |
438 | + <v-layout> | |
439 | + <v-flex xs12 sm12> | |
440 | + <v-layout class="right"> | |
441 | + <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | |
442 | + </v-layout> | |
443 | + </v-flex> | |
444 | + </v-layout> | |
445 | + </v-form> | |
446 | + </v-flex> | |
447 | + </v-flex> | |
448 | + </v-layout> | |
449 | + </v-container> | |
450 | + </v-card> | |
451 | + </v-dialog> | |
452 | + <v-snackbar | |
453 | + :timeout="timeout" | |
454 | + :top="y === 'top'" | |
455 | + :right="x === 'right'" | |
456 | + :vertical="mode === 'vertical'" | |
457 | + v-model="snackbar" | |
458 | + :color="color" | |
459 | + >{{ text }}</v-snackbar> | |
460 | + <div class="loader" v-if="showLoader"> | |
461 | + <v-progress-circular indeterminate color="white"></v-progress-circular> | |
462 | + </div> | |
463 | + </v-container> | |
464 | +</template> | |
465 | + | |
466 | +<script> | |
467 | +import http from "@/Services/http.js"; | |
468 | +import moment from "moment"; | |
469 | +import countryList from "@/script/country.js"; | |
470 | +import parent from "@/script/parents.js"; | |
471 | + | |
472 | +export default { | |
473 | + data: () => ({ | |
474 | + showNext: false, | |
475 | + snackbar: false, | |
476 | + y: "top", | |
477 | + x: "right", | |
478 | + role: "", | |
479 | + mode: "", | |
480 | + append: "", | |
481 | + timeout: 3000, | |
482 | + text: "", | |
483 | + show: true, | |
484 | + color: "", | |
485 | + showSearch: false, | |
486 | + showLoader: false, | |
487 | + loading: false, | |
488 | + editLoading: false, | |
489 | + date: null, | |
490 | + search: "", | |
491 | + menu: false, | |
492 | + menu1: false, | |
493 | + editStudentDialog: false, | |
494 | + profileStudentDialog: false, | |
495 | + addAnnoucementDialog: false, | |
496 | + valid: true, | |
497 | + addclass: [], | |
498 | + addSection: [], | |
499 | + pagination: { | |
500 | + rowsPerPage: 10 | |
501 | + }, | |
502 | + imageData: {}, | |
503 | + imageName: "", | |
504 | + imageUrl: "", | |
505 | + imageFile: "", | |
506 | + editImageName: "", | |
507 | + editImageUrl: "", | |
508 | + courseRules: [v => !!v || " Course Name is required"], | |
509 | + classRules: [v => !!v || " Class Name is required"], | |
510 | + sectionRules: [v => !!v || "Section Name is required"], | |
511 | + errorMessages: "", | |
512 | + headers: [ | |
513 | + { | |
514 | + text: "Image", | |
515 | + value: "attachementUrl", | |
516 | + sortable: false, | |
517 | + align: "center" | |
518 | + }, | |
519 | + { | |
520 | + text: "Discussion Type", | |
521 | + value: "discussionType", | |
522 | + sortable: false, | |
523 | + align: "center" | |
524 | + }, | |
525 | + { text: "Action", value: "", sortable: false, align: "center" } | |
526 | + ], | |
527 | + courseData: [], | |
528 | + editedIndex: -1, | |
529 | + addAnnoucement: { | |
530 | + select: "" | |
531 | + }, | |
532 | + selectAnnoucement: {}, | |
533 | + editedItem: {}, | |
534 | + annoucementData: [] | |
535 | + }), | |
536 | + methods: { | |
537 | + getCourses(selectCourseId) { | |
538 | + this.showLoader = true; | |
539 | + http() | |
540 | + .get("/getCourseesList", { | |
541 | + params: { | |
542 | + classId: selectCourseId | |
543 | + } | |
544 | + }) | |
545 | + .then(response => { | |
546 | + this.courseData = response.data.data; | |
547 | + this.showLoader = false; | |
548 | + }) | |
549 | + .catch(err => { | |
550 | + console.log("err====>", err); | |
551 | + this.showLoader = false; | |
552 | + }); | |
553 | + }, | |
554 | + getAnnoucementes() { | |
555 | + this.showLoader = true; | |
556 | + http() | |
557 | + .get("/getAnnoucementesList", { | |
558 | + params: { | |
559 | + courseId: this.selectAnnoucement.courseId | |
560 | + } | |
561 | + }) | |
562 | + .then(response => { | |
563 | + this.annoucementData = response.data.data; | |
564 | + this.showLoader = false; | |
565 | + }) | |
566 | + .catch(err => { | |
567 | + console.log("err====>", err); | |
568 | + this.showLoader = false; | |
569 | + }); | |
570 | + }, | |
571 | + // getSections(_id) { | |
572 | + // var token = this.$store.state.token; | |
573 | + // this.showLoader = true; | |
574 | + // http() | |
575 | + // .get( | |
576 | + // "/getSectionsList", | |
577 | + // { params: { classId: _id } }, | |
578 | + // { | |
579 | + // headers: { Authorization: "Bearer " + token } | |
580 | + // } | |
581 | + // ) | |
582 | + // .then(response => { | |
583 | + // this.addSection = response.data.data; | |
584 | + // this.showLoader = false; | |
585 | + // }) | |
586 | + // .catch(err => { | |
587 | + // this.showLoader = false; | |
588 | + // }); | |
589 | + // }, | |
590 | + pickFile() { | |
591 | + this.$refs.image.click(); | |
592 | + }, | |
593 | + pickEditFile() { | |
594 | + this.$refs.editDataImage.click(); | |
595 | + }, | |
596 | + dates: function(date) { | |
597 | + return moment(date).format("MMMM DD, YYYY"); | |
598 | + return date; | |
599 | + }, | |
600 | + onFilePicked(e) { | |
601 | + // console.log(e) | |
602 | + const files = e.target.files; | |
603 | + this.imageData.upload = e.target.files[0]; | |
604 | + if (files[0] !== undefined) { | |
605 | + this.imageName = files[0].name; | |
606 | + if (this.imageName.lastIndexOf(".") <= 0) { | |
607 | + return; | |
608 | + } | |
609 | + const fr = new FileReader(); | |
610 | + fr.readAsDataURL(files[0]); | |
611 | + fr.addEventListener("load", () => { | |
612 | + this.imageUrl = fr.result; | |
613 | + this.imageFile = files[0]; // this is an image file that can be sent to server... | |
614 | + this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | |
615 | + }); | |
616 | + } else { | |
617 | + this.imageName = ""; | |
618 | + this.imageFile = ""; | |
619 | + this.imageUrl = ""; | |
620 | + } | |
621 | + }, | |
622 | + onEditFilePicked(e) { | |
623 | + console.log(e); | |
624 | + const files = e.target.files; | |
625 | + if (files[0] !== undefined) { | |
626 | + this.editImageName = files[0].name; | |
627 | + console.log("this.editImageName", this.editImageName); | |
628 | + | |
629 | + if (this.editImageName.lastIndexOf(".") <= 0) { | |
630 | + return; | |
631 | + } | |
632 | + const fr = new FileReader(); | |
633 | + fr.readAsDataURL(files[0]); | |
634 | + fr.addEventListener("load", () => { | |
635 | + this.editImageUrl = fr.result; | |
636 | + this.editiImageFile = files[0]; // this is an image file that can be sent to server... | |
637 | + }); | |
638 | + } else { | |
639 | + this.editImageName = ""; | |
640 | + this.editiImageFile = ""; | |
641 | + } | |
642 | + }, | |
643 | + editItem(item) { | |
644 | + this.editedIndex = this.courseData.indexOf(item); | |
645 | + this.editedItem = Object.assign({}, item); | |
646 | + this.editStudentDialog = true; | |
647 | + }, | |
648 | + profile(item) { | |
649 | + this.editedIndex = this.courseData.indexOf(item); | |
650 | + this.editedItem = Object.assign({}, item); | |
651 | + this.profileStudentDialog = true; | |
652 | + }, | |
653 | + deleteItem(item) { | |
654 | + let deleteAnnoucement = { | |
655 | + annoucementId: item._id | |
656 | + }; | |
657 | + http() | |
658 | + .delete( | |
659 | + "/deleteAnnoucement", | |
660 | + confirm("Are you sure you want to delete this?") && { | |
661 | + params: deleteAnnoucement | |
662 | + } | |
663 | + ) | |
664 | + .then(response => { | |
665 | + this.snackbar = true; | |
666 | + this.text = response.data.message; | |
667 | + this.color = "green"; | |
668 | + this.getAnnoucementes(); | |
669 | + }) | |
670 | + .catch(error => { | |
671 | + this.snackbar = true; | |
672 | + this.text = error.response.data.message; | |
673 | + this.color = "error"; | |
674 | + }); | |
675 | + }, | |
676 | + close() { | |
677 | + this.editStudentDialog = false; | |
678 | + }, | |
679 | + closeStudentProfile() { | |
680 | + this.profileStudentDialog = false; | |
681 | + }, | |
682 | + submit() { | |
683 | + if (this.$refs.form.validate()) { | |
684 | + let addCourse = { | |
685 | + classId: this.addAnnoucement.select, | |
686 | + sectionId: this.addAnnoucement.selectSection, | |
687 | + discussionType: this.addAnnoucement.discussionType, | |
688 | + courseId: this.addAnnoucement.coursrName | |
689 | + }; | |
690 | + if (this.imageUrl) { | |
691 | + var str = this.imageUrl; | |
692 | + const [baseUrl, imageUrl] = str.split(/,/); | |
693 | + addCourse.upload = imageUrl; | |
694 | + } | |
695 | + this.loading = true; | |
696 | + http() | |
697 | + .post("/createAnnoucement", addCourse) | |
698 | + .then(response => { | |
699 | + this.snackbar = true; | |
700 | + this.text = "New Annoucement added successfully"; | |
701 | + this.color = "green"; | |
702 | + this.addAnnoucementDialog = false; | |
703 | + this.clear(); | |
704 | + this.loading = false; | |
705 | + }) | |
706 | + .catch(error => { | |
707 | + this.snackbar = true; | |
708 | + this.text = error.response.data.message; | |
709 | + this.color = "error"; | |
710 | + this.loading = false; | |
711 | + }); | |
712 | + } | |
713 | + }, | |
714 | + clear() { | |
715 | + this.$refs.form.reset(); | |
716 | + this.imageUrl = ""; | |
717 | + }, | |
718 | + save() { | |
719 | + let editAnnoucement = { | |
720 | + annoucementId: this.editedItem._id, | |
721 | + discussionType: this.editedItem.discussionType, | |
722 | + classId: this.editedItem.select, | |
723 | + courseId: this.editedItem.coursrName | |
724 | + }; | |
725 | + if (this.editImageUrl) { | |
726 | + var str = this.editImageUrl; | |
727 | + const [baseUrl, editImageUrl] = str.split(/,/); | |
728 | + editAnnoucement.upload = editImageUrl; | |
729 | + } | |
730 | + this.editLoading = true; | |
731 | + http() | |
732 | + .put("/updateAnnoucement", editAnnoucement) | |
733 | + .then(response => { | |
734 | + this.snackbar = true; | |
735 | + this.text = response.data.message; | |
736 | + this.color = "green"; | |
737 | + this.imageUrl = ""; | |
738 | + this.getAnnoucementes(); | |
739 | + this.close(); | |
740 | + this.editLoading = false; | |
741 | + }) | |
742 | + .catch(error => { | |
743 | + this.snackbar = true; | |
744 | + this.text = error.response.data.statusText; | |
745 | + this.color = "error"; | |
746 | + this.editLoading = false; | |
747 | + }); | |
748 | + }, | |
749 | + displaySearch() { | |
750 | + this.show = false; | |
751 | + this.showSearch = true; | |
752 | + }, | |
753 | + closeSearch() { | |
754 | + this.showSearch = false; | |
755 | + this.show = true; | |
756 | + this.search = ""; | |
757 | + } | |
758 | + }, | |
759 | + mounted() { | |
760 | + var token = this.$store.state.token; | |
761 | + http() | |
762 | + .get("/getClassesList", { | |
763 | + headers: { Authorization: "Bearer " + token } | |
764 | + }) | |
765 | + .then(response => { | |
766 | + this.addclass = response.data.data; | |
767 | + }) | |
768 | + .catch(error => { | |
769 | + this.showLoader = false; | |
770 | + if (error.response.status === 401) { | |
771 | + this.$router.replace({ path: "/" }); | |
772 | + this.$store.dispatch("setToken", null); | |
773 | + this.$store.dispatch("Id", null); | |
774 | + this.$store.dispatch("Role", null); | |
775 | + } | |
776 | + }); | |
777 | + } | |
778 | +}; | |
779 | +</script> | |
780 | +<style scoped> | |
781 | +.active { | |
782 | + background-color: gray; | |
783 | + color: white !important; | |
784 | +} | |
785 | +.activebtn { | |
786 | + color: black !important; | |
787 | +} | |
788 | +</style> | |
0 | 789 | \ No newline at end of file | ... | ... |
src/pages/Authentication/Login.vue
... | ... | @@ -12,7 +12,13 @@ |
12 | 12 | >{{ text }}</v-snackbar> |
13 | 13 | <v-layout align-center justify-center> |
14 | 14 | <v-flex xs12 sm10 md5 lg4> |
15 | - <img src="/static/icon.png" height="40" width="140" alt="logo" class="logo mx-auto mb-2" /> | |
15 | + <img | |
16 | + src="/static/icon.png" | |
17 | + height="40" | |
18 | + width="140" | |
19 | + alt="logo" | |
20 | + class="logo mx-auto mb-2" | |
21 | + /> | |
16 | 22 | <v-card class="elevation-1 px-2 py-3 card" style="background-color: #7852cc" dark> |
17 | 23 | <img |
18 | 24 | src="/static/intrackIllustration.png" |
... | ... | @@ -101,55 +107,56 @@ export default { |
101 | 107 | }, |
102 | 108 | methods: { |
103 | 109 | login() { |
104 | - this.loading = true; | |
105 | - var userdata = { | |
106 | - email: this.userLogincredentials.email, | |
107 | - password: this.userLogincredentials.password | |
108 | - }; | |
109 | - http() | |
110 | - .post("/schoolLogin", userdata) | |
111 | - .then(response => { | |
112 | - // console.log("token",response.data.data); | |
113 | - this.loading = false; | |
114 | - if (response.data.data.role === "ADMIN") { | |
115 | - this.$store.dispatch("setToken", response.data.data.token); | |
116 | - this.$store.dispatch("Id", response.data.data.id); | |
117 | - this.$store.dispatch("Role", response.data.data.role); | |
118 | - this.$router.push("/dashboard"); | |
119 | - } else if (response.data.data.role === "SUPERADMIN") { | |
120 | - this.$store.dispatch("setSchoolRole", response.data.data.role); | |
121 | - this.$store.dispatch("setSchoolToken", response.data.data.token); | |
122 | - this.$router.push("/schooldashboard"); | |
123 | - } else if (response.data.data.role === "TEACHER") { | |
124 | - // console.log("teacher", response.data.data.role); | |
125 | - this.$store.dispatch("setToken", response.data.data.token); | |
126 | - this.$store.dispatch("Id", response.data.data.id); | |
127 | - this.$store.dispatch("Role", response.data.data.role); | |
128 | - this.$router.push("/dashboard"); | |
129 | - } else if (response.data.data.role === "LIBRARIAN") { | |
130 | - this.$store.dispatch("setToken", response.data.data.token); | |
131 | - this.$store.dispatch("Id", response.data.data.id); | |
132 | - this.$store.dispatch("Role", response.data.data.role); | |
133 | - this.$router.push("/dashboard"); | |
134 | - } else if (response.data.data.role === "ACCOUNTANT") { | |
135 | - this.$store.dispatch("setToken", response.data.data.token); | |
136 | - this.$store.dispatch("Id", response.data.data.id); | |
137 | - this.$store.dispatch("Role", response.data.data.role); | |
138 | - this.$router.push("/dashboard"); | |
139 | - } | |
140 | - }) | |
141 | - .catch(error => { | |
142 | - if (error) { | |
143 | - this.text = "Server appears to be offline"; | |
144 | - this.snackbar = true; | |
110 | + if (this.$refs.form.validate()) { | |
111 | + this.loading = true; | |
112 | + var userdata = { | |
113 | + email: this.userLogincredentials.email, | |
114 | + password: this.userLogincredentials.password | |
115 | + }; | |
116 | + http() | |
117 | + .post("/schoolLogin", userdata) | |
118 | + .then(response => { | |
119 | + // console.log("token",response.data.data); | |
145 | 120 | this.loading = false; |
146 | - } | |
147 | - if (error.response.data.message) { | |
148 | - this.text = error.response.data.message; | |
149 | - this.snackbar = true; | |
150 | - } | |
151 | - this.loading = false; | |
152 | - }); | |
121 | + if (response.data.data.role === "ADMIN") { | |
122 | + this.$store.dispatch("setToken", response.data.data.token); | |
123 | + this.$store.dispatch("Id", response.data.data.id); | |
124 | + this.$store.dispatch("Role", response.data.data.role); | |
125 | + this.$router.push("/dashboard"); | |
126 | + } else if (response.data.data.role === "SUPERADMIN") { | |
127 | + this.$store.dispatch("setSchoolRole", response.data.data.role); | |
128 | + this.$store.dispatch("setSchoolToken", response.data.data.token); | |
129 | + this.$router.push("/schooldashboard"); | |
130 | + } else if (response.data.data.role === "TEACHER") { | |
131 | + // console.log("teacher", response.data.data.role); | |
132 | + this.$store.dispatch("setToken", response.data.data.token); | |
133 | + this.$store.dispatch("Id", response.data.data.id); | |
134 | + this.$store.dispatch("Role", response.data.data.role); | |
135 | + this.$router.push("/dashboard"); | |
136 | + } else if (response.data.data.role === "LIBRARIAN") { | |
137 | + this.$store.dispatch("setToken", response.data.data.token); | |
138 | + this.$store.dispatch("Id", response.data.data.id); | |
139 | + this.$store.dispatch("Role", response.data.data.role); | |
140 | + this.$router.push("/dashboard"); | |
141 | + } else if (response.data.data.role === "ACCOUNTANT") { | |
142 | + this.$store.dispatch("setToken", response.data.data.token); | |
143 | + this.$store.dispatch("Id", response.data.data.id); | |
144 | + this.$store.dispatch("Role", response.data.data.role); | |
145 | + this.$router.push("/dashboard"); | |
146 | + } | |
147 | + }) | |
148 | + .catch(error => { | |
149 | + if (error.response.data.message) { | |
150 | + this.text = error.response.data.message; | |
151 | + this.snackbar = true; | |
152 | + this.loading = false; | |
153 | + } else { | |
154 | + this.text = "Server appears to be offline"; | |
155 | + this.snackbar = true; | |
156 | + this.loading = false; | |
157 | + } | |
158 | + }); | |
159 | + } | |
153 | 160 | } |
154 | 161 | }, |
155 | 162 | mounted() { | ... | ... |
src/pages/Course/course.vue
... | ... | @@ -0,0 +1,709 @@ |
1 | +<template> | |
2 | + <v-container fluid class="body-color"> | |
3 | + <!-- ****** EDITS COURSES DETAILS ****** --> | |
4 | + <v-dialog v-model="editStudentDialog" max-width="600px" scrollable> | |
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 Course</label> | |
9 | + <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon> | |
10 | + </v-flex> | |
11 | + </v-layout> | |
12 | + <v-card-text> | |
13 | + <v-form ref="form"> | |
14 | + <v-container fluid> | |
15 | + <v-layout> | |
16 | + <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | |
17 | + <v-avatar size="100px" v-if="!editedItem.courseImageUrl && !editImageUrl"> | |
18 | + <img src="/static/icon/user.png" /> | |
19 | + </v-avatar> | |
20 | + <img | |
21 | + :src="editedItem.courseImageUrl" | |
22 | + v-else-if="editedItem.courseImageUrl && !editImageUrl" | |
23 | + height="150" | |
24 | + style="border-radius:50%; width:150px" | |
25 | + /> | |
26 | + <img | |
27 | + v-if="editImageUrl" | |
28 | + :src="editImageUrl" | |
29 | + style="border-radius:50%; width:150px;height:150px" | |
30 | + /> | |
31 | + <input | |
32 | + type="file" | |
33 | + style="display: none" | |
34 | + ref="editDataImage" | |
35 | + accept="image/*" | |
36 | + @change="onEditFilePicked" | |
37 | + /> | |
38 | + </v-flex> | |
39 | + </v-layout> | |
40 | + <v-layout wrap> | |
41 | + <v-flex xs12 sm12> | |
42 | + <v-layout> | |
43 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
44 | + <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | |
45 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | |
46 | + </v-flex> | |
47 | + <v-flex xs8 sm7 class="ml-3"> | |
48 | + <v-select | |
49 | + :items="addclass" | |
50 | + label="Select Class" | |
51 | + v-model="editedItem.select" | |
52 | + item-text="classNum" | |
53 | + item-value="_id" | |
54 | + name="Select Class" | |
55 | + required | |
56 | + ></v-select> | |
57 | + </v-flex> | |
58 | + </v-layout> | |
59 | + <v-layout> | |
60 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
61 | + <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | |
62 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | |
63 | + </v-flex> | |
64 | + <v-flex xs8 sm7 class="ml-3"> | |
65 | + <v-text-field | |
66 | + v-model="editedItem.coursrName" | |
67 | + placeholder="fill your Course Name" | |
68 | + type="text" | |
69 | + required | |
70 | + ></v-text-field> | |
71 | + </v-flex> | |
72 | + </v-layout> | |
73 | + <v-layout> | |
74 | + <v-flex xs4 sm5 class="pt-4 subheading"> | |
75 | + <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | |
76 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> | |
77 | + </v-flex> | |
78 | + <v-flex xs8 sm7 class="ml-3"> | |
79 | + <v-text-field | |
80 | + label="Select Image" | |
81 | + @click="pickEditFile" | |
82 | + v-model="editImageName" | |
83 | + append-icon="attach_file" | |
84 | + ></v-text-field> | |
85 | + </v-flex> | |
86 | + </v-layout> | |
87 | + </v-flex> | |
88 | + </v-layout> | |
89 | + <v-layout> | |
90 | + <v-flex xs12 sm12 class="px-0 mx-0"> | |
91 | + <v-layout class="right"> | |
92 | + <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> | |
93 | + </v-layout> | |
94 | + </v-flex> | |
95 | + </v-layout> | |
96 | + </v-container> | |
97 | + </v-form> | |
98 | + </v-card-text> | |
99 | + </v-card> | |
100 | + </v-dialog> | |
101 | + | |
102 | + <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> | |
103 | + | |
104 | + <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> | |
105 | + <v-card flat class="card-style pa-3" dark> | |
106 | + <v-layout> | |
107 | + <v-flex xs12> | |
108 | + <label class="title text-xs-center">View Course</label> | |
109 | + <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> | |
110 | + </v-flex> | |
111 | + </v-layout> | |
112 | + <v-card-text> | |
113 | + <v-flex align-center justify-center layout text-xs-center class="mt-3"> | |
114 | + <v-avatar size="100px"> | |
115 | + <img src="/static/icon/user.png" v-if="!editedItem.courseImageUrl" /> | |
116 | + <img :src="editedItem.courseImageUrl" v-else-if="editedItem.courseImageUrl" /> | |
117 | + </v-avatar> | |
118 | + </v-flex> | |
119 | + <v-container grid-list-md> | |
120 | + <v-layout wrap> | |
121 | + <v-flex xs12> | |
122 | + <v-layout> | |
123 | + <v-flex xs6 sm6> | |
124 | + <h5 class="right my-1"> | |
125 | + <b>Course :</b> | |
126 | + </h5> | |
127 | + </v-flex> | |
128 | + <v-flex sm6 xs6> | |
129 | + <h5 class="my-1 left">{{ editedItem.coursrName }}</h5> | |
130 | + </v-flex> | |
131 | + </v-layout> | |
132 | + </v-flex> | |
133 | + </v-layout> | |
134 | + </v-container> | |
135 | + </v-card-text> | |
136 | + </v-card> | |
137 | + </v-dialog> | |
138 | + | |
139 | + <!-- ****** STUDENTS TABLE ****** --> | |
140 | + <v-toolbar color="transparent" flat> | |
141 | + <v-btn | |
142 | + fab | |
143 | + dark | |
144 | + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | |
145 | + small | |
146 | + @click="addCourseDialog = true" | |
147 | + > | |
148 | + <v-icon dark>add</v-icon> | |
149 | + </v-btn> | |
150 | + <v-btn | |
151 | + round | |
152 | + class="open-dialog-button hidden-sm-only hidden-xs-only" | |
153 | + dark | |
154 | + @click="addCourseDialog = true" | |
155 | + > | |
156 | + <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course | |
157 | + </v-btn> | |
158 | + <v-card-actions class="hidden-xs-only hidden-sm-only"> | |
159 | + <v-flex md13 lg12> | |
160 | + <v-layout> | |
161 | + <v-flex lg6 md6> | |
162 | + <v-select | |
163 | + :items="addclass" | |
164 | + label="Select Class" | |
165 | + v-model="selectStudents.select" | |
166 | + item-text="classNum" | |
167 | + item-value="_id" | |
168 | + name="Select Class" | |
169 | + :rules="classRules" | |
170 | + required | |
171 | + class="ml-2" | |
172 | + ></v-select> | |
173 | + </v-flex> | |
174 | + </v-layout> | |
175 | + </v-flex> | |
176 | + </v-card-actions> | |
177 | + <v-spacer></v-spacer> | |
178 | + <v-btn | |
179 | + @click="getCourses()" | |
180 | + round | |
181 | + dark | |
182 | + :loading="loading" | |
183 | + class="add-button hidden-xs-only hidden-sm-only" | |
184 | + >Find</v-btn> | |
185 | + <v-card-title class="body-1" v-show="show"> | |
186 | + <v-btn icon large flat @click="displaySearch"> | |
187 | + <v-avatar size="27"> | |
188 | + <img src="/static/icon/search.png" alt="icon" /> | |
189 | + </v-avatar> | |
190 | + </v-btn> | |
191 | + </v-card-title> | |
192 | + <v-flex xs8 sm7 lg2 md3 v-show="showSearch"> | |
193 | + <v-layout> | |
194 | + <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | |
195 | + <v-icon @click="closeSearch" color="error">close</v-icon> | |
196 | + </v-layout> | |
197 | + </v-flex> | |
198 | + </v-toolbar> | |
199 | + <v-card flat class="elevation-0 transparent"> | |
200 | + <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> | |
201 | + <v-layout> | |
202 | + <!-- <v-flex xs4> | |
203 | + <label class="right mt-4">Select Class:</label> | |
204 | + </v-flex>--> | |
205 | + <v-flex xs12> | |
206 | + <v-select | |
207 | + :items="addclass" | |
208 | + label="Select Class" | |
209 | + v-model="selectStudents.select" | |
210 | + item-text="classNum" | |
211 | + item-value="_id" | |
212 | + name="Select Class" | |
213 | + :rules="classRules" | |
214 | + class="px-2" | |
215 | + ></v-select> | |
216 | + </v-flex> | |
217 | + </v-layout> | |
218 | + <v-layout> | |
219 | + <v-flex xs5 class="mx-auto mb-2"> | |
220 | + <v-btn @click="getCourses()" block round dark :loading="loading" class="add-button">Find</v-btn> | |
221 | + </v-flex> | |
222 | + </v-layout> | |
223 | + </v-flex> | |
224 | + </v-card> | |
225 | + <v-data-table | |
226 | + :headers="headers" | |
227 | + :items="courseData" | |
228 | + :pagination.sync="pagination" | |
229 | + :search="search" | |
230 | + > | |
231 | + <template slot="items" slot-scope="props"> | |
232 | + <tr class="tr"> | |
233 | + <td class="text-xs-center td td-row"> | |
234 | + <v-avatar size="40"> | |
235 | + <img :src="props.item.courseImageUrl" v-if="props.item.courseImageUrl" /> | |
236 | + <img src="/static/icon/user.png" v-else-if="!props.item.courseImageUrl" /> | |
237 | + </v-avatar> | |
238 | + </td> | |
239 | + <td class="text-xs-center td td-row">{{ props.item.coursrName}}</td> | |
240 | + <td class="text-xs-center td td-row"> | |
241 | + <span> | |
242 | + <v-tooltip top> | |
243 | + <img | |
244 | + slot="activator" | |
245 | + style="cursor:pointer; width:25px; height:25px; " | |
246 | + class="mr-3" | |
247 | + @click="profile(props.item)" | |
248 | + src="/static/icon/view.png" | |
249 | + /> | |
250 | + <span>View</span> | |
251 | + </v-tooltip> | |
252 | + <v-tooltip top> | |
253 | + <img | |
254 | + slot="activator" | |
255 | + style="cursor:pointer; width:20px; height:18px; " | |
256 | + class="mr-3" | |
257 | + @click="editItem(props.item)" | |
258 | + src="/static/icon/edit.png" | |
259 | + /> | |
260 | + <span>Edit</span> | |
261 | + </v-tooltip> | |
262 | + <v-tooltip top> | |
263 | + <img | |
264 | + slot="activator" | |
265 | + style="cursor:pointer; width:20px; height:20px; " | |
266 | + class="mr-3" | |
267 | + @click="deleteItem(props.item)" | |
268 | + src="/static/icon/delete.png" | |
269 | + /> | |
270 | + <span>Delete</span> | |
271 | + </v-tooltip> | |
272 | + </span> | |
273 | + </td> | |
274 | + </tr> | |
275 | + </template> | |
276 | + <v-alert | |
277 | + slot="no-results" | |
278 | + :value="true" | |
279 | + color="error" | |
280 | + icon="warning" | |
281 | + >Your search for "{{ search }}" found no results.</v-alert> | |
282 | + </v-data-table> | |
283 | + <!-- ****** Add CourseS DETAILS****** --> | |
284 | + <v-dialog v-model="addCourseDialog" max-width="500"> | |
285 | + <v-card flat class="card-style pa-2" dark> | |
286 | + <v-layout> | |
287 | + <v-flex xs12> | |
288 | + <label class="title text-xs-center">Add Course</label> | |
289 | + <v-icon size="24" class="right" @click="addCourseDialog = false">cancel</v-icon> | |
290 | + </v-flex> | |
291 | + </v-layout> | |
292 | + <v-container fluid> | |
293 | + <v-layout align-center> | |
294 | + <v-flex xs12> | |
295 | + <v-flex xs12 sm12> | |
296 | + <v-form ref="form" v-model="valid" lazy-validation> | |
297 | + <v-layout> | |
298 | + <v-flex | |
299 | + xs12 | |
300 | + class="text-xs-center text-sm-center text-md-center text-lg-center" | |
301 | + > | |
302 | + <v-avatar size="100px"> | |
303 | + <img src="/static/icon/user.png" v-if="!imageUrl" /> | |
304 | + </v-avatar> | |
305 | + <input | |
306 | + type="file" | |
307 | + style="display: none" | |
308 | + ref="image" | |
309 | + accept="image/*" | |
310 | + @change="onFilePicked" | |
311 | + /> | |
312 | + <img | |
313 | + :src="imageData.imageUrl" | |
314 | + height="150" | |
315 | + v-if="imageUrl" | |
316 | + style="border-radius:50%; width:200px" | |
317 | + /> | |
318 | + </v-flex> | |
319 | + </v-layout> | |
320 | + <v-layout wrap> | |
321 | + <v-flex xs12 sm12> | |
322 | + <v-layout> | |
323 | + <v-flex x4 sm4 class="pt-4 subheading"> | |
324 | + <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | |
325 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | |
326 | + </v-flex> | |
327 | + <v-flex xs8 sm8 class="ml-3"> | |
328 | + <v-select | |
329 | + :items="addclass" | |
330 | + label="Select Class" | |
331 | + v-model="addCourses.select" | |
332 | + item-text="classNum" | |
333 | + item-value="_id" | |
334 | + name="Select Class" | |
335 | + :rules="classRules" | |
336 | + @change="getSections(addCourses.select)" | |
337 | + required | |
338 | + ></v-select> | |
339 | + </v-flex> | |
340 | + </v-layout> | |
341 | + </v-flex> | |
342 | + </v-layout> | |
343 | + <v-layout wrap> | |
344 | + <v-flex xs12 sm12> | |
345 | + <v-layout> | |
346 | + <v-flex xs4 sm4 class="pt-4 subheading"> | |
347 | + <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | |
348 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | |
349 | + </v-flex> | |
350 | + <v-flex xs8 sm8 class="ml-3"> | |
351 | + <v-text-field | |
352 | + v-model="addCourses.coursrName" | |
353 | + placeholder="fill your Course name" | |
354 | + type="text" | |
355 | + :rules="courseRules" | |
356 | + required | |
357 | + ></v-text-field> | |
358 | + </v-flex> | |
359 | + </v-layout> | |
360 | + </v-flex> | |
361 | + <v-flex xs12 sm12> | |
362 | + <v-layout> | |
363 | + <v-flex xs4 class="pt-4 subheading"> | |
364 | + <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | |
365 | + <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> | |
366 | + </v-flex> | |
367 | + <v-flex xs8 class="ml-3"> | |
368 | + <v-text-field | |
369 | + label="Select Image" | |
370 | + @click="pickFile" | |
371 | + v-model="imageName" | |
372 | + append-icon="attach_file" | |
373 | + ></v-text-field> | |
374 | + </v-flex> | |
375 | + </v-layout> | |
376 | + </v-flex> | |
377 | + </v-layout> | |
378 | + <v-layout> | |
379 | + <v-flex xs12 sm12> | |
380 | + <v-layout class="right"> | |
381 | + <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | |
382 | + </v-layout> | |
383 | + </v-flex> | |
384 | + </v-layout> | |
385 | + </v-form> | |
386 | + </v-flex> | |
387 | + </v-flex> | |
388 | + </v-layout> | |
389 | + </v-container> | |
390 | + </v-card> | |
391 | + </v-dialog> | |
392 | + <v-snackbar | |
393 | + :timeout="timeout" | |
394 | + :top="y === 'top'" | |
395 | + :right="x === 'right'" | |
396 | + :vertical="mode === 'vertical'" | |
397 | + v-model="snackbar" | |
398 | + :color="color" | |
399 | + >{{ text }}</v-snackbar> | |
400 | + <div class="loader" v-if="showLoader"> | |
401 | + <v-progress-circular indeterminate color="white"></v-progress-circular> | |
402 | + </div> | |
403 | + </v-container> | |
404 | +</template> | |
405 | + | |
406 | +<script> | |
407 | +import http from "@/Services/http.js"; | |
408 | +import moment from "moment"; | |
409 | +import countryList from "@/script/country.js"; | |
410 | +import parent from "@/script/parents.js"; | |
411 | + | |
412 | +export default { | |
413 | + data: () => ({ | |
414 | + showNext: false, | |
415 | + snackbar: false, | |
416 | + y: "top", | |
417 | + x: "right", | |
418 | + role: "", | |
419 | + mode: "", | |
420 | + append: "", | |
421 | + timeout: 3000, | |
422 | + text: "", | |
423 | + show: true, | |
424 | + color: "", | |
425 | + showSearch: false, | |
426 | + showLoader: false, | |
427 | + loading: false, | |
428 | + editLoading: false, | |
429 | + date: null, | |
430 | + search: "", | |
431 | + menu: false, | |
432 | + menu1: false, | |
433 | + editStudentDialog: false, | |
434 | + profileStudentDialog: false, | |
435 | + addCourseDialog: false, | |
436 | + valid: true, | |
437 | + addclass: [], | |
438 | + addSection: [], | |
439 | + pagination: { | |
440 | + rowsPerPage: 10 | |
441 | + }, | |
442 | + imageData: {}, | |
443 | + imageName: "", | |
444 | + imageUrl: "", | |
445 | + imageFile: "", | |
446 | + editImageName: "", | |
447 | + editImageUrl: "", | |
448 | + courseRules: [v => !!v || " Course Name is required"], | |
449 | + classRules: [v => !!v || " Class Name is required"], | |
450 | + sectionRules: [v => !!v || " Section Name is required"], | |
451 | + errorMessages: "", | |
452 | + headers: [ | |
453 | + { | |
454 | + text: "Image", | |
455 | + value: "courseImageUrl", | |
456 | + sortable: false, | |
457 | + align: "center" | |
458 | + }, | |
459 | + { | |
460 | + text: "Course", | |
461 | + value: "course", | |
462 | + sortable: false, | |
463 | + align: "center" | |
464 | + }, | |
465 | + { text: "Action", value: "", sortable: false, align: "center" } | |
466 | + ], | |
467 | + courseData: [], | |
468 | + editedIndex: -1, | |
469 | + addCourses: {}, | |
470 | + selectStudents: { | |
471 | + select: "", | |
472 | + selectSection: "" | |
473 | + }, | |
474 | + editedItem: {} | |
475 | + }), | |
476 | + methods: { | |
477 | + getCourses() { | |
478 | + this.showLoader = true; | |
479 | + http() | |
480 | + .get("/getCourseesList", { | |
481 | + params: { | |
482 | + classId: this.selectStudents.select | |
483 | + } | |
484 | + }) | |
485 | + .then(response => { | |
486 | + this.courseData = response.data.data; | |
487 | + this.showLoader = false; | |
488 | + }) | |
489 | + .catch(err => { | |
490 | + console.log("err====>", err); | |
491 | + this.showLoader = false; | |
492 | + }); | |
493 | + }, | |
494 | + getSections(_id) { | |
495 | + var token = this.$store.state.token; | |
496 | + this.showLoader = true; | |
497 | + http() | |
498 | + .get( | |
499 | + "/getSectionsList", | |
500 | + { params: { classId: _id } }, | |
501 | + { | |
502 | + headers: { Authorization: "Bearer " + token } | |
503 | + } | |
504 | + ) | |
505 | + .then(response => { | |
506 | + this.addSection = response.data.data; | |
507 | + this.showLoader = false; | |
508 | + }) | |
509 | + .catch(err => { | |
510 | + this.showLoader = false; | |
511 | + }); | |
512 | + }, | |
513 | + pickFile() { | |
514 | + this.$refs.image.click(); | |
515 | + }, | |
516 | + pickEditFile() { | |
517 | + this.$refs.editDataImage.click(); | |
518 | + }, | |
519 | + dates: function(date) { | |
520 | + return moment(date).format("MMMM DD, YYYY"); | |
521 | + return date; | |
522 | + }, | |
523 | + onFilePicked(e) { | |
524 | + // console.log(e) | |
525 | + const files = e.target.files; | |
526 | + this.imageData.upload = e.target.files[0]; | |
527 | + if (files[0] !== undefined) { | |
528 | + this.imageName = files[0].name; | |
529 | + if (this.imageName.lastIndexOf(".") <= 0) { | |
530 | + return; | |
531 | + } | |
532 | + const fr = new FileReader(); | |
533 | + fr.readAsDataURL(files[0]); | |
534 | + fr.addEventListener("load", () => { | |
535 | + this.imageUrl = fr.result; | |
536 | + this.imageFile = files[0]; // this is an image file that can be sent to server... | |
537 | + this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | |
538 | + }); | |
539 | + } else { | |
540 | + this.imageName = ""; | |
541 | + this.imageFile = ""; | |
542 | + this.imageUrl = ""; | |
543 | + } | |
544 | + }, | |
545 | + onEditFilePicked(e) { | |
546 | + console.log(e); | |
547 | + const files = e.target.files; | |
548 | + if (files[0] !== undefined) { | |
549 | + this.editImageName = files[0].name; | |
550 | + console.log("this.editImageName", this.editImageName); | |
551 | + | |
552 | + if (this.editImageName.lastIndexOf(".") <= 0) { | |
553 | + return; | |
554 | + } | |
555 | + const fr = new FileReader(); | |
556 | + fr.readAsDataURL(files[0]); | |
557 | + fr.addEventListener("load", () => { | |
558 | + this.editImageUrl = fr.result; | |
559 | + this.editiImageFile = files[0]; // this is an image file that can be sent to server... | |
560 | + }); | |
561 | + } else { | |
562 | + this.editImageName = ""; | |
563 | + this.editiImageFile = ""; | |
564 | + } | |
565 | + }, | |
566 | + editItem(item) { | |
567 | + this.editedIndex = this.courseData.indexOf(item); | |
568 | + this.editedItem = Object.assign({}, item); | |
569 | + this.editStudentDialog = true; | |
570 | + }, | |
571 | + profile(item) { | |
572 | + this.editedIndex = this.courseData.indexOf(item); | |
573 | + this.editedItem = Object.assign({}, item); | |
574 | + this.profileStudentDialog = true; | |
575 | + }, | |
576 | + deleteItem(item) { | |
577 | + let deleteCourse = { | |
578 | + courseId: item._id | |
579 | + }; | |
580 | + http() | |
581 | + .delete( | |
582 | + "/deleteCourse", | |
583 | + confirm("Are you sure you want to delete this?") && { | |
584 | + params: deleteCourse | |
585 | + } | |
586 | + ) | |
587 | + .then(response => { | |
588 | + this.snackbar = true; | |
589 | + this.text = response.data.message; | |
590 | + this.color = "green"; | |
591 | + this.getCourses(); | |
592 | + }) | |
593 | + .catch(error => { | |
594 | + this.snackbar = true; | |
595 | + this.text = error.response.data.message; | |
596 | + this.color = "error"; | |
597 | + }); | |
598 | + }, | |
599 | + close() { | |
600 | + this.editStudentDialog = false; | |
601 | + }, | |
602 | + closeStudentProfile() { | |
603 | + this.profileStudentDialog = false; | |
604 | + }, | |
605 | + submit() { | |
606 | + if (this.$refs.form.validate()) { | |
607 | + let addCourse = { | |
608 | + classId: this.addCourses.select, | |
609 | + sectionId: this.addCourses.selectSection, | |
610 | + coursrName: this.addCourses.coursrName | |
611 | + }; | |
612 | + if (this.imageUrl) { | |
613 | + var str = this.imageUrl; | |
614 | + const [baseUrl, imageUrl] = str.split(/,/); | |
615 | + addCourse.upload = imageUrl; | |
616 | + } | |
617 | + this.loading = true; | |
618 | + http() | |
619 | + .post("/createCourse", addCourse) | |
620 | + .then(response => { | |
621 | + this.snackbar = true; | |
622 | + this.text = "New Course added successfully"; | |
623 | + this.color = "green"; | |
624 | + this.addCourseDialog = false; | |
625 | + this.clear(); | |
626 | + this.loading = false; | |
627 | + }) | |
628 | + .catch(error => { | |
629 | + this.snackbar = true; | |
630 | + this.text = error.response.data.message; | |
631 | + this.color = "error"; | |
632 | + this.loading = false; | |
633 | + }); | |
634 | + } | |
635 | + }, | |
636 | + clear() { | |
637 | + this.$refs.form.reset(); | |
638 | + this.imageUrl = ""; | |
639 | + }, | |
640 | + save() { | |
641 | + let editCourse = { | |
642 | + courseId: this.editedItem._id, | |
643 | + coursrName: this.editedItem.coursrName, | |
644 | + classId: this.editedItem.select | |
645 | + }; | |
646 | + if (this.editImageUrl) { | |
647 | + var str = this.editImageUrl; | |
648 | + const [baseUrl, editImageUrl] = str.split(/,/); | |
649 | + editCourse.upload = editImageUrl; | |
650 | + } | |
651 | + this.editLoading = true; | |
652 | + http() | |
653 | + .put("/updateCourse", editCourse) | |
654 | + .then(response => { | |
655 | + this.snackbar = true; | |
656 | + this.text = response.data.message; | |
657 | + this.color = "green"; | |
658 | + this.imageUrl = ""; | |
659 | + this.getCourses(); | |
660 | + this.close(); | |
661 | + this.editLoading = false; | |
662 | + }) | |
663 | + .catch(error => { | |
664 | + this.snackbar = true; | |
665 | + this.text = error.response.data.statusText; | |
666 | + this.color = "error"; | |
667 | + this.editLoading = false; | |
668 | + }); | |
669 | + }, | |
670 | + displaySearch() { | |
671 | + this.show = false; | |
672 | + this.showSearch = true; | |
673 | + }, | |
674 | + closeSearch() { | |
675 | + this.showSearch = false; | |
676 | + this.show = true; | |
677 | + this.search = ""; | |
678 | + } | |
679 | + }, | |
680 | + mounted() { | |
681 | + var token = this.$store.state.token; | |
682 | + http() | |
683 | + .get("/getClassesList", { | |
684 | + headers: { Authorization: "Bearer " + token } | |
685 | + }) | |
686 | + .then(response => { | |
687 | + this.addclass = response.data.data; | |
688 | + }) | |
689 | + .catch(error => { | |
690 | + this.showLoader = false; | |
691 | + if (error.response.status === 401) { | |
692 | + this.$router.replace({ path: "/" }); | |
693 | + this.$store.dispatch("setToken", null); | |
694 | + this.$store.dispatch("Id", null); | |
695 | + this.$store.dispatch("Role", null); | |
696 | + } | |
697 | + }); | |
698 | + } | |
699 | +}; | |
700 | +</script> | |
701 | +<style scoped> | |
702 | +.active { | |
703 | + background-color: gray; | |
704 | + color: white !important; | |
705 | +} | |
706 | +.activebtn { | |
707 | + color: black !important; | |
708 | +} | |
709 | +</style> | |
0 | 710 | \ No newline at end of file | ... | ... |
src/pages/Course/enrollStudents.vue
... | ... | @@ -0,0 +1,333 @@ |
1 | +<template> | |
2 | + <v-container fluid class="body-color"> | |
3 | + <!-- ****** STUDENTS TABLE ****** --> | |
4 | + <v-toolbar color="transparent" flat> | |
5 | + <v-spacer></v-spacer> | |
6 | + <v-flex xs12 sm4 md2> | |
7 | + <v-select | |
8 | + small | |
9 | + :items="addclass" | |
10 | + label="Select Class" | |
11 | + v-model="getReport.classId" | |
12 | + item-text="classNum" | |
13 | + item-value="_id" | |
14 | + name="Select Class" | |
15 | + @change="getCourses(getReport.classId)" | |
16 | + class="mr-2" | |
17 | + required | |
18 | + ></v-select> | |
19 | + </v-flex> | |
20 | + <v-flex xs12 sm4 md2> | |
21 | + <v-select | |
22 | + :items="courseData" | |
23 | + label="Select Course" | |
24 | + v-model="getReport.courseId" | |
25 | + item-text="coursrName" | |
26 | + item-value="_id" | |
27 | + required | |
28 | + class="ml-2" | |
29 | + @change="getStudentTable(getReport.courseId)" | |
30 | + ></v-select> | |
31 | + </v-flex> | |
32 | + <v-card-title class="body-1" v-show="show"> | |
33 | + <v-btn icon large flat @click="displaySearch"> | |
34 | + <v-avatar size="27"> | |
35 | + <img src="/static/icon/search.png" alt="icon" /> | |
36 | + </v-avatar> | |
37 | + </v-btn> | |
38 | + </v-card-title> | |
39 | + <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | |
40 | + <v-layout> | |
41 | + <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | |
42 | + <v-icon @click="closeSearch" color="error">close</v-icon> | |
43 | + </v-layout> | |
44 | + </v-flex> | |
45 | + </v-toolbar> | |
46 | + <v-data-table | |
47 | + :headers="headers" | |
48 | + :items="studentsData" | |
49 | + :pagination.sync="pagination" | |
50 | + :search="search" | |
51 | + select-all | |
52 | + v-model="selected" | |
53 | + item-key="name" | |
54 | + > | |
55 | + <template slot="items" slot-scope="props"> | |
56 | + <tr class="tr" :active="props.selected" @click="props.selected = !props.selected"> | |
57 | + <td class="text-xs-center td td-row"> | |
58 | + <v-checkbox | |
59 | + :input-value="props.selected" | |
60 | + @change="selectParticularStudent(props.item._id)" | |
61 | + primary | |
62 | + hide-details | |
63 | + ></v-checkbox> | |
64 | + </td> | |
65 | + <td class="text-xs-center td td-row"> | |
66 | + <v-avatar size="40"> | |
67 | + <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | |
68 | + <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | |
69 | + </v-avatar> | |
70 | + </td> | |
71 | + <td class="text-xs-center td td-row">{{ props.item.name}}</td> | |
72 | + <td class="text-xs-center td td-row">{{ props.item.fatherCellNo}}</td> | |
73 | + <td class="text-xs-center td td-row">{{ props.item.email }}</td> | |
74 | + </tr> | |
75 | + </template> | |
76 | + <template slot="headers" slot-scope="props"> | |
77 | + <tr> | |
78 | + <th> | |
79 | + <v-checkbox | |
80 | + :input-value="props.all" | |
81 | + :indeterminate="props.indeterminate" | |
82 | + primary | |
83 | + hide-details | |
84 | + @click.native="toggleAll" | |
85 | + ></v-checkbox> | |
86 | + </th> | |
87 | + <th | |
88 | + v-for="header in props.headers" | |
89 | + :key="header.text" | |
90 | + :class="['column sortable', pagination.descending ? 'desc' : 'asc', header.value === pagination.sortBy ? 'active' : '']" | |
91 | + @click="changeSort(header.value)" | |
92 | + > | |
93 | + <v-icon small>arrow_upward</v-icon> | |
94 | + {{ header.text }} | |
95 | + </th> | |
96 | + </tr> | |
97 | + </template> | |
98 | + <v-alert | |
99 | + slot="no-results" | |
100 | + :value="true" | |
101 | + color="error" | |
102 | + icon="warning" | |
103 | + >Your search for "{{ search }}" found no results.</v-alert> | |
104 | + </v-data-table> | |
105 | + <v-snackbar | |
106 | + :timeout="timeout" | |
107 | + :top="y === 'top'" | |
108 | + :right="x === 'right'" | |
109 | + :vertical="mode === 'vertical'" | |
110 | + v-model="snackbar" | |
111 | + color="success" | |
112 | + >{{ text }}</v-snackbar> | |
113 | + <div class="loader" v-if="showLoader"> | |
114 | + <v-progress-circular indeterminate color="white"></v-progress-circular> | |
115 | + </div> | |
116 | + </v-container> | |
117 | +</template> | |
118 | + | |
119 | +<script> | |
120 | +import http from "@/Services/http.js"; | |
121 | +import moment from "moment"; | |
122 | + | |
123 | +export default { | |
124 | + data: () => ({ | |
125 | + snackbar: false, | |
126 | + y: "top", | |
127 | + x: "right", | |
128 | + mode: "", | |
129 | + timeout: 3000, | |
130 | + text: "", | |
131 | + show: true, | |
132 | + showSearch: false, | |
133 | + showLoader: false, | |
134 | + loading: false, | |
135 | + date: null, | |
136 | + search: "", | |
137 | + addclass: [], | |
138 | + pagination: { | |
139 | + rowsPerPage: 10 | |
140 | + }, | |
141 | + headers: [ | |
142 | + { | |
143 | + text: "Profile Pic", | |
144 | + value: "profilprofilePicUrlePicUrl", | |
145 | + sortable: false, | |
146 | + align: "center" | |
147 | + }, | |
148 | + { text: "Name", value: "name", sortable: false, align: "center" }, | |
149 | + { | |
150 | + text: "Mobile No", | |
151 | + value: "fatherCellNo", | |
152 | + sortable: false, | |
153 | + align: "center" | |
154 | + }, | |
155 | + { text: "Email", value: "email", sortable: false, align: "center" } | |
156 | + // { text: "Action", value: "", sortable: false, align: "center" } | |
157 | + ], | |
158 | + token: "", | |
159 | + selectStudents: { | |
160 | + select: "", | |
161 | + selectSection: "" | |
162 | + }, | |
163 | + | |
164 | + role: "", | |
165 | + schoolRole: "", | |
166 | + menu: false, | |
167 | + valid: true, | |
168 | + | |
169 | + getReport: {}, | |
170 | + studentsData: [], | |
171 | + courseData: [], | |
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"] | |
179 | + }), | |
180 | + methods: { | |
181 | + save(date) { | |
182 | + this.$refs.menu.save(date); | |
183 | + }, | |
184 | + getAllClass() { | |
185 | + http() | |
186 | + .get("/getClassesList", { | |
187 | + headers: { Authorization: "Bearer " + this.token } | |
188 | + }) | |
189 | + .then(response => { | |
190 | + this.addclass = response.data.data; | |
191 | + }) | |
192 | + .catch(error => { | |
193 | + // console.log("err====>", err); | |
194 | + // this.$router.replace({ path: "/" }); | |
195 | + }); | |
196 | + }, | |
197 | + getCourses(classId) { | |
198 | + this.showLoader = true; | |
199 | + http() | |
200 | + .get("/getCourseesList", { | |
201 | + params: { | |
202 | + classId: classId | |
203 | + } | |
204 | + }) | |
205 | + .then(response => { | |
206 | + this.courseData = response.data.data; | |
207 | + this.showLoader = false; | |
208 | + }) | |
209 | + .catch(err => { | |
210 | + console.log("err====>", err); | |
211 | + this.showLoader = false; | |
212 | + }); | |
213 | + }, | |
214 | + getStudents() { | |
215 | + this.showLoader = true; | |
216 | + http() | |
217 | + .get("/getStudentsList", { | |
218 | + params: { | |
219 | + classId: this.getReport.classId | |
220 | + } | |
221 | + }) | |
222 | + .then(response => { | |
223 | + this.studentsData = response.data.data; | |
224 | + this.showLoader = false; | |
225 | + // this.addStudentAttendenceDialog = false; | |
226 | + var attendence = ""; | |
227 | + for (let i = 0; i < this.studentsData.length; i++) { | |
228 | + this.studentsData[i].attendence = true; | |
229 | + } | |
230 | + }) | |
231 | + .catch(error => { | |
232 | + console.log("err====>", error); | |
233 | + this.showLoader = false; | |
234 | + }); | |
235 | + }, | |
236 | + getStudentTable(id) { | |
237 | + console.log("id", this.getReport.courseId); | |
238 | + this.getStudents(); | |
239 | + }, | |
240 | + update() { | |
241 | + var studentsAttendence = []; | |
242 | + for (var j = 0; j < this.studentsData.length; j++) { | |
243 | + studentsAttendence.push({ | |
244 | + studentId: this.studentsData[j]._id, | |
245 | + isPresent: this.studentsData[j].attendence | |
246 | + }); | |
247 | + } | |
248 | + if (this.$refs.form.validate()) { | |
249 | + let attendanceData = { | |
250 | + sectionId: this.getReport.sectionId, | |
251 | + date: this.date, | |
252 | + students: studentsAttendence | |
253 | + }; | |
254 | + http() | |
255 | + .put("/updateAttendance", attendanceData) | |
256 | + .then(response => { | |
257 | + this.snackbar = true; | |
258 | + this.text = response.data.message; | |
259 | + this.addStudentAttendenceDialog = false; | |
260 | + }) | |
261 | + .catch(error => { | |
262 | + this.snackbar = true; | |
263 | + this.text = error.response.data.message; | |
264 | + }); | |
265 | + } | |
266 | + }, | |
267 | + toggleAll() { | |
268 | + if (this.selected.length) this.selected = []; | |
269 | + else this.selected = this.studentsData.slice(); | |
270 | + console.log("this.selected", this.selected); | |
271 | + console.log("selected====", selected); | |
272 | + let selectedStudentsArray = []; | |
273 | + selectedStudentsArray.push(selected.id); | |
274 | + var payload = { | |
275 | + courseId: this.getReport.courseId, | |
276 | + enrollStudents: selectedStudentsArray | |
277 | + }; | |
278 | + http() | |
279 | + .put("/enrollStudents", payload) | |
280 | + .then(response => { | |
281 | + this.snackbar = true; | |
282 | + this.text = response.data.message; | |
283 | + }) | |
284 | + .catch(error => { | |
285 | + this.snackbar = true; | |
286 | + this.text = error.response.data.message; | |
287 | + }); | |
288 | + }, | |
289 | + selectParticularStudent(selected) { | |
290 | + console.log("selected====", selected); | |
291 | + let selectedStudentsArray = []; | |
292 | + selectedStudentsArray.push(selected); | |
293 | + var payload = { | |
294 | + courseId: this.getReport.courseId, | |
295 | + enrollStudents: selectedStudentsArray | |
296 | + }; | |
297 | + http() | |
298 | + .put("/enrollStudents", payload) | |
299 | + .then(response => { | |
300 | + this.snackbar = true; | |
301 | + this.text = response.data.message; | |
302 | + }) | |
303 | + .catch(error => { | |
304 | + this.snackbar = true; | |
305 | + this.text = error.response.data.message; | |
306 | + }); | |
307 | + }, | |
308 | + changeSort(column) { | |
309 | + if (this.pagination.sortBy === column) { | |
310 | + this.pagination.descending = !this.pagination.descending; | |
311 | + } else { | |
312 | + this.pagination.sortBy = column; | |
313 | + this.pagination.descending = false; | |
314 | + } | |
315 | + }, | |
316 | + displaySearch() { | |
317 | + this.show = false; | |
318 | + this.showSearch = true; | |
319 | + }, | |
320 | + closeSearch() { | |
321 | + this.showSearch = false; | |
322 | + this.show = true; | |
323 | + this.search = ""; | |
324 | + } | |
325 | + }, | |
326 | + mounted() { | |
327 | + // this.getStudentList(); | |
328 | + this.token = this.$store.state.token; | |
329 | + this.role = this.$store.state.role; | |
330 | + this.getAllClass(); | |
331 | + } | |
332 | +}; | |
333 | +</script> | |
0 | 334 | \ No newline at end of file | ... | ... |
src/pages/Dashboard/dashboard.vue
... | ... | @@ -509,11 +509,11 @@ export default { |
509 | 509 | .catch(error => { |
510 | 510 | // console.log("err====>", err); |
511 | 511 | this.showLoader = false; |
512 | - // if (error.response.status === 401) { | |
513 | - // this.$router.replace({ path: "/" }); | |
514 | - // this.$store.dispatch("setToken", null); | |
515 | - // this.$store.dispatch("Id", null); | |
516 | - // } | |
512 | + if (error.response.status === 401) { | |
513 | + this.$router.replace({ path: "/" }); | |
514 | + this.$store.dispatch("setToken", null); | |
515 | + this.$store.dispatch("Id", null); | |
516 | + } | |
517 | 517 | }); |
518 | 518 | }, |
519 | 519 | getParents() { |
... | ... | @@ -530,11 +530,6 @@ export default { |
530 | 530 | .catch(error => { |
531 | 531 | // console.log("err====>", err); |
532 | 532 | this.showLoader = false; |
533 | - // if (error.response.status === 401) { | |
534 | - // this.$router.replace({ path: "/" }); | |
535 | - // this.$store.dispatch("setToken", null); | |
536 | - // this.$store.dispatch("Id", null); | |
537 | - // } | |
538 | 533 | }); |
539 | 534 | }, |
540 | 535 | getTeachers() { |
... | ... | @@ -551,11 +546,6 @@ export default { |
551 | 546 | .catch(error => { |
552 | 547 | // console.log("err====>", err); |
553 | 548 | this.showLoader = false; |
554 | - // if (error.response.status === 401) { | |
555 | - // this.$router.replace({ path: "/" }); | |
556 | - // this.$store.dispatch("setToken", null); | |
557 | - // this.$store.dispatch("Id", null); | |
558 | - // } | |
559 | 549 | }); |
560 | 550 | }, |
561 | 551 | getClasses() { |
... | ... | @@ -571,12 +561,6 @@ export default { |
571 | 561 | }) |
572 | 562 | .catch(error => { |
573 | 563 | this.showLoader = false; |
574 | - // if (error.response.status === 401) { | |
575 | - // this.$router.replace({ path: "/" }); | |
576 | - // this.$store.dispatch("setToken", null); | |
577 | - // this.$store.dispatch("Id", null); | |
578 | - // this.$store.dispatch("Role", null); | |
579 | - // } | |
580 | 564 | }); |
581 | 565 | }, |
582 | 566 | getNoticeData() { |
... | ... | @@ -593,11 +577,6 @@ export default { |
593 | 577 | }) |
594 | 578 | .catch(error => { |
595 | 579 | this.showLoader = false; |
596 | - // if (error.response.status === 401) { | |
597 | - // this.$router.replace({ path: "/" }); | |
598 | - // this.$store.dispatch("setToken", null); | |
599 | - // this.$store.dispatch("Id", null); | |
600 | - // } | |
601 | 580 | }); |
602 | 581 | }, |
603 | 582 | getUserData() { |
... | ... | @@ -614,11 +593,6 @@ export default { |
614 | 593 | }) |
615 | 594 | .catch(error => { |
616 | 595 | this.showLoader = false; |
617 | - // if (error.response.status === 401) { | |
618 | - // this.$router.replace({ path: "/" }); | |
619 | - // this.$store.dispatch("setToken", null); | |
620 | - // this.$store.dispatch("Id", null); | |
621 | - // } | |
622 | 596 | }); |
623 | 597 | }, |
624 | 598 | ... | ... |
src/pages/Mark/viewMark.vue
... | ... | @@ -256,7 +256,7 @@ |
256 | 256 | </tbody> |
257 | 257 | </table> |
258 | 258 | </v-card> |
259 | - <v-card v-if="markData == ''"> | |
259 | + <v-card v-if="markData.length == 0"> | |
260 | 260 | <v-layout> |
261 | 261 | <v-flex xs12> |
262 | 262 | <h5 class="text-xs-center pa-3">No Data Found</h5> |
... | ... | @@ -503,7 +503,7 @@ |
503 | 503 | </tbody> |
504 | 504 | </table> |
505 | 505 | </v-card> |
506 | - <v-card v-if="markData == ''"> | |
506 | + <v-card v-if="markData.length == 0"> | |
507 | 507 | <v-layout> |
508 | 508 | <v-flex xs12> |
509 | 509 | <h5 class="text-xs-center pa-3">No Data Found</h5> | ... | ... |
src/pages/Parent/parents.vue
... | ... | @@ -120,11 +120,9 @@ |
120 | 120 | </v-flex> |
121 | 121 | <v-flex xs8 class="ml-3"> |
122 | 122 | <v-text-field |
123 | - :append-icon="e1 ? 'visibility_off' : 'visibility'" | |
124 | - :append-icon-cb="() => (e1 = !e1)" | |
125 | - :type="e1 ? 'password' : 'text'" | |
126 | - :rules="password" | |
127 | - placeholder="Enter Your Password" | |
123 | + v-model="editedItem.password" | |
124 | + placeholder="Enter Password" | |
125 | + type="text" | |
128 | 126 | required |
129 | 127 | ></v-text-field> |
130 | 128 | </v-flex> | ... | ... |
src/router/paths.js
... | ... | @@ -793,7 +793,42 @@ export default [{ |
793 | 793 | `@/pages/Academic/syllabus.vue` |
794 | 794 | ) |
795 | 795 | }, |
796 | - | |
796 | + { | |
797 | + path: '/course', | |
798 | + meta: {}, | |
799 | + name: 'Course', | |
800 | + props: (route) => ({ type: route.query.type }), | |
801 | + component: () => | |
802 | + import ( | |
803 | + /* webpackChunkName: "routes" */ | |
804 | + /* webpackMode: "lazy-once" */ | |
805 | + `@/pages/Course/course.vue` | |
806 | + ) | |
807 | + }, | |
808 | + { | |
809 | + path: '/enrollStudents', | |
810 | + meta: {}, | |
811 | + name: 'Enroll Students', | |
812 | + props: (route) => ({ type: route.query.type }), | |
813 | + component: () => | |
814 | + import ( | |
815 | + /* webpackChunkName: "routes" */ | |
816 | + /* webpackMode: "lazy-once" */ | |
817 | + `@/pages/Course/enrollStudents.vue` | |
818 | + ) | |
819 | + }, | |
820 | + { | |
821 | + path: '/annoucement', | |
822 | + meta: {}, | |
823 | + name: 'Annoucement', | |
824 | + props: (route) => ({ type: route.query.type }), | |
825 | + component: () => | |
826 | + import ( | |
827 | + /* webpackChunkName: "routes" */ | |
828 | + /* webpackMode: "lazy-once" */ | |
829 | + `@/pages/Annoucement/annoucement.vue` | |
830 | + ) | |
831 | + }, | |
797 | 832 | //////SCHOOL |
798 | 833 | |
799 | 834 | { | ... | ... |
static/icon/camera-icon-white.jpg
68.4 KB