Commit fc9854ffb884eae820f8f20f45a754015c73c039
1 parent
ba110dd210
Exists in
master
and in
2 other branches
Show list of added data after adding the exam schedule
Showing
1 changed file
with
25 additions
and
2 deletions
Show diff stats
src/pages/Exam/examSchedule.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Exam Schedule****** --> | 3 | <!-- ****** Edit Exam Schedule****** --> |
4 | <v-dialog v-model="editExamScheduleDialog" max-width="800px" scrollable> | 4 | <v-dialog v-model="editExamScheduleDialog" max-width="800px" scrollable> |
5 | <v-card flat class="card-style pa-2" dark> | 5 | <v-card flat class="card-style pa-2" dark> |
6 | <v-layout> | 6 | <v-layout> |
7 | <v-flex xs12> | 7 | <v-flex xs12> |
8 | <label class="title text-xs-center">Edit Exam Schedule</label> | 8 | <label class="title text-xs-center">Edit Exam Schedule</label> |
9 | <v-icon size="24" class="right" @click="editExamScheduleDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editExamScheduleDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-card-text> | 12 | <v-card-text> |
13 | <v-form ref="form"> | 13 | <v-form ref="form"> |
14 | <v-container fluid> | 14 | <v-container fluid> |
15 | <v-layout wrap> | 15 | <v-layout wrap> |
16 | <v-flex xs12 sm12> | 16 | <v-flex xs12 sm12> |
17 | <v-layout> | 17 | <v-layout> |
18 | <v-flex xs4 class="pt-4 subheading"> | 18 | <v-flex xs4 class="pt-4 subheading"> |
19 | <label class="right">Exam Name:</label> | 19 | <label class="right">Exam Name:</label> |
20 | </v-flex> | 20 | </v-flex> |
21 | <v-flex xs7 class="ml-3"> | 21 | <v-flex xs7 class="ml-3"> |
22 | <v-select | 22 | <v-select |
23 | :rules="examRules" | 23 | :rules="examRules" |
24 | :items="examList" | 24 | :items="examList" |
25 | v-model="editedItem.examId" | 25 | v-model="editedItem.examId" |
26 | label="Select your Exam Name" | 26 | label="Select your Exam Name" |
27 | item-text="examName" | 27 | item-text="examName" |
28 | item-value="_id" | 28 | item-value="_id" |
29 | ></v-select> | 29 | ></v-select> |
30 | </v-flex> | 30 | </v-flex> |
31 | </v-layout> | 31 | </v-layout> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs12 sm12> | 33 | <v-flex xs12 sm12> |
34 | <v-layout> | 34 | <v-layout> |
35 | <v-flex xs4 class="pt-4 subheading"> | 35 | <v-flex xs4 class="pt-4 subheading"> |
36 | <label class="right">Class:</label> | 36 | <label class="right">Class:</label> |
37 | </v-flex> | 37 | </v-flex> |
38 | <v-flex xs7 class="ml-3"> | 38 | <v-flex xs7 class="ml-3"> |
39 | <v-select | 39 | <v-select |
40 | v-model="editedItem.classId" | 40 | v-model="editedItem.classId" |
41 | label="Select your Class" | 41 | label="Select your Class" |
42 | type="text" | 42 | type="text" |
43 | :items="classList" | 43 | :items="classList" |
44 | item-text="classNum" | 44 | item-text="classNum" |
45 | item-value="_id" | 45 | item-value="_id" |
46 | @change="getSections(editedItem.classId)" | 46 | @change="getSections(editedItem.classId)" |
47 | required | 47 | required |
48 | ></v-select> | 48 | ></v-select> |
49 | </v-flex> | 49 | </v-flex> |
50 | </v-layout> | 50 | </v-layout> |
51 | </v-flex> | 51 | </v-flex> |
52 | <v-flex xs12 sm12> | 52 | <v-flex xs12 sm12> |
53 | <v-layout> | 53 | <v-layout> |
54 | <v-flex xs4 class="pt-4 subheading"> | 54 | <v-flex xs4 class="pt-4 subheading"> |
55 | <label class="right">Subject Name:</label> | 55 | <label class="right">Subject Name:</label> |
56 | </v-flex> | 56 | </v-flex> |
57 | <v-flex xs7 class="ml-3"> | 57 | <v-flex xs7 class="ml-3"> |
58 | <v-select | 58 | <v-select |
59 | :items="subjects" | 59 | :items="subjects" |
60 | label="Select your Subject" | 60 | label="Select your Subject" |
61 | v-model="editedItem.subjectName" | 61 | v-model="editedItem.subjectName" |
62 | item-text="subjectName" | 62 | item-text="subjectName" |
63 | item-value="subjectName" | 63 | item-value="subjectName" |
64 | name="Select Subject" | 64 | name="Select Subject" |
65 | required | 65 | required |
66 | ></v-select> | 66 | ></v-select> |
67 | </v-flex> | 67 | </v-flex> |
68 | </v-layout> | 68 | </v-layout> |
69 | </v-flex> | 69 | </v-flex> |
70 | <v-flex xs12 sm12> | 70 | <v-flex xs12 sm12> |
71 | <v-layout> | 71 | <v-layout> |
72 | <v-flex xs4 class="pt-4 subheading"> | 72 | <v-flex xs4 class="pt-4 subheading"> |
73 | <label class="right">Date:</label> | 73 | <label class="right">Date:</label> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-flex xs7 class="ml-3"> | 75 | <v-flex xs7 class="ml-3"> |
76 | <v-menu | 76 | <v-menu |
77 | ref="editDate" | 77 | ref="editDate" |
78 | :close-on-content-click="false" | 78 | :close-on-content-click="false" |
79 | v-model="editDate" | 79 | v-model="editDate" |
80 | :nudge-right="40" | 80 | :nudge-right="40" |
81 | :return-value.sync="editDate" | 81 | :return-value.sync="editDate" |
82 | lazy | 82 | lazy |
83 | transition="scale-transition" | 83 | transition="scale-transition" |
84 | offset-y | 84 | offset-y |
85 | full-width | 85 | full-width |
86 | min-width="290px" | 86 | min-width="290px" |
87 | > | 87 | > |
88 | <v-text-field | 88 | <v-text-field |
89 | slot="activator" | 89 | slot="activator" |
90 | v-model="editedItem.date" | 90 | v-model="editedItem.date" |
91 | label="Select Date" | 91 | label="Select Date" |
92 | append-icon="event" | 92 | append-icon="event" |
93 | readonly | 93 | readonly |
94 | ></v-text-field> | 94 | ></v-text-field> |
95 | <v-date-picker v-model="editedItem.date" @input="editDate = false"></v-date-picker> | 95 | <v-date-picker v-model="editedItem.date" @input="editDate = false"></v-date-picker> |
96 | </v-menu> | 96 | </v-menu> |
97 | </v-flex> | 97 | </v-flex> |
98 | </v-layout> | 98 | </v-layout> |
99 | </v-flex> | 99 | </v-flex> |
100 | <v-flex xs12 sm12> | 100 | <v-flex xs12 sm12> |
101 | <v-layout> | 101 | <v-layout> |
102 | <v-flex xs4 class="pt-4 subheading"> | 102 | <v-flex xs4 class="pt-4 subheading"> |
103 | <label class="right">Time From:</label> | 103 | <label class="right">Time From:</label> |
104 | </v-flex> | 104 | </v-flex> |
105 | <v-flex xs7 class="ml-3"> | 105 | <v-flex xs7 class="ml-3"> |
106 | <v-menu | 106 | <v-menu |
107 | ref="menuEdit" | 107 | ref="menuEdit" |
108 | :close-on-content-click="false" | 108 | :close-on-content-click="false" |
109 | v-model="menuEdit" | 109 | v-model="menuEdit" |
110 | :nudge-right="40" | 110 | :nudge-right="40" |
111 | :return-value.sync="editedItem.timeFrom" | 111 | :return-value.sync="editedItem.timeFrom" |
112 | lazy | 112 | lazy |
113 | transition="scale-transition" | 113 | transition="scale-transition" |
114 | offset-y | 114 | offset-y |
115 | full-width | 115 | full-width |
116 | max-width="290px" | 116 | max-width="290px" |
117 | min-width="290px" | 117 | min-width="290px" |
118 | > | 118 | > |
119 | <v-text-field | 119 | <v-text-field |
120 | slot="activator" | 120 | slot="activator" |
121 | v-model="editedItem.timeFrom" | 121 | v-model="editedItem.timeFrom" |
122 | label="Select your time From" | 122 | label="Select your time From" |
123 | append-icon="access_time" | 123 | append-icon="access_time" |
124 | readonly | 124 | readonly |
125 | ></v-text-field> | 125 | ></v-text-field> |
126 | <v-time-picker | 126 | <v-time-picker |
127 | v-model="editedItem.timeIn" | 127 | v-model="editedItem.timeIn" |
128 | @change="$refs.menuEdit.save(editedItem.timeIn)" | 128 | @change="$refs.menuEdit.save(editedItem.timeIn)" |
129 | ></v-time-picker> | 129 | ></v-time-picker> |
130 | </v-menu> | 130 | </v-menu> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | </v-flex> | 133 | </v-flex> |
134 | <v-flex xs12 sm12> | 134 | <v-flex xs12 sm12> |
135 | <v-layout> | 135 | <v-layout> |
136 | <v-flex xs4 class="pt-4 subheading"> | 136 | <v-flex xs4 class="pt-4 subheading"> |
137 | <label class="right">Time To:</label> | 137 | <label class="right">Time To:</label> |
138 | </v-flex> | 138 | </v-flex> |
139 | <v-flex xs7 class="ml-3"> | 139 | <v-flex xs7 class="ml-3"> |
140 | <v-menu | 140 | <v-menu |
141 | ref="timeToEdit" | 141 | ref="timeToEdit" |
142 | :close-on-content-click="false" | 142 | :close-on-content-click="false" |
143 | v-model="timeToEdit" | 143 | v-model="timeToEdit" |
144 | :nudge-right="40" | 144 | :nudge-right="40" |
145 | :return-value.sync="editedItem.timeTo" | 145 | :return-value.sync="editedItem.timeTo" |
146 | lazy | 146 | lazy |
147 | transition="scale-transition" | 147 | transition="scale-transition" |
148 | offset-y | 148 | offset-y |
149 | full-width | 149 | full-width |
150 | max-width="290px" | 150 | max-width="290px" |
151 | min-width="290px" | 151 | min-width="290px" |
152 | > | 152 | > |
153 | <v-text-field | 153 | <v-text-field |
154 | slot="activator" | 154 | slot="activator" |
155 | v-model="editedItem.timeTo" | 155 | v-model="editedItem.timeTo" |
156 | label="Select your Time To" | 156 | label="Select your Time To" |
157 | append-icon="access_time" | 157 | append-icon="access_time" |
158 | readonly | 158 | readonly |
159 | ></v-text-field> | 159 | ></v-text-field> |
160 | <v-time-picker | 160 | <v-time-picker |
161 | v-model="editedItem.timeTo" | 161 | v-model="editedItem.timeTo" |
162 | @change="$refs.timeToEdit.save(editedItem.timeTo)" | 162 | @change="$refs.timeToEdit.save(editedItem.timeTo)" |
163 | ></v-time-picker> | 163 | ></v-time-picker> |
164 | </v-menu> | 164 | </v-menu> |
165 | </v-flex> | 165 | </v-flex> |
166 | </v-layout> | 166 | </v-layout> |
167 | </v-flex> | 167 | </v-flex> |
168 | <v-flex xs12 sm12> | 168 | <v-flex xs12 sm12> |
169 | <v-layout> | 169 | <v-layout> |
170 | <v-flex xs4 class="pt-4 subheading"> | 170 | <v-flex xs4 class="pt-4 subheading"> |
171 | <label class="right">Room:</label> | 171 | <label class="right">Room:</label> |
172 | </v-flex> | 172 | </v-flex> |
173 | <v-flex xs7 class="ml-3"> | 173 | <v-flex xs7 class="ml-3"> |
174 | <v-text-field | 174 | <v-text-field |
175 | placeholder="fill your room" | 175 | placeholder="fill your room" |
176 | v-model="editedItem.room" | 176 | v-model="editedItem.room" |
177 | @keyup.enter="save" | 177 | @keyup.enter="save" |
178 | ></v-text-field> | 178 | ></v-text-field> |
179 | </v-flex> | 179 | </v-flex> |
180 | </v-layout> | 180 | </v-layout> |
181 | </v-flex> | 181 | </v-flex> |
182 | </v-layout> | 182 | </v-layout> |
183 | <v-layout> | 183 | <v-layout> |
184 | <v-flex xs12> | 184 | <v-flex xs12> |
185 | <v-card-actions> | 185 | <v-card-actions> |
186 | <v-spacer></v-spacer> | 186 | <v-spacer></v-spacer> |
187 | <v-btn round dark @click="update" class="add-button">Save</v-btn> | 187 | <v-btn round dark @click="update" class="add-button">Save</v-btn> |
188 | </v-card-actions> | 188 | </v-card-actions> |
189 | </v-flex> | 189 | </v-flex> |
190 | </v-layout> | 190 | </v-layout> |
191 | </v-container> | 191 | </v-container> |
192 | </v-form> | 192 | </v-form> |
193 | </v-card-text> | 193 | </v-card-text> |
194 | </v-card> | 194 | </v-card> |
195 | </v-dialog> | 195 | </v-dialog> |
196 | 196 | ||
197 | <!-- ****** PROFILE VIEW Exam Schedule DATA ****** --> | 197 | <!-- ****** PROFILE VIEW Exam Schedule DATA ****** --> |
198 | 198 | ||
199 | <v-dialog v-model="profileExamScheduleDialog" max-width="600px"> | 199 | <v-dialog v-model="profileExamScheduleDialog" max-width="600px"> |
200 | <v-card flat class="card-style pa-3" dark> | 200 | <v-card flat class="card-style pa-3" dark> |
201 | <v-layout> | 201 | <v-layout> |
202 | <v-flex xs12> | 202 | <v-flex xs12> |
203 | <label class="title text-xs-center">View Exam Schedule</label> | 203 | <label class="title text-xs-center">View Exam Schedule</label> |
204 | <v-icon size="24" class="right" @click="profileExamScheduleDialog = false">cancel</v-icon> | 204 | <v-icon size="24" class="right" @click="profileExamScheduleDialog = false">cancel</v-icon> |
205 | </v-flex> | 205 | </v-flex> |
206 | </v-layout> | 206 | </v-layout> |
207 | <v-card-text> | 207 | <v-card-text> |
208 | <v-container grid-list-md> | 208 | <v-container grid-list-md> |
209 | <v-layout wrap> | 209 | <v-layout wrap> |
210 | <v-flex> | 210 | <v-flex> |
211 | <v-layout> | 211 | <v-layout> |
212 | <v-flex xs5 sm6> | 212 | <v-flex xs5 sm6> |
213 | <h5 class="right my-1"> | 213 | <h5 class="right my-1"> |
214 | <b>Exam Name:</b> | 214 | <b>Exam Name:</b> |
215 | </h5> | 215 | </h5> |
216 | </v-flex> | 216 | </v-flex> |
217 | <v-flex sm6 xs8> | 217 | <v-flex sm6 xs8> |
218 | <h5 class="my-1">{{ editedItem.examId}}</h5> | 218 | <h5 class="my-1">{{ editedItem.examId}}</h5> |
219 | </v-flex> | 219 | </v-flex> |
220 | </v-layout> | 220 | </v-layout> |
221 | <v-layout> | 221 | <v-layout> |
222 | <v-flex xs5 sm6> | 222 | <v-flex xs5 sm6> |
223 | <h5 class="right my-1"> | 223 | <h5 class="right my-1"> |
224 | <b>Class:</b> | 224 | <b>Class:</b> |
225 | </h5> | 225 | </h5> |
226 | </v-flex> | 226 | </v-flex> |
227 | <v-flex sm6 xs8> | 227 | <v-flex sm6 xs8> |
228 | <h5 class="my-1">{{ editedItem.classId }}</h5> | 228 | <h5 class="my-1">{{ editedItem.classId }}</h5> |
229 | </v-flex> | 229 | </v-flex> |
230 | </v-layout> | 230 | </v-layout> |
231 | <v-layout> | 231 | <v-layout> |
232 | <v-flex xs5 sm6> | 232 | <v-flex xs5 sm6> |
233 | <h5 class="right my-1"> | 233 | <h5 class="right my-1"> |
234 | <b>Section:</b> | 234 | <b>Section:</b> |
235 | </h5> | 235 | </h5> |
236 | </v-flex> | 236 | </v-flex> |
237 | <v-flex sm6 xs8> | 237 | <v-flex sm6 xs8> |
238 | <h5 class="my-1">{{ editedItem.sectionId }}</h5> | 238 | <h5 class="my-1">{{ editedItem.sectionId }}</h5> |
239 | </v-flex> | 239 | </v-flex> |
240 | </v-layout> | 240 | </v-layout> |
241 | <v-layout> | 241 | <v-layout> |
242 | <v-flex xs5 sm6> | 242 | <v-flex xs5 sm6> |
243 | <h5 class="right my-1"> | 243 | <h5 class="right my-1"> |
244 | <b>Subject Name:</b> | 244 | <b>Subject Name:</b> |
245 | </h5> | 245 | </h5> |
246 | </v-flex> | 246 | </v-flex> |
247 | <v-flex sm6 xs8> | 247 | <v-flex sm6 xs8> |
248 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> | 248 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> |
249 | </v-flex> | 249 | </v-flex> |
250 | </v-layout> | 250 | </v-layout> |
251 | <v-layout> | 251 | <v-layout> |
252 | <v-flex xs5 sm6> | 252 | <v-flex xs5 sm6> |
253 | <h5 class="right my-1"> | 253 | <h5 class="right my-1"> |
254 | <b>Date:</b> | 254 | <b>Date:</b> |
255 | </h5> | 255 | </h5> |
256 | </v-flex> | 256 | </v-flex> |
257 | <v-flex sm6 xs8> | 257 | <v-flex sm6 xs8> |
258 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> | 258 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> |
259 | </v-flex> | 259 | </v-flex> |
260 | </v-layout> | 260 | </v-layout> |
261 | <v-layout> | 261 | <v-layout> |
262 | <v-flex xs5 sm6> | 262 | <v-flex xs5 sm6> |
263 | <h5 class="right my-1"> | 263 | <h5 class="right my-1"> |
264 | <b>Time From:</b> | 264 | <b>Time From:</b> |
265 | </h5> | 265 | </h5> |
266 | </v-flex> | 266 | </v-flex> |
267 | <v-flex sm6 xs8> | 267 | <v-flex sm6 xs8> |
268 | <h5 class="my-1">{{ editedItem.timeFrom }}</h5> | 268 | <h5 class="my-1">{{ editedItem.timeFrom }}</h5> |
269 | </v-flex> | 269 | </v-flex> |
270 | </v-layout> | 270 | </v-layout> |
271 | <v-layout> | 271 | <v-layout> |
272 | <v-flex xs5 sm6> | 272 | <v-flex xs5 sm6> |
273 | <h5 class="right my-1"> | 273 | <h5 class="right my-1"> |
274 | <b>Time To:</b> | 274 | <b>Time To:</b> |
275 | </h5> | 275 | </h5> |
276 | </v-flex> | 276 | </v-flex> |
277 | <v-flex sm6 xs8> | 277 | <v-flex sm6 xs8> |
278 | <h5 class="my-1">{{ editedItem.timeTo }}</h5> | 278 | <h5 class="my-1">{{ editedItem.timeTo }}</h5> |
279 | </v-flex> | 279 | </v-flex> |
280 | </v-layout> | 280 | </v-layout> |
281 | <v-layout> | 281 | <v-layout> |
282 | <v-flex xs5 sm6> | 282 | <v-flex xs5 sm6> |
283 | <h5 class="right my-1"> | 283 | <h5 class="right my-1"> |
284 | <b>Room:</b> | 284 | <b>Room:</b> |
285 | </h5> | 285 | </h5> |
286 | </v-flex> | 286 | </v-flex> |
287 | <v-flex sm6 xs8> | 287 | <v-flex sm6 xs8> |
288 | <h5 class="my-1">{{ editedItem.room }}</h5> | 288 | <h5 class="my-1">{{ editedItem.room }}</h5> |
289 | </v-flex> | 289 | </v-flex> |
290 | </v-layout> | 290 | </v-layout> |
291 | </v-flex> | 291 | </v-flex> |
292 | </v-layout> | 292 | </v-layout> |
293 | </v-container> | 293 | </v-container> |
294 | </v-card-text> | 294 | </v-card-text> |
295 | </v-card> | 295 | </v-card> |
296 | </v-dialog> | 296 | </v-dialog> |
297 | <!-- ***** Exam Schedule TABLE****** --> | 297 | <!-- ***** Exam Schedule TABLE****** --> |
298 | <v-toolbar color="transparent" flat> | 298 | <v-toolbar color="transparent" flat> |
299 | <v-btn | 299 | <v-btn |
300 | fab | 300 | fab |
301 | dark | 301 | dark |
302 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 302 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
303 | small | 303 | small |
304 | @click="addExamScheduleDialog = true" | 304 | @click="addExamScheduleDialog = true" |
305 | > | 305 | > |
306 | <v-icon dark>add</v-icon> | 306 | <v-icon dark>add</v-icon> |
307 | </v-btn> | 307 | </v-btn> |
308 | <v-btn | 308 | <v-btn |
309 | v-if="role != 'TEACHER' " | 309 | v-if="role != 'TEACHER' " |
310 | round | 310 | round |
311 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 311 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
312 | dark | 312 | dark |
313 | @click="addExamScheduleDialog = true" | 313 | @click="addExamScheduleDialog = true" |
314 | > | 314 | > |
315 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Schedule | 315 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Schedule |
316 | </v-btn> | 316 | </v-btn> |
317 | <v-spacer></v-spacer> | 317 | <v-spacer></v-spacer> |
318 | <v-flex xs8 sm3 md2 class="mr-3"> | 318 | <v-flex xs8 sm3 md2 class="mr-3"> |
319 | <v-select | 319 | <v-select |
320 | v-model="getScheduleData.classId" | 320 | v-model="getScheduleData.classId" |
321 | label="Select your class" | 321 | label="Select your class" |
322 | type="text" | 322 | type="text" |
323 | :items="classList" | 323 | :items="classList" |
324 | item-text="classNum" | 324 | item-text="classNum" |
325 | item-value="_id" | 325 | item-value="_id" |
326 | @change="getSections(getScheduleData.classId)" | 326 | @change="getSections(getScheduleData.classId)" |
327 | required | 327 | required |
328 | ></v-select> | 328 | ></v-select> |
329 | </v-flex> | 329 | </v-flex> |
330 | <v-flex xs8 sm3 md2 class="mr-3"> | 330 | <v-flex xs8 sm3 md2 class="mr-3"> |
331 | <v-select | 331 | <v-select |
332 | v-model="getScheduleData.sectionId" | 332 | v-model="getScheduleData.sectionId" |
333 | label="Select your section" | 333 | label="Select your section" |
334 | type="text" | 334 | type="text" |
335 | :items="addSection" | 335 | :items="addSection" |
336 | item-text="name" | 336 | item-text="name" |
337 | item-value="_id" | 337 | item-value="_id" |
338 | @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)" | 338 | @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)" |
339 | required | 339 | required |
340 | ></v-select> | 340 | ></v-select> |
341 | </v-flex> | 341 | </v-flex> |
342 | <v-card-title class="body-1" v-show="show"> | 342 | <v-card-title class="body-1" v-show="show"> |
343 | <v-btn icon large flat @click="displaySearch"> | 343 | <v-btn icon large flat @click="displaySearch"> |
344 | <v-avatar size="27"> | 344 | <v-avatar size="27"> |
345 | <img src="/static/icon/search.png" alt="icon" /> | 345 | <img src="/static/icon/search.png" alt="icon" /> |
346 | </v-avatar> | 346 | </v-avatar> |
347 | </v-btn> | 347 | </v-btn> |
348 | </v-card-title> | 348 | </v-card-title> |
349 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 349 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
350 | <v-layout> | 350 | <v-layout> |
351 | <v-text-field | 351 | <v-text-field |
352 | autofocus | 352 | autofocus |
353 | v-model="search" | 353 | v-model="search" |
354 | label="Search" | 354 | label="Search" |
355 | prepend-inner-icon="search" | 355 | prepend-inner-icon="search" |
356 | color="primary" | 356 | color="primary" |
357 | ></v-text-field> | 357 | ></v-text-field> |
358 | <v-icon @click="closeSearch" color="error">close</v-icon> | 358 | <v-icon @click="closeSearch" color="error">close</v-icon> |
359 | </v-layout> | 359 | </v-layout> |
360 | </v-flex> | 360 | </v-flex> |
361 | </v-toolbar> | 361 | </v-toolbar> |
362 | <v-data-table | 362 | <v-data-table |
363 | :headers="headers" | 363 | :headers="headers" |
364 | :items="ScheduleData" | 364 | :items="ScheduleData" |
365 | :pagination.sync="pagination" | 365 | :pagination.sync="pagination" |
366 | :search="search" | 366 | :search="search" |
367 | > | 367 | > |
368 | <template slot="items" slot-scope="props"> | 368 | <template slot="items" slot-scope="props"> |
369 | <tr class="tr"> | 369 | <tr class="tr"> |
370 | <td class="td td-row">{{ props.index + 1}}</td> | 370 | <td class="td td-row">{{ props.index + 1}}</td> |
371 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> | 371 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> |
372 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> | 372 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> |
373 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> | 373 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> |
374 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> | 374 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> |
375 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> | 375 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> |
376 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> | 376 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> |
377 | <td class="td td-row text-xs-center"> | 377 | <td class="td td-row text-xs-center"> |
378 | <span> | 378 | <span> |
379 | <v-tooltip top> | 379 | <v-tooltip top> |
380 | <img | 380 | <img |
381 | slot="activator" | 381 | slot="activator" |
382 | style="cursor:pointer; width:25px; height:25px; " | 382 | style="cursor:pointer; width:25px; height:25px; " |
383 | class="mr-3" | 383 | class="mr-3" |
384 | @click="profile(props.item)" | 384 | @click="profile(props.item)" |
385 | src="/static/icon/view.png" | 385 | src="/static/icon/view.png" |
386 | /> | 386 | /> |
387 | <span>View</span> | 387 | <span>View</span> |
388 | </v-tooltip> | 388 | </v-tooltip> |
389 | <v-tooltip top v-if="role != 'TEACHER' "> | 389 | <v-tooltip top v-if="role != 'TEACHER' "> |
390 | <img | 390 | <img |
391 | slot="activator" | 391 | slot="activator" |
392 | style="cursor:pointer; width:20px; height:18px; " | 392 | style="cursor:pointer; width:20px; height:18px; " |
393 | class="mr-3" | 393 | class="mr-3" |
394 | @click="editItem(props.item)" | 394 | @click="editItem(props.item)" |
395 | src="/static/icon/edit.png" | 395 | src="/static/icon/edit.png" |
396 | /> | 396 | /> |
397 | <span>Edit</span> | 397 | <span>Edit</span> |
398 | </v-tooltip> | 398 | </v-tooltip> |
399 | <v-tooltip top v-if="role != 'TEACHER' "> | 399 | <v-tooltip top v-if="role != 'TEACHER' "> |
400 | <img | 400 | <img |
401 | slot="activator" | 401 | slot="activator" |
402 | style="cursor:pointer; width:20px; height:20px; " | 402 | style="cursor:pointer; width:20px; height:20px; " |
403 | @click="deleteSchedule(props.item)" | 403 | @click="deleteSchedule(props.item)" |
404 | src="/static/icon/delete.png" | 404 | src="/static/icon/delete.png" |
405 | /> | 405 | /> |
406 | <span>Delete</span> | 406 | <span>Delete</span> |
407 | </v-tooltip> | 407 | </v-tooltip> |
408 | </span> | 408 | </span> |
409 | </td> | 409 | </td> |
410 | </tr> | 410 | </tr> |
411 | </template> | 411 | </template> |
412 | <v-alert | 412 | <v-alert |
413 | slot="no-results" | 413 | slot="no-results" |
414 | :value="true" | 414 | :value="true" |
415 | color="error" | 415 | color="error" |
416 | icon="warning" | 416 | icon="warning" |
417 | >Your search for "{{ search }}" found no results.</v-alert> | 417 | >Your search for "{{ search }}" found no results.</v-alert> |
418 | </v-data-table> | 418 | </v-data-table> |
419 | 419 | ||
420 | <!-- ****** ADD Exam Schedule ****** --> | 420 | <!-- ****** ADD Exam Schedule ****** --> |
421 | <v-dialog v-model="addExamScheduleDialog" max-width="600" v-if="addExamScheduleDialog"> | 421 | <v-dialog v-model="addExamScheduleDialog" max-width="600" v-if="addExamScheduleDialog"> |
422 | <v-card flat class="card-style pa-2" dark> | 422 | <v-card flat class="card-style pa-2" dark> |
423 | <v-layout> | 423 | <v-layout> |
424 | <v-flex xs12> | 424 | <v-flex xs12> |
425 | <label class="title text-xs-center">Add Exam Schedule</label> | 425 | <label class="title text-xs-center">Add Exam Schedule</label> |
426 | <v-icon | 426 | <v-icon |
427 | size="24" | 427 | size="24" |
428 | class="right" | 428 | class="right" |
429 | @click="$refs.form.reset();addExamScheduleDialog = false" | 429 | @click="$refs.form.reset();addExamScheduleDialog = false" |
430 | >cancel</v-icon> | 430 | >cancel</v-icon> |
431 | </v-flex> | 431 | </v-flex> |
432 | </v-layout> | 432 | </v-layout> |
433 | <v-form ref="form" v-model="valid" lazy-validation> | 433 | <v-form ref="form" v-model="valid" lazy-validation> |
434 | <v-container fluid> | 434 | <v-container fluid> |
435 | <v-flex xs12> | 435 | <v-flex xs12> |
436 | <v-layout> | 436 | <v-layout> |
437 | <v-flex xs5 class="pt-4 subheading"> | 437 | <v-flex xs5 class="pt-4 subheading"> |
438 | <label class="right">Exam Name:</label> | 438 | <label class="right">Exam Name:</label> |
439 | </v-flex> | 439 | </v-flex> |
440 | <v-flex xs7 sm7 md6 class="ml-3"> | 440 | <v-flex xs7 sm7 md6 class="ml-3"> |
441 | <v-select | 441 | <v-select |
442 | label="Select your Exam Name" | 442 | label="Select your Exam Name" |
443 | :rules="examRules" | 443 | :rules="examRules" |
444 | :items="examList" | 444 | :items="examList" |
445 | v-model="addSchedule.examId" | 445 | v-model="addSchedule.examId" |
446 | item-text="examName" | 446 | item-text="examName" |
447 | item-value="_id" | 447 | item-value="_id" |
448 | ></v-select> | 448 | ></v-select> |
449 | </v-flex> | 449 | </v-flex> |
450 | </v-layout> | 450 | </v-layout> |
451 | </v-flex> | 451 | </v-flex> |
452 | <v-flex xs12> | 452 | <v-flex xs12> |
453 | <v-layout> | 453 | <v-layout> |
454 | <v-flex xs5 class="pt-4 subheading"> | 454 | <v-flex xs5 class="pt-4 subheading"> |
455 | <label class="right">Class:</label> | 455 | <label class="right">Class:</label> |
456 | </v-flex> | 456 | </v-flex> |
457 | <v-flex xs7 sm7 md6 class="ml-3"> | 457 | <v-flex xs7 sm7 md6 class="ml-3"> |
458 | <v-select | 458 | <v-select |
459 | v-model="addSchedule.classId" | 459 | v-model="addSchedule.classId" |
460 | label="Select your class" | 460 | label="Select your class" |
461 | type="text" | 461 | type="text" |
462 | :items="classList" | 462 | :items="classList" |
463 | item-text="classNum" | 463 | item-text="classNum" |
464 | item-value="_id" | 464 | item-value="_id" |
465 | :rules="classRules" | 465 | :rules="classRules" |
466 | @change="getSections(addSchedule.classId)" | 466 | @change="getSections(addSchedule.classId)" |
467 | required | 467 | required |
468 | ></v-select> | 468 | ></v-select> |
469 | </v-flex> | 469 | </v-flex> |
470 | </v-layout> | 470 | </v-layout> |
471 | </v-flex> | 471 | </v-flex> |
472 | <v-flex xs12> | 472 | <v-flex xs12> |
473 | <v-layout> | 473 | <v-layout> |
474 | <v-flex xs5 class="pt-4 subheading"> | 474 | <v-flex xs5 class="pt-4 subheading"> |
475 | <label class="right">Section:</label> | 475 | <label class="right">Section:</label> |
476 | </v-flex> | 476 | </v-flex> |
477 | <v-flex xs7 sm7 md6 class="ml-3"> | 477 | <v-flex xs7 sm7 md6 class="ml-3"> |
478 | <v-select | 478 | <v-select |
479 | :items="addSection" | 479 | :items="addSection" |
480 | label="Select Section" | 480 | label="Select Section" |
481 | v-model="addSchedule.sectionId" | 481 | v-model="addSchedule.sectionId" |
482 | item-text="name" | 482 | item-text="name" |
483 | item-value="_id" | 483 | item-value="_id" |
484 | name="Select Section" | 484 | name="Select Section" |
485 | :rules="sectionRules" | 485 | :rules="sectionRules" |
486 | required | 486 | required |
487 | ></v-select> | 487 | ></v-select> |
488 | </v-flex> | 488 | </v-flex> |
489 | </v-layout> | 489 | </v-layout> |
490 | </v-flex> | 490 | </v-flex> |
491 | <v-flex xs12> | 491 | <v-flex xs12> |
492 | <v-layout> | 492 | <v-layout> |
493 | <v-flex xs5 class="pt-4 subheading"> | 493 | <v-flex xs5 class="pt-4 subheading"> |
494 | <label class="right">Subject Name:</label> | 494 | <label class="right">Subject Name:</label> |
495 | </v-flex> | 495 | </v-flex> |
496 | <v-flex xs7 sm7 md6 class="ml-3"> | 496 | <v-flex xs7 sm7 md6 class="ml-3"> |
497 | <v-select | 497 | <v-select |
498 | :items="subjects" | 498 | :items="subjects" |
499 | label="Select Subject" | 499 | label="Select Subject" |
500 | v-model="addSchedule.subjectName" | 500 | v-model="addSchedule.subjectName" |
501 | item-text="subjectName" | 501 | item-text="subjectName" |
502 | item-value="subjectName" | 502 | item-value="subjectName" |
503 | name="Select Section" | 503 | name="Select Section" |
504 | :rules="subjectRules" | 504 | :rules="subjectRules" |
505 | required | 505 | required |
506 | ></v-select> | 506 | ></v-select> |
507 | </v-flex> | 507 | </v-flex> |
508 | </v-layout> | 508 | </v-layout> |
509 | </v-flex> | 509 | </v-flex> |
510 | <v-flex xs12> | 510 | <v-flex xs12> |
511 | <v-layout> | 511 | <v-layout> |
512 | <v-flex xs5 class="pt-4 subheading"> | 512 | <v-flex xs5 class="pt-4 subheading"> |
513 | <label class="right">Date:</label> | 513 | <label class="right">Date:</label> |
514 | </v-flex> | 514 | </v-flex> |
515 | <v-flex xs7 sm7 md6 class="ml-3"> | 515 | <v-flex xs7 sm7 md6 class="ml-3"> |
516 | <v-menu | 516 | <v-menu |
517 | ref="menu2" | 517 | ref="menu2" |
518 | :close-on-content-click="false" | 518 | :close-on-content-click="false" |
519 | v-model="menu2" | 519 | v-model="menu2" |
520 | :nudge-right="40" | 520 | :nudge-right="40" |
521 | :return-value.sync="addSchedule.date" | 521 | :return-value.sync="addSchedule.date" |
522 | lazy | 522 | lazy |
523 | transition="scale-transition" | 523 | transition="scale-transition" |
524 | offset-y | 524 | offset-y |
525 | full-width | 525 | full-width |
526 | min-width="290px" | 526 | min-width="290px" |
527 | > | 527 | > |
528 | <v-text-field | 528 | <v-text-field |
529 | slot="activator" | 529 | slot="activator" |
530 | v-model="addSchedule.date" | 530 | v-model="addSchedule.date" |
531 | :rules="examScheduleDateRules" | 531 | :rules="examScheduleDateRules" |
532 | label="Select Date" | 532 | label="Select Date" |
533 | append-icon="event" | 533 | append-icon="event" |
534 | readonly | 534 | readonly |
535 | ></v-text-field> | 535 | ></v-text-field> |
536 | <v-date-picker | 536 | <v-date-picker |
537 | v-model="addSchedule.date" | 537 | v-model="addSchedule.date" |
538 | @input="$refs.menu2.save(addSchedule.date)" | 538 | @input="$refs.menu2.save(addSchedule.date)" |
539 | ></v-date-picker> | 539 | ></v-date-picker> |
540 | </v-menu> | 540 | </v-menu> |
541 | </v-flex> | 541 | </v-flex> |
542 | </v-layout> | 542 | </v-layout> |
543 | </v-flex> | 543 | </v-flex> |
544 | <v-flex xs12> | 544 | <v-flex xs12> |
545 | <v-layout> | 545 | <v-layout> |
546 | <v-flex xs5 class="pt-4 subheading"> | 546 | <v-flex xs5 class="pt-4 subheading"> |
547 | <label class="right">Time From:</label> | 547 | <label class="right">Time From:</label> |
548 | </v-flex> | 548 | </v-flex> |
549 | <v-flex xs7 sm7 md6 class="ml-3"> | 549 | <v-flex xs7 sm7 md6 class="ml-3"> |
550 | <v-menu | 550 | <v-menu |
551 | ref="menuA" | 551 | ref="menuA" |
552 | :close-on-content-click="false" | 552 | :close-on-content-click="false" |
553 | v-model="menuB" | 553 | v-model="menuB" |
554 | :nudge-right="40" | 554 | :nudge-right="40" |
555 | :return-value.sync="addSchedule.timeFrom" | 555 | :return-value.sync="addSchedule.timeFrom" |
556 | lazy | 556 | lazy |
557 | transition="scale-transition" | 557 | transition="scale-transition" |
558 | offset-y | 558 | offset-y |
559 | full-width | 559 | full-width |
560 | max-width="290px" | 560 | max-width="290px" |
561 | min-width="290px" | 561 | min-width="290px" |
562 | > | 562 | > |
563 | <v-text-field | 563 | <v-text-field |
564 | slot="activator" | 564 | slot="activator" |
565 | v-model="addSchedule.timeIn" | 565 | v-model="addSchedule.timeIn" |
566 | label="Select your time From" | 566 | label="Select your time From" |
567 | append-icon="access_time" | 567 | append-icon="access_time" |
568 | :rules="timeInRules" | 568 | :rules="timeInRules" |
569 | readonly | 569 | readonly |
570 | ></v-text-field> | 570 | ></v-text-field> |
571 | <v-time-picker | 571 | <v-time-picker |
572 | v-model="addSchedule.timeIn" | 572 | v-model="addSchedule.timeIn" |
573 | @change="$refs.menuA.save(addSchedule.timeIn)" | 573 | @change="$refs.menuA.save(addSchedule.timeIn)" |
574 | ></v-time-picker> | 574 | ></v-time-picker> |
575 | </v-menu> | 575 | </v-menu> |
576 | </v-flex> | 576 | </v-flex> |
577 | </v-layout> | 577 | </v-layout> |
578 | </v-flex> | 578 | </v-flex> |
579 | <v-flex xs12> | 579 | <v-flex xs12> |
580 | <v-layout> | 580 | <v-layout> |
581 | <v-flex xs5 class="pt-4 subheading"> | 581 | <v-flex xs5 class="pt-4 subheading"> |
582 | <label class="right">Time To:</label> | 582 | <label class="right">Time To:</label> |
583 | </v-flex> | 583 | </v-flex> |
584 | <v-flex xs7 sm7 md6 class="ml-3"> | 584 | <v-flex xs7 sm7 md6 class="ml-3"> |
585 | <v-menu | 585 | <v-menu |
586 | ref="menu" | 586 | ref="menu" |
587 | :close-on-content-click="false" | 587 | :close-on-content-click="false" |
588 | v-model="menu1" | 588 | v-model="menu1" |
589 | :nudge-right="40" | 589 | :nudge-right="40" |
590 | :return-value.sync="addSchedule.timeTo" | 590 | :return-value.sync="addSchedule.timeTo" |
591 | lazy | 591 | lazy |
592 | transition="scale-transition" | 592 | transition="scale-transition" |
593 | offset-y | 593 | offset-y |
594 | full-width | 594 | full-width |
595 | max-width="290px" | 595 | max-width="290px" |
596 | min-width="290px" | 596 | min-width="290px" |
597 | > | 597 | > |
598 | <v-text-field | 598 | <v-text-field |
599 | slot="activator" | 599 | slot="activator" |
600 | v-model="addSchedule.timeTo" | 600 | v-model="addSchedule.timeTo" |
601 | label="Select your Time To" | 601 | label="Select your Time To" |
602 | append-icon="access_time" | 602 | append-icon="access_time" |
603 | :rules="timeOutRules" | 603 | :rules="timeOutRules" |
604 | readonly | 604 | readonly |
605 | ></v-text-field> | 605 | ></v-text-field> |
606 | <v-time-picker | 606 | <v-time-picker |
607 | v-model="addSchedule.timeTo" | 607 | v-model="addSchedule.timeTo" |
608 | @change="$refs.menu.save(addSchedule.timeTo)" | 608 | @change="$refs.menu.save(addSchedule.timeTo)" |
609 | ></v-time-picker> | 609 | ></v-time-picker> |
610 | </v-menu> | 610 | </v-menu> |
611 | </v-flex> | 611 | </v-flex> |
612 | </v-layout> | 612 | </v-layout> |
613 | </v-flex> | 613 | </v-flex> |
614 | <v-flex xs12> | 614 | <v-flex xs12> |
615 | <v-layout> | 615 | <v-layout> |
616 | <v-flex xs5 class="pt-4 subheading"> | 616 | <v-flex xs5 class="pt-4 subheading"> |
617 | <label class="right">Room:</label> | 617 | <label class="right">Room:</label> |
618 | </v-flex> | 618 | </v-flex> |
619 | <v-flex xs7 sm7 md6 class="ml-3"> | 619 | <v-flex xs7 sm7 md6 class="ml-3"> |
620 | <v-text-field | 620 | <v-text-field |
621 | placeholder="fill your room" | 621 | placeholder="fill your room" |
622 | :rules="roomRules" | 622 | :rules="roomRules" |
623 | v-model="addSchedule.room" | 623 | v-model="addSchedule.room" |
624 | @keyup.enter="submit" | 624 | @keyup.enter="submit" |
625 | ></v-text-field> | 625 | ></v-text-field> |
626 | </v-flex> | 626 | </v-flex> |
627 | </v-layout> | 627 | </v-layout> |
628 | </v-flex> | 628 | </v-flex> |
629 | <v-layout> | 629 | <v-layout> |
630 | <v-flex xs12> | 630 | <v-flex xs12> |
631 | <v-card-actions> | 631 | <v-card-actions> |
632 | <v-spacer class="hidden-xs-only"></v-spacer> | 632 | <v-spacer class="hidden-xs-only"></v-spacer> |
633 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 633 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
634 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 634 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
635 | </v-card-actions> | 635 | </v-card-actions> |
636 | </v-flex> | 636 | </v-flex> |
637 | </v-layout> | 637 | </v-layout> |
638 | </v-container> | 638 | </v-container> |
639 | </v-form> | 639 | </v-form> |
640 | </v-card> | 640 | </v-card> |
641 | </v-dialog> | 641 | </v-dialog> |
642 | <v-snackbar | 642 | <v-snackbar |
643 | :timeout="timeout" | 643 | :timeout="timeout" |
644 | :top="y === 'top'" | 644 | :top="y === 'top'" |
645 | :right="x === 'right'" | 645 | :right="x === 'right'" |
646 | :vertical="mode === 'vertical'" | 646 | :vertical="mode === 'vertical'" |
647 | v-model="snackbar" | 647 | v-model="snackbar" |
648 | :color="color" | 648 | :color="color" |
649 | >{{ text }}</v-snackbar> | 649 | >{{ text }}</v-snackbar> |
650 | <div class="loader" v-if="showLoader"> | 650 | <div class="loader" v-if="showLoader"> |
651 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 651 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
652 | </div> | 652 | </div> |
653 | </v-container> | 653 | </v-container> |
654 | </template> | 654 | </template> |
655 | 655 | ||
656 | <script> | 656 | <script> |
657 | import http from "@/Services/http.js"; | 657 | import http from "@/Services/http.js"; |
658 | import moment from "moment"; | 658 | import moment from "moment"; |
659 | 659 | ||
660 | export default { | 660 | export default { |
661 | data: () => ({ | 661 | data: () => ({ |
662 | snackbar: false, | 662 | snackbar: false, |
663 | date: null, | 663 | date: null, |
664 | editDate: false, | 664 | editDate: false, |
665 | menu1: false, | 665 | menu1: false, |
666 | menuB: false, | 666 | menuB: false, |
667 | menu2: false, | 667 | menu2: false, |
668 | menuEdit: false, | 668 | menuEdit: false, |
669 | timeToEdit: false, | 669 | timeToEdit: false, |
670 | show: true, | 670 | show: true, |
671 | showSearch: false, | 671 | showSearch: false, |
672 | addExamScheduleDialog: false, | 672 | addExamScheduleDialog: false, |
673 | color: "", | 673 | color: "", |
674 | y: "top", | 674 | y: "top", |
675 | x: "right", | 675 | x: "right", |
676 | mode: "", | 676 | mode: "", |
677 | timeout: 10000, | 677 | timeout: 10000, |
678 | text: "", | 678 | text: "", |
679 | loading: false, | 679 | loading: false, |
680 | date: null, | 680 | date: null, |
681 | search: "", | 681 | search: "", |
682 | showLoader: false, | 682 | showLoader: false, |
683 | editExamScheduleDialog: false, | 683 | editExamScheduleDialog: false, |
684 | profileExamScheduleDialog: false, | 684 | profileExamScheduleDialog: false, |
685 | valid: true, | 685 | valid: true, |
686 | role: "", | 686 | role: "", |
687 | pagination: { | 687 | pagination: { |
688 | rowsPerPage: 10, | 688 | rowsPerPage: 10, |
689 | }, | 689 | }, |
690 | examRules: [(v) => !!v || "Exam Name is required"], | 690 | examRules: [(v) => !!v || "Exam Name is required"], |
691 | classRules: [(v) => !!v || "Class Name is required"], | 691 | classRules: [(v) => !!v || "Class Name is required"], |
692 | sectionRules: [(v) => !!v || "section is required"], | 692 | sectionRules: [(v) => !!v || "section is required"], |
693 | subjectRules: [(v) => !!v || "Subject is required"], | 693 | subjectRules: [(v) => !!v || "Subject is required"], |
694 | timeInRules: [(v) => !!v || "Time In is required"], | 694 | timeInRules: [(v) => !!v || "Time In is required"], |
695 | timeOutRules: [(v) => !!v || "time Out s is required"], | 695 | timeOutRules: [(v) => !!v || "time Out s is required"], |
696 | roomRules: [(v) => !!v || "Room is required"], | 696 | roomRules: [(v) => !!v || "Room is required"], |
697 | examScheduleDateRules: [(v) => !!v || "Date is required"], | 697 | examScheduleDateRules: [(v) => !!v || "Date is required"], |
698 | headers: [ | 698 | headers: [ |
699 | { | 699 | { |
700 | align: "", | 700 | align: "", |
701 | text: "No", | 701 | text: "No", |
702 | sortable: false, | 702 | sortable: false, |
703 | value: "No", | 703 | value: "No", |
704 | }, | 704 | }, |
705 | { | 705 | { |
706 | text: "Exam Name", | 706 | text: "Exam Name", |
707 | vaue: "examId.examName", | 707 | vaue: "examId.examName", |
708 | sortable: false, | 708 | sortable: false, |
709 | align: "center", | 709 | align: "center", |
710 | }, | 710 | }, |
711 | { | 711 | { |
712 | text: "Class", | 712 | text: "Class", |
713 | value: "classId.classNum", | 713 | value: "classId.classNum", |
714 | sortable: false, | 714 | sortable: false, |
715 | align: "center", | 715 | align: "center", |
716 | }, | 716 | }, |
717 | // { | 717 | // { |
718 | // text: "Section", | 718 | // text: "Section", |
719 | // value: "sectionId.name", | 719 | // value: "sectionId.name", |
720 | // sortable: false, | 720 | // sortable: false, |
721 | // align: "center" | 721 | // align: "center" |
722 | // }, | 722 | // }, |
723 | { | 723 | { |
724 | text: "Subject Name", | 724 | text: "Subject Name", |
725 | value: "subjectName", | 725 | value: "subjectName", |
726 | sortable: false, | 726 | sortable: false, |
727 | align: "center", | 727 | align: "center", |
728 | }, | 728 | }, |
729 | { | 729 | { |
730 | text: "Date", | 730 | text: "Date", |
731 | value: "date", | 731 | value: "date", |
732 | sortable: false, | 732 | sortable: false, |
733 | align: "center", | 733 | align: "center", |
734 | }, | 734 | }, |
735 | { | 735 | { |
736 | text: "Time", | 736 | text: "Time", |
737 | value: "timeFrom", | 737 | value: "timeFrom", |
738 | sortable: false, | 738 | sortable: false, |
739 | align: "center", | 739 | align: "center", |
740 | }, | 740 | }, |
741 | { | 741 | { |
742 | text: "Room", | 742 | text: "Room", |
743 | value: "room", | 743 | value: "room", |
744 | sortable: false, | 744 | sortable: false, |
745 | align: "center", | 745 | align: "center", |
746 | }, | 746 | }, |
747 | { text: "Action", value: "", sortable: false, align: "center" }, | 747 | { text: "Action", value: "", sortable: false, align: "center" }, |
748 | ], | 748 | ], |
749 | classList: [], | 749 | classList: [], |
750 | addSection: [], | 750 | addSection: [], |
751 | examList: [], | 751 | examList: [], |
752 | subjects: [], | 752 | subjects: [], |
753 | addSchedule: {}, | 753 | addSchedule: {}, |
754 | editedItem: { | 754 | editedItem: { |
755 | sectionId: { | 755 | sectionId: { |
756 | name: "", | 756 | name: "", |
757 | }, | 757 | }, |
758 | }, | 758 | }, |
759 | getScheduleData: {}, | 759 | getScheduleData: {}, |
760 | ScheduleData: [], | 760 | ScheduleData: [], |
761 | token: "", | 761 | token: "", |
762 | }), | 762 | }), |
763 | watch: { | 763 | watch: { |
764 | addExamScheduleDialog: function (val) { | 764 | addExamScheduleDialog: function (val) { |
765 | if (!val) { | 765 | if (!val) { |
766 | this.addSchedule = []; | 766 | this.addSchedule = []; |
767 | } | 767 | } |
768 | }, | 768 | }, |
769 | }, | 769 | }, |
770 | methods: { | 770 | methods: { |
771 | dates: function (date) { | 771 | dates: function (date) { |
772 | return moment(date).format("MMMM DD, YYYY"); | 772 | return moment(date).format("MMMM DD, YYYY"); |
773 | }, | 773 | }, |
774 | pickFile() { | 774 | pickFile() { |
775 | this.$refs.image.click(); | 775 | this.$refs.image.click(); |
776 | }, | 776 | }, |
777 | getSchedulesList() { | 777 | getSchedulesList() { |
778 | if (this.addSchedule.classId) { | 778 | if (this.addSchedule.classId) { |
779 | this.getScheduleData.classId = this.addSchedule.classId; | 779 | this.getScheduleData.classId = this.addSchedule.classId; |
780 | } | 780 | } |
781 | this.showLoader = true; | 781 | this.showLoader = true; |
782 | http() | 782 | http() |
783 | .get("/getSchedulesList", { | 783 | .get("/getSchedulesList", { |
784 | params: { | 784 | params: { |
785 | classId: this.getScheduleData.classId, | 785 | classId: this.getScheduleData.classId, |
786 | sectionId: this.getScheduleData.sectionId, | 786 | sectionId: this.getScheduleData.sectionId, |
787 | }, | 787 | }, |
788 | headers: { Authorization: "Bearer " + this.token }, | 788 | headers: { Authorization: "Bearer " + this.token }, |
789 | }) | 789 | }) |
790 | .then((response) => { | 790 | .then((response) => { |
791 | this.ScheduleData = response.data.data; | 791 | this.ScheduleData = response.data.data; |
792 | // console.log("this.ScheduleData", this.ScheduleData); | 792 | // console.log("this.ScheduleData", this.ScheduleData); |
793 | this.showLoader = false; | 793 | this.showLoader = false; |
794 | }) | 794 | }) |
795 | .catch((error) => { | 795 | .catch((error) => { |
796 | // console.log("err====>", err); | 796 | // console.log("err====>", err); |
797 | this.showLoader = false; | 797 | this.showLoader = false; |
798 | this.loadingSearch = false; | 798 | this.loadingSearch = false; |
799 | this.snackbar = true; | 799 | this.snackbar = true; |
800 | this.color = "error"; | 800 | this.color = "error"; |
801 | this.text = error.response.data.message; | 801 | this.text = error.response.data.message; |
802 | if (error.response.status === 401) { | 802 | if (error.response.status === 401) { |
803 | this.$router.replace({ path: "/" }); | 803 | this.$router.replace({ path: "/" }); |
804 | this.$store.dispatch("setToken", null); | 804 | this.$store.dispatch("setToken", null); |
805 | this.$store.dispatch("Id", null); | 805 | this.$store.dispatch("Id", null); |
806 | } | 806 | } |
807 | }); | 807 | }); |
808 | }, | 808 | }, |
809 | editItem(item) { | 809 | editItem(item) { |
810 | // console.log("item", item); | 810 | // console.log("item", item); |
811 | this.editedIndex = this.ScheduleData.indexOf(item); | 811 | this.editedIndex = this.ScheduleData.indexOf(item); |
812 | this.editedItem = Object.assign({}, item); | 812 | this.editedItem = Object.assign({}, item); |
813 | this.editedItem.examId = this.editedItem.examId._id; | 813 | this.editedItem.examId = this.editedItem.examId._id; |
814 | this.editedItem.classId = this.editedItem.classId._id; | 814 | this.editedItem.classId = this.editedItem.classId._id; |
815 | this.editedItem.sectionId = | 815 | this.editedItem.sectionId = |
816 | this.editedItem.sectionId === null | 816 | this.editedItem.sectionId === null |
817 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | 817 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") |
818 | : this.editedItem.sectionId._id; | 818 | : this.editedItem.sectionId._id; |
819 | this.editedItem.date = | 819 | this.editedItem.date = |
820 | this.editedItem.date != undefined | 820 | this.editedItem.date != undefined |
821 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 821 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
822 | : (this.editedItem.date = ""); | 822 | : (this.editedItem.date = ""); |
823 | this.editExamScheduleDialog = true; | 823 | this.editExamScheduleDialog = true; |
824 | }, | 824 | }, |
825 | profile(item) { | 825 | profile(item) { |
826 | this.editedIndex = this.ScheduleData.indexOf(item); | 826 | this.editedIndex = this.ScheduleData.indexOf(item); |
827 | this.editedItem = Object.assign({}, item); | 827 | this.editedItem = Object.assign({}, item); |
828 | this.editedItem.examId = this.editedItem.examId.examName; | 828 | this.editedItem.examId = this.editedItem.examId.examName; |
829 | this.editedItem.classId = this.editedItem.classId.classNum; | 829 | this.editedItem.classId = this.editedItem.classId.classNum; |
830 | this.editedItem.sectionId = | 830 | this.editedItem.sectionId = |
831 | this.editedItem.sectionId === null | 831 | this.editedItem.sectionId === null |
832 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | 832 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") |
833 | : this.editedItem.sectionId.name; | 833 | : this.editedItem.sectionId.name; |
834 | this.profileExamScheduleDialog = true; | 834 | this.profileExamScheduleDialog = true; |
835 | }, | 835 | }, |
836 | deleteSchedule(item) { | 836 | deleteSchedule(item) { |
837 | let deleteSchedule = { | 837 | let deleteSchedule = { |
838 | scheduleId: item._id, | 838 | scheduleId: item._id, |
839 | }; | 839 | }; |
840 | http() | 840 | http() |
841 | .delete( | 841 | .delete( |
842 | "/deleteSchedule", | 842 | "/deleteSchedule", |
843 | confirm("Are you sure you want to Delete this?") && { | 843 | confirm("Are you sure you want to Delete this?") && { |
844 | params: deleteSchedule, | 844 | params: deleteSchedule, |
845 | } | 845 | } |
846 | ) | 846 | ) |
847 | .then((response) => { | 847 | .then((response) => { |
848 | this.snackbar = true; | 848 | this.snackbar = true; |
849 | this.text = response.data.message; | 849 | this.text = response.data.message; |
850 | this.color = "green"; | 850 | this.color = "green"; |
851 | this.getSchedulesList(); | 851 | this.getSchedulesList(); |
852 | }) | 852 | }) |
853 | .catch((error) => { | 853 | .catch((error) => { |
854 | this.snackbar = true; | 854 | this.snackbar = true; |
855 | this.color = "error"; | 855 | this.color = "error"; |
856 | this.text = error.response.data.message; | 856 | this.text = error.response.data.message; |
857 | }); | 857 | }); |
858 | }, | 858 | }, |
859 | close() { | 859 | close() { |
860 | this.dialog = false; | 860 | this.dialog = false; |
861 | }, | 861 | }, |
862 | submit() { | 862 | submit() { |
863 | if (this.$refs.form.validate()) { | 863 | if (this.$refs.form.validate()) { |
864 | this.loading = true; | 864 | this.loading = true; |
865 | http() | 865 | http() |
866 | .post("/createSchedule", this.addSchedule) | 866 | .post("/createSchedule", this.addSchedule) |
867 | .then((response) => { | 867 | .then((response) => { |
868 | this.loading = false; | 868 | this.loading = false; |
869 | this.snackbar = true; | 869 | this.snackbar = true; |
870 | this.text = response.data.message; | 870 | this.text = response.data.message; |
871 | this.color = "green"; | 871 | this.color = "green"; |
872 | http() | ||
873 | .get("/getSchedulesList", { | ||
874 | params: { | ||
875 | classId: this.addSchedule.classId, | ||
876 | sectionId: this.addSchedule.sectionId, | ||
877 | }, | ||
878 | headers: { Authorization: "Bearer " + this.token }, | ||
879 | }) | ||
880 | .then((response) => { | ||
881 | this.ScheduleData = response.data.data; | ||
882 | this.showLoader = false; | ||
883 | }) | ||
884 | .catch((error) => { | ||
885 | this.showLoader = false; | ||
886 | this.loadingSearch = false; | ||
887 | this.snackbar = true; | ||
888 | this.color = "error"; | ||
889 | this.text = error.response.data.message; | ||
890 | if (error.response.status === 401) { | ||
891 | this.$router.replace({ path: "/" }); | ||
892 | this.$store.dispatch("setToken", null); | ||
893 | this.$store.dispatch("Id", null); | ||
894 | } | ||
895 | }); | ||
872 | this.addExamScheduleDialog = false; | 896 | this.addExamScheduleDialog = false; |
873 | this.getSchedulesList(); | 897 | // this.clear(); |
874 | this.clear(); | ||
875 | }) | 898 | }) |
876 | .catch((error) => { | 899 | .catch((error) => { |
877 | this.snackbar = true; | 900 | this.snackbar = true; |
878 | this.text = error.response.data.message; | 901 | this.text = error.response.data.message; |
879 | this.color = "red"; | 902 | this.color = "red"; |
880 | this.loading = false; | 903 | this.loading = false; |
881 | }); | 904 | }); |
882 | } | 905 | } |
883 | }, | 906 | }, |
884 | clear() { | 907 | clear() { |
885 | this.$refs.form.reset(); | 908 | this.$refs.form.reset(); |
886 | this.disable = false; | 909 | this.disable = false; |
887 | this.loading = false; | 910 | this.loading = false; |
888 | }, | 911 | }, |
889 | update() { | 912 | update() { |
890 | this.editedItem.scheduleId = this.editedItem._id; | 913 | this.editedItem.scheduleId = this.editedItem._id; |
891 | http() | 914 | http() |
892 | .put("/updateSchedule", this.editedItem) | 915 | .put("/updateSchedule", this.editedItem) |
893 | .then((response) => { | 916 | .then((response) => { |
894 | this.snackbar = true; | 917 | this.snackbar = true; |
895 | this.text = "Successfully Edit Exam Schedule"; | 918 | this.text = "Successfully Edit Exam Schedule"; |
896 | this.color = "green"; | 919 | this.color = "green"; |
897 | this.editExamScheduleDialog = false; | 920 | this.editExamScheduleDialog = false; |
898 | this.getSchedulesList(); | 921 | this.getSchedulesList(); |
899 | this.close(); | 922 | this.close(); |
900 | }) | 923 | }) |
901 | .catch((error) => { | 924 | .catch((error) => { |
902 | this.snackbar = true; | 925 | this.snackbar = true; |
903 | this.text = error.response.data.messages; | 926 | this.text = error.response.data.messages; |
904 | this.color = "error"; | 927 | this.color = "error"; |
905 | this.loading = false; | 928 | this.loading = false; |
906 | }); | 929 | }); |
907 | }, | 930 | }, |
908 | getClass() { | 931 | getClass() { |
909 | http() | 932 | http() |
910 | .get("/getClassesList", { | 933 | .get("/getClassesList", { |
911 | headers: { Authorization: "Bearer " + this.token }, | 934 | headers: { Authorization: "Bearer " + this.token }, |
912 | }) | 935 | }) |
913 | .then((response) => { | 936 | .then((response) => { |
914 | this.classList = response.data.data; | 937 | this.classList = response.data.data; |
915 | }) | 938 | }) |
916 | .catch((err) => { | 939 | .catch((err) => { |
917 | // console.log("err====>", err); | 940 | // console.log("err====>", err); |
918 | }); | 941 | }); |
919 | }, | 942 | }, |
920 | getSections(_id) { | 943 | getSections(_id) { |
921 | for (let i = 0; i < this.classList.length; i++) { | 944 | for (let i = 0; i < this.classList.length; i++) { |
922 | if (_id == this.classList[i]._id) { | 945 | if (_id == this.classList[i]._id) { |
923 | this.subjects = this.classList[i].subjects; | 946 | this.subjects = this.classList[i].subjects; |
924 | } | 947 | } |
925 | } | 948 | } |
926 | http() | 949 | http() |
927 | .get( | 950 | .get( |
928 | "/getSectionsList", | 951 | "/getSectionsList", |
929 | { params: { classId: _id } }, | 952 | { params: { classId: _id } }, |
930 | { | 953 | { |
931 | headers: { Authorization: "Bearer " + this.token }, | 954 | headers: { Authorization: "Bearer " + this.token }, |
932 | } | 955 | } |
933 | ) | 956 | ) |
934 | .then((response) => { | 957 | .then((response) => { |
935 | this.addSection = response.data.data; | 958 | this.addSection = response.data.data; |
936 | }) | 959 | }) |
937 | .catch((err) => {}); | 960 | .catch((err) => {}); |
938 | }, | 961 | }, |
939 | getExamList() { | 962 | getExamList() { |
940 | this.showLoader = true; | 963 | this.showLoader = true; |
941 | this.loadingSearch = true; | 964 | this.loadingSearch = true; |
942 | http() | 965 | http() |
943 | .get("/getExamsList", { | 966 | .get("/getExamsList", { |
944 | headers: { Authorization: "Bearer " + this.token }, | 967 | headers: { Authorization: "Bearer " + this.token }, |
945 | }) | 968 | }) |
946 | .then((response) => { | 969 | .then((response) => { |
947 | this.examList = response.data.data; | 970 | this.examList = response.data.data; |
948 | this.showLoader = false; | 971 | this.showLoader = false; |
949 | this.loadingSearch = false; | 972 | this.loadingSearch = false; |
950 | }) | 973 | }) |
951 | .catch((error) => { | 974 | .catch((error) => { |
952 | this.showLoader = false; | 975 | this.showLoader = false; |
953 | this.loadingSearch = false; | 976 | this.loadingSearch = false; |
954 | this.snackbar = true; | 977 | this.snackbar = true; |
955 | this.text = error.response.data.message; | 978 | this.text = error.response.data.message; |
956 | if (error.response.status === 401) { | 979 | if (error.response.status === 401) { |
957 | this.$router.replace({ path: "/" }); | 980 | this.$router.replace({ path: "/" }); |
958 | this.$store.dispatch("setToken", null); | 981 | this.$store.dispatch("setToken", null); |
959 | this.$store.dispatch("Id", null); | 982 | this.$store.dispatch("Id", null); |
960 | } | 983 | } |
961 | }); | 984 | }); |
962 | }, | 985 | }, |
963 | displaySearch() { | 986 | displaySearch() { |
964 | (this.show = false), (this.showSearch = true); | 987 | (this.show = false), (this.showSearch = true); |
965 | }, | 988 | }, |
966 | closeSearch() { | 989 | closeSearch() { |
967 | this.showSearch = false; | 990 | this.showSearch = false; |
968 | this.show = true; | 991 | this.show = true; |
969 | this.search = ""; | 992 | this.search = ""; |
970 | }, | 993 | }, |
971 | }, | 994 | }, |
972 | mounted() { | 995 | mounted() { |
973 | this.token = this.$store.state.token; | 996 | this.token = this.$store.state.token; |
974 | this.getClass(); | 997 | this.getClass(); |
975 | this.getExamList(); | 998 | this.getExamList(); |
976 | this.role = this.$store.state.role; | 999 | this.role = this.$store.state.role; |
977 | }, | 1000 | }, |
978 | }; | 1001 | }; |