Commit 5ceb88b4443fe6dede631114f0a9402cd8b704ec

Authored by Shikha Mishra
1 parent cbf69abb68

added pdf option while uploading file in assignment and ser roution option in academic

src/pages/Academic/assignment.vue
1 <template> 1 <template>
2 <v-container fluid class="body-color"> 2 <v-container fluid class="body-color">
3 <!-- ****** EDIT Assignment ****** --> 3 <!-- ****** EDIT Assignment ****** -->
4 <v-dialog v-model="editAssignmentDialog" max-width="400px"> 4 <v-dialog v-model="editAssignmentDialog" max-width="400px">
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 Assignment</label> 8 <label class="title text-xs-center">Edit Assignment</label>
9 <v-icon size="24" class="right" @click="editAssignmentDialog = false">cancel</v-icon> 9 <v-icon size="24" class="right" @click="editAssignmentDialog = false">cancel</v-icon>
10 </v-flex> 10 </v-flex>
11 </v-layout> 11 </v-layout>
12 <v-container fluid> 12 <v-container fluid>
13 <v-form ref="formEditAssignment" v-model="validEditAssignment" lazy-validation> 13 <v-form ref="formEditAssignment" v-model="validEditAssignment" lazy-validation>
14 <v-layout> 14 <v-layout>
15 <v-flex
16 xs12
17 class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
18 >
19 <v-avatar size="140px" v-if="!editedItem.file && !imageUrl">
20 <img src="/static/icon/user.png" />
21 </v-avatar>
22 <img
23 :src="editedItem.file"
24 v-else-if="editedItem.file && !imageUrl"
25 style="border-radius:50%; width:150px"
26 />
27 <img
28 v-if="imageUrl"
29 :src="imageUrl"
30 height="150"
31 style="border-radius:50%; width:150px"
32 />
33 <input
34 type="file"
35 style="display:none"
36 ref="image"
37 accept="image/*"
38 @change="onFilePicked"
39 />
40 </v-flex>
41 </v-layout>
42 <v-layout>
15 <v-flex xs4 class="pt-4 subheading"> 43 <v-flex xs4 class="pt-4 subheading">
16 <label class="right">Title:</label> 44 <label class="right">Title:</label>
17 </v-flex> 45 </v-flex>
18 <v-flex xs8 class="ml-3"> 46 <v-flex xs8 class="ml-3">
19 <v-text-field v-model="editedItem.title" type="text" :rules="titleRules" required></v-text-field> 47 <v-text-field v-model="editedItem.title" type="text" :rules="titleRules" required></v-text-field>
20 </v-flex> 48 </v-flex>
21 </v-layout> 49 </v-layout>
22 <v-layout> 50 <v-layout>
23 <v-flex xs4 class="pt-4 subheading"> 51 <v-flex xs4 class="pt-4 subheading">
24 <label class="right">Description:</label> 52 <label class="right">Description:</label>
25 </v-flex> 53 </v-flex>
26 <v-flex xs8 class="ml-3"> 54 <v-flex xs8 class="ml-3">
27 <v-text-field 55 <v-text-field
28 v-model="editedItem.description" 56 v-model="editedItem.description"
29 type="text" 57 type="text"
30 :rules="deadlineRules" 58 :rules="deadlineRules"
31 required 59 required
32 ></v-text-field> 60 ></v-text-field>
33 </v-flex> 61 </v-flex>
34 </v-layout> 62 </v-layout>
35 <v-layout> 63 <v-layout>
36 <v-flex xs4 class="pt-4 subheading"> 64 <v-flex xs4 class="pt-4 subheading">
37 <label class="right">Deadline:</label> 65 <label class="right">Deadline:</label>
38 </v-flex> 66 </v-flex>
39 <v-flex xs8 class="pt-4 subheading"> 67 <v-flex xs8 class="pt-4 subheading">
40 <v-menu 68 <v-menu
41 ref="menu1" 69 ref="menu1"
42 :close-on-content-click="false" 70 :close-on-content-click="false"
43 v-model="menu1" 71 v-model="menu1"
44 :nudge-right="40" 72 :nudge-right="40"
45 :return-value.sync="menu1" 73 :return-value.sync="menu1"
46 lazy 74 lazy
47 transition="scale-transition" 75 transition="scale-transition"
48 offset-y 76 offset-y
49 full-width 77 full-width
50 min-width="290px" 78 min-width="290px"
51 > 79 >
52 <v-text-field 80 <v-text-field
53 slot="activator" 81 slot="activator"
54 v-model="editedItem.deadline" 82 v-model="editedItem.deadline"
55 label="Select Date" 83 label="Select Date"
56 :rules="deadlineRules" 84 :rules="deadlineRules"
57 append-icon="event" 85 append-icon="event"
58 required 86 required
59 ></v-text-field> 87 ></v-text-field>
60 <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker> 88 <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker>
61 </v-menu> 89 </v-menu>
62 </v-flex> 90 </v-flex>
63 </v-layout> 91 </v-layout>
64 <v-layout> 92 <v-layout>
65 <v-flex xs4 class="pt-4 subheading"> 93 <v-flex xs4 class="pt-4 subheading">
66 <label class="right">Class:</label> 94 <label class="right">Class:</label>
67 </v-flex> 95 </v-flex>
68 <v-flex xs8 class="ml-3"> 96 <v-flex xs8 class="ml-3">
69 <v-select 97 <v-select
70 :items="classList" 98 :items="classList"
71 item-text="classNum" 99 item-text="classNum"
72 item-value="_id" 100 item-value="_id"
73 :rules="classRules" 101 :rules="classRules"
74 v-model="editedItem.classId" 102 v-model="editedItem.classId"
75 @change="getSections(addAssignment.classId)" 103 @change="getSections(addAssignment.classId)"
76 required 104 required
77 ></v-select> 105 ></v-select>
78 </v-flex> 106 </v-flex>
79 </v-layout> 107 </v-layout>
80 <v-layout> 108 <v-layout>
81 <v-flex xs4 class="pt-4 subheading"> 109 <v-flex xs4 class="pt-4 subheading">
82 <label class="right">Section:</label> 110 <label class="right">Section:</label>
83 </v-flex> 111 </v-flex>
84 <v-flex xs8 class="ml-3"> 112 <v-flex xs8 class="ml-3">
85 <v-select 113 <v-select
86 :items="addSection" 114 :items="addSection"
87 item-text="name" 115 item-text="name"
88 item-value="_id" 116 item-value="_id"
89 v-model="editedItem.sectionId" 117 v-model="editedItem.sectionId"
90 :rules="sectionRules" 118 :rules="sectionRules"
91 @change="getClassSubject(addAssignment.classId)" 119 @change="getClassSubject(addAssignment.classId)"
92 required 120 required
93 ></v-select> 121 ></v-select>
94 </v-flex> 122 </v-flex>
95 </v-layout> 123 </v-layout>
96 <v-layout> 124 <v-layout>
97 <v-flex xs4 class="pt-4 subheading"> 125 <v-flex xs4 class="pt-4 subheading">
98 <label class="right">Subject</label> 126 <label class="right">Subject</label>
99 </v-flex> 127 </v-flex>
100 <v-flex xs8 class="ml-3"> 128 <v-flex xs8 class="ml-3">
101 <v-select 129 <v-select
102 :items="subjectList.subjects" 130 :items="subjectList.subjects"
103 v-model="editedItem.subjectName" 131 v-model="editedItem.subjectName"
104 item-text="subjectName" 132 item-text="subjectName"
105 item-value="_id" 133 item-value="_id"
106 :rules="subjectRules" 134 :rules="subjectRules"
107 required 135 required
108 ></v-select> 136 ></v-select>
109 </v-flex> 137 </v-flex>
110 </v-layout> 138 </v-layout>
111 <v-layout> 139 <v-layout>
112 <v-flex xs4 class="pt-4 subheading"> 140 <v-flex xs4 class="pt-4 subheading">
113 <label class="right">File:</label> 141 <label class="right">File:</label>
114 </v-flex> 142 </v-flex>
115 <v-flex xs8 class="ml-3"> 143 <v-flex xs8 class="ml-3">
116 <v-text-field 144 <v-text-field
117 label="Select file" 145 label="Select Image"
118 @click="pickFile" 146 @click="pickFile"
119 v-model="editedItem.imageName" 147 v-model="imageName"
120 append-icon="attach_file" 148 append-icon="attach_file"
121 ></v-text-field> 149 ></v-text-field>
122 <input
123 type="file"
124 style="display:none"
125 ref="image"
126 accept="image/*"
127 @change="onFilePicked"
128 />
129 </v-flex> 150 </v-flex>
130 </v-layout> 151 </v-layout>
131 <v-flex xs12 sm12> 152 <v-flex xs12 sm12>
132 <v-card-actions> 153 <v-card-actions>
133 <v-spacer></v-spacer> 154 <v-spacer></v-spacer>
134 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> 155 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
135 </v-card-actions> 156 </v-card-actions>
136 </v-flex> 157 </v-flex>
137 </v-form> 158 </v-form>
138 </v-container> 159 </v-container>
139 </v-card> 160 </v-card>
140 </v-dialog> 161 </v-dialog>
141 162
142 <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> 163 <!-- ****** VIEW PROFIL NOTICE BOARD ****** -->
143 <v-dialog v-model="viewAssignmentDialog" max-width="500px"> 164 <v-dialog v-model="viewAssignmentDialog" max-width="500px">
144 <v-card flat class="card-style pa-3" dark> 165 <v-card flat class="card-style pa-3" dark>
145 <v-layout> 166 <v-layout>
146 <v-flex xs12> 167 <v-flex xs12>
147 <label class="title text-xs-center">View Attendence</label> 168 <label class="title text-xs-center">View Attendence</label>
148 <v-icon size="24" class="right" @click="viewAssignmentDialog = false">cancel</v-icon> 169 <v-icon size="24" class="right" @click="viewAssignmentDialog = false">cancel</v-icon>
149 </v-flex> 170 </v-flex>
150 </v-layout> 171 </v-layout>
151 <v-card-text> 172 <v-card-text>
152 <v-container grid-list-md> 173 <v-container grid-list-md>
153 <v-layout wrap> 174 <v-layout wrap>
154 <v-flex> 175 <v-flex>
155 <v-layout> 176 <v-layout>
156 <v-flex xs6 sm4> 177 <v-flex xs6 sm4>
157 <h5 class="right my-1"> 178 <h5 class="right my-1">
158 <b>Title:</b> 179 <b>Title:</b>
159 </h5> 180 </h5>
160 </v-flex> 181 </v-flex>
161 <v-flex sm8 xs6> 182 <v-flex sm8 xs6>
162 <h5 class="my-1">{{ editedItem.title }}</h5> 183 <h5 class="my-1">{{ editedItem.title }}</h5>
163 </v-flex> 184 </v-flex>
164 </v-layout> 185 </v-layout>
165 <v-layout> 186 <v-layout>
166 <v-flex xs6 sm4> 187 <v-flex xs6 sm4>
167 <h5 class="right my-1"> 188 <h5 class="right my-1">
168 <b>Description:</b> 189 <b>Description:</b>
169 </h5> 190 </h5>
170 </v-flex> 191 </v-flex>
171 <v-flex sm8 xs6> 192 <v-flex sm8 xs6>
172 <h5 class="my-1">{{ editedItem.description }}</h5> 193 <h5 class="my-1">{{ editedItem.description }}</h5>
173 </v-flex> 194 </v-flex>
174 </v-layout> 195 </v-layout>
175 <v-layout> 196 <v-layout>
176 <v-flex xs6 sm4> 197 <v-flex xs6 sm4>
177 <h5 class="right my-1"> 198 <h5 class="right my-1">
178 <b>Deadline:</b> 199 <b>Deadline:</b>
179 </h5> 200 </h5>
180 </v-flex> 201 </v-flex>
181 <v-flex sm8 xs6> 202 <v-flex sm8 xs6>
182 <h5 class="my-1">{{ dates(editedItem.deadline) }}</h5> 203 <h5 class="my-1">{{ dates(editedItem.deadline) }}</h5>
183 </v-flex> 204 </v-flex>
184 </v-layout> 205 </v-layout>
185 </v-flex> 206 </v-flex>
186 </v-layout> 207 </v-layout>
187 </v-container> 208 </v-container>
188 </v-card-text> 209 </v-card-text>
189 </v-card> 210 </v-card>
190 </v-dialog> 211 </v-dialog>
191 212
192 <!-- ****** EXISTING ASSIGNMENT TABLE ****** --> 213 <!-- ****** EXISTING ASSIGNMENT TABLE ****** -->
193 <v-toolbar color="transparent" flat> 214 <v-toolbar color="transparent" flat>
194 <v-btn 215 <v-btn
195 fab 216 fab
196 dark 217 dark
197 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" 218 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
198 small 219 small
199 @click="addAssignmentDialog = true" 220 @click="addAssignmentDialog = true"
200 > 221 >
201 <v-icon dark>add</v-icon> 222 <v-icon dark>add</v-icon>
202 </v-btn> 223 </v-btn>
203 <v-flex xs1 class="hidden-sm-only hidden-xs-only"> 224 <v-flex xs1 class="hidden-sm-only hidden-xs-only">
204 <v-btn round class="open-dialog-button" dark @click="addAssignmentDialog = true"> 225 <v-btn round class="open-dialog-button" dark @click="addAssignmentDialog = true">
205 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Assignment 226 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Assignment
206 </v-btn> 227 </v-btn>
207 </v-flex> 228 </v-flex>
208 <v-spacer></v-spacer> 229 <v-spacer></v-spacer>
209 <v-flex lg2 md2 xs12 v-show="show"> 230 <v-flex lg2 md2 xs12 v-show="show">
210 <v-select 231 <v-select
211 :items="classList" 232 :items="classList"
212 label="Select Your Class" 233 label="Select Your Class"
213 v-model="addAssignment.classId" 234 v-model="addAssignment.classId"
214 item-text="classNum" 235 item-text="classNum"
215 item-value="_id" 236 item-value="_id"
216 name="Select Class" 237 name="Select Class"
217 :rules="classRules" 238 :rules="classRules"
218 @change="getAssignmentList()" 239 @change="getAssignmentList()"
219 class="pl-2" 240 class="pl-2"
220 required 241 required
221 ></v-select> 242 ></v-select>
222 </v-flex> 243 </v-flex>
223 <v-card-title class="body-1" v-show="show"> 244 <v-card-title class="body-1" v-show="show">
224 <v-btn icon flat @click="displaySearch"> 245 <v-btn icon flat @click="displaySearch">
225 <v-avatar size="27"> 246 <v-avatar size="27">
226 <img src="/static/icon/search.png" alt="icon" /> 247 <img src="/static/icon/search.png" alt="icon" />
227 </v-avatar> 248 </v-avatar>
228 </v-btn> 249 </v-btn>
229 </v-card-title> 250 </v-card-title>
230 <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> 251 <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch">
231 <v-layout> 252 <v-layout>
232 <v-text-field 253 <v-text-field
233 v-model="search" 254 v-model="search"
234 label="Search" 255 label="Search"
235 prepend-inner-icon="search" 256 prepend-inner-icon="search"
236 color="primary" 257 color="primary"
237 style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" 258 style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important"
238 ></v-text-field> 259 ></v-text-field>
239 <v-icon @click="closeSearch" color="error">close</v-icon> 260 <v-icon @click="closeSearch" color="error">close</v-icon>
240 </v-layout> 261 </v-layout>
241 </v-flex> 262 </v-flex>
242 </v-toolbar> 263 </v-toolbar>
243 <v-data-table 264 <v-data-table
244 :headers="headers" 265 :headers="headers"
245 :items="assignmentData" 266 :items="assignmentData"
246 :pagination.sync="pagination" 267 :pagination.sync="pagination"
247 :search="search" 268 :search="search"
248 > 269 >
249 <template slot="items" slot-scope="props"> 270 <template slot="items" slot-scope="props">
250 <tr class="tr"> 271 <tr class="tr">
251 <td class="td-row td">{{ props.index + 1 }}</td> 272 <td class="td-row td">{{ props.index + 1 }}</td>
252 <td class="text-xs-center td td-row">{{ props.item.title }}</td> 273 <td class="text-xs-center td td-row">{{ props.item.title }}</td>
253 <td class="text-xs-center td td-row">{{ props.item.description }}</td> 274 <td class="text-xs-center td td-row">{{ props.item.description }}</td>
254 <td class="text-xs-center td td-row">{{ props.item.deadline }}</td> 275 <td class="text-xs-center td td-row">{{ props.item.deadline }}</td>
255 <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td> 276 <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td>
256 <td class="text-xs-center td td-row" v-if="role != 'ADMIN' ">{{ props.item.teacherId.name }}</td> 277 <td
257 <td class="text-xs-center td td-row" v-if="role != 'TEACHER' ">{{ props.item.schoolId .name }}</td> 278 class="text-xs-center td td-row"
279 v-if="role != 'ADMIN' "
280 >{{ props.item.teacherId.name }}</td>
281 <td
282 class="text-xs-center td td-row"
283 v-if="role != 'TEACHER' "
284 >{{ props.item.schoolId .name }}</td>
258 <!-- <td class="text-xs-center td td-row">{{ props.item.file }}</td> --> 285 <!-- <td class="text-xs-center td td-row">{{ props.item.file }}</td> -->
259 <td class="text-xs-center td td-row"> 286 <td class="text-xs-center td td-row">
287 <v-avatar>
288 <img :src="props.item.file" v-if="props.item.file" />
289 <img src="/static/icon/user.png" v-else-if="!props.item.file" />
290 </v-avatar>
291 </td>
292 <td class="text-xs-center td td-row">
260 <span> 293 <span>
261 <v-tooltip top> 294 <v-tooltip top>
262 <img 295 <img
263 slot="activator" 296 slot="activator"
264 style="cursor:pointer; width:25px; height:25px; " 297 style="cursor:pointer; width:25px; height:25px; "
265 class="mr-3" 298 class="mr-3"
266 @click="profile(props.item)" 299 @click="profile(props.item)"
267 src="/static/icon/view.png" 300 src="/static/icon/view.png"
268 /> 301 />
269 <span>View</span> 302 <span>View</span>
270 </v-tooltip> 303 </v-tooltip>
271 <v-tooltip top> 304 <v-tooltip top>
272 <img 305 <img
273 slot="activator" 306 slot="activator"
274 style="cursor:pointer; width:20px; height:18px; " 307 style="cursor:pointer; width:20px; height:18px; "
275 class="mr-3" 308 class="mr-3"
276 @click="editItem(props.item)" 309 @click="editItem(props.item)"
277 src="/static/icon/edit.png" 310 src="/static/icon/edit.png"
278 /> 311 />
279 <span>Edit</span> 312 <span>Edit</span>
280 </v-tooltip> 313 </v-tooltip>
281 <v-tooltip top> 314 <v-tooltip top>
282 <img 315 <img
283 slot="activator" 316 slot="activator"
284 style="cursor:pointer; width:20px; height:20px; " 317 style="cursor:pointer; width:20px; height:20px; "
285 class="mr-3" 318 class="mr-3"
286 @click="deleteItem(props.item)" 319 @click="deleteItem(props.item)"
287 src="/static/icon/delete.png" 320 src="/static/icon/delete.png"
288 /> 321 />
289 <span>Delete</span> 322 <span>Delete</span>
290 </v-tooltip> 323 </v-tooltip>
291 </span> 324 </span>
292 </td> 325 </td>
293 </tr> 326 </tr>
294 </template> 327 </template>
295 <v-alert 328 <v-alert
296 slot="no-results" 329 slot="no-results"
297 :value="true" 330 :value="true"
298 color="error" 331 color="error"
299 icon="warning" 332 icon="warning"
300 >Your search for "{{ search }}" found no results.</v-alert> 333 >Your search for "{{ search }}" found no results.</v-alert>
301 </v-data-table> 334 </v-data-table>
302 <!-- ****** ADD MULTIPLE Subject ****** --> 335 <!-- ****** ADD MULTIPLE Subject ****** -->
303 <v-snackbar 336 <v-snackbar
304 :timeout="timeout" 337 :timeout="timeout"
305 :top="y === 'top'" 338 :top="y === 'top'"
306 :right="x === 'right'" 339 :right="x === 'right'"
307 :vertical="mode === 'vertical'" 340 :vertical="mode === 'vertical'"
308 v-model="snackbar" 341 v-model="snackbar"
309 :color="color" 342 :color="color"
310 >{{ text }}</v-snackbar> 343 >{{ text }}</v-snackbar>
311 <v-dialog v-model="addAssignmentDialog" max-width="400px"> 344 <v-dialog v-model="addAssignmentDialog" max-width="400px">
312 <v-card flat class="card-style pa-2" dark> 345 <v-card flat class="card-style pa-2" dark>
313 <v-layout> 346 <v-layout>
314 <v-flex xs12> 347 <v-flex xs12>
315 <label class="title text-xs-center">Add Assignment</label> 348 <label class="title text-xs-center">Add Assignment</label>
316 <v-icon size="24" class="right" @click="addAssignmentDialog = false">cancel</v-icon> 349 <v-icon size="24" class="right" @click="addAssignmentDialog = false">cancel</v-icon>
317 </v-flex> 350 </v-flex>
318 </v-layout> 351 </v-layout>
319 <v-container fluid fill-height> 352 <v-container fluid fill-height>
320 <v-layout align-center> 353 <v-layout align-center>
321 <v-flex xs12> 354 <v-flex xs12>
322 <v-form ref="form" v-model="valid" lazy-validation> 355 <v-form ref="form" v-model="valid" lazy-validation>
323 <v-layout> 356 <v-layout>
357 <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center">
358 <v-avatar size="80px">
359 <img src="/static/icon/user.png" v-if="!imageUrl" />
360 </v-avatar>
361 <img
362 :src="imageUrl"
363 height="150"
364 v-if="imageUrl"
365 style="border-radius:50%; width:150px"
366 />
367 </v-flex>
368 </v-layout>
369 <v-layout>
324 <v-flex xs4 sm4 class="pt-4 subheading"> 370 <v-flex xs4 sm4 class="pt-4 subheading">
325 <label class="right">Title :</label> 371 <label class="right">Title :</label>
326 </v-flex> 372 </v-flex>
327 <v-flex xs8 sm8 class="ml-3"> 373 <v-flex xs8 sm8 class="ml-3">
328 <v-text-field 374 <v-text-field
329 name="name" 375 name="name"
330 type="text" 376 type="text"
331 :rules="titleRules" 377 :rules="titleRules"
332 v-model="addAssignment.title" 378 v-model="addAssignment.title"
333 required 379 required
334 ></v-text-field> 380 ></v-text-field>
335 </v-flex> 381 </v-flex>
336 </v-layout> 382 </v-layout>
337 <v-layout> 383 <v-layout>
338 <v-flex xs4 sm4 class="pt-4 subheading"> 384 <v-flex xs4 sm4 class="pt-4 subheading">
339 <label class="right">Description :</label> 385 <label class="right">Description :</label>
340 </v-flex> 386 </v-flex>
341 <v-flex xs8 sm8 class="ml-3"> 387 <v-flex xs8 sm8 class="ml-3">
342 <v-text-field 388 <v-text-field
343 name="name" 389 name="name"
344 type="text" 390 type="text"
345 :rules="descriptionRules" 391 :rules="descriptionRules"
346 v-model="addAssignment.description" 392 v-model="addAssignment.description"
347 required 393 required
348 ></v-text-field> 394 ></v-text-field>
349 </v-flex> 395 </v-flex>
350 </v-layout> 396 </v-layout>
351 <v-layout> 397 <v-layout>
352 <v-flex xs4 sm4 class="pt-4 subheading"> 398 <v-flex xs4 sm4 class="pt-4 subheading">
353 <label class="right">Deadline :</label> 399 <label class="right">Deadline :</label>
354 </v-flex> 400 </v-flex>
355 <v-flex xs8 sm7 class="ml-3"> 401 <v-flex xs8 sm7 class="ml-3">
356 <v-menu 402 <v-menu
357 ref="menu2" 403 ref="menu2"
358 :close-on-content-click="false" 404 :close-on-content-click="false"
359 v-model="menu2" 405 v-model="menu2"
360 :nudge-right="40" 406 :nudge-right="40"
361 :return-value.sync="addAssignment.date" 407 :return-value.sync="addAssignment.date"
362 lazy 408 lazy
363 transition="scale-transition" 409 transition="scale-transition"
364 offset-y 410 offset-y
365 full-width 411 full-width
366 min-width="290px" 412 min-width="290px"
367 > 413 >
368 <v-text-field 414 <v-text-field
369 slot="activator" 415 slot="activator"
370 v-model="addAssignment.deadline" 416 v-model="addAssignment.deadline"
371 :rules="deadlineRules" 417 :rules="deadlineRules"
372 label="Select Date" 418 label="Select Date"
373 append-icon="event" 419 append-icon="event"
374 readonly 420 readonly
375 ></v-text-field> 421 ></v-text-field>
376 <v-date-picker 422 <v-date-picker
377 v-model="addAssignment.deadline" 423 v-model="addAssignment.deadline"
378 @input="$refs.menu2.save(addAssignment.date)" 424 @input="$refs.menu2.save(addAssignment.date)"
379 ></v-date-picker> 425 ></v-date-picker>
380 </v-menu> 426 </v-menu>
381 </v-flex> 427 </v-flex>
382 </v-layout> 428 </v-layout>
383 <v-layout> 429 <v-layout>
384 <v-flex xs4 sm4 class="pt-4 subheading"> 430 <v-flex xs4 sm4 class="pt-4 subheading">
385 <label class="right">Class :</label> 431 <label class="right">Class :</label>
386 </v-flex> 432 </v-flex>
387 <v-flex xs8 sm8 class="ml-3"> 433 <v-flex xs8 sm8 class="ml-3">
388 <v-select 434 <v-select
389 :items="classList" 435 :items="classList"
390 label="Select Class" 436 label="Select Class"
391 item-text="classNum" 437 item-text="classNum"
392 item-value="_id" 438 item-value="_id"
393 v-model="addAssignment.classId" 439 v-model="addAssignment.classId"
394 name="Select Class" 440 name="Select Class"
395 :rules="classRules" 441 :rules="classRules"
396 @change="getSections(addAssignment.classId)" 442 @change="getSections(addAssignment.classId)"
397 class="pl-2" 443 class="pl-2"
398 required 444 required
399 ></v-select> 445 ></v-select>
400 </v-flex> 446 </v-flex>
401 </v-layout> 447 </v-layout>
402 <v-layout> 448 <v-layout>
403 <v-flex xs4 sm4 class="pt-4 subheading"> 449 <v-flex xs4 sm4 class="pt-4 subheading">
404 <label class="right">Section :</label> 450 <label class="right">Section :</label>
405 </v-flex> 451 </v-flex>
406 <v-flex xs8 sm8 class="ml-3"> 452 <v-flex xs8 sm8 class="ml-3">
407 <v-select 453 <v-select
408 :items="addSection" 454 :items="addSection"
409 label="Select Section" 455 label="Select Section"
410 item-text="name" 456 item-text="name"
411 item-value="_id" 457 item-value="_id"
412 v-model="addAssignment.sectionId" 458 v-model="addAssignment.sectionId"
413 name="Select Section" 459 name="Select Section"
414 :rules="sectionRules" 460 :rules="sectionRules"
415 @change="getClassSubject(addAssignment.classId)" 461 @change="getClassSubject(addAssignment.classId)"
416 class="px-2" 462 class="px-2"
417 required 463 required
418 ></v-select> 464 ></v-select>
419 </v-flex> 465 </v-flex>
420 </v-layout> 466 </v-layout>
421 <v-layout> 467 <v-layout>
422 <v-flex xs3 sm4 class="pt-4 subheading"> 468 <v-flex xs3 sm4 class="pt-4 subheading">
423 <label class="right">Subject :</label> 469 <label class="right">Subject :</label>
424 </v-flex> 470 </v-flex>
425 <v-flex xs8 sm8 class="ml-2"> 471 <v-flex xs8 sm8 class="ml-2">
426 <v-select 472 <v-select
427 :items="subjectList.subjects" 473 :items="subjectList.subjects"
428 label="Select your subject" 474 label="Select your subject"
429 v-model="addAssignment.subjectName" 475 v-model="addAssignment.subjectName"
430 item-text="subjectName" 476 item-text="subjectName"
431 item-value="_id" 477 item-value="_id"
432 :rules="subjectRules" 478 :rules="subjectRules"
433 required 479 required
434 ></v-select> 480 ></v-select>
435 </v-flex> 481 </v-flex>
436 </v-layout> 482 </v-layout>
437 <v-layout> 483 <v-layout>
438 <v-flex xs4 class="pt-4 subheading"> 484 <v-flex xs4 class="pt-4 subheading">
439 <label class="right">File:</label> 485 <label class="right">File:</label>
440 </v-flex> 486 </v-flex>
441 <v-flex xs8 sm6 class="ml-3"> 487 <v-flex xs8 sm6 class="ml-3">
442 <v-text-field 488 <v-text-field
443 label="Select file" 489 label="Select file"
444 @click="pickFile" 490 @click="pickFile"
445 v-model="addAssignment.file" 491 v-model="imageName"
446 append-icon="attach_file" 492 append-icon="attach_file"
447 ></v-text-field> 493 ></v-text-field>
448 <input 494 <input
449 type="file" 495 type="file"
450 style="display:none" 496 style="display:none"
451 ref="image" 497 ref="image"
452 accept="image/*" 498 accept="image/*"
453 @change="onFilePicked" 499 @change="onFilePicked"
454 /> 500 />
455 </v-flex> 501 </v-flex>
456 </v-layout> 502 </v-layout>
457 <v-layout> 503 <v-layout>
458 <v-flex xs12 sm12> 504 <v-flex xs12 sm12>
459 <v-card-actions> 505 <v-card-actions>
460 <!-- <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> --> 506 <!-- <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> -->
461 <v-spacer></v-spacer> 507 <v-spacer></v-spacer>
462 <v-btn 508 <v-btn
463 @click="submit" 509 @click="submit"
464 round 510 round
465 dark 511 dark
466 :loading="loading" 512 :loading="loading"
467 class="add-button" 513 class="add-button"
468 >Add Assignment</v-btn> 514 >Add Assignment</v-btn>
469 </v-card-actions> 515 </v-card-actions>
470 </v-flex> 516 </v-flex>
471 </v-layout> 517 </v-layout>
472 </v-form> 518 </v-form>
473 </v-flex> 519 </v-flex>
474 </v-layout> 520 </v-layout>
475 </v-container> 521 </v-container>
476 </v-card> 522 </v-card>
477 </v-dialog> 523 </v-dialog>
478 <div class="loader" v-if="showLoader"> 524 <div class="loader" v-if="showLoader">
479 <v-progress-circular indeterminate color="white"></v-progress-circular> 525 <v-progress-circular indeterminate color="white"></v-progress-circular>
480 </div> 526 </div>
481 </v-container> 527 </v-container>
482 </template> 528 </template>
483 529
484 <script> 530 <script>
485 import http from "@/Services/http.js"; 531 import http from "@/Services/http.js";
486 import Util from "@/util"; 532 import Util from "@/util";
487 import moment from "moment"; 533 import moment from "moment";
488 534
489 export default { 535 export default {
490 data: () => ({ 536 data: () => ({
491 snackbar: false, 537 snackbar: false,
492 role: "", 538 role: "",
493 menu1: false, 539 menu1: false,
494 menu2: false, 540 menu2: false,
495 y: "top", 541 y: "top",
496 x: "right", 542 x: "right",
497 mode: "", 543 mode: "",
498 timeout: 3000, 544 timeout: 3000,
499 text: "", 545 text: "",
500 color: "", 546 color: "",
501 show: true, 547 show: true,
502 showSearch: false, 548 showSearch: false,
503 showLoader: false, 549 showLoader: false,
504 loading: false, 550 loading: false,
505 editLoading: false, 551 editLoading: false,
506 date: null, 552 date: null,
507 search: "", 553 search: "",
508 viewAssignmentDialog: false, 554 viewAssignmentDialog: false,
509 editAssignmentDialog: false, 555 editAssignmentDialog: false,
510 valid: true, 556 valid: true,
511 validEditAssignment: true, 557 validEditAssignment: true,
512 addAssignmentDialog: false, 558 addAssignmentDialog: false,
513 // isActive: true, 559 // isActive: true,
514 // newActive: false, 560 // newActive: false,
515 pagination: { 561 pagination: {
516 rowsPerPage: 10 562 rowsPerPage: 10
517 }, 563 },
518 token: "", 564 token: "",
519 headers: [ 565 headers: [
520 { 566 {
521 text: "No", 567 text: "No",
522 align: "", 568 align: "",
523 sortable: false, 569 sortable: false,
524 value: "No" 570 value: "No"
525 }, 571 },
526 { 572 {
527 text: "Title", 573 text: "Title",
528 value: "title", 574 value: "title",
529 sortable: false, 575 sortable: false,
530 align: "center" 576 align: "center"
531 }, 577 },
532 { 578 {
533 text: "Description", 579 text: "Description",
534 value: "description", 580 value: "description",
535 sortable: false, 581 sortable: false,
536 align: "center" 582 align: "center"
537 }, 583 },
538 { 584 {
539 text: "Deadline", 585 text: "Deadline",
540 value: "deadline", 586 value: "deadline",
541 sortable: false, 587 sortable: false,
542 align: "center" 588 align: "center"
543 }, 589 },
544 { 590 {
545 text: "Section", 591 text: "Section",
546 value: "name", 592 value: "name",
547 sortable: false, 593 sortable: false,
548 align: "center" 594 align: "center"
549 }, 595 },
550 { 596 {
551 text: "Uploader", 597 text: "Uploader",
552 value: "name", 598 value: "name",
553 sortable: false, 599 sortable: false,
554 align: "center" 600 align: "center"
555 }, 601 },
556 // { 602 {
557 // text: "File", 603 text: "File",
558 // value: "file", 604 value: "file",
559 // sortable: false, 605 sortable: false,
560 // align: "center" 606 align: "center"
561 // }, 607 },
562 { text: "Action", value: "", sortable: false, align: "center" } 608 { text: "Action", value: "", sortable: false, align: "center" }
563 ], 609 ],
564 assignmentData: [], 610 assignmentData: [],
565 subjectList: [], 611 subjectList: [],
566 classList: [], 612 classList: [],
567 addSection: [], 613 addSection: [],
568 editedIndex: -1, 614 editedIndex: -1,
569 addSubject: {}, 615 addSubject: {},
570 616
571 editedItem: { 617 editedItem: {
572 title: "", 618 title: "",
573 description: "", 619 description: "",
574 deadline: "", 620 deadline: "",
575 classId: "", 621 classId: "",
576 sectionId: "", 622 sectionId: "",
577 subjectName: "", 623 subjectName: "",
578 file: "" 624 file: ""
579 }, 625 },
580 addAssignment: {}, 626 addAssignment: {},
581 627
582 imageData: {}, 628 imageData: {},
583 imageName: "", 629 imageName: "",
584 imageUrl: "", 630 imageUrl: "",
585 imageFile: "", 631 imageFile: "",
586 632
587 titleRules: [v => !!v || " Title is required"], 633 titleRules: [v => !!v || " Title is required"],
588 descriptionRules: [v => !!v || " Description is required"], 634 descriptionRules: [v => !!v || " Description is required"],
589 deadlineRules: [v => !!v || " Deadline is required"], 635 deadlineRules: [v => !!v || " Deadline is required"],
590 classRules: [v => !!v || "Class is required"], 636 classRules: [v => !!v || "Class is required"],
591 sectionRules: [v => !!v || "Section is required"], 637 sectionRules: [v => !!v || "Section is required"],
592 subjectRules: [v => !!v || "Student is required"], 638 subjectRules: [v => !!v || "Student is required"],
593 fileRules: [v => !!v || "File is required"] 639 fileRules: [v => !!v || "File is required"]
594 }), 640 }),
595 methods: { 641 methods: {
596 dates: function(date) { 642 dates: function(date) {
597 return moment(date).format("MMMM DD, YYYY"); 643 return moment(date).format("MMMM DD, YYYY");
598 }, 644 },
599 pickFile() { 645 pickFile() {
600 this.$refs.image.click(); 646 this.$refs.image.click();
601 }, 647 },
602 editItem(item) { 648 editItem(item) {
603 this.editedIndex = this.assignmentData; 649 this.editedIndex = this.assignmentData;
604 this.editedItem = Object.assign({}, item); 650 this.editedItem = Object.assign({}, item);
605 this.dialog = true; 651 this.dialog = true;
606 this.editAssignmentDialog = true; 652 this.editAssignmentDialog = true;
607 }, 653 },
608 profile(item) { 654 profile(item) {
609 this.editedIndex = this.assignmentData; 655 this.editedIndex = this.assignmentData;
610 this.editedItem = Object.assign({}, item); 656 this.editedItem = Object.assign({}, item);
611 this.dialog1 = true; 657 this.dialog1 = true;
612 this.viewAssignmentDialog = true; 658 this.viewAssignmentDialog = true;
613 }, 659 },
614 deleteItem(item) { 660 deleteItem(item) {
615 let deleteAssignment = { 661 let deleteAssignment = {
616 assignmentId: item._id 662 assignmentId: item._id
617 }; 663 };
618 http() 664 http()
619 .delete( 665 .delete(
620 "/deleteAssignment", 666 "/deleteAssignment",
621 confirm("Are you sure you want to delete this?") && { 667 confirm("Are you sure you want to delete this?") && {
622 params: deleteAssignment 668 params: deleteAssignment
623 }, 669 },
624 { 670 {
625 headers: { Authorization: "Bearer " + this.token } 671 headers: { Authorization: "Bearer " + this.token }
626 } 672 }
627 ) 673 )
628 .then(response => { 674 .then(response => {
629 this.getAssignmentList(); 675 this.getAssignmentList();
630 this.snackbar = true; 676 this.snackbar = true;
631 this.text = "Successfully delete Existing Assignment"; 677 this.text = "Successfully delete Existing Assignment";
632 this.color = "green"; 678 this.color = "green";
633 }) 679 })
634 .catch(error => { 680 .catch(error => {
635 this.snackbar = true; 681 this.snackbar = true;
636 this.text = error.response.data.message; 682 this.text = error.response.data.message;
637 this.color = "error"; 683 this.color = "error";
638 }); 684 });
639 }, 685 },
640 close() { 686 close() {
641 this.editAssignmentDialog = false; 687 this.editAssignmentDialog = false;
642 }, 688 },
643 close1() { 689 close1() {
644 this.viewAssignmentDialog = false; 690 this.viewAssignmentDialog = false;
645 }, 691 },
646 submit() { 692 submit() {
647 var addAssignment = { 693 var addAssignment = {
648 title: this.addAssignment.title, 694 title: this.addAssignment.title,
649 description: this.addAssignment.description, 695 description: this.addAssignment.description,
650 deadline: this.addAssignment.deadline, 696 deadline: this.addAssignment.deadline,
651 classId: this.addAssignment.classId, 697 classId: this.addAssignment.classId,
652 sectionId: this.addAssignment.sectionId, 698 sectionId: this.addAssignment.sectionId,
653 subjectName: this.addAssignment.subjectName, 699 subjectName: this.addAssignment.subjectName,
654 file: this.addAssignment.imageName 700 file: this.addAssignment.imageName
655 }; 701 };
656 if (this.$refs.form.validate()) { 702 if (this.$refs.form.validate()) {
657 http() 703 http()
658 .post("/createAssignment", addAssignment) 704 .post("/createAssignment", addAssignment)
659 .then(response => { 705 .then(response => {
660 this.getAssignmentList(); 706 this.getAssignmentList();
661 this.snackbar = true; 707 this.snackbar = true;
662 this.text = "Syllabus added successfully"; 708 this.text = "Syllabus added successfully";
663 this.clear(); 709 this.clear();
664 this.color = "green"; 710 this.color = "green";
665 this.addAssignmentDialog = false; 711 this.addAssignmentDialog = false;
666 }) 712 })
667 .catch(error => { 713 .catch(error => {
668 // console.log(error); 714 // console.log(error);
669 this.snackbar = true; 715 this.snackbar = true;
670 this.text = error.response.data.message; 716 this.text = error.response.data.message;
671 this.color = "red"; 717 this.color = "red";
672 }); 718 });
673 } 719 }
674 }, 720 },
675 getAssignmentList() { 721 getAssignmentList() {
676 this.showLoader = true; 722 this.showLoader = true;
677 http() 723 http()
678 .get( 724 .get(
679 "/getAssignmentList", 725 "/getAssignmentList",
680 { 726 {
681 params: { classId: this.addAssignment.classId } 727 params: { classId: this.addAssignment.classId }
682 }, 728 },
683 { 729 {
684 headers: { Authorization: "Bearer " + this.token } 730 headers: { Authorization: "Bearer " + this.token }
685 } 731 }
686 ) 732 )
687 .then(response => { 733 .then(response => {
688 this.assignmentData = response.data.data; 734 this.assignmentData = response.data.data;
689 this.showLoader = false; 735 this.showLoader = false;
690 this.loadingSearch = false; 736 this.loadingSearch = false;
691 }) 737 })
692 .catch(error => { 738 .catch(error => {
693 // console.log("err====>", err);u 739 // console.log("err====>", err);u
694 this.showLoader = false; 740 this.showLoader = false;
695 this.loadingSearch = false; 741 this.loadingSearch = false;
696 this.snackbar = true; 742 this.snackbar = true;
697 this.text = error.response.data.message; 743 this.text = error.response.data.message;
698 if (error.response.status === 401) { 744 if (error.response.status === 401) {
699 this.$router.replace({ path: "/" }); 745 this.$router.replace({ path: "/" });
700 this.$store.dispatch("setToken", null); 746 this.$store.dispatch("setToken", null);
701 this.$store.dispatch("Id", null); 747 this.$store.dispatch("Id", null);
702 } 748 }
703 }); 749 });
704 }, 750 },
705 clear() { 751 clear() {
706 this.$refs.form.reset(); 752 this.$refs.form.reset();
707 }, 753 },
708 save() { 754 save() {
709 if (this.$refs.formEditAssignment.validate()) { 755 if (this.$refs.formEditAssignment.validate()) {
710 let editAssignment = { 756 let editAssignment = {
711 assignmentId: this.editedItem._id, 757 assignmentId: this.editedItem._id,
712 title: this.addAssignment.title, 758 title: this.addAssignment.title,
713 description: this.addAssignment.description, 759 description: this.addAssignment.description,
714 deadline: this.addAssignment.deadline, 760 deadline: this.addAssignment.deadline,
715 classId: this.addAssignment.classId, 761 classId: this.addAssignment.classId,
716 sectionId: this.addAssignment.sectionId, 762 sectionId: this.addAssignment.sectionId,
717 subjectName: this.addAssignment.subjectName, 763 subjectName: this.addAssignment.subjectName,
718 file: this.addAssignment.imageName 764 file: this.addAssignment.imageName
719 }; 765 };
720 this.editLoading = true; 766 this.editLoading = true;
721 http() 767 http()
722 .put("/updateAssignment", editAssignment) 768 .put("/updateAssignment", editAssignment)
723 .then(response => { 769 .then(response => {
724 this.snackbar = true; 770 this.snackbar = true;
725 this.text = "Successfully Edit Existing Assignment"; 771 this.text = "Successfully Edit Existing Assignment";
726 this.color = "green"; 772 this.color = "green";
727 this.editLoading = false; 773 this.editLoading = false;
728 this.editAssignmentDialog = false; 774 this.editAssignmentDialog = false;
729 http() 775 http()
730 .get( 776 .get(
731 "/getParticularClass", 777 "/getParticularClass",
732 { params: { classId: _id } }, 778 { params: { classId: _id } },
733 { 779 {
734 headers: { Authorization: "Bearer " + this.token } 780 headers: { Authorization: "Bearer " + this.token }
735 } 781 }
736 ) 782 )
737 .then(response => { 783 .then(response => {
738 this.assignmentData = response.data.data; 784 this.assignmentData = response.data.data;
739 this.showLoader = false; 785 this.showLoader = false;
740 this.snackbar = true; 786 this.snackbar = true;
741 this.color = "green"; 787 this.color = "green";
742 this.close(); 788 this.close();
743 }) 789 })
744 .catch(err => { 790 .catch(err => {
745 this.showLoader = false; 791 this.showLoader = false;
746 }); 792 });
747 }) 793 })
748 .catch(error => { 794 .catch(error => {
749 this.editLoading = false; 795 this.editLoading = false;
750 // console.log(error); 796 // console.log(error);
751 }); 797 });
752 } 798 }
753 }, 799 },
754 getClass() { 800 getClass() {
755 http() 801 http()
756 .get("/getClassesList", { 802 .get("/getClassesList", {
757 headers: { Authorization: "Bearer " + this.token } 803 headers: { Authorization: "Bearer " + this.token }
758 }) 804 })
759 .then(response => { 805 .then(response => {
760 this.classList = response.data.data; 806 this.classList = response.data.data;
761 }) 807 })
762 .catch(error => { 808 .catch(error => {
763 if (error.response.status === 401) { 809 if (error.response.status === 401) {
764 this.$router.replace({ path: "/" }); 810 this.$router.replace({ path: "/" });
765 this.$store.dispatch("setToken", null); 811 this.$store.dispatch("setToken", null);
766 this.$store.dispatch("Id", null); 812 this.$store.dispatch("Id", null);
767 } 813 }
768 }); 814 });
769 }, 815 },
770 getSections(_id) { 816 getSections(_id) {
771 var token = this.$store.state.token; 817 var token = this.$store.state.token;
772 this.showLoader = true; 818 this.showLoader = true;
773 http() 819 http()
774 .get( 820 .get(
775 "/getSectionsList", 821 "/getSectionsList",
776 { params: { classId: _id } }, 822 { params: { classId: _id } },
777 { 823 {
778 headers: { Authorization: "Bearer " + token } 824 headers: { Authorization: "Bearer " + token }
779 } 825 }
780 ) 826 )
781 .then(response => { 827 .then(response => {
782 this.addSection = response.data.data; 828 this.addSection = response.data.data;
783 this.showLoader = false; 829 this.showLoader = false;
784 }) 830 })
785 .catch(err => { 831 .catch(err => {
786 this.showLoader = false; 832 this.showLoader = false;
787 }); 833 });
788 }, 834 },
789 getClassSubject(_id) { 835 getClassSubject(_id) {
790 this.showLoader = true; 836 this.showLoader = true;
791 // this.classId = this.classId; 837 // this.classId = this.classId;
792 http() 838 http()
793 .get( 839 .get(
794 "/getParticularClass", 840 "/getParticularClass",
795 { params: { classId: _id } }, 841 { params: { classId: _id } },
796 { 842 {
797 headers: { Authorization: "Bearer " + this.token } 843 headers: { Authorization: "Bearer " + this.token }
798 } 844 }
799 ) 845 )
800 .then(response => { 846 .then(response => {
801 this.subjectList = response.data.data; 847 this.subjectList = response.data.data;
802 this.showLoader = false; 848 this.showLoader = false;
803 }) 849 })
804 .catch(err => { 850 .catch(err => {
805 this.showLoader = false; 851 this.showLoader = false;
806 }); 852 });
807 }, 853 },
808 onFilePicked(e) { 854 onFilePicked(e) {
809 // console.log(e) 855 // console.log(e)
810 const files = e.target.files; 856 const files = e.target.files;
811 this.upload = e.target.files[0]; 857 this.upload = e.target.files[0];
812 // console.log("imageData-upload========>", this.upload); 858 console.log("imageData-upload========>", this.upload);
813 if (files[0] !== undefined) { 859 if (files[0] !== undefined) {
814 this.imageName = files[0].name; 860 this.imageName = files[0].name;
815 if (this.imageName.lastIndexOf(".") <= 0) { 861 if (this.imageName.lastIndexOf(".") <= 0) {
816 return; 862 return;
817 } 863 }
818 const fr = new FileReader(); 864 const fr = new FileReader();
819 fr.readAsDataURL(files[0]); 865 fr.readAsDataURL(files[0]);
820 fr.addEventListener("load", () => { 866 fr.addEventListener("load", () => {
821 this.imageUrl = fr.result; 867 this.imageUrl = fr.result;
822 this.imageFile = files[0]; // this is an image file that can be sent to server... 868 this.imageFile = files[0]; // this is an image file that can be sent to server...
823 this.imageData.imageUrl = URL.createObjectURL(this.imageFile); 869 // this.imageData.imageUrl = URL.createObjectURL(this.imageFile);
824 // console.log("upload=======>", this.imageData.imageUrl); 870 // console.log("upload=======>", this.imageData.imageUrl);
825 // console.log("imageFile", this.imageUrl); 871 console.log("imageFile", this.imageUrl);
826 }); 872 });
827 } else { 873 } else {
828 this.imageName = ""; 874 this.imageName = "";
829 this.imageFile = ""; 875 this.imageFile = "";
830 this.imageUrl = ""; 876 this.imageUrl = "";
831 } 877 }
832 }, 878 },
833 displaySearch() { 879 displaySearch() {
834 (this.show = false), (this.showSearch = true); 880 (this.show = false), (this.showSearch = true);
835 }, 881 },
836 closeSearch() { 882 closeSearch() {
837 this.showSearch = false; 883 this.showSearch = false;
838 this.show = true; 884 this.show = true;
839 this.search = ""; 885 this.search = "";
840 } 886 }
841 }, 887 },
842 mounted() { 888 mounted() {
843 this.token = this.$store.state.token; 889 this.token = this.$store.state.token;
src/pages/Academic/routine.vue
1 <template> 1 <template>
2 <v-container fluid class="body-color"> 2 <v-container fluid class="body-color">
3 <!-- ****** EDIT Subject ****** --> 3 <!-- ****** EDIT Subject ****** -->
4 <v-dialog v-model="editRoutineDialog" max-width="600px"> 4 <v-dialog v-model="editRoutineDialog" max-width="600px">
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 Subject</label> 8 <label class="title text-xs-center">Edit Routine</label>
9 <v-icon size="24" class="right" @click="editRoutineDialog = false">cancel</v-icon> 9 <v-icon size="24" class="right" @click="editRoutineDialog = false">cancel</v-icon>
10 </v-flex> 10 </v-flex>
11 </v-layout> 11 </v-layout>
12 <v-container fluid> 12 <v-container fluid>
13 <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation> 13 <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation>
14 <v-layout> 14 <v-layout>
15 <v-flex xs4 class="pt-4 subheading"> 15 <v-flex xs4 sm4 class="pt-4 subheading">
16 <label class="right">Class:</label> 16 <label class="right">School Year :</label>
17 </v-flex>
18 <v-flex xs8 sm8 class="ml-3">
19 <v-text-field v-model="editedItem.schoolYear" label="Select Year"></v-text-field>
20 </v-flex>
21 </v-layout>
22 <v-layout>
23 <v-flex xs4 sm4 class="pt-4 subheading">
24 <label class="right">Class :</label>
17 </v-flex> 25 </v-flex>
18 <v-flex xs8 class="ml-3"> 26 <v-flex xs8 sm8 class="ml-3">
19 <v-select 27 <v-select
20 v-model="editedItem.classId"
21 label="Select your class"
22 type="text"
23 :items="classList" 28 :items="classList"
29 label="Select Class"
24 item-text="classNum" 30 item-text="classNum"
25 item-value="_id" 31 item-value="_id"
32 v-model="editedItem.classId"
33 name="Select Class"
26 :rules="classRules" 34 :rules="classRules"
35 @change="getSections(addRoutine.classId)"
36 class="pl-2"
37 required
38 ></v-select>
39 </v-flex>
40 </v-layout>
41 <v-layout>
42 <v-flex xs4 sm4 class="pt-4 subheading">
43 <label class="right">Section :</label>
44 </v-flex>
45 <v-flex xs8 sm8 class="ml-3">
46 <v-select
47 :items="addSection"
48 label="Select Section"
49 item-text="name"
50 item-value="_id"
51 v-model="editedItem.sectionId"
52 name="Select Section"
53 :rules="sectionRules"
54 @change="getClassSubject(addRoutine.classId)"
55 class="px-2"
56 required
57 ></v-select>
58 </v-flex>
59 </v-layout>
60 <v-layout>
61 <v-flex xs3 sm4 class="pt-4 subheading">
62 <label class="right">Subject :</label>
63 </v-flex>
64 <v-flex xs8 sm8 class="ml-2">
65 <v-select
66 :items="subjectList.subjects"
67 label="Select your subject"
68 v-model="editedItem.subjectName"
69 item-text="subjectName"
70 item-value="_id"
71 :rules="subjectRules"
72 required
73 ></v-select>
74 </v-flex>
75 </v-layout>
76 <v-layout>
77 <v-flex xs3 sm4 class="pt-4 subheading">
78 <label class="right">Day :</label>
79 </v-flex>
80 <v-flex xs8 sm8 class="ml-2">
81 <v-select
82 :items="day"
83 label="Select your day"
84 v-model="editedItem.day"
85 item-text="text"
86 :rules="dayRules"
27 required 87 required
28 ></v-select> 88 ></v-select>
29 </v-flex> 89 </v-flex>
30 </v-layout> 90 </v-layout>
31 <v-layout> 91 <v-layout>
32 <v-flex xs4 sm4 class="pt-4 subheading"> 92 <v-flex xs4 sm4 class="pt-4 subheading">
33 <label class="right">Teacher Name :</label> 93 <label class="right">Teacher Name :</label>
34 </v-flex> 94 </v-flex>
35 <v-flex xs8 sm8 class="ml-3"> 95 <v-flex xs8 sm8 class="ml-3">
36 <v-select 96 <v-select
37 v-model="editedItem.teacherId" 97 v-model="editedItem.teacherId"
38 label="Select your teacher" 98 label="Select your teacher"
39 type="text" 99 type="text"
40 :items="teacherList" 100 :items="teacherList"
41 item-text="name" 101 item-text="name"
42 item-value="_id" 102 item-value="_id"
43 :rules="teacherRules" 103 :rules="teacherRules"
44 required 104 required
45 ></v-select> 105 ></v-select>
46 </v-flex> 106 </v-flex>
47 </v-layout> 107 </v-layout>
48 <v-layout> 108 <v-layout>
49 <v-flex xs4 sm4 class="pt-4 subheading"> 109 <v-flex xs4 sm4 class="pt-4 subheading">
50 <label class="right">Pass Mark :</label> 110 <label class="right">Starting time:</label>
51 </v-flex> 111 </v-flex>
52 <v-flex xs8 sm8 class="ml-3"> 112 <v-flex xs8 sm8 class="ml-3">
53 <v-text-field 113 <v-menu
54 label="Fill your Pass Mark" 114 ref="menuA"
55 name="name" 115 :close-on-content-click="false"
56 type="text" 116 v-model="menuB"
57 :rules="markRules" 117 :nudge-right="40"
58 v-model="editedItem.passMarks" 118 :return-value.sync="addRoutine.startingTime"
59 required 119 lazy
60 ></v-text-field> 120 transition="scale-transition"
121 offset-y
122 full-width
123 max-width="290px"
124 min-width="290px"
125 >
126 <v-text-field
127 slot="activator"
128 v-model="editedItem.startingTime"
129 label="Select your starting time"
130 append-icon="access_time"
131 :rules="timeInRules"
132 readonly
133 ></v-text-field>
134 <v-time-picker
135 v-model="editedItem.startingTime"
136 @change="$refs.menuA.save(addRoutine.startingTime)"
137 ></v-time-picker>
138 </v-menu>
61 </v-flex> 139 </v-flex>
62 </v-layout> 140 </v-layout>
63 <v-layout> 141 <v-layout>
64 <v-flex xs4 sm4 class="pt-4 subheading"> 142 <v-flex xs4 sm4 class="pt-4 subheading">
65 <label class="right">Final Mark :</label> 143 <label class="right">Ending Time:</label>
66 </v-flex> 144 </v-flex>
67 <v-flex xs8 sm8 class="ml-3"> 145 <v-flex xs8 sm8 class="ml-3">
68 <v-text-field 146 <v-menu
69 label="Fill your final mark" 147 ref="menu"
70 name="name" 148 :close-on-content-click="false"
71 type="text" 149 v-model="menu1"
72 :rules="finalRules" 150 :nudge-right="40"
73 v-model="editedItem.finalMarks" 151 :return-value.sync="addRoutine.endingTime"
74 required 152 lazy
75 ></v-text-field> 153 transition="scale-transition"
154 offset-y
155 full-width
156 max-width="290px"
157 min-width="290px"
158 >
159 <v-text-field
160 slot="activator"
161 v-model="editedItem.endingTime"
162 label="Select your end time"
163 append-icon="access_time"
164 :rules="timeOutRules"
165 readonly
166 ></v-text-field>
167 <v-time-picker
168 v-model="editedItem.endingTime"
169 @change="$refs.menu.save(addRoutine.endingTime)"
170 ></v-time-picker>
171 </v-menu>
76 </v-flex> 172 </v-flex>
77 </v-layout> 173 </v-layout>
78 <v-layout> 174 <v-layout>
79 <v-flex xs4 class="pt-4 subheading"> 175 <v-flex xs4 sm4 class="pt-4 subheading">
80 <label class="right">Subject:</label> 176 <label class="right">Room:</label>
81 </v-flex> 177 </v-flex>
82 <v-flex xs8 class="ml-3"> 178 <v-flex xs8 sm8 class="ml-3">
83 <v-text-field 179 <v-text-field
84 placeholder="fill your Subject" 180 label="fill your room"
85 v-model="editedItem.subjectName" 181 :rules="roomRules"
86 :rules="subjectRules" 182 v-model="editedItem.room"
87 type="text" 183 @keyup.enter="submit"
88 name="email"
89 required
90 ></v-text-field> 184 ></v-text-field>
91 </v-flex> 185 </v-flex>
92 </v-layout> 186 </v-layout>
93 <v-layout> 187 <v-layout>
94 <v-flex xs4 sm4 class="pt-4 subheading"> 188 <v-flex xs4 sm4 class="pt-4 subheading">
95 <label class="right">Subject Author :</label> 189 <label class="right">Period:</label>
96 </v-flex> 190 </v-flex>
97 <v-flex xs8 sm8 class="ml-3"> 191 <v-flex xs8 sm8 class="ml-3">
98 <v-text-field 192 <v-text-field
99 v-model="editedItem.subjectAuthor" 193 label="fill your period"
100 placeholder="fill your Subject Author" 194 :rules="periodRules"
101 name="name" 195 v-model="editedItem.period"
102 type="text" 196 @keyup.enter="submit"
103 ></v-text-field> 197 ></v-text-field>
104 </v-flex> 198 </v-flex>
105 </v-layout> 199 </v-layout>
106 <v-layout> 200 <v-layout>
107 <v-flex xs4 sm4 class="pt-4 subheading"> 201 <v-flex xs12 sm12>
108 <label class="right">Subject Code:</label> 202 <v-card-actions>
109 </v-flex> 203 <v-spacer></v-spacer>
110 <v-flex xs8 sm8 class="ml-3"> 204 <v-btn
111 <v-text-field 205 @click="update"
112 v-model="editedItem.subjectCode" 206 round
113 placeholder="fill your Subject Code" 207 dark
114 name="name" 208 :loading="loading"
115 type="text" 209 class="add-button"
116 ></v-text-field> 210 >Update Routine</v-btn>
211 </v-card-actions>
117 </v-flex> 212 </v-flex>
118 </v-layout> 213 </v-layout>
119 <v-flex xs12 sm12>
120 <v-card-actions>
121 <v-spacer></v-spacer>
122 <v-btn
123 round
124 dark
125 @click="save"
126 :loading="editLoading"
127 class="add-button"
128 >Update Subject</v-btn>
129 </v-card-actions>
130 </v-flex>
131 </v-form> 214 </v-form>
132 </v-container> 215 </v-container>
133 </v-card> 216 </v-card>
134 </v-dialog> 217 </v-dialog>
135 218
136 <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> 219 <!-- ****** EXISTING ROUTINE TABLE ****** -->
137
138 <!-- <v-dialog v-model="viewSubjectDialog" max-width="500px">
139 <v-card flat class="card-style pa-3" dark>
140 <v-layout>
141 <v-flex xs12>
142 <label class="title text-xs-center">View Subject</label>
143 <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon>
144 </v-flex>
145 </v-layout>
146 <v-card-text>
147 <v-container grid-list-md>
148 <v-layout wrap>
149 <v-flex>
150 <v-layout>
151 <v-flex xs6 sm4>
152 <h5 class="right my-1">
153 <b>Subject Name:</b>
154 </h5>
155 </v-flex>
156 <v-flex sm8 xs6>
157 <h5 class="my-1">{{ editedItem.subjectName }}</h5>
158 </v-flex>
159 </v-layout>
160 <v-layout>
161 <v-flex xs6 sm4>
162 <h5 class="right my-1">
163 <b>Subject Author:</b>
164 </h5>
165 </v-flex>
166 <v-flex sm8 xs6>
167 <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5>
168 </v-flex>
169 </v-layout>
170 <v-layout>
171 <v-flex xs6 sm4>
172 <h5 class="right my-1">
173 <b>Subject :</b>
174 </h5>
175 </v-flex>
176 <v-flex sm8 xs6>
177 <h5 class="my-1">{{ editedItem.subjectCode }}</h5>
178 </v-flex>
179 </v-layout>
180 <v-layout>
181 <v-flex xs6 sm4>
182 <h5 class="right my-1">
183 <b>Pass Marks :</b>
184 </h5>
185 </v-flex>
186 <v-flex sm8 xs6>
187 <h5 class="my-1">{{ editedItem.passMarks }}</h5>
188 </v-flex>
189 </v-layout>
190 <v-layout>
191 <v-flex xs6 sm4>
192 <h5 class="right my-1">
193 <b>Final Marks :</b>
194 </h5>
195 </v-flex>
196 <v-flex sm8 xs6>
197 <h5 class="my-1">{{ editedItem.finalMarks }}</h5>
198 </v-flex>
199 </v-layout>
200 <v-layout>
201 <v-flex xs6 sm4>
202 <h5 class="right my-1">
203 <b>Type :</b>
204 </h5>
205 </v-flex>
206 <v-flex sm8 xs6>
207 <h5 class="my-1">{{ editedItem.type }}</h5>
208 </v-flex>
209 </v-layout>
210 </v-flex>
211 </v-layout>
212 </v-container>
213 </v-card-text>
214 </v-card>
215 </v-dialog>-->
216
217 <!-- ****** EXISTING SUBJECTS TABLE ****** -->
218 <v-toolbar color="transparent" flat> 220 <v-toolbar color="transparent" flat>
219 <v-btn 221 <v-btn
220 fab 222 fab
221 dark 223 dark
222 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" 224 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
223 small 225 small
224 @click="addRoutineDialog = true" 226 @click="addRoutineDialog = true"
225 > 227 >
226 <v-icon dark>add</v-icon> 228 <v-icon dark>add</v-icon>
227 </v-btn> 229 </v-btn>
228 <v-flex xs1 class="hidden-sm-only hidden-xs-only"> 230 <v-flex xs1 class="hidden-sm-only hidden-xs-only">
229 <v-btn 231 <v-btn
230 round 232 round
231 class="open-dialog-button" 233 class="open-dialog-button"
232 dark 234 dark
233 @click="addRoutineDialog = true" 235 @click="addRoutineDialog = true"
234 v-if="role != 'TEACHER' " 236 v-if="role != 'TEACHER' "
235 > 237 >
236 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Routine 238 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Routine
237 </v-btn> 239 </v-btn>
238 </v-flex> 240 </v-flex>
239 <v-spacer></v-spacer> 241 <v-spacer></v-spacer>
240 <v-flex lg2 md2 xs12 v-show="show"> 242 <v-flex lg2 md2 xs12 v-show="show">
241 <v-select 243 <v-select
242 :items="classList" 244 :items="classList"
243 label="Select Your Class" 245 label="Select Your Class"
244 v-model="addRoutine.classId" 246 v-model="addRoutine.classId"
245 item-text="classNum" 247 item-text="classNum"
246 item-value="_id" 248 item-value="_id"
247 name="Select Class" 249 name="Select Class"
248 :rules="classRules" 250 :rules="classRules"
249 @change="getSections(addRoutine.classId)" 251 @change="getSections(addRoutine.classId)"
250 class="pl-2" 252 class="pl-2"
251 required 253 required
252 ></v-select> 254 ></v-select>
253 </v-flex> 255 </v-flex>
254 <v-flex xs8 sm3 md2 class="mr-3"> 256 <v-flex xs8 sm3 md2 class="mr-3">
255 <v-select 257 <v-select
256 v-model="addRoutine.sectionId" 258 v-model="addRoutine.sectionId"
257 label="Select your section" 259 label="Select your section"
258 type="text"
259 :items="addSection" 260 :items="addSection"
260 item-text="name" 261 item-text="name"
261 item-value="_id" 262 item-value="_id"
263 name="Select Section"
264 :rules="sectionRules"
262 @change="getRoutineList()" 265 @change="getRoutineList()"
266 class="pl-2"
263 required 267 required
264 ></v-select> 268 ></v-select>
265 </v-flex> 269 </v-flex>
266 <v-card-title class="body-1" v-show="show"> 270 <v-card-title class="body-1" v-show="show">
267 <v-btn icon flat @click="displaySearch"> 271 <v-btn icon flat @click="displaySearch">
268 <v-avatar size="27"> 272 <v-avatar size="27">
269 <img src="/static/icon/search.png" alt="icon" /> 273 <img src="/static/icon/search.png" alt="icon" />
270 </v-avatar> 274 </v-avatar>
271 </v-btn> 275 </v-btn>
272 </v-card-title> 276 </v-card-title>
273 <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> 277 <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch">
274 <v-layout> 278 <v-layout>
275 <v-text-field 279 <v-text-field
276 v-model="search" 280 v-model="search"
277 label="Search" 281 label="Search"
278 prepend-inner-icon="search" 282 prepend-inner-icon="search"
279 color="primary" 283 color="primary"
280 style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" 284 style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important"
281 ></v-text-field> 285 ></v-text-field>
282 <v-icon @click="closeSearch" color="error">close</v-icon> 286 <v-icon @click="closeSearch" color="error">close</v-icon>
283 </v-layout> 287 </v-layout>
284 </v-flex> 288 </v-flex>
285 </v-toolbar> 289 </v-toolbar>
286 290
287 <div class="col-sm-12"> 291 <div class="col-sm-12">
288 <!-- <h5 class="page-header"> 292 <div class="box-body">
289 <div class="col-lg-2 col-sm-2 col-md-2 col-xs-12 pull-right drop-marg"> 293 <div class="row">
290 <div class="select2-container form-control select2" id="s2id_classesID"> 294 <div class="col-sm-12">
291 <a 295 <div class="nav-tabs-custom">
292 href="javascript:void(0)" 296 <ul class="nav nav-tabs">
293 onclick="return false;" 297 <li class="active">
294 class="select2-choice" 298 <a data-toggle="tab" href="#all" aria-expanded="true">All Routines</a>
295 tabindex="-1" 299 </li>
296 > 300 </ul>
297 <span class="select2-chosen">Select Class</span>
298 <abbr class="select2-search-choice-close"></abbr>
299 <span class="select2-arrow">
300 <b></b>
301 </span>
302 </a>
303 <input class="select2-focusser select2-offscreen" type="text" id="s2id_autogen1" />
304 <div class="select2-drop select2-display-none select2-with-searchbox">
305 <div class="select2-search">
306 <input
307 type="text"
308 autocomplete="off"
309 autocorrect="off"
310 autocapitalize="off"
311 spellcheck="false"
312 class="select2-input"
313 />
314 </div>
315 <ul class="select2-results"></ul>
316 </div>
317 </div>
318 <select
319 name="classesID"
320 id="classesID"
321 class="form-control select2 select2-offscreen"
322 tabindex="-1"
323 >
324 <option value="0" selected="selected">Select Class</option>
325 <option value="3">ONE</option>
326 </select>
327 </div>
328 </h5>-->
329 301
330 <div class="nav-tabs-custom"> 302 <div class="tab-content" v-show="hideTable">
331 <ul class="nav nav-tabs"> 303 <div id="all" class="tab-pane active mCustomScrollbar _mCS_1 mCS_no_scrollbar">
332 <li class="active">
333 <a data-toggle="tab" href="#all" aria-expanded="true">All Routines</a>
334 </li>
335 </ul>
336
337 <div class="tab-content">
338 <div id="all" class="tab-pane active mCustomScrollbar _mCS_1 mCS_no_scrollbar">
339 <div
340 id="mCSB_1"
341 class="mCustomScrollBox mCS-light mCSB_horizontal mCSB_inside"
342 style="max-height: none;"
343 tabindex="0"
344 >
345 <div
346 id="mCSB_1_container"
347 class="mCSB_container mCS_x_hidden mCS_no_scrollbar_x"
348 style="position: relative; top: 0px; left: 0px; width: 100%;"
349 dir="ltr"
350 >
351 <div id="hide-table-2">
352 <table id="table" class="table table-striped">
353 <tbody>
354 <tr>
355 <td>MONDAY</td>
356 </tr>
357 <tr>
358 <td>TUESDAY</td>
359 </tr>
360 <tr>
361 <td>WEDNESDAY</td>
362 </tr>
363 <tr>
364 <td>THURSDAY</td>
365 </tr>
366 <tr>
367 <td>FRIDAY</td>
368 </tr>
369 <tr>
370 <td>SATURDAY</td>
371 </tr>
372 <tr>
373 <td style="font-weight:bold">SUNDAY</td>
374 </tr>
375 </tbody>
376 </table>
377 </div>
378 </div>
379 <div
380 id="mCSB_1_scrollbar_horizontal"
381 class="mCSB_scrollTools mCSB_1_scrollbar mCS-light mCSB_scrollTools_horizontal"
382 style="display: none;"
383 >
384 <div class="mCSB_draggerContainer">
385 <div 304 <div
386 id="mCSB_1_dragger_horizontal" 305 id="mCSB_1"
387 class="mCSB_dragger" 306 class="mCustomScrollBox mCS-light"
388 style="position: absolute; min-width: 30px; width: 0px; left: 0px;" 307 style="max-height: none;"
308 tabindex="0"
389 > 309 >
390 <div class="mCSB_dragger_bar"></div> 310 <div
311 id="mCSB_1_container"
312 class="mCSB_container mCS_x_hidden mCS_no_scrollbar_x"
313 style="position: relative; top: 0px; left: 0px; width: 100%;"
314 dir="ltr"
315 >
316 <div id="hide-table-2">
317 <table id="table" class="table table-striped">
318 <tbody>
319 <tr>
320 <td>MONDAY</td>
321 </tr>
322 <tr>
323 <td>TUESDAY</td>
324 </tr>
325 <tr>
326 <td>WEDNESDAY</td>
327 </tr>
328 <tr>
329 <td>THURSDAY</td>
330 </tr>
331 <tr>
332 <td>FRIDAY</td>
333 </tr>
334 <tr>
335 <td>SATURDAY</td>
336 </tr>
337 </tbody>
338 </table>
339 </div>
340 </div>
341 <div
342 id="mCSB_1_scrollbar_horizontal"
343 class="mCSB_scrollTools mCSB_1_scrollbar mCS-light mCSB_scrollTools_horizontal"
344 style="display: none;"
345 >
346 <div class="mCSB_draggerContainer">
347 <div
348 id="mCSB_1_dragger_horizontal"
349 class="mCSB_dragger"
350 style="position: absolute; min-width: 30px; width: 0px; left: 0px;"
351 >
352 <div class="mCSB_dragger_bar"></div>
353 </div>
354 <div class="mCSB_draggerRail"></div>
355 </div>
356 </div>
391 </div> 357 </div>
392 <div class="mCSB_draggerRail"></div>
393 </div> 358 </div>
394 </div> 359 </div>
360 <div>
361 <table id="table" class="table table-bordered" v-show="showTable">
362 <tbody>
363 <div class="nav-tabs-custom">
364 <div class="tab-content" id="scrolling">
365 <div id="hide-table-2">
366 <v-data-table :items="routineList">
367 <template slot="items" slot-scope="props">
368 <tr class="tr">
369 <td>{{ props.item.day }}</td>
370 <td class="text-center">
371 <br />
372 {{ props.item.classId.classNum }}
373 <br />
374 {{ props.item.sectionId.name }}
375 </td>
376 <td class="text-center" v-for="list in props.item.lectureRoutine">
377 {{ list.startingTime }} - {{ list.endingTime }}
378 <br />
379 {{ list.room }}
380 <br />
381 {{ list.subjectName }}
382 <br />
383 {{ list.teacherId .name}}
384 <br />
385 <span>
386 <v-tooltip top>
387 <img
388 slot="activator"
389 style="cursor:pointer; width:20px; height:18px; "
390 class="mr-3"
391 @click="editItem()"
392 src="/static/icon/edit.png"
393 />
394 <span>Edit</span>
395 </v-tooltip>
396 <v-tooltip top>
397 <img
398 slot="activator"
399 style="cursor:pointer; width:20px; height:18px; "
400 class="mr-3"
401 @click="deleteItem(props.item)"
402 src="/static/icon/delete.png"
403 />
404 <span>Delete</span>
405 </v-tooltip>
406 </span>
407 </td>
408 </tr>
409 </template>
410 </v-data-table>
411 </div>
412 </div>
413 </div>
414 </tbody>
415 </table>
416 </div>
395 </div> 417 </div>
396 </div> 418 </div>
397 </div> 419 </div>
398 </div> 420 </div>
399 </div> 421 </div>
400
401 <!-- <v-data-table
402 :headers="headers"
403 :items="routineList"
404 :pagination.sync="pagination"
405 :search="search"
406 >
407 <template slot="items" slot-scope="props">
408 <tr class="tr">
409 <td class="td-row td">{{ props.index + 1 }}</td>
410 <td class="text-xs-center td td-row">{{ props.item.schoolYear }}</td>
411 <td class="text-xs-center td td-row">{{ props.item.classId }}</td>
412 <td class="text-xs-center td td-row">{{ props.item.sectionId }}</td>
413 <td class="text-xs-center td td-row">{{ props.item.day }}</td>
414 <td class="text-xs-center td td-row">{{ props.item.lectureRoutine.staringTime }}</td>
415 <td class="text-xs-center td td-row">{{ props.item.lectureRoutine.endingTime }}</td>
416 <td class="text-xs-center td td-row">{{ props.item.lectureRoutine.subjectName }}</td>
417 <td class="text-xs-center td td-row">
418 <span>
419 <v-tooltip top>
420 <img
421 slot="activator"
422 style="cursor:pointer; width:20px; height:18px; "
423 class="mr-3"
424 @click="editItem(props.item)"
425 src="/static/icon/edit.png"
426 />
427 <span>Edit</span>
428 </v-tooltip>
429 <v-tooltip top>
430 <img
431 slot="activator"
432 style="cursor:pointer; width:20px; height:20px; "
433 class="mr-3"
434 @click="deleteItem(props.item)"
435 src="/static/icon/delete.png"
436 />
437 <span>Delete</span>
438 </v-tooltip>
439 </span>
440 </td>
441 </tr>
442 </template>
443 <v-alert
444 slot="no-results"
445 :value="true"
446 color="error"
447 icon="warning"
448 >Your search for "{{ search }}" found no results.</v-alert>
449 </v-data-table> -->
450 <!-- ****** ADD MULTIPLE Subject ****** --> 422 <!-- ****** ADD MULTIPLE Subject ****** -->
451 <v-snackbar 423 <v-snackbar
452 :timeout="timeout" 424 :timeout="timeout"
453 :top="y === 'top'" 425 :top="y === 'top'"
454 :right="x === 'right'" 426 :right="x === 'right'"
455 :vertical="mode === 'vertical'" 427 :vertical="mode === 'vertical'"
456 v-model="snackbar" 428 v-model="snackbar"
457 :color="color" 429 :color="color"
458 >{{ text }}</v-snackbar> 430 >{{ text }}</v-snackbar>
459 <v-dialog v-model="addRoutineDialog" max-width="600px"> 431 <v-dialog v-model="addRoutineDialog" max-width="600px">
460 <v-card flat class="card-style pa-2" dark> 432 <v-card flat class="card-style pa-2" dark>
461 <v-layout> 433 <v-layout>
462 <v-flex xs12> 434 <v-flex xs12>
463 <label class="title text-xs-center">Add Routine</label> 435 <label class="title text-xs-center">Add Routine</label>
464 <v-icon size="24" class="right" @click="addRoutineDialog = false">cancel</v-icon> 436 <v-icon size="24" class="right" @click="addRoutineDialog = false">cancel</v-icon>
465 </v-flex> 437 </v-flex>
466 </v-layout> 438 </v-layout>
467 <v-container fluid fill-height> 439 <v-container fluid fill-height>
468 <v-layout align-center> 440 <v-layout align-center>
469 <v-flex xs12> 441 <v-flex xs12>
470 <v-form ref="form" v-model="valid" lazy-validation> 442 <v-form ref="form" v-model="valid" lazy-validation>
471 <v-layout> 443 <v-layout>
472 <v-flex xs4 sm4 class="pt-4 subheading"> 444 <v-flex xs4 sm4 class="pt-4 subheading">
473 <label class="right">School Year :</label> 445 <label class="right">School Year :</label>
474 </v-flex> 446 </v-flex>
475 <v-flex xs8 sm8 class="ml-3"> 447 <v-flex xs8 sm8 class="ml-3">
476 <v-text-field 448 <v-text-field
477 placeholder="fill your year" 449 label="fill your year"
478 :rules="schoolRules" 450 :rules="schoolRules"
479 v-model="addRoutine.schoolYear" 451 v-model="addRoutine.schoolYear"
480 ></v-text-field> 452 ></v-text-field>
481 <!-- <v-select
482 :items="classList"
483 label="Select School Year"
484 item-text="classNum"
485 item-value="_id"
486 v-model="addRoutine.classId"
487 name="Select School Year"
488 :rules="schoolRules"
489 class="pl-2"
490 required
491 ></v-select>-->
492 </v-flex> 453 </v-flex>
493 </v-layout> 454 </v-layout>
494 <v-layout> 455 <v-layout>
495 <v-flex xs4 sm4 class="pt-4 subheading"> 456 <v-flex xs4 sm4 class="pt-4 subheading">
496 <label class="right">Class :</label> 457 <label class="right">Class :</label>
497 </v-flex> 458 </v-flex>
498 <v-flex xs8 sm8 class="ml-3"> 459 <v-flex xs8 sm8 class="ml-3">
499 <v-select 460 <v-select
500 :items="classList" 461 :items="classList"
501 label="Select Class"
502 item-text="classNum" 462 item-text="classNum"
503 item-value="_id" 463 item-value="_id"
504 v-model="addRoutine.classId" 464 v-model="addRoutine.classId"
505 name="Select Class" 465 label="Select Class"
506 :rules="classRules" 466 :rules="classRules"
507 @change="getSections(addRoutine.classId)" 467 @change="getSections(addRoutine.classId)"
508 class="pl-2" 468 class="pl-2"
509 required 469 required
510 ></v-select> 470 ></v-select>
511 </v-flex> 471 </v-flex>
512 </v-layout> 472 </v-layout>
513 <v-layout> 473 <v-layout>
514 <v-flex xs4 sm4 class="pt-4 subheading"> 474 <v-flex xs4 sm4 class="pt-4 subheading">
515 <label class="right">Section :</label> 475 <label class="right">Section :</label>
516 </v-flex> 476 </v-flex>
517 <v-flex xs8 sm8 class="ml-3"> 477 <v-flex xs8 sm8 class="ml-3">
518 <v-select 478 <v-select
519 :items="addSection" 479 :items="addSection"
520 label="Select Section"
521 item-text="name" 480 item-text="name"
522 item-value="_id" 481 item-value="_id"
523 v-model="addRoutine.sectionId" 482 v-model="addRoutine.sectionId"
524 name="Select Section" 483 label="Select Section"
525 :rules="sectionRules" 484 :rules="sectionRules"
526 @change="getClassSubject(addRoutine.classId)" 485 @change="getClassSubject(addRoutine.classId)"
527 class="px-2" 486 class="px-2"
528 required 487 required
529 ></v-select> 488 ></v-select>
530 </v-flex> 489 </v-flex>
531 </v-layout> 490 </v-layout>
532 <v-layout> 491 <v-layout>
533 <v-flex xs3 sm4 class="pt-4 subheading"> 492 <v-flex xs3 sm4 class="pt-4 subheading">
534 <label class="right">Subject :</label> 493 <label class="right">Subject :</label>
535 </v-flex> 494 </v-flex>
536 <v-flex xs8 sm8 class="ml-2"> 495 <v-flex xs8 sm8 class="ml-2">
537 <v-select 496 <v-select
538 :items="subjectList.subjects" 497 :items="subjectList.subjects"
539 label="Select your subject" 498 label="Select your subject"
540 v-model="addRoutine.subjectName" 499 v-model="addRoutine.subjectName"
541 item-text="subjectName" 500 item-text="subjectName"
542 item-value="_id" 501 item-value="subjectName"
543 :rules="subjectRules" 502 :rules="subjectRules"
544 required 503 required
545 ></v-select> 504 ></v-select>
546 </v-flex> 505 </v-flex>
547 </v-layout> 506 </v-layout>
548 <v-layout> 507 <v-layout>
549 <v-flex xs3 sm4 class="pt-4 subheading"> 508 <v-flex xs3 sm4 class="pt-4 subheading">
550 <label class="right">Day :</label> 509 <label class="right">Day :</label>
551 </v-flex> 510 </v-flex>
552 <v-flex xs8 sm8 class="ml-2"> 511 <v-flex xs8 sm8 class="ml-2">
553 <v-select 512 <v-select
554 :items="day" 513 :items="day"
555 label="Select your day" 514 label="Select your day"
556 v-model="addRoutine.day" 515 v-model="addRoutine.day"
557 item-text="text" 516 item-text="text"
558 :rules="dayRules" 517 :rules="dayRules"
559 required 518 required
560 ></v-select> 519 ></v-select>
561 </v-flex> 520 </v-flex>
562 </v-layout> 521 </v-layout>
563 <v-layout> 522 <v-layout>
564 <v-flex xs4 sm4 class="pt-4 subheading"> 523 <v-flex xs4 sm4 class="pt-4 subheading">
565 <label class="right">Teacher Name :</label> 524 <label class="right">Teacher Name :</label>
566 </v-flex> 525 </v-flex>
567 <v-flex xs8 sm8 class="ml-3"> 526 <v-flex xs8 sm8 class="ml-3">
568 <v-select 527 <v-select
569 v-model="addRoutine.teacherId" 528 v-model="addRoutine.teacherId"
570 label="Select your teacher" 529 label="Select your teacher"
571 type="text" 530 type="text"
572 :items="teacherList" 531 :items="teacherList"
573 item-text="name" 532 item-text="name"
574 item-value="_id" 533 item-value="_id"
575 :rules="teacherRules" 534 :rules="teacherRules"
576 required 535 required
577 ></v-select> 536 ></v-select>
578 </v-flex> 537 </v-flex>
579 </v-layout> 538 </v-layout>
580 <v-layout> 539 <v-layout>
581 <v-flex xs4 sm4 class="pt-4 subheading"> 540 <v-flex xs4 sm4 class="pt-4 subheading">
582 <label class="right">Starting time:</label> 541 <label class="right">Starting time:</label>
583 </v-flex> 542 </v-flex>
584 <v-flex xs8 sm8 class="ml-3"> 543 <v-flex xs8 sm8 class="ml-3">
585 <v-menu 544 <v-menu
586 ref="menuA" 545 ref="menuA"
587 :close-on-content-click="false" 546 :close-on-content-click="false"
588 v-model="menuB" 547 v-model="menuB"
589 :nudge-right="40" 548 :nudge-right="40"
590 :return-value.sync="addRoutine.staringTime" 549 :return-value.sync="addRoutine.startingTime"
591 lazy 550 lazy
592 transition="scale-transition" 551 transition="scale-transition"
593 offset-y 552 offset-y
594 full-width 553 full-width
595 max-width="290px" 554 max-width="290px"
596 min-width="290px" 555 min-width="290px"
597 > 556 >
598 <v-text-field 557 <v-text-field
599 slot="activator" 558 slot="activator"
600 v-model="addRoutine.staringTime" 559 v-model="addRoutine.startingTime"
601 label="Select your starting time" 560 label="Select your starting time"
602 append-icon="access_time" 561 append-icon="access_time"
603 :rules="timeInRules" 562 :rules="timeInRules"
604 readonly 563 readonly
605 ></v-text-field> 564 ></v-text-field>
606 <v-time-picker 565 <v-time-picker
607 v-model="addRoutine.staringTime" 566 v-model="addRoutine.startingTime"
608 @change="$refs.menuA.save(addRoutine.staringTime)" 567 @change="$refs.menuA.save(addRoutine.startingTime)"
609 ></v-time-picker> 568 ></v-time-picker>
610 </v-menu> 569 </v-menu>
611 </v-flex> 570 </v-flex>
612 </v-layout> 571 </v-layout>
613 <v-layout> 572 <v-layout>
614 <v-flex xs4 sm4 class="pt-4 subheading"> 573 <v-flex xs4 sm4 class="pt-4 subheading">
615 <label class="right">Ending Time:</label> 574 <label class="right">Ending Time:</label>
616 </v-flex> 575 </v-flex>
617 <v-flex xs8 sm8 class="ml-3"> 576 <v-flex xs8 sm8 class="ml-3">
618 <v-menu 577 <v-menu
619 ref="menu" 578 ref="menu"
620 :close-on-content-click="false" 579 :close-on-content-click="false"
621 v-model="menu1" 580 v-model="menu1"
622 :nudge-right="40" 581 :nudge-right="40"
623 :return-value.sync="addRoutine.endingTime" 582 :return-value.sync="addRoutine.endingTime"
624 lazy 583 lazy
625 transition="scale-transition" 584 transition="scale-transition"
626 offset-y 585 offset-y
627 full-width 586 full-width
628 max-width="290px" 587 max-width="290px"
629 min-width="290px" 588 min-width="290px"
630 > 589 >
631 <v-text-field 590 <v-text-field
632 slot="activator" 591 slot="activator"
633 v-model="addRoutine.endingTime" 592 v-model="addRoutine.endingTime"
634 label="Select your end time" 593 label="Select your end time"
635 append-icon="access_time" 594 append-icon="access_time"
636 :rules="timeOutRules" 595 :rules="timeOutRules"
637 readonly 596 readonly
638 ></v-text-field> 597 ></v-text-field>
639 <v-time-picker 598 <v-time-picker
640 v-model="addRoutine.endingTime" 599 v-model="addRoutine.endingTime"
641 @change="$refs.menu.save(addRoutine.endingTime)" 600 @change="$refs.menu.save(addRoutine.endingTime)"
642 ></v-time-picker> 601 ></v-time-picker>
643 </v-menu> 602 </v-menu>
644 </v-flex> 603 </v-flex>
645 </v-layout> 604 </v-layout>
646 <v-layout> 605 <v-layout>
647 <v-flex xs4 sm4 class="pt-4 subheading"> 606 <v-flex xs4 sm4 class="pt-4 subheading">
648 <label class="right">Room:</label> 607 <label class="right">Room:</label>
649 </v-flex> 608 </v-flex>
650 <v-flex xs8 sm8 class="ml-3"> 609 <v-flex xs8 sm8 class="ml-3">
651 <v-text-field 610 <v-text-field
652 placeholder="fill your room" 611 label="fill your room"
653 :rules="roomRules" 612 :rules="roomRules"
654 v-model="addRoutine.room" 613 v-model="addRoutine.room"
655 @keyup.enter="submit" 614 @keyup.enter="submit"
656 ></v-text-field> 615 ></v-text-field>
657 </v-flex> 616 </v-flex>
658 </v-layout> 617 </v-layout>
659 <v-layout> 618 <v-layout>
660 <v-flex xs4 sm4 class="pt-4 subheading"> 619 <v-flex xs4 sm4 class="pt-4 subheading">
661 <label class="right">Period:</label> 620 <label class="right">Period:</label>
662 </v-flex> 621 </v-flex>
663 <v-flex xs8 sm8 class="ml-3"> 622 <v-flex xs8 sm8 class="ml-3">
664 <v-text-field 623 <v-text-field
665 placeholder="fill your room" 624 label="fill your period"
666 :rules="periodRules" 625 :rules="periodRules"
667 v-model="addRoutine.period" 626 v-model="addRoutine.period"
668 @keyup.enter="submit" 627 @keyup.enter="submit"
669 ></v-text-field> 628 ></v-text-field>
670 </v-flex> 629 </v-flex>
671 </v-layout> 630 </v-layout>
672 <v-layout> 631 <v-layout>
673 <v-flex xs12 sm12> 632 <v-flex xs12 sm12>
674 <v-card-actions> 633 <v-card-actions>
675 <v-spacer></v-spacer> 634 <v-spacer></v-spacer>
676 <v-btn 635 <v-btn
677 @click="create" 636 @click="create"
678 round 637 round
679 dark 638 dark
680 :loading="loading" 639 :loading="loading"
681 class="add-button" 640 class="add-button"
682 >Add Routine</v-btn> 641 >Add Routine</v-btn>
683 </v-card-actions> 642 </v-card-actions>
684 </v-flex> 643 </v-flex>
685 </v-layout> 644 </v-layout>
686 </v-form> 645 </v-form>
687 </v-flex> 646 </v-flex>
688 </v-layout> 647 </v-layout>
689 </v-container> 648 </v-container>
690 </v-card> 649 </v-card>
691 </v-dialog> 650 </v-dialog>
692 <div class="loader" v-if="showLoader"> 651 <div class="loader" v-if="showLoader">
693 <v-progress-circular indeterminate color="white"></v-progress-circular> 652 <v-progress-circular indeterminate color="white"></v-progress-circular>
694 </div> 653 </div>
695 </v-container> 654 </v-container>
696 </template> 655 </template>
697 656
698 <script> 657 <script>
699 import http from "@/Services/http.js"; 658 import http from "@/Services/http.js";
700 import Util from "@/util"; 659 import Util from "@/util";
701 660
702 export default { 661 export default {
703 data: () => ({ 662 data: () => ({
704 snackbar: false, 663 snackbar: false,
705 y: "top", 664 y: "top",
706 x: "right", 665 x: "right",
707 role: "", 666 role: "",
708 mode: "", 667 mode: "",
709 timeout: 3000, 668 timeout: 3000,
710 text: "", 669 text: "",
711 color: "", 670 color: "",
712 show: true, 671 show: true,
713 showSearch: false, 672 showSearch: false,
714 showLoader: false, 673 showLoader: false,
715 loading: false, 674 loading: false,
716 editLoading: false, 675 editLoading: false,
717 date: null, 676 date: null,
718 search: "", 677 search: "",
719 // viewSubjectDialog: false,
720 editRoutineDialog: false, 678 editRoutineDialog: false,
721 valid: true, 679 valid: true,
722 validEditRoutine: true, 680 validEditRoutine: true,
723 addRoutineDialog: false, 681 addRoutineDialog: false,
682 showTable: false,
683 hideTable: true,
684 name: "",
724 685
725 day: [ 686 day: [
726 "Monday", 687 "Monday",
727 "Tuesday", 688 "Tuesday",
728 "Wednesday", 689 "Wednesday",
729 "Thursday", 690 "Thursday",
730 "Friday", 691 "Friday",
731 "Saturday", 692 "Saturday",
732 "Sunday" 693 "Sunday"
733 ], 694 ],
734 pagination: { 695
735 rowsPerPage: 10
736 },
737 token: "", 696 token: "",
738 697
739 menu1: false, 698 menu1: false,
740 menuB: false, 699 menuB: false,
741 menu2: false, 700 menu2: false,
742 701
743 schoolRules: [v => !!v || "School Year is required"], 702 schoolRules: [v => !!v || "School Year is required"],
744 classRules: [v => !!v || " Class Name is required"], 703 classRules: [v => !!v || " Class Name is required"],
745 teacherRules: [v => !!v || " Teacher Name is required"], 704 teacherRules: [v => !!v || " Teacher Name is required"],
746 sectionRules: [v => !!v || "Section is required"], 705 sectionRules: [v => !!v || "Section is required"],
747 studentRules: [v => !!v || " Student is required"], 706 studentRules: [v => !!v || " Student is required"],
748 finalRules: [v => !!v || "Final MArk is required"], 707 finalRules: [v => !!v || "Final MArk is required"],
749 subjectRules: [v => !!v || " Subject Name is required"], 708 subjectRules: [v => !!v || " Subject Name is required"],
750 dayRules: [v => !!v || "Day is required"], 709 dayRules: [v => !!v || "Day is required"],
751 timeInRules: [v => !!v || "Start Time is required"], 710 timeInRules: [v => !!v || "Start Time is required"],
752 timeOutRules: [v => !!v || "End Time is required"], 711 timeOutRules: [v => !!v || "End Time is required"],
753 roomRules: [v => !!v || "Room is required"], 712 roomRules: [v => !!v || "Room is required"],
754 periodRules: [v => !!v || "Period is required"], 713 periodRules: [v => !!v || "Period is required"],
755 headers: [ 714
756 {
757 text: "No",
758 align: "",
759 sortable: false,
760 value: "No"
761 },
762 {
763 text: "Subject Name",
764 value: "subjectName",
765 sortable: false,
766 align: "center"
767 },
768 {
769 text: "Subject Author",
770 value: "subjectAuthor",
771 sortable: false,
772 align: "center"
773 },
774 {
775 text: "Subject Code",
776 value: "subjectCode",
777 sortable: false,
778 align: "center"
779 },
780 // {
781 // text: "Teacher",
782 // value: "teacherId",
783 // sortable: false,
784 // align: "center"
785 // },
786 {
787 text: "Pass Marks",
788 value: "passMarks",
789 sortable: false,
790 align: "center"
791 },
792 {
793 text: "Final Marks",
794 value: "finalMarks",
795 sortable: false,
796 align: "center"
797 },
798 {
799 text: "Type",
800 value: "type",
801 sortable: false,
802 align: "center"
803 },
804 { text: "Action", value: "", sortable: false, align: "center" }
805 ],
806 subjectList: [],
807 classList: [], 715 classList: [],
808 addSection: [], 716 addSection: [],
809 subjectList: [], 717 subjectList: [],
810 teacherList: [], 718 teacherList: [],
811 titleRules: [], 719 titleRules: [],
812 markRules: [], 720 markRules: [],
813 typeRules: [], 721 typeRules: [],
814 routineList: [], 722 routineList: [],
815 editedIndex: -1, 723 editedIndex: -1,
816 addRoutine: {}, 724 addRoutine: {},
725 startingTime: "",
726 editedItem: {}
817 727
818 editedItem: { 728 // editedItem: {
819 // subjectName: "", 729 // schoolYear: "",
820 // subjectAuthor: "" 730 // day: "",
821 } 731 // teacherId: "",
732 // classId: "",
733 // sectionId: "",
734 // startingTime: "",
735 // endingTime: "",
736 // room: "",
737 // period: "",
738 // subjectName: ""
739 // }
822 }), 740 }),
823 methods: { 741 methods: {
824 pickFile() {
825 this.$refs.image.click();
826 },
827 editItem(item) { 742 editItem(item) {
828 this.editedIndex = this.subjectList.subjects; 743 this.editedIndex = this.routineList;
829 this.editedItem = Object.assign({}, item); 744 this.editedItem = Object.assign({}, item);
745 // this.editedItem.subjectName = item.lectureRoutine.subjectName;
830 this.dialog = true; 746 this.dialog = true;
831 this.editRoutineDialog = true; 747 this.editRoutineDialog = true;
832 }, 748 },
833 // profile(item) {
834 // this.editedIndex = this.subjectList.subjects;
835 // this.editedItem = Object.assign({}, item);
836 // this.dialog1 = true;
837 // this.viewSubjectDialog = true;
838 // },
839 deleteItem(item) { 749 deleteItem(item) {
840 let deleteSubject = { 750 let deleteLecture = {
841 classId: this.addRoutine.classId, 751 routineId: item._id,
842 subjectId: item._id 752 lectureId: item.lectureRoutine[0]._id
843 }; 753 };
844 http() 754 http()
845 .delete( 755 .delete(
846 "/deleteSubject", 756 "/deleteRoutineLecture",
847 confirm("Are you sure you want to delete this?") && { 757 confirm("Are you sure you want to delete this?") && {
848 params: deleteSubject 758 params: deleteLecture
849 } 759 }
850 ) 760 )
851 .then(response => { 761 .then(response => {
852 this.getClassSubject(_id);
853 this.snackbar = true; 762 this.snackbar = true;
854 this.text = "Successfully delete Existing Subject"; 763 this.text = "Successfully delete Existing Routine";
855 this.color = "green"; 764 this.color = "green";
765 this.getRoutineList();
856 }) 766 })
857 .catch(error => { 767 .catch(error => {
858 this.snackbar = true; 768 this.snackbar = true;
859 this.text = error.response.data.message; 769 this.text = error.response.data.message;
860 this.color = "error"; 770 this.color = "error";
861 }); 771 });
862 }, 772 },
863 close() { 773 close() {
864 this.editRoutineDialog = false; 774 this.editRoutineDialog = false;
865 }, 775 },
866 776
867 create() { 777 create() {
868 var routineData = { 778 var routineData = {
869 schoolYear: this.addRoutine.schoolYear, 779 schoolYear: this.addRoutine.schoolYear,
870 classId: this.addRoutine.classId, 780 classId: this.addRoutine.classId,
871 sectionId: this.addRoutine.sectionId, 781 sectionId: this.addRoutine.sectionId,
872 day: this.addRoutine.day, 782 day: this.addRoutine.day,
873 lectureRoutine: [] 783 lectureRoutine: []
874 }; 784 };
875 if (this.$refs.form.validate()) { 785 if (this.$refs.form.validate()) {
876 routineData.lectureRoutine.push({ 786 routineData.lectureRoutine.push({
877 teacherId: this.addRoutine.teacherId, 787 teacherId: this.addRoutine.teacherId,
878 staringTime: this.addRoutine.staringTime, 788 startingTime: this.addRoutine.startingTime,
879 endingTime: this.addRoutine.endingTime, 789 endingTime: this.addRoutine.endingTime,
880 room: this.addRoutine.room, 790 room: this.addRoutine.room,
881 period: this.addRoutine.period, 791 period: this.addRoutine.period,
882 subjectName: this.addRoutine.subjectName 792 subjectName: this.addRoutine.subjectName
883 }); 793 });
884 http() 794 http()
885 .post("/createRoutine", routineData) 795 .post("/createRoutine", routineData)
886 .then(response => { 796 .then(response => {
797 this.getRoutineList();
887 this.text = "Routine added successfully"; 798 this.text = "Routine added successfully";
888 this.clear(); 799 this.clear();
889 this.snackbar = true; 800 this.snackbar = true;
890 this.color = "green"; 801 this.color = "green";
891 this.addRoutineDialog = false; 802 this.addRoutineDialog = false;
892 }) 803 })
893 .catch(error => { 804 .catch(error => {
894 // console.log(error); 805 // console.log(error);
895 this.snackbar = true; 806 this.snackbar = true;
896 this.text = error.response.data.message; 807 this.text = error.response.data.message;
897 this.color = "error"; 808 this.color = "error";
898 }); 809 });
899 } 810 }
900 }, 811 },
901 clear() { 812 clear() {
902 this.$refs.form.reset(); 813 this.$refs.form.reset();
903 }, 814 },
904 815
905 save() { 816 update() {
906 if (this.$refs.formEditRoutine.validate()) { 817 // if (this.$refs.formEditRoutine.validate()) {
907 let editSubject = { 818 // let editSubject = {
908 classId: this.editedItem.classId, 819 // classId: this.editedItem.classId,
909 subjectId: this.editedItem._id, 820 // subjectId: this.editedItem._id,
910 teacherId: this.editedItem.teacherId, 821 // teacherId: this.editedItem.teacherId,
911 type: this.editedItem.type, 822 // type: this.editedItem.type,
912 passMarks: this.editedItem.passMarks, 823 // passMarks: this.editedItem.passMarks,
913 finalMarks: this.editedItem.finalMarks, 824 // finalMarks: this.editedItem.finalMarks,
914 subjectAuthor: this.editedItem.subjectAuthor, 825 // subjectAuthor: this.editedItem.subjectAuthor,
915 subjectCode: this.editedItem.subjectCode, 826 // subjectCode: this.editedItem.subjectCode,
916 subjectName: this.editedItem.subjectName 827 // subjectName: this.editedItem.subjectName
917 }; 828 // };
918 this.editLoading = true; 829 // this.editLoading = true;
919 http() 830 // http()
920 .put("/updateSubject", editSubject) 831 // .put("/updateSubject", editSubject)
921 .then(response => { 832 // .then(response => {
922 this.snackbar = true; 833 // this.snackbar = true;
923 this.text = "Successfully Edit Existing Subject"; 834 // this.text = "Successfully Edit Existing Subject";
924 this.color = "green"; 835 // this.color = "green";
925 this.editLoading = false; 836 // this.editLoading = false;
926 this.editRoutineDialog = false; 837 // this.editRoutineDialog = false;
927 http() 838 // http()
928 .get( 839 // .get(
929 "/getParticularClass", 840 // "/getParticularClass",
930 { params: { classId: _id } }, 841 // { params: { classId: _id } },
931 { 842 // {
932 headers: { Authorization: "Bearer " + this.token } 843 // headers: { Authorization: "Bearer " + this.token }
933 } 844 // }
934 ) 845 // )
935 .then(response => { 846 // .then(response => {
936 this.subjectList = response.data.data; 847 // this.subjectList = response.data.data;
937 this.snackbar = true; 848 // this.snackbar = true;
938 this.color = "green"; 849 // this.color = "green";
939 this.text = response.data.message; 850 // this.text = response.data.message;
940 this.close(); 851 // this.close();
941 }) 852 // })
942 .catch(err => { 853 // .catch(err => {
943 console.log("err====>", err); 854 // console.log("err====>", err);
944 }); 855 // });
945 }) 856 // })
946 .catch(error => { 857 // .catch(error => {
947 this.editLoading = false; 858 // this.editLoading = false;
948 859
949 // console.log(error); 860 // // console.log(error);
950 }); 861 // });
951 } 862 // }
952 },
953 getClassSubject(_id) {
954 this.showLoader = true;
955 // this.classId = this.classId;
956 http()
957 .get(
958 "/getParticularClass",
959 { params: { classId: _id } },
960 {
961 headers: { Authorization: "Bearer " + this.token }