Commit b039d39fb840c9c5ef7bb7bcf248f64ff4d51ccc
1 parent
d9cb34e695
Exists in
master
and in
2 other branches
Hide Edit functionality in subject screen, Improve add and show functionality i…
…n syllabus screen, Hide Delete functionality in class screen, Improve add and show functionality in exam Attendence screen, Improve get exam schedule functionality in exam schedule screen, Fix issue while viewing marks in view mark screen, Hide Delete functionality in sectioin screen, Improve updateMeetingEvent api in meeting event screen, Improve add and show functionality in assignment screen
Showing
9 changed files
with
94 additions
and
37 deletions
Show diff stats
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 | <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 xs4 class="pt-4 subheading"> | 15 | <v-flex xs4 class="pt-4 subheading"> |
16 | <label class="right">Title:</label> | 16 | <label class="right">Title:</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs8 class="ml-3"> | 18 | <v-flex xs8 class="ml-3"> |
19 | <v-text-field v-model="editedItem.title" type="text" :rules="titleRules" required></v-text-field> | 19 | <v-text-field v-model="editedItem.title" type="text" :rules="titleRules" required></v-text-field> |
20 | </v-flex> | 20 | </v-flex> |
21 | </v-layout> | 21 | </v-layout> |
22 | <v-layout> | 22 | <v-layout> |
23 | <v-flex xs4 class="pt-4 subheading"> | 23 | <v-flex xs4 class="pt-4 subheading"> |
24 | <label class="right">Description:</label> | 24 | <label class="right">Description:</label> |
25 | </v-flex> | 25 | </v-flex> |
26 | <v-flex xs8 class="ml-3"> | 26 | <v-flex xs8 class="ml-3"> |
27 | <v-text-field | 27 | <v-text-field |
28 | v-model="editedItem.description" | 28 | v-model="editedItem.description" |
29 | type="text" | 29 | type="text" |
30 | :rules="deadlineRules" | 30 | :rules="deadlineRules" |
31 | required | 31 | required |
32 | ></v-text-field> | 32 | ></v-text-field> |
33 | </v-flex> | 33 | </v-flex> |
34 | </v-layout> | 34 | </v-layout> |
35 | <v-layout> | 35 | <v-layout> |
36 | <v-flex xs4 class="pt-4 subheading"> | 36 | <v-flex xs4 class="pt-4 subheading"> |
37 | <label class="right">Deadline:</label> | 37 | <label class="right">Deadline:</label> |
38 | </v-flex> | 38 | </v-flex> |
39 | <v-flex xs8 class="pt-4 subheading"> | 39 | <v-flex xs8 class="ml-3"> |
40 | <v-menu | 40 | <v-menu |
41 | ref="menu1" | 41 | ref="menu1" |
42 | :close-on-content-click="false" | 42 | :close-on-content-click="false" |
43 | v-model="menu1" | 43 | v-model="menu1" |
44 | :nudge-right="40" | 44 | :nudge-right="40" |
45 | :return-value.sync="menu1" | 45 | :return-value.sync="menu1" |
46 | lazy | 46 | lazy |
47 | transition="scale-transition" | 47 | transition="scale-transition" |
48 | offset-y | 48 | offset-y |
49 | full-width | 49 | full-width |
50 | min-width="290px" | 50 | min-width="290px" |
51 | > | 51 | > |
52 | <v-text-field | 52 | <v-text-field |
53 | slot="activator" | 53 | slot="activator" |
54 | v-model="editedItem.deadline" | 54 | v-model="editedItem.deadline" |
55 | placeholder="Select Date" | 55 | placeholder="Select Date" |
56 | :rules="deadlineRules" | 56 | :rules="deadlineRules" |
57 | append-icon="event" | 57 | append-icon="event" |
58 | required | 58 | required |
59 | ></v-text-field> | 59 | ></v-text-field> |
60 | <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker> | 60 | <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker> |
61 | </v-menu> | 61 | </v-menu> |
62 | </v-flex> | 62 | </v-flex> |
63 | </v-layout> | 63 | </v-layout> |
64 | <v-layout> | 64 | <v-layout> |
65 | <v-flex xs4 class="pt-4 subheading"> | 65 | <v-flex xs4 class="pt-4 subheading"> |
66 | <label class="right">Class:</label> | 66 | <label class="right">Class:</label> |
67 | </v-flex> | 67 | </v-flex> |
68 | <v-flex xs8 class="ml-3"> | 68 | <v-flex xs8 class="ml-3"> |
69 | <v-select | 69 | <v-select |
70 | :items="classList" | 70 | :items="classList" |
71 | item-text="classNum" | 71 | item-text="classNum" |
72 | item-value="_id" | 72 | item-value="_id" |
73 | :rules="classRules" | 73 | :rules="classRules" |
74 | v-model="editedItem.classId" | 74 | v-model="editedItem.classId" |
75 | @change="getSections(addAssignment.classId)" | 75 | @change="getSections(editedItem.classId)" |
76 | required | 76 | required |
77 | ></v-select> | 77 | ></v-select> |
78 | </v-flex> | 78 | </v-flex> |
79 | </v-layout> | 79 | </v-layout> |
80 | <v-layout> | 80 | <v-layout> |
81 | <v-flex xs4 class="pt-4 subheading"> | 81 | <v-flex xs4 class="pt-4 subheading"> |
82 | <label class="right">Section:</label> | 82 | <label class="right">Section:</label> |
83 | </v-flex> | 83 | </v-flex> |
84 | <v-flex xs8 class="ml-3"> | 84 | <v-flex xs8 class="ml-3"> |
85 | <v-select | 85 | <v-select |
86 | :items="addSection" | 86 | :items="addSection" |
87 | item-text="name" | 87 | item-text="name" |
88 | item-value="_id" | 88 | item-value="_id" |
89 | v-model="editedItem.sectionId" | 89 | v-model="editedItem.sectionId" |
90 | :rules="sectionRules" | 90 | :rules="sectionRules" |
91 | @change="getClassSubject(addAssignment.classId)" | 91 | @change="getClassSubject(editedItem.classId)" |
92 | required | 92 | required |
93 | ></v-select> | 93 | ></v-select> |
94 | </v-flex> | 94 | </v-flex> |
95 | </v-layout> | 95 | </v-layout> |
96 | <v-layout> | 96 | <v-layout> |
97 | <v-flex xs4 class="pt-4 subheading"> | 97 | <v-flex xs4 class="pt-4 subheading"> |
98 | <label class="right">Subject</label> | 98 | <label class="right">Subject</label> |
99 | </v-flex> | 99 | </v-flex> |
100 | <v-flex xs8 class="ml-3"> | 100 | <v-flex xs8 class="ml-3"> |
101 | <v-select | 101 | <v-select |
102 | :items="subjectList.subjects" | 102 | :items="subjectList.subjects" |
103 | v-model="editedItem.subjectName" | 103 | v-model="editedItem.subjectName" |
104 | item-text="subjectName" | 104 | item-text="subjectName" |
105 | item-value="_id" | 105 | item-value="_id" |
106 | :rules="subjectRules" | 106 | :rules="subjectRules" |
107 | required | 107 | required |
108 | ></v-select> | 108 | ></v-select> |
109 | </v-flex> | 109 | </v-flex> |
110 | </v-layout> | 110 | </v-layout> |
111 | <v-layout> | 111 | <v-layout> |
112 | <v-flex xs4 class="pt-4 subheading"> | 112 | <v-flex xs4 class="pt-4 subheading"> |
113 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> | 113 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> |
114 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File :</label> | 114 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File :</label> |
115 | </v-flex> | 115 | </v-flex> |
116 | <v-flex xs8 sm8 class="ml-3"> | 116 | <v-flex xs8 sm8 class="ml-3"> |
117 | <v-text-field | 117 | <v-text-field |
118 | label="Select File" | 118 | label="Select File" |
119 | @click="pickFile" | 119 | @click="pickFile" |
120 | v-model="imageName" | 120 | v-model="imageName" |
121 | append-icon="attach_file" | 121 | append-icon="attach_file" |
122 | ></v-text-field> | 122 | ></v-text-field> |
123 | </v-flex> | 123 | </v-flex> |
124 | </v-layout> | 124 | </v-layout> |
125 | <v-flex xs12 sm12> | 125 | <v-flex xs12 sm12> |
126 | <v-card-actions> | 126 | <v-card-actions> |
127 | <v-spacer></v-spacer> | 127 | <v-spacer></v-spacer> |
128 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 128 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
129 | </v-card-actions> | 129 | </v-card-actions> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-form> | 131 | </v-form> |
132 | </v-container> | 132 | </v-container> |
133 | </v-card> | 133 | </v-card> |
134 | </v-dialog> | 134 | </v-dialog> |
135 | 135 | ||
136 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> | 136 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> |
137 | <v-dialog v-model="viewAssignmentDialog" max-width="500px"> | 137 | <v-dialog v-model="viewAssignmentDialog" max-width="500px"> |
138 | <v-card flat class="card-style pa-3" dark> | 138 | <v-card flat class="card-style pa-3" dark> |
139 | <v-layout> | 139 | <v-layout> |
140 | <v-flex xs12> | 140 | <v-flex xs12> |
141 | <label class="title text-xs-center">View Attendence</label> | 141 | <label class="title text-xs-center">View Attendence</label> |
142 | <v-icon size="24" class="right" @click="viewAssignmentDialog = false">cancel</v-icon> | 142 | <v-icon size="24" class="right" @click="viewAssignmentDialog = false">cancel</v-icon> |
143 | </v-flex> | 143 | </v-flex> |
144 | </v-layout> | 144 | </v-layout> |
145 | <v-card-text> | 145 | <v-card-text> |
146 | <v-container grid-list-md> | 146 | <v-container grid-list-md> |
147 | <v-layout wrap> | 147 | <v-layout wrap> |
148 | <v-flex> | 148 | <v-flex> |
149 | <v-layout> | 149 | <v-layout> |
150 | <v-flex xs6 sm4> | 150 | <v-flex xs6 sm4> |
151 | <h5 class="right my-1"> | 151 | <h5 class="right my-1"> |
152 | <b>Title:</b> | 152 | <b>Title:</b> |
153 | </h5> | 153 | </h5> |
154 | </v-flex> | 154 | </v-flex> |
155 | <v-flex sm8 xs6> | 155 | <v-flex sm8 xs6> |
156 | <h5 class="my-1">{{ editedItem.title }}</h5> | 156 | <h5 class="my-1">{{ editedItem.title }}</h5> |
157 | </v-flex> | 157 | </v-flex> |
158 | </v-layout> | 158 | </v-layout> |
159 | <v-layout> | 159 | <v-layout> |
160 | <v-flex xs6 sm4> | 160 | <v-flex xs6 sm4> |
161 | <h5 class="right my-1"> | 161 | <h5 class="right my-1"> |
162 | <b>Description:</b> | 162 | <b>Description:</b> |
163 | </h5> | 163 | </h5> |
164 | </v-flex> | 164 | </v-flex> |
165 | <v-flex sm8 xs6> | 165 | <v-flex sm8 xs6> |
166 | <h5 class="my-1">{{ editedItem.description }}</h5> | 166 | <h5 class="my-1">{{ editedItem.description }}</h5> |
167 | </v-flex> | 167 | </v-flex> |
168 | </v-layout> | 168 | </v-layout> |
169 | <v-layout> | 169 | <v-layout> |
170 | <v-flex xs6 sm4> | 170 | <v-flex xs6 sm4> |
171 | <h5 class="right my-1"> | 171 | <h5 class="right my-1"> |
172 | <b>Deadline:</b> | 172 | <b>Deadline:</b> |
173 | </h5> | 173 | </h5> |
174 | </v-flex> | 174 | </v-flex> |
175 | <v-flex sm8 xs6> | 175 | <v-flex sm8 xs6> |
176 | <h5 class="my-1">{{ dates(editedItem.deadline) }}</h5> | 176 | <h5 class="my-1">{{ dates(editedItem.deadline) }}</h5> |
177 | </v-flex> | 177 | </v-flex> |
178 | </v-layout> | 178 | </v-layout> |
179 | </v-flex> | 179 | </v-flex> |
180 | </v-layout> | 180 | </v-layout> |
181 | </v-container> | 181 | </v-container> |
182 | </v-card-text> | 182 | </v-card-text> |
183 | </v-card> | 183 | </v-card> |
184 | </v-dialog> | 184 | </v-dialog> |
185 | 185 | ||
186 | <!-- ****** EXISTING ASSIGNMENT TABLE ****** --> | 186 | <!-- ****** EXISTING ASSIGNMENT TABLE ****** --> |
187 | <v-toolbar color="transparent" flat> | 187 | <v-toolbar color="transparent" flat> |
188 | <v-btn | 188 | <v-btn |
189 | fab | 189 | fab |
190 | dark | 190 | dark |
191 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 191 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
192 | small | 192 | small |
193 | @click="addAssignmentDialog = true" | 193 | @click="addAssignmentDialog = true" |
194 | > | 194 | > |
195 | <v-icon dark>add</v-icon> | 195 | <v-icon dark>add</v-icon> |
196 | </v-btn> | 196 | </v-btn> |
197 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> | 197 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> |
198 | <v-btn round class="open-dialog-button" dark @click="addAssignmentDialog = true"> | 198 | <v-btn round class="open-dialog-button" dark @click="addAssignmentDialog = true"> |
199 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Assignment | 199 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Assignment |
200 | </v-btn> | 200 | </v-btn> |
201 | </v-flex> | 201 | </v-flex> |
202 | <v-spacer></v-spacer> | 202 | <v-spacer></v-spacer> |
203 | <v-flex lg2 md2 xs12 v-show="show"> | 203 | <v-flex lg2 md2 xs12 v-show="show"> |
204 | <v-select | 204 | <v-select |
205 | :items="classList" | 205 | :items="classList" |
206 | placeholder="Select Your Class" | 206 | placeholder="Select Your Class" |
207 | v-model="addAssignment.classId" | 207 | v-model="showAssignment.classId" |
208 | item-text="classNum" | 208 | item-text="classNum" |
209 | item-value="_id" | 209 | item-value="_id" |
210 | name="Select Class" | 210 | name="Select Class" |
211 | :rules="classRules" | 211 | :rules="classRules" |
212 | @change="getAssignmentList()" | 212 | @change="getAssignmentList()" |
213 | class="pl-2" | 213 | class="pl-2" |
214 | required | 214 | required |
215 | ></v-select> | 215 | ></v-select> |
216 | </v-flex> | 216 | </v-flex> |
217 | <v-card-title class="body-1" v-show="show"> | 217 | <v-card-title class="body-1" v-show="show"> |
218 | <v-btn icon flat @click="displaySearch"> | 218 | <v-btn icon flat @click="displaySearch"> |
219 | <v-avatar size="27"> | 219 | <v-avatar size="27"> |
220 | <img src="/static/icon/search.png" alt="icon" /> | 220 | <img src="/static/icon/search.png" alt="icon" /> |
221 | </v-avatar> | 221 | </v-avatar> |
222 | </v-btn> | 222 | </v-btn> |
223 | </v-card-title> | 223 | </v-card-title> |
224 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> | 224 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> |
225 | <v-layout> | 225 | <v-layout> |
226 | <v-text-field | 226 | <v-text-field |
227 | v-model="search" | 227 | v-model="search" |
228 | placeholder="Search" | 228 | placeholder="Search" |
229 | prepend-inner-icon="search" | 229 | prepend-inner-icon="search" |
230 | color="primary" | 230 | color="primary" |
231 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 231 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
232 | ></v-text-field> | 232 | ></v-text-field> |
233 | <v-icon @click="closeSearch" color="error">close</v-icon> | 233 | <v-icon @click="closeSearch" color="error">close</v-icon> |
234 | </v-layout> | 234 | </v-layout> |
235 | </v-flex> | 235 | </v-flex> |
236 | </v-toolbar> | 236 | </v-toolbar> |
237 | <v-data-table | 237 | <v-data-table |
238 | :headers="headers" | 238 | :headers="headers" |
239 | :items="assignmentData" | 239 | :items="assignmentData" |
240 | :pagination.sync="pagination" | 240 | :pagination.sync="pagination" |
241 | :search="search" | 241 | :search="search" |
242 | > | 242 | > |
243 | <template slot="items" slot-scope="props"> | 243 | <template slot="items" slot-scope="props"> |
244 | <tr class="tr"> | 244 | <tr class="tr"> |
245 | <td class="td-row td">{{ props.index + 1 }}</td> | 245 | <td class="td-row td">{{ props.index + 1 }}</td> |
246 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> | 246 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> |
247 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> | 247 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> |
248 | <td class="text-xs-center td td-row">{{ props.item.deadline }}</td> | 248 | <td class="text-xs-center td td-row">{{ props.item.deadline }}</td> |
249 | <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td> | 249 | <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td> |
250 | <td | 250 | <td |
251 | class="text-xs-center td td-row" | 251 | class="text-xs-center td td-row" |
252 | v-if="role != 'ADMIN' " | 252 | v-if="role != 'ADMIN' " |
253 | >{{ props.item.teacherId.name }}</td> | 253 | >{{ props.item.teacherId.name }}</td> |
254 | <td | 254 | <td |
255 | class="text-xs-center td td-row" | 255 | class="text-xs-center td td-row" |
256 | v-if="role != 'TEACHER' " | 256 | v-if="role != 'TEACHER' " |
257 | >{{ props.item.schoolId .name }}</td> | 257 | >{{ props.item.schoolId .name }}</td> |
258 | <td class="text-xs-center td td-row"> | 258 | <td class="text-xs-center td td-row"> |
259 | <v-btn | 259 | <v-btn |
260 | class="add-button" | 260 | class="add-button" |
261 | @click="generatePDF2Canvas(props.item)" | 261 | @click="generatePDF2Canvas(props.item)" |
262 | :loading="loadingPdf" | 262 | :loading="loadingPdf" |
263 | dark | 263 | dark |
264 | >{{ props.item.fileType }}</v-btn> | 264 | >{{ props.item.fileType }}</v-btn> |
265 | </td> | 265 | </td> |
266 | <td class="text-xs-center td td-row"> | 266 | <td class="text-xs-center td td-row"> |
267 | <span> | 267 | <span> |
268 | <v-tooltip top> | 268 | <v-tooltip top> |
269 | <img | 269 | <img |
270 | slot="activator" | 270 | slot="activator" |
271 | style="cursor:pointer; width:25px; height:25px; " | 271 | style="cursor:pointer; width:25px; height:25px; " |
272 | class="mr-3" | 272 | class="mr-3" |
273 | @click="profile(props.item)" | 273 | @click="profile(props.item)" |
274 | src="/static/icon/view.png" | 274 | src="/static/icon/view.png" |
275 | /> | 275 | /> |
276 | <span>View</span> | 276 | <span>View</span> |
277 | </v-tooltip> | 277 | </v-tooltip> |
278 | <v-tooltip top> | 278 | <v-tooltip top> |
279 | <img | 279 | <img |
280 | slot="activator" | 280 | slot="activator" |
281 | style="cursor:pointer; width:20px; height:18px; " | 281 | style="cursor:pointer; width:20px; height:18px; " |
282 | class="mr-3" | 282 | class="mr-3" |
283 | @click="editItem(props.item)" | 283 | @click="editItem(props.item)" |
284 | src="/static/icon/edit.png" | 284 | src="/static/icon/edit.png" |
285 | /> | 285 | /> |
286 | <span>Edit</span> | 286 | <span>Edit</span> |
287 | </v-tooltip> | 287 | </v-tooltip> |
288 | <v-tooltip top> | 288 | <v-tooltip top> |
289 | <img | 289 | <img |
290 | slot="activator" | 290 | slot="activator" |
291 | style="cursor:pointer; width:20px; height:20px; " | 291 | style="cursor:pointer; width:20px; height:20px; " |
292 | class="mr-3" | 292 | class="mr-3" |
293 | @click="deleteItem(props.item)" | 293 | @click="deleteItem(props.item)" |
294 | src="/static/icon/delete.png" | 294 | src="/static/icon/delete.png" |
295 | /> | 295 | /> |
296 | <span>Delete</span> | 296 | <span>Delete</span> |
297 | </v-tooltip> | 297 | </v-tooltip> |
298 | </span> | 298 | </span> |
299 | </td> | 299 | </td> |
300 | </tr> | 300 | </tr> |
301 | </template> | 301 | </template> |
302 | <v-alert | 302 | <v-alert |
303 | slot="no-results" | 303 | slot="no-results" |
304 | :value="true" | 304 | :value="true" |
305 | color="error" | 305 | color="error" |
306 | icon="warning" | 306 | icon="warning" |
307 | >Your search for "{{ search }}" found no results.</v-alert> | 307 | >Your search for "{{ search }}" found no results.</v-alert> |
308 | </v-data-table> | 308 | </v-data-table> |
309 | <!-- ****** ADD MULTIPLE Subject ****** --> | 309 | <!-- ****** ADD MULTIPLE Subject ****** --> |
310 | <v-snackbar | 310 | <v-snackbar |
311 | :timeout="timeout" | 311 | :timeout="timeout" |
312 | :top="y === 'top'" | 312 | :top="y === 'top'" |
313 | :right="x === 'right'" | 313 | :right="x === 'right'" |
314 | :vertical="mode === 'vertical'" | 314 | :vertical="mode === 'vertical'" |
315 | v-model="snackbar" | 315 | v-model="snackbar" |
316 | :color="color" | 316 | :color="color" |
317 | >{{ text }}</v-snackbar> | 317 | >{{ text }}</v-snackbar> |
318 | <v-dialog v-model="addAssignmentDialog" max-width="400px"> | 318 | <v-dialog v-model="addAssignmentDialog" max-width="400px"> |
319 | <v-card flat class="card-style pa-2" dark> | 319 | <v-card flat class="card-style pa-2" dark> |
320 | <v-layout> | 320 | <v-layout> |
321 | <v-flex xs12> | 321 | <v-flex xs12> |
322 | <label class="title text-xs-center">Add Assignment</label> | 322 | <label class="title text-xs-center">Add Assignment</label> |
323 | <v-icon size="24" class="right" @click="addAssignmentDialog = false">cancel</v-icon> | 323 | <v-icon size="24" class="right" @click="addAssignmentDialog = false">cancel</v-icon> |
324 | </v-flex> | 324 | </v-flex> |
325 | </v-layout> | 325 | </v-layout> |
326 | <v-container fluid fill-height> | 326 | <v-container fluid fill-height> |
327 | <v-layout align-center> | 327 | <v-layout align-center> |
328 | <v-flex xs12> | 328 | <v-flex xs12> |
329 | <v-form ref="form" v-model="valid" lazy-validation> | 329 | <v-form ref="form" v-model="valid" lazy-validation> |
330 | <v-layout> | 330 | <v-layout> |
331 | <v-flex xs4 sm4 class="pt-4 subheading"> | 331 | <v-flex xs4 sm4 class="pt-4 subheading"> |
332 | <label class="right">Title :</label> | 332 | <label class="right">Title :</label> |
333 | </v-flex> | 333 | </v-flex> |
334 | <v-flex xs8 sm8 class="ml-3"> | 334 | <v-flex xs8 sm8 class="ml-3"> |
335 | <v-text-field | 335 | <v-text-field |
336 | name="name" | 336 | name="name" |
337 | type="text" | 337 | type="text" |
338 | placeholder="Select Title" | 338 | placeholder="Select Title" |
339 | :rules="titleRules" | 339 | :rules="titleRules" |
340 | v-model="addAssignment.title" | 340 | v-model="addAssignment.title" |
341 | required | 341 | required |
342 | ></v-text-field> | 342 | ></v-text-field> |
343 | </v-flex> | 343 | </v-flex> |
344 | </v-layout> | 344 | </v-layout> |
345 | <v-layout> | 345 | <v-layout> |
346 | <v-flex xs4 sm4 class="pt-4 subheading"> | 346 | <v-flex xs4 sm4 class="pt-4 subheading"> |
347 | <label class="right">Description :</label> | 347 | <label class="right">Description :</label> |
348 | </v-flex> | 348 | </v-flex> |
349 | <v-flex xs8 sm8 class="ml-3"> | 349 | <v-flex xs8 sm8 class="ml-3"> |
350 | <v-text-field | 350 | <v-text-field |
351 | name="name" | 351 | name="name" |
352 | type="text" | 352 | type="text" |
353 | placeholder="Select Description" | 353 | placeholder="Select Description" |
354 | :rules="descriptionRules" | 354 | :rules="descriptionRules" |
355 | v-model="addAssignment.description" | 355 | v-model="addAssignment.description" |
356 | required | 356 | required |
357 | ></v-text-field> | 357 | ></v-text-field> |
358 | </v-flex> | 358 | </v-flex> |
359 | </v-layout> | 359 | </v-layout> |
360 | <v-layout> | 360 | <v-layout> |
361 | <v-flex xs4 sm4 class="pt-4 subheading"> | 361 | <v-flex xs4 sm4 class="pt-4 subheading"> |
362 | <label class="right">Deadline :</label> | 362 | <label class="right">Deadline :</label> |
363 | </v-flex> | 363 | </v-flex> |
364 | <v-flex xs8 sm7 class="ml-3"> | 364 | <v-flex xs8 sm7 class="ml-3"> |
365 | <v-menu | 365 | <v-menu |
366 | ref="menu2" | 366 | ref="menu2" |
367 | :close-on-content-click="false" | 367 | :close-on-content-click="false" |
368 | v-model="menu2" | 368 | v-model="menu2" |
369 | :nudge-right="40" | 369 | :nudge-right="40" |
370 | :return-value.sync="addAssignment.date" | 370 | :return-value.sync="addAssignment.date" |
371 | lazy | 371 | lazy |
372 | transition="scale-transition" | 372 | transition="scale-transition" |
373 | offset-y | 373 | offset-y |
374 | full-width | 374 | full-width |
375 | min-width="290px" | 375 | min-width="290px" |
376 | > | 376 | > |
377 | <v-text-field | 377 | <v-text-field |
378 | slot="activator" | 378 | slot="activator" |
379 | v-model="addAssignment.deadline" | 379 | v-model="addAssignment.deadline" |
380 | :rules="deadlineRules" | 380 | :rules="deadlineRules" |
381 | placeholder="Select Date" | 381 | placeholder="Select Date" |
382 | append-icon="event" | 382 | append-icon="event" |
383 | readonly | 383 | readonly |
384 | ></v-text-field> | 384 | ></v-text-field> |
385 | <v-date-picker | 385 | <v-date-picker |
386 | v-model="addAssignment.deadline" | 386 | v-model="addAssignment.deadline" |
387 | @input="$refs.menu2.save(addAssignment.date)" | 387 | @input="$refs.menu2.save(addAssignment.date)" |
388 | ></v-date-picker> | 388 | ></v-date-picker> |
389 | </v-menu> | 389 | </v-menu> |
390 | </v-flex> | 390 | </v-flex> |
391 | </v-layout> | 391 | </v-layout> |
392 | <v-layout> | 392 | <v-layout> |
393 | <v-flex xs4 sm4 class="pt-4 subheading"> | 393 | <v-flex xs4 sm4 class="pt-4 subheading"> |
394 | <label class="right">Class :</label> | 394 | <label class="right">Class :</label> |
395 | </v-flex> | 395 | </v-flex> |
396 | <v-flex xs8 sm8 class="ml-3"> | 396 | <v-flex xs8 sm8 class="ml-3"> |
397 | <v-select | 397 | <v-select |
398 | :items="classList" | 398 | :items="classList" |
399 | placeholder="Select Class" | 399 | placeholder="Select Class" |
400 | item-text="classNum" | 400 | item-text="classNum" |
401 | item-value="_id" | 401 | item-value="_id" |
402 | v-model="addAssignment.classId" | 402 | v-model="addAssignment.classId" |
403 | name="Select Class" | 403 | name="Select Class" |
404 | :rules="classRules" | 404 | :rules="classRules" |
405 | @change="getSections(addAssignment.classId)" | 405 | @change="getSections(addAssignment.classId)" |
406 | class="pl-2" | 406 | class="pl-2" |
407 | required | 407 | required |
408 | ></v-select> | 408 | ></v-select> |
409 | </v-flex> | 409 | </v-flex> |
410 | </v-layout> | 410 | </v-layout> |
411 | <v-layout> | 411 | <v-layout> |
412 | <v-flex xs4 sm4 class="pt-4 subheading"> | 412 | <v-flex xs4 sm4 class="pt-4 subheading"> |
413 | <label class="right">Section :</label> | 413 | <label class="right">Section :</label> |
414 | </v-flex> | 414 | </v-flex> |
415 | <v-flex xs8 sm8 class="ml-3"> | 415 | <v-flex xs8 sm8 class="ml-3"> |
416 | <v-select | 416 | <v-select |
417 | :items="addSection" | 417 | :items="addSection" |
418 | placeholder="Select Section" | 418 | placeholder="Select Section" |
419 | item-text="name" | 419 | item-text="name" |
420 | item-value="_id" | 420 | item-value="_id" |
421 | v-model="addAssignment.sectionId" | 421 | v-model="addAssignment.sectionId" |
422 | name="Select Section" | 422 | name="Select Section" |
423 | :rules="sectionRules" | 423 | :rules="sectionRules" |
424 | @change="getClassSubject(addAssignment.classId)" | 424 | @change="getClassSubject(addAssignment.classId)" |
425 | class="px-2" | 425 | class="px-2" |
426 | required | 426 | required |
427 | ></v-select> | 427 | ></v-select> |
428 | </v-flex> | 428 | </v-flex> |
429 | </v-layout> | 429 | </v-layout> |
430 | <v-layout> | 430 | <v-layout> |
431 | <v-flex xs3 sm4 class="pt-4 subheading"> | 431 | <v-flex xs3 sm4 class="pt-4 subheading"> |
432 | <label class="right">Subject :</label> | 432 | <label class="right">Subject :</label> |
433 | </v-flex> | 433 | </v-flex> |
434 | <v-flex xs8 sm8 class="ml-2"> | 434 | <v-flex xs8 sm8 class="ml-2"> |
435 | <v-select | 435 | <v-select |
436 | :items="subjectList.subjects" | 436 | :items="subjectList.subjects" |
437 | placeholder="Select your subject" | 437 | placeholder="Select your subject" |
438 | v-model="addAssignment.subjectName" | 438 | v-model="addAssignment.subjectName" |
439 | item-text="subjectName" | 439 | item-text="subjectName" |
440 | item-value="_id" | 440 | item-value="_id" |
441 | :rules="subjectRules" | 441 | :rules="subjectRules" |
442 | required | 442 | required |
443 | ></v-select> | 443 | ></v-select> |
444 | </v-flex> | 444 | </v-flex> |
445 | </v-layout> | 445 | </v-layout> |
446 | <v-layout> | 446 | <v-layout> |
447 | <v-flex xs4 class="pt-4 subheading"> | 447 | <v-flex xs4 class="pt-4 subheading"> |
448 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> | 448 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> |
449 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File:</label> | 449 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File:</label> |
450 | </v-flex> | 450 | </v-flex> |
451 | <v-flex xs8 class="ml-3"> | 451 | <v-flex xs8 class="ml-3"> |
452 | <v-text-field | 452 | <v-text-field |
453 | placeholder="Select File" | 453 | placeholder="Select File" |
454 | @click="pickFile" | 454 | @click="pickFile" |
455 | v-model="imageName" | 455 | v-model="imageName" |
456 | append-icon="attach_file" | 456 | append-icon="attach_file" |
457 | ></v-text-field> | 457 | ></v-text-field> |
458 | <input | 458 | <input |
459 | type="file" | 459 | type="file" |
460 | style="display:none" | 460 | style="display:none" |
461 | ref="image" | 461 | ref="image" |
462 | accept="image/*" | 462 | accept="image/*" |
463 | @change="onFilePicked" | 463 | @change="onFilePicked" |
464 | /> | 464 | /> |
465 | </v-flex> | 465 | </v-flex> |
466 | </v-layout> | 466 | </v-layout> |
467 | <v-layout> | 467 | <v-layout> |
468 | <v-flex xs12 sm12> | 468 | <v-flex xs12 sm12> |
469 | <v-card-actions> | 469 | <v-card-actions> |
470 | <v-spacer></v-spacer> | 470 | <v-spacer></v-spacer> |
471 | <v-btn | 471 | <v-btn |
472 | @click="submit" | 472 | @click="submit" |
473 | round | 473 | round |
474 | dark | 474 | dark |
475 | :loading="loading" | 475 | :loading="loading" |
476 | class="add-button" | 476 | class="add-button" |
477 | >Add Assignment</v-btn> | 477 | >Add Assignment</v-btn> |
478 | </v-card-actions> | 478 | </v-card-actions> |
479 | </v-flex> | 479 | </v-flex> |
480 | </v-layout> | 480 | </v-layout> |
481 | </v-form> | 481 | </v-form> |
482 | </v-flex> | 482 | </v-flex> |
483 | </v-layout> | 483 | </v-layout> |
484 | </v-container> | 484 | </v-container> |
485 | </v-card> | 485 | </v-card> |
486 | </v-dialog> | 486 | </v-dialog> |
487 | <div class="loader" v-if="showLoader"> | 487 | <div class="loader" v-if="showLoader"> |
488 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 488 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
489 | </div> | 489 | </div> |
490 | </v-container> | 490 | </v-container> |
491 | </template> | 491 | </template> |
492 | 492 | ||
493 | <script> | 493 | <script> |
494 | import http from "@/Services/http.js"; | 494 | import http from "@/Services/http.js"; |
495 | import Util from "@/util"; | 495 | import Util from "@/util"; |
496 | import moment from "moment"; | 496 | import moment from "moment"; |
497 | import jsPDF from "jspdf"; | 497 | import jsPDF from "jspdf"; |
498 | import { saveAs } from "file-saver"; | 498 | import { saveAs } from "file-saver"; |
499 | 499 | ||
500 | export default { | 500 | export default { |
501 | data: () => ({ | 501 | data: () => ({ |
502 | snackbar: false, | 502 | snackbar: false, |
503 | role: "", | 503 | role: "", |
504 | menu1: false, | 504 | menu1: false, |
505 | menu2: false, | 505 | menu2: false, |
506 | y: "top", | 506 | y: "top", |
507 | x: "right", | 507 | x: "right", |
508 | mode: "", | 508 | mode: "", |
509 | timeout: 3000, | 509 | timeout: 3000, |
510 | text: "", | 510 | text: "", |
511 | color: "", | 511 | color: "", |
512 | show: true, | 512 | show: true, |
513 | showSearch: false, | 513 | showSearch: false, |
514 | showLoader: false, | 514 | showLoader: false, |
515 | loading: false, | 515 | loading: false, |
516 | editLoading: false, | 516 | editLoading: false, |
517 | date: null, | 517 | date: null, |
518 | search: "", | 518 | search: "", |
519 | viewAssignmentDialog: false, | 519 | viewAssignmentDialog: false, |
520 | editAssignmentDialog: false, | 520 | editAssignmentDialog: false, |
521 | valid: true, | 521 | valid: true, |
522 | validEditAssignment: true, | 522 | validEditAssignment: true, |
523 | addAssignmentDialog: false, | 523 | addAssignmentDialog: false, |
524 | 524 | ||
525 | pagination: { | 525 | pagination: { |
526 | rowsPerPage: 10 | 526 | rowsPerPage: 10 |
527 | }, | 527 | }, |
528 | token: "", | 528 | token: "", |
529 | headers: [ | 529 | headers: [ |
530 | { | 530 | { |
531 | text: "No", | 531 | text: "No", |
532 | align: "", | 532 | align: "", |
533 | sortable: false, | 533 | sortable: false, |
534 | value: "No" | 534 | value: "No" |
535 | }, | 535 | }, |
536 | { | 536 | { |
537 | text: "Title", | 537 | text: "Title", |
538 | value: "title", | 538 | value: "title", |
539 | sortable: false, | 539 | sortable: false, |
540 | align: "center" | 540 | align: "center" |
541 | }, | 541 | }, |
542 | { | 542 | { |
543 | text: "Description", | 543 | text: "Description", |
544 | value: "description", | 544 | value: "description", |
545 | sortable: false, | 545 | sortable: false, |
546 | align: "center" | 546 | align: "center" |
547 | }, | 547 | }, |
548 | { | 548 | { |
549 | text: "Deadline", | 549 | text: "Deadline", |
550 | value: "deadline", | 550 | value: "deadline", |
551 | sortable: false, | 551 | sortable: false, |
552 | align: "center" | 552 | align: "center" |
553 | }, | 553 | }, |
554 | { | 554 | { |
555 | text: "Section", | 555 | text: "Section", |
556 | value: "name", | 556 | value: "name", |
557 | sortable: false, | 557 | sortable: false, |
558 | align: "center" | 558 | align: "center" |
559 | }, | 559 | }, |
560 | { | 560 | { |
561 | text: "Uploader", | 561 | text: "Uploader", |
562 | value: "name", | 562 | value: "name", |
563 | sortable: false, | 563 | sortable: false, |
564 | align: "center" | 564 | align: "center" |
565 | }, | 565 | }, |
566 | { | 566 | { |
567 | text: "File", | 567 | text: "File", |
568 | value: "file", | 568 | value: "file", |
569 | sortable: false, | 569 | sortable: false, |
570 | align: "center" | 570 | align: "center" |
571 | }, | 571 | }, |
572 | { text: "Action", value: "", sortable: false, align: "center" } | 572 | { text: "Action", value: "", sortable: false, align: "center" } |
573 | ], | 573 | ], |
574 | 574 | ||
575 | showPdfData: false, | 575 | showPdfData: false, |
576 | loadingPdf: false, | 576 | loadingPdf: false, |
577 | hideData: true, | 577 | hideData: true, |
578 | 578 | ||
579 | assignmentData: [], | 579 | assignmentData: [], |
580 | subjectList: [], | 580 | subjectList: [], |
581 | classList: [], | 581 | classList: [], |
582 | addSection: [], | 582 | addSection: [], |
583 | editedIndex: -1, | 583 | editedIndex: -1, |
584 | addSubject: {}, | 584 | addSubject: {}, |
585 | 585 | ||
586 | editedItem: { | 586 | editedItem: { |
587 | title: "", | 587 | title: "", |
588 | description: "", | 588 | description: "", |
589 | deadline: "", | 589 | deadline: "", |
590 | classId: "", | 590 | classId: "", |
591 | sectionId: "", | 591 | sectionId: "", |
592 | subjectName: "", | 592 | subjectName: "", |
593 | fileType: "" | 593 | fileType: "" |
594 | }, | 594 | }, |
595 | addAssignment: {}, | 595 | addAssignment: {}, |
596 | showAssignment: {}, | ||
596 | 597 | ||
597 | imageData: {}, | 598 | imageData: {}, |
598 | imageName: "", | 599 | imageName: "", |
599 | imageUrl: "", | 600 | imageUrl: "", |
600 | imageFile: "", | 601 | imageFile: "", |
601 | 602 | ||
602 | titleRules: [v => !!v || " Title is required"], | 603 | titleRules: [v => !!v || " Title is required"], |
603 | descriptionRules: [v => !!v || " Description is required"], | 604 | descriptionRules: [v => !!v || " Description is required"], |
604 | deadlineRules: [v => !!v || " Deadline is required"], | 605 | deadlineRules: [v => !!v || " Deadline is required"], |
605 | classRules: [v => !!v || "Class is required"], | 606 | classRules: [v => !!v || "Class is required"], |
606 | sectionRules: [v => !!v || "Section is required"], | 607 | sectionRules: [v => !!v || "Section is required"], |
607 | subjectRules: [v => !!v || "Student is required"], | 608 | subjectRules: [v => !!v || "Student is required"], |
608 | fileRules: [v => !!v || "File is required"] | 609 | fileRules: [v => !!v || "File is required"] |
609 | }), | 610 | }), |
610 | methods: { | 611 | methods: { |
611 | dates: function(date) { | 612 | dates: function(date) { |
612 | return moment(date).format("MMMM DD, YYYY"); | 613 | return moment(date).format("MMMM DD, YYYY"); |
613 | }, | 614 | }, |
614 | pickFile() { | 615 | pickFile() { |
615 | this.$refs.image.click(); | 616 | this.$refs.image.click(); |
616 | }, | 617 | }, |
617 | editItem(item) { | 618 | editItem(item) { |
618 | this.editedIndex = this.assignmentData; | 619 | this.editedIndex = this.assignmentData; |
619 | this.editedItem = Object.assign({}, item); | 620 | this.editedItem = Object.assign({}, item); |
620 | this.dialog = true; | 621 | this.dialog = true; |
621 | this.editAssignmentDialog = true; | 622 | this.editAssignmentDialog = true; |
622 | }, | 623 | }, |
623 | profile(item) { | 624 | profile(item) { |
624 | this.editedIndex = this.assignmentData; | 625 | this.editedIndex = this.assignmentData; |
625 | this.editedItem = Object.assign({}, item); | 626 | this.editedItem = Object.assign({}, item); |
626 | this.dialog1 = true; | 627 | this.dialog1 = true; |
627 | this.viewAssignmentDialog = true; | 628 | this.viewAssignmentDialog = true; |
628 | }, | 629 | }, |
629 | deleteItem(item) { | 630 | deleteItem(item) { |
630 | let deleteAssignment = { | 631 | let deleteAssignment = { |
631 | assignmentId: item._id | 632 | assignmentId: item._id |
632 | }; | 633 | }; |
633 | http() | 634 | http() |
634 | .delete( | 635 | .delete( |
635 | "/deleteAssignment", | 636 | "/deleteAssignment", |
636 | confirm("Are you sure you want to delete this?") && { | 637 | confirm("Are you sure you want to delete this?") && { |
637 | params: deleteAssignment | 638 | params: deleteAssignment |
638 | }, | 639 | }, |
639 | { | 640 | { |
640 | headers: { Authorization: "Bearer " + this.token } | 641 | headers: { Authorization: "Bearer " + this.token } |
641 | } | 642 | } |
642 | ) | 643 | ) |
643 | .then(response => { | 644 | .then(response => { |
644 | this.getAssignmentList(); | 645 | this.getAssignmentList(); |
645 | this.snackbar = true; | 646 | this.snackbar = true; |
646 | this.text = "Successfully delete Existing Assignment"; | 647 | this.text = "Successfully delete Existing Assignment"; |
647 | this.color = "green"; | 648 | this.color = "green"; |
648 | }) | 649 | }) |
649 | .catch(error => { | 650 | .catch(error => { |
650 | this.snackbar = true; | 651 | this.snackbar = true; |
651 | this.text = error.response.data.message; | 652 | this.text = error.response.data.message; |
652 | this.color = "error"; | 653 | this.color = "error"; |
653 | }); | 654 | }); |
654 | }, | 655 | }, |
655 | close() { | 656 | close() { |
656 | this.editAssignmentDialog = false; | 657 | this.editAssignmentDialog = false; |
657 | }, | 658 | }, |
658 | close1() { | 659 | close1() { |
659 | this.viewAssignmentDialog = false; | 660 | this.viewAssignmentDialog = false; |
660 | }, | 661 | }, |
661 | submit() { | 662 | submit() { |
662 | var addAssignment = { | 663 | var addAssignment = { |
663 | title: this.addAssignment.title, | 664 | title: this.addAssignment.title, |
664 | description: this.addAssignment.description, | 665 | description: this.addAssignment.description, |
665 | deadline: this.addAssignment.deadline, | 666 | deadline: this.addAssignment.deadline, |
666 | classId: this.addAssignment.classId, | 667 | classId: this.addAssignment.classId, |
667 | sectionId: this.addAssignment.sectionId, | 668 | sectionId: this.addAssignment.sectionId, |
668 | subjectName: this.addAssignment.subjectName, | 669 | subjectName: this.addAssignment.subjectName, |
669 | file: this.addAssignment.imageName, | 670 | file: this.addAssignment.imageName, |
670 | fileName: this.imageName | 671 | fileName: this.imageName |
671 | }; | 672 | }; |
672 | var signatures = { | 673 | var signatures = { |
673 | JVBERi0: "other", | 674 | JVBERi0: "other", |
674 | iVBORw0KGgo: "image", | 675 | iVBORw0KGgo: "image", |
675 | UEsDBBQ: "other", | 676 | UEsDBBQ: "other", |
676 | "/": "image", | 677 | "/": "image", |
677 | AAABAA: "image", | 678 | AAABAA: "image", |
678 | IywiV2hhdC: "other", | 679 | IywiV2hhdC: "other", |
679 | bmFtZSxl: "other" | 680 | bmFtZSxl: "other" |
680 | }; | 681 | }; |
681 | function detectMimeType(b64) { | 682 | function detectMimeType(b64) { |
682 | for (var s in signatures) { | 683 | for (var s in signatures) { |
683 | if (b64.indexOf(s) === 0) { | 684 | if (b64.indexOf(s) === 0) { |
684 | return signatures[s]; | 685 | return signatures[s]; |
685 | } | 686 | } |
686 | } | 687 | } |
687 | } | 688 | } |
688 | if (this.$refs.form.validate()) { | 689 | if (this.$refs.form.validate()) { |
689 | if (this.imageUrl) { | 690 | if (this.imageUrl) { |
690 | var str = this.imageUrl; | 691 | var str = this.imageUrl; |
691 | const [baseUrl, imageUrl] = str.split(/,/); | 692 | const [baseUrl, imageUrl] = str.split(/,/); |
692 | addAssignment.upload = imageUrl; | 693 | addAssignment.upload = imageUrl; |
693 | addAssignment.fileType = detectMimeType(imageUrl); | 694 | addAssignment.fileType = detectMimeType(imageUrl); |
694 | } | 695 | } |
695 | console.log("data===>", addAssignment); | 696 | console.log("data===>", addAssignment); |
696 | http() | 697 | http() |
697 | .post("/createAssignment", addAssignment) | 698 | .post("/createAssignment", addAssignment) |
698 | .then(response => { | 699 | .then(response => { |
699 | this.getAssignmentList(); | 700 | this.getAssignmentList(); |
700 | this.snackbar = true; | 701 | this.snackbar = true; |
701 | this.text = "Syllabus added successfully"; | 702 | this.text = "Syllabus added successfully"; |
702 | this.color = "green"; | 703 | this.color = "green"; |
703 | this.addAssignmentDialog = false; | 704 | this.addAssignmentDialog = false; |
704 | this.clear(); | 705 | this.clear(); |
705 | }) | 706 | }) |
706 | .catch(error => { | 707 | .catch(error => { |
707 | // console.log(error); | 708 | // console.log(error); |
708 | this.snackbar = true; | 709 | this.snackbar = true; |
709 | this.text = error.response.data.message; | 710 | this.text = error.response.data.message; |
710 | this.color = "red"; | 711 | this.color = "red"; |
711 | }); | 712 | }); |
712 | } | 713 | } |
713 | }, | 714 | }, |
714 | getAssignmentList() { | 715 | getAssignmentList() { |
715 | if (this.addAssignment.classId) { | 716 | if (this.addAssignment.classId) { |
716 | this.addAssignment.classId = this.addAssignment.classId; | 717 | this.addAssignment.classId = this.addAssignment.classId; |
717 | } | 718 | } |
718 | this.showLoader = true; | 719 | this.showLoader = true; |
719 | http() | 720 | http() |
720 | .get( | 721 | .get( |
721 | "/getAssignmentList", | 722 | "/getAssignmentList", |
722 | { | 723 | { |
723 | params: { classId: this.addAssignment.classId } | 724 | params: { classId: this.showAssignment.classId } |
724 | }, | 725 | }, |
725 | { | 726 | { |
726 | headers: { Authorization: "Bearer " + this.token } | 727 | headers: { Authorization: "Bearer " + this.token } |
727 | } | 728 | } |
728 | ) | 729 | ) |
729 | .then(response => { | 730 | .then(response => { |
730 | this.assignmentData = response.data.data; | 731 | this.assignmentData = response.data.data; |
731 | this.showLoader = false; | 732 | this.showLoader = false; |
732 | this.loadingSearch = false; | 733 | this.loadingSearch = false; |
733 | }) | 734 | }) |
734 | .catch(error => { | 735 | .catch(error => { |
735 | // console.log("err====>", err); | 736 | // console.log("err====>", err); |
736 | this.showLoader = false; | 737 | this.showLoader = false; |
737 | this.loadingSearch = false; | 738 | this.loadingSearch = false; |
738 | this.snackbar = true; | 739 | this.snackbar = true; |
739 | this.text = error.response.data.message; | 740 | this.text = error.response.data.message; |
740 | if (error.response.status === 401) { | 741 | if (error.response.status === 401) { |
741 | this.$router.replace({ path: "/" }); | 742 | this.$router.replace({ path: "/" }); |
742 | this.$store.dispatch("setToken", null); | 743 | this.$store.dispatch("setToken", null); |
743 | this.$store.dispatch("Id", null); | 744 | this.$store.dispatch("Id", null); |
744 | } | 745 | } |
745 | }); | 746 | }); |
746 | }, | 747 | }, |
747 | clear() { | 748 | clear() { |
748 | this.$refs.form.reset(); | 749 | this.$refs.form.reset(); |
749 | }, | 750 | }, |
750 | save() { | 751 | save() { |
751 | if (this.$refs.formEditAssignment.validate()) { | 752 | if (this.$refs.formEditAssignment.validate()) { |
752 | let editAssignment = { | 753 | let editAssignment = { |
753 | assignmentId: this.editedItem._id, | 754 | assignmentId: this.editedItem._id, |
754 | title: this.addAssignment.title, | 755 | title: this.addAssignment.title, |
755 | description: this.addAssignment.description, | 756 | description: this.addAssignment.description, |
756 | deadline: this.addAssignment.deadline, | 757 | deadline: this.addAssignment.deadline, |
757 | classId: this.addAssignment.classId, | 758 | classId: this.addAssignment.classId, |
758 | sectionId: this.addAssignment.sectionId, | 759 | sectionId: this.addAssignment.sectionId, |
759 | subjectName: this.addAssignment.subjectName, | 760 | subjectName: this.addAssignment.subjectName, |
760 | file: this.addAssignment.imageName, | 761 | file: this.addAssignment.imageName, |
761 | fileName: this.imageName | 762 | fileName: this.imageName |
762 | }; | 763 | }; |
763 | this.editLoading = true; | 764 | this.editLoading = true; |
764 | var signatures = { | 765 | var signatures = { |
765 | JVBERi0: "other", | 766 | JVBERi0: "other", |
766 | iVBORw0KGgo: "image", | 767 | iVBORw0KGgo: "image", |
767 | UEsDBBQ: "other", | 768 | UEsDBBQ: "other", |
768 | "/": "image", | 769 | "/": "image", |
769 | AAABAA: "image", | 770 | AAABAA: "image", |
770 | IywiV2hhdC: "other", | 771 | IywiV2hhdC: "other", |
771 | bmFtZSxl: "other" | 772 | bmFtZSxl: "other" |
772 | }; | 773 | }; |
773 | function detectMimeType(b64) { | 774 | function detectMimeType(b64) { |
774 | for (var s in signatures) { | 775 | for (var s in signatures) { |
775 | if (b64.indexOf(s) === 0) { | 776 | if (b64.indexOf(s) === 0) { |
776 | return signatures[s]; | 777 | return signatures[s]; |
777 | } | 778 | } |
778 | } | 779 | } |
779 | } | 780 | } |
780 | if (this.imageUrl) { | 781 | if (this.imageUrl) { |
781 | var str = this.imageUrl; | 782 | var str = this.imageUrl; |
782 | const [baseUrl, imageUrl] = str.split(/,/); | 783 | const [baseUrl, imageUrl] = str.split(/,/); |
783 | editAssignment.upload = imageUrl; | 784 | editAssignment.upload = imageUrl; |
784 | editAssignment.fileType = detectMimeType(imageUrl); | 785 | editAssignment.fileType = detectMimeType(imageUrl); |
785 | } | 786 | } |
786 | http() | 787 | http() |
787 | .put("/updateAssignment", editAssignment) | 788 | .put("/updateAssignment", editAssignment) |
788 | .then(response => { | 789 | .then(response => { |
789 | this.snackbar = true; | 790 | this.snackbar = true; |
790 | this.text = "Successfully Edit Existing Assignment"; | 791 | this.text = "Successfully Edit Existing Assignment"; |
791 | this.color = "green"; | 792 | this.color = "green"; |
792 | this.editLoading = false; | 793 | this.editLoading = false; |
793 | this.editAssignmentDialog = false; | 794 | this.editAssignmentDialog = false; |
794 | this.getAssignmentList(); | 795 | this.getAssignmentList(); |
795 | }) | 796 | }) |
796 | .catch(error => { | 797 | .catch(error => { |
797 | this.editLoading = false; | 798 | this.editLoading = false; |
798 | // console.log(error); | 799 | // console.log(error); |
799 | }); | 800 | }); |
800 | } | 801 | } |
801 | }, | 802 | }, |
802 | getClass() { | 803 | getClass() { |
803 | http() | 804 | http() |
804 | .get("/getClassesList", { | 805 | .get("/getClassesList", { |
805 | headers: { Authorization: "Bearer " + this.token } | 806 | headers: { Authorization: "Bearer " + this.token } |
806 | }) | 807 | }) |
807 | .then(response => { | 808 | .then(response => { |
808 | this.classList = response.data.data; | 809 | this.classList = response.data.data; |
809 | }) | 810 | }) |
810 | .catch(error => { | 811 | .catch(error => { |
811 | if (error.response.status === 401) { | 812 | if (error.response.status === 401) { |
812 | this.$router.replace({ path: "/" }); | 813 | this.$router.replace({ path: "/" }); |
813 | this.$store.dispatch("setToken", null); | 814 | this.$store.dispatch("setToken", null); |
814 | this.$store.dispatch("Id", null); | 815 | this.$store.dispatch("Id", null); |
815 | } | 816 | } |
816 | }); | 817 | }); |
817 | }, | 818 | }, |
818 | getSections(_id) { | 819 | getSections(_id) { |
819 | var token = this.$store.state.token; | 820 | var token = this.$store.state.token; |
820 | this.showLoader = true; | 821 | this.showLoader = true; |
821 | http() | 822 | http() |
822 | .get( | 823 | .get( |
823 | "/getSectionsList", | 824 | "/getSectionsList", |
824 | { params: { classId: _id } }, | 825 | { params: { classId: _id } }, |
825 | { | 826 | { |
826 | headers: { Authorization: "Bearer " + token } | 827 | headers: { Authorization: "Bearer " + token } |
827 | } | 828 | } |
828 | ) | 829 | ) |
829 | .then(response => { | 830 | .then(response => { |
830 | this.addSection = response.data.data; | 831 | this.addSection = response.data.data; |
831 | this.showLoader = false; | 832 | this.showLoader = false; |
832 | }) | 833 | }) |
833 | .catch(err => { | 834 | .catch(err => { |
834 | this.showLoader = false; | 835 | this.showLoader = false; |
835 | }); | 836 | }); |
836 | }, | 837 | }, |
837 | getClassSubject(_id) { | 838 | getClassSubject(_id) { |
838 | this.showLoader = true; | 839 | this.showLoader = true; |
839 | // this.classId = this.classId; | 840 | // this.classId = this.classId; |
840 | http() | 841 | http() |
841 | .get( | 842 | .get( |
842 | "/getParticularClass", | 843 | "/getParticularClass", |
843 | { params: { classId: _id } }, | 844 | { params: { classId: _id } }, |
844 | { | 845 | { |
845 | headers: { Authorization: "Bearer " + this.token } | 846 | headers: { Authorization: "Bearer " + this.token } |
846 | } | 847 | } |
847 | ) | 848 | ) |
848 | .then(response => { | 849 | .then(response => { |
849 | this.subjectList = response.data.data; | 850 | this.subjectList = response.data.data; |
850 | this.showLoader = false; | 851 | this.showLoader = false; |
851 | }) | 852 | }) |
852 | .catch(err => { | 853 | .catch(err => { |
853 | this.showLoader = false; | 854 | this.showLoader = false; |
854 | }); | 855 | }); |
855 | }, | 856 | }, |
856 | onFilePicked(e) { | 857 | onFilePicked(e) { |
857 | const files = e.target.files; | 858 | const files = e.target.files; |
858 | this.upload = e.target.files[0]; | 859 | this.upload = e.target.files[0]; |
859 | if (files[0] !== undefined) { | 860 | if (files[0] !== undefined) { |
860 | this.imageName = files[0].name; | 861 | this.imageName = files[0].name; |
861 | if (this.imageName.lastIndexOf(".") <= 0) { | 862 | if (this.imageName.lastIndexOf(".") <= 0) { |
862 | return; | 863 | return; |
863 | } | 864 | } |
864 | const fr = new FileReader(); | 865 | const fr = new FileReader(); |
865 | fr.readAsDataURL(files[0]); | 866 | fr.readAsDataURL(files[0]); |
866 | fr.addEventListener("load", () => { | 867 | fr.addEventListener("load", () => { |
867 | this.imageUrl = fr.result; | 868 | this.imageUrl = fr.result; |
868 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 869 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
869 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 870 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
870 | }); | 871 | }); |
871 | console.log("this.imageName", this.imageName); | 872 | console.log("this.imageName", this.imageName); |
872 | } else { | 873 | } else { |
873 | this.imageName = ""; | 874 | this.imageName = ""; |
874 | this.imageFile = ""; | 875 | this.imageFile = ""; |
875 | this.imageUrl = ""; | 876 | this.imageUrl = ""; |
876 | } | 877 | } |
877 | }, | 878 | }, |
878 | displaySearch() { | 879 | displaySearch() { |
879 | (this.show = false), (this.showSearch = true); | 880 | (this.show = false), (this.showSearch = true); |
880 | }, | 881 | }, |
881 | closeSearch() { | 882 | closeSearch() { |
882 | this.showSearch = false; | 883 | this.showSearch = false; |
883 | this.show = true; | 884 | this.show = true; |
884 | this.search = ""; | 885 | this.search = ""; |
885 | }, | 886 | }, |
886 | 887 | ||
887 | async generatePDF2Canvas(item) { | 888 | async generatePDF2Canvas(item) { |
888 | var dataType = ""; | 889 | var dataType = ""; |
889 | var type = ""; | 890 | var type = ""; |
890 | if (item.fileType == "image") { | 891 | if (item.fileType == "image") { |
891 | dataType = "file.jpg"; | 892 | dataType = "file.jpg"; |
892 | } else if (item.fileType == "other") { | 893 | } else if (item.fileType == "other") { |
893 | dataType = "file.pdf"; | 894 | dataType = "file.pdf"; |
894 | type = "application/pdf"; | 895 | type = "application/pdf"; |
895 | } | 896 | } |
896 | var FileSaver = require("file-saver"); | 897 | var FileSaver = require("file-saver"); |
897 | FileSaver.saveAs(item.file, "image.jpg"); | 898 | FileSaver.saveAs(item.file, "image.jpg"); |
898 | } | 899 | } |
899 | }, | 900 | }, |
900 | mounted() { | 901 | mounted() { |
901 | this.token = this.$store.state.token; | 902 | this.token = this.$store.state.token; |
902 | this.role = this.$store.state.role; | 903 | this.role = this.$store.state.role; |
903 | this.getClass(); | 904 | this.getClass(); |
904 | } | 905 | } |
905 | }; | 906 | }; |
906 | </script> | 907 | </script> |
src/pages/Academic/subject.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="editSubjectDialog" max-width="600px"> | 4 | <v-dialog v-model="editSubjectDialog" 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 Subject</label> |
9 | <v-icon size="24" class="right" @click="editSubjectDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editSubjectDialog = 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="formEditSubject" v-model="validEditSubject" lazy-validation> | 13 | <v-form ref="formEditSubject" v-model="validEditSubject" lazy-validation> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs4 class="pt-4 subheading"> | 15 | <v-flex xs4 class="pt-4 subheading"> |
16 | <label class="right">Class:</label> | 16 | <label class="right">Class:</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs8 class="ml-3"> | 18 | <v-flex xs8 class="ml-3"> |
19 | <v-select | 19 | <v-select |
20 | v-model="editedItem.classId" | 20 | v-model="editedItem.classId" |
21 | label="Select your class" | 21 | label="Select your class" |
22 | type="text" | 22 | type="text" |
23 | :items="classList" | 23 | :items="classList" |
24 | item-text="classNum" | 24 | item-text="classNum" |
25 | item-value="_id" | 25 | item-value="_id" |
26 | :rules="classRules" | 26 | :rules="classRules" |
27 | required | 27 | required |
28 | ></v-select> | 28 | ></v-select> |
29 | </v-flex> | 29 | </v-flex> |
30 | </v-layout> | 30 | </v-layout> |
31 | <v-layout> | 31 | <v-layout> |
32 | <v-flex xs4 sm4 class="pt-4 subheading"> | 32 | <v-flex xs4 sm4 class="pt-4 subheading"> |
33 | <label class="right">Teacher Name :</label> | 33 | <label class="right">Teacher Name :</label> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs8 sm8 class="ml-3"> | 35 | <v-flex xs8 sm8 class="ml-3"> |
36 | <v-select | 36 | <v-select |
37 | v-model="editedItem.teacherId" | 37 | v-model="editedItem.teacherId" |
38 | label="Select your teacher" | 38 | label="Select your teacher" |
39 | type="text" | 39 | type="text" |
40 | :items="teacherList" | 40 | :items="teacherList" |
41 | item-text="name" | 41 | item-text="name" |
42 | item-value="_id" | 42 | item-value="_id" |
43 | :rules="teacherRules" | 43 | :rules="teacherRules" |
44 | required | 44 | required |
45 | ></v-select> | 45 | ></v-select> |
46 | </v-flex> | 46 | </v-flex> |
47 | </v-layout> | 47 | </v-layout> |
48 | <v-layout> | 48 | <v-layout> |
49 | <v-flex xs4 sm4 class="pt-4 sybheading"> | 49 | <v-flex xs4 sm4 class="pt-4 sybheading"> |
50 | <label class="right">Type :</label> | 50 | <label class="right">Type :</label> |
51 | </v-flex> | 51 | </v-flex> |
52 | <v-flex xs8 sm8 class="ml-3"> | 52 | <v-flex xs8 sm8 class="ml-3"> |
53 | <v-select | 53 | <v-select |
54 | v-model="editedItem.type" | 54 | v-model="editedItem.type" |
55 | :items="type" | 55 | :items="type" |
56 | label="Select your Type" | 56 | label="Select your Type" |
57 | :rules="typeRules" | 57 | :rules="typeRules" |
58 | required | 58 | required |
59 | ></v-select> | 59 | ></v-select> |
60 | </v-flex> | 60 | </v-flex> |
61 | </v-layout> | 61 | </v-layout> |
62 | <v-layout> | 62 | <v-layout> |
63 | <v-flex xs4 sm4 class="pt-4 subheading"> | 63 | <v-flex xs4 sm4 class="pt-4 subheading"> |
64 | <label class="right">Pass Mark :</label> | 64 | <label class="right">Pass Mark :</label> |
65 | </v-flex> | 65 | </v-flex> |
66 | <v-flex xs8 sm8 class="ml-3"> | 66 | <v-flex xs8 sm8 class="ml-3"> |
67 | <v-text-field | 67 | <v-text-field |
68 | label="Fill your Pass Mark" | 68 | label="Fill your Pass Mark" |
69 | name="name" | 69 | name="name" |
70 | type="text" | 70 | type="text" |
71 | :rules="markRules" | 71 | :rules="markRules" |
72 | v-model="editedItem.passMarks" | 72 | v-model="editedItem.passMarks" |
73 | required | 73 | required |
74 | ></v-text-field> | 74 | ></v-text-field> |
75 | </v-flex> | 75 | </v-flex> |
76 | </v-layout> | 76 | </v-layout> |
77 | <v-layout> | 77 | <v-layout> |
78 | <v-flex xs4 sm4 class="pt-4 subheading"> | 78 | <v-flex xs4 sm4 class="pt-4 subheading"> |
79 | <label class="right">Final Mark :</label> | 79 | <label class="right">Final Mark :</label> |
80 | </v-flex> | 80 | </v-flex> |
81 | <v-flex xs8 sm8 class="ml-3"> | 81 | <v-flex xs8 sm8 class="ml-3"> |
82 | <v-text-field | 82 | <v-text-field |
83 | label="Fill your final mark" | 83 | label="Fill your final mark" |
84 | name="name" | 84 | name="name" |
85 | type="text" | 85 | type="text" |
86 | :rules="finalRules" | 86 | :rules="finalRules" |
87 | v-model="editedItem.finalMarks" | 87 | v-model="editedItem.finalMarks" |
88 | required | 88 | required |
89 | ></v-text-field> | 89 | ></v-text-field> |
90 | </v-flex> | 90 | </v-flex> |
91 | </v-layout> | 91 | </v-layout> |
92 | <v-layout> | 92 | <v-layout> |
93 | <v-flex xs4 class="pt-4 subheading"> | 93 | <v-flex xs4 class="pt-4 subheading"> |
94 | <label class="right">Subject:</label> | 94 | <label class="right">Subject:</label> |
95 | </v-flex> | 95 | </v-flex> |
96 | <v-flex xs8 class="ml-3"> | 96 | <v-flex xs8 class="ml-3"> |
97 | <v-text-field | 97 | <v-text-field |
98 | placeholder="fill your Subject" | 98 | placeholder="fill your Subject" |
99 | v-model="editedItem.subjectName" | 99 | v-model="editedItem.subjectName" |
100 | :rules="subjectRules" | 100 | :rules="subjectRules" |
101 | type="text" | 101 | type="text" |
102 | name="email" | 102 | name="email" |
103 | required | 103 | required |
104 | ></v-text-field> | 104 | ></v-text-field> |
105 | </v-flex> | 105 | </v-flex> |
106 | </v-layout> | 106 | </v-layout> |
107 | <v-layout> | 107 | <v-layout> |
108 | <v-flex xs4 sm4 class="pt-4 subheading"> | 108 | <v-flex xs4 sm4 class="pt-4 subheading"> |
109 | <label class="right">Subject Author :</label> | 109 | <label class="right">Subject Author :</label> |
110 | </v-flex> | 110 | </v-flex> |
111 | <v-flex xs8 sm8 class="ml-3"> | 111 | <v-flex xs8 sm8 class="ml-3"> |
112 | <v-text-field | 112 | <v-text-field |
113 | v-model="editedItem.subjectAuthor" | 113 | v-model="editedItem.subjectAuthor" |
114 | placeholder="fill your Subject Author" | 114 | placeholder="fill your Subject Author" |
115 | name="name" | 115 | name="name" |
116 | type="text" | 116 | type="text" |
117 | ></v-text-field> | 117 | ></v-text-field> |
118 | </v-flex> | 118 | </v-flex> |
119 | </v-layout> | 119 | </v-layout> |
120 | <v-layout> | 120 | <v-layout> |
121 | <v-flex xs4 sm4 class="pt-4 subheading"> | 121 | <v-flex xs4 sm4 class="pt-4 subheading"> |
122 | <label class="right">Subject Code:</label> | 122 | <label class="right">Subject Code:</label> |
123 | </v-flex> | 123 | </v-flex> |
124 | <v-flex xs8 sm8 class="ml-3"> | 124 | <v-flex xs8 sm8 class="ml-3"> |
125 | <v-text-field | 125 | <v-text-field |
126 | v-model="editedItem.subjectCode" | 126 | v-model="editedItem.subjectCode" |
127 | placeholder="fill your Subject Code" | 127 | placeholder="fill your Subject Code" |
128 | name="name" | 128 | name="name" |
129 | type="text" | 129 | type="text" |
130 | ></v-text-field> | 130 | ></v-text-field> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | <v-flex xs12 sm12> | 133 | <v-flex xs12 sm12> |
134 | <v-card-actions> | 134 | <v-card-actions> |
135 | <v-spacer></v-spacer> | 135 | <v-spacer></v-spacer> |
136 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Update Subject</v-btn> | 136 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Update Subject</v-btn> |
137 | </v-card-actions> | 137 | </v-card-actions> |
138 | </v-flex> | 138 | </v-flex> |
139 | </v-form> | 139 | </v-form> |
140 | </v-container> | 140 | </v-container> |
141 | </v-card> | 141 | </v-card> |
142 | </v-dialog> | 142 | </v-dialog> |
143 | 143 | ||
144 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> | 144 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> |
145 | 145 | ||
146 | <v-dialog v-model="viewSubjectDialog" max-width="500px"> | 146 | <v-dialog v-model="viewSubjectDialog" max-width="500px"> |
147 | <v-card flat class="card-style pa-3" dark> | 147 | <v-card flat class="card-style pa-3" dark> |
148 | <v-layout> | 148 | <v-layout> |
149 | <v-flex xs12> | 149 | <v-flex xs12> |
150 | <label class="title text-xs-center">View Subject</label> | 150 | <label class="title text-xs-center">View Subject</label> |
151 | <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon> | 151 | <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon> |
152 | </v-flex> | 152 | </v-flex> |
153 | </v-layout> | 153 | </v-layout> |
154 | <v-card-text> | 154 | <v-card-text> |
155 | <v-container grid-list-md> | 155 | <v-container grid-list-md> |
156 | <v-layout wrap> | 156 | <v-layout wrap> |
157 | <v-flex> | 157 | <v-flex> |
158 | <v-layout> | 158 | <v-layout> |
159 | <v-flex xs6 sm4> | 159 | <v-flex xs6 sm4> |
160 | <h5 class="right my-1"> | 160 | <h5 class="right my-1"> |
161 | <b>Subject Name:</b> | 161 | <b>Subject Name:</b> |
162 | </h5> | 162 | </h5> |
163 | </v-flex> | 163 | </v-flex> |
164 | <v-flex sm8 xs6> | 164 | <v-flex sm8 xs6> |
165 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> | 165 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> |
166 | </v-flex> | 166 | </v-flex> |
167 | </v-layout> | 167 | </v-layout> |
168 | <v-layout> | 168 | <v-layout> |
169 | <v-flex xs6 sm4> | 169 | <v-flex xs6 sm4> |
170 | <h5 class="right my-1"> | 170 | <h5 class="right my-1"> |
171 | <b>Subject Author:</b> | 171 | <b>Subject Author:</b> |
172 | </h5> | 172 | </h5> |
173 | </v-flex> | 173 | </v-flex> |
174 | <v-flex sm8 xs6> | 174 | <v-flex sm8 xs6> |
175 | <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5> | 175 | <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5> |
176 | </v-flex> | 176 | </v-flex> |
177 | </v-layout> | 177 | </v-layout> |
178 | <v-layout> | 178 | <v-layout> |
179 | <v-flex xs6 sm4> | 179 | <v-flex xs6 sm4> |
180 | <h5 class="right my-1"> | 180 | <h5 class="right my-1"> |
181 | <b>Subject :</b> | 181 | <b>Subject :</b> |
182 | </h5> | 182 | </h5> |
183 | </v-flex> | 183 | </v-flex> |
184 | <v-flex sm8 xs6> | 184 | <v-flex sm8 xs6> |
185 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> | 185 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> |
186 | </v-flex> | 186 | </v-flex> |
187 | </v-layout> | 187 | </v-layout> |
188 | <!-- <v-layout> | 188 | <!-- <v-layout> |
189 | <v-flex xs6 sm4> | 189 | <v-flex xs6 sm4> |
190 | <h5 class="right my-1"> | 190 | <h5 class="right my-1"> |
191 | <b>Teacher :</b> | 191 | <b>Teacher :</b> |
192 | </h5> | 192 | </h5> |
193 | </v-flex> | 193 | </v-flex> |
194 | <v-flex sm8 xs6> | 194 | <v-flex sm8 xs6> |
195 | <h5 class="my-1">{{ editedItem.teacherId }}</h5> | 195 | <h5 class="my-1">{{ editedItem.teacherId }}</h5> |
196 | </v-flex> | 196 | </v-flex> |
197 | </v-layout>--> | 197 | </v-layout>--> |
198 | <v-layout> | 198 | <v-layout> |
199 | <v-flex xs6 sm4> | 199 | <v-flex xs6 sm4> |
200 | <h5 class="right my-1"> | 200 | <h5 class="right my-1"> |
201 | <b>Pass Marks :</b> | 201 | <b>Pass Marks :</b> |
202 | </h5> | 202 | </h5> |
203 | </v-flex> | 203 | </v-flex> |
204 | <v-flex sm8 xs6> | 204 | <v-flex sm8 xs6> |
205 | <h5 class="my-1">{{ editedItem.passMarks }}</h5> | 205 | <h5 class="my-1">{{ editedItem.passMarks }}</h5> |
206 | </v-flex> | 206 | </v-flex> |
207 | </v-layout> | 207 | </v-layout> |
208 | <v-layout> | 208 | <v-layout> |
209 | <v-flex xs6 sm4> | 209 | <v-flex xs6 sm4> |
210 | <h5 class="right my-1"> | 210 | <h5 class="right my-1"> |
211 | <b>Final Marks :</b> | 211 | <b>Final Marks :</b> |
212 | </h5> | 212 | </h5> |
213 | </v-flex> | 213 | </v-flex> |
214 | <v-flex sm8 xs6> | 214 | <v-flex sm8 xs6> |
215 | <h5 class="my-1">{{ editedItem.finalMarks }}</h5> | 215 | <h5 class="my-1">{{ editedItem.finalMarks }}</h5> |
216 | </v-flex> | 216 | </v-flex> |
217 | </v-layout> | 217 | </v-layout> |
218 | <v-layout> | 218 | <v-layout> |
219 | <v-flex xs6 sm4> | 219 | <v-flex xs6 sm4> |
220 | <h5 class="right my-1"> | 220 | <h5 class="right my-1"> |
221 | <b>Type :</b> | 221 | <b>Type :</b> |
222 | </h5> | 222 | </h5> |
223 | </v-flex> | 223 | </v-flex> |
224 | <v-flex sm8 xs6> | 224 | <v-flex sm8 xs6> |
225 | <h5 class="my-1">{{ editedItem.type }}</h5> | 225 | <h5 class="my-1">{{ editedItem.type }}</h5> |
226 | </v-flex> | 226 | </v-flex> |
227 | </v-layout> | 227 | </v-layout> |
228 | </v-flex> | 228 | </v-flex> |
229 | </v-layout> | 229 | </v-layout> |
230 | </v-container> | 230 | </v-container> |
231 | </v-card-text> | 231 | </v-card-text> |
232 | </v-card> | 232 | </v-card> |
233 | </v-dialog> | 233 | </v-dialog> |
234 | 234 | ||
235 | <!-- ****** EXISTING SUBJECTS TABLE ****** --> | 235 | <!-- ****** EXISTING SUBJECTS TABLE ****** --> |
236 | <v-toolbar color="transparent" flat> | 236 | <v-toolbar color="transparent" flat> |
237 | <v-btn | 237 | <v-btn |
238 | fab | 238 | fab |
239 | dark | 239 | dark |
240 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 240 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
241 | small | 241 | small |
242 | @click="addSubjectDialog = true" | 242 | @click="addSubjectDialog = true" |
243 | > | 243 | > |
244 | <v-icon dark>add</v-icon> | 244 | <v-icon dark>add</v-icon> |
245 | </v-btn> | 245 | </v-btn> |
246 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> | 246 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> |
247 | <v-btn | 247 | <v-btn |
248 | round | 248 | round |
249 | class="open-dialog-button" | 249 | class="open-dialog-button" |
250 | dark | 250 | dark |
251 | @click="addSubjectDialog = true" | 251 | @click="addSubjectDialog = true" |
252 | v-if="role != 'TEACHER' " | 252 | v-if="role != 'TEACHER' " |
253 | > | 253 | > |
254 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Subject | 254 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Subject |
255 | </v-btn> | 255 | </v-btn> |
256 | </v-flex> | 256 | </v-flex> |
257 | <v-spacer></v-spacer> | 257 | <v-spacer></v-spacer> |
258 | <v-flex lg2 md2 xs12 v-show="show"> | 258 | <v-flex lg2 md2 xs12 v-show="show"> |
259 | <v-select | 259 | <v-select |
260 | :items="classList" | 260 | :items="classList" |
261 | label="Select Your Class" | 261 | label="Select Your Class" |
262 | v-model="addSubject.classId" | 262 | v-model="addSubject.classId" |
263 | item-text="classNum" | 263 | item-text="classNum" |
264 | item-value="_id" | 264 | item-value="_id" |
265 | name="Select Class" | 265 | name="Select Class" |
266 | :rules="classRules" | 266 | :rules="classRules" |
267 | @change="getClassSubject" | 267 | @change="getClassSubject" |
268 | class="pl-2" | 268 | class="pl-2" |
269 | required | 269 | required |
270 | ></v-select> | 270 | ></v-select> |
271 | </v-flex> | 271 | </v-flex> |
272 | <v-card-title class="body-1" v-show="show"> | 272 | <v-card-title class="body-1" v-show="show"> |
273 | <v-btn icon flat @click="displaySearch"> | 273 | <v-btn icon flat @click="displaySearch"> |
274 | <v-avatar size="27"> | 274 | <v-avatar size="27"> |
275 | <img src="/static/icon/search.png" alt="icon" /> | 275 | <img src="/static/icon/search.png" alt="icon" /> |
276 | </v-avatar> | 276 | </v-avatar> |
277 | </v-btn> | 277 | </v-btn> |
278 | </v-card-title> | 278 | </v-card-title> |
279 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> | 279 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> |
280 | <v-layout> | 280 | <v-layout> |
281 | <v-text-field | 281 | <v-text-field |
282 | v-model="search" | 282 | v-model="search" |
283 | label="Search" | 283 | label="Search" |
284 | prepend-inner-icon="search" | 284 | prepend-inner-icon="search" |
285 | color="primary" | 285 | color="primary" |
286 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 286 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
287 | ></v-text-field> | 287 | ></v-text-field> |
288 | <v-icon @click="closeSearch" color="error">close</v-icon> | 288 | <v-icon @click="closeSearch" color="error">close</v-icon> |
289 | </v-layout> | 289 | </v-layout> |
290 | </v-flex> | 290 | </v-flex> |
291 | </v-toolbar> | 291 | </v-toolbar> |
292 | <v-data-table | 292 | <v-data-table |
293 | :headers="headers" | 293 | :headers="headers" |
294 | :items="subjectList.subjects" | 294 | :items="subjectList.subjects" |
295 | :pagination.sync="pagination" | 295 | :pagination.sync="pagination" |
296 | :search="search" | 296 | :search="search" |
297 | > | 297 | > |
298 | <template slot="items" slot-scope="props"> | 298 | <template slot="items" slot-scope="props"> |
299 | <tr class="tr"> | 299 | <tr class="tr"> |
300 | <td class="td-row td">{{ props.index + 1 }}</td> | 300 | <td class="td-row td">{{ props.index + 1 }}</td> |
301 | <td class="text-xs-center td td-row">{{ props.item.subjectName }}</td> | 301 | <td class="text-xs-center td td-row">{{ props.item.subjectName }}</td> |
302 | <td class="text-xs-center td td-row">{{ props.item.subjectAuthor }}</td> | 302 | <td class="text-xs-center td td-row">{{ props.item.subjectAuthor }}</td> |
303 | <td class="text-xs-center td td-row">{{ props.item.subjectCode }}</td> | 303 | <td class="text-xs-center td td-row">{{ props.item.subjectCode }}</td> |
304 | <!-- <td class="text-xs-center td td-row">{{ props.item.teacherId }}</td> --> | 304 | <!-- <td class="text-xs-center td td-row">{{ props.item.teacherId }}</td> --> |
305 | <td class="text-xs-center td td-row">{{ props.item.passMarks }}</td> | 305 | <td class="text-xs-center td td-row">{{ props.item.passMarks }}</td> |
306 | <td class="text-xs-center td td-row">{{ props.item.finalMarks }}</td> | 306 | <td class="text-xs-center td td-row">{{ props.item.finalMarks }}</td> |
307 | <td class="text-xs-center td td-row">{{ props.item.type }}</td> | 307 | <td class="text-xs-center td td-row">{{ props.item.type }}</td> |
308 | 308 | ||
309 | <td class="text-xs-center td td-row"> | 309 | <!-- <td class="text-xs-center td td-row"> |
310 | <span> | 310 | <span> |
311 | <!-- <v-tooltip top> | 311 | <v-tooltip top> |
312 | <img | 312 | <img |
313 | slot="activator" | 313 | slot="activator" |
314 | style="cursor:pointer; width:25px; height:25px; " | 314 | style="cursor:pointer; width:25px; height:25px; " |
315 | class="mr-3" | 315 | class="mr-3" |
316 | @click="profile(props.item)" | 316 | @click="profile(props.item)" |
317 | src="/static/icon/view.png" | 317 | src="/static/icon/view.png" |
318 | /> | 318 | /> |
319 | <span>View</span> | 319 | <span>View</span> |
320 | </v-tooltip>--> | 320 | </v-tooltip> |
321 | <v-tooltip top> | 321 | <v-tooltip top> |
322 | <img | 322 | <img |
323 | slot="activator" | 323 | slot="activator" |
324 | style="cursor:pointer; width:20px; height:18px; " | 324 | style="cursor:pointer; width:20px; height:18px; " |
325 | class="mr-3" | 325 | class="mr-3" |
326 | @click="editItem(props.item)" | 326 | @click="editItem(props.item)" |
327 | src="/static/icon/edit.png" | 327 | src="/static/icon/edit.png" |
328 | /> | 328 | /> |
329 | <span>Edit</span> | 329 | <span>Edit</span> |
330 | </v-tooltip> | 330 | </v-tooltip> |
331 | <v-tooltip top> | 331 | <v-tooltip top> |
332 | <img | 332 | <img |
333 | slot="activator" | 333 | slot="activator" |
334 | style="cursor:pointer; width:20px; height:20px; " | 334 | style="cursor:pointer; width:20px; height:20px; " |
335 | class="mr-3" | 335 | class="mr-3" |
336 | @click="deleteItem(props.item)" | 336 | @click="deleteItem(props.item)" |
337 | src="/static/icon/delete.png" | 337 | src="/static/icon/delete.png" |
338 | /> | 338 | /> |
339 | <span>Delete</span> | 339 | <span>Delete</span> |
340 | </v-tooltip> | 340 | </v-tooltip> |
341 | </span> | 341 | </span> |
342 | </td> | 342 | </td> --> |
343 | </tr> | 343 | </tr> |
344 | </template> | 344 | </template> |
345 | <v-alert | 345 | <v-alert |
346 | slot="no-results" | 346 | slot="no-results" |
347 | :value="true" | 347 | :value="true" |
348 | color="error" | 348 | color="error" |
349 | icon="warning" | 349 | icon="warning" |
350 | >Your search for "{{ search }}" found no results.</v-alert> | 350 | >Your search for "{{ search }}" found no results.</v-alert> |
351 | </v-data-table> | 351 | </v-data-table> |
352 | <!-- ****** ADD MULTIPLE Subject ****** --> | 352 | <!-- ****** ADD MULTIPLE Subject ****** --> |
353 | <v-snackbar | 353 | <v-snackbar |
354 | :timeout="timeout" | 354 | :timeout="timeout" |
355 | :top="y === 'top'" | 355 | :top="y === 'top'" |
356 | :right="x === 'right'" | 356 | :right="x === 'right'" |
357 | :vertical="mode === 'vertical'" | 357 | :vertical="mode === 'vertical'" |
358 | v-model="snackbar" | 358 | v-model="snackbar" |
359 | :color="color" | 359 | :color="color" |
360 | >{{ text }}</v-snackbar> | 360 | >{{ text }}</v-snackbar> |
361 | <v-dialog v-model="addSubjectDialog" max-width="600px"> | 361 | <v-dialog v-model="addSubjectDialog" max-width="600px"> |
362 | <v-card flat class="card-style pa-2" dark> | 362 | <v-card flat class="card-style pa-2" dark> |
363 | <v-layout> | 363 | <v-layout> |
364 | <v-flex xs12> | 364 | <v-flex xs12> |
365 | <label class="title text-xs-center">Add Subject</label> | 365 | <label class="title text-xs-center">Add Subject</label> |
366 | <v-icon size="24" class="right" @click="addSubjectDialog = false">cancel</v-icon> | 366 | <v-icon size="24" class="right" @click="addSubjectDialog = false">cancel</v-icon> |
367 | </v-flex> | 367 | </v-flex> |
368 | </v-layout> | 368 | </v-layout> |
369 | <v-container fluid fill-height> | 369 | <v-container fluid fill-height> |
370 | <v-layout align-center> | 370 | <v-layout align-center> |
371 | <v-flex xs12> | 371 | <v-flex xs12> |
372 | <v-form ref="form" v-model="valid" lazy-validation> | 372 | <v-form ref="form" v-model="valid" lazy-validation> |
373 | <v-layout> | 373 | <v-layout> |
374 | <v-flex xs4 sm4 class="pt-4 subheading"> | 374 | <v-flex xs4 sm4 class="pt-4 subheading"> |
375 | <label class="right">Class Name :</label> | 375 | <label class="right">Class Name :</label> |
376 | </v-flex> | 376 | </v-flex> |
377 | <v-flex xs8 sm8 class="ml-3"> | 377 | <v-flex xs8 sm8 class="ml-3"> |
378 | <v-select | 378 | <v-select |
379 | v-model="addSubject.classId" | 379 | v-model="addSubject.classId" |
380 | label="Select your class" | 380 | label="Select your class" |
381 | type="text" | 381 | type="text" |
382 | :items="classList" | 382 | :items="classList" |
383 | item-text="classNum" | 383 | item-text="classNum" |
384 | item-value="_id" | 384 | item-value="_id" |
385 | :rules="classRules" | 385 | :rules="classRules" |
386 | required | 386 | required |
387 | ></v-select> | 387 | ></v-select> |
388 | </v-flex> | 388 | </v-flex> |
389 | </v-layout> | 389 | </v-layout> |
390 | <v-layout> | 390 | <v-layout> |
391 | <v-flex xs4 sm4 class="pt-4 subheading"> | 391 | <v-flex xs4 sm4 class="pt-4 subheading"> |
392 | <label class="right">Teacher Name :</label> | 392 | <label class="right">Teacher Name :</label> |
393 | </v-flex> | 393 | </v-flex> |
394 | <v-flex xs8 sm8 class="ml-3"> | 394 | <v-flex xs8 sm8 class="ml-3"> |
395 | <v-select | 395 | <v-select |
396 | v-model="addSubject.teacherId" | 396 | v-model="addSubject.teacherId" |
397 | label="Select your teacher" | 397 | label="Select your teacher" |
398 | type="text" | 398 | type="text" |
399 | :items="teacherList" | 399 | :items="teacherList" |
400 | item-text="name" | 400 | item-text="name" |
401 | item-value="_id" | 401 | item-value="_id" |
402 | :rules="teacherRules" | 402 | :rules="teacherRules" |
403 | required | 403 | required |
404 | ></v-select> | 404 | ></v-select> |
405 | </v-flex> | 405 | </v-flex> |
406 | </v-layout> | 406 | </v-layout> |
407 | <v-layout> | 407 | <v-layout> |
408 | <v-flex xs4 sm4 class="pt-4 sybheading"> | 408 | <v-flex xs4 sm4 class="pt-4 sybheading"> |
409 | <label class="right">Type :</label> | 409 | <label class="right">Type :</label> |
410 | </v-flex> | 410 | </v-flex> |
411 | <v-flex xs8 sm8 class="ml-3"> | 411 | <v-flex xs8 sm8 class="ml-3"> |
412 | <v-select | 412 | <v-select |
413 | v-model="addSubject.type" | 413 | v-model="addSubject.type" |
414 | :items="type" | 414 | :items="type" |
415 | label="Select your Type" | 415 | label="Select your Type" |
416 | :rules="typeRules" | 416 | :rules="typeRules" |
417 | required | 417 | required |
418 | ></v-select> | 418 | ></v-select> |
419 | </v-flex> | 419 | </v-flex> |
420 | </v-layout> | 420 | </v-layout> |
421 | <v-layout> | 421 | <v-layout> |
422 | <v-flex xs4 sm4 class="pt-4 subheading"> | 422 | <v-flex xs4 sm4 class="pt-4 subheading"> |
423 | <label class="right">Pass Mark :</label> | 423 | <label class="right">Pass Mark :</label> |
424 | </v-flex> | 424 | </v-flex> |
425 | <v-flex xs8 sm8 class="ml-3"> | 425 | <v-flex xs8 sm8 class="ml-3"> |
426 | <v-text-field | 426 | <v-text-field |
427 | label="Fill your Pass Mark" | 427 | label="Fill your Pass Mark" |
428 | name="name" | 428 | name="name" |
429 | type="text" | 429 | type="text" |
430 | :rules="markRules" | 430 | :rules="markRules" |
431 | v-model="addSubject.passMarks" | 431 | v-model="addSubject.passMarks" |
432 | required | 432 | required |
433 | ></v-text-field> | 433 | ></v-text-field> |
434 | </v-flex> | 434 | </v-flex> |
435 | </v-layout> | 435 | </v-layout> |
436 | <v-layout> | 436 | <v-layout> |
437 | <v-flex xs4 sm4 class="pt-4 subheading"> | 437 | <v-flex xs4 sm4 class="pt-4 subheading"> |
438 | <label class="right">Final Mark :</label> | 438 | <label class="right">Final Mark :</label> |
439 | </v-flex> | 439 | </v-flex> |
440 | <v-flex xs8 sm8 class="ml-3"> | 440 | <v-flex xs8 sm8 class="ml-3"> |
441 | <v-text-field | 441 | <v-text-field |
442 | label="Fill your final mark" | 442 | label="Fill your final mark" |
443 | name="name" | 443 | name="name" |
444 | type="text" | 444 | type="text" |
445 | :rules="finalRules" | 445 | :rules="finalRules" |
446 | v-model="addSubject.finalMarks" | 446 | v-model="addSubject.finalMarks" |
447 | required | 447 | required |
448 | ></v-text-field> | 448 | ></v-text-field> |
449 | </v-flex> | 449 | </v-flex> |
450 | </v-layout> | 450 | </v-layout> |
451 | <v-layout> | 451 | <v-layout> |
452 | <v-flex xs4 sm4 class="pt-4 subheading"> | 452 | <v-flex xs4 sm4 class="pt-4 subheading"> |
453 | <label class="right">Subject :</label> | 453 | <label class="right">Subject :</label> |
454 | </v-flex> | 454 | </v-flex> |
455 | <v-flex xs8 sm8 class="ml-3"> | 455 | <v-flex xs8 sm8 class="ml-3"> |
456 | <v-text-field | 456 | <v-text-field |
457 | v-model="addSubject.subjectName" | 457 | v-model="addSubject.subjectName" |
458 | placeholder="fill your Subject Name" | 458 | placeholder="fill your Subject Name" |
459 | name="name" | 459 | name="name" |
460 | type="text" | 460 | type="text" |
461 | :rules="subjectRules" | 461 | :rules="subjectRules" |
462 | required | 462 | required |
463 | ></v-text-field> | 463 | ></v-text-field> |
464 | </v-flex> | 464 | </v-flex> |
465 | </v-layout> | 465 | </v-layout> |
466 | <v-layout> | 466 | <v-layout> |
467 | <v-flex xs4 sm4 class="pt-4 subheading"> | 467 | <v-flex xs4 sm4 class="pt-4 subheading"> |
468 | <label class="right">Subject Author :</label> | 468 | <label class="right">Subject Author :</label> |
469 | </v-flex> | 469 | </v-flex> |
470 | <v-flex xs8 sm8 class="ml-3"> | 470 | <v-flex xs8 sm8 class="ml-3"> |
471 | <v-text-field | 471 | <v-text-field |
472 | v-model="addSubject.subjectAuthor" | 472 | v-model="addSubject.subjectAuthor" |
473 | placeholder="fill your Subject Author" | 473 | placeholder="fill your Subject Author" |
474 | name="name" | 474 | name="name" |
475 | type="text" | 475 | type="text" |
476 | ></v-text-field> | 476 | ></v-text-field> |
477 | </v-flex> | 477 | </v-flex> |
478 | </v-layout> | 478 | </v-layout> |
479 | <v-layout> | 479 | <v-layout> |
480 | <v-flex xs4 sm4 class="pt-4 subheading"> | 480 | <v-flex xs4 sm4 class="pt-4 subheading"> |
481 | <label class="right">Subject Code:</label> | 481 | <label class="right">Subject Code:</label> |
482 | </v-flex> | 482 | </v-flex> |
483 | <v-flex xs8 sm8 class="ml-3"> | 483 | <v-flex xs8 sm8 class="ml-3"> |
484 | <v-text-field | 484 | <v-text-field |
485 | v-model="addSubject.subjectCode" | 485 | v-model="addSubject.subjectCode" |
486 | placeholder="fill your Subject Code" | 486 | placeholder="fill your Subject Code" |
487 | name="name" | 487 | name="name" |
488 | type="text" | 488 | type="text" |
489 | ></v-text-field> | 489 | ></v-text-field> |
490 | </v-flex> | 490 | </v-flex> |
491 | </v-layout> | 491 | </v-layout> |
492 | <v-layout> | 492 | <v-layout> |
493 | <v-flex xs12 sm12> | 493 | <v-flex xs12 sm12> |
494 | <v-card-actions> | 494 | <v-card-actions> |
495 | <v-spacer></v-spacer> | 495 | <v-spacer></v-spacer> |
496 | <v-btn | 496 | <v-btn |
497 | @click="submit" | 497 | @click="submit" |
498 | round | 498 | round |
499 | dark | 499 | dark |
500 | :loading="addLoading" | 500 | :loading="addLoading" |
501 | class="add-button" | 501 | class="add-button" |
502 | >Add Subject</v-btn> | 502 | >Add Subject</v-btn> |
503 | </v-card-actions> | 503 | </v-card-actions> |
504 | </v-flex> | 504 | </v-flex> |
505 | </v-layout> | 505 | </v-layout> |
506 | </v-form> | 506 | </v-form> |
507 | </v-flex> | 507 | </v-flex> |
508 | </v-layout> | 508 | </v-layout> |
509 | </v-container> | 509 | </v-container> |
510 | </v-card> | 510 | </v-card> |
511 | </v-dialog> | 511 | </v-dialog> |
512 | <div class="loader" v-if="showLoader"> | 512 | <div class="loader" v-if="showLoader"> |
513 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 513 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
514 | </div> | 514 | </div> |
515 | </v-container> | 515 | </v-container> |
516 | </template> | 516 | </template> |
517 | 517 | ||
518 | <script> | 518 | <script> |
519 | import http from "@/Services/http.js"; | 519 | import http from "@/Services/http.js"; |
520 | import Util from "@/util"; | 520 | import Util from "@/util"; |
521 | 521 | ||
522 | export default { | 522 | export default { |
523 | data: () => ({ | 523 | data: () => ({ |
524 | snackbar: false, | 524 | snackbar: false, |
525 | y: "top", | 525 | y: "top", |
526 | x: "right", | 526 | x: "right", |
527 | role: "", | 527 | role: "", |
528 | mode: "", | 528 | mode: "", |
529 | timeout: 3000, | 529 | timeout: 3000, |
530 | text: "", | 530 | text: "", |
531 | color: "", | 531 | color: "", |
532 | show: true, | 532 | show: true, |
533 | showSearch: false, | 533 | showSearch: false, |
534 | showLoader: false, | 534 | showLoader: false, |
535 | loading: false, | 535 | loading: false, |
536 | editLoading: false, | 536 | editLoading: false, |
537 | addLoading: false, | 537 | addLoading: false, |
538 | date: null, | 538 | date: null, |
539 | search: "", | 539 | search: "", |
540 | viewSubjectDialog: false, | 540 | viewSubjectDialog: false, |
541 | editSubjectDialog: false, | 541 | editSubjectDialog: false, |
542 | valid: true, | 542 | valid: true, |
543 | validEditSubject: true, | 543 | validEditSubject: true, |
544 | addSubjectDialog: false, | 544 | addSubjectDialog: false, |
545 | // isActive: true, | 545 | // isActive: true, |
546 | // newActive: false, | 546 | // newActive: false, |
547 | type: ["Optional", "Mandatory"], | 547 | type: ["Optional", "Mandatory"], |
548 | pagination: { | 548 | pagination: { |
549 | rowsPerPage: 10 | 549 | rowsPerPage: 10 |
550 | }, | 550 | }, |
551 | token: "", | 551 | token: "", |
552 | classRules: [v => !!v || " Class Name is required"], | 552 | classRules: [v => !!v || " Class Name is required"], |
553 | teacherRules: [v => !!v || " Teacher Name is required"], | 553 | teacherRules: [v => !!v || " Teacher Name is required"], |
554 | typeRules: [v => !!v || "Type is required"], | 554 | typeRules: [v => !!v || "Type is required"], |
555 | markRules: [v => !!v || " Pass Mark is required"], | 555 | markRules: [v => !!v || " Pass Mark is required"], |
556 | finalRules: [v => !!v || "Final MArk is required"], | 556 | finalRules: [v => !!v || "Final MArk is required"], |
557 | subjectRules: [v => !!v || " Subject Name is required"], | 557 | subjectRules: [v => !!v || " Subject Name is required"], |
558 | headers: [ | 558 | headers: [ |
559 | { | 559 | { |
560 | text: "No", | 560 | text: "No", |
561 | align: "", | 561 | align: "", |
562 | sortable: false, | 562 | sortable: false, |
563 | value: "No" | 563 | value: "No" |
564 | }, | 564 | }, |
565 | { | 565 | { |
566 | text: "Subject Name", | 566 | text: "Subject Name", |
567 | value: "subjectName", | 567 | value: "subjectName", |
568 | sortable: false, | 568 | sortable: false, |
569 | align: "center" | 569 | align: "center" |
570 | }, | 570 | }, |
571 | { | 571 | { |
572 | text: "Subject Author", | 572 | text: "Subject Author", |
573 | value: "subjectAuthor", | 573 | value: "subjectAuthor", |
574 | sortable: false, | 574 | sortable: false, |
575 | align: "center" | 575 | align: "center" |
576 | }, | 576 | }, |
577 | { | 577 | { |
578 | text: "Subject Code", | 578 | text: "Subject Code", |
579 | value: "subjectCode", | 579 | value: "subjectCode", |
580 | sortable: false, | 580 | sortable: false, |
581 | align: "center" | 581 | align: "center" |
582 | }, | 582 | }, |
583 | // { | 583 | // { |
584 | // text: "Teacher", | 584 | // text: "Teacher", |
585 | // value: "teacherId", | 585 | // value: "teacherId", |
586 | // sortable: false, | 586 | // sortable: false, |
587 | // align: "center" | 587 | // align: "center" |
588 | // }, | 588 | // }, |
589 | { | 589 | { |
590 | text: "Pass Marks", | 590 | text: "Pass Marks", |
591 | value: "passMarks", | 591 | value: "passMarks", |
592 | sortable: false, | 592 | sortable: false, |
593 | align: "center" | 593 | align: "center" |
594 | }, | 594 | }, |
595 | { | 595 | { |
596 | text: "Final Marks", | 596 | text: "Final Marks", |
597 | value: "finalMarks", | 597 | value: "finalMarks", |
598 | sortable: false, | 598 | sortable: false, |
599 | align: "center" | 599 | align: "center" |
600 | }, | 600 | }, |
601 | { | 601 | { |
602 | text: "Type", | 602 | text: "Type", |
603 | value: "type", | 603 | value: "type", |
604 | sortable: false, | 604 | sortable: false, |
605 | align: "center" | 605 | align: "center" |
606 | }, | 606 | }, |
607 | { text: "Action", value: "", sortable: false, align: "center" } | 607 | // { text: "Action", value: "", sortable: false, align: "center" } |
608 | ], | 608 | ], |
609 | subjectList: [], | 609 | subjectList: [], |
610 | classList: [], | 610 | classList: [], |
611 | teacherList: [], | 611 | teacherList: [], |
612 | editedIndex: -1, | 612 | editedIndex: -1, |
613 | addSubject: {}, | 613 | addSubject: {}, |
614 | 614 | ||
615 | editedItem: { | 615 | editedItem: { |
616 | // subjectName: "", | 616 | // subjectName: "", |
617 | // subjectAuthor: "" | 617 | // subjectAuthor: "" |
618 | } | 618 | } |
619 | }), | 619 | }), |
620 | methods: { | 620 | methods: { |
621 | pickFile() { | 621 | pickFile() { |
622 | this.$refs.image.click(); | 622 | this.$refs.image.click(); |
623 | }, | 623 | }, |
624 | editItem(item) { | 624 | editItem(item) { |
625 | this.editedIndex = this.subjectList.subjects; | 625 | this.editedIndex = this.subjectList.subjects; |
626 | this.editedItem = Object.assign({}, item); | 626 | this.editedItem = Object.assign({}, item); |
627 | this.dialog = true; | 627 | this.dialog = true; |
628 | this.editSubjectDialog = true; | 628 | this.editSubjectDialog = true; |
629 | }, | 629 | }, |
630 | profile(item) { | 630 | profile(item) { |
631 | this.editedIndex = this.subjectList.subjects; | 631 | this.editedIndex = this.subjectList.subjects; |
632 | this.editedItem = Object.assign({}, item); | 632 | this.editedItem = Object.assign({}, item); |
633 | this.dialog1 = true; | 633 | this.dialog1 = true; |
634 | this.viewSubjectDialog = true; | 634 | this.viewSubjectDialog = true; |
635 | }, | 635 | }, |
636 | deleteItem(item) { | 636 | deleteItem(item) { |
637 | let deleteSubject = { | 637 | let deleteSubject = { |
638 | classId: this.addSubject.classId, | 638 | classId: this.addSubject.classId, |
639 | subjectId: item._id | 639 | subjectId: item._id |
640 | }; | 640 | }; |
641 | http() | 641 | http() |
642 | .delete( | 642 | .delete( |
643 | "/deleteSubject", | 643 | "/deleteSubject", |
644 | confirm("Are you sure you want to delete this?") && { | 644 | confirm("Are you sure you want to delete this?") && { |
645 | params: deleteSubject | 645 | params: deleteSubject |
646 | } | 646 | } |
647 | ) | 647 | ) |
648 | .then(response => { | 648 | .then(response => { |
649 | this.snackbar = true; | 649 | this.snackbar = true; |
650 | this.color = "green"; | 650 | this.color = "green"; |
651 | this.text = "Successfully delete Existing Subject"; | 651 | this.text = "Successfully delete Existing Subject"; |
652 | this.getClassSubject(this.addSubject.classId); | 652 | this.getClassSubject(this.addSubject.classId); |
653 | }) | 653 | }) |
654 | .catch(error => { | 654 | .catch(error => { |
655 | // this.snackbar = true; | 655 | // this.snackbar = true; |
656 | // this.text = error.response.data.message; | 656 | // this.text = error.response.data.message; |
657 | // this.color = "error"; | 657 | // this.color = "error"; |
658 | console.log("error", error); | 658 | console.log("error", error); |
659 | }); | 659 | }); |
660 | }, | 660 | }, |
661 | close() { | 661 | close() { |
662 | this.editSubjectDialog = false; | 662 | this.editSubjectDialog = false; |
663 | }, | 663 | }, |
664 | close1() { | 664 | close1() { |
665 | this.viewSubjectDialog = false; | 665 | this.viewSubjectDialog = false; |
666 | }, | 666 | }, |
667 | submit() { | 667 | submit() { |
668 | if (this.$refs.form.validate()) { | 668 | if (this.$refs.form.validate()) { |
669 | this.addLoading = true; | 669 | this.addLoading = true; |
670 | http() | 670 | http() |
671 | .post("/addSubject", this.addSubject) | 671 | .post("/addSubject", this.addSubject) |
672 | .then(response => { | 672 | .then(response => { |
673 | this.snackbar = true; | 673 | this.snackbar = true; |
674 | this.text = "New Subject added successfully"; | 674 | this.text = "New Subject added successfully"; |
675 | this.color = "green"; | 675 | this.color = "green"; |
676 | this.addLoading = false; | 676 | this.addLoading = false; |
677 | this.addSubjectDialog = false; | 677 | this.addSubjectDialog = false; |
678 | this.getClassSubject(_id); | 678 | this.getClassSubject(_id); |
679 | }) | 679 | }) |
680 | .catch(error => { | 680 | .catch(error => { |
681 | this.addLoading = false; | 681 | this.addLoading = false; |
682 | }); | 682 | }); |
683 | } | 683 | } |
684 | }, | 684 | }, |
685 | clear() { | 685 | clear() { |
686 | this.$refs.form.reset(); | 686 | this.$refs.form.reset(); |
687 | }, | 687 | }, |
688 | save() { | 688 | save() { |
689 | if (this.$refs.formEditSubject.validate()) { | 689 | if (this.$refs.formEditSubject.validate()) { |
690 | let editSubject = { | 690 | let editSubject = { |
691 | classId: this.editedItem.classId, | 691 | classId: this.editedItem.classId, |
692 | subjectId: this.editedItem._id, | 692 | subjectId: this.editedItem._id, |
693 | teacherId: this.editedItem.teacherId, | 693 | teacherId: this.editedItem.teacherId, |
694 | type: this.editedItem.type, | 694 | type: this.editedItem.type, |
695 | passMarks: this.editedItem.passMarks, | 695 | passMarks: this.editedItem.passMarks, |
696 | finalMarks: this.editedItem.finalMarks, | 696 | finalMarks: this.editedItem.finalMarks, |
697 | subjectAuthor: this.editedItem.subjectAuthor, | 697 | subjectAuthor: this.editedItem.subjectAuthor, |
698 | subjectCode: this.editedItem.subjectCode, | 698 | subjectCode: this.editedItem.subjectCode, |
699 | subjectName: this.editedItem.subjectName | 699 | subjectName: this.editedItem.subjectName |
700 | }; | 700 | }; |
701 | this.editLoading = true; | 701 | this.editLoading = true; |
702 | http() | 702 | http() |
703 | .put("/updateSubject", editSubject) | 703 | .put("/updateSubject", editSubject) |
704 | .then(response => { | 704 | .then(response => { |
705 | this.snackbar = true; | 705 | this.snackbar = true; |
706 | this.text = "Successfully Edit Existing Subject"; | 706 | this.text = "Successfully Edit Existing Subject"; |
707 | this.color = "green"; | 707 | this.color = "green"; |
708 | this.editLoading = false; | 708 | this.editLoading = false; |
709 | this.editSubjectDialog = false; | 709 | this.editSubjectDialog = false; |
710 | this.getClassSubject(this.editedItem.classId); | 710 | this.getClassSubject(this.editedItem.classId); |
711 | }) | 711 | }) |
712 | .catch(error => { | 712 | .catch(error => { |
713 | this.editLoading = false; | 713 | this.editLoading = false; |
714 | 714 | ||
715 | // console.log(error); | 715 | // console.log(error); |
716 | }); | 716 | }); |
717 | } | 717 | } |
718 | }, | 718 | }, |
719 | getClassSubject(_id) { | 719 | getClassSubject(_id) { |
720 | this.showLoader = true; | 720 | this.showLoader = true; |
721 | console.log("class", _id); | 721 | console.log("class", _id); |
722 | // this.classId = this.classId; | 722 | // this.classId = this.classId; |
723 | http() | 723 | http() |
724 | .get( | 724 | .get( |
725 | "/getParticularClass", | 725 | "/getParticularClass", |
726 | { params: { classId: _id } }, | 726 | { params: { classId: _id } }, |
727 | { | 727 | { |
728 | headers: { Authorization: "Bearer " + this.token } | 728 | headers: { Authorization: "Bearer " + this.token } |
729 | } | 729 | } |
730 | ) | 730 | ) |
731 | .then(response => { | 731 | .then(response => { |
732 | this.subjectList = response.data.data; | 732 | this.subjectList = response.data.data; |
733 | this.showLoader = false; | 733 | this.showLoader = false; |
734 | }) | 734 | }) |
735 | .catch(err => { | 735 | .catch(err => { |
736 | this.showLoader = false; | 736 | this.showLoader = false; |
737 | }); | 737 | }); |
738 | }, | 738 | }, |
739 | getClass() { | 739 | getClass() { |
740 | http() | 740 | http() |
741 | .get("/getClassesList", { | 741 | .get("/getClassesList", { |
742 | headers: { Authorization: "Bearer " + this.token } | 742 | headers: { Authorization: "Bearer " + this.token } |
743 | }) | 743 | }) |
744 | .then(response => { | 744 | .then(response => { |
745 | this.classList = response.data.data; | 745 | this.classList = response.data.data; |
746 | }) | 746 | }) |
747 | .catch(error => { | 747 | .catch(error => { |
748 | if (error.response.status === 401) { | 748 | if (error.response.status === 401) { |
749 | this.$router.replace({ path: "/" }); | 749 | this.$router.replace({ path: "/" }); |
750 | this.$store.dispatch("setToken", null); | 750 | this.$store.dispatch("setToken", null); |
751 | this.$store.dispatch("Id", null); | 751 | this.$store.dispatch("Id", null); |
752 | } | 752 | } |
753 | }); | 753 | }); |
754 | }, | 754 | }, |
755 | getTeacherList() { | 755 | getTeacherList() { |
756 | this.showLoader = true; | 756 | this.showLoader = true; |
757 | var token = this.$store.state.token; | 757 | var token = this.$store.state.token; |
758 | http() | 758 | http() |
759 | .get("/getTeachersList", { | 759 | .get("/getTeachersList", { |
760 | headers: { Authorization: "Bearer " + token } | 760 | headers: { Authorization: "Bearer " + token } |
761 | }) | 761 | }) |
762 | .then(response => { | 762 | .then(response => { |
763 | this.teacherList = response.data.data; | 763 | this.teacherList = response.data.data; |
764 | this.showLoader = false; | 764 | this.showLoader = false; |
765 | // console.log("getTeacherList=====>",this.desserts) | 765 | // console.log("getTeacherList=====>",this.desserts) |
766 | }) | 766 | }) |
767 | .catch(error => { | 767 | .catch(error => { |
768 | this.showLoader = false; | 768 | this.showLoader = false; |
769 | if (error.response.status === 401) { | 769 | if (error.response.status === 401) { |
770 | this.$router.replace({ path: "/" }); | 770 | this.$router.replace({ path: "/" }); |
771 | this.$store.dispatch("setToken", null); | 771 | this.$store.dispatch("setToken", null); |
772 | this.$store.dispatch("Id", null); | 772 | this.$store.dispatch("Id", null); |
773 | } | 773 | } |
774 | }); | 774 | }); |
775 | }, | 775 | }, |
776 | displaySearch() { | 776 | displaySearch() { |
777 | (this.show = false), (this.showSearch = true); | 777 | (this.show = false), (this.showSearch = true); |
778 | }, | 778 | }, |
779 | closeSearch() { | 779 | closeSearch() { |
780 | this.showSearch = false; | 780 | this.showSearch = false; |
781 | this.show = true; | 781 | this.show = true; |
782 | this.search = ""; | 782 | this.search = ""; |
783 | } | 783 | } |
784 | }, | 784 | }, |
785 | mounted() { | 785 | mounted() { |
786 | this.token = this.$store.state.token; | 786 | this.token = this.$store.state.token; |
787 | // this.getNoticeDataList(); | 787 | // this.getNoticeDataList(); |
788 | this.getClass(); | 788 | this.getClass(); |
789 | this.getTeacherList(); | 789 | this.getTeacherList(); |
790 | this.role = this.$store.state.role; | 790 | this.role = this.$store.state.role; |
791 | } | 791 | } |
792 | }; | 792 | }; |
793 | </script> | 793 | </script> |
src/pages/Academic/syllabus.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT Syllabus ****** --> | 3 | <!-- ****** EDIT Syllabus ****** --> |
4 | <v-dialog v-model="editSyllabusDialog" max-width="400px"> | 4 | <v-dialog v-model="editSyllabusDialog" 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 Syllabus</label> | 8 | <label class="title text-xs-center">Edit Syllabus</label> |
9 | <v-icon size="24" class="right" @click="editSyllabusDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editSyllabusDialog = 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="formEditSyllabus" v-model="validEditSyllabus" lazy-validation> | 13 | <v-form ref="formEditSyllabus" v-model="validEditSyllabus" lazy-validation> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs4 sm4 class="pt-4 subheading"> | 15 | <v-flex xs4 sm4 class="pt-4 subheading"> |
16 | <label class="right">Title :</label> | 16 | <label class="right">Title :</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs8 sm8 class="ml-3"> | 18 | <v-flex xs8 sm8 class="ml-3"> |
19 | <v-text-field v-model="editedItem.title"></v-text-field> | 19 | <v-text-field v-model="editedItem.title"></v-text-field> |
20 | </v-flex> | 20 | </v-flex> |
21 | </v-layout> | 21 | </v-layout> |
22 | <v-layout> | 22 | <v-layout> |
23 | <v-flex xs4 class="pt-4 subheading"> | 23 | <v-flex xs4 class="pt-4 subheading"> |
24 | <label class="right">Description:</label> | 24 | <label class="right">Description:</label> |
25 | </v-flex> | 25 | </v-flex> |
26 | <v-flex xs8 class="ml-3"> | 26 | <v-flex xs8 class="ml-3"> |
27 | <v-text-field v-model="editedItem.description"></v-text-field> | 27 | <v-text-field v-model="editedItem.description"></v-text-field> |
28 | </v-flex> | 28 | </v-flex> |
29 | </v-layout> | 29 | </v-layout> |
30 | <v-layout> | 30 | <v-layout> |
31 | <v-flex xs4 class="pt-4 subheading"> | 31 | <v-flex xs4 class="pt-4 subheading"> |
32 | <label class="right">Class:</label> | 32 | <label class="right">Class:</label> |
33 | </v-flex> | 33 | </v-flex> |
34 | <v-flex xs8 class="ml-3"> | 34 | <v-flex xs8 class="ml-3"> |
35 | <v-select | 35 | <v-select |
36 | :items="classList" | 36 | :items="classList" |
37 | v-model="editedItem.classId" | 37 | v-model="editedItem.classId" |
38 | label="Select Class" | 38 | label="Select Class" |
39 | item-text="classNum" | 39 | item-text="classNum" |
40 | item-value="_id" | 40 | item-value="_id" |
41 | name="Select Class" | 41 | name="Select Class" |
42 | @change="getSections(addSyllabus.classId)" | 42 | @change="getSections(addSyllabus.classId)" |
43 | required | 43 | required |
44 | ></v-select> | 44 | ></v-select> |
45 | </v-flex> | 45 | </v-flex> |
46 | </v-layout> | 46 | </v-layout> |
47 | <!-- <v-layout> | 47 | <!-- <v-layout> |
48 | <v-flex xs4 sm4 class="pt-4 subheading"> | 48 | <v-flex xs4 sm4 class="pt-4 subheading"> |
49 | <label class="right">Section :</label> | 49 | <label class="right">Section :</label> |
50 | </v-flex> | 50 | </v-flex> |
51 | <v-flex xs8 sm8 class="ml-3"> | 51 | <v-flex xs8 sm8 class="ml-3"> |
52 | <v-select | 52 | <v-select |
53 | :items="addSection" | 53 | :items="addSection" |
54 | label="Select Section" | 54 | label="Select Section" |
55 | item-text="name" | 55 | item-text="name" |
56 | item-value="_id" | 56 | item-value="_id" |
57 | v-model="editedItem.sectionId" | 57 | v-model="editedItem.sectionId" |
58 | name="Select Section" | 58 | name="Select Section" |
59 | class="px-2" | 59 | class="px-2" |
60 | required | 60 | required |
61 | ></v-select> | 61 | ></v-select> |
62 | </v-flex> | 62 | </v-flex> |
63 | </v-layout>--> | 63 | </v-layout>--> |
64 | <v-layout> | 64 | <v-layout> |
65 | <v-flex xs4 class="pt-4 subheading"> | 65 | <v-flex xs4 class="pt-4 subheading"> |
66 | <label class="right">File:</label> | 66 | <label class="right">File:</label> |
67 | </v-flex> | 67 | </v-flex> |
68 | <v-flex xs8 sm6 class="ml-3"> | 68 | <v-flex xs8 sm6 class="ml-3"> |
69 | <v-text-field | 69 | <v-text-field |
70 | label="Select file" | 70 | label="Select file" |
71 | @click="pickFile" | 71 | @click="pickFile" |
72 | v-model="imageName" | 72 | v-model="imageName" |
73 | append-icon="attach_file" | 73 | append-icon="attach_file" |
74 | ></v-text-field> | 74 | ></v-text-field> |
75 | </v-flex> | 75 | </v-flex> |
76 | </v-layout> | 76 | </v-layout> |
77 | <v-flex xs12 sm12> | 77 | <v-flex xs12 sm12> |
78 | <v-card-actions> | 78 | <v-card-actions> |
79 | <v-spacer></v-spacer> | 79 | <v-spacer></v-spacer> |
80 | <v-btn | 80 | <v-btn |
81 | round | 81 | round |
82 | dark | 82 | dark |
83 | @click="save" | 83 | @click="save" |
84 | :loading="editLoading" | 84 | :loading="editLoading" |
85 | class="add-button" | 85 | class="add-button" |
86 | >Update Syllabus</v-btn> | 86 | >Update Syllabus</v-btn> |
87 | </v-card-actions> | 87 | </v-card-actions> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-form> | 89 | </v-form> |
90 | </v-container> | 90 | </v-container> |
91 | </v-card> | 91 | </v-card> |
92 | </v-dialog> | 92 | </v-dialog> |
93 | 93 | ||
94 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> | 94 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> |
95 | 95 | ||
96 | <!-- <v-dialog v-model="viewSubjectDialog" max-width="600px"> | 96 | <!-- <v-dialog v-model="viewSubjectDialog" max-width="600px"> |
97 | <v-toolbar flat class="card-style pa-3" dark> | 97 | <v-toolbar flat class="card-style pa-3" dark> |
98 | <v-spacer></v-spacer> | 98 | <v-spacer></v-spacer> |
99 | <v-toolbar-title> | 99 | <v-toolbar-title> |
100 | <h3>Subject</h3> | 100 | <h3>Subject</h3> |
101 | </v-toolbar-title> | 101 | </v-toolbar-title> |
102 | <v-spacer></v-spacer> | 102 | <v-spacer></v-spacer> |
103 | <v-icon @click="close1">close</v-icon> | 103 | <v-icon @click="close1">close</v-icon> |
104 | </v-toolbar> | 104 | </v-toolbar> |
105 | <v-card> | 105 | <v-card> |
106 | <v-card-text> | 106 | <v-card-text> |
107 | <v-container grid-list-md> | 107 | <v-container grid-list-md> |
108 | <v-layout wrap> | 108 | <v-layout wrap> |
109 | <v-flex> | 109 | <v-flex> |
110 | <v-layout> | 110 | <v-layout> |
111 | <v-flex xs7 sm6> | 111 | <v-flex xs7 sm6> |
112 | <h5 class="right my-1"> | 112 | <h5 class="right my-1"> |
113 | <b>Subject Name:</b> | 113 | <b>Subject Name:</b> |
114 | </h5> | 114 | </h5> |
115 | </v-flex> | 115 | </v-flex> |
116 | <v-flex sm6 xs5> | 116 | <v-flex sm6 xs5> |
117 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> | 117 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> |
118 | </v-flex> | 118 | </v-flex> |
119 | </v-layout> | 119 | </v-layout> |
120 | </v-flex> | 120 | </v-flex> |
121 | </v-layout> | 121 | </v-layout> |
122 | </v-container> | 122 | </v-container> |
123 | </v-card-text> | 123 | </v-card-text> |
124 | </v-card> | 124 | </v-card> |
125 | </v-dialog>--> | 125 | </v-dialog>--> |
126 | 126 | ||
127 | <!-- ****** EXISTING SYLLABUS TABLE ****** --> | 127 | <!-- ****** EXISTING SYLLABUS TABLE ****** --> |
128 | <v-toolbar color="transparent" flat> | 128 | <v-toolbar color="transparent" flat> |
129 | <v-btn | 129 | <v-btn |
130 | fab | 130 | fab |
131 | dark | 131 | dark |
132 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 132 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
133 | small | 133 | small |
134 | @click="addSyllabusDialog = true" | 134 | @click="addSyllabusDialog = true" |
135 | > | 135 | > |
136 | <v-icon dark>add</v-icon> | 136 | <v-icon dark>add</v-icon> |
137 | </v-btn> | 137 | </v-btn> |
138 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> | 138 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> |
139 | <v-btn round class="open-dialog-button" dark @click="addSyllabusDialog = true"> | 139 | <v-btn round class="open-dialog-button" dark @click="addSyllabusDialog = true"> |
140 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Syllabus | 140 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Syllabus |
141 | </v-btn> | 141 | </v-btn> |
142 | </v-flex> | 142 | </v-flex> |
143 | <v-spacer></v-spacer> | 143 | <v-spacer></v-spacer> |
144 | <v-flex lg2 md2 xs12 v-show="show"> | 144 | <v-flex lg2 md2 xs12 v-show="show"> |
145 | <v-select | 145 | <v-select |
146 | :items="classList" | 146 | :items="classList" |
147 | label="Select Class" | 147 | label="Select Class" |
148 | v-model="addSyllabus.classId" | 148 | v-model="showSyllabus.classId" |
149 | item-text="classNum" | 149 | item-text="classNum" |
150 | item-value="_id" | 150 | item-value="_id" |
151 | name="Select Class" | 151 | name="Select Class" |
152 | :rules="classRules" | 152 | :rules="classRules" |
153 | @change="getSyallabusList" | 153 | @change="getSyallabusList" |
154 | class="pl-2" | 154 | class="pl-2" |
155 | required | 155 | required |
156 | ></v-select> | 156 | ></v-select> |
157 | </v-flex> | 157 | </v-flex> |
158 | <v-card-title class="body-1" v-show="show"> | 158 | <v-card-title class="body-1" v-show="show"> |
159 | <v-btn icon flat @click="displaySearch"> | 159 | <v-btn icon flat @click="displaySearch"> |
160 | <v-avatar size="27"> | 160 | <v-avatar size="27"> |
161 | <img src="/static/icon/search.png" alt="icon" /> | 161 | <img src="/static/icon/search.png" alt="icon" /> |
162 | </v-avatar> | 162 | </v-avatar> |
163 | </v-btn> | 163 | </v-btn> |
164 | </v-card-title> | 164 | </v-card-title> |
165 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> | 165 | <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch"> |
166 | <v-layout> | 166 | <v-layout> |
167 | <v-text-field | 167 | <v-text-field |
168 | v-model="search" | 168 | v-model="search" |
169 | label="Search" | 169 | label="Search" |
170 | prepend-inner-icon="search" | 170 | prepend-inner-icon="search" |
171 | color="primary" | 171 | color="primary" |
172 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 172 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
173 | ></v-text-field> | 173 | ></v-text-field> |
174 | <v-icon @click="closeSearch" color="error">close</v-icon> | 174 | <v-icon @click="closeSearch" color="error">close</v-icon> |
175 | </v-layout> | 175 | </v-layout> |
176 | </v-flex> | 176 | </v-flex> |
177 | </v-toolbar> | 177 | </v-toolbar> |
178 | <v-data-table | 178 | <v-data-table |
179 | :headers="headers" | 179 | :headers="headers" |
180 | :items="syllabusList" | 180 | :items="syllabusList" |
181 | :pagination.sync="pagination" | 181 | :pagination.sync="pagination" |
182 | :search="search" | 182 | :search="search" |
183 | > | 183 | > |
184 | <template slot="items" slot-scope="props"> | 184 | <template slot="items" slot-scope="props"> |
185 | <tr class="tr"> | 185 | <tr class="tr"> |
186 | <td class="td-row td">{{ props.index + 1 }}</td> | 186 | <td class="td-row td">{{ props.index + 1 }}</td> |
187 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> | 187 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> |
188 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> | 188 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> |
189 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> | 189 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> |
190 | <td | 190 | <td |
191 | class="text-xs-center td td-row" | 191 | class="text-xs-center td td-row" |
192 | v-if="props.item.teacherId" | 192 | v-if="props.item.teacherId" |
193 | >{{ props.item.teacherId.name }}</td> | 193 | >{{ props.item.teacherId.name }}</td> |
194 | <td | 194 | <td |
195 | class="text-xs-center td td-row" | 195 | class="text-xs-center td td-row" |
196 | v-else | 196 | v-else |
197 | >{{ props.item.schoolId.name }}</td> | 197 | >{{ props.item.schoolId.name }}</td> |
198 | <td class="text-xs-center td td-row"> | 198 | <td class="text-xs-center td td-row"> |
199 | <v-btn | 199 | <v-btn |
200 | class="add-button" | 200 | class="add-button" |
201 | @click="generatePDF2Canvas(props.item)" | 201 | @click="generatePDF2Canvas(props.item)" |
202 | :loading="loadingPdf" | 202 | :loading="loadingPdf" |
203 | dark | 203 | dark |
204 | >{{ props.item.fileType }}</v-btn> | 204 | >{{ props.item.fileType }}</v-btn> |
205 | </td> | 205 | </td> |
206 | <td class="text-xs-center td td-row"> | 206 | <td class="text-xs-center td td-row"> |
207 | <span> | 207 | <span> |
208 | <v-tooltip top> | 208 | <v-tooltip top> |
209 | <img | 209 | <img |
210 | slot="activator" | 210 | slot="activator" |
211 | style="cursor:pointer; width:20px; height:18px; " | 211 | style="cursor:pointer; width:20px; height:18px; " |
212 | class="mr-3" | 212 | class="mr-3" |
213 | @click="editItem(props.item)" | 213 | @click="editItem(props.item)" |
214 | src="/static/icon/edit.png" | 214 | src="/static/icon/edit.png" |
215 | /> | 215 | /> |
216 | <span>Edit</span> | 216 | <span>Edit</span> |
217 | </v-tooltip> | 217 | </v-tooltip> |
218 | <v-tooltip top> | 218 | <v-tooltip top> |
219 | <img | 219 | <img |
220 | slot="activator" | 220 | slot="activator" |
221 | style="cursor:pointer; width:20px; height:20px; " | 221 | style="cursor:pointer; width:20px; height:20px; " |
222 | class="mr-3" | 222 | class="mr-3" |
223 | @click="deleteItem(props.item)" | 223 | @click="deleteItem(props.item)" |
224 | src="/static/icon/delete.png" | 224 | src="/static/icon/delete.png" |
225 | /> | 225 | /> |
226 | <span>Delete</span> | 226 | <span>Delete</span> |
227 | </v-tooltip> | 227 | </v-tooltip> |
228 | </span> | 228 | </span> |
229 | </td> | 229 | </td> |
230 | </tr> | 230 | </tr> |
231 | </template> | 231 | </template> |
232 | <v-alert | 232 | <v-alert |
233 | slot="no-results" | 233 | slot="no-results" |
234 | :value="true" | 234 | :value="true" |
235 | color="error" | 235 | color="error" |
236 | icon="warning" | 236 | icon="warning" |
237 | >Your search for "{{ search }}" found no results.</v-alert> | 237 | >Your search for "{{ search }}" found no results.</v-alert> |
238 | </v-data-table> | 238 | </v-data-table> |
239 | <!-- ****** ADD SYLLABUS ****** --> | 239 | <!-- ****** ADD SYLLABUS ****** --> |
240 | <v-snackbar | 240 | <v-snackbar |
241 | :timeout="timeout" | 241 | :timeout="timeout" |
242 | :top="y === 'top'" | 242 | :top="y === 'top'" |
243 | :right="x === 'right'" | 243 | :right="x === 'right'" |
244 | :vertical="mode === 'vertical'" | 244 | :vertical="mode === 'vertical'" |
245 | v-model="snackbar" | 245 | v-model="snackbar" |
246 | :color="color" | 246 | :color="color" |
247 | >{{ text }}</v-snackbar> | 247 | >{{ text }}</v-snackbar> |
248 | <v-dialog v-model="addSyllabusDialog" max-width="400px"> | 248 | <v-dialog v-model="addSyllabusDialog" max-width="400px"> |
249 | <v-card flat class="card-style pa-2" dark> | 249 | <v-card flat class="card-style pa-2" dark> |
250 | <v-layout> | 250 | <v-layout> |
251 | <v-flex xs12> | 251 | <v-flex xs12> |
252 | <label class="title text-xs-center">Add Syllabus</label> | 252 | <label class="title text-xs-center">Add Syllabus</label> |
253 | <v-icon size="24" class="right" @click="addSyllabusDialog = false">cancel</v-icon> | 253 | <v-icon size="24" class="right" @click="addSyllabusDialog = false">cancel</v-icon> |
254 | </v-flex> | 254 | </v-flex> |
255 | </v-layout> | 255 | </v-layout> |
256 | <v-container fluid fill-height> | 256 | <v-container fluid fill-height> |
257 | <v-layout align-center> | 257 | <v-layout align-center> |
258 | <v-flex xs12> | 258 | <v-flex xs12> |
259 | <v-form ref="form" v-model="valid" lazy-validation> | 259 | <v-form ref="form" v-model="valid" lazy-validation> |
260 | <v-layout> | 260 | <v-layout> |
261 | <v-flex xs4 sm4 class="pt-4 subheading"> | 261 | <v-flex xs4 sm4 class="pt-4 subheading"> |
262 | <label class="right">Title :</label> | 262 | <label class="right">Title :</label> |
263 | </v-flex> | 263 | </v-flex> |
264 | <v-flex xs8 sm8 class="ml-3"> | 264 | <v-flex xs8 sm8 class="ml-3"> |
265 | <v-text-field | 265 | <v-text-field |
266 | v-model="addSyllabus.title" | 266 | v-model="addSyllabus.title" |
267 | name="name" | 267 | name="name" |
268 | type="text" | 268 | type="text" |
269 | placeholder="Add Title" | 269 | placeholder="Add Title" |
270 | :rules="titleRules" | 270 | :rules="titleRules" |
271 | required | 271 | required |
272 | ></v-text-field> | 272 | ></v-text-field> |
273 | </v-flex> | 273 | </v-flex> |
274 | </v-layout> | 274 | </v-layout> |
275 | <v-layout> | 275 | <v-layout> |
276 | <v-flex xs4 sm4 class="pt-4 subheading"> | 276 | <v-flex xs4 sm4 class="pt-4 subheading"> |
277 | <label class="right">Description :</label> | 277 | <label class="right">Description :</label> |
278 | </v-flex> | 278 | </v-flex> |
279 | <v-flex xs8 sm8 class="ml-3"> | 279 | <v-flex xs8 sm8 class="ml-3"> |
280 | <v-text-field | 280 | <v-text-field |
281 | v-model="addSyllabus.description" | 281 | v-model="addSyllabus.description" |
282 | name="name" | 282 | name="name" |
283 | type="text" | 283 | type="text" |
284 | placeholder="Add Description" | 284 | placeholder="Add Description" |
285 | :rules="descriptionRules" | 285 | :rules="descriptionRules" |
286 | required | 286 | required |
287 | ></v-text-field> | 287 | ></v-text-field> |
288 | </v-flex> | 288 | </v-flex> |
289 | </v-layout> | 289 | </v-layout> |
290 | <v-layout> | 290 | <v-layout> |
291 | <v-flex xs4 class="pt-4 subheading"> | 291 | <v-flex xs4 class="pt-4 subheading"> |
292 | <label class="right">Class:</label> | 292 | <label class="right">Class:</label> |
293 | </v-flex> | 293 | </v-flex> |
294 | <v-flex xs8 class="ml-3"> | 294 | <v-flex xs8 class="ml-3"> |
295 | <v-select | 295 | <v-select |
296 | :items="classList" | 296 | :items="classList" |
297 | v-model="addSyllabus.classId" | 297 | v-model="addSyllabus.classId" |
298 | label="Select Class" | 298 | label="Select Class" |
299 | item-text="classNum" | 299 | item-text="classNum" |
300 | item-value="_id" | 300 | item-value="_id" |
301 | name="Select Class" | 301 | name="Select Class" |
302 | @change="getSections(addSyllabus.classId)" | 302 | @change="getSections(addSyllabus.classId)" |
303 | required | 303 | required |
304 | ></v-select> | 304 | ></v-select> |
305 | </v-flex> | 305 | </v-flex> |
306 | </v-layout> | 306 | </v-layout> |
307 | <!-- <v-layout> | 307 | <!-- <v-layout> |
308 | <v-flex xs4 sm4 class="pt-4 subheading"> | 308 | <v-flex xs4 sm4 class="pt-4 subheading"> |
309 | <label class="right">Section :</label> | 309 | <label class="right">Section :</label> |
310 | </v-flex> | 310 | </v-flex> |
311 | <v-flex xs8 sm8 class="ml-3"> | 311 | <v-flex xs8 sm8 class="ml-3"> |
312 | <v-select | 312 | <v-select |
313 | :items="addSection" | 313 | :items="addSection" |
314 | label="Select Section" | 314 | label="Select Section" |
315 | item-text="name" | 315 | item-text="name" |
316 | item-value="_id" | 316 | item-value="_id" |
317 | v-model="addSyllabus.sectionId" | 317 | v-model="addSyllabus.sectionId" |
318 | name="Select Section" | 318 | name="Select Section" |
319 | class="px-2" | 319 | class="px-2" |
320 | required | 320 | required |
321 | ></v-select> | 321 | ></v-select> |
322 | </v-flex> | 322 | </v-flex> |
323 | </v-layout>--> | 323 | </v-layout>--> |
324 | <v-layout> | 324 | <v-layout> |
325 | <v-flex xs4 class="pt-4 subheading"> | 325 | <v-flex xs4 class="pt-4 subheading"> |
326 | <label class="right">File:</label> | 326 | <label class="right">File:</label> |
327 | </v-flex> | 327 | </v-flex> |
328 | <v-flex xs8 sm6 class="ml-3"> | 328 | <v-flex xs8 sm6 class="ml-3"> |
329 | <v-text-field | 329 | <v-text-field |
330 | label="Select file" | 330 | label="Select file" |
331 | @click="pickFile" | 331 | @click="pickFile" |
332 | v-model="imageName" | 332 | v-model="imageName" |
333 | append-icon="attach_file" | 333 | append-icon="attach_file" |
334 | ></v-text-field> | 334 | ></v-text-field> |
335 | <input | 335 | <input |
336 | type="file" | 336 | type="file" |
337 | style="display:none" | 337 | style="display:none" |
338 | ref="image" | 338 | ref="image" |
339 | accept="image/*" | 339 | accept="image/*" |
340 | @change="onFilePicked" | 340 | @change="onFilePicked" |
341 | /> | 341 | /> |
342 | </v-flex> | 342 | </v-flex> |
343 | </v-layout> | 343 | </v-layout> |
344 | <v-layout> | 344 | <v-layout> |
345 | <v-flex xs12 sm12> | 345 | <v-flex xs12 sm12> |
346 | <v-card-actions> | 346 | <v-card-actions> |
347 | <v-spacer></v-spacer> | 347 | <v-spacer></v-spacer> |
348 | <v-btn | 348 | <v-btn |
349 | @click="submit" | 349 | @click="submit" |
350 | round | 350 | round |
351 | dark | 351 | dark |
352 | :loading="loading" | 352 | :loading="loading" |
353 | class="add-button" | 353 | class="add-button" |
354 | >Add Syllabus</v-btn> | 354 | >Add Syllabus</v-btn> |
355 | </v-card-actions> | 355 | </v-card-actions> |
356 | </v-flex> | 356 | </v-flex> |
357 | </v-layout> | 357 | </v-layout> |
358 | </v-form> | 358 | </v-form> |
359 | </v-flex> | 359 | </v-flex> |
360 | </v-layout> | 360 | </v-layout> |
361 | </v-container> | 361 | </v-container> |
362 | </v-card> | 362 | </v-card> |
363 | </v-dialog> | 363 | </v-dialog> |
364 | <div class="loader" v-if="showLoader"> | 364 | <div class="loader" v-if="showLoader"> |
365 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 365 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
366 | </div> | 366 | </div> |
367 | </v-container> | 367 | </v-container> |
368 | </template> | 368 | </template> |
369 | 369 | ||
370 | <script> | 370 | <script> |
371 | import http from "@/Services/http.js"; | 371 | import http from "@/Services/http.js"; |
372 | import Util from "@/util"; | 372 | import Util from "@/util"; |
373 | import moment from "moment"; | 373 | import moment from "moment"; |
374 | import jsPDF from "jspdf"; | 374 | import jsPDF from "jspdf"; |
375 | import { saveAs } from "file-saver"; | 375 | import { saveAs } from "file-saver"; |
376 | 376 | ||
377 | export default { | 377 | export default { |
378 | data: () => ({ | 378 | data: () => ({ |
379 | snackbar: false, | 379 | snackbar: false, |
380 | y: "top", | 380 | y: "top", |
381 | x: "right", | 381 | x: "right", |
382 | mode: "", | 382 | mode: "", |
383 | timeout: 3000, | 383 | timeout: 3000, |
384 | text: "", | 384 | text: "", |
385 | color: "", | 385 | color: "", |
386 | show: true, | 386 | show: true, |
387 | showSearch: false, | 387 | showSearch: false, |
388 | showLoader: false, | 388 | showLoader: false, |
389 | loading: false, | 389 | loading: false, |
390 | editLoading: false, | 390 | editLoading: false, |
391 | date: null, | 391 | date: null, |
392 | search: "", | 392 | search: "", |
393 | editSyllabusDialog: false, | 393 | editSyllabusDialog: false, |
394 | valid: true, | 394 | valid: true, |
395 | validEditSyllabus: true, | 395 | validEditSyllabus: true, |
396 | addSyllabusDialog: false, | 396 | addSyllabusDialog: false, |
397 | loadingPdf: false, | 397 | loadingPdf: false, |
398 | 398 | ||
399 | pagination: { | 399 | pagination: { |
400 | rowsPerPage: 10 | 400 | rowsPerPage: 10 |
401 | }, | 401 | }, |
402 | token: "", | 402 | token: "", |
403 | upload: "", | 403 | upload: "", |
404 | titleRules: [v => !!v || " Title is required"], | 404 | titleRules: [v => !!v || " Title is required"], |
405 | descriptionRules: [v => !!v || " Description is required"], | 405 | descriptionRules: [v => !!v || " Description is required"], |
406 | classRules: [v => !!v || " Class Name is required"], | 406 | classRules: [v => !!v || " Class Name is required"], |
407 | fileRules: [v => !!v || " File is required"], | 407 | fileRules: [v => !!v || " File is required"], |
408 | headers: [ | 408 | headers: [ |
409 | { | 409 | { |
410 | text: "No", | 410 | text: "No", |
411 | align: "", | 411 | align: "", |
412 | sortable: false, | 412 | sortable: false, |
413 | value: "No" | 413 | value: "No" |
414 | }, | 414 | }, |
415 | { | 415 | { |
416 | text: "Title", | 416 | text: "Title", |
417 | value: "title", | 417 | value: "title", |
418 | sortable: false, | 418 | sortable: false, |
419 | align: "center" | 419 | align: "center" |
420 | }, | 420 | }, |
421 | { | 421 | { |
422 | text: "Description", | 422 | text: "Description", |
423 | value: "description", | 423 | value: "description", |
424 | sortable: false, | 424 | sortable: false, |
425 | align: "center" | 425 | align: "center" |
426 | }, | 426 | }, |
427 | { | 427 | { |
428 | text: "Date", | 428 | text: "Date", |
429 | value: "created", | 429 | value: "created", |
430 | sortable: false, | 430 | sortable: false, |
431 | align: "center" | 431 | align: "center" |
432 | }, | 432 | }, |
433 | { | 433 | { |
434 | text: "Uploader", | 434 | text: "Uploader", |
435 | value: "upload", | 435 | value: "upload", |
436 | sortable: false, | 436 | sortable: false, |
437 | align: "center" | 437 | align: "center" |
438 | }, | 438 | }, |
439 | { | 439 | { |
440 | text: "File", | 440 | text: "File", |
441 | value: "documentUrl", | 441 | value: "documentUrl", |
442 | sortable: false, | 442 | sortable: false, |
443 | align: "center" | 443 | align: "center" |
444 | }, | 444 | }, |
445 | { text: "Action", value: "", sortable: false, align: "center" } | 445 | { text: "Action", value: "", sortable: false, align: "center" } |
446 | ], | 446 | ], |
447 | syllabusList: [], | 447 | syllabusList: [], |
448 | classList: [], | 448 | classList: [], |
449 | addSection: [], | 449 | addSection: [], |
450 | editedIndex: -1, | 450 | editedIndex: -1, |
451 | addSyllabus: {}, | 451 | addSyllabus: {}, |
452 | showSyllabus: {}, | ||
452 | 453 | ||
453 | editedItem: { | 454 | editedItem: { |
454 | subjectName: "" | 455 | subjectName: "" |
455 | }, | 456 | }, |
456 | imageData: {}, | 457 | imageData: {}, |
457 | imageName: "", | 458 | imageName: "", |
458 | imageUrl: "", | 459 | imageUrl: "", |
459 | imageFile: "" | 460 | imageFile: "" |
460 | }), | 461 | }), |
461 | 462 | ||
462 | methods: { | 463 | methods: { |
463 | pickFile() { | 464 | pickFile() { |
464 | this.$refs.image.click(); | 465 | this.$refs.image.click(); |
465 | }, | 466 | }, |
466 | dates: function(date) { | 467 | dates: function(date) { |
467 | return moment(date).format("MMMM DD, YYYY"); | 468 | return moment(date).format("MMMM DD, YYYY"); |
468 | }, | 469 | }, |
469 | editItem(item) { | 470 | editItem(item) { |
470 | this.editedIndex = this.syllabusList; | 471 | this.editedIndex = this.syllabusList; |
471 | this.editedItem = Object.assign({}, item); | 472 | this.editedItem = Object.assign({}, item); |
472 | this.dialog = true; | 473 | this.dialog = true; |
473 | this.editSyllabusDialog = true; | 474 | this.editSyllabusDialog = true; |
474 | }, | 475 | }, |
475 | download(item) { | 476 | download(item) { |
476 | this.editedIndex = this.syllabusList; | 477 | this.editedIndex = this.syllabusList; |
477 | this.editedItem = Object.assign({}, item); | 478 | this.editedItem = Object.assign({}, item); |
478 | this.dialog1 = true; | 479 | this.dialog1 = true; |
479 | }, | 480 | }, |
480 | deleteItem(item) { | 481 | deleteItem(item) { |
481 | let deleteSyallabus = { | 482 | let deleteSyallabus = { |
482 | syallabusId: item._id | 483 | syallabusId: item._id |
483 | }; | 484 | }; |
484 | http() | 485 | http() |
485 | .delete( | 486 | .delete( |
486 | "/deleteSyallabus", | 487 | "/deleteSyallabus", |
487 | confirm("Are you sure you want to delete this?") && { | 488 | confirm("Are you sure you want to delete this?") && { |
488 | params: deleteSyallabus | 489 | params: deleteSyallabus |
489 | } | 490 | } |
490 | ) | 491 | ) |
491 | .then(response => { | 492 | .then(response => { |
492 | this.getSyallabusList(); | 493 | this.getSyallabusList(); |
493 | this.snackbar = true; | 494 | this.snackbar = true; |
494 | this.color = "green"; | 495 | this.color = "green"; |
495 | this.text = "Successfully delete Existing Syllabus"; | 496 | this.text = "Successfully delete Existing Syllabus"; |
496 | }) | 497 | }) |
497 | .catch(error => { | 498 | .catch(error => { |
498 | this.snackbar = true; | 499 | this.snackbar = true; |
499 | this.text = error.response.data.message; | 500 | this.text = error.response.data.message; |
500 | this.color = "error"; | 501 | this.color = "error"; |
501 | }); | 502 | }); |
502 | }, | 503 | }, |
503 | close() { | 504 | close() { |
504 | this.editSyllabusDialog = false; | 505 | this.editSyllabusDialog = false; |
505 | }, | 506 | }, |
506 | 507 | ||
507 | submit() { | 508 | submit() { |
508 | // var addSyllabus = { | 509 | // var addSyllabus = { |
509 | // classId: this.addSyllabus.classId, | 510 | // classId: this.addSyllabus.classId, |
510 | // title: this.addSyllabus.title, | 511 | // title: this.addSyllabus.title, |
511 | // description: this.addSyllabus.description, | 512 | // description: this.addSyllabus.description, |
512 | // upload: this.addSyllabus.upload, | 513 | // upload: this.addSyllabus.upload, |
513 | // fileType: this.addSyllabus.fileType | 514 | // fileType: this.addSyllabus.fileType |
514 | // }; | 515 | // }; |
515 | var signatures = { | 516 | var signatures = { |
516 | JVBERi0: "other", | 517 | JVBERi0: "other", |
517 | iVBORw0KGgo: "image", | 518 | iVBORw0KGgo: "image", |
518 | UEsDBBQ: "other", | 519 | UEsDBBQ: "other", |
519 | "/": "image", | 520 | "/": "image", |
520 | AAABAA: "image", | 521 | AAABAA: "image", |
521 | IywiV2hhdC: "other", | 522 | IywiV2hhdC: "other", |
522 | bmFtZSxl: "other" | 523 | bmFtZSxl: "other" |
523 | }; | 524 | }; |
524 | function detectMimeType(b64) { | 525 | function detectMimeType(b64) { |
525 | for (var s in signatures) { | 526 | for (var s in signatures) { |
526 | if (b64.indexOf(s) === 0) { | 527 | if (b64.indexOf(s) === 0) { |
527 | return signatures[s]; | 528 | return signatures[s]; |
528 | } | 529 | } |
529 | } | 530 | } |
530 | } | 531 | } |
531 | if (this.$refs.form.validate()) { | 532 | if (this.$refs.form.validate()) { |
532 | if (this.imageUrl) { | 533 | if (this.imageUrl) { |
533 | var str = this.imageUrl; | 534 | var str = this.imageUrl; |
534 | const [baseUrl, imageUrl] = str.split(/,/); | 535 | const [baseUrl, imageUrl] = str.split(/,/); |
535 | this.addSyllabus.upload = imageUrl; | 536 | this.addSyllabus.upload = imageUrl; |
536 | this.addSyllabus.fileType = detectMimeType(imageUrl); | 537 | this.addSyllabus.fileType = detectMimeType(imageUrl); |
537 | this.addSyllabus.fileName = this.imageName; | 538 | this.addSyllabus.fileName = this.imageName; |
538 | } | 539 | } |
539 | http() | 540 | http() |
540 | .post("/createSyallabus", this.addSyllabus) | 541 | .post("/createSyallabus", this.addSyllabus) |
541 | .then(response => { | 542 | .then(response => { |
542 | this.getSyallabusList(); | 543 | this.getSyallabusList(); |
543 | this.snackbar = true; | 544 | this.snackbar = true; |
544 | this.text = "Syllabus added successfully"; | 545 | this.text = "Syllabus added successfully"; |
545 | this.clear(); | 546 | this.clear(); |
546 | this.color = "green"; | 547 | this.color = "green"; |
547 | this.addSyllabusDialog = false; | 548 | this.addSyllabusDialog = false; |
548 | }) | 549 | }) |
549 | .catch(error => { | 550 | .catch(error => { |
550 | // console.log(error); | 551 | // console.log(error); |
551 | this.snackbar = true; | 552 | this.snackbar = true; |
552 | this.text = error.response.data.message; | 553 | this.text = error.response.data.message; |
553 | this.color = "error"; | 554 | this.color = "error"; |
554 | }); | 555 | }); |
555 | } | 556 | } |
556 | }, | 557 | }, |
557 | onFilePicked(e) { | 558 | onFilePicked(e) { |
558 | const files = e.target.files; | 559 | const files = e.target.files; |
559 | this.upload = e.target.files[0]; | 560 | this.upload = e.target.files[0]; |
560 | if (files[0] !== undefined) { | 561 | if (files[0] !== undefined) { |
561 | this.imageName = files[0].name; | 562 | this.imageName = files[0].name; |
562 | if (this.imageName.lastIndexOf(".") <= 0) { | 563 | if (this.imageName.lastIndexOf(".") <= 0) { |
563 | return; | 564 | return; |
564 | } | 565 | } |
565 | const fr = new FileReader(); | 566 | const fr = new FileReader(); |
566 | fr.readAsDataURL(files[0]); | 567 | fr.readAsDataURL(files[0]); |
567 | fr.addEventListener("load", () => { | 568 | fr.addEventListener("load", () => { |
568 | this.imageUrl = fr.result; | 569 | this.imageUrl = fr.result; |
569 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 570 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
570 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 571 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
571 | }); | 572 | }); |
572 | } else { | 573 | } else { |
573 | this.imageName = ""; | 574 | this.imageName = ""; |
574 | this.imageFile = ""; | 575 | this.imageFile = ""; |
575 | this.imageUrl = ""; | 576 | this.imageUrl = ""; |
576 | } | 577 | } |
577 | }, | 578 | }, |
578 | clear() { | 579 | clear() { |
579 | this.$refs.form.reset(); | 580 | this.$refs.form.reset(); |
580 | }, | 581 | }, |
581 | save() { | 582 | save() { |
582 | if (this.$refs.formEditSyllabus.validate()) { | 583 | if (this.$refs.formEditSyllabus.validate()) { |
583 | let syllabusData = { | 584 | let syllabusData = { |
584 | syallabusId: this.editedItem._id, | 585 | syallabusId: this.editedItem._id, |
585 | classId: this.editedItem.classId._id, | 586 | classId: this.editedItem.classId._id, |
586 | // sectionId: this.editedItem.sectionId, | 587 | // sectionId: this.editedItem.sectionId, |
587 | title: this.editedItem.title, | 588 | title: this.editedItem.title, |
588 | description: this.editedItem.description, | 589 | description: this.editedItem.description, |
589 | upload: this.editedItem.upload, | 590 | upload: this.editedItem.upload, |
590 | fileType: this.editedItem.fileType, | 591 | fileType: this.editedItem.fileType, |
591 | fileName: this.imageName | 592 | fileName: this.imageName |
592 | }; | 593 | }; |
593 | this.editLoading = true; | 594 | this.editLoading = true; |
594 | var signatures = { | 595 | var signatures = { |
595 | JVBERi0: "other", | 596 | JVBERi0: "other", |
596 | iVBORw0KGgo: "image", | 597 | iVBORw0KGgo: "image", |
597 | UEsDBBQ: "other", | 598 | UEsDBBQ: "other", |
598 | "/": "image", | 599 | "/": "image", |
599 | AAABAA: "image", | 600 | AAABAA: "image", |
600 | IywiV2hhdC: "other" | 601 | IywiV2hhdC: "other" |
601 | }; | 602 | }; |
602 | function detectMimeType(b64) { | 603 | function detectMimeType(b64) { |
603 | for (var s in signatures) { | 604 | for (var s in signatures) { |
604 | if (b64.indexOf(s) === 0) { | 605 | if (b64.indexOf(s) === 0) { |
605 | return signatures[s]; | 606 | return signatures[s]; |
606 | } | 607 | } |
607 | } | 608 | } |
608 | } | 609 | } |
609 | if (this.imageUrl) { | 610 | if (this.imageUrl) { |
610 | var str = this.imageUrl; | 611 | var str = this.imageUrl; |
611 | const [baseUrl, imageUrl] = str.split(/,/); | 612 | const [baseUrl, imageUrl] = str.split(/,/); |
612 | syllabusData.upload = imageUrl; | 613 | syllabusData.upload = imageUrl; |
613 | syllabusData.fileType = detectMimeType(imageUrl); | 614 | syllabusData.fileType = detectMimeType(imageUrl); |
614 | } | 615 | } |
615 | http() | 616 | http() |
616 | .put("/updateSyallabus", syllabusData) | 617 | .put("/updateSyallabus", syllabusData) |
617 | .then(response => { | 618 | .then(response => { |
618 | this.snackbar = true; | 619 | this.snackbar = true; |
619 | this.text = "Successfully Edit Existing Syllabus"; | 620 | this.text = "Successfully Edit Existing Syllabus"; |
620 | this.color = "green"; | 621 | this.color = "green"; |
621 | this.editLoading = false; | 622 | this.editLoading = false; |
622 | this.editSyllabusDialog = false; | 623 | this.editSyllabusDialog = false; |
623 | http() | 624 | http() |
624 | .get( | 625 | .get( |
625 | "/getSyallabusList", | 626 | "/getSyallabusList", |
626 | { params: { classId: this.addSyllabus.classId } }, | 627 | { params: { classId: this.addSyllabus.classId } }, |
627 | { | 628 | { |
628 | headers: { Authorization: "Bearer " + this.token } | 629 | headers: { Authorization: "Bearer " + this.token } |
629 | } | 630 | } |
630 | ) | 631 | ) |
631 | .then(response => { | 632 | .then(response => { |
632 | this.syllabusList = response.data.data; | 633 | this.syllabusList = response.data.data; |
633 | this.getSyallabusList(); | 634 | this.getSyallabusList(); |
634 | this.snackbar = true; | 635 | this.snackbar = true; |
635 | this.color = "green"; | 636 | this.color = "green"; |
636 | this.close(); | 637 | this.close(); |
637 | }) | 638 | }) |
638 | .catch(err => { | 639 | .catch(err => { |
639 | console.log("err====>", err); | 640 | console.log("err====>", err); |
640 | this.text = error.response.data.message; | 641 | this.text = error.response.data.message; |
641 | this.color = "error"; | 642 | this.color = "error"; |
642 | }); | 643 | }); |
643 | }) | 644 | }) |
644 | .catch(error => { | 645 | .catch(error => { |
645 | this.editLoading = false; | 646 | this.editLoading = false; |
646 | }); | 647 | }); |
647 | } | 648 | } |
648 | }, | 649 | }, |
649 | getSyallabusList() { | 650 | getSyallabusList() { |
650 | this.showLoader = true; | 651 | this.showLoader = true; |
651 | http() | 652 | http() |
652 | .get( | 653 | .get( |
653 | "/getSyallabusList", | 654 | "/getSyallabusList", |
654 | { params: { classId: this.addSyllabus.classId } }, | 655 | { params: { classId: this.showSyllabus.classId } }, |
655 | { | 656 | { |
656 | headers: { Authorization: "Bearer " + this.token } | 657 | headers: { Authorization: "Bearer " + this.token } |
657 | } | 658 | } |
658 | ) | 659 | ) |
659 | .then(response => { | 660 | .then(response => { |
660 | this.syllabusList = response.data.data; | 661 | this.syllabusList = response.data.data; |
661 | this.showLoader = false; | 662 | this.showLoader = false; |
662 | }) | 663 | }) |
663 | .catch(err => { | 664 | .catch(err => { |
664 | this.showLoader = false; | 665 | this.showLoader = false; |
665 | }); | 666 | }); |
666 | }, | 667 | }, |
667 | getClass() { | 668 | getClass() { |
668 | http() | 669 | http() |
669 | .get("/getClassesList", { | 670 | .get("/getClassesList", { |
670 | headers: { Authorization: "Bearer " + this.token } | 671 | headers: { Authorization: "Bearer " + this.token } |
671 | }) | 672 | }) |
672 | .then(response => { | 673 | .then(response => { |
673 | this.classList = response.data.data; | 674 | this.classList = response.data.data; |
674 | }) | 675 | }) |
675 | .catch(error => { | 676 | .catch(error => { |
676 | if (error.response.status === 401) { | 677 | if (error.response.status === 401) { |
677 | this.$router.replace({ path: "/" }); | 678 | this.$router.replace({ path: "/" }); |
678 | this.$store.dispatch("setToken", null); | 679 | this.$store.dispatch("setToken", null); |
679 | this.$store.dispatch("Id", null); | 680 | this.$store.dispatch("Id", null); |
680 | } | 681 | } |
681 | }); | 682 | }); |
682 | }, | 683 | }, |
683 | getSections(_id) { | 684 | getSections(_id) { |
684 | var token = this.$store.state.token; | 685 | var token = this.$store.state.token; |
685 | this.showLoader = true; | 686 | this.showLoader = true; |
686 | http() | 687 | http() |
687 | .get( | 688 | .get( |
688 | "/getSectionsList", | 689 | "/getSectionsList", |
689 | { params: { classId: _id } }, | 690 | { params: { classId: _id } }, |
690 | { | 691 | { |
691 | headers: { Authorization: "Bearer " + token } | 692 | headers: { Authorization: "Bearer " + token } |
692 | } | 693 | } |
693 | ) | 694 | ) |
694 | .then(response => { | 695 | .then(response => { |
695 | this.addSection = response.data.data; | 696 | this.addSection = response.data.data; |
696 | this.showLoader = false; | 697 | this.showLoader = false; |
697 | }) | 698 | }) |
698 | .catch(err => { | 699 | .catch(err => { |
699 | this.showLoader = false; | 700 | this.showLoader = false; |
700 | }); | 701 | }); |
701 | }, | 702 | }, |
702 | displaySearch() { | 703 | displaySearch() { |
703 | (this.show = false), (this.showSearch = true); | 704 | (this.show = false), (this.showSearch = true); |
704 | }, | 705 | }, |
705 | closeSearch() { | 706 | closeSearch() { |
706 | this.showSearch = false; | 707 | this.showSearch = false; |
707 | this.show = true; | 708 | this.show = true; |
708 | this.search = ""; | 709 | this.search = ""; |
709 | }, | 710 | }, |
710 | 711 | ||
711 | async generatePDF2Canvas(item) { | 712 | async generatePDF2Canvas(item) { |
712 | // console.log("documentUrl", documentUrl); | 713 | // console.log("documentUrl", documentUrl); |
713 | // this.loadingPdf = true; | 714 | // this.loadingPdf = true; |
714 | // const el = this.$refs.printMe; | 715 | // const el = this.$refs.printMe; |
715 | // add option type to get the image version | 716 | // add option type to get the image version |
716 | // if not provided the promise will return | 717 | // if not provided the promise will return |
717 | // the canvas. | 718 | // the canvas. |
718 | // const options = { | 719 | // const options = { |
719 | // type: "dataURL" | 720 | // type: "dataURL" |
720 | // }; | 721 | // }; |
721 | // this.output = await this.$html2canvas(el, options); | 722 | // this.output = await this.$html2canvas(el, options); |
722 | // console.log("el,option", this.output); | 723 | // console.log("el,option", this.output); |
723 | // if (this.output) { | 724 | // if (this.output) { |
724 | // this.loadingPdf = false; | 725 | // this.loadingPdf = false; |
725 | // } | 726 | // } |
726 | // let doc = new jsPDF(); | 727 | // let doc = new jsPDF(); |
727 | // doc.addImage(this.output,"JPEG", 5, 10, 200, 280); | 728 | // doc.addImage(this.output,"JPEG", 5, 10, 200, 280); |
728 | // doc.save("File.pdf"); | 729 | // doc.save("File.pdf"); |
729 | 730 | ||
730 | // function download(documentUrl, filename) { | 731 | // function download(documentUrl, filename) { |
731 | // fetch(documentUrl).then(function(t) { | 732 | // fetch(documentUrl).then(function(t) { |
732 | // return t.blob().then(b => { | 733 | // return t.blob().then(b => { |
733 | // var a = document.createElement("a"); | 734 | // var a = document.createElement("a"); |
734 | // a.href = URL.createObjectURL(b); | 735 | // a.href = URL.createObjectURL(b); |
735 | // a.setAttribute("download", "filename"); | 736 | // a.setAttribute("download", "filename"); |
736 | // a.click(); | 737 | // a.click(); |
737 | // }); | 738 | // }); |
738 | // }); | 739 | // }); |
739 | // } | 740 | // } |
740 | var dataType = ""; | 741 | var dataType = ""; |
741 | var type = ""; | 742 | var type = ""; |
742 | if (item.fileType == "image") { | 743 | if (item.fileType == "image") { |
743 | dataType = "file.jpg"; | 744 | dataType = "file.jpg"; |
744 | } else if (item.fileType == "other") { | 745 | } else if (item.fileType == "other") { |
745 | dataType = "file.pdf"; | 746 | dataType = "file.pdf"; |
746 | type = "application/pdf"; | 747 | type = "application/pdf"; |
747 | } | 748 | } |
748 | var FileSaver = require("file-saver"); | 749 | var FileSaver = require("file-saver"); |
749 | FileSaver.saveAs(item.documentUrl, "image.jpg"); | 750 | FileSaver.saveAs(item.documentUrl, "image.jpg"); |
750 | 751 | ||
751 | // var blob = new Blob([item.documentUrl], { | 752 | // var blob = new Blob([item.documentUrl], { |
752 | // type: type | 753 | // type: type |
753 | // }); | 754 | // }); |
754 | // FileSaver.saveAs(blob, dataType); | 755 | // FileSaver.saveAs(blob, dataType); |
755 | // const url = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); | 756 | // const url = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); |
756 | // console.log("document", item.documentUrl); | 757 | // console.log("document", item.documentUrl); |
757 | // const link = document.createElement("a"); | 758 | // const link = document.createElement("a"); |
758 | // link.href = url; | 759 | // link.href = url; |
759 | // link.setAttribute("download", dataType); //or any other extension | 760 | // link.setAttribute("download", dataType); //or any other extension |
760 | // document.body.appendChild(link); | 761 | // document.body.appendChild(link); |
761 | // link.click(); | 762 | // link.click(); |
762 | 763 | ||
763 | // const blob = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); | 764 | // const blob = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); |
764 | // const link = document.createElement('a') | 765 | // const link = document.createElement('a') |
765 | // link.href = URL.createObjectURL(blob) | 766 | // link.href = URL.createObjectURL(blob) |
766 | // link.download = dataType | 767 | // link.download = dataType |
767 | // link.click() | 768 | // link.click() |
768 | // URL.revokeObjectURL(link.href) | 769 | // URL.revokeObjectURL(link.href) |
769 | } | 770 | } |
770 | }, | 771 | }, |
771 | mounted() { | 772 | mounted() { |
772 | this.token = this.$store.state.token; | 773 | this.token = this.$store.state.token; |
773 | this.role = this.$store.state.role; | 774 | this.role = this.$store.state.role; |
774 | this.getClass(); | 775 | this.getClass(); |
775 | } | 776 | } |
776 | }; | 777 | }; |
777 | </script> | 778 | </script> |
src/pages/Class/addclass.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT ClASS ****** --> | 3 | <!-- ****** EDIT ClASS ****** --> |
4 | <v-dialog v-model="editClassDialog" max-width="400px"> | 4 | <v-dialog v-model="editClassDialog" 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 Class</label> | 8 | <label class="title text-xs-center">Edit Class</label> |
9 | <v-icon size="24" class="right" @click="editClassDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editClassDialog = 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-layout justify-center> | 13 | <v-layout justify-center> |
14 | <v-flex xs12 sm12> | 14 | <v-flex xs12 sm12> |
15 | <v-flex xs12> | 15 | <v-flex xs12> |
16 | <v-text-field v-model="editedItem.classNum" @keyup.enter="save" :rules="nameRules"></v-text-field> | 16 | <v-text-field v-model="editedItem.classNum" @keyup.enter="save" :rules="nameRules"></v-text-field> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-card-actions> | 18 | <v-card-actions> |
19 | <v-spacer></v-spacer> | 19 | <v-spacer></v-spacer> |
20 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 20 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
21 | <v-spacer></v-spacer> | 21 | <v-spacer></v-spacer> |
22 | </v-card-actions> | 22 | </v-card-actions> |
23 | </v-flex> | 23 | </v-flex> |
24 | </v-layout> | 24 | </v-layout> |
25 | </v-container> | 25 | </v-container> |
26 | </v-card> | 26 | </v-card> |
27 | </v-dialog> | 27 | </v-dialog> |
28 | 28 | ||
29 | <!-- ****** PROFILE VIEW STUDENTS ****** --> | 29 | <!-- ****** PROFILE VIEW STUDENTS ****** --> |
30 | <v-dialog v-model="profileClassDialog" max-width="400px"> | 30 | <v-dialog v-model="profileClassDialog" max-width="400px"> |
31 | <v-card flat class="card-style pa-3" dark> | 31 | <v-card flat class="card-style pa-3" dark> |
32 | <v-layout> | 32 | <v-layout> |
33 | <v-flex xs12> | 33 | <v-flex xs12> |
34 | <label class="title text-xs-center">View Class</label> | 34 | <label class="title text-xs-center">View Class</label> |
35 | <v-icon size="24" class="right" @click="profileClassDialog = false">cancel</v-icon> | 35 | <v-icon size="24" class="right" @click="profileClassDialog = false">cancel</v-icon> |
36 | </v-flex> | 36 | </v-flex> |
37 | </v-layout> | 37 | </v-layout> |
38 | <v-card-text> | 38 | <v-card-text> |
39 | <v-container grid-list-md> | 39 | <v-container grid-list-md> |
40 | <v-layout wrap> | 40 | <v-layout wrap> |
41 | <v-flex xs6 sm6> | 41 | <v-flex xs6 sm6> |
42 | <h5 class="right my-1 subheading"> | 42 | <h5 class="right my-1 subheading"> |
43 | <b>Class Name:</b> | 43 | <b>Class Name:</b> |
44 | </h5> | 44 | </h5> |
45 | </v-flex> | 45 | </v-flex> |
46 | <v-flex sm6 xs6> | 46 | <v-flex sm6 xs6> |
47 | <h5 class="my-1">{{ editedItem.classNum }}</h5> | 47 | <h5 class="my-1">{{ editedItem.classNum }}</h5> |
48 | </v-flex> | 48 | </v-flex> |
49 | </v-layout> | 49 | </v-layout> |
50 | </v-container> | 50 | </v-container> |
51 | </v-card-text> | 51 | </v-card-text> |
52 | </v-card> | 52 | </v-card> |
53 | </v-dialog> | 53 | </v-dialog> |
54 | 54 | ||
55 | <!-- ****** Class Table ****** --> | 55 | <!-- ****** Class Table ****** --> |
56 | 56 | ||
57 | <v-toolbar color="transparent" flat> | 57 | <v-toolbar color="transparent" flat> |
58 | <v-btn | 58 | <v-btn |
59 | fab | 59 | fab |
60 | dark | 60 | dark |
61 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 61 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
62 | small | 62 | small |
63 | @click="addClassDialog = true" | 63 | @click="addClassDialog = true" |
64 | > | 64 | > |
65 | <v-icon dark>add</v-icon> | 65 | <v-icon dark>add</v-icon> |
66 | </v-btn> | 66 | </v-btn> |
67 | <v-btn | 67 | <v-btn |
68 | round | 68 | round |
69 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 69 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
70 | dark | 70 | dark |
71 | @click="addClassDialog = true" | 71 | @click="addClassDialog = true" |
72 | > | 72 | > |
73 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Class | 73 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Class |
74 | </v-btn> | 74 | </v-btn> |
75 | <v-spacer></v-spacer> | 75 | <v-spacer></v-spacer> |
76 | <v-card-title class="body-1" v-show="show"> | 76 | <v-card-title class="body-1" v-show="show"> |
77 | <v-btn icon large flat @click="displaySearch"> | 77 | <v-btn icon large flat @click="displaySearch"> |
78 | <v-avatar size="27"> | 78 | <v-avatar size="27"> |
79 | <img src="/static/icon/search.png" alt="icon" /> | 79 | <img src="/static/icon/search.png" alt="icon" /> |
80 | </v-avatar> | 80 | </v-avatar> |
81 | </v-btn> | 81 | </v-btn> |
82 | </v-card-title> | 82 | </v-card-title> |
83 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | 83 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> |
84 | <v-layout> | 84 | <v-layout> |
85 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 85 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> |
86 | <v-icon @click="closeSearch" color="error">close</v-icon> | 86 | <v-icon @click="closeSearch" color="error">close</v-icon> |
87 | </v-layout> | 87 | </v-layout> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-toolbar> | 89 | </v-toolbar> |
90 | <v-data-table | 90 | <v-data-table |
91 | :headers="headers" | 91 | :headers="headers" |
92 | :items="classList" | 92 | :items="classList" |
93 | :pagination.sync="pagination" | 93 | :pagination.sync="pagination" |
94 | :search="search" | 94 | :search="search" |
95 | > | 95 | > |
96 | <template slot="items" slot-scope="props"> | 96 | <template slot="items" slot-scope="props"> |
97 | <tr class="tr"> | 97 | <tr class="tr"> |
98 | <td class="td td-row">{{ props.index + 1 }}</td> | 98 | <td class="td td-row">{{ props.index + 1 }}</td> |
99 | <td class="text-xs-center td td-row">{{ props.item.classNum}}</td> | 99 | <td class="text-xs-center td td-row">{{ props.item.classNum}}</td> |
100 | <td class="text-xs-center td td-row"> | 100 | <td class="text-xs-center td td-row"> |
101 | <span> | 101 | <span> |
102 | <v-tooltip top> | 102 | <v-tooltip top> |
103 | <img | 103 | <img |
104 | slot="activator" | 104 | slot="activator" |
105 | style="cursor:pointer; width:25px; height:25px; " | 105 | style="cursor:pointer; width:25px; height:25px; " |
106 | class="mr-3" | 106 | class="mr-3" |
107 | @click="profile(props.item)" | 107 | @click="profile(props.item)" |
108 | src="/static/icon/view.png" | 108 | src="/static/icon/view.png" |
109 | /> | 109 | /> |
110 | <span>View</span> | 110 | <span>View</span> |
111 | </v-tooltip> | 111 | </v-tooltip> |
112 | <v-tooltip top> | 112 | <v-tooltip top> |
113 | <img | 113 | <img |
114 | slot="activator" | 114 | slot="activator" |
115 | style="cursor:pointer; width:20px; height:18px; " | 115 | style="cursor:pointer; width:20px; height:18px; " |
116 | class="mr-3" | 116 | class="mr-3" |
117 | @click="editItem(props.item)" | 117 | @click="editItem(props.item)" |
118 | src="/static/icon/edit.png" | 118 | src="/static/icon/edit.png" |
119 | /> | 119 | /> |
120 | <span>Edit</span> | 120 | <span>Edit</span> |
121 | </v-tooltip> | 121 | </v-tooltip> |
122 | <v-tooltip top> | 122 | <!-- <v-tooltip top> |
123 | <img | 123 | <img |
124 | slot="activator" | 124 | slot="activator" |
125 | style="cursor:pointer; width:20px; height:20px; " | 125 | style="cursor:pointer; width:20px; height:20px; " |
126 | @click="deleteItem(props.item)" | 126 | @click="deleteItem(props.item)" |
127 | src="/static/icon/delete.png" | 127 | src="/static/icon/delete.png" |
128 | /> | 128 | /> |
129 | <span>Delete</span> | 129 | <span>Delete</span> |
130 | </v-tooltip> | 130 | </v-tooltip> --> |
131 | </span> | 131 | </span> |
132 | </td> | 132 | </td> |
133 | </tr> | 133 | </tr> |
134 | </template> | 134 | </template> |
135 | <v-alert | 135 | <v-alert |
136 | slot="no-results" | 136 | slot="no-results" |
137 | :value="true" | 137 | :value="true" |
138 | color="error" | 138 | color="error" |
139 | icon="warning" | 139 | icon="warning" |
140 | >Your search for "{{ search }}" found no results.</v-alert> | 140 | >Your search for "{{ search }}" found no results.</v-alert> |
141 | </v-data-table> | 141 | </v-data-table> |
142 | 142 | ||
143 | <!-- ****** ADD Class ****** --> | 143 | <!-- ****** ADD Class ****** --> |
144 | <v-dialog v-model="addClassDialog" max-width="400px"> | 144 | <v-dialog v-model="addClassDialog" max-width="400px"> |
145 | <v-card flat class="card-style pa-2" dark> | 145 | <v-card flat class="card-style pa-2" dark> |
146 | <v-layout> | 146 | <v-layout> |
147 | <v-flex xs12> | 147 | <v-flex xs12> |
148 | <label class="title text-xs-center">Add Class</label> | 148 | <label class="title text-xs-center">Add Class</label> |
149 | <v-icon size="24" class="right" @click="addClassDialog = false">cancel</v-icon> | 149 | <v-icon size="24" class="right" @click="addClassDialog = false">cancel</v-icon> |
150 | </v-flex> | 150 | </v-flex> |
151 | </v-layout> | 151 | </v-layout> |
152 | <v-container fluid fill-height> | 152 | <v-container fluid fill-height> |
153 | <v-layout align-center> | 153 | <v-layout align-center> |
154 | <v-flex xs12> | 154 | <v-flex xs12> |
155 | <v-form ref="form" v-model="valid" lazy-validation> | 155 | <v-form ref="form" v-model="valid" lazy-validation> |
156 | <v-flex xs12 class="headline text-xs-center"> | 156 | <v-flex xs12 class="headline text-xs-center"> |
157 | <label>Class</label> | 157 | <label>Class</label> |
158 | </v-flex> | 158 | </v-flex> |
159 | <v-flex xs12> | 159 | <v-flex xs12> |
160 | <v-text-field | 160 | <v-text-field |
161 | v-model="addclasses.classNum" | 161 | v-model="addclasses.classNum" |
162 | placeholder="fill your class Name" | 162 | placeholder="fill your class Name" |
163 | type="text" | 163 | type="text" |
164 | :rules="nameRules" | 164 | :rules="nameRules" |
165 | required | 165 | required |
166 | ></v-text-field> | 166 | ></v-text-field> |
167 | </v-flex> | 167 | </v-flex> |
168 | <v-layout> | 168 | <v-layout> |
169 | <v-flex xs12 sm12> | 169 | <v-flex xs12 sm12> |
170 | <v-card-actions> | 170 | <v-card-actions> |
171 | <v-spacer></v-spacer> | 171 | <v-spacer></v-spacer> |
172 | <v-btn | 172 | <v-btn |
173 | @click="submit" | 173 | @click="submit" |
174 | class="add-button" | 174 | class="add-button" |
175 | round | 175 | round |
176 | dark | 176 | dark |
177 | :loading="loading" | 177 | :loading="loading" |
178 | >Add Class</v-btn> | 178 | >Add Class</v-btn> |
179 | <v-spacer></v-spacer> | 179 | <v-spacer></v-spacer> |
180 | </v-card-actions> | 180 | </v-card-actions> |
181 | </v-flex> | 181 | </v-flex> |
182 | </v-layout> | 182 | </v-layout> |
183 | </v-form> | 183 | </v-form> |
184 | </v-flex> | 184 | </v-flex> |
185 | </v-layout> | 185 | </v-layout> |
186 | </v-container> | 186 | </v-container> |
187 | </v-card> | 187 | </v-card> |
188 | </v-dialog> | 188 | </v-dialog> |
189 | <div class="loader" v-if="showLoader"> | 189 | <div class="loader" v-if="showLoader"> |
190 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 190 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
191 | </div> | 191 | </div> |
192 | <v-snackbar | 192 | <v-snackbar |
193 | :timeout="timeout" | 193 | :timeout="timeout" |
194 | :top="y === 'top'" | 194 | :top="y === 'top'" |
195 | :right="x === 'right'" | 195 | :right="x === 'right'" |
196 | :vertical="mode === 'vertical'" | 196 | :vertical="mode === 'vertical'" |
197 | v-model="snackbar" | 197 | v-model="snackbar" |
198 | :color="color" | 198 | :color="color" |
199 | >{{ text }}</v-snackbar> | 199 | >{{ text }}</v-snackbar> |
200 | </v-container> | 200 | </v-container> |
201 | </template> | 201 | </template> |
202 | 202 | ||
203 | <script> | 203 | <script> |
204 | import http from "@/Services/http.js"; | 204 | import http from "@/Services/http.js"; |
205 | 205 | ||
206 | export default { | 206 | export default { |
207 | data: () => ({ | 207 | data: () => ({ |
208 | snackbar: false, | 208 | snackbar: false, |
209 | y: "top", | 209 | y: "top", |
210 | x: "right", | 210 | x: "right", |
211 | mode: "", | 211 | mode: "", |
212 | timeout: 5000, | 212 | timeout: 5000, |
213 | text: "", | 213 | text: "", |
214 | color: "", | 214 | color: "", |
215 | show: true, | 215 | show: true, |
216 | showSearch: false, | 216 | showSearch: false, |
217 | showLoader: false, | 217 | showLoader: false, |
218 | loading: false, | 218 | loading: false, |
219 | addClassDialog: false, | 219 | addClassDialog: false, |
220 | search: "", | 220 | search: "", |
221 | editClassDialog: false, | 221 | editClassDialog: false, |
222 | profileClassDialog: false, | 222 | profileClassDialog: false, |
223 | valid: true, | 223 | valid: true, |
224 | pagination: { | 224 | pagination: { |
225 | rowsPerPage: 10 | 225 | rowsPerPage: 10 |
226 | }, | 226 | }, |
227 | nameRules: [v => !!v || " Class Name is required"], | 227 | nameRules: [v => !!v || " Class Name is required"], |
228 | headers: [ | 228 | headers: [ |
229 | { | 229 | { |
230 | text: "No", | 230 | text: "No", |
231 | align: "left", | 231 | align: "left", |
232 | sortable: false, | 232 | sortable: false, |
233 | value: "No" | 233 | value: "No" |
234 | }, | 234 | }, |
235 | { text: "Class No", value: "classNum", sortable: false, align: "center" }, | 235 | { text: "Class No", value: "classNum", sortable: false, align: "center" }, |
236 | 236 | ||
237 | { text: "Action", value: "", sortable: false, align: "center" } | 237 | { text: "Action", value: "", sortable: false, align: "center" } |
238 | ], | 238 | ], |
239 | classList: [], | 239 | classList: [], |
240 | editedIndex: -1, | 240 | editedIndex: -1, |
241 | editedItem: { | 241 | editedItem: { |
242 | classNum: "" | 242 | classNum: "" |
243 | }, | 243 | }, |
244 | addclasses: { | 244 | addclasses: { |
245 | classNum: "" | 245 | classNum: "" |
246 | } | 246 | } |
247 | }), | 247 | }), |
248 | methods: { | 248 | methods: { |
249 | getClassList() { | 249 | getClassList() { |
250 | this.showLoader = true; | 250 | this.showLoader = true; |
251 | var token = this.$store.state.token; | 251 | var token = this.$store.state.token; |
252 | http() | 252 | http() |
253 | .get("/getClassesList") | 253 | .get("/getClassesList") |
254 | .then(response => { | 254 | .then(response => { |
255 | this.classList = response.data.data; | 255 | this.classList = response.data.data; |
256 | this.showLoader = false; | 256 | this.showLoader = false; |
257 | }) | 257 | }) |
258 | .catch(error => { | 258 | .catch(error => { |
259 | this.showLoader = false; | 259 | this.showLoader = false; |
260 | if (error.response.status === 401) { | 260 | if (error.response.status === 401) { |
261 | this.$router.replace({ path: "/" }); | 261 | this.$router.replace({ path: "/" }); |
262 | this.$store.dispatch("setToken", null); | 262 | this.$store.dispatch("setToken", null); |
263 | this.$store.dispatch("Id", null); | 263 | this.$store.dispatch("Id", null); |
264 | } | 264 | } |
265 | }); | 265 | }); |
266 | }, | 266 | }, |
267 | editItem(item) { | 267 | editItem(item) { |
268 | this.editedIndex = this.classList.indexOf(item); | 268 | this.editedIndex = this.classList.indexOf(item); |
269 | this.editedItem = Object.assign({}, item); | 269 | this.editedItem = Object.assign({}, item); |
270 | this.editClassDialog = true; | 270 | this.editClassDialog = true; |
271 | }, | 271 | }, |
272 | profile(item) { | 272 | profile(item) { |
273 | this.editedIndex = this.classList.indexOf(item); | 273 | this.editedIndex = this.classList.indexOf(item); |
274 | this.editedItem = Object.assign({}, item); | 274 | this.editedItem = Object.assign({}, item); |
275 | this.profileClassDialog = true; | 275 | this.profileClassDialog = true; |
276 | }, | 276 | }, |
277 | deleteItem(item) { | 277 | deleteItem(item) { |
278 | let deleteStudent = { | 278 | let deleteStudent = { |
279 | classId: item._id | 279 | classId: item._id |
280 | }; | 280 | }; |
281 | http() | 281 | http() |
282 | .delete( | 282 | .delete( |
283 | "/deleteClass", | 283 | "/deleteClass", |
284 | confirm("Are you sure you want to delete this?") && { | 284 | confirm("Are you sure you want to delete this?") && { |
285 | params: deleteStudent | 285 | params: deleteStudent |
286 | } | 286 | } |
287 | ) | 287 | ) |
288 | .then(response => { | 288 | .then(response => { |
289 | this.snackbar = true; | 289 | this.snackbar = true; |
290 | this.text = response.data.message; | 290 | this.text = response.data.message; |
291 | this.color = "green"; | 291 | this.color = "green"; |
292 | this.getClassList(); | 292 | this.getClassList(); |
293 | }) | 293 | }) |
294 | .catch(error => { | 294 | .catch(error => { |
295 | this.snackbar = true; | 295 | this.snackbar = true; |
296 | this.color = "error"; | 296 | this.color = "error"; |
297 | this.text = error.response.data.message; | 297 | this.text = error.response.data.message; |
298 | }); | 298 | }); |
299 | }, | 299 | }, |
300 | close() { | 300 | close() { |
301 | this.editClassDialog = false; | 301 | this.editClassDialog = false; |
302 | }, | 302 | }, |
303 | closeProfile() { | 303 | closeProfile() { |
304 | this.profileClassDialog = false; | 304 | this.profileClassDialog = false; |
305 | }, | 305 | }, |
306 | submit() { | 306 | submit() { |
307 | if (this.$refs.form.validate()) { | 307 | if (this.$refs.form.validate()) { |
308 | let addClass = { | 308 | let addClass = { |
309 | classNum: this.addclasses.classNum | 309 | classNum: this.addclasses.classNum |
310 | }; | 310 | }; |
311 | this.loading = true; | 311 | this.loading = true; |
312 | http() | 312 | http() |
313 | .post("/createClass", addClass) | 313 | .post("/createClass", addClass) |
314 | .then(response => { | 314 | .then(response => { |
315 | this.getClassList(); | 315 | this.getClassList(); |
316 | this.snackbar = true; | 316 | this.snackbar = true; |
317 | this.text = response.data.message; | 317 | this.text = response.data.message; |
318 | this.color = "green" | 318 | this.color = "green" |
319 | this.clear(); | 319 | this.clear(); |
320 | this.loading = false; | 320 | this.loading = false; |
321 | this.addClassDialog = false; | 321 | this.addClassDialog = false; |
322 | }) | 322 | }) |
323 | .catch(error => { | 323 | .catch(error => { |
324 | this.loading = false; | 324 | this.loading = false; |
325 | this.snackbar = true; | 325 | this.snackbar = true; |
326 | this.color = "error"; | 326 | this.color = "error"; |
327 | this.text = error.response.data.message; | 327 | this.text = error.response.data.message; |
328 | }); | 328 | }); |
329 | } | 329 | } |
330 | }, | 330 | }, |
331 | clear() { | 331 | clear() { |
332 | this.$refs.form.reset(); | 332 | this.$refs.form.reset(); |
333 | }, | 333 | }, |
334 | save() { | 334 | save() { |
335 | let editClass = { | 335 | let editClass = { |
336 | classId: this.editedItem._id, | 336 | classId: this.editedItem._id, |
337 | classNum: this.editedItem.classNum | 337 | classNum: this.editedItem.classNum |
338 | }; | 338 | }; |
339 | http() | 339 | http() |
340 | .put("/updateClass", editClass) | 340 | .put("/updateClass", editClass) |
341 | .then(response => { | 341 | .then(response => { |
342 | this.snackbar = true; | 342 | this.snackbar = true; |
343 | this.text = response.data.message; | 343 | this.text = response.data.message; |
344 | this.color = "green"; | 344 | this.color = "green"; |
345 | this.getClassList(); | 345 | this.getClassList(); |
346 | this.close(); | 346 | this.close(); |
347 | }) | 347 | }) |
348 | .catch(error => { | 348 | .catch(error => { |
349 | this.snackbar = true; | 349 | this.snackbar = true; |
350 | this.text = error.response.data.message; | 350 | this.text = error.response.data.message; |
351 | this.color = "error"; | 351 | this.color = "error"; |
352 | // console.log(error); | 352 | // console.log(error); |
353 | }); | 353 | }); |
354 | }, | 354 | }, |
355 | displaySearch() { | 355 | displaySearch() { |
356 | (this.show = false), (this.showSearch = true); | 356 | (this.show = false), (this.showSearch = true); |
357 | }, | 357 | }, |
358 | closeSearch() { | 358 | closeSearch() { |
359 | this.showSearch = false; | 359 | this.showSearch = false; |
360 | this.show = true; | 360 | this.show = true; |
361 | this.search = ""; | 361 | this.search = ""; |
362 | } | 362 | } |
363 | }, | 363 | }, |
364 | mounted() { | 364 | mounted() { |
365 | this.getClassList(); | 365 | this.getClassList(); |
366 | } | 366 | } |
367 | // created() { | 367 | // created() { |
368 | // this.$root.$on("app:search", search => { | 368 | // this.$root.$on("app:search", search => { |
369 | // this.search = search; | 369 | // this.search = search; |
370 | // }); | 370 | // }); |
371 | // }, | 371 | // }, |
372 | // beforeDestroy() { | 372 | // beforeDestroy() { |
373 | // // dont forget to remove the listener | 373 | // // dont forget to remove the listener |
374 | // this.$root.$off("app:search"); | 374 | // this.$root.$off("app:search"); |
375 | // } | 375 | // } |
376 | }; | 376 | }; |
377 | </script> | 377 | </script> |
378 | <style> | 378 | <style> |
379 | </style> | 379 | </style> |
src/pages/Exam/examAttendence.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ***** Exam Schedule TABLE****** --> | 3 | <!-- ***** Exam Schedule TABLE****** --> |
4 | <v-toolbar color="transparent" flat> | 4 | <v-toolbar color="transparent" flat> |
5 | <v-btn | 5 | <v-btn |
6 | fab | 6 | fab |
7 | dark | 7 | dark |
8 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 8 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
9 | small | 9 | small |
10 | @click="addExamAttendenceDialog = true" | 10 | @click="addExamAttendenceDialog = true" |
11 | > | 11 | > |
12 | <v-icon dark>add</v-icon> | 12 | <v-icon dark>add</v-icon> |
13 | </v-btn> | 13 | </v-btn> |
14 | <v-btn | 14 | <v-btn |
15 | round | 15 | round |
16 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 16 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
17 | dark | 17 | dark |
18 | @click="addExamAttendenceDialog = true" | 18 | @click="addExamAttendenceDialog = true" |
19 | > | 19 | > |
20 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Attendence | 20 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Attendence |
21 | </v-btn> | 21 | </v-btn> |
22 | <v-spacer></v-spacer> | 22 | <v-spacer></v-spacer> |
23 | <v-flex xs8 sm3 md2 class="mr-3"> | 23 | <v-flex xs8 sm3 md2 class="mr-3"> |
24 | <v-select | 24 | <v-select |
25 | v-model="addAttendence.examId" | 25 | v-model="getAttendence.examId" |
26 | label="Select Exam" | 26 | label="Select Exam" |
27 | :rules="examRules" | 27 | :rules="examRules" |
28 | :items="examList" | 28 | :items="examList" |
29 | item-text="examName" | 29 | item-text="examName" |
30 | item-value="_id" | 30 | item-value="_id" |
31 | required | 31 | required |
32 | ></v-select> | 32 | ></v-select> |
33 | </v-flex> | 33 | </v-flex> |
34 | <v-flex xs8 sm3 md2 class="mr-3"> | 34 | <v-flex xs8 sm3 md2 class="mr-3"> |
35 | <v-select | 35 | <v-select |
36 | v-model="addAttendence.classId" | 36 | v-model="getAttendence.classId" |
37 | label="Select your class" | 37 | label="Select your class" |
38 | type="text" | 38 | type="text" |
39 | :items="classList" | 39 | :items="classList" |
40 | item-text="classNum" | 40 | item-text="classNum" |
41 | item-value="_id" | 41 | item-value="_id" |
42 | @change="getSections(addAttendence.classId)" | 42 | @change="getSections(getAttendence.classId)" |
43 | required | 43 | required |
44 | ></v-select> | 44 | ></v-select> |
45 | </v-flex> | 45 | </v-flex> |
46 | <v-flex xs8 sm3 md2 class="mr-3"> | 46 | <v-flex xs8 sm3 md2 class="mr-3"> |
47 | <v-select | 47 | <v-select |
48 | v-model="addAttendence.sectionId" | 48 | v-model="getAttendence.sectionId" |
49 | label="Select your section" | 49 | label="Select your section" |
50 | type="text" | 50 | type="text" |
51 | :items="addSection" | 51 | :items="addSection" |
52 | item-text="name" | 52 | item-text="name" |
53 | item-value="_id" | 53 | item-value="_id" |
54 | @change="getClassSubject(addAttendence.classId)" | 54 | @change="getClassSubject(getAttendence.classId)" |
55 | required | 55 | required |
56 | ></v-select> | 56 | ></v-select> |
57 | </v-flex> | 57 | </v-flex> |
58 | <v-flex xs8 sm3 md2 class="mr-3"> | 58 | <v-flex xs8 sm3 md2 class="mr-3"> |
59 | <v-select | 59 | <v-select |
60 | v-model="addAttendence.subjectId" | 60 | v-model="getAttendence.subjectId" |
61 | label="Select Subject" | 61 | label="Select Subject" |
62 | :rules="subjectRules" | 62 | :rules="subjectRules" |
63 | :items="subjectList.subjects" | 63 | :items="subjectList.subjects" |
64 | item-text="subjectName" | 64 | item-text="subjectName" |
65 | item-value="_id" | 65 | item-value="_id" |
66 | @change="getExamAttendenceList()" | 66 | @change="getExamAttendenceList()" |
67 | required | 67 | required |
68 | ></v-select> | 68 | ></v-select> |
69 | </v-flex> | 69 | </v-flex> |
70 | 70 | ||
71 | <v-card-title class="body-1" v-show="show"> | 71 | <v-card-title class="body-1" v-show="show"> |
72 | <v-btn icon large flat @click="displaySearch"> | 72 | <v-btn icon large flat @click="displaySearch"> |
73 | <v-avatar size="27"> | 73 | <v-avatar size="27"> |
74 | <img src="/static/icon/search.png" alt="icon" /> | 74 | <img src="/static/icon/search.png" alt="icon" /> |
75 | </v-avatar> | 75 | </v-avatar> |
76 | </v-btn> | 76 | </v-btn> |
77 | </v-card-title> | 77 | </v-card-title> |
78 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | 78 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> |
79 | <v-layout> | 79 | <v-layout> |
80 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 80 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> |
81 | <v-icon @click="closeSearch" color="error">close</v-icon> | 81 | <v-icon @click="closeSearch" color="error">close</v-icon> |
82 | </v-layout> | 82 | </v-layout> |
83 | </v-flex> | 83 | </v-flex> |
84 | </v-toolbar> | 84 | </v-toolbar> |
85 | 85 | ||
86 | <v-data-table | 86 | <v-data-table |
87 | :headers="headers" | 87 | :headers="headers" |
88 | :items="examData.students" | 88 | :items="examData.students" |
89 | :pagination.sync="pagination" | 89 | :pagination.sync="pagination" |
90 | :search="search" | 90 | :search="search" |
91 | > | 91 | > |
92 | <template slot="items" slot-scope="props"> | 92 | <template slot="items" slot-scope="props"> |
93 | <tr class="tr"> | 93 | <tr class="tr"> |
94 | <td class="td td-row">{{ props.index + 1}}</td> | 94 | <td class="td td-row">{{ props.index + 1}}</td> |
95 | <td class="text-xs-center td td-row"> | 95 | <td class="text-xs-center td td-row"> |
96 | <v-avatar size="40"> | 96 | <v-avatar size="40"> |
97 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 97 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
98 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 98 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
99 | </v-avatar> | 99 | </v-avatar> |
100 | </td> | 100 | </td> |
101 | <td class="td td-row text-xs-center">{{ props.item.studentId.name}}</td> | 101 | <td class="td td-row text-xs-center">{{ props.item.studentId.name}}</td> |
102 | <td class="td td-row text-xs-center">{{ props.item.studentId.rollNo}}</td> | 102 | <td class="td td-row text-xs-center">{{ props.item.studentId.rollNo}}</td> |
103 | <td class="td td-row text-xs-center">{{ props.item.studentId.email }}</td> | 103 | <td class="td td-row text-xs-center">{{ props.item.studentId.email }}</td> |
104 | <td class="td td-row text-xs-center"> | 104 | <td class="td td-row text-xs-center"> |
105 | <v-radio-group v-model="isPresent" row readonly> | 105 | <v-radio-group v-model="isPresent" row readonly> |
106 | <v-radio | 106 | <v-radio |
107 | :value="props.item.isPresent" | 107 | :value="props.item.isPresent" |
108 | ></v-radio> | 108 | ></v-radio> |
109 | </v-radio-group> | 109 | </v-radio-group> |
110 | </td> | 110 | </td> |
111 | </tr> | 111 | </tr> |
112 | </template> | 112 | </template> |
113 | <v-alert | 113 | <v-alert |
114 | slot="no-results" | 114 | slot="no-results" |
115 | :value="true" | 115 | :value="true" |
116 | color="error" | 116 | color="error" |
117 | icon="warning" | 117 | icon="warning" |
118 | >Your search for "{{ search }}" found no results.</v-alert> | 118 | >Your search for "{{ search }}" found no results.</v-alert> |
119 | </v-data-table> | 119 | </v-data-table> |
120 | 120 | ||
121 | <!-- ****** ADD Exam Attendence ****** --> | 121 | <!-- ****** ADD Exam Attendence ****** --> |
122 | <v-dialog v-model="addExamAttendenceDialog" max-width="800px"> | 122 | <v-dialog v-model="addExamAttendenceDialog" max-width="800px"> |
123 | <v-card flat class="text-xs-center pa-2"> | 123 | <v-card flat class="text-xs-center pa-2"> |
124 | <v-layout> | 124 | <v-layout> |
125 | <v-flex xs12> | 125 | <v-flex xs12> |
126 | <label class="title text-xs-center">Add Exam Attendence</label> | 126 | <label class="title text-xs-center">Add Exam Attendence</label> |
127 | <v-icon size="24" class="right" @click="addExamAttendenceDialog = false">cancel</v-icon> | 127 | <v-icon size="24" class="right" @click="addExamAttendenceDialog = false">cancel</v-icon> |
128 | </v-flex> | 128 | </v-flex> |
129 | </v-layout> | 129 | </v-layout> |
130 | <v-form ref="form" v-model="valid" lazy-validation class="text-xs-center"> | 130 | <v-form ref="form" v-model="valid" lazy-validation class="text-xs-center"> |
131 | <v-container fluid> | 131 | <v-container fluid> |
132 | <v-flex xs12> | 132 | <v-flex xs12> |
133 | <v-layout> | 133 | <v-layout> |
134 | <v-flex xs5 class="pt-4 subheading"> | 134 | <v-flex xs5 class="pt-4 subheading"> |
135 | <label class="right">Exam Name:</label> | 135 | <label class="right">Exam Name:</label> |
136 | </v-flex> | 136 | </v-flex> |
137 | <v-flex xs7 sm7 md6 class="ml-3"> | 137 | <v-flex xs7 sm7 md6 class="ml-3"> |
138 | <v-select | 138 | <v-select |
139 | label="Select Exam" | 139 | label="Select Exam" |
140 | :rules="examRules" | 140 | :rules="examRules" |
141 | :items="examList" | 141 | :items="examList" |
142 | v-model="addAttendence.examId" | 142 | v-model="addAttendence.examId" |
143 | item-text="examName" | 143 | item-text="examName" |
144 | item-value="_id" | 144 | item-value="_id" |
145 | ></v-select> | 145 | ></v-select> |
146 | </v-flex> | 146 | </v-flex> |
147 | </v-layout> | 147 | </v-layout> |
148 | </v-flex> | 148 | </v-flex> |
149 | <v-flex xs12> | 149 | <v-flex xs12> |
150 | <v-layout> | 150 | <v-layout> |
151 | <v-flex xs5 class="pt-4 subheading"> | 151 | <v-flex xs5 class="pt-4 subheading"> |
152 | <label class="right">Class:</label> | 152 | <label class="right">Class:</label> |
153 | </v-flex> | 153 | </v-flex> |
154 | <v-flex xs7 sm7 md6 class="ml-3"> | 154 | <v-flex xs7 sm7 md6 class="ml-3"> |
155 | <v-select | 155 | <v-select |
156 | v-model="addAttendence.classId" | 156 | v-model="addAttendence.classId" |
157 | label="Select Class" | 157 | label="Select Class" |
158 | type="text" | 158 | type="text" |
159 | :items="classList" | 159 | :items="classList" |
160 | item-text="classNum" | 160 | item-text="classNum" |
161 | item-value="_id" | 161 | item-value="_id" |
162 | :rules="classRules" | 162 | :rules="classRules" |
163 | @change="getSections(addAttendence.classId)" | 163 | @change="getSections(addAttendence.classId)" |
164 | required | 164 | required |
165 | ></v-select> | 165 | ></v-select> |
166 | </v-flex> | 166 | </v-flex> |
167 | </v-layout> | 167 | </v-layout> |
168 | </v-flex> | 168 | </v-flex> |
169 | <v-flex xs12> | 169 | <v-flex xs12> |
170 | <v-layout> | 170 | <v-layout> |
171 | <v-flex xs5 class="pt-4 subheading"> | 171 | <v-flex xs5 class="pt-4 subheading"> |
172 | <label class="right">Section:</label> | 172 | <label class="right">Section:</label> |
173 | </v-flex> | 173 | </v-flex> |
174 | <v-flex xs7 sm7 md6 class="ml-3"> | 174 | <v-flex xs7 sm7 md6 class="ml-3"> |
175 | <v-select | 175 | <v-select |
176 | :items="addSection" | 176 | :items="addSection" |
177 | label="Select Section" | 177 | label="Select Section" |
178 | v-model="addAttendence.sectionId" | 178 | v-model="addAttendence.sectionId" |
179 | item-text="name" | 179 | item-text="name" |
180 | item-value="_id" | 180 | item-value="_id" |
181 | name="Select Section" | 181 | name="Select Section" |
182 | :rules="sectionRules" | 182 | :rules="sectionRules" |
183 | @change="getClassSubject(addAttendence.classId)" | 183 | @change="getClassSubject(addAttendence.classId)" |
184 | required | 184 | required |
185 | ></v-select> | 185 | ></v-select> |
186 | </v-flex> | 186 | </v-flex> |
187 | </v-layout> | 187 | </v-layout> |
188 | </v-flex> | 188 | </v-flex> |
189 | <v-flex xs12> | 189 | <v-flex xs12> |
190 | <v-layout> | 190 | <v-layout> |
191 | <v-flex xs5 class="pt-4 subheading"> | 191 | <v-flex xs5 class="pt-4 subheading"> |
192 | <label class="right">Subject Name:</label> | 192 | <label class="right">Subject Name:</label> |
193 | </v-flex> | 193 | </v-flex> |
194 | <v-flex xs7 sm7 md6 class="ml-3"> | 194 | <v-flex xs7 sm7 md6 class="ml-3"> |
195 | <v-select | 195 | <v-select |
196 | :items="subjectList.subjects" | 196 | :items="subjectList.subjects" |
197 | label="Select Subject" | 197 | label="Select Subject" |
198 | item-text="subjectName" | 198 | item-text="subjectName" |
199 | v-model="addAttendence.subjectId" | 199 | v-model="addAttendence.subjectId" |
200 | item-value="_id" | 200 | item-value="_id" |
201 | name="Select Subject" | 201 | name="Select Subject" |
202 | :rules="subjectRules" | 202 | :rules="subjectRules" |
203 | required | 203 | required |
204 | ></v-select> | 204 | ></v-select> |
205 | </v-flex> | 205 | </v-flex> |
206 | </v-layout> | 206 | </v-layout> |
207 | </v-flex> | 207 | </v-flex> |
208 | <v-layout> | 208 | <v-layout> |
209 | <v-flex xs12> | 209 | <v-flex xs12> |
210 | <v-card-actions> | 210 | <v-card-actions> |
211 | <v-spacer class="hidden-xs-only"></v-spacer> | 211 | <v-spacer class="hidden-xs-only"></v-spacer> |
212 | <v-btn | 212 | <v-btn |
213 | round | 213 | round |
214 | dark | 214 | dark |
215 | @click="showTable" | 215 | @click="showTable" |
216 | :loading="loading" | 216 | :loading="loading" |
217 | class="add-button" | 217 | class="add-button" |
218 | >Attendence</v-btn> | 218 | >Attendence</v-btn> |
219 | </v-card-actions> | 219 | </v-card-actions> |
220 | </v-flex> | 220 | </v-flex> |
221 | </v-layout> | 221 | </v-layout> |
222 | </v-container> | 222 | </v-container> |
223 | </v-form> | 223 | </v-form> |
224 | <v-flex xs12 v-show="attendeceTable" class> | 224 | <v-flex xs12 v-show="attendeceTable" class> |
225 | <v-data-table | 225 | <v-data-table |
226 | :headers="headers" | 226 | :headers="headers" |
227 | :items="studentsData" | 227 | :items="studentsData" |
228 | :pagination.sync="pagination" | 228 | :pagination.sync="pagination" |
229 | :search="search" | 229 | :search="search" |
230 | > | 230 | > |
231 | <template slot="items" slot-scope="props"> | 231 | <template slot="items" slot-scope="props"> |
232 | <tr class="tr"> | 232 | <tr class="tr"> |
233 | <td class="td td-row">{{ props.index + 1}}</td> | 233 | <td class="td td-row">{{ props.index + 1}}</td> |
234 | <td class="text-xs-center td td-row"> | 234 | <td class="text-xs-center td td-row"> |
235 | <v-avatar size="40"> | 235 | <v-avatar size="40"> |
236 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 236 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
237 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 237 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
238 | </v-avatar> | 238 | </v-avatar> |
239 | </td> | 239 | </td> |
240 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 240 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
241 | <td class="td td-row text-xs-center">{{ props.item.rollNo}}</td> | 241 | <td class="td td-row text-xs-center">{{ props.item.rollNo}}</td> |
242 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> | 242 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
243 | <td class="td td-row text-xs-center"> | 243 | <td class="td td-row text-xs-center"> |
244 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> | 244 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> |
245 | <v-radio | 245 | <v-radio |
246 | v-for="attendences in attendenceType" | 246 | v-for="attendences in attendenceType" |
247 | :key="attendences.value" | 247 | :key="attendences.value" |
248 | :label="`${attendences.label}`" | 248 | :label="`${attendences.label}`" |
249 | :value="attendences.value" | 249 | :value="attendences.value" |
250 | ></v-radio> | 250 | ></v-radio> |
251 | </v-radio-group> | 251 | </v-radio-group> |
252 | </td> | 252 | </td> |
253 | </tr> | 253 | </tr> |
254 | </template> | 254 | </template> |
255 | <v-alert | 255 | <v-alert |
256 | slot="no-results" | 256 | slot="no-results" |
257 | :value="true" | 257 | :value="true" |
258 | color="error" | 258 | color="error" |
259 | icon="warning" | 259 | icon="warning" |
260 | >Your search for "{{ search }}" found no results.</v-alert> | 260 | >Your search for "{{ search }}" found no results.</v-alert> |
261 | </v-data-table> | 261 | </v-data-table> |
262 | <v-flex xs12 sm12> | 262 | <v-flex xs12 sm12> |
263 | <v-card-actions> | 263 | <v-card-actions> |
264 | <v-spacer></v-spacer> | 264 | <v-spacer></v-spacer> |
265 | <v-btn @click="submit()" round dark :loading="loading" class="add-button">Submit</v-btn> | 265 | <v-btn @click="submit()" round dark :loading="loading" class="add-button">Submit</v-btn> |
266 | </v-card-actions> | 266 | </v-card-actions> |
267 | </v-flex> | 267 | </v-flex> |
268 | </v-flex> | 268 | </v-flex> |
269 | </v-card> | 269 | </v-card> |
270 | </v-dialog> | 270 | </v-dialog> |
271 | <v-snackbar | 271 | <v-snackbar |
272 | :timeout="timeout" | 272 | :timeout="timeout" |
273 | :top="y === 'top'" | 273 | :top="y === 'top'" |
274 | :right="x === 'right'" | 274 | :right="x === 'right'" |
275 | :vertical="mode === 'vertical'" | 275 | :vertical="mode === 'vertical'" |
276 | v-model="snackbar" | 276 | v-model="snackbar" |
277 | :color="color" | 277 | :color="color" |
278 | >{{ text }}</v-snackbar> | 278 | >{{ text }}</v-snackbar> |
279 | <div class="loader" v-if="showLoader"> | 279 | <div class="loader" v-if="showLoader"> |
280 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 280 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
281 | </div> | 281 | </div> |
282 | </v-container> | 282 | </v-container> |
283 | </template> | 283 | </template> |
284 | 284 | ||
285 | <script> | 285 | <script> |
286 | import http from "@/Services/http.js"; | 286 | import http from "@/Services/http.js"; |
287 | import Util from "@/util"; | 287 | import Util from "@/util"; |
288 | import moment from "moment"; | 288 | import moment from "moment"; |
289 | 289 | ||
290 | export default { | 290 | export default { |
291 | data: () => ({ | 291 | data: () => ({ |
292 | snackbar: false, | 292 | snackbar: false, |
293 | editDate: false, | 293 | editDate: false, |
294 | menu1: false, | 294 | menu1: false, |
295 | menuB: false, | 295 | menuB: false, |
296 | menu2: false, | 296 | menu2: false, |
297 | menuEdit: false, | 297 | menuEdit: false, |
298 | timeToEdit: false, | 298 | timeToEdit: false, |
299 | show: true, | 299 | show: true, |
300 | showSearch: false, | 300 | showSearch: false, |
301 | addExamAttendenceDialog: false, | 301 | addExamAttendenceDialog: false, |
302 | color: "", | 302 | color: "", |
303 | y: "top", | 303 | y: "top", |
304 | x: "right", | 304 | x: "right", |
305 | mode: "", | 305 | mode: "", |
306 | timeout: 10000, | 306 | timeout: 10000, |
307 | text: "", | 307 | text: "", |
308 | loading: false, | 308 | loading: false, |
309 | search: "", | 309 | search: "", |
310 | showLoader: false, | 310 | showLoader: false, |
311 | valid: true, | 311 | valid: true, |
312 | role: "", | 312 | role: "", |
313 | pagination: { | 313 | pagination: { |
314 | rowsPerPage: 10 | 314 | rowsPerPage: 10 |
315 | }, | 315 | }, |
316 | attendeceTable: false, | 316 | attendeceTable: false, |
317 | isPresent: true, | 317 | isPresent: true, |
318 | 318 | ||
319 | examRules: [v => !!v || "Exam Name is required"], | 319 | examRules: [v => !!v || "Exam Name is required"], |
320 | classRules: [v => !!v || "Class Name is required"], | 320 | classRules: [v => !!v || "Class Name is required"], |
321 | sectionRules: [v => !!v || "section is required"], | 321 | sectionRules: [v => !!v || "section is required"], |
322 | subjectRules: [v => !!v || "Subject is required"], | 322 | subjectRules: [v => !!v || "Subject is required"], |
323 | timeInRules: [v => !!v || "Time In is required"], | 323 | timeInRules: [v => !!v || "Time In is required"], |
324 | timeOutRules: [v => !!v || "time Out s is required"], | 324 | timeOutRules: [v => !!v || "time Out s is required"], |
325 | roomRules: [v => !!v || "Room is required"], | 325 | roomRules: [v => !!v || "Room is required"], |
326 | examScheduleDateRules: [v => !!v || "Date is required"], | 326 | examScheduleDateRules: [v => !!v || "Date is required"], |
327 | studentsData: [], | 327 | studentsData: [], |
328 | examData: [], | 328 | examData: [], |
329 | students: [], | 329 | students: [], |
330 | 330 | ||
331 | headers: [ | 331 | headers: [ |
332 | { | 332 | { |
333 | align: "", | 333 | align: "", |
334 | text: "No", | 334 | text: "No", |
335 | sortable: false, | 335 | sortable: false, |
336 | value: "No" | 336 | value: "No" |
337 | }, | 337 | }, |
338 | { | 338 | { |
339 | text: "Profile Pic", | 339 | text: "Profile Pic", |
340 | value: "profilprofilePicUrlePicUrl", | 340 | value: "profilprofilePicUrlePicUrl", |
341 | sortable: false, | 341 | sortable: false, |
342 | align: "center" | 342 | align: "center" |
343 | }, | 343 | }, |
344 | { | 344 | { |
345 | text: "Name", | 345 | text: "Name", |
346 | value: "name", | 346 | value: "name", |
347 | sortable: false, | 347 | sortable: false, |
348 | align: "center" | 348 | align: "center" |
349 | }, | 349 | }, |
350 | { | 350 | { |
351 | text: "Roll No", | 351 | text: "Roll No", |
352 | value: "rollNo", | 352 | value: "rollNo", |
353 | sortable: false, | 353 | sortable: false, |
354 | align: "center" | 354 | align: "center" |
355 | }, | 355 | }, |
356 | { | 356 | { |
357 | text: "Email", | 357 | text: "Email", |
358 | value: "email", | 358 | value: "email", |
359 | sortable: false, | 359 | sortable: false, |
360 | align: "center" | 360 | align: "center" |
361 | }, | 361 | }, |
362 | { | 362 | { |
363 | text: "Action", | 363 | text: "Action", |
364 | value: "", | 364 | value: "", |
365 | sortable: false, | 365 | sortable: false, |
366 | align: "center" | 366 | align: "center" |
367 | } | 367 | } |
368 | ], | 368 | ], |
369 | attendenceType: [ | 369 | attendenceType: [ |
370 | { | 370 | { |
371 | label: "", | 371 | label: "", |
372 | value: true | 372 | value: true |
373 | } | 373 | } |
374 | ], | 374 | ], |
375 | classList: [], | 375 | classList: [], |
376 | addSection: [], | 376 | addSection: [], |
377 | examList: [], | 377 | examList: [], |
378 | subjectList: [], | 378 | subjectList: [], |
379 | subjects: [], | 379 | subjects: [], |
380 | addAttendence: {}, | 380 | addAttendence: {}, |
381 | getAttendence: {}, | ||
381 | editedItem: { | 382 | editedItem: { |
382 | sectionId: { | 383 | sectionId: { |
383 | name: "" | 384 | name: "" |
384 | } | 385 | } |
385 | }, | 386 | }, |
386 | getScheduleData: {}, | 387 | getScheduleData: {}, |
387 | ScheduleData: [], | 388 | ScheduleData: [], |
388 | token: "" | 389 | token: "" |
389 | }), | 390 | }), |
390 | methods: { | 391 | methods: { |
391 | pickFile() { | 392 | pickFile() { |
392 | this.$refs.image.click(); | 393 | this.$refs.image.click(); |
393 | }, | 394 | }, |
394 | getSchedulesList() { | 395 | getSchedulesList() { |
395 | this.showLoader = true; | 396 | this.showLoader = true; |
396 | http() | 397 | http() |
397 | .get("/getSchedulesList", { | 398 | .get("/getSchedulesList", { |
398 | params: { classId: this.getScheduleData.classId }, | 399 | params: { classId: this.getScheduleData.classId }, |
399 | headers: { Authorization: "Bearer " + this.token } | 400 | headers: { Authorization: "Bearer " + this.token } |
400 | }) | 401 | }) |
401 | .then(response => { | 402 | .then(response => { |
402 | this.ScheduleData = response.data.data; | 403 | this.ScheduleData = response.data.data; |
403 | // console.log("this.ScheduleData", this.ScheduleData); | 404 | // console.log("this.ScheduleData", this.ScheduleData); |
404 | this.showLoader = false; | 405 | this.showLoader = false; |
405 | }) | 406 | }) |
406 | .catch(error => { | 407 | .catch(error => { |
407 | // console.log("err====>", err); | 408 | // console.log("err====>", err); |
408 | this.showLoader = false; | 409 | this.showLoader = false; |
409 | this.loadingSearch = false; | 410 | this.loadingSearch = false; |
410 | this.snackbar = true; | 411 | this.snackbar = true; |
411 | this.text = error.response.data.message; | 412 | this.text = error.response.data.message; |
412 | if (error.response.status === 401) { | 413 | if (error.response.status === 401) { |
413 | this.$router.replace({ path: "/" }); | 414 | this.$router.replace({ path: "/" }); |
414 | this.$store.dispatch("setToken", null); | 415 | this.$store.dispatch("setToken", null); |
415 | this.$store.dispatch("Id", null); | 416 | this.$store.dispatch("Id", null); |
416 | } | 417 | } |
417 | }); | 418 | }); |
418 | }, | 419 | }, |
419 | close() { | 420 | close() { |
420 | this.dialog = false; | 421 | this.dialog = false; |
421 | }, | 422 | }, |
422 | submit() { | 423 | submit() { |
423 | var examAttendence = { | 424 | var examAttendence = { |
424 | examId: this.addAttendence.examId, | 425 | examId: this.addAttendence.examId, |
425 | classId: this.addAttendence.classId, | 426 | classId: this.addAttendence.classId, |
426 | sectionId: this.addAttendence.sectionId, | 427 | sectionId: this.addAttendence.sectionId, |
427 | subjectId: this.addAttendence.subjectId, | 428 | subjectId: this.addAttendence.subjectId, |
428 | students: [] | 429 | students: [] |
429 | }; | 430 | }; |
430 | for (var j = 0; j < this.studentsData.length; j++) { | 431 | for (var j = 0; j < this.studentsData.length; j++) { |
431 | console.log("studentdata", this.studentsData); | 432 | console.log("studentdata", this.studentsData); |
432 | examAttendence.students.push({ | 433 | examAttendence.students.push({ |
433 | studentId: this.studentsData[j]._id, | 434 | studentId: this.studentsData[j]._id, |
434 | isPresent: this.studentsData[j].attendence | 435 | isPresent: this.studentsData[j].attendence |
435 | }); | 436 | }); |
436 | } | 437 | } |
437 | console.log("attendence", examAttendence); | 438 | console.log("attendence", examAttendence); |
438 | if (this.$refs.form.validate()) { | 439 | if (this.$refs.form.validate()) { |
439 | http() | 440 | http() |
440 | .post("/createExamAttendance", examAttendence) | 441 | .post("/createExamAttendance", examAttendence) |
441 | .then(response => { | 442 | .then(response => { |
442 | this.snackbar = true; | 443 | this.snackbar = true; |
443 | this.color = "success"; | 444 | this.color = "success"; |
444 | this.text = "Successfully created exam attendence"; | 445 | this.text = "Successfully created exam attendence"; |
445 | this.addExamAttendenceDialog = false; | 446 | this.addExamAttendenceDialog = false; |
446 | // this.getExamAttendenceList(); | 447 | // this.getExamAttendenceList(); |
447 | }) | 448 | }) |
448 | .catch(error => { | 449 | .catch(error => { |
449 | this.snackbar = true; | 450 | this.snackbar = true; |
450 | this.text = error.response.data.message; | 451 | this.text = error.response.data.message; |
451 | }); | 452 | }); |
452 | } | 453 | } |
453 | }, | 454 | }, |
454 | clear() { | 455 | clear() { |
455 | this.$refs.form.reset(); | 456 | this.$refs.form.reset(); |
456 | this.disable = false; | 457 | this.disable = false; |
457 | this.loading = false; | 458 | this.loading = false; |
458 | }, | 459 | }, |
459 | getClass() { | 460 | getClass() { |
460 | http() | 461 | http() |
461 | .get("/getClassesList", { | 462 | .get("/getClassesList", { |
462 | headers: { Authorization: "Bearer " + this.token } | 463 | headers: { Authorization: "Bearer " + this.token } |
463 | }) | 464 | }) |
464 | .then(response => { | 465 | .then(response => { |
465 | this.classList = response.data.data; | 466 | this.classList = response.data.data; |
466 | }) | 467 | }) |
467 | .catch(err => { | 468 | .catch(err => { |
468 | // console.log("err====>", err); | 469 | // console.log("err====>", err); |
469 | }); | 470 | }); |
470 | }, | 471 | }, |
471 | getSections(_id) { | 472 | getSections(_id) { |
472 | for (let i = 0; i < this.classList.length; i++) { | 473 | for (let i = 0; i < this.classList.length; i++) { |
473 | if (_id == this.classList[i]._id) { | 474 | if (_id == this.classList[i]._id) { |
474 | // this.subjects = this.classList[i].subjects; | 475 | // this.subjects = this.classList[i].subjects; |
475 | } | 476 | } |
476 | } | 477 | } |
477 | http() | 478 | http() |
478 | .get( | 479 | .get( |
479 | "/getSectionsList", | 480 | "/getSectionsList", |
480 | { params: { classId: _id } }, | 481 | { params: { classId: _id } }, |
481 | { | 482 | { |
482 | headers: { Authorization: "Bearer " + this.token } | 483 | headers: { Authorization: "Bearer " + this.token } |
483 | } | 484 | } |
484 | ) | 485 | ) |
485 | .then(response => { | 486 | .then(response => { |
486 | this.addSection = response.data.data; | 487 | this.addSection = response.data.data; |
487 | }) | 488 | }) |
488 | .catch(err => {}); | 489 | .catch(err => {}); |
489 | }, | 490 | }, |
490 | getClassSubject(_id) { | 491 | getClassSubject(_id) { |
491 | this.showLoader = true; | 492 | this.showLoader = true; |
492 | // this.classId = this.classId; | 493 | // this.classId = this.classId; |
493 | http() | 494 | http() |
494 | .get( | 495 | .get( |
495 | "/getParticularClass", | 496 | "/getParticularClass", |
496 | { params: { classId: _id } }, | 497 | { params: { classId: _id } }, |
497 | { | 498 | { |
498 | headers: { Authorization: "Bearer " + this.token } | 499 | headers: { Authorization: "Bearer " + this.token } |
499 | } | 500 | } |
500 | ) | 501 | ) |
501 | .then(response => { | 502 | .then(response => { |
502 | this.subjectList = response.data.data; | 503 | this.subjectList = response.data.data; |
503 | this.showLoader = false; | 504 | this.showLoader = false; |
504 | }) | 505 | }) |
505 | .catch(err => { | 506 | .catch(err => { |
506 | this.showLoader = false; | 507 | this.showLoader = false; |
507 | }); | 508 | }); |
508 | }, | 509 | }, |
509 | getExamList() { | 510 | getExamList() { |
510 | this.showLoader = true; | 511 | this.showLoader = true; |
511 | this.loadingSearch = true; | 512 | this.loadingSearch = true; |
512 | http() | 513 | http() |
513 | .get("/getExamsList", { | 514 | .get("/getExamsList", { |
514 | headers: { Authorization: "Bearer " + this.token } | 515 | headers: { Authorization: "Bearer " + this.token } |
515 | }) | 516 | }) |
516 | .then(response => { | 517 | .then(response => { |
517 | this.examList = response.data.data; | 518 | this.examList = response.data.data; |
518 | this.showLoader = false; | 519 | this.showLoader = false; |
519 | this.loadingSearch = false; | 520 | this.loadingSearch = false; |
520 | }) | 521 | }) |
521 | .catch(error => { | 522 | .catch(error => { |
522 | this.showLoader = false; | 523 | this.showLoader = false; |
523 | this.loadingSearch = false; | 524 | this.loadingSearch = false; |
524 | this.snackbar = true; | 525 | this.snackbar = true; |
525 | this.text = error.response.data.message; | 526 | this.text = error.response.data.message; |
526 | if (error.response.status === 401) { | 527 | if (error.response.status === 401) { |
527 | this.$router.replace({ path: "/" }); | 528 | this.$router.replace({ path: "/" }); |
528 | this.$store.dispatch("setToken", null); | 529 | this.$store.dispatch("setToken", null); |
529 | this.$store.dispatch("Id", null); | 530 | this.$store.dispatch("Id", null); |
530 | } | 531 | } |
531 | }); | 532 | }); |
532 | }, | 533 | }, |
533 | showTable() { | 534 | showTable() { |
534 | this.attendeceTable = true; | 535 | this.attendeceTable = true; |
535 | this.getStudentList(); | 536 | this.getStudentList(); |
536 | }, | 537 | }, |
537 | getStudentList() { | 538 | getStudentList() { |
538 | this.showLoader = true; | 539 | this.showLoader = true; |
539 | http() | 540 | http() |
540 | .get("/getStudentWithClass", { | 541 | .get("/getStudentWithClass", { |
541 | params: { | 542 | params: { |
542 | classId: this.addAttendence.classId, | 543 | classId: this.addAttendence.classId, |
543 | sectionId: this.addAttendence.sectionId | 544 | sectionId: this.addAttendence.sectionId |
544 | } | 545 | } |
545 | }) | 546 | }) |
546 | .then(response => { | 547 | .then(response => { |
547 | this.studentsData = response.data.data; | 548 | this.studentsData = response.data.data; |
548 | this.showLoader = false; | 549 | this.showLoader = false; |
549 | // this.addExamAttendenceDialog = false; | 550 | // this.addExamAttendenceDialog = false; |
550 | var attendence = ""; | 551 | var attendence = ""; |
551 | for (let i = 0; i < this.studentsData.length; i++) { | 552 | for (let i = 0; i < this.studentsData.length; i++) { |
552 | this.studentsData[i].attendence = false; | 553 | this.studentsData[i].attendence = false; |
553 | } | 554 | } |
554 | }) | 555 | }) |
555 | .catch(err => { | 556 | .catch(err => { |
556 | console.log("err====>", err); | 557 | console.log("err====>", err); |
557 | this.showLoader = false; | 558 | this.showLoader = false; |
558 | }); | 559 | }); |
559 | }, | 560 | }, |
560 | getExamAttendenceList() { | 561 | getExamAttendenceList() { |
561 | this.showLoader = true; | 562 | this.showLoader = true; |
562 | http() | 563 | http() |
563 | .get("/getExamAttendenceList", { | 564 | .get("/getExamAttendenceList", { |
564 | params: { | 565 | params: { |
565 | examId: this.addAttendence.examId, | 566 | examId: this.getAttendence.examId, |
566 | classId: this.addAttendence.classId, | 567 | classId: this.getAttendence.classId, |
567 | sectionId: this.addAttendence.sectionId, | 568 | sectionId: this.getAttendence.sectionId, |
568 | subjectId: this.addAttendence.subjectId | 569 | subjectId: this.getAttendence.subjectId |
569 | } | 570 | } |
570 | }) | 571 | }) |
571 | .then(response => { | 572 | .then(response => { |
572 | this.examData = response.data.data[0]; | 573 | this.examData = response.data.data[0]; |
573 | this.showLoader = false; | 574 | this.showLoader = false; |
574 | }) | 575 | }) |
575 | .catch(error => { | 576 | .catch(error => { |
576 | console.log("error", error); | 577 | console.log("error", error); |
577 | this.showLoader = false; | 578 | this.showLoader = false; |
578 | }); | 579 | }); |
579 | }, | 580 | }, |
580 | displaySearch() { | 581 | displaySearch() { |
581 | (this.show = false), (this.showSearch = true); | 582 | (this.show = false), (this.showSearch = true); |
582 | }, | 583 | }, |
583 | closeSearch() { | 584 | closeSearch() { |
584 | this.showSearch = false; | 585 | this.showSearch = false; |
585 | this.show = true; | 586 | this.show = true; |
586 | this.search = ""; | 587 | this.search = ""; |
587 | } | 588 | } |
588 | }, | 589 | }, |
589 | mounted() { | 590 | mounted() { |
590 | this.token = this.$store.state.token; | 591 | this.token = this.$store.state.token; |
591 | this.getClass(); | 592 | this.getClass(); |
592 | this.getExamList(); | 593 | this.getExamList(); |
593 | this.role = this.$store.state.role; | 594 | this.role = this.$store.state.role; |
594 | } | 595 | } |
595 | }; | 596 | }; |
596 | </script> | 597 | </script> |
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="getSchedulesList()" | 326 | @change="getSections(getScheduleData.classId)" |
327 | required | ||
328 | ></v-select> | ||
329 | </v-flex> | ||
330 | <v-flex xs8 sm3 md2 class="mr-3"> | ||
331 | <v-select | ||
332 | v-model="getScheduleData.sectionId" | ||
333 | label="Select your section" | ||
334 | type="text" | ||
335 | :items="addSection" | ||
336 | item-text="name" | ||
337 | item-value="_id" | ||
338 | @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)" | ||
327 | required | 339 | required |
328 | ></v-select> | 340 | ></v-select> |
329 | </v-flex> | 341 | </v-flex> |
330 | <v-card-title class="body-1" v-show="show"> | 342 | <v-card-title class="body-1" v-show="show"> |
331 | <v-btn icon large flat @click="displaySearch"> | 343 | <v-btn icon large flat @click="displaySearch"> |
332 | <v-avatar size="27"> | 344 | <v-avatar size="27"> |
333 | <img src="/static/icon/search.png" alt="icon" /> | 345 | <img src="/static/icon/search.png" alt="icon" /> |
334 | </v-avatar> | 346 | </v-avatar> |
335 | </v-btn> | 347 | </v-btn> |
336 | </v-card-title> | 348 | </v-card-title> |
337 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | 349 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> |
338 | <v-layout> | 350 | <v-layout> |
339 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 351 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> |
340 | <v-icon @click="closeSearch" color="error">close</v-icon> | 352 | <v-icon @click="closeSearch" color="error">close</v-icon> |
341 | </v-layout> | 353 | </v-layout> |
342 | </v-flex> | 354 | </v-flex> |
343 | </v-toolbar> | 355 | </v-toolbar> |
344 | <v-data-table | 356 | <v-data-table |
345 | :headers="headers" | 357 | :headers="headers" |
346 | :items="ScheduleData" | 358 | :items="ScheduleData" |
347 | :pagination.sync="pagination" | 359 | :pagination.sync="pagination" |
348 | :search="search" | 360 | :search="search" |
349 | > | 361 | > |
350 | <template slot="items" slot-scope="props"> | 362 | <template slot="items" slot-scope="props"> |
351 | <tr class="tr"> | 363 | <tr class="tr"> |
352 | <td class="td td-row">{{ props.index + 1}}</td> | 364 | <td class="td td-row">{{ props.index + 1}}</td> |
353 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> | 365 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> |
354 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> | 366 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> |
355 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> | 367 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> |
356 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> | 368 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> |
357 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> | 369 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> |
358 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> | 370 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> |
359 | <td class="td td-row text-xs-center"> | 371 | <td class="td td-row text-xs-center"> |
360 | <span> | 372 | <span> |
361 | <v-tooltip top> | 373 | <v-tooltip top> |
362 | <img | 374 | <img |
363 | slot="activator" | 375 | slot="activator" |
364 | style="cursor:pointer; width:25px; height:25px; " | 376 | style="cursor:pointer; width:25px; height:25px; " |
365 | class="mr-3" | 377 | class="mr-3" |
366 | @click="profile(props.item)" | 378 | @click="profile(props.item)" |
367 | src="/static/icon/view.png" | 379 | src="/static/icon/view.png" |
368 | /> | 380 | /> |
369 | <span>View</span> | 381 | <span>View</span> |
370 | </v-tooltip> | 382 | </v-tooltip> |
371 | <v-tooltip top v-if="role != 'TEACHER' "> | 383 | <v-tooltip top v-if="role != 'TEACHER' "> |
372 | <img | 384 | <img |
373 | slot="activator" | 385 | slot="activator" |
374 | style="cursor:pointer; width:20px; height:18px; " | 386 | style="cursor:pointer; width:20px; height:18px; " |
375 | class="mr-3" | 387 | class="mr-3" |
376 | @click="editItem(props.item)" | 388 | @click="editItem(props.item)" |
377 | src="/static/icon/edit.png" | 389 | src="/static/icon/edit.png" |
378 | /> | 390 | /> |
379 | <span>Edit</span> | 391 | <span>Edit</span> |
380 | </v-tooltip> | 392 | </v-tooltip> |
381 | <v-tooltip top v-if="role != 'TEACHER' "> | 393 | <v-tooltip top v-if="role != 'TEACHER' "> |
382 | <img | 394 | <img |
383 | slot="activator" | 395 | slot="activator" |
384 | style="cursor:pointer; width:20px; height:20px; " | 396 | style="cursor:pointer; width:20px; height:20px; " |
385 | @click="deleteSchedule(props.item)" | 397 | @click="deleteSchedule(props.item)" |
386 | src="/static/icon/delete.png" | 398 | src="/static/icon/delete.png" |
387 | /> | 399 | /> |
388 | <span>Delete</span> | 400 | <span>Delete</span> |
389 | </v-tooltip> | 401 | </v-tooltip> |
390 | </span> | 402 | </span> |
391 | </td> | 403 | </td> |
392 | </tr> | 404 | </tr> |
393 | </template> | 405 | </template> |
394 | <v-alert | 406 | <v-alert |
395 | slot="no-results" | 407 | slot="no-results" |
396 | :value="true" | 408 | :value="true" |
397 | color="error" | 409 | color="error" |
398 | icon="warning" | 410 | icon="warning" |
399 | >Your search for "{{ search }}" found no results.</v-alert> | 411 | >Your search for "{{ search }}" found no results.</v-alert> |
400 | </v-data-table> | 412 | </v-data-table> |
401 | 413 | ||
402 | <!-- ****** ADD Exam Schedule ****** --> | 414 | <!-- ****** ADD Exam Schedule ****** --> |
403 | <v-dialog v-model="addExamScheduleDialog" max-width="600"> | 415 | <v-dialog v-model="addExamScheduleDialog" max-width="600"> |
404 | <v-card flat class="card-style pa-2" dark> | 416 | <v-card flat class="card-style pa-2" dark> |
405 | <v-layout> | 417 | <v-layout> |
406 | <v-flex xs12> | 418 | <v-flex xs12> |
407 | <label class="title text-xs-center">Add Exam Schedule</label> | 419 | <label class="title text-xs-center">Add Exam Schedule</label> |
408 | <v-icon size="24" class="right" @click="addExamScheduleDialog = false">cancel</v-icon> | 420 | <v-icon size="24" class="right" @click="addExamScheduleDialog = false">cancel</v-icon> |
409 | </v-flex> | 421 | </v-flex> |
410 | </v-layout> | 422 | </v-layout> |
411 | <v-form ref="form" v-model="valid" lazy-validation> | 423 | <v-form ref="form" v-model="valid" lazy-validation> |
412 | <v-container fluid> | 424 | <v-container fluid> |
413 | <v-flex xs12> | 425 | <v-flex xs12> |
414 | <v-layout> | 426 | <v-layout> |
415 | <v-flex xs5 class="pt-4 subheading"> | 427 | <v-flex xs5 class="pt-4 subheading"> |
416 | <label class="right">Exam Name:</label> | 428 | <label class="right">Exam Name:</label> |
417 | </v-flex> | 429 | </v-flex> |
418 | <v-flex xs7 sm7 md6 class="ml-3"> | 430 | <v-flex xs7 sm7 md6 class="ml-3"> |
419 | <v-select | 431 | <v-select |
420 | label="Select your Exam Name" | 432 | label="Select your Exam Name" |
421 | :rules="examRules" | 433 | :rules="examRules" |
422 | :items="examList" | 434 | :items="examList" |
423 | v-model="addSchedule.examId" | 435 | v-model="addSchedule.examId" |
424 | item-text="examName" | 436 | item-text="examName" |
425 | item-value="_id" | 437 | item-value="_id" |
426 | ></v-select> | 438 | ></v-select> |
427 | </v-flex> | 439 | </v-flex> |
428 | </v-layout> | 440 | </v-layout> |
429 | </v-flex> | 441 | </v-flex> |
430 | <v-flex xs12> | 442 | <v-flex xs12> |
431 | <v-layout> | 443 | <v-layout> |
432 | <v-flex xs5 class="pt-4 subheading"> | 444 | <v-flex xs5 class="pt-4 subheading"> |
433 | <label class="right">Class:</label> | 445 | <label class="right">Class:</label> |
434 | </v-flex> | 446 | </v-flex> |
435 | <v-flex xs7 sm7 md6 class="ml-3"> | 447 | <v-flex xs7 sm7 md6 class="ml-3"> |
436 | <v-select | 448 | <v-select |
437 | v-model="addSchedule.classId" | 449 | v-model="addSchedule.classId" |
438 | label="Select your class" | 450 | label="Select your class" |
439 | type="text" | 451 | type="text" |
440 | :items="classList" | 452 | :items="classList" |
441 | item-text="classNum" | 453 | item-text="classNum" |
442 | item-value="_id" | 454 | item-value="_id" |
443 | :rules="classRules" | 455 | :rules="classRules" |
444 | @change="getSections(addSchedule.classId)" | 456 | @change="getSections(addSchedule.classId)" |
445 | required | 457 | required |
446 | ></v-select> | 458 | ></v-select> |
447 | </v-flex> | 459 | </v-flex> |
448 | </v-layout> | 460 | </v-layout> |
449 | </v-flex> | 461 | </v-flex> |
450 | <v-flex xs12> | 462 | <v-flex xs12> |
451 | <v-layout> | 463 | <v-layout> |
452 | <v-flex xs5 class="pt-4 subheading"> | 464 | <v-flex xs5 class="pt-4 subheading"> |
453 | <label class="right">Section:</label> | 465 | <label class="right">Section:</label> |
454 | </v-flex> | 466 | </v-flex> |
455 | <v-flex xs7 sm7 md6 class="ml-3"> | 467 | <v-flex xs7 sm7 md6 class="ml-3"> |
456 | <v-select | 468 | <v-select |
457 | :items="addSection" | 469 | :items="addSection" |
458 | label="Select Section" | 470 | label="Select Section" |
459 | v-model="addSchedule.sectionId" | 471 | v-model="addSchedule.sectionId" |
460 | item-text="name" | 472 | item-text="name" |
461 | item-value="_id" | 473 | item-value="_id" |
462 | name="Select Section" | 474 | name="Select Section" |
463 | :rules="sectionRules" | 475 | :rules="sectionRules" |
464 | required | 476 | required |
465 | ></v-select> | 477 | ></v-select> |
466 | </v-flex> | 478 | </v-flex> |
467 | </v-layout> | 479 | </v-layout> |
468 | </v-flex> | 480 | </v-flex> |
469 | <v-flex xs12> | 481 | <v-flex xs12> |
470 | <v-layout> | 482 | <v-layout> |
471 | <v-flex xs5 class="pt-4 subheading"> | 483 | <v-flex xs5 class="pt-4 subheading"> |
472 | <label class="right">Subject Name:</label> | 484 | <label class="right">Subject Name:</label> |
473 | </v-flex> | 485 | </v-flex> |
474 | <v-flex xs7 sm7 md6 class="ml-3"> | 486 | <v-flex xs7 sm7 md6 class="ml-3"> |
475 | <v-select | 487 | <v-select |
476 | :items="subjects" | 488 | :items="subjects" |
477 | label="Select Subject" | 489 | label="Select Subject" |
478 | v-model="addSchedule.subjectName" | 490 | v-model="addSchedule.subjectName" |
479 | item-text="subjectName" | 491 | item-text="subjectName" |
480 | item-value="subjectName" | 492 | item-value="subjectName" |
481 | name="Select Section" | 493 | name="Select Section" |
482 | :rules="subjectRules" | 494 | :rules="subjectRules" |
483 | required | 495 | required |
484 | ></v-select> | 496 | ></v-select> |
485 | </v-flex> | 497 | </v-flex> |
486 | </v-layout> | 498 | </v-layout> |
487 | </v-flex> | 499 | </v-flex> |
488 | <v-flex xs12> | 500 | <v-flex xs12> |
489 | <v-layout> | 501 | <v-layout> |
490 | <v-flex xs5 class="pt-4 subheading"> | 502 | <v-flex xs5 class="pt-4 subheading"> |
491 | <label class="right">Date:</label> | 503 | <label class="right">Date:</label> |
492 | </v-flex> | 504 | </v-flex> |
493 | <v-flex xs7 sm7 md6 class="ml-3"> | 505 | <v-flex xs7 sm7 md6 class="ml-3"> |
494 | <v-menu | 506 | <v-menu |
495 | ref="menu2" | 507 | ref="menu2" |
496 | :close-on-content-click="false" | 508 | :close-on-content-click="false" |
497 | v-model="menu2" | 509 | v-model="menu2" |
498 | :nudge-right="40" | 510 | :nudge-right="40" |
499 | :return-value.sync="addSchedule.date" | 511 | :return-value.sync="addSchedule.date" |
500 | lazy | 512 | lazy |
501 | transition="scale-transition" | 513 | transition="scale-transition" |
502 | offset-y | 514 | offset-y |
503 | full-width | 515 | full-width |
504 | min-width="290px" | 516 | min-width="290px" |
505 | > | 517 | > |
506 | <v-text-field | 518 | <v-text-field |
507 | slot="activator" | 519 | slot="activator" |
508 | v-model="addSchedule.date" | 520 | v-model="addSchedule.date" |
509 | :rules="examScheduleDateRules" | 521 | :rules="examScheduleDateRules" |
510 | label="Select Date" | 522 | label="Select Date" |
511 | append-icon="event" | 523 | append-icon="event" |
512 | readonly | 524 | readonly |
513 | ></v-text-field> | 525 | ></v-text-field> |
514 | <v-date-picker | 526 | <v-date-picker |
515 | v-model="addSchedule.date" | 527 | v-model="addSchedule.date" |
516 | @input="$refs.menu2.save(addSchedule.date)" | 528 | @input="$refs.menu2.save(addSchedule.date)" |
517 | ></v-date-picker> | 529 | ></v-date-picker> |
518 | </v-menu> | 530 | </v-menu> |
519 | </v-flex> | 531 | </v-flex> |
520 | </v-layout> | 532 | </v-layout> |
521 | </v-flex> | 533 | </v-flex> |
522 | <v-flex xs12> | 534 | <v-flex xs12> |
523 | <v-layout> | 535 | <v-layout> |
524 | <v-flex xs5 class="pt-4 subheading"> | 536 | <v-flex xs5 class="pt-4 subheading"> |
525 | <label class="right">Time From:</label> | 537 | <label class="right">Time From:</label> |
526 | </v-flex> | 538 | </v-flex> |
527 | <v-flex xs7 sm7 md6 class="ml-3"> | 539 | <v-flex xs7 sm7 md6 class="ml-3"> |
528 | <v-menu | 540 | <v-menu |
529 | ref="menuA" | 541 | ref="menuA" |
530 | :close-on-content-click="false" | 542 | :close-on-content-click="false" |
531 | v-model="menuB" | 543 | v-model="menuB" |
532 | :nudge-right="40" | 544 | :nudge-right="40" |
533 | :return-value.sync="addSchedule.timeFrom" | 545 | :return-value.sync="addSchedule.timeFrom" |
534 | lazy | 546 | lazy |
535 | transition="scale-transition" | 547 | transition="scale-transition" |
536 | offset-y | 548 | offset-y |
537 | full-width | 549 | full-width |
538 | max-width="290px" | 550 | max-width="290px" |
539 | min-width="290px" | 551 | min-width="290px" |
540 | > | 552 | > |
541 | <v-text-field | 553 | <v-text-field |
542 | slot="activator" | 554 | slot="activator" |
543 | v-model="addSchedule.timeIn" | 555 | v-model="addSchedule.timeIn" |
544 | label="Select your time From" | 556 | label="Select your time From" |
545 | append-icon="access_time" | 557 | append-icon="access_time" |
546 | :rules="timeInRules" | 558 | :rules="timeInRules" |
547 | readonly | 559 | readonly |
548 | ></v-text-field> | 560 | ></v-text-field> |
549 | <v-time-picker | 561 | <v-time-picker |
550 | v-model="addSchedule.timeIn" | 562 | v-model="addSchedule.timeIn" |
551 | @change="$refs.menuA.save(addSchedule.timeIn)" | 563 | @change="$refs.menuA.save(addSchedule.timeIn)" |
552 | ></v-time-picker> | 564 | ></v-time-picker> |
553 | </v-menu> | 565 | </v-menu> |
554 | </v-flex> | 566 | </v-flex> |
555 | </v-layout> | 567 | </v-layout> |
556 | </v-flex> | 568 | </v-flex> |
557 | <v-flex xs12> | 569 | <v-flex xs12> |
558 | <v-layout> | 570 | <v-layout> |
559 | <v-flex xs5 class="pt-4 subheading"> | 571 | <v-flex xs5 class="pt-4 subheading"> |
560 | <label class="right">Time To:</label> | 572 | <label class="right">Time To:</label> |
561 | </v-flex> | 573 | </v-flex> |
562 | <v-flex xs7 sm7 md6 class="ml-3"> | 574 | <v-flex xs7 sm7 md6 class="ml-3"> |
563 | <v-menu | 575 | <v-menu |
564 | ref="menu" | 576 | ref="menu" |
565 | :close-on-content-click="false" | 577 | :close-on-content-click="false" |
566 | v-model="menu1" | 578 | v-model="menu1" |
567 | :nudge-right="40" | 579 | :nudge-right="40" |
568 | :return-value.sync="addSchedule.timeTo" | 580 | :return-value.sync="addSchedule.timeTo" |
569 | lazy | 581 | lazy |
570 | transition="scale-transition" | 582 | transition="scale-transition" |
571 | offset-y | 583 | offset-y |
572 | full-width | 584 | full-width |
573 | max-width="290px" | 585 | max-width="290px" |
574 | min-width="290px" | 586 | min-width="290px" |
575 | > | 587 | > |
576 | <v-text-field | 588 | <v-text-field |
577 | slot="activator" | 589 | slot="activator" |
578 | v-model="addSchedule.timeTo" | 590 | v-model="addSchedule.timeTo" |
579 | label="Select your Time To" | 591 | label="Select your Time To" |
580 | append-icon="access_time" | 592 | append-icon="access_time" |
581 | :rules="timeOutRules" | 593 | :rules="timeOutRules" |
582 | readonly | 594 | readonly |
583 | ></v-text-field> | 595 | ></v-text-field> |
584 | <v-time-picker | 596 | <v-time-picker |
585 | v-model="addSchedule.timeTo" | 597 | v-model="addSchedule.timeTo" |
586 | @change="$refs.menu.save(addSchedule.timeTo)" | 598 | @change="$refs.menu.save(addSchedule.timeTo)" |
587 | ></v-time-picker> | 599 | ></v-time-picker> |
588 | </v-menu> | 600 | </v-menu> |
589 | </v-flex> | 601 | </v-flex> |
590 | </v-layout> | 602 | </v-layout> |
591 | </v-flex> | 603 | </v-flex> |
592 | <v-flex xs12> | 604 | <v-flex xs12> |
593 | <v-layout> | 605 | <v-layout> |
594 | <v-flex xs5 class="pt-4 subheading"> | 606 | <v-flex xs5 class="pt-4 subheading"> |
595 | <label class="right">Room:</label> | 607 | <label class="right">Room:</label> |
596 | </v-flex> | 608 | </v-flex> |
597 | <v-flex xs7 sm7 md6 class="ml-3"> | 609 | <v-flex xs7 sm7 md6 class="ml-3"> |
598 | <v-text-field | 610 | <v-text-field |
599 | placeholder="fill your room" | 611 | placeholder="fill your room" |
600 | :rules="roomRules" | 612 | :rules="roomRules" |
601 | v-model="addSchedule.room" | 613 | v-model="addSchedule.room" |
602 | @keyup.enter="submit" | 614 | @keyup.enter="submit" |
603 | ></v-text-field> | 615 | ></v-text-field> |
604 | </v-flex> | 616 | </v-flex> |
605 | </v-layout> | 617 | </v-layout> |
606 | </v-flex> | 618 | </v-flex> |
607 | <v-layout> | 619 | <v-layout> |
608 | <v-flex xs12> | 620 | <v-flex xs12> |
609 | <v-card-actions> | 621 | <v-card-actions> |
610 | <v-spacer class="hidden-xs-only"></v-spacer> | 622 | <v-spacer class="hidden-xs-only"></v-spacer> |
611 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 623 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
612 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 624 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
613 | </v-card-actions> | 625 | </v-card-actions> |
614 | </v-flex> | 626 | </v-flex> |
615 | </v-layout> | 627 | </v-layout> |
616 | </v-container> | 628 | </v-container> |
617 | </v-form> | 629 | </v-form> |
618 | </v-card> | 630 | </v-card> |
619 | </v-dialog> | 631 | </v-dialog> |
620 | <v-snackbar | 632 | <v-snackbar |
621 | :timeout="timeout" | 633 | :timeout="timeout" |
622 | :top="y === 'top'" | 634 | :top="y === 'top'" |
623 | :right="x === 'right'" | 635 | :right="x === 'right'" |
624 | :vertical="mode === 'vertical'" | 636 | :vertical="mode === 'vertical'" |
625 | v-model="snackbar" | 637 | v-model="snackbar" |
626 | :color="color" | 638 | :color="color" |
627 | >{{ text }}</v-snackbar> | 639 | >{{ text }}</v-snackbar> |
628 | <div class="loader" v-if="showLoader"> | 640 | <div class="loader" v-if="showLoader"> |
629 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 641 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
630 | </div> | 642 | </div> |
631 | </v-container> | 643 | </v-container> |
632 | </template> | 644 | </template> |
633 | 645 | ||
634 | <script> | 646 | <script> |
635 | import http from "@/Services/http.js"; | 647 | import http from "@/Services/http.js"; |
636 | import moment from "moment"; | 648 | import moment from "moment"; |
637 | 649 | ||
638 | export default { | 650 | export default { |
639 | data: () => ({ | 651 | data: () => ({ |
640 | snackbar: false, | 652 | snackbar: false, |
641 | date: null, | 653 | date: null, |
642 | editDate: false, | 654 | editDate: false, |
643 | menu1: false, | 655 | menu1: false, |
644 | menuB: false, | 656 | menuB: false, |
645 | menu2: false, | 657 | menu2: false, |
646 | menuEdit: false, | 658 | menuEdit: false, |
647 | timeToEdit: false, | 659 | timeToEdit: false, |
648 | show: true, | 660 | show: true, |
649 | showSearch: false, | 661 | showSearch: false, |
650 | addExamScheduleDialog: false, | 662 | addExamScheduleDialog: false, |
651 | color: "", | 663 | color: "", |
652 | y: "top", | 664 | y: "top", |
653 | x: "right", | 665 | x: "right", |
654 | mode: "", | 666 | mode: "", |
655 | timeout: 10000, | 667 | timeout: 10000, |
656 | text: "", | 668 | text: "", |
657 | loading: false, | 669 | loading: false, |
658 | date: null, | 670 | date: null, |
659 | search: "", | 671 | search: "", |
660 | showLoader: false, | 672 | showLoader: false, |
661 | editExamScheduleDialog: false, | 673 | editExamScheduleDialog: false, |
662 | profileExamScheduleDialog: false, | 674 | profileExamScheduleDialog: false, |
663 | valid: true, | 675 | valid: true, |
664 | role: "", | 676 | role: "", |
665 | pagination: { | 677 | pagination: { |
666 | rowsPerPage: 10 | 678 | rowsPerPage: 10 |
667 | }, | 679 | }, |
668 | examRules: [v => !!v || "Exam Name is required"], | 680 | examRules: [v => !!v || "Exam Name is required"], |
669 | classRules: [v => !!v || "Class Name is required"], | 681 | classRules: [v => !!v || "Class Name is required"], |
670 | sectionRules: [v => !!v || "section is required"], | 682 | sectionRules: [v => !!v || "section is required"], |
671 | subjectRules: [v => !!v || "Subject is required"], | 683 | subjectRules: [v => !!v || "Subject is required"], |
672 | timeInRules: [v => !!v || "Time In is required"], | 684 | timeInRules: [v => !!v || "Time In is required"], |
673 | timeOutRules: [v => !!v || "time Out s is required"], | 685 | timeOutRules: [v => !!v || "time Out s is required"], |
674 | roomRules: [v => !!v || "Room is required"], | 686 | roomRules: [v => !!v || "Room is required"], |
675 | examScheduleDateRules: [v => !!v || "Date is required"], | 687 | examScheduleDateRules: [v => !!v || "Date is required"], |
676 | headers: [ | 688 | headers: [ |
677 | { | 689 | { |
678 | align: "", | 690 | align: "", |
679 | text: "No", | 691 | text: "No", |
680 | sortable: false, | 692 | sortable: false, |
681 | value: "No" | 693 | value: "No" |
682 | }, | 694 | }, |
683 | { | 695 | { |
684 | text: "Exam Name", | 696 | text: "Exam Name", |
685 | vaue: "examId.examName", | 697 | vaue: "examId.examName", |
686 | sortable: false, | 698 | sortable: false, |
687 | align: "center" | 699 | align: "center" |
688 | }, | 700 | }, |
689 | { | 701 | { |
690 | text: "Class", | 702 | text: "Class", |
691 | value: "classId.classNum", | 703 | value: "classId.classNum", |
692 | sortable: false, | 704 | sortable: false, |
693 | align: "center" | 705 | align: "center" |
694 | }, | 706 | }, |
695 | // { | 707 | // { |
696 | // text: "Section", | 708 | // text: "Section", |
697 | // value: "sectionId.name", | 709 | // value: "sectionId.name", |
698 | // sortable: false, | 710 | // sortable: false, |
699 | // align: "center" | 711 | // align: "center" |
700 | // }, | 712 | // }, |
701 | { | 713 | { |
702 | text: "Subject Name", | 714 | text: "Subject Name", |
703 | value: "subjectName", | 715 | value: "subjectName", |
704 | sortable: false, | 716 | sortable: false, |
705 | align: "center" | 717 | align: "center" |
706 | }, | 718 | }, |
707 | { | 719 | { |
708 | text: "Date", | 720 | text: "Date", |
709 | value: "date", | 721 | value: "date", |
710 | sortable: false, | 722 | sortable: false, |
711 | align: "center" | 723 | align: "center" |
712 | }, | 724 | }, |
713 | { | 725 | { |
714 | text: "Time", | 726 | text: "Time", |
715 | value: "timeFrom", | 727 | value: "timeFrom", |
716 | sortable: false, | 728 | sortable: false, |
717 | align: "center" | 729 | align: "center" |
718 | }, | 730 | }, |
719 | { | 731 | { |
720 | text: "Room", | 732 | text: "Room", |
721 | value: "room", | 733 | value: "room", |
722 | sortable: false, | 734 | sortable: false, |
723 | align: "center" | 735 | align: "center" |
724 | }, | 736 | }, |
725 | { text: "Action", value: "", sortable: false, align: "center" } | 737 | { text: "Action", value: "", sortable: false, align: "center" } |
726 | ], | 738 | ], |
727 | classList: [], | 739 | classList: [], |
728 | addSection: [], | 740 | addSection: [], |
729 | examList: [], | 741 | examList: [], |
730 | subjects: [], | 742 | subjects: [], |
731 | addSchedule: {}, | 743 | addSchedule: {}, |
732 | editedItem: { | 744 | editedItem: { |
733 | sectionId: { | 745 | sectionId: { |
734 | name: "" | 746 | name: "" |
735 | } | 747 | } |
736 | }, | 748 | }, |
737 | getScheduleData: {}, | 749 | getScheduleData: {}, |
738 | ScheduleData: [], | 750 | ScheduleData: [], |
739 | token: "" | 751 | token: "" |
740 | }), | 752 | }), |
741 | methods: { | 753 | methods: { |
742 | dates: function(date) { | 754 | dates: function(date) { |
743 | return moment(date).format("MMMM DD, YYYY"); | 755 | return moment(date).format("MMMM DD, YYYY"); |
744 | }, | 756 | }, |
745 | pickFile() { | 757 | pickFile() { |
746 | this.$refs.image.click(); | 758 | this.$refs.image.click(); |
747 | }, | 759 | }, |
748 | getSchedulesList() { | 760 | getSchedulesList() { |
749 | if (this.addSchedule.classId) { | 761 | if (this.addSchedule.classId) { |
750 | this.getScheduleData.classId = this.addSchedule.classId; | 762 | this.getScheduleData.classId = this.addSchedule.classId; |
751 | } | 763 | } |
752 | this.showLoader = true; | 764 | this.showLoader = true; |
753 | http() | 765 | http() |
754 | .get("/getSchedulesList", { | 766 | .get("/getSchedulesList", { |
755 | params: { classId: this.getScheduleData.classId }, | 767 | params: { |
768 | classId: this.getScheduleData.classId, | ||
769 | sectionId: this.getScheduleData.sectionId | ||
770 | }, | ||
756 | headers: { Authorization: "Bearer " + this.token } | 771 | headers: { Authorization: "Bearer " + this.token } |
757 | }) | 772 | }) |
758 | .then(response => { | 773 | .then(response => { |
759 | this.ScheduleData = response.data.data; | 774 | this.ScheduleData = response.data.data; |
760 | // console.log("this.ScheduleData", this.ScheduleData); | 775 | // console.log("this.ScheduleData", this.ScheduleData); |
761 | this.showLoader = false; | 776 | this.showLoader = false; |
762 | }) | 777 | }) |
763 | .catch(error => { | 778 | .catch(error => { |
764 | // console.log("err====>", err); | 779 | // console.log("err====>", err); |
765 | this.showLoader = false; | 780 | this.showLoader = false; |
766 | this.loadingSearch = false; | 781 | this.loadingSearch = false; |
767 | this.snackbar = true; | 782 | this.snackbar = true; |
783 | this.color = "error"; | ||
768 | this.text = error.response.data.message; | 784 | this.text = error.response.data.message; |
769 | if (error.response.status === 401) { | 785 | if (error.response.status === 401) { |
770 | this.$router.replace({ path: "/" }); | 786 | this.$router.replace({ path: "/" }); |
771 | this.$store.dispatch("setToken", null); | 787 | this.$store.dispatch("setToken", null); |
772 | this.$store.dispatch("Id", null); | 788 | this.$store.dispatch("Id", null); |
773 | } | 789 | } |
774 | }); | 790 | }); |
775 | }, | 791 | }, |
776 | editItem(item) { | 792 | editItem(item) { |
777 | // console.log("item", item); | 793 | // console.log("item", item); |
778 | this.editedIndex = this.ScheduleData.indexOf(item); | 794 | this.editedIndex = this.ScheduleData.indexOf(item); |
779 | this.editedItem = Object.assign({}, item); | 795 | this.editedItem = Object.assign({}, item); |
780 | this.editedItem.examId = this.editedItem.examId._id; | 796 | this.editedItem.examId = this.editedItem.examId._id; |
781 | this.editedItem.classId = this.editedItem.classId._id; | 797 | this.editedItem.classId = this.editedItem.classId._id; |
782 | this.editedItem.sectionId = this.editedItem.sectionId._id; | 798 | this.editedItem.sectionId = |
799 | this.editedItem.sectionId === null | ||
800 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | ||
801 | : this.editedItem.sectionId._id; | ||
783 | this.editedItem.date = | 802 | this.editedItem.date = |
784 | this.editedItem.date != undefined | 803 | this.editedItem.date != undefined |
785 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 804 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
786 | : (this.editedItem.date = ""); | 805 | : (this.editedItem.date = ""); |
787 | this.editExamScheduleDialog = true; | 806 | this.editExamScheduleDialog = true; |
788 | }, | 807 | }, |
789 | profile(item) { | 808 | profile(item) { |
790 | this.editedIndex = this.ScheduleData.indexOf(item); | 809 | this.editedIndex = this.ScheduleData.indexOf(item); |
791 | this.editedItem = Object.assign({}, item); | 810 | this.editedItem = Object.assign({}, item); |
792 | this.editedItem.examId = this.editedItem.examId.examName; | 811 | this.editedItem.examId = this.editedItem.examId.examName; |
793 | this.editedItem.classId = this.editedItem.classId.classNum; | 812 | this.editedItem.classId = this.editedItem.classId.classNum; |
794 | this.editedItem.sectionId = this.editedItem.sectionId.name; | 813 | this.editedItem.sectionId = |
814 | this.editedItem.sectionId === null | ||
815 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | ||
816 | : this.editedItem.sectionId.name; | ||
795 | this.profileExamScheduleDialog = true; | 817 | this.profileExamScheduleDialog = true; |
796 | }, | 818 | }, |
797 | deleteSchedule(item) { | 819 | deleteSchedule(item) { |
798 | let deleteSchedule = { | 820 | let deleteSchedule = { |
799 | scheduleId: item._id | 821 | scheduleId: item._id |
800 | }; | 822 | }; |
801 | http() | 823 | http() |
802 | .delete( | 824 | .delete( |
803 | "/deleteSchedule", | 825 | "/deleteSchedule", |
804 | confirm("Are you sure you want to Delete this?") && { | 826 | confirm("Are you sure you want to Delete this?") && { |
805 | params: deleteSchedule | 827 | params: deleteSchedule |
806 | } | 828 | } |
807 | ) | 829 | ) |
808 | .then(response => { | 830 | .then(response => { |
809 | this.snackbar = true; | 831 | this.snackbar = true; |
810 | this.text = response.data.message; | 832 | this.text = response.data.message; |
811 | this.color = "green"; | 833 | this.color = "green"; |
812 | this.getSchedulesList(); | 834 | this.getSchedulesList(); |
813 | }) | 835 | }) |
814 | .catch(error => { | 836 | .catch(error => { |
815 | this.snackbar = true; | 837 | this.snackbar = true; |
816 | this.color = "error"; | 838 | this.color = "error"; |
817 | this.text = error.response.data.message; | 839 | this.text = error.response.data.message; |
818 | }); | 840 | }); |
819 | }, | 841 | }, |
820 | close() { | 842 | close() { |
821 | this.dialog = false; | 843 | this.dialog = false; |
822 | }, | 844 | }, |
823 | submit() { | 845 | submit() { |
824 | if (this.$refs.form.validate()) { | 846 | if (this.$refs.form.validate()) { |
825 | this.loading = true; | 847 | this.loading = true; |
826 | http() | 848 | http() |
827 | .post("/createSchedule", this.addSchedule) | 849 | .post("/createSchedule", this.addSchedule) |
828 | .then(response => { | 850 | .then(response => { |
829 | this.loading = false; | 851 | this.loading = false; |
830 | this.snackbar = true; | 852 | this.snackbar = true; |
831 | this.text = response.data.message; | 853 | this.text = response.data.message; |
832 | this.color = "green"; | 854 | this.color = "green"; |
833 | this.addExamScheduleDialog = false; | 855 | this.addExamScheduleDialog = false; |
834 | this.getSchedulesList(); | 856 | this.getSchedulesList(); |
835 | this.clear(); | 857 | this.clear(); |
836 | }) | 858 | }) |
837 | .catch(error => { | 859 | .catch(error => { |
838 | this.snackbar = true; | 860 | this.snackbar = true; |
839 | this.text = error.response.data.message; | 861 | this.text = error.response.data.message; |
840 | this.color = "red"; | 862 | this.color = "red"; |
841 | this.loading = false; | 863 | this.loading = false; |
842 | }); | 864 | }); |
843 | } | 865 | } |
844 | }, | 866 | }, |
845 | clear() { | 867 | clear() { |
846 | this.$refs.form.reset(); | 868 | this.$refs.form.reset(); |
847 | this.disable = false; | 869 | this.disable = false; |
848 | this.loading = false; | 870 | this.loading = false; |
849 | }, | 871 | }, |
850 | update() { | 872 | update() { |
851 | this.editedItem.scheduleId = this.editedItem._id; | 873 | this.editedItem.scheduleId = this.editedItem._id; |
852 | http() | 874 | http() |
853 | .put("/updateSchedule", this.editedItem) | 875 | .put("/updateSchedule", this.editedItem) |
854 | .then(response => { | 876 | .then(response => { |
855 | this.snackbar = true; | 877 | this.snackbar = true; |
856 | this.text = "Successfully Edit Exam Schedule"; | 878 | this.text = "Successfully Edit Exam Schedule"; |
857 | this.color = "green"; | 879 | this.color = "green"; |
858 | this.editExamScheduleDialog = false; | 880 | this.editExamScheduleDialog = false; |
859 | this.getSchedulesList(); | 881 | this.getSchedulesList(); |
860 | this.close(); | 882 | this.close(); |
861 | }) | 883 | }) |
862 | .catch(error => { | 884 | .catch(error => { |
863 | this.snackbar = true; | 885 | this.snackbar = true; |
864 | this.text = error.response.data.message; | 886 | this.text = error.response.data.messages; |
865 | this.color = "red"; | 887 | this.color = "error"; |
888 | this.loading = false; | ||
866 | }); | 889 | }); |
867 | }, | 890 | }, |
868 | getClass() { | 891 | getClass() { |
869 | http() | 892 | http() |
870 | .get("/getClassesList", { | 893 | .get("/getClassesList", { |
871 | headers: { Authorization: "Bearer " + this.token } | 894 | headers: { Authorization: "Bearer " + this.token } |
872 | }) | 895 | }) |
873 | .then(response => { | 896 | .then(response => { |
874 | this.classList = response.data.data; | 897 | this.classList = response.data.data; |
875 | }) | 898 | }) |
876 | .catch(err => { | 899 | .catch(err => { |
877 | // console.log("err====>", err); | 900 | // console.log("err====>", err); |
878 | }); | 901 | }); |
879 | }, | 902 | }, |
880 | getSections(_id) { | 903 | getSections(_id) { |
881 | for (let i = 0; i < this.classList.length; i++) { | 904 | for (let i = 0; i < this.classList.length; i++) { |
882 | if (_id == this.classList[i]._id) { | 905 | if (_id == this.classList[i]._id) { |
883 | this.subjects = this.classList[i].subjects; | 906 | this.subjects = this.classList[i].subjects; |
884 | } | 907 | } |
885 | } | 908 | } |
886 | http() | 909 | http() |
887 | .get( | 910 | .get( |
888 | "/getSectionsList", | 911 | "/getSectionsList", |
889 | { params: { classId: _id } }, | 912 | { params: { classId: _id } }, |
890 | { | 913 | { |
891 | headers: { Authorization: "Bearer " + this.token } | 914 | headers: { Authorization: "Bearer " + this.token } |
892 | } | 915 | } |
893 | ) | 916 | ) |
894 | .then(response => { | 917 | .then(response => { |
895 | this.addSection = response.data.data; | 918 | this.addSection = response.data.data; |
896 | }) | 919 | }) |
897 | .catch(err => {}); | 920 | .catch(err => {}); |
898 | }, | 921 | }, |
899 | getExamList() { | 922 | getExamList() { |
900 | this.showLoader = true; | 923 | this.showLoader = true; |
901 | this.loadingSearch = true; | 924 | this.loadingSearch = true; |
902 | http() | 925 | http() |
903 | .get("/getExamsList", { | 926 | .get("/getExamsList", { |
904 | headers: { Authorization: "Bearer " + this.token } | 927 | headers: { Authorization: "Bearer " + this.token } |
905 | }) | 928 | }) |
906 | .then(response => { | 929 | .then(response => { |
907 | this.examList = response.data.data; | 930 | this.examList = response.data.data; |
908 | this.showLoader = false; | 931 | this.showLoader = false; |
909 | this.loadingSearch = false; | 932 | this.loadingSearch = false; |
910 | }) | 933 | }) |
911 | .catch(error => { | 934 | .catch(error => { |
912 | this.showLoader = false; | 935 | this.showLoader = false; |
913 | this.loadingSearch = false; | 936 | this.loadingSearch = false; |
914 | this.snackbar = true; | 937 | this.snackbar = true; |
915 | this.text = error.response.data.message; | 938 | this.text = error.response.data.message; |
916 | if (error.response.status === 401) { | 939 | if (error.response.status === 401) { |
917 | this.$router.replace({ path: "/" }); | 940 | this.$router.replace({ path: "/" }); |
918 | this.$store.dispatch("setToken", null); | 941 | this.$store.dispatch("setToken", null); |
919 | this.$store.dispatch("Id", null); | 942 | this.$store.dispatch("Id", null); |
920 | } | 943 | } |
921 | }); | 944 | }); |
922 | }, | 945 | }, |
923 | displaySearch() { | 946 | displaySearch() { |
924 | (this.show = false), (this.showSearch = true); | 947 | (this.show = false), (this.showSearch = true); |
925 | }, | 948 | }, |
926 | closeSearch() { | 949 | closeSearch() { |
927 | this.showSearch = false; | 950 | this.showSearch = false; |
928 | this.show = true; | 951 | this.show = true; |
929 | this.search = ""; | 952 | this.search = ""; |
930 | } | 953 | } |
931 | }, | 954 | }, |
932 | mounted() { | 955 | mounted() { |
933 | this.token = this.$store.state.token; | 956 | this.token = this.$store.state.token; |
934 | this.getClass(); | 957 | this.getClass(); |
935 | this.getExamList(); | 958 | this.getExamList(); |
936 | this.role = this.$store.state.role; | 959 | this.role = this.$store.state.role; |
937 | } | 960 | } |
938 | }; | 961 | }; |
939 | </script> | 962 | </script> |
src/pages/Mark/viewMark.vue
1 | <template> | 1 | <template> |
2 | <v-app id="pages-dasboard"> | 2 | <v-app id="pages-dasboard"> |
3 | <!-- ****** PROFILE MARK ****** --> | 3 | <!-- ****** PROFILE MARK ****** --> |
4 | <v-container fluid grid-list-md> | 4 | <v-container fluid grid-list-md> |
5 | <v-layout> | 5 | <v-layout> |
6 | <v-flex xs12 sm8 md10> | 6 | <v-flex xs12 sm8 md10> |
7 | <v-btn class="open-dialog-button mt-3" round dark @click="print()"> | 7 | <v-btn class="open-dialog-button mt-3" round dark @click="print()"> |
8 | 8 | ||
9 | <v-icon size="18" right dark>print</v-icon> | 9 | <v-icon size="18" right dark>print</v-icon> |
10 | </v-btn> | 10 | </v-btn> |
11 | </v-flex> | 11 | </v-flex> |
12 | <v-flex xs12 sm4 md2 class="right"> | 12 | <v-flex xs12 sm4 md2 class="right"> |
13 | <v-select | 13 | <v-select |
14 | class | 14 | class |
15 | :items="selectMark" | 15 | :items="selectMark" |
16 | label="Select" | 16 | label="Select" |
17 | v-model="selectMarkList" | 17 | v-model="selectMarkList" |
18 | @change="selectMarkData(selectMarkList)" | 18 | @change="selectMarkData(selectMarkList)" |
19 | ></v-select> | 19 | ></v-select> |
20 | </v-flex> | 20 | </v-flex> |
21 | </v-layout> | 21 | </v-layout> |
22 | <v-flex xs12 sm12> | 22 | <v-flex xs12 sm12 v-if="showData"> |
23 | <!-- <v-layout wrap> --> | 23 | <!-- <v-layout wrap> --> |
24 | <!-- ****** TABLE DATA MARK ****** --> | 24 | <!-- ****** TABLE DATA MARK ****** --> |
25 | <v-flex xs12 sm12 md12> | 25 | <v-flex xs12 sm12 md12> |
26 | <v-layout> | 26 | <v-layout> |
27 | <v-flex xs12 sm12 md12 style="text-align:center"> | 27 | <v-flex xs12 sm12 md12 style="text-align:center"> |
28 | <!-- <img :src="userData.schoolLogoUrl" width="140" alt="logo" /> --> | 28 | <!-- <img :src="userData.schoolLogoUrl" width="140" alt="logo" /> --> |
29 | <v-avatar> | 29 | <v-avatar> |
30 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" /> | 30 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" /> |
31 | <img | 31 | <img |
32 | src="/static/schoolIcons/INTRACK_White.png" | 32 | src="/static/schoolIcons/INTRACK_White.png" |
33 | v-else-if="!userData.schoolLogoUrl" | 33 | v-else-if="!userData.schoolLogoUrl" |
34 | /> | 34 | /> |
35 | </v-avatar> | 35 | </v-avatar> |
36 | <p | 36 | <p |
37 | style=" | 37 | style=" |
38 | font-size: 20px !important; | 38 | font-size: 20px !important; |
39 | font-weight: 500; | 39 | font-weight: 500; |
40 | line-height: 2 !important; | 40 | line-height: 2 !important; |
41 | letter-spacing: 0.02em !important;" | 41 | letter-spacing: 0.02em !important;" |
42 | >{{ userData.name }}</p> | 42 | >{{ userData.name }}</p> |
43 | <p style="margin-bottom: 16px;">{{ userData.address }}</p> | 43 | <p style="margin-bottom: 16px;">{{ userData.address }}</p> |
44 | </v-flex> | 44 | </v-flex> |
45 | </v-layout> | 45 | </v-layout> |
46 | <v-layout wrap> | 46 | <v-layout wrap> |
47 | <v-flex xs12 sm12 md3> | 47 | <v-flex xs12 sm12 md3> |
48 | <v-card | 48 | <v-card |
49 | style=" | 49 | style=" |
50 | margin:auto 4px; | 50 | margin:auto 4px; |
51 | padding:20px; | 51 | padding:20px; |
52 | background-color: #fff; | 52 | background-color: #fff; |
53 | border-color: #fff; | 53 | border-color: #fff; |
54 | color: rgba(0,0,0,0.87); | 54 | color: rgba(0,0,0,0.87); |
55 | border: 1px solid rgb(226, 231, 235); | 55 | border: 1px solid rgb(226, 231, 235); |
56 | -webkit-box-shadow:inherit !important; | 56 | -webkit-box-shadow:inherit !important; |
57 | box-shadow: inherit !important;" | 57 | box-shadow: inherit !important;" |
58 | > | 58 | > |
59 | <v-layout> | 59 | <v-layout> |
60 | <v-flex xs12 style="text-align: center;"> | 60 | <v-flex xs12 style="text-align: center;"> |
61 | <v-avatar size="80"> | 61 | <v-avatar size="80"> |
62 | <img src="/static/icon/user.png" v-if="!markData[0].studentId.profilePicUrl" /> | 62 | <img src="/static/icon/user.png" v-if="!markData[0].studentId.profilePicUrl" /> |
63 | <img | 63 | <img |
64 | :src="markData[0].studentId.profilePicUrl" | 64 | :src="markData[0].studentId.profilePicUrl" |
65 | v-else-if="markData[0].studentId.profilePicUrl" | 65 | v-else-if="markData[0].studentId.profilePicUrl" |
66 | /> | 66 | /> |
67 | </v-avatar> | 67 | </v-avatar> |
68 | </v-flex> | 68 | </v-flex> |
69 | </v-layout> | 69 | </v-layout> |
70 | <v-layout> | 70 | <v-layout> |
71 | <v-flex xs12 style="text-align: center;"> | 71 | <v-flex xs12 style="text-align: center;"> |
72 | <h4 style="margin: 4px 0px;font-weight: 400;">{{ markData[0].studentId.name }}</h4> | 72 | <h4 style="margin: 4px 0px;font-weight: 400;">{{ markData[0].studentId.name }}</h4> |
73 | <p style="color: #999;">Student</p> | 73 | <p style="color: #999;">Student</p> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | <v-layout | 76 | <v-layout |
77 | style=" | 77 | style=" |
78 | margin-bottom: -1px; | 78 | margin-bottom: -1px; |
79 | border: 1px solid #ddd; | 79 | border: 1px solid #ddd; |
80 | margin: 0px; | 80 | margin: 0px; |
81 | padding: 4px; | 81 | padding: 4px; |
82 | color: #707478; | 82 | color: #707478; |
83 | font-size: 16px;" | 83 | font-size: 16px;" |
84 | > | 84 | > |
85 | <v-flex xs6 sm6> | 85 | <v-flex xs6 sm6> |
86 | <p style="float:left;margin: 4px 0px;"> | 86 | <p style="float:left;margin: 4px 0px;"> |
87 | <b>Class</b> | 87 | <b>Class</b> |
88 | </p> | 88 | </p> |
89 | </v-flex> | 89 | </v-flex> |
90 | <v-flex sm6 xs6> | 90 | <v-flex sm6 xs6> |
91 | <p style="float:right;margin: 4px 0px;">{{ markData[0].classId.classNum }}</p> | 91 | <p style="float:right;margin: 4px 0px;">{{ markData[0].classId.classNum }}</p> |
92 | </v-flex> | 92 | </v-flex> |
93 | </v-layout> | 93 | </v-layout> |
94 | <v-layout | 94 | <v-layout |
95 | style=" | 95 | style=" |
96 | margin-bottom: -1px; | 96 | margin-bottom: -1px; |
97 | border: 1px solid #ddd; | 97 | border: 1px solid #ddd; |
98 | margin: 0px; | 98 | margin: 0px; |
99 | padding: 4px; | 99 | padding: 4px; |
100 | color: #707478; | 100 | color: #707478; |
101 | font-size: 16px;" | 101 | font-size: 16px;" |
102 | > | 102 | > |
103 | <v-flex xs6 sm6> | 103 | <v-flex xs6 sm6> |
104 | <p style="float:left;margin: 4px 0px;"> | 104 | <p style="float:left;margin: 4px 0px;"> |
105 | <b>Section</b> | 105 | <b>Section</b> |
106 | </p> | 106 | </p> |
107 | </v-flex> | 107 | </v-flex> |
108 | <v-flex sm6 xs6> | 108 | <v-flex sm6 xs6> |
109 | <p style="float:right;margin: 4px 0px;">{{ markData[0].sectionId.name }}</p> | 109 | <p style="float:right;margin: 4px 0px;">{{ markData[0].sectionId.name }}</p> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | <v-layout | 112 | <v-layout |
113 | style=" | 113 | style=" |
114 | margin-bottom: -1px; | 114 | margin-bottom: -1px; |
115 | border: 1px solid #ddd; | 115 | border: 1px solid #ddd; |
116 | margin: 0px; | 116 | margin: 0px; |
117 | padding: 4px; | 117 | padding: 4px; |
118 | color: #707478; | 118 | color: #707478; |
119 | font-size: 16px;" | 119 | font-size: 16px;" |
120 | > | 120 | > |
121 | <v-flex xs6 sm6> | 121 | <v-flex xs6 sm6> |
122 | <p style="float:left;margin: 4px 0px;"> | 122 | <p style="float:left;margin: 4px 0px;"> |
123 | <b>Roll No</b> | 123 | <b>Roll No</b> |
124 | </p> | 124 | </p> |
125 | </v-flex> | 125 | </v-flex> |
126 | <v-flex sm6 xs6> | 126 | <v-flex sm6 xs6> |
127 | <p style="float:right;margin: 4px 0px;">{{ markData[0].studentId.rollNo }}</p> | 127 | <p style="float:right;margin: 4px 0px;">{{ markData[0].studentId.rollNo }}</p> |
128 | </v-flex> | 128 | </v-flex> |
129 | </v-layout> | 129 | </v-layout> |
130 | </v-card> | 130 | </v-card> |
131 | </v-flex> | 131 | </v-flex> |
132 | <v-flex xs12 sm12 md9 v-show="showMark"> | 132 | <v-flex xs12 sm12 md9 v-show="showMark"> |
133 | <v-card | 133 | <v-card |
134 | style=" margin:auto 14px; | 134 | style=" margin:auto 14px; |
135 | padding:0px 0px; | 135 | padding:0px 0px; |
136 | background-color: #fff; | 136 | background-color: #fff; |
137 | border: 1px solid lightgrey; | 137 | border: 1px solid lightgrey; |
138 | color: rgba(0,0,0,0.87); | 138 | color: rgba(0,0,0,0.87); |
139 | overflow: auto; | 139 | overflow: auto; |
140 | display: block; | 140 | display: block; |
141 | border: 1px solid rgb(226, 231, 235); | 141 | border: 1px solid rgb(226, 231, 235); |
142 | -webkit-box-shadow:inherit !important; | 142 | -webkit-box-shadow:inherit !important; |
143 | box-shadow: inherit !important;" | 143 | box-shadow: inherit !important;" |
144 | > | 144 | > |
145 | <div> | 145 | <div> |
146 | <table | 146 | <table |
147 | v-for="(value, id) in filterData" | 147 | v-for="(value, id) in filterData" |
148 | :key="id" | 148 | :key="id" |
149 | class="mb-5 tableRsponsive feeTypeTable subheading" | 149 | class="mb-5 tableRsponsive feeTypeTable subheading" |
150 | style="border: 1px solid black; | 150 | style="border: 1px solid black; |
151 | border-collapse: collapse;!important | 151 | border-collapse: collapse;!important |
152 | table-layout: auto !important; | 152 | table-layout: auto !important; |
153 | width: 100% !important;" | 153 | width: 100% !important;" |
154 | > | 154 | > |
155 | <thead style="border: 1px solid transparent !important;"> | 155 | <thead style="border: 1px solid transparent !important;"> |
156 | <td | 156 | <td |
157 | colspan="4" | 157 | colspan="4" |
158 | style="text-align: inherit !important; | 158 | style="text-align: inherit !important; |
159 | border-right: inherit; | 159 | border-right: inherit; |
160 | border-top: inherit; | 160 | border-top: inherit; |
161 | padding:8px;" | 161 | padding:8px;" |
162 | >{{value[0].examId.examName}}</td> | 162 | >{{value[0].examId.examName}}</td> |
163 | <tr style="border: 1px solid lightgrey !important;"> | 163 | <tr style="border: 1px solid lightgrey !important;"> |
164 | <td | 164 | <td |
165 | rowspan="2" | 165 | rowspan="2" |
166 | style="border: 1px solid lightgrey !important;;padding:4px; text-align: left;" | 166 | style="border: 1px solid lightgrey !important;;padding:4px; text-align: left;" |
167 | >Subject</td> | 167 | >Subject</td> |
168 | <template v-for="(studentData,ind) in value"> | 168 | <template v-for="(studentData,ind) in value"> |
169 | <td | 169 | <td |
170 | v-if="ind == 0" | 170 | v-if="ind == 0" |
171 | colspan="2" | 171 | colspan="2" |
172 | v-for="studentMark in studentData.studentsMarks" | 172 | v-for="studentMark in studentData.studentsMarks" |
173 | style="border: 1px solid lightgrey !important;padding:10px; text-align: left;" | 173 | style="border: 1px solid lightgrey !important;padding:10px; text-align: left;" |
174 | >{{studentMark.markDistributionId.distributionType}}</td> | 174 | >{{studentMark.markDistributionId.distributionType}}</td> |
175 | <td | 175 | <td |
176 | v-if="ind == 0" | 176 | v-if="ind == 0" |
177 | style="border: 1px solid lightgrey !important text-align: left;" | 177 | style="border: 1px solid lightgrey !important text-align: left;" |
178 | >Total Marks</td> | 178 | >Total Marks</td> |
179 | </template> | 179 | </template> |
180 | </tr> | 180 | </tr> |
181 | <tr | 181 | <tr |
182 | v-for="(subject, ind) in value" | 182 | v-for="(subject, ind) in value" |
183 | v-if="ind == 0" | 183 | v-if="ind == 0" |
184 | style="border: 1px solid lightgrey !important;" | 184 | style="border: 1px solid lightgrey !important;" |
185 | > | 185 | > |
186 | <template v-for="(exam, i) in subject.studentsMarks"> | 186 | <template v-for="(exam, i) in subject.studentsMarks"> |
187 | <td | 187 | <td |
188 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 188 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
189 | >Marks</td> | 189 | >Marks</td> |
190 | <td | 190 | <td |
191 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 191 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
192 | >Highest Marks</td> | 192 | >Highest Marks</td> |
193 | </template> | 193 | </template> |
194 | </tr> | 194 | </tr> |
195 | </thead> | 195 | </thead> |
196 | <tbody style="border: 1px solid lightgrey !important;"> | 196 | <tbody style="border: 1px solid lightgrey !important;"> |
197 | <tr | 197 | <tr |
198 | v-for="subject in value" | 198 | v-for="subject in value" |
199 | style="border: 1px solid lightgrey !important;" | 199 | style="border: 1px solid lightgrey !important;" |
200 | class="tr" | 200 | class="tr" |
201 | > | 201 | > |
202 | <td | 202 | <td |
203 | style="border: 1px solid lightgrey !important;padding: 4px;" | 203 | style="border: 1px solid lightgrey !important;padding: 4px;" |
204 | >{{subject.subjectName}}</td> | 204 | >{{subject.subjectName}}</td> |
205 | <template v-for="(exam, i) in subject.studentsMarks"> | 205 | <template v-for="(exam, i) in subject.studentsMarks"> |
206 | <td | 206 | <td |
207 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 207 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
208 | >{{exam.marksScored}}</td> | 208 | >{{exam.marksScored}}</td> |
209 | <td | 209 | <td |
210 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 210 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
211 | >{{exam.markDistributionId.markValue}}</td> | 211 | >{{exam.markDistributionId.markValue}}</td> |
212 | </template> | 212 | </template> |
213 | <td | 213 | <td |
214 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 214 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
215 | >{{subject.totalMarks}}</td> | 215 | >{{subject.totalMarks}}</td> |
216 | </tr> | 216 | </tr> |
217 | </tbody> | 217 | </tbody> |
218 | </table> | 218 | </table> |
219 | </div> | 219 | </div> |
220 | </v-card> | 220 | </v-card> |
221 | </v-flex> | 221 | </v-flex> |
222 | <!-- ****** TABLE GRADE MARK ****** --> | 222 | <!-- ****** TABLE GRADE MARK ****** --> |
223 | <v-flex xs12 sm12 md8 v-show="showGrade"> | 223 | <v-flex xs12 sm12 md8 v-show="showGrade"> |
224 | <v-card | 224 | <v-card |
225 | v-for="(value, id, index) in filterData" | 225 | v-for="(value, id, index) in filterData" |
226 | :key="index" | 226 | :key="index" |
227 | flat | 227 | flat |
228 | style="border: 1px solid lightgrey;margin-bottom:14px;" | 228 | style="border: 1px solid lightgrey;margin-bottom:14px;" |
229 | > | 229 | > |
230 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> | 230 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> |
231 | <table | 231 | <table |
232 | class="mb-5 tableRsponsive feeTypeTable" | 232 | class="mb-5 tableRsponsive feeTypeTable" |
233 | style="border: 1px solid lightgrey; | 233 | style="border: 1px solid lightgrey; |
234 | border-collapse: collapse;!important | 234 | border-collapse: collapse;!important |
235 | table-layout: auto !important; | 235 | table-layout: auto !important; |
236 | width: 100% !important;" | 236 | width: 100% !important;" |
237 | > | 237 | > |
238 | <thead style="border: 1px solid lightgrey !important;"> | 238 | <thead style="border: 1px solid lightgrey !important;"> |
239 | <tr | 239 | <tr |
240 | class="info white--text" | 240 | class="info white--text" |
241 | style="border: 1px solid lightgrey !important;padding:4px;" | 241 | style="border: 1px solid lightgrey !important;padding:4px;" |
242 | > | 242 | > |
243 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Subject</td> | 243 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Subject</td> |
244 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Grade</td> | 244 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Grade</td> |
245 | </tr> | 245 | </tr> |
246 | </thead> | 246 | </thead> |
247 | <tbody style="border: 1px solid lightgrey !important;"> | 247 | <tbody style="border: 1px solid lightgrey !important;"> |
248 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> | 248 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> |
249 | <td | 249 | <td |
250 | style="border: 1px solid lightgrey !important;padding: 4px;" | 250 | style="border: 1px solid lightgrey !important;padding: 4px;" |
251 | >{{ subject.subjectName }}</td> | 251 | >{{ subject.subjectName }}</td> |
252 | <td | 252 | <td |
253 | style="border: 1px solid lightgrey !important;padding: 4px;" | 253 | style="border: 1px solid lightgrey !important;padding: 4px;" |
254 | >{{ subject.grade }}</td> | 254 | >{{ subject.grade }}</td> |
255 | </tr> | 255 | </tr> |
256 | </tbody> | 256 | </tbody> |
257 | </table> | 257 | </table> |
258 | </v-card> | 258 | </v-card> |
259 | <v-card v-if="markData.length == 0"> | 259 | <v-card v-if="markData.length == 0"> |
260 | <v-layout> | 260 | <v-layout> |
261 | <v-flex xs12> | 261 | <v-flex xs12> |
262 | <h5 class="text-xs-center pa-3">No Data Found</h5> | 262 | <h5 class="text-xs-center pa-3">No Data Found</h5> |
263 | </v-flex> | 263 | </v-flex> |
264 | </v-layout> | 264 | </v-layout> |
265 | </v-card> | 265 | </v-card> |
266 | </v-flex> | 266 | </v-flex> |
267 | </v-layout> | 267 | </v-layout> |
268 | </v-flex> | 268 | </v-flex> |
269 | </v-flex> | 269 | </v-flex> |
270 | <!-- print Me --> | 270 | <!-- print Me --> |
271 | <v-flex xs12 sm12 id="printMe" v-show="hideViewMark"> | 271 | <v-flex xs12 sm12 id="printMe" v-show="hideViewMark" v-if="showData"> |
272 | <!-- <v-layout wrap> --> | 272 | <!-- <v-layout wrap> --> |
273 | <!-- ****** TABLE DATA MARK ****** --> | 273 | <!-- ****** TABLE DATA MARK ****** --> |
274 | <v-flex xs12 sm12 md12> | 274 | <v-flex xs12 sm12 md12> |
275 | <v-layout> | 275 | <v-layout> |
276 | <v-flex xs12 sm12 md12 style="text-align:center"> | 276 | <v-flex xs12 sm12 md12 style="text-align:center"> |
277 | <!-- <img :src="userData.schoolLogoUrl" width="140" alt="logo" /> --> | 277 | <!-- <img :src="userData.schoolLogoUrl" width="140" alt="logo" /> --> |
278 | <v-avatar> | 278 | <v-avatar> |
279 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" /> | 279 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" /> |
280 | <img | 280 | <img |
281 | src="/static/schoolIcons/INTRACK_White.png" | 281 | src="/static/schoolIcons/INTRACK_White.png" |
282 | v-else-if="!userData.schoolLogoUrl" | 282 | v-else-if="!userData.schoolLogoUrl" |
283 | /> | 283 | /> |
284 | </v-avatar> | 284 | </v-avatar> |
285 | <p | 285 | <p |
286 | style=" | 286 | style=" |
287 | font-size: 20px !important; | 287 | font-size: 20px !important; |
288 | font-weight: 500; | 288 | font-weight: 500; |
289 | line-height: 2 !important; | 289 | line-height: 2 !important; |
290 | letter-spacing: 0.02em !important;" | 290 | letter-spacing: 0.02em !important;" |
291 | >{{ userData.name }}</p> | 291 | >{{ userData.name }}</p> |
292 | <p style="margin-bottom: 16px;">{{ userData.address }}</p> | 292 | <p style="margin-bottom: 16px;">{{ userData.address }}</p> |
293 | </v-flex> | 293 | </v-flex> |
294 | </v-layout> | 294 | </v-layout> |
295 | <v-layout wrap> | 295 | <v-layout wrap> |
296 | <v-flex xs3 sm3 md3> | 296 | <v-flex xs3 sm3 md3> |
297 | <v-card | 297 | <v-card |
298 | style=" | 298 | style=" |
299 | margin:auto 4px; | 299 | margin:auto 4px; |
300 | padding:20px; | 300 | padding:20px; |
301 | background-color: #fff; | 301 | background-color: #fff; |
302 | border-color: #fff; | 302 | border-color: #fff; |
303 | color: rgba(0,0,0,0.87); | 303 | color: rgba(0,0,0,0.87); |
304 | border: 1px solid rgb(226, 231, 235); | 304 | border: 1px solid rgb(226, 231, 235); |
305 | -webkit-box-shadow:inherit !important; | 305 | -webkit-box-shadow:inherit !important; |
306 | box-shadow: inherit !important;" | 306 | box-shadow: inherit !important;" |
307 | > | 307 | > |
308 | <v-layout> | 308 | <v-layout> |
309 | <v-flex xs12 style="text-align: center;"> | 309 | <v-flex xs12 style="text-align: center;"> |
310 | <v-avatar size="80"> | 310 | <v-avatar size="80"> |
311 | <img src="/static/icon/user.png" v-if="!markData[0].studentId.profilePicUrl" /> | 311 | <img src="/static/icon/user.png" v-if="!markData[0].studentId.profilePicUrl" /> |
312 | <img | 312 | <img |
313 | :src="markData[0].studentId.profilePicUrl" | 313 | :src="markData[0].studentId.profilePicUrl" |
314 | v-else-if="markData[0].studentId.profilePicUrl" | 314 | v-else-if="markData[0].studentId.profilePicUrl" |
315 | /> | 315 | /> |
316 | </v-avatar> | 316 | </v-avatar> |
317 | </v-flex> | 317 | </v-flex> |
318 | </v-layout> | 318 | </v-layout> |
319 | <v-layout> | 319 | <v-layout> |
320 | <v-flex xs12 style="text-align: center;"> | 320 | <v-flex xs12 style="text-align: center;"> |
321 | <h4 style="margin: 4px 0px;font-weight: 400;">{{ markData[0].studentId.name }}</h4> | 321 | <h4 style="margin: 4px 0px;font-weight: 400;">{{ markData[0].studentId.name }}</h4> |
322 | <p style="color: #999;margin-bottom: 16px;">Student</p> | 322 | <p style="color: #999;margin-bottom: 16px;">Student</p> |
323 | </v-flex> | 323 | </v-flex> |
324 | </v-layout> | 324 | </v-layout> |
325 | <v-layout | 325 | <v-layout |
326 | style=" | 326 | style=" |
327 | margin-bottom: -1px; | 327 | margin-bottom: -1px; |
328 | border: 1px solid #ddd; | 328 | border: 1px solid #ddd; |
329 | margin: 0px; | 329 | margin: 0px; |
330 | padding: 4px; | 330 | padding: 4px; |
331 | color: #707478; | 331 | color: #707478; |
332 | font-size: 16px;" | 332 | font-size: 16px;" |
333 | > | 333 | > |
334 | <v-flex xs6 sm6> | 334 | <v-flex xs6 sm6> |
335 | <p style="float:left;margin: 4px 0px;"> | 335 | <p style="float:left;margin: 4px 0px;"> |
336 | <b>Class</b> | 336 | <b>Class</b> |
337 | </p> | 337 | </p> |
338 | </v-flex> | 338 | </v-flex> |
339 | <v-flex sm6 xs6> | 339 | <v-flex sm6 xs6> |
340 | <p style="float:right;margin: 4px 0px;">{{ markData[0].classId.classNum }}</p> | 340 | <p style="float:right;margin: 4px 0px;">{{ markData[0].classId.classNum }}</p> |
341 | </v-flex> | 341 | </v-flex> |
342 | </v-layout> | 342 | </v-layout> |
343 | <v-layout | 343 | <v-layout |
344 | style=" | 344 | style=" |
345 | margin-bottom: -1px; | 345 | margin-bottom: -1px; |
346 | border: 1px solid #ddd; | 346 | border: 1px solid #ddd; |
347 | margin: 0px; | 347 | margin: 0px; |
348 | padding: 4px; | 348 | padding: 4px; |
349 | color: #707478; | 349 | color: #707478; |
350 | font-size: 16px;" | 350 | font-size: 16px;" |
351 | > | 351 | > |
352 | <v-flex xs6 sm6> | 352 | <v-flex xs6 sm6> |
353 | <p style="float:left;margin: 4px 0px;"> | 353 | <p style="float:left;margin: 4px 0px;"> |
354 | <b>Section</b> | 354 | <b>Section</b> |
355 | </p> | 355 | </p> |
356 | </v-flex> | 356 | </v-flex> |
357 | <v-flex sm6 xs6> | 357 | <v-flex sm6 xs6> |
358 | <p style="float:right;margin: 4px 0px;">{{ markData[0].sectionId.name }}</p> | 358 | <p style="float:right;margin: 4px 0px;">{{ markData[0].sectionId.name }}</p> |
359 | </v-flex> | 359 | </v-flex> |
360 | </v-layout> | 360 | </v-layout> |
361 | <v-layout | 361 | <v-layout |
362 | style=" | 362 | style=" |
363 | margin-bottom: -1px; | 363 | margin-bottom: -1px; |
364 | border: 1px solid #ddd; | 364 | border: 1px solid #ddd; |
365 | margin: 0px; | 365 | margin: 0px; |
366 | padding: 4px; | 366 | padding: 4px; |
367 | color: #707478; | 367 | color: #707478; |
368 | font-size: 16px;" | 368 | font-size: 16px;" |
369 | > | 369 | > |
370 | <v-flex xs6 sm6> | 370 | <v-flex xs6 sm6> |
371 | <p style="float:left;margin: 4px 0px;"> | 371 | <p style="float:left;margin: 4px 0px;"> |
372 | <b>Roll No</b> | 372 | <b>Roll No</b> |
373 | </p> | 373 | </p> |
374 | </v-flex> | 374 | </v-flex> |
375 | <v-flex sm6 xs6> | 375 | <v-flex sm6 xs6> |
376 | <p style="float:right;margin: 4px 0px;">{{ markData[0].studentId.rollNo }}</p> | 376 | <p style="float:right;margin: 4px 0px;">{{ markData[0].studentId.rollNo }}</p> |
377 | </v-flex> | 377 | </v-flex> |
378 | </v-layout> | 378 | </v-layout> |
379 | </v-card> | 379 | </v-card> |
380 | </v-flex> | 380 | </v-flex> |
381 | <v-flex xs9 sm9 md9 v-show="showMark"> | 381 | <v-flex xs9 sm9 md9 v-show="showMark"> |
382 | <v-card | 382 | <v-card |
383 | style=" margin:auto 14px; | 383 | style=" margin:auto 14px; |
384 | padding:20px 0px; | 384 | padding:20px 0px; |
385 | background-color: #fff; | 385 | background-color: #fff; |
386 | border: 1px solid lightgrey; | 386 | border: 1px solid lightgrey; |
387 | color: rgba(0,0,0,0.87); | 387 | color: rgba(0,0,0,0.87); |
388 | border: 1px solid rgb(226, 231, 235); | 388 | border: 1px solid rgb(226, 231, 235); |
389 | -webkit-box-shadow:inherit !important; | 389 | -webkit-box-shadow:inherit !important; |
390 | box-shadow: inherit !important;" | 390 | box-shadow: inherit !important;" |
391 | > | 391 | > |
392 | <div> | 392 | <div> |
393 | <table | 393 | <table |
394 | v-for="(value, id) in filterData" | 394 | v-for="(value, id) in filterData" |
395 | :key="id" | 395 | :key="id" |
396 | class="mb-5 tableRsponsive feeTypeTable subheading" | 396 | class="mb-5 tableRsponsive feeTypeTable subheading" |
397 | style="border: 1px solid black; | 397 | style="border: 1px solid black; |
398 | border-collapse: collapse;!important | 398 | border-collapse: collapse;!important |
399 | table-layout: auto !important; | 399 | table-layout: auto !important; |
400 | width: 100% !important;" | 400 | width: 100% !important;" |
401 | > | 401 | > |
402 | <thead style="border: 1px solid transparent !important;"> | 402 | <thead style="border: 1px solid transparent !important;"> |
403 | <td | 403 | <td |
404 | colspan="4" | 404 | colspan="4" |
405 | style="text-align: inherit !important; | 405 | style="text-align: inherit !important; |
406 | border-right: inherit; | 406 | border-right: inherit; |
407 | border-top: inherit; | 407 | border-top: inherit; |
408 | padding:14px;" | 408 | padding:14px;" |
409 | >{{value[0].examId.examName}}</td> | 409 | >{{value[0].examId.examName}}</td> |
410 | <tr style="border: 1px solid lightgrey !important;"> | 410 | <tr style="border: 1px solid lightgrey !important;"> |
411 | <td | 411 | <td |
412 | rowspan="2" | 412 | rowspan="2" |
413 | style="border: 1px solid lightgrey !important;;padding:4px; text-align: left;" | 413 | style="border: 1px solid lightgrey !important;;padding:4px; text-align: left;" |
414 | >Subject</td> | 414 | >Subject</td> |
415 | <template v-for="(studentData,ind) in value"> | 415 | <template v-for="(studentData,ind) in value"> |
416 | <td | 416 | <td |
417 | v-if="ind == 0" | 417 | v-if="ind == 0" |
418 | colspan="2" | 418 | colspan="2" |
419 | v-for="studentMark in studentData.studentsMarks" | 419 | v-for="studentMark in studentData.studentsMarks" |
420 | style="border: 1px solid lightgrey !important;padding:10px; text-align: left;" | 420 | style="border: 1px solid lightgrey !important;padding:10px; text-align: left;" |
421 | >{{studentMark.markDistributionId.distributionType}}</td> | 421 | >{{studentMark.markDistributionId.distributionType}}</td> |
422 | <td | 422 | <td |
423 | v-if="ind == 0" | 423 | v-if="ind == 0" |
424 | style="border: 1px solid lightgrey !important text-align: left;" | 424 | style="border: 1px solid lightgrey !important text-align: left;" |
425 | >Total Marks</td> | 425 | >Total Marks</td> |
426 | </template> | 426 | </template> |
427 | </tr> | 427 | </tr> |
428 | <tr | 428 | <tr |
429 | v-for="(subject, ind) in value" | 429 | v-for="(subject, ind) in value" |
430 | v-if="ind == 0" | 430 | v-if="ind == 0" |
431 | style="border: 1px solid lightgrey !important;" | 431 | style="border: 1px solid lightgrey !important;" |
432 | > | 432 | > |
433 | <template v-for="(exam, i) in subject.studentsMarks"> | 433 | <template v-for="(exam, i) in subject.studentsMarks"> |
434 | <td | 434 | <td |
435 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 435 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
436 | >Marks</td> | 436 | >Marks</td> |
437 | <td | 437 | <td |
438 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 438 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
439 | >Highest Marks</td> | 439 | >Highest Marks</td> |
440 | </template> | 440 | </template> |
441 | </tr> | 441 | </tr> |
442 | </thead> | 442 | </thead> |
443 | <tbody style="border: 1px solid lightgrey !important;"> | 443 | <tbody style="border: 1px solid lightgrey !important;"> |
444 | <tr | 444 | <tr |
445 | v-for="subject in value" | 445 | v-for="subject in value" |
446 | style="border: 1px solid lightgrey !important;" | 446 | style="border: 1px solid lightgrey !important;" |
447 | class="tr" | 447 | class="tr" |
448 | > | 448 | > |
449 | <td | 449 | <td |
450 | style="border: 1px solid lightgrey !important;padding: 4px;" | 450 | style="border: 1px solid lightgrey !important;padding: 4px;" |
451 | >{{subject.subjectName}}</td> | 451 | >{{subject.subjectName}}</td> |
452 | <template v-for="(exam, i) in subject.studentsMarks"> | 452 | <template v-for="(exam, i) in subject.studentsMarks"> |
453 | <td | 453 | <td |
454 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 454 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
455 | >{{exam.marksScored}}</td> | 455 | >{{exam.marksScored}}</td> |
456 | <td | 456 | <td |
457 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 457 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
458 | >{{exam.markDistributionId.markValue}}</td> | 458 | >{{exam.markDistributionId.markValue}}</td> |
459 | </template> | 459 | </template> |
460 | <td | 460 | <td |
461 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" | 461 | style="border: 1px solid lightgrey !important;padding: 4px; text-align: left;" |
462 | >{{subject.totalMarks}}</td> | 462 | >{{subject.totalMarks}}</td> |
463 | </tr> | 463 | </tr> |
464 | </tbody> | 464 | </tbody> |
465 | </table> | 465 | </table> |
466 | </div> | 466 | </div> |
467 | </v-card> | 467 | </v-card> |
468 | </v-flex> | 468 | </v-flex> |
469 | <!-- ****** TABLE GRADE MARK ****** --> | 469 | <!-- ****** TABLE GRADE MARK ****** --> |
470 | <v-flex xs9 sm9 md8 v-show="showGrade"> | 470 | <v-flex xs9 sm9 md8 v-show="showGrade"> |
471 | <v-card | 471 | <v-card |
472 | v-for="(value, id, index) in filterData" | 472 | v-for="(value, id, index) in filterData" |
473 | :key="index" | 473 | :key="index" |
474 | flat | 474 | flat |
475 | style="border: 1px solid lightgrey;margin-bottom:14px;" | 475 | style="border: 1px solid lightgrey;margin-bottom:14px;" |
476 | > | 476 | > |
477 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> | 477 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> |
478 | <table | 478 | <table |
479 | class="mb-5 tableRsponsive feeTypeTable" | 479 | class="mb-5 tableRsponsive feeTypeTable" |
480 | style="border: 1px solid lightgrey; | 480 | style="border: 1px solid lightgrey; |
481 | border-collapse: collapse;!important | 481 | border-collapse: collapse;!important |
482 | table-layout: auto !important; | 482 | table-layout: auto !important; |
483 | width: 100% !important;" | 483 | width: 100% !important;" |
484 | > | 484 | > |
485 | <thead style="border: 1px solid lightgrey !important;"> | 485 | <thead style="border: 1px solid lightgrey !important;"> |
486 | <tr | 486 | <tr |
487 | class="info white--text" | 487 | class="info white--text" |
488 | style="border: 1px solid lightgrey !important;padding:4px;" | 488 | style="border: 1px solid lightgrey !important;padding:4px;" |
489 | > | 489 | > |
490 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Subject</td> | 490 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Subject</td> |
491 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Grade</td> | 491 | <td style="border: 1px solid lightgrey !important;padding: 4px;">Grade</td> |
492 | </tr> | 492 | </tr> |
493 | </thead> | 493 | </thead> |
494 | <tbody style="border: 1px solid lightgrey !important;"> | 494 | <tbody style="border: 1px solid lightgrey !important;"> |
495 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> | 495 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> |
496 | <td | 496 | <td |
497 | style="border: 1px solid lightgrey !important;padding: 4px;" | 497 | style="border: 1px solid lightgrey !important;padding: 4px;" |
498 | >{{ subject.subjectName }}</td> | 498 | >{{ subject.subjectName }}</td> |
499 | <td | 499 | <td |
500 | style="border: 1px solid lightgrey !important;padding: 4px;" | 500 | style="border: 1px solid lightgrey !important;padding: 4px;" |
501 | >{{ subject.grade }}</td> | 501 | >{{ subject.grade }}</td> |
502 | </tr> | 502 | </tr> |
503 | </tbody> | 503 | </tbody> |
504 | </table> | 504 | </table> |
505 | </v-card> | 505 | </v-card> |
506 | <v-card v-if="markData.length == 0"> | 506 | <v-card v-if="markData.length == 0"> |
507 | <v-layout> | 507 | <v-layout> |
508 | <v-flex xs12> | 508 | <v-flex xs12> |
509 | <h5 class="text-xs-center pa-3">No Data Found</h5> | 509 | <h5 class="text-xs-center pa-3">No Data Found</h5> |
510 | </v-flex> | 510 | </v-flex> |
511 | </v-layout> | 511 | </v-layout> |
512 | </v-card> | 512 | </v-card> |
513 | </v-flex> | 513 | </v-flex> |
514 | </v-layout> | 514 | </v-layout> |
515 | </v-flex> | 515 | </v-flex> |
516 | </v-flex> | 516 | </v-flex> |
517 | </v-container> | 517 | </v-container> |
518 | <div class="loader" v-if="showLoader"> | 518 | <div class="loader" v-if="showLoader"> |
519 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 519 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
520 | </div> | 520 | </div> |
521 | <v-snackbar | ||
522 | :timeout="timeout" | ||
523 | :top="y === 'top'" | ||
524 | :right="x === 'right'" | ||
525 | :vertical="mode === 'vertical'" | ||
526 | v-model="snackbar" | ||
527 | :color="color" | ||
528 | >{{ text }}</v-snackbar> | ||
521 | </v-app> | 529 | </v-app> |
522 | </template> | 530 | </template> |
523 | 531 | ||
524 | <script> | 532 | <script> |
525 | import http from "@/Services/http.js"; | 533 | import http from "@/Services/http.js"; |
526 | import moment from "moment"; | 534 | import moment from "moment"; |
527 | import _ from "underscore"; | 535 | import _ from "underscore"; |
528 | 536 | ||
529 | export default { | 537 | export default { |
530 | data: () => ({ | 538 | data: () => ({ |
531 | showLoader: true, | 539 | showLoader: true, |
532 | nameShow: false, | 540 | nameShow: false, |
533 | showMark: true, | 541 | showMark: true, |
534 | showGrade: false, | 542 | showGrade: false, |
535 | hideViewMark: false, | 543 | hideViewMark: false, |
536 | markData: [], | 544 | markData: [], |
537 | token: "", | 545 | token: "", |
538 | markDistributions: [], | 546 | markDistributions: [], |
539 | markParticularDistributionData: [], | 547 | markParticularDistributionData: [], |
540 | filterData: [], | 548 | filterData: [], |
541 | output: null, | 549 | output: null, |
542 | gradeAPlus: "A+", | 550 | gradeAPlus: "A+", |
543 | gradeA: "A", | 551 | gradeA: "A", |
544 | gradeBPlus: "B+", | 552 | gradeBPlus: "B+", |
545 | gradeB: "B", | 553 | gradeB: "B", |
546 | gradeCPlus: "C+", | 554 | gradeCPlus: "C+", |
547 | gradeC: "C", | 555 | gradeC: "C", |
548 | selectMarkList: "Mark", | 556 | selectMarkList: "Mark", |
549 | selectMark: ["Mark", "Grade"], | 557 | selectMark: ["Mark", "Grade"], |
550 | MarkData: "", | 558 | MarkData: "", |
551 | userData: {} | 559 | userData: {}, |
560 | showData: false, | ||
561 | |||
562 | //SNACKBAR | ||
563 | snackbar: false, | ||
564 | color: "", | ||
565 | y: "top", | ||
566 | x: "right", | ||
567 | mode: "", | ||
568 | timeout: 10000, | ||
569 | text: "" | ||
552 | }), | 570 | }), |
553 | mounted() { | 571 | mounted() { |
554 | this.token = this.$store.state.token; | 572 | this.token = this.$store.state.token; |
555 | this.getMarkList(); | 573 | this.getMarkList(); |
556 | this.getUserData(); | 574 | this.getUserData(); |
557 | }, | 575 | }, |
558 | methods: { | 576 | methods: { |
559 | getMarkList() { | 577 | getMarkList() { |
560 | this.showLoader = true; | 578 | this.showLoader = true; |
561 | http() | 579 | http() |
562 | .get("/getParticularMark", { | 580 | .get("/getParticularMark", { |
563 | params: { studentId: this.$route.params.markId }, | 581 | params: { studentId: this.$route.params.markId }, |
564 | headers: { Authorization: "Bearer " + this.token } | 582 | headers: { Authorization: "Bearer " + this.token } |
565 | }) | 583 | }) |
566 | .then(response => { | 584 | .then(response => { |
567 | this.markData = response.data.data; | 585 | this.markData = response.data.data; |
586 | // console.log("====this.markData===", this.markData); | ||
587 | if (this.markData.length === 0) { | ||
588 | this.showLoader = false; | ||
589 | this.snackbar = true; | ||
590 | this.text = "Data not found!"; | ||
591 | this.color = "error"; | ||
592 | return; | ||
593 | } | ||
594 | this.showData = true; | ||
568 | let newData = response.data.data; | 595 | let newData = response.data.data; |
569 | // console.log("newData", newData); | 596 | // console.log("newData", newData); |
570 | for (var i = 0; i < newData.length; i++) { | 597 | for (var i = 0; i < newData.length; i++) { |
571 | newData[i].examination = newData[i].examId._id; | 598 | newData[i].examination = newData[i].examId._id; |
572 | } | 599 | } |
573 | this.filterData = _.groupBy(newData, ["examination"]); | 600 | this.filterData = _.groupBy(newData, ["examination"]); |
574 | // console.log("this.filterData", this.filterData); | 601 | // console.log("this.filterData", this.filterData); |
575 | for (let data in this.filterData) { | 602 | for (let data in this.filterData) { |
576 | for (let item in this.filterData[data]) { | 603 | for (let item in this.filterData[data]) { |
577 | var totalMarks = 0; | 604 | var totalMarks = 0; |
578 | for ( | 605 | for ( |
579 | let i = 0; | 606 | let i = 0; |
580 | i < this.filterData[data][item].studentsMarks.length; | 607 | i < this.filterData[data][item].studentsMarks.length; |
581 | i++ | 608 | i++ |
582 | ) { | 609 | ) { |
583 | // console.log("this.filterData[data][item].studentsMarks[i]",this.filterData[data][item].studentsMarks[i] | 610 | // console.log("this.filterData[data][item].studentsMarks[i]",this.filterData[data][item].studentsMarks[i] |
584 | // .marksScored) | 611 | // .marksScored) |
585 | totalMarks += this.filterData[data][item].studentsMarks[i] | 612 | totalMarks += this.filterData[data][item].studentsMarks[i] |
586 | .marksScored; | 613 | .marksScored; |
587 | } | 614 | } |
588 | this.filterData[data][item].totalMarks = totalMarks; | 615 | this.filterData[data][item].totalMarks = totalMarks; |
589 | 616 | ||
590 | if (totalMarks > 90) { | 617 | if (totalMarks > 90) { |
591 | this.filterData[data][item].grade = this.gradeAPlus; | 618 | this.filterData[data][item].grade = this.gradeAPlus; |
592 | } else if (totalMarks > 80 && totalMarks < 90) { | 619 | } else if (totalMarks > 80 && totalMarks < 90) { |
593 | this.filterData[data][item].grade = this.gradeA; | 620 | this.filterData[data][item].grade = this.gradeA; |
594 | } else if (totalMarks > 70 && totalMarks < 80) { | 621 | } else if (totalMarks > 70 && totalMarks < 80) { |
595 | this.filterData[data][item].grade = this.gradeBPlus; | 622 | this.filterData[data][item].grade = this.gradeBPlus; |
596 | } else if (totalMarks > 60 && totalMarks < 70) { | 623 | } else if (totalMarks > 60 && totalMarks < 70) { |
597 | this.filterData[data][item].grade = this.gradeB; | 624 | this.filterData[data][item].grade = this.gradeB; |
598 | } else if (totalMarks > 50 && totalMarks < 60) { | 625 | } else if (totalMarks > 50 && totalMarks < 60) { |
599 | this.filterData[data][item].grade = this.gradeCPlus; | 626 | this.filterData[data][item].grade = this.gradeCPlus; |
600 | } else if (totalMarks > 40 && totalMarks < 50) { | 627 | } else if (totalMarks > 40 && totalMarks < 50) { |
601 | this.filterData[data][item].grade = this.gradeC; | 628 | this.filterData[data][item].grade = this.gradeC; |
602 | } | 629 | } |
603 | } | 630 | } |
604 | } | 631 | } |
605 | this.showLoader = false; | 632 | this.showLoader = false; |
606 | }) | 633 | }) |
607 | .catch(error => { | 634 | .catch(error => { |
608 | this.showLoader = false; | 635 | this.showLoader = false; |
609 | this.snackbar = true; | 636 | this.snackbar = true; |
610 | this.text = error.response.data.message; | 637 | this.text = error.response.data.message; |
611 | if (error.response.status === 401) { | 638 | if (error.response.status === 401) { |
612 | this.$router.replace({ path: "/" }); | 639 | this.$router.replace({ path: "/" }); |
613 | this.$store.dispatch("setToken", null); | 640 | this.$store.dispatch("setToken", null); |
614 | this.$store.dispatch("Id", null); | 641 | this.$store.dispatch("Id", null); |
615 | } | 642 | } |
616 | }); | 643 | }); |
617 | }, | 644 | }, |
618 | print() { | 645 | print() { |
619 | // Pass the element id here | 646 | // Pass the element id here |
620 | this.$htmlToPaper("printMe"); | 647 | this.$htmlToPaper("printMe"); |
621 | }, | 648 | }, |
622 | getUserData() { | 649 | getUserData() { |
623 | http() | 650 | http() |
624 | .get("/getParticularUserDetail") | 651 | .get("/getParticularUserDetail") |
625 | .then(response => { | 652 | .then(response => { |
626 | this.userData = response.data.data; | 653 | this.userData = response.data.data; |
627 | }) | 654 | }) |
628 | .catch(error => { | 655 | .catch(error => { |
629 | // if (error.response.status === 401) { | 656 | // if (error.response.status === 401) { |
630 | // this.$router.replace({ path: "/" }); | 657 | // this.$router.replace({ path: "/" }); |
631 | // this.$store.dispatch("setToken", null); | 658 | // this.$store.dispatch("setToken", null); |
632 | // this.$store.dispatch("Id", null); | 659 | // this.$store.dispatch("Id", null); |
633 | // } | 660 | // } |
634 | }); | 661 | }); |
635 | }, | 662 | }, |
636 | selectMarkData(select) { | 663 | selectMarkData(select) { |
637 | if (select == "Mark") { | 664 | if (select == "Mark") { |
638 | this.showMark = true; | 665 | this.showMark = true; |
639 | this.showGrade = false; | 666 | this.showGrade = false; |
640 | } else if (select == "Grade") { | 667 | } else if (select == "Grade") { |
641 | this.showGrade = true; | 668 | this.showGrade = true; |
642 | this.showMark = false; | 669 | this.showMark = false; |
643 | } | 670 | } |
644 | } | 671 | } |
645 | } | 672 | } |
646 | }; | 673 | }; |
647 | </script> | 674 | </script> |
648 | 675 | ||
649 | <style scoped> | 676 | <style scoped> |
650 | .add-button { | 677 | .add-button { |
651 | background: #feb83c !important; | 678 | background: #feb83c !important; |
652 | border-color: #feb83c !important; | 679 | border-color: #feb83c !important; |
653 | text-transform: none !important; | 680 | text-transform: none !important; |
654 | -webkit-box-shadow: none !important; | 681 | -webkit-box-shadow: none !important; |
655 | box-shadow: none !important; | 682 | box-shadow: none !important; |
656 | } | 683 | } |
657 | .card-styles { | 684 | .card-styles { |
658 | background: #7f62f8 !important; | 685 | background: #7f62f8 !important; |
659 | border-color: #7f62f8 !important; | 686 | border-color: #7f62f8 !important; |
660 | } | 687 | } |
661 | .open-dialog-button { | 688 | .open-dialog-button { |
662 | background: #827bfa !important; | 689 | background: #827bfa !important; |
663 | border-color: #827bfa !important; | 690 | border-color: #827bfa !important; |
664 | text-transform: none !important; | 691 | text-transform: none !important; |
665 | } | 692 | } |
666 | /* table { | 693 | /* table { |
667 | border-collapse: collapse; | 694 | border-collapse: collapse; |
668 | border: 1px solid #e2e7eb; | 695 | border: 1px solid #e2e7eb; |
669 | } | 696 | } |
670 | th, | 697 | th, |
671 | td { | 698 | td { |
672 | border: 1px solid #e2e7eb; | 699 | border: 1px solid #e2e7eb; |
673 | text-align: center; | 700 | text-align: center; |
674 | } | 701 | } |
675 | table.feeTypeTable { | 702 | table.feeTypeTable { |
676 | table-layout: auto !important; | 703 | table-layout: auto !important; |
677 | width: 100% !important; | 704 | width: 100% !important; |
678 | } */ | 705 | } */ |
679 | .bg-sky { | 706 | .bg-sky { |
680 | background-color: #98b2cc !important; | 707 | background-color: #98b2cc !important; |
681 | } | 708 | } |
682 | .bg-sky-light { | 709 | .bg-sky-light { |
683 | background-color: #89a0b8; | 710 | background-color: #89a0b8; |
684 | } | 711 | } |
685 | .bg-purple { | 712 | .bg-purple { |
686 | background-color: #9583ac; | 713 | background-color: #9583ac; |
687 | } | 714 | } |
688 | .bg-skyDark { | 715 | .bg-skyDark { |
689 | background-color: #956785; | 716 | background-color: #956785; |
690 | } | 717 | } |
691 | .loader { | 718 | .loader { |
692 | width: 100%; | 719 | width: 100%; |
693 | height: 100%; | 720 | height: 100%; |
694 | position: fixed; | 721 | position: fixed; |
695 | top: 0; | 722 | top: 0; |
696 | left: 0; | 723 | left: 0; |
697 | text-align: center; | 724 | text-align: center; |
698 | background-color: rgba(0, 0, 0, 0.5); | 725 | background-color: rgba(0, 0, 0, 0.5); |
699 | z-index: 999; | 726 | z-index: 999; |
700 | } | 727 | } |
701 | /* .tr:nth-child(odd){background-color: #f2f2f2} */ | 728 | /* .tr:nth-child(odd){background-color: #f2f2f2} */ |
702 | 729 | ||
703 | .loader > div { | 730 | .loader > div { |
704 | position: relative; | 731 | position: relative; |
705 | top: calc(50% - 16px); | 732 | top: calc(50% - 16px); |
706 | } | 733 | } |
707 | @media screen and (max-width: 380px) { | 734 | @media screen and (max-width: 380px) { |
708 | .tableRsponsive { | 735 | .tableRsponsive { |
709 | /* display: block; */ | 736 | /* display: block; */ |
710 | position: relative; | 737 | position: relative; |
711 | overflow: scroll; | 738 | overflow: scroll; |
712 | } | 739 | } |
713 | } | 740 | } |
714 | </style> | 741 | </style> |
src/pages/Section/section.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <v-dialog v-model="editSectionDialog" max-width="460px"> | 3 | <v-dialog v-model="editSectionDialog" max-width="460px"> |
4 | <v-card flat class="card-style pa-2" dark> | 4 | <v-card flat class="card-style pa-2" dark> |
5 | <v-layout> | 5 | <v-layout> |
6 | <v-flex xs12> | 6 | <v-flex xs12> |
7 | <label class="title text-xs-center">Edit Section</label> | 7 | <label class="title text-xs-center">Edit Section</label> |
8 | <v-icon size="24" class="right" @click="editSectionDialog = false">cancel</v-icon> | 8 | <v-icon size="24" class="right" @click="editSectionDialog = false">cancel</v-icon> |
9 | </v-flex> | 9 | </v-flex> |
10 | </v-layout> | 10 | </v-layout> |
11 | <v-container fluid> | 11 | <v-container fluid> |
12 | <v-layout wrap justify-center> | 12 | <v-layout wrap justify-center> |
13 | <v-flex xs12 sm12> | 13 | <v-flex xs12 sm12> |
14 | <v-form> | 14 | <v-form> |
15 | <v-layout> | 15 | <v-layout> |
16 | <v-flex xs5 sm4 class="pt-4 subheading"> | 16 | <v-flex xs5 sm4 class="pt-4 subheading"> |
17 | <label class="right">Class :</label> | 17 | <label class="right">Class :</label> |
18 | </v-flex> | 18 | </v-flex> |
19 | <v-flex xs7 sm8> | 19 | <v-flex xs7 sm8> |
20 | <v-autocomplete | 20 | <v-autocomplete |
21 | :items="addclass" | 21 | :items="addclass" |
22 | :label="editedItem.classData.classNum" | 22 | :label="editedItem.classData.classNum" |
23 | v-model="editItem.classId" | 23 | v-model="editItem.classId" |
24 | item-text="classNum" | 24 | item-text="classNum" |
25 | item-value="_id" | 25 | item-value="_id" |
26 | class="ml-2" | 26 | class="ml-2" |
27 | ></v-autocomplete> | 27 | ></v-autocomplete> |
28 | </v-flex> | 28 | </v-flex> |
29 | </v-layout> | 29 | </v-layout> |
30 | <v-layout> | 30 | <v-layout> |
31 | <v-flex xs5 sm4 class="pt-4 subheading"> | 31 | <v-flex xs5 sm4 class="pt-4 subheading"> |
32 | <h5 class="right my-1 hidden-xs-only hidden-sm-only">Section Name :</h5> | 32 | <h5 class="right my-1 hidden-xs-only hidden-sm-only">Section Name :</h5> |
33 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Name :</h5> | 33 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Name :</h5> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs7 sm8> | 35 | <v-flex xs7 sm8> |
36 | <v-autocomplete | 36 | <v-autocomplete |
37 | v-model="editedItem.name" | 37 | v-model="editedItem.name" |
38 | placeholder="fill your Section Name" | 38 | placeholder="fill your Section Name" |
39 | :items="SectionName" | 39 | :items="SectionName" |
40 | class="ml-2" | 40 | class="ml-2" |
41 | ></v-autocomplete> | 41 | ></v-autocomplete> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs5 sm4 class="pt-4 subheading"> | 45 | <v-flex xs5 sm4 class="pt-4 subheading"> |
46 | <h5 class="right my-1 hidden-xs-only hidden-sm-only">Incharge :</h5> | 46 | <h5 class="right my-1 hidden-xs-only hidden-sm-only">Incharge :</h5> |
47 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Incharge :</h5> | 47 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only">Incharge :</h5> |
48 | </v-flex> | 48 | </v-flex> |
49 | <v-flex xs7 sm8> | 49 | <v-flex xs7 sm8> |
50 | <v-select | 50 | <v-select |
51 | :items="teacherList" | 51 | :items="teacherList" |
52 | v-model="editedItem.classInchargeId" | 52 | v-model="editedItem.classInchargeId" |
53 | :label="editedItem.teacherData[0].name" | 53 | :label="editedItem.teacherData[0].name" |
54 | item-text="name" | 54 | item-text="name" |
55 | item-value="_id" | 55 | item-value="_id" |
56 | class="ml-2" | 56 | class="ml-2" |
57 | ></v-select> | 57 | ></v-select> |
58 | </v-flex> | 58 | </v-flex> |
59 | </v-layout> | 59 | </v-layout> |
60 | <v-flex xs12> | 60 | <v-flex xs12> |
61 | <v-card-actions> | 61 | <v-card-actions> |
62 | <v-btn round dark @click.native="closeSectionDialog" class="add-button">Cancel</v-btn> | 62 | <v-btn round dark @click.native="closeSectionDialog" class="add-button">Cancel</v-btn> |
63 | <v-spacer></v-spacer> | 63 | <v-spacer></v-spacer> |
64 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 64 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
65 | </v-card-actions> | 65 | </v-card-actions> |
66 | </v-flex> | 66 | </v-flex> |
67 | </v-form> | 67 | </v-form> |
68 | </v-flex> | 68 | </v-flex> |
69 | </v-layout> | 69 | </v-layout> |
70 | </v-container> | 70 | </v-container> |
71 | </v-card> | 71 | </v-card> |
72 | </v-dialog> | 72 | </v-dialog> |
73 | 73 | ||
74 | <!-- ****** PROFILE VIEW SECTION DATA ****** --> | 74 | <!-- ****** PROFILE VIEW SECTION DATA ****** --> |
75 | 75 | ||
76 | <v-dialog v-model="viewSectionDialog" max-width="500px"> | 76 | <v-dialog v-model="viewSectionDialog" max-width="500px"> |
77 | <v-card flat class="card-style pa-3" dark> | 77 | <v-card flat class="card-style pa-3" dark> |
78 | <v-layout> | 78 | <v-layout> |
79 | <v-flex xs12> | 79 | <v-flex xs12> |
80 | <label class="title text-xs-center">View Section</label> | 80 | <label class="title text-xs-center">View Section</label> |
81 | <v-icon size="24" class="right" @click="viewSectionDialog = false">cancel</v-icon> | 81 | <v-icon size="24" class="right" @click="viewSectionDialog = false">cancel</v-icon> |
82 | </v-flex> | 82 | </v-flex> |
83 | </v-layout> | 83 | </v-layout> |
84 | <v-card-text> | 84 | <v-card-text> |
85 | <v-container grid-list-md> | 85 | <v-container grid-list-md> |
86 | <v-layout wrap> | 86 | <v-layout wrap> |
87 | <v-flex> | 87 | <v-flex> |
88 | <v-layout> | 88 | <v-layout> |
89 | <v-flex xs7 sm6> | 89 | <v-flex xs7 sm6> |
90 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> | 90 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> |
91 | <b>Class Name :</b> | 91 | <b>Class Name :</b> |
92 | </h5> | 92 | </h5> |
93 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only"> | 93 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only"> |
94 | <b>Class :</b> | 94 | <b>Class :</b> |
95 | </h5> | 95 | </h5> |
96 | </v-flex> | 96 | </v-flex> |
97 | <v-flex sm6 xs5> | 97 | <v-flex sm6 xs5> |
98 | <h5 class="my-1">{{ editedItem.classData.classNum }}</h5> | 98 | <h5 class="my-1">{{ editedItem.classData.classNum }}</h5> |
99 | </v-flex> | 99 | </v-flex> |
100 | </v-layout> | 100 | </v-layout> |
101 | <v-layout> | 101 | <v-layout> |
102 | <v-flex xs7 sm6> | 102 | <v-flex xs7 sm6> |
103 | <h5 class="right my-1"> | 103 | <h5 class="right my-1"> |
104 | <b>Section Name :</b> | 104 | <b>Section Name :</b> |
105 | </h5> | 105 | </h5> |
106 | </v-flex> | 106 | </v-flex> |
107 | <v-flex sm6 xs5> | 107 | <v-flex sm6 xs5> |
108 | <h5 class="my-1">{{ editedItem.name }}</h5> | 108 | <h5 class="my-1">{{ editedItem.name }}</h5> |
109 | </v-flex> | 109 | </v-flex> |
110 | </v-layout> | 110 | </v-layout> |
111 | <v-layout> | 111 | <v-layout> |
112 | <v-flex xs7 sm6> | 112 | <v-flex xs7 sm6> |
113 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> | 113 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> |
114 | <b>Class Incharge :</b> | 114 | <b>Class Incharge :</b> |
115 | </h5> | 115 | </h5> |
116 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only"> | 116 | <h5 class="right my-1 hidden-lg-only hidden-md-only hidden-xl-only"> |
117 | <b>Incharge :</b> | 117 | <b>Incharge :</b> |
118 | </h5> | 118 | </h5> |
119 | </v-flex> | 119 | </v-flex> |
120 | <v-flex sm6 xs5> | 120 | <v-flex sm6 xs5> |
121 | <h5 class="my-1">{{ editedItem.teacherData[0].name }}</h5> | 121 | <h5 class="my-1">{{ editedItem.teacherData[0].name }}</h5> |
122 | </v-flex> | 122 | </v-flex> |
123 | </v-layout> | 123 | </v-layout> |
124 | <v-layout> | 124 | <v-layout> |
125 | <v-flex xs7 sm6> | 125 | <v-flex xs7 sm6> |
126 | <h5 class="right my-1"> | 126 | <h5 class="right my-1"> |
127 | <b>Session :</b> | 127 | <b>Session :</b> |
128 | </h5> | 128 | </h5> |
129 | </v-flex> | 129 | </v-flex> |
130 | <v-flex sm6 xs5> | 130 | <v-flex sm6 xs5> |
131 | <h5 class="my-1">{{ editedItem.session }}</h5> | 131 | <h5 class="my-1">{{ editedItem.session }}</h5> |
132 | </v-flex> | 132 | </v-flex> |
133 | </v-layout> | 133 | </v-layout> |
134 | </v-flex> | 134 | </v-flex> |
135 | </v-layout> | 135 | </v-layout> |
136 | </v-container> | 136 | </v-container> |
137 | </v-card-text> | 137 | </v-card-text> |
138 | </v-card> | 138 | </v-card> |
139 | </v-dialog> | 139 | </v-dialog> |
140 | <!-- ****** Section Table ****** --> | 140 | <!-- ****** Section Table ****** --> |
141 | <v-toolbar color="transparent" flat> | 141 | <v-toolbar color="transparent" flat> |
142 | <v-btn | 142 | <v-btn |
143 | fab | 143 | fab |
144 | dark | 144 | dark |
145 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 145 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
146 | small | 146 | small |
147 | @click="addSectionDialog = true" | 147 | @click="addSectionDialog = true" |
148 | > | 148 | > |
149 | <v-icon dark>add</v-icon> | 149 | <v-icon dark>add</v-icon> |
150 | </v-btn> | 150 | </v-btn> |
151 | <v-btn | 151 | <v-btn |
152 | round | 152 | round |
153 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 153 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
154 | dark | 154 | dark |
155 | @click="addSectionDialog = true" | 155 | @click="addSectionDialog = true" |
156 | > | 156 | > |
157 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Section | 157 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Section |
158 | </v-btn> | 158 | </v-btn> |
159 | <v-spacer></v-spacer> | 159 | <v-spacer></v-spacer> |
160 | <v-card-title class="body-1" v-show="show"> | 160 | <v-card-title class="body-1" v-show="show"> |
161 | <v-btn icon large flat @click="displaySearch"> | 161 | <v-btn icon large flat @click="displaySearch"> |
162 | <v-avatar size="27"> | 162 | <v-avatar size="27"> |
163 | <img src="/static/icon/search.png" alt="icon" /> | 163 | <img src="/static/icon/search.png" alt="icon" /> |
164 | </v-avatar> | 164 | </v-avatar> |
165 | </v-btn> | 165 | </v-btn> |
166 | </v-card-title> | 166 | </v-card-title> |
167 | <v-flex xs8 v-show="showSearch"> | 167 | <v-flex xs8 v-show="showSearch"> |
168 | <v-layout> | 168 | <v-layout> |
169 | <v-text-field | 169 | <v-text-field |
170 | v-model="search" | 170 | v-model="search" |
171 | label="Search" | 171 | label="Search" |
172 | prepend-inner-icon="search" | 172 | prepend-inner-icon="search" |
173 | color="primary" | 173 | color="primary" |
174 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 174 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
175 | ></v-text-field> | 175 | ></v-text-field> |
176 | <v-icon @click="closeSearch" color="error">close</v-icon> | 176 | <v-icon @click="closeSearch" color="error">close</v-icon> |
177 | </v-layout> | 177 | </v-layout> |
178 | </v-flex> | 178 | </v-flex> |
179 | </v-toolbar> | 179 | </v-toolbar> |
180 | <v-data-table | 180 | <v-data-table |
181 | :headers="headers" | 181 | :headers="headers" |
182 | :items="sectionList" | 182 | :items="sectionList" |
183 | :pagination.sync="pagination" | 183 | :pagination.sync="pagination" |
184 | :search="search" | 184 | :search="search" |
185 | > | 185 | > |
186 | <template slot="items" slot-scope="props"> | 186 | <template slot="items" slot-scope="props"> |
187 | <tr class="tr"> | 187 | <tr class="tr"> |
188 | <td class="td td-row">{{ props.index + 1 }}</td> | 188 | <td class="td td-row">{{ props.index + 1 }}</td> |
189 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum }}</td> | 189 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum }}</td> |
190 | <td class="text-xs-center td td-row">{{ props.item.name }}</td> | 190 | <td class="text-xs-center td td-row">{{ props.item.name }}</td> |
191 | <td class="text-xs-center td td-row">{{ props.item.session }}</td> | 191 | <td class="text-xs-center td td-row">{{ props.item.session }}</td> |
192 | <td class="text-xs-center td td-row"> | 192 | <td class="text-xs-center td td-row"> |
193 | <span> | 193 | <span> |
194 | <v-tooltip top> | 194 | <v-tooltip top> |
195 | <img | 195 | <img |
196 | slot="activator" | 196 | slot="activator" |
197 | style="cursor:pointer; width:25px; height:25px;" | 197 | style="cursor:pointer; width:25px; height:25px;" |
198 | class="mr-3" | 198 | class="mr-3" |
199 | @click="profile(props.item)" | 199 | @click="profile(props.item)" |
200 | src="/static/icon/view.png" | 200 | src="/static/icon/view.png" |
201 | /> | 201 | /> |
202 | <span>View</span> | 202 | <span>View</span> |
203 | </v-tooltip> | 203 | </v-tooltip> |
204 | <v-tooltip top> | 204 | <v-tooltip top> |
205 | <img | 205 | <img |
206 | slot="activator" | 206 | slot="activator" |
207 | style="cursor:pointer; width:20px; height:18px; " | 207 | style="cursor:pointer; width:20px; height:18px; " |
208 | class="mr-3" | 208 | class="mr-3" |
209 | @click="editItem(props.item)" | 209 | @click="editItem(props.item)" |
210 | src="/static/icon/edit.png" | 210 | src="/static/icon/edit.png" |
211 | /> | 211 | /> |
212 | <span>Edit</span> | 212 | <span>Edit</span> |
213 | </v-tooltip> | 213 | </v-tooltip> |
214 | <v-tooltip top> | 214 | <!-- <v-tooltip top> |
215 | <img | 215 | <img |
216 | slot="activator" | 216 | slot="activator" |
217 | style="cursor:pointer; width:20px; height:20px; " | 217 | style="cursor:pointer; width:20px; height:20px; " |
218 | @click="deleteItem(props.item)" | 218 | @click="deleteItem(props.item)" |
219 | src="/static/icon/delete.png" | 219 | src="/static/icon/delete.png" |
220 | class="mr-3" | 220 | class="mr-3" |
221 | /> | 221 | /> |
222 | <span>Delete</span> | 222 | <span>Delete</span> |
223 | </v-tooltip> | 223 | </v-tooltip> --> |
224 | </span> | 224 | </span> |
225 | </td> | 225 | </td> |
226 | </tr> | 226 | </tr> |
227 | </template> | 227 | </template> |
228 | <v-alert | 228 | <v-alert |
229 | slot="no-results" | 229 | slot="no-results" |
230 | :value="true" | 230 | :value="true" |
231 | color="error" | 231 | color="error" |
232 | icon="warning" | 232 | icon="warning" |
233 | >Your search for "{{ search }}" found no results.</v-alert> | 233 | >Your search for "{{ search }}" found no results.</v-alert> |
234 | </v-data-table> | 234 | </v-data-table> |
235 | <!-- </v-tab-item> --> | 235 | <!-- </v-tab-item> --> |
236 | 236 | ||
237 | <!-- ****** ADD Students Dialog box****** --> | 237 | <!-- ****** ADD Students Dialog box****** --> |
238 | <v-dialog v-model="addSectionDialog" max-width="400px"> | 238 | <v-dialog v-model="addSectionDialog" max-width="400px"> |
239 | <v-card flat class="card-style pa-2" dark> | 239 | <v-card flat class="card-style pa-2" dark> |
240 | <v-layout> | 240 | <v-layout> |
241 | <v-flex xs12> | 241 | <v-flex xs12> |
242 | <label class="title text-xs-center">Add Section</label> | 242 | <label class="title text-xs-center">Add Section</label> |
243 | <v-icon size="24" class="right" @click="addSectionDialog = false">cancel</v-icon> | 243 | <v-icon size="24" class="right" @click="addSectionDialog = false">cancel</v-icon> |
244 | </v-flex> | 244 | </v-flex> |
245 | </v-layout> | 245 | </v-layout> |
246 | <v-container fluid fill-height> | 246 | <v-container fluid fill-height> |
247 | <v-layout align-center> | 247 | <v-layout align-center> |
248 | <v-flex xs12> | 248 | <v-flex xs12> |
249 | <v-form ref="form" v-model="valid" lazy-validation> | 249 | <v-form ref="form" v-model="valid" lazy-validation> |
250 | <v-layout> | 250 | <v-layout> |
251 | <v-flex xs4 class="pt-4 subheading"> | 251 | <v-flex xs4 class="pt-4 subheading"> |
252 | <label class="right">Section :</label> | 252 | <label class="right">Section :</label> |
253 | </v-flex> | 253 | </v-flex> |
254 | <v-flex xs8 class="ml-3"> | 254 | <v-flex xs8 class="ml-3"> |
255 | <v-autocomplete | 255 | <v-autocomplete |
256 | v-model="sectionData.name" | 256 | v-model="sectionData.name" |
257 | placeholder="fill your Section Name" | 257 | placeholder="fill your Section Name" |
258 | :items="SectionName" | 258 | :items="SectionName" |
259 | :rules="nameRules" | 259 | :rules="nameRules" |
260 | required | 260 | required |
261 | ></v-autocomplete> | 261 | ></v-autocomplete> |
262 | </v-flex> | 262 | </v-flex> |
263 | </v-layout> | 263 | </v-layout> |
264 | <v-layout> | 264 | <v-layout> |
265 | <v-flex xs4 class="pt-4 subheading"> | 265 | <v-flex xs4 class="pt-4 subheading"> |
266 | <label class="right">Class :</label> | 266 | <label class="right">Class :</label> |
267 | </v-flex> | 267 | </v-flex> |
268 | <v-flex xs8 class="ml-3"> | 268 | <v-flex xs8 class="ml-3"> |
269 | <v-select | 269 | <v-select |
270 | :items="addclass" | 270 | :items="addclass" |
271 | label="Select Class" | 271 | label="Select Class" |
272 | v-model="sectionData.classNum" | 272 | v-model="sectionData.classNum" |
273 | item-text="classNum" | 273 | item-text="classNum" |
274 | item-value="_id" | 274 | item-value="_id" |
275 | name="Select Class" | 275 | name="Select Class" |
276 | :rules="classRules" | 276 | :rules="classRules" |
277 | required | 277 | required |
278 | ></v-select> | 278 | ></v-select> |
279 | </v-flex> | 279 | </v-flex> |
280 | </v-layout> | 280 | </v-layout> |
281 | <v-layout> | 281 | <v-layout> |
282 | <v-flex xs4 class="pt-4 subheading"> | 282 | <v-flex xs4 class="pt-4 subheading"> |
283 | <label class="right">Incharge :</label> | 283 | <label class="right">Incharge :</label> |
284 | </v-flex> | 284 | </v-flex> |
285 | <v-flex xs8 class="ml-3"> | 285 | <v-flex xs8 class="ml-3"> |
286 | <v-select | 286 | <v-select |
287 | :items="teacherList" | 287 | :items="teacherList" |
288 | label="Select Incharge" | 288 | label="Select Incharge" |
289 | v-model="sectionData.sectionId" | 289 | v-model="sectionData.sectionId" |
290 | item-text="name" | 290 | item-text="name" |
291 | item-value="_id" | 291 | item-value="_id" |
292 | name="Select Class" | 292 | name="Select Class" |
293 | :rules="inchargeRules" | 293 | :rules="inchargeRules" |
294 | required | 294 | required |
295 | ></v-select> | 295 | ></v-select> |
296 | </v-flex> | 296 | </v-flex> |
297 | </v-layout> | 297 | </v-layout> |
298 | <v-layout> | 298 | <v-layout> |
299 | <v-flex xs4 class="pt-4 subheading"> | 299 | <v-flex xs4 class="pt-4 subheading"> |
300 | <label class="right">Session:</label> | 300 | <label class="right">Session:</label> |
301 | </v-flex> | 301 | </v-flex> |
302 | <v-flex xs8 class="ml-3"> | 302 | <v-flex xs8 class="ml-3"> |
303 | <v-text-field | 303 | <v-text-field |
304 | v-model="sectionData.session" | 304 | v-model="sectionData.session" |
305 | placeholder="fill your Session" | 305 | placeholder="fill your Session" |
306 | name="name" | 306 | name="name" |
307 | type="text" | 307 | type="text" |
308 | :rules="sessionRules" | 308 | :rules="sessionRules" |
309 | required | 309 | required |
310 | ></v-text-field> | 310 | ></v-text-field> |
311 | </v-flex> | 311 | </v-flex> |
312 | </v-layout> | 312 | </v-layout> |
313 | <v-layout> | 313 | <v-layout> |
314 | <v-flex xs12 sm12> | 314 | <v-flex xs12 sm12> |
315 | <v-card-actions> | 315 | <v-card-actions> |
316 | <v-btn @click="clear" class="add-button" round dark>Clear</v-btn> | 316 | <v-btn @click="clear" class="add-button" round dark>Clear</v-btn> |
317 | <v-spacer></v-spacer> | 317 | <v-spacer></v-spacer> |
318 | <v-btn @click="submit" class="add-button" round dark :loading="loading">Add</v-btn> | 318 | <v-btn @click="submit" class="add-button" round dark :loading="loading">Add</v-btn> |
319 | </v-card-actions> | 319 | </v-card-actions> |
320 | </v-flex> | 320 | </v-flex> |
321 | </v-layout> | 321 | </v-layout> |
322 | </v-form> | 322 | </v-form> |
323 | </v-flex> | 323 | </v-flex> |
324 | </v-layout> | 324 | </v-layout> |
325 | </v-container> | 325 | </v-container> |
326 | </v-card> | 326 | </v-card> |
327 | </v-dialog> | 327 | </v-dialog> |
328 | <v-snackbar | 328 | <v-snackbar |
329 | :timeout="timeout" | 329 | :timeout="timeout" |
330 | :top="y === 'top'" | 330 | :top="y === 'top'" |
331 | :right="x === 'right'" | 331 | :right="x === 'right'" |
332 | :vertical="mode === 'vertical'" | 332 | :vertical="mode === 'vertical'" |
333 | v-model="snackbar" | 333 | v-model="snackbar" |
334 | :color="color" | 334 | :color="color" |
335 | >{{ text }}</v-snackbar> | 335 | >{{ text }}</v-snackbar> |
336 | <div class="loader" v-if="showLoader"> | 336 | <div class="loader" v-if="showLoader"> |
337 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 337 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
338 | </div> | 338 | </div> |
339 | </v-container> | 339 | </v-container> |
340 | </template> | 340 | </template> |
341 | 341 | ||
342 | <script> | 342 | <script> |
343 | import http from "@/Services/http.js"; | 343 | import http from "@/Services/http.js"; |
344 | // import { apiCollection } from "@/schoolApi/apiCollection"; | 344 | // import { apiCollection } from "@/schoolApi/apiCollection"; |
345 | // const getSectionData = apiCollection.get("posts"); | 345 | // const getSectionData = apiCollection.get("posts"); |
346 | 346 | ||
347 | export default { | 347 | export default { |
348 | data: () => ({ | 348 | data: () => ({ |
349 | snackbar: false, | 349 | snackbar: false, |
350 | y: "top", | 350 | y: "top", |
351 | x: "right", | 351 | x: "right", |
352 | mode: "", | 352 | mode: "", |
353 | timeout: 5000, | 353 | timeout: 5000, |
354 | text: "", | 354 | text: "", |
355 | color: "", | 355 | color: "", |
356 | show: true, | 356 | show: true, |
357 | showSearch: false, | 357 | showSearch: false, |
358 | showLoader: false, | 358 | showLoader: false, |
359 | loading: false, | 359 | loading: false, |
360 | date: null, | 360 | date: null, |
361 | search: "", | 361 | search: "", |
362 | editSectionDialog: false, | 362 | editSectionDialog: false, |
363 | viewSectionDialog: false, | 363 | viewSectionDialog: false, |
364 | valid: true, | 364 | valid: true, |
365 | validEdit: true, | 365 | validEdit: true, |
366 | addSectionDialog: false, | 366 | addSectionDialog: false, |
367 | editLoading: false, | 367 | editLoading: false, |
368 | details: [], | 368 | details: [], |
369 | pagination: { | 369 | pagination: { |
370 | rowsPerPage: 10 | 370 | rowsPerPage: 10 |
371 | }, | 371 | }, |
372 | nameRules: [v => !!v || " Section Name is required"], | 372 | nameRules: [v => !!v || " Section Name is required"], |
373 | classRules: [v => !!v || " Class Name is required"], | 373 | classRules: [v => !!v || " Class Name is required"], |
374 | sessionRules: [v => !!v || " Session is required"], | 374 | sessionRules: [v => !!v || " Session is required"], |
375 | inchargeRules: [v => !!v || " Incharge Name is required"], | 375 | inchargeRules: [v => !!v || " Incharge Name is required"], |
376 | SectionName: ["A", "B", "C", "D", "E", "F"], | 376 | SectionName: ["A", "B", "C", "D", "E", "F"], |
377 | headers: [ | 377 | headers: [ |
378 | { | 378 | { |
379 | text: "No", | 379 | text: "No", |
380 | align: "", | 380 | align: "", |
381 | sortable: false, | 381 | sortable: false, |
382 | value: "No" | 382 | value: "No" |
383 | }, | 383 | }, |
384 | { | 384 | { |
385 | text: "Class Name", | 385 | text: "Class Name", |
386 | value: "classData.classNum", | 386 | value: "classData.classNum", |
387 | sortable: false, | 387 | sortable: false, |
388 | align: "center" | 388 | align: "center" |
389 | }, | 389 | }, |
390 | { text: "Section Name", value: "name", sortable: false, align: "center" }, | 390 | { text: "Section Name", value: "name", sortable: false, align: "center" }, |
391 | { text: "Session", value: "session", sortable: false, align: "center" }, | 391 | { text: "Session", value: "session", sortable: false, align: "center" }, |
392 | { text: "Action", value: "", sortable: false, align: "center" } | 392 | { text: "Action", value: "", sortable: false, align: "center" } |
393 | ], | 393 | ], |
394 | sectionList: [], | 394 | sectionList: [], |
395 | addclass: [], | 395 | addclass: [], |
396 | teacherList: [], | 396 | teacherList: [], |
397 | select: "", | 397 | select: "", |
398 | selectId: "", | 398 | selectId: "", |
399 | token: "", | 399 | token: "", |
400 | editedIndex: -1, | 400 | editedIndex: -1, |
401 | editedItem: { | 401 | editedItem: { |
402 | classData: { | 402 | classData: { |
403 | classNum: "" | 403 | classNum: "" |
404 | }, | 404 | }, |
405 | teacherData: [ | 405 | teacherData: [ |
406 | { | 406 | { |
407 | name: "" | 407 | name: "" |
408 | } | 408 | } |
409 | ] | 409 | ] |
410 | // name: "", | 410 | // name: "", |
411 | // session: new Date().getFullYear() | 411 | // session: new Date().getFullYear() |
412 | }, | 412 | }, |
413 | sectionData: { | 413 | sectionData: { |
414 | session: new Date().getFullYear() | 414 | session: new Date().getFullYear() |
415 | } | 415 | } |
416 | }), | 416 | }), |
417 | methods: { | 417 | methods: { |
418 | getSectionList() { | 418 | getSectionList() { |
419 | // const { data } = await getSectionData.get(); | 419 | // const { data } = await getSectionData.get(); |
420 | this.showLoader = true; | 420 | this.showLoader = true; |
421 | http() | 421 | http() |
422 | .get("/getAllSections", { | 422 | .get("/getAllSections", { |
423 | headers: { Authorization: "Bearer " + this.token } | 423 | headers: { Authorization: "Bearer " + this.token } |
424 | }) | 424 | }) |
425 | .then(response => { | 425 | .then(response => { |
426 | this.sectionList = response.data.data; | 426 | this.sectionList = response.data.data; |
427 | this.showLoader = false; | 427 | this.showLoader = false; |
428 | // console.log("getAllSections=====>",response.data.data) | 428 | // console.log("getAllSections=====>",response.data.data) |
429 | }) | 429 | }) |
430 | .catch(error => { | 430 | .catch(error => { |
431 | this.showLoader = false; | 431 | this.showLoader = false; |
432 | if (error.response.status === 401) { | 432 | if (error.response.status === 401) { |
433 | this.$router.replace({ path: "/" }); | 433 | this.$router.replace({ path: "/" }); |
434 | this.$store.dispatch("setToken", null); | 434 | this.$store.dispatch("setToken", null); |
435 | this.$store.dispatch("Id", null); | 435 | this.$store.dispatch("Id", null); |
436 | } | 436 | } |
437 | }); | 437 | }); |
438 | }, | 438 | }, |
439 | editItem(item) { | 439 | editItem(item) { |
440 | this.editedIndex = this.sectionList.indexOf(item); | 440 | this.editedIndex = this.sectionList.indexOf(item); |
441 | this.editedItem = Object.assign({}, item); | 441 | this.editedItem = Object.assign({}, item); |
442 | this.editSectionDialog = true; | 442 | this.editSectionDialog = true; |
443 | }, | 443 | }, |
444 | profile(item) { | 444 | profile(item) { |
445 | this.editedIndex = this.sectionList.indexOf(item); | 445 | this.editedIndex = this.sectionList.indexOf(item); |
446 | this.editedItem = Object.assign({}, item); | 446 | this.editedItem = Object.assign({}, item); |
447 | this.viewSectionDialog = true; | 447 | this.viewSectionDialog = true; |
448 | }, | 448 | }, |
449 | deleteItem(item) { | 449 | deleteItem(item) { |
450 | let deleteStudent = { | 450 | let deleteStudent = { |
451 | sectionId: item._id | 451 | sectionId: item._id |
452 | }; | 452 | }; |
453 | http() | 453 | http() |
454 | .delete( | 454 | .delete( |
455 | "/deleteSection", | 455 | "/deleteSection", |
456 | confirm("Are you sure you want to delete this?") && { | 456 | confirm("Are you sure you want to delete this?") && { |
457 | params: deleteStudent | 457 | params: deleteStudent |
458 | } | 458 | } |
459 | ) | 459 | ) |
460 | .then(response => { | 460 | .then(response => { |
461 | this.snackbar = true; | 461 | this.snackbar = true; |
462 | this.text = response.data.message; | 462 | this.text = response.data.message; |
463 | this.color = "green"; | 463 | this.color = "green"; |
464 | this.getSectionList(); | 464 | this.getSectionList(); |
465 | }) | 465 | }) |
466 | .catch(error => { | 466 | .catch(error => { |
467 | this.snackbar = true; | 467 | this.snackbar = true; |
468 | this.text = error.response.data.message; | 468 | this.text = error.response.data.message; |
469 | this.color = "green"; | 469 | this.color = "green"; |
470 | }); | 470 | }); |
471 | }, | 471 | }, |
472 | closeSectionDialog() { | 472 | closeSectionDialog() { |
473 | this.editSectionDialog = false; | 473 | this.editSectionDialog = false; |
474 | }, | 474 | }, |
475 | closeviewSectionDialog() { | 475 | closeviewSectionDialog() { |
476 | this.viewSectionDialog = false; | 476 | this.viewSectionDialog = false; |
477 | }, | 477 | }, |
478 | submit() { | 478 | submit() { |
479 | if (this.$refs.form.validate()) { | 479 | if (this.$refs.form.validate()) { |
480 | let addSection = { | 480 | let addSection = { |
481 | name: this.sectionData.name, | 481 | name: this.sectionData.name, |
482 | classId: this.sectionData.classNum, | 482 | classId: this.sectionData.classNum, |
483 | session: this.sectionData.session, | 483 | session: this.sectionData.session, |
484 | classInchargeId: this.sectionData.sectionId | 484 | classInchargeId: this.sectionData.sectionId |
485 | }; | 485 | }; |
486 | this.loading = true; | 486 | this.loading = true; |
487 | http() | 487 | http() |
488 | .post("/createSection", addSection) | 488 | .post("/createSection", addSection) |
489 | .then(response => { | 489 | .then(response => { |
490 | this.getSectionList(); | 490 | this.getSectionList(); |
491 | this.snackbar = true; | 491 | this.snackbar = true; |
492 | this.color = "green"; | 492 | this.color = "green"; |
493 | this.text = "New Section added successfully"; | 493 | this.text = "New Section added successfully"; |
494 | this.clear(); | 494 | this.clear(); |
495 | this.addSectionDialog = false; | 495 | this.addSectionDialog = false; |
496 | this.loading = false; | 496 | this.loading = false; |
497 | }) | 497 | }) |
498 | .catch(error => { | 498 | .catch(error => { |
499 | this.snackbar = true; | 499 | this.snackbar = true; |
500 | this.color = "error"; | 500 | this.color = "error"; |
501 | this.text = error.response.data.message; | 501 | this.text = error.response.data.message; |
502 | this.loading = false; | 502 | this.loading = false; |
503 | }); | 503 | }); |
504 | } | 504 | } |
505 | }, | 505 | }, |
506 | clear() { | 506 | clear() { |
507 | this.$refs.form.reset(); | 507 | this.$refs.form.reset(); |
508 | }, | 508 | }, |
509 | save() { | 509 | save() { |
510 | this.editedItem.sectionId = this.editedItem._id; | 510 | this.editedItem.sectionId = this.editedItem._id; |
511 | this.editLoading = true; | 511 | this.editLoading = true; |
512 | http() | 512 | http() |
513 | .put("/updateSection", this.editedItem) | 513 | .put("/updateSection", this.editedItem) |
514 | .then(response => { | 514 | .then(response => { |
515 | this.editLoading = false; | 515 | this.editLoading = false; |
516 | this.snackbar = true; | 516 | this.snackbar = true; |
517 | this.color = "green"; | 517 | this.color = "green"; |
518 | this.text = response.data.message; | 518 | this.text = response.data.message; |
519 | this.getSectionList(); | 519 | this.getSectionList(); |
520 | this.closeSectionDialog(); | 520 | this.closeSectionDialog(); |
521 | }) | 521 | }) |
522 | .catch(error => { | 522 | .catch(error => { |
523 | this.editLoading = false; | 523 | this.editLoading = false; |
524 | this.snackbar = true; | 524 | this.snackbar = true; |
525 | this.color = "error"; | 525 | this.color = "error"; |
526 | this.text = error.response.data.message; | 526 | this.text = error.response.data.message; |
527 | }); | 527 | }); |
528 | }, | 528 | }, |
529 | getAllTeacher() { | 529 | getAllTeacher() { |
530 | http() | 530 | http() |
531 | .get("/getTeachersList", { | 531 | .get("/getTeachersList", { |
532 | headers: { Authorization: "Bearer " + this.token } | 532 | headers: { Authorization: "Bearer " + this.token } |
533 | }) | 533 | }) |
534 | .then(response => { | 534 | .then(response => { |
535 | this.teacherList = response.data.data; | 535 | this.teacherList = response.data.data; |
536 | this.showLoader = false; | 536 | this.showLoader = false; |
537 | }) | 537 | }) |
538 | .catch(err => { | 538 | .catch(err => { |
539 | // console.log("err====>", err); | 539 | // console.log("err====>", err); |
540 | this.showLoader = false; | 540 | this.showLoader = false; |
541 | }); | 541 | }); |
542 | }, | 542 | }, |
543 | getAllClasses() { | 543 | getAllClasses() { |
544 | http() | 544 | http() |
545 | .get("/getClassesList", { | 545 | .get("/getClassesList", { |
546 | headers: { Authorization: "Bearer " + this.token } | 546 | headers: { Authorization: "Bearer " + this.token } |
547 | }) | 547 | }) |
548 | .then(response => { | 548 | .then(response => { |
549 | this.addclass = response.data.data; | 549 | this.addclass = response.data.data; |
550 | }) | 550 | }) |
551 | .catch(err => { | 551 | .catch(err => { |
552 | // console.log("err====>", err); | 552 | // console.log("err====>", err); |
553 | // this.$router.replace({ path: "/" }); | 553 | // this.$router.replace({ path: "/" }); |
554 | }); | 554 | }); |
555 | }, | 555 | }, |
556 | displaySearch() { | 556 | displaySearch() { |
557 | (this.show = false), (this.showSearch = true); | 557 | (this.show = false), (this.showSearch = true); |
558 | }, | 558 | }, |
559 | closeSearch() { | 559 | closeSearch() { |
560 | this.showSearch = false; | 560 | this.showSearch = false; |
561 | this.show = true; | 561 | this.show = true; |
562 | this.search = ""; | 562 | this.search = ""; |
563 | } | 563 | } |
564 | }, | 564 | }, |
565 | mounted() { | 565 | mounted() { |
566 | this.token = this.$store.state.token; | 566 | this.token = this.$store.state.token; |
567 | this.getSectionList(); | 567 | this.getSectionList(); |
568 | this.getAllClasses(); | 568 | this.getAllClasses(); |
569 | this.getAllTeacher(); | 569 | this.getAllTeacher(); |
570 | } | 570 | } |
571 | }; | 571 | }; |
572 | </script> | 572 | </script> |
573 | 573 |
src/pages/meetingEvent/meetingEvent.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS EVENT ****** --> | 3 | <!-- ****** EDITS EVENT ****** --> |
4 | <v-dialog v-model="editEventdialog" max-width="500px"> | 4 | <v-dialog v-model="editEventdialog" max-width="500px"> |
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 Meeting Event</label> | 8 | <label class="title text-xs-center">Edit Meeting Event</label> |
9 | <v-icon size="24" class="right" @click="editEventdialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editEventdialog = 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-flex xs12 sm12> | 13 | <v-flex xs12 sm12> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs4 class="pt-4 subheading"> | 15 | <v-flex xs4 class="pt-4 subheading"> |
16 | <label class="right">Title:</label> | 16 | <label class="right">Title:</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs7 class="ml-3"> | 18 | <v-flex xs7 class="ml-3"> |
19 | <v-text-field v-model="editedItem.title" type="text"></v-text-field> | 19 | <v-text-field v-model="editedItem.title" type="text"></v-text-field> |
20 | </v-flex> | 20 | </v-flex> |
21 | </v-layout> | 21 | </v-layout> |
22 | </v-flex> | 22 | </v-flex> |
23 | <v-flex xs12 sm12> | 23 | <v-flex xs12 sm12> |
24 | <v-layout> | 24 | <v-layout> |
25 | <v-flex xs4 class="pt-4 subheading"> | 25 | <v-flex xs4 class="pt-4 subheading"> |
26 | <label class="right">Date:</label> | 26 | <label class="right">Date:</label> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs7 class="ml-3"> | 28 | <v-flex xs7 class="ml-3"> |
29 | <v-menu | 29 | <v-menu |
30 | ref="menu" | 30 | ref="menu" |
31 | :close-on-content-click="false" | 31 | :close-on-content-click="false" |
32 | v-model="menuEditDate" | 32 | v-model="menuEditDate" |
33 | :nudge-right="40" | 33 | :nudge-right="40" |
34 | lazy | 34 | lazy |
35 | transition="scale-transition" | 35 | transition="scale-transition" |
36 | offset-y | 36 | offset-y |
37 | full-width | 37 | full-width |
38 | min-width="290px" | 38 | min-width="290px" |
39 | > | 39 | > |
40 | <v-text-field | 40 | <v-text-field |
41 | slot="activator" | 41 | slot="activator" |
42 | v-model="editedItem.dateOfEvent" | 42 | v-model="editedItem.dateOfEvent" |
43 | placeholder="Select date" | 43 | placeholder="Select date" |
44 | ></v-text-field> | 44 | ></v-text-field> |
45 | <v-date-picker | 45 | <v-date-picker |
46 | color="info" | 46 | color="info" |
47 | ref="picker" | 47 | ref="picker" |
48 | v-model="editedItem.dateOfEvent" | 48 | v-model="editedItem.dateOfEvent" |
49 | @input="$refs.menu.save(editedItem.dateOfEvent)" | 49 | @input="$refs.menu.save(editedItem.dateOfEvent)" |
50 | ></v-date-picker> | 50 | ></v-date-picker> |
51 | </v-menu> | 51 | </v-menu> |
52 | </v-flex> | 52 | </v-flex> |
53 | </v-layout> | 53 | </v-layout> |
54 | </v-flex> | 54 | </v-flex> |
55 | <v-flex xs12 sm12> | 55 | <v-flex xs12 sm12> |
56 | <v-layout> | 56 | <v-layout> |
57 | <v-flex xs4 class="pt-4 subheading"> | 57 | <v-flex xs4 class="pt-4 subheading"> |
58 | <label class="right">Start Time:</label> | 58 | <label class="right">Start Time:</label> |
59 | </v-flex> | 59 | </v-flex> |
60 | <v-flex xs7 class="ml-3"> | 60 | <v-flex xs7 class="ml-3"> |
61 | <v-menu | 61 | <v-menu |
62 | ref="menuEdit" | 62 | ref="menuEdit" |
63 | :close-on-content-click="false" | 63 | :close-on-content-click="false" |
64 | v-model="menuEditTime" | 64 | v-model="menuEditTime" |
65 | :nudge-right="40" | 65 | :nudge-right="40" |
66 | :return-value.sync="editedItem.startTime" | 66 | :return-value.sync="editedItem.startTime" |
67 | lazy | 67 | lazy |
68 | transition="scale-transition" | 68 | transition="scale-transition" |
69 | offset-y | 69 | offset-y |
70 | full-width | 70 | full-width |
71 | max-width="290px" | 71 | max-width="290px" |
72 | min-width="290px" | 72 | min-width="290px" |
73 | > | 73 | > |
74 | <v-text-field | 74 | <v-text-field |
75 | slot="activator" | 75 | slot="activator" |
76 | v-model="editedItem.startTime" | 76 | v-model="editedItem.startTime" |
77 | append-icon="access_time" | 77 | append-icon="access_time" |
78 | readonly | 78 | readonly |
79 | ></v-text-field> | 79 | ></v-text-field> |
80 | <v-time-picker | 80 | <v-time-picker |
81 | v-model="editedItem.startTime" | 81 | v-model="editedItem.startTime" |
82 | format="24hr" | 82 | format="24hr" |
83 | @change="$refs.menuEdit.save(editedItem.startTime)" | 83 | @change="$refs.menuEdit.save(editedItem.startTime)" |
84 | ></v-time-picker> | 84 | ></v-time-picker> |
85 | </v-menu> | 85 | </v-menu> |
86 | </v-flex> | 86 | </v-flex> |
87 | </v-layout> | 87 | </v-layout> |
88 | </v-flex> | 88 | </v-flex> |
89 | <v-flex xs12 sm12> | 89 | <v-flex xs12 sm12> |
90 | <v-layout> | 90 | <v-layout> |
91 | <v-flex xs4 class="pt-4 subheading"> | 91 | <v-flex xs4 class="pt-4 subheading"> |
92 | <label class="right">Duration:</label> | 92 | <label class="right">Duration:</label> |
93 | </v-flex> | 93 | </v-flex> |
94 | <v-flex xs7 class="ml-3"> | 94 | <v-flex xs7 class="ml-3"> |
95 | <v-text-field v-model="editedItem.duration" type="text"></v-text-field> | 95 | <v-text-field v-model="editedItem.duration" type="text"></v-text-field> |
96 | </v-flex> | 96 | </v-flex> |
97 | </v-layout> | 97 | </v-layout> |
98 | </v-flex> | 98 | </v-flex> |
99 | <v-layout> | 99 | <v-layout> |
100 | <v-flex xs12> | 100 | <v-flex xs12> |
101 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 101 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
102 | <v-spacer></v-spacer> | 102 | <v-spacer></v-spacer> |
103 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 103 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
104 | </v-card-actions> | 104 | </v-card-actions> |
105 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 105 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
106 | <v-spacer></v-spacer> | 106 | <v-spacer></v-spacer> |
107 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 107 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
108 | <v-spacer></v-spacer> | 108 | <v-spacer></v-spacer> |
109 | </v-card-actions> | 109 | </v-card-actions> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | </v-container> | 112 | </v-container> |
113 | </v-card> | 113 | </v-card> |
114 | </v-dialog> | 114 | </v-dialog> |
115 | <!-- ****** PROFILE VIEW EVENT ****** --> | 115 | <!-- ****** PROFILE VIEW EVENT ****** --> |
116 | <v-dialog v-model="viewEventdialog" max-width="500px"> | 116 | <v-dialog v-model="viewEventdialog" max-width="500px"> |
117 | <v-card flat class="card-style pa-3" dark> | 117 | <v-card flat class="card-style pa-3" dark> |
118 | <v-layout> | 118 | <v-layout> |
119 | <v-flex xs12> | 119 | <v-flex xs12> |
120 | <label class="title text-xs-center">View Meeting Event</label> | 120 | <label class="title text-xs-center">View Meeting Event</label> |
121 | <v-icon size="24" class="right" @click="viewEventdialog = false">cancel</v-icon> | 121 | <v-icon size="24" class="right" @click="viewEventdialog = false">cancel</v-icon> |
122 | </v-flex> | 122 | </v-flex> |
123 | </v-layout> | 123 | </v-layout> |
124 | <v-card-text> | 124 | <v-card-text> |
125 | <v-container grid-list-md> | 125 | <v-container grid-list-md> |
126 | <v-layout wrap> | 126 | <v-layout wrap> |
127 | <v-flex> | 127 | <v-flex> |
128 | <v-layout> | 128 | <v-layout> |
129 | <v-flex xs4 sm6> | 129 | <v-flex xs4 sm6> |
130 | <h5 class="right my-1"> | 130 | <h5 class="right my-1"> |
131 | <b>Title:</b> | 131 | <b>Title:</b> |
132 | </h5> | 132 | </h5> |
133 | </v-flex> | 133 | </v-flex> |
134 | <v-flex sm6 xs8> | 134 | <v-flex sm6 xs8> |
135 | <h5 class="my-1">{{ editedItem.title }}</h5> | 135 | <h5 class="my-1">{{ editedItem.title }}</h5> |
136 | </v-flex> | 136 | </v-flex> |
137 | </v-layout> | 137 | </v-layout> |
138 | <v-layout> | 138 | <v-layout> |
139 | <v-flex xs4 sm6> | 139 | <v-flex xs4 sm6> |
140 | <h5 class="right my-1"> | 140 | <h5 class="right my-1"> |
141 | <b>Date:</b> | 141 | <b>Date:</b> |
142 | </h5> | 142 | </h5> |
143 | </v-flex> | 143 | </v-flex> |
144 | <v-flex sm6 xs8> | 144 | <v-flex sm6 xs8> |
145 | <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5> | 145 | <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5> |
146 | </v-flex> | 146 | </v-flex> |
147 | </v-layout> | 147 | </v-layout> |
148 | <v-layout> | 148 | <v-layout> |
149 | <v-flex xs4 sm6> | 149 | <v-flex xs4 sm6> |
150 | <h5 class="right my-1"> | 150 | <h5 class="right my-1"> |
151 | <b>Start Time:</b> | 151 | <b>Start Time:</b> |
152 | </h5> | 152 | </h5> |
153 | </v-flex> | 153 | </v-flex> |
154 | <v-flex sm6 xs8> | 154 | <v-flex sm6 xs8> |
155 | <h5 class="my-1">{{ editedItem.startTime }}</h5> | 155 | <h5 class="my-1">{{ editedItem.startTime }}</h5> |
156 | </v-flex> | 156 | </v-flex> |
157 | </v-layout> | 157 | </v-layout> |
158 | <v-layout> | 158 | <v-layout> |
159 | <v-flex xs4 sm6> | 159 | <v-flex xs4 sm6> |
160 | <h5 class="right my-1"> | 160 | <h5 class="right my-1"> |
161 | <b>Type Of Event:</b> | 161 | <b>Type Of Event:</b> |
162 | </h5> | 162 | </h5> |
163 | </v-flex> | 163 | </v-flex> |
164 | <v-flex sm6 xs8> | 164 | <v-flex sm6 xs8> |
165 | <h5 class="my-1">{{ editedItem.typeOfEvent }}</h5> | 165 | <h5 class="my-1">{{ editedItem.typeOfEvent }}</h5> |
166 | </v-flex> | 166 | </v-flex> |
167 | </v-layout> | 167 | </v-layout> |
168 | <v-layout v-if="editedItem.courseId"> | 168 | <v-layout v-if="editedItem.courseId"> |
169 | <v-flex xs4 sm6> | 169 | <v-flex xs4 sm6> |
170 | <h5 class="right my-1"> | 170 | <h5 class="right my-1"> |
171 | <b>Course Name:</b> | 171 | <b>Course Name:</b> |
172 | </h5> | 172 | </h5> |
173 | </v-flex> | 173 | </v-flex> |
174 | <v-flex sm6 xs8> | 174 | <v-flex sm6 xs8> |
175 | <h5 class="my-1">{{ editedItem.courseId.courseName }}</h5> | 175 | <h5 class="my-1">{{ editedItem.courseId.courseName }}</h5> |
176 | </v-flex> | 176 | </v-flex> |
177 | </v-layout> | 177 | </v-layout> |
178 | <v-layout v-if="editedItem.classId"> | 178 | <v-layout v-if="editedItem.classId"> |
179 | <v-flex xs4 sm6> | 179 | <v-flex xs4 sm6> |
180 | <h5 class="right my-1"> | 180 | <h5 class="right my-1"> |
181 | <b>Class:</b> | 181 | <b>Class:</b> |
182 | </h5> | 182 | </h5> |
183 | </v-flex> | 183 | </v-flex> |
184 | <v-flex sm6 xs8> | 184 | <v-flex sm6 xs8> |
185 | <h5 class="my-1">{{ editedItem.classId.classNum }}</h5> | 185 | <h5 class="my-1">{{ editedItem.classId.classNum }}</h5> |
186 | </v-flex> | 186 | </v-flex> |
187 | </v-layout> | 187 | </v-layout> |
188 | <v-layout> | 188 | <v-layout> |
189 | <v-flex xs4 sm6> | 189 | <v-flex xs4 sm6> |
190 | <h5 class="right my-1"> | 190 | <h5 class="right my-1"> |
191 | <b>Duration:</b> | 191 | <b>Duration:</b> |
192 | </h5> | 192 | </h5> |
193 | </v-flex> | 193 | </v-flex> |
194 | <v-flex sm6 xs8> | 194 | <v-flex sm6 xs8> |
195 | <h5 class="my-1">{{ editedItem.duration }}</h5> | 195 | <h5 class="my-1">{{ editedItem.duration }}</h5> |
196 | </v-flex> | 196 | </v-flex> |
197 | </v-layout> | 197 | </v-layout> |
198 | </v-flex> | 198 | </v-flex> |
199 | </v-layout> | 199 | </v-layout> |
200 | </v-container> | 200 | </v-container> |
201 | </v-card-text> | 201 | </v-card-text> |
202 | </v-card> | 202 | </v-card> |
203 | </v-dialog> | 203 | </v-dialog> |
204 | 204 | ||
205 | <!-- ****** EVENT TABLE ****** --> | 205 | <!-- ****** EVENT TABLE ****** --> |
206 | 206 | ||
207 | <v-toolbar color="transparent" flat> | 207 | <v-toolbar color="transparent" flat> |
208 | <v-btn | 208 | <v-btn |
209 | fab | 209 | fab |
210 | dark | 210 | dark |
211 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 211 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
212 | small | 212 | small |
213 | @click="meetEventDialog = true" | 213 | @click="meetEventDialog = true" |
214 | > | 214 | > |
215 | <v-icon dark>add</v-icon> | 215 | <v-icon dark>add</v-icon> |
216 | </v-btn> | 216 | </v-btn> |
217 | <v-btn | 217 | <v-btn |
218 | round | 218 | round |
219 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 219 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
220 | dark | 220 | dark |
221 | @click="meetEventDialog = true" | 221 | @click="meetEventDialog = true" |
222 | > | 222 | > |
223 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Event | 223 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Event |
224 | </v-btn> | 224 | </v-btn> |
225 | <v-spacer></v-spacer> | 225 | <v-spacer></v-spacer> |
226 | <v-card-title class="body-1" v-show="show"> | 226 | <v-card-title class="body-1" v-show="show"> |
227 | <v-btn icon large flat @click="displaySearch"> | 227 | <v-btn icon large flat @click="displaySearch"> |
228 | <v-avatar size="27"> | 228 | <v-avatar size="27"> |
229 | <img src="/static/icon/search.png" alt="icon" /> | 229 | <img src="/static/icon/search.png" alt="icon" /> |
230 | </v-avatar> | 230 | </v-avatar> |
231 | </v-btn> | 231 | </v-btn> |
232 | </v-card-title> | 232 | </v-card-title> |
233 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | 233 | <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> |
234 | <v-layout> | 234 | <v-layout> |
235 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 235 | <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> |
236 | <v-icon @click="closeSearch" color="error">close</v-icon> | 236 | <v-icon @click="closeSearch" color="error">close</v-icon> |
237 | </v-layout> | 237 | </v-layout> |
238 | </v-flex> | 238 | </v-flex> |
239 | </v-toolbar> | 239 | </v-toolbar> |
240 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> | 240 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> |
241 | <template slot="items" slot-scope="props"> | 241 | <template slot="items" slot-scope="props"> |
242 | <tr class="tr"> | 242 | <tr class="tr"> |
243 | <td class="td td-row">{{ props.index + 1}}</td> | 243 | <td class="td td-row">{{ props.index + 1}}</td> |
244 | <td | 244 | <td |
245 | class="td td-row text-xs-center" | 245 | class="td td-row text-xs-center" |
246 | >{{ props.item.classId ? props.item.classId.classNum : "-" }}</td> | 246 | >{{ props.item.classId ? props.item.classId.classNum : "-" }}</td> |
247 | <td class="td td-row text-xs-center">{{ props.item.title }}</td> | 247 | <td class="td td-row text-xs-center">{{ props.item.title }}</td> |
248 | <td class="td td-row text-xs-center">{{ dates(props.item.dateOfEvent) }}</td> | 248 | <td class="td td-row text-xs-center">{{ dates(props.item.dateOfEvent) }}</td> |
249 | <td class="td td-row text-xs-center">{{ props.item.startTime }}</td> | 249 | <td class="td td-row text-xs-center">{{ props.item.startTime }}</td> |
250 | <td class="td td-row text-xs-center"> | 250 | <td class="td td-row text-xs-center"> |
251 | <span> | 251 | <span> |
252 | <v-tooltip top> | 252 | <v-tooltip top> |
253 | <img | 253 | <img |
254 | slot="activator" | 254 | slot="activator" |
255 | style="cursor:pointer; width:25px; height:25px; " | 255 | style="cursor:pointer; width:25px; height:25px; " |
256 | class="mr-3" | 256 | class="mr-3" |
257 | @click="profile(props.item)" | 257 | @click="profile(props.item)" |
258 | src="/static/icon/view.png" | 258 | src="/static/icon/view.png" |
259 | /> | 259 | /> |
260 | <span>View</span> | 260 | <span>View</span> |
261 | </v-tooltip> | 261 | </v-tooltip> |
262 | <v-tooltip top> | 262 | <v-tooltip top> |
263 | <img | 263 | <img |
264 | slot="activator" | 264 | slot="activator" |
265 | style="cursor:pointer; width:20px; height:18px; " | 265 | style="cursor:pointer; width:20px; height:18px; " |
266 | class="mr-3" | 266 | class="mr-3" |
267 | @click="editItem(props.item)" | 267 | @click="editItem(props.item)" |
268 | src="/static/icon/edit.png" | 268 | src="/static/icon/edit.png" |
269 | /> | 269 | /> |
270 | <span>Edit</span> | 270 | <span>Edit</span> |
271 | </v-tooltip> | 271 | </v-tooltip> |
272 | <v-tooltip top> | 272 | <v-tooltip top> |
273 | <img | 273 | <img |
274 | slot="activator" | 274 | slot="activator" |
275 | style="cursor:pointer; width:20px; height:20px; " | 275 | style="cursor:pointer; width:20px; height:20px; " |
276 | class="mr-3" | 276 | class="mr-3" |
277 | @click="deleteItem(props.item)" | 277 | @click="deleteItem(props.item)" |
278 | src="/static/icon/delete.png" | 278 | src="/static/icon/delete.png" |
279 | /> | 279 | /> |
280 | <span>Delete</span> | 280 | <span>Delete</span> |
281 | </v-tooltip> | 281 | </v-tooltip> |
282 | </span> | 282 | </span> |
283 | </td> | 283 | </td> |
284 | </tr> | 284 | </tr> |
285 | </template> | 285 | </template> |
286 | <v-alert | 286 | <v-alert |
287 | slot="no-results" | 287 | slot="no-results" |
288 | :value="true" | 288 | :value="true" |
289 | color="error" | 289 | color="error" |
290 | icon="warning" | 290 | icon="warning" |
291 | >Your search for "{{ search }}" found no results.</v-alert> | 291 | >Your search for "{{ search }}" found no results.</v-alert> |
292 | </v-data-table> | 292 | </v-data-table> |
293 | <!-- ****** ADD MULTIPLE EVENT ****** --> | 293 | <!-- ****** ADD MULTIPLE EVENT ****** --> |
294 | <v-dialog v-model="meetEventDialog" max-width="500px" persistent> | 294 | <v-dialog v-model="meetEventDialog" max-width="500px" persistent> |
295 | <v-card flat class="card-style pa-2" dark> | 295 | <v-card flat class="card-style pa-2" dark> |
296 | <v-layout> | 296 | <v-layout> |
297 | <v-flex xs12> | 297 | <v-flex xs12> |
298 | <label class="title text-xs-center">Add Meeting Event</label> | 298 | <label class="title text-xs-center">Add Meeting Event</label> |
299 | <v-icon size="24" class="right" @click="meetEventDialog = false; $refs.form.reset()">cancel</v-icon> | 299 | <v-icon size="24" class="right" @click="meetEventDialog = false; $refs.form.reset()">cancel</v-icon> |
300 | </v-flex> | 300 | </v-flex> |
301 | </v-layout> | 301 | </v-layout> |
302 | <v-form ref="form" v-model="valid" lazy-validation > | 302 | <v-form ref="form" v-model="valid" lazy-validation > |
303 | <v-container fluid> | 303 | <v-container fluid> |
304 | <v-flex xs12> | 304 | <v-flex xs12> |
305 | <v-layout> | 305 | <v-layout> |
306 | <v-flex xs4 class="pt-4 subheading"> | 306 | <v-flex xs4 class="pt-4 subheading"> |
307 | <label class="right">Title:</label> | 307 | <label class="right">Title:</label> |
308 | </v-flex> | 308 | </v-flex> |
309 | <v-flex xs8 sm8 class="ml-3"> | 309 | <v-flex xs8 sm8 class="ml-3"> |
310 | <v-text-field | 310 | <v-text-field |
311 | v-model="meetEvent.title" | 311 | v-model="meetEvent.title" |
312 | placeholder="fill your Title" | 312 | placeholder="fill your Title" |
313 | type="text" | 313 | type="text" |
314 | :rules="titleRules" | 314 | :rules="titleRules" |
315 | required | 315 | required |
316 | ></v-text-field> | 316 | ></v-text-field> |
317 | </v-flex> | 317 | </v-flex> |
318 | </v-layout> | 318 | </v-layout> |
319 | </v-flex> | 319 | </v-flex> |
320 | <v-flex xs12> | 320 | <v-flex xs12> |
321 | <v-layout> | 321 | <v-layout> |
322 | <v-flex xs4 class="pt-4 subheading"> | 322 | <v-flex xs4 class="pt-4 subheading"> |
323 | <label class="right">Date:</label> | 323 | <label class="right">Date:</label> |
324 | </v-flex> | 324 | </v-flex> |
325 | <v-flex xs8 sm8 class="ml-3"> | 325 | <v-flex xs8 sm8 class="ml-3"> |
326 | <v-menu | 326 | <v-menu |
327 | ref="menu1" | 327 | ref="menu1" |
328 | :close-on-content-click="false" | 328 | :close-on-content-click="false" |
329 | v-model="menu1" | 329 | v-model="menu1" |
330 | :nudge-right="40" | 330 | :nudge-right="40" |
331 | :return-value.sync="meetEvent.dateOfEvent" | 331 | :return-value.sync="meetEvent.dateOfEvent" |
332 | app | 332 | app |
333 | lazy | 333 | lazy |
334 | transition="scale-transition" | 334 | transition="scale-transition" |
335 | offset-y | 335 | offset-y |
336 | full-width | 336 | full-width |
337 | min-width="290px" | 337 | min-width="290px" |
338 | > | 338 | > |
339 | <v-text-field | 339 | <v-text-field |
340 | slot="activator" | 340 | slot="activator" |
341 | :rules="dateRules" | 341 | :rules="dateRules" |
342 | v-model="meetEvent.dateOfEvent" | 342 | v-model="meetEvent.dateOfEvent" |
343 | append-icon="event" | 343 | append-icon="event" |
344 | placeholder="Select date" | 344 | placeholder="Select date" |
345 | ></v-text-field> | 345 | ></v-text-field> |
346 | <v-date-picker | 346 | <v-date-picker |
347 | color="info" | 347 | color="info" |
348 | v-model="meetEvent.dateOfEvent" | 348 | v-model="meetEvent.dateOfEvent" |
349 | @input="$refs.menu1.save(meetEvent.dateOfEvent)" | 349 | @input="$refs.menu1.save(meetEvent.dateOfEvent)" |
350 | ></v-date-picker> | 350 | ></v-date-picker> |
351 | </v-menu> | 351 | </v-menu> |
352 | </v-flex> | 352 | </v-flex> |
353 | </v-layout> | 353 | </v-layout> |
354 | </v-flex> | 354 | </v-flex> |
355 | <v-flex xs12> | 355 | <v-flex xs12> |
356 | <v-layout> | 356 | <v-layout> |
357 | <v-flex xs4 class="pt-4 subheading"> | 357 | <v-flex xs4 class="pt-4 subheading"> |
358 | <label class="right">Start Time:</label> | 358 | <label class="right">Start Time:</label> |
359 | </v-flex> | 359 | </v-flex> |
360 | <v-flex xs8 sm8 class="ml-3"> | 360 | <v-flex xs8 sm8 class="ml-3"> |
361 | <v-menu | 361 | <v-menu |
362 | ref="menuA" | 362 | ref="menuA" |
363 | :close-on-content-click="false" | 363 | :close-on-content-click="false" |
364 | v-model="menu2" | 364 | v-model="menu2" |
365 | :nudge-right="40" | 365 | :nudge-right="40" |
366 | :return-value.sync="meetEvent.startTime" | 366 | :return-value.sync="meetEvent.startTime" |
367 | lazy | 367 | lazy |
368 | transition="scale-transition" | 368 | transition="scale-transition" |
369 | offset-y | 369 | offset-y |
370 | full-width | 370 | full-width |
371 | max-width="290px" | 371 | max-width="290px" |
372 | min-width="290px" | 372 | min-width="290px" |
373 | > | 373 | > |
374 | <v-text-field | 374 | <v-text-field |
375 | slot="activator" | 375 | slot="activator" |
376 | v-model="meetEvent.startTime" | 376 | v-model="meetEvent.startTime" |
377 | placeholder="Select Start time" | 377 | placeholder="Select Start time" |
378 | append-icon="access_time" | 378 | append-icon="access_time" |
379 | :rules="startTimeRules" | 379 | :rules="startTimeRules" |
380 | readonly | 380 | readonly |
381 | ></v-text-field> | 381 | ></v-text-field> |
382 | <v-time-picker | 382 | <v-time-picker |
383 | v-model="meetEvent.startTime" | 383 | v-model="meetEvent.startTime" |
384 | format="24hr" | 384 | format="24hr" |
385 | @change="$refs.menuA.save(meetEvent.startTime)" | 385 | @change="$refs.menuA.save(meetEvent.startTime)" |
386 | ></v-time-picker> | 386 | ></v-time-picker> |
387 | </v-menu> | 387 | </v-menu> |
388 | </v-flex> | 388 | </v-flex> |
389 | </v-layout> | 389 | </v-layout> |
390 | </v-flex> | 390 | </v-flex> |
391 | <v-flex xs12> | 391 | <v-flex xs12> |
392 | <v-layout> | 392 | <v-layout> |
393 | <v-flex xs4 class="pt-4 subheading"> | 393 | <v-flex xs4 class="pt-4 subheading"> |
394 | <label class="right">Type Of Event:</label> | 394 | <label class="right">Type Of Event:</label> |
395 | </v-flex> | 395 | </v-flex> |
396 | <v-flex xs8 sm8 class="ml-3"> | 396 | <v-flex xs8 sm8 class="ml-3"> |
397 | <v-select | 397 | <v-select |
398 | :items="typeOfEvent" | 398 | :items="typeOfEvent" |
399 | label="Select Type Of Event" | 399 | label="Select Type Of Event" |
400 | v-model="meetEvent.typeOfEvent" | 400 | v-model="meetEvent.typeOfEvent" |
401 | :rules="typeOfEventRules" | 401 | :rules="typeOfEventRules" |
402 | 402 | ||
403 | ></v-select> | 403 | ></v-select> |
404 | </v-flex> | 404 | </v-flex> |
405 | </v-layout> | 405 | </v-layout> |
406 | </v-flex> | 406 | </v-flex> |
407 | <v-flex xs12 v-show="meetEvent.typeOfEvent"> | 407 | <v-flex xs12 v-show="meetEvent.typeOfEvent"> |
408 | <v-layout> | 408 | <v-layout> |
409 | <v-flex xs4 class="pt-4 subheading"> | 409 | <v-flex xs4 class="pt-4 subheading"> |
410 | <label class="right">Class:</label> | 410 | <label class="right">Class:</label> |
411 | </v-flex> | 411 | </v-flex> |
412 | <v-flex xs8 sm8 class="ml-3"> | 412 | <v-flex xs8 sm8 class="ml-3"> |
413 | <v-select | 413 | <v-select |
414 | :items="addclass" | 414 | :items="addclass" |
415 | label="Select Class" | 415 | label="Select Class" |
416 | v-model="meetEvent.classId" | 416 | v-model="meetEvent.classId" |
417 | item-text="classNum" | 417 | item-text="classNum" |
418 | item-value="_id" | 418 | item-value="_id" |
419 | @change="getCourses(meetEvent.classId)" | 419 | @change="getCourses(meetEvent.classId)" |
420 | ></v-select> | 420 | ></v-select> |
421 | </v-flex> | 421 | </v-flex> |
422 | </v-layout> | 422 | </v-layout> |
423 | </v-flex> | 423 | </v-flex> |
424 | <v-flex xs12 v-show="meetEvent.typeOfEvent === 'Course'"> | 424 | <v-flex xs12 v-show="meetEvent.typeOfEvent === 'Course'"> |
425 | <v-layout> | 425 | <v-layout> |
426 | <v-flex xs4 class="pt-4 subheading"> | 426 | <v-flex xs4 class="pt-4 subheading"> |
427 | <label class="right">Courses:</label> | 427 | <label class="right">Courses:</label> |
428 | </v-flex> | 428 | </v-flex> |
429 | <v-flex xs8 sm8 class="ml-3"> | 429 | <v-flex xs8 sm8 class="ml-3"> |
430 | <v-select | 430 | <v-select |
431 | :items="courseData" | 431 | :items="courseData" |
432 | label="Select Course" | 432 | label="Select Course" |
433 | v-model="meetEvent.courseId" | 433 | v-model="meetEvent.courseId" |
434 | item-text="courseName" | 434 | item-text="courseName" |
435 | item-value="_id" | 435 | item-value="_id" |
436 | required | 436 | required |
437 | ></v-select> | 437 | ></v-select> |
438 | </v-flex> | 438 | </v-flex> |
439 | </v-layout> | 439 | </v-layout> |
440 | </v-flex> | 440 | </v-flex> |
441 | <v-flex xs12> | 441 | <v-flex xs12> |
442 | <v-layout> | 442 | <v-layout> |
443 | <v-flex xs4 class="pt-4 subheading"> | 443 | <v-flex xs4 class="pt-4 subheading"> |
444 | <label class="right">Duration</label> | 444 | <label class="right">Duration</label> |
445 | </v-flex> | 445 | </v-flex> |
446 | <v-flex xs8 sm8 class="ml-3"> | 446 | <v-flex xs8 sm8 class="ml-3"> |
447 | <v-text-field | 447 | <v-text-field |
448 | placeholder="fill your Description" | 448 | placeholder="fill your Description" |
449 | :rules="descriptionRules" | 449 | :rules="descriptionRules" |
450 | v-model="meetEvent.duration" | 450 | v-model="meetEvent.duration" |
451 | type="text" | 451 | type="text" |
452 | required | 452 | required |
453 | ></v-text-field> | 453 | ></v-text-field> |
454 | </v-flex> | 454 | </v-flex> |
455 | </v-layout> | 455 | </v-layout> |
456 | </v-flex> | 456 | </v-flex> |
457 | <v-layout> | 457 | <v-layout> |
458 | <v-flex xs12> | 458 | <v-flex xs12> |
459 | <v-layout class="right"> | 459 | <v-layout class="right"> |
460 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 460 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
461 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 461 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
462 | </v-layout> | 462 | </v-layout> |
463 | </v-flex> | 463 | </v-flex> |
464 | </v-layout> | 464 | </v-layout> |
465 | </v-container> | 465 | </v-container> |
466 | </v-form> | 466 | </v-form> |
467 | </v-card> | 467 | </v-card> |
468 | </v-dialog> | 468 | </v-dialog> |
469 | <v-snackbar | 469 | <v-snackbar |
470 | :timeout="timeout" | 470 | :timeout="timeout" |
471 | :top="y === 'top'" | 471 | :top="y === 'top'" |
472 | :right="x === 'right'" | 472 | :right="x === 'right'" |
473 | :vertical="mode === 'vertical'" | 473 | :vertical="mode === 'vertical'" |
474 | v-model="snackbar" | 474 | v-model="snackbar" |
475 | :color="color" | 475 | :color="color" |
476 | >{{ text }}</v-snackbar> | 476 | >{{ text }}</v-snackbar> |
477 | <div class="loader" v-if="showLoader"> | 477 | <div class="loader" v-if="showLoader"> |
478 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 478 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
479 | </div> | 479 | </div> |
480 | </v-container> | 480 | </v-container> |
481 | </template> | 481 | </template> |
482 | 482 | ||
483 | <script> | 483 | <script> |
484 | import http from "@/Services/http.js"; | 484 | import http from "@/Services/http.js"; |
485 | import moment from "moment"; | 485 | import moment from "moment"; |
486 | 486 | ||
487 | export default { | 487 | export default { |
488 | data: () => ({ | 488 | data: () => ({ |
489 | snackbar: false, | 489 | snackbar: false, |
490 | y: "top", | 490 | y: "top", |
491 | x: "right", | 491 | x: "right", |
492 | mode: "", | 492 | mode: "", |
493 | timeout: 5000, | 493 | timeout: 5000, |
494 | text: "", | 494 | text: "", |
495 | color: "", | 495 | color: "", |
496 | loading: false, | 496 | loading: false, |
497 | date: null, | 497 | date: null, |
498 | search: "", | 498 | search: "", |
499 | color: "", | 499 | color: "", |
500 | show: true, | 500 | show: true, |
501 | meetEventDialog: false, | 501 | meetEventDialog: false, |
502 | showSearch: false, | 502 | showSearch: false, |
503 | showLoader: false, | 503 | showLoader: false, |
504 | editEventdialog: false, | 504 | editEventdialog: false, |
505 | viewEventdialog: false, | 505 | viewEventdialog: false, |
506 | valid: true, | 506 | valid: true, |
507 | addclass: [], | 507 | addclass: [], |
508 | courseData: [], | 508 | courseData: [], |
509 | pagination: { | 509 | pagination: { |
510 | rowsPerPage: 10 | 510 | rowsPerPage: 10 |
511 | }, | 511 | }, |
512 | date: null, | 512 | date: null, |
513 | menu1: false, | 513 | menu1: false, |
514 | menu: false, | 514 | menu: false, |
515 | menuEditTime: false, | 515 | menuEditTime: false, |
516 | menuEditDate: false, | 516 | menuEditDate: false, |
517 | titleRules: [v => !!v || " Tilte is required"], | 517 | titleRules: [v => !!v || " Tilte is required"], |
518 | descriptionRules: [v => !!v || " Discription is required"], | 518 | descriptionRules: [v => !!v || " Discription is required"], |
519 | dateRules: [v => !!v || "Date of event is required"], | 519 | dateRules: [v => !!v || "Date of event is required"], |
520 | startTimeRules: [v => !!v || "Start Time is required"], | 520 | startTimeRules: [v => !!v || "Start Time is required"], |
521 | typeOfEventRules: [v => !!v || "Type of event is required"], | 521 | typeOfEventRules: [v => !!v || "Type of event is required"], |
522 | headers: [ | 522 | headers: [ |
523 | { | 523 | { |
524 | text: "No", | 524 | text: "No", |
525 | align: "", | 525 | align: "", |
526 | sortable: false, | 526 | sortable: false, |
527 | value: "No" | 527 | value: "No" |
528 | }, | 528 | }, |
529 | { | 529 | { |
530 | text: "Class", | 530 | text: "Class", |
531 | value: "classNum", | 531 | value: "classNum", |
532 | sortable: false, | 532 | sortable: false, |
533 | align: "center" | 533 | align: "center" |
534 | }, | 534 | }, |
535 | { text: "Title", value: "title", sortable: false, align: "center" }, | 535 | { text: "Title", value: "title", sortable: false, align: "center" }, |
536 | { | 536 | { |
537 | text: "Date Of Event", | 537 | text: "Date Of Event", |
538 | value: "dateOfEvent", | 538 | value: "dateOfEvent", |
539 | sortable: false, | 539 | sortable: false, |
540 | align: "center" | 540 | align: "center" |
541 | }, | 541 | }, |
542 | { | 542 | { |
543 | text: "Start Time", | 543 | text: "Start Time", |
544 | value: "startTime", | 544 | value: "startTime", |
545 | sortable: false, | 545 | sortable: false, |
546 | align: "center" | 546 | align: "center" |
547 | }, | 547 | }, |
548 | { text: "Action", value: "", sortable: false, align: "center" } | 548 | { text: "Action", value: "", sortable: false, align: "center" } |
549 | ], | 549 | ], |
550 | events: [], | 550 | events: [], |
551 | typeOfEvent: ["Class", "Course"], | 551 | typeOfEvent: ["Class", "Course"], |
552 | editedIndex: -1, | 552 | editedIndex: -1, |
553 | meetEvent: { | 553 | meetEvent: { |
554 | startTime: null | 554 | startTime: null |
555 | }, | 555 | }, |
556 | editedItem: {}, | 556 | editedItem: {}, |
557 | menu1: false, | 557 | menu1: false, |
558 | menu2: false, | 558 | menu2: false, |
559 | loginId: "" | 559 | loginId: "" |
560 | }), | 560 | }), |
561 | methods: { | 561 | methods: { |
562 | dates: function(date) { | 562 | dates: function(date) { |
563 | return moment(date).format("MMMM DD, YYYY"); | 563 | return moment(date).format("MMMM DD, YYYY"); |
564 | }, | 564 | }, |
565 | getEvents() { | 565 | getEvents() { |
566 | this.showLoader = true; | 566 | this.showLoader = true; |
567 | var token = this.$store.state.token; | 567 | var token = this.$store.state.token; |
568 | http() | 568 | http() |
569 | .get("/getMeetingEventesList", { | 569 | .get("/getMeetingEventesList", { |
570 | params: { teacherId: this.loginId }, | 570 | params: { teacherId: this.loginId }, |
571 | headers: { Authorization: "Bearer " + token } | 571 | headers: { Authorization: "Bearer " + token } |
572 | }) | 572 | }) |
573 | .then(response => { | 573 | .then(response => { |
574 | this.events = response.data.data; | 574 | this.events = response.data.data; |
575 | this.showLoader = false; | 575 | this.showLoader = false; |
576 | }) | 576 | }) |
577 | .catch(error => { | 577 | .catch(error => { |
578 | // console.log("err====>", err); | 578 | // console.log("err====>", err); |
579 | this.showLoader = false; | 579 | this.showLoader = false; |
580 | if (error.response.status === 401) { | 580 | if (error.response.status === 401) { |
581 | this.$router.replace({ path: "/" }); | 581 | this.$router.replace({ path: "/" }); |
582 | this.$store.dispatch("setToken", null); | 582 | this.$store.dispatch("setToken", null); |
583 | this.$store.dispatch("Id", null); | 583 | this.$store.dispatch("Id", null); |
584 | } | 584 | } |
585 | }); | 585 | }); |
586 | }, | 586 | }, |
587 | editItem(item) { | 587 | editItem(item) { |
588 | this.editedIndex = this.events.indexOf(item); | 588 | this.editedIndex = this.events.indexOf(item); |
589 | this.editedItem = Object.assign({}, item); | 589 | this.editedItem = Object.assign({}, item); |
590 | this.editedItem.meetingEventId = item._id; | 590 | this.editedItem.meetingEventId = item._id; |
591 | this.editedItem.startTime = moment(this.editedItem.startTime, ["h:mm A"]).format("HH:mm"); | 591 | this.editedItem.startTime = moment(this.editedItem.startTime, ["h:mm A"]).format("HH:mm"); |
592 | this.editEventdialog = true; | 592 | this.editEventdialog = true; |
593 | }, | 593 | }, |
594 | profile(item) { | 594 | profile(item) { |
595 | this.editedIndex = this.events.indexOf(item); | 595 | this.editedIndex = this.events.indexOf(item); |
596 | this.editedItem = Object.assign({}, item); | 596 | this.editedItem = Object.assign({}, item); |
597 | this.viewEventdialog = true; | 597 | this.viewEventdialog = true; |
598 | }, | 598 | }, |
599 | 599 | ||
600 | deleteItem(item) { | 600 | deleteItem(item) { |
601 | let deleteEvent = { | 601 | let deleteEvent = { |
602 | meetingEventId: item._id | 602 | meetingEventId: item._id |
603 | }; | 603 | }; |
604 | http() | 604 | http() |
605 | .delete( | 605 | .delete( |
606 | "/deleteMeetingEvent", | 606 | "/deleteMeetingEvent", |
607 | confirm("Are you sure you want to delete this?") && { | 607 | confirm("Are you sure you want to delete this?") && { |
608 | params: deleteEvent | 608 | params: deleteEvent |
609 | } | 609 | } |
610 | ) | 610 | ) |
611 | .then(response => { | 611 | .then(response => { |
612 | this.snackbar = true; | 612 | this.snackbar = true; |
613 | this.text = response.data.message; | 613 | this.text = response.data.message; |
614 | this.getEvents(); | 614 | this.getEvents(); |
615 | this.snackbar = true; | 615 | this.snackbar = true; |
616 | this.color = "green"; | 616 | this.color = "green"; |
617 | this.text = response.data.message; | 617 | this.text = response.data.message; |
618 | }) | 618 | }) |
619 | .catch(error => { | 619 | .catch(error => { |
620 | this.snackbar = true; | 620 | this.snackbar = true; |
621 | this.text = error.response.data.message; | 621 | this.text = error.response.data.message; |
622 | this.color = "error"; | 622 | this.color = "error"; |
623 | this.loading = false; | 623 | this.loading = false; |
624 | }); | 624 | }); |
625 | }, | 625 | }, |
626 | getAllClass() { | 626 | getAllClass() { |
627 | http() | 627 | http() |
628 | .get("/getClassesList") | 628 | .get("/getClassesList") |
629 | .then(response => { | 629 | .then(response => { |
630 | this.addclass = response.data.data; | 630 | this.addclass = response.data.data; |
631 | }) | 631 | }) |
632 | .catch(error => { | 632 | .catch(error => { |
633 | // console.log("err====>", err); | 633 | // console.log("err====>", err); |
634 | // this.$router.replace({ path: "/" }); | 634 | // this.$router.replace({ path: "/" }); |
635 | }); | 635 | }); |
636 | }, | 636 | }, |
637 | getCourses(classId) { | 637 | getCourses(classId) { |
638 | this.showLoader = true; | 638 | this.showLoader = true; |
639 | http() | 639 | http() |
640 | .get("/getCourseesList", { | 640 | .get("/getCourseesList", { |
641 | params: { | 641 | params: { |
642 | classId: classId | 642 | classId: classId |
643 | } | 643 | } |
644 | }) | 644 | }) |
645 | .then(response => { | 645 | .then(response => { |
646 | this.courseData = response.data.data; | 646 | this.courseData = response.data.data; |
647 | this.showLoader = false; | 647 | this.showLoader = false; |
648 | }) | 648 | }) |
649 | .catch(err => { | 649 | .catch(err => { |
650 | console.log("err====>", err); | 650 | console.log("err====>", err); |
651 | this.showLoader = false; | 651 | this.showLoader = false; |
652 | }); | 652 | }); |
653 | }, | 653 | }, |
654 | close() { | 654 | close() { |
655 | this.editEventdialog = false; | 655 | this.editEventdialog = false; |
656 | }, | 656 | }, |
657 | submit() { | 657 | submit() { |
658 | if (this.$refs.form.validate()) { | 658 | if (this.$refs.form.validate()) { |
659 | this.loading = true; | 659 | this.loading = true; |
660 | this.meetEvent.startTime = moment(this.meetEvent.startTime, "hh:mm").format("LT"); | 660 | this.meetEvent.startTime = moment(this.meetEvent.startTime, "hh:mm").format("LT"); |
661 | http() | 661 | http() |
662 | .post("/createMeetingEvent", this.meetEvent) | 662 | .post("/createMeetingEvent", this.meetEvent) |
663 | .then(response => { | 663 | .then(response => { |
664 | this.snackbar = true; | 664 | this.snackbar = true; |
665 | this.text = response.data.message; | 665 | this.text = response.data.message; |
666 | this.color = "green"; | 666 | this.color = "green"; |
667 | this.getEvents(); | 667 | this.getEvents(); |
668 | this.clear(); | 668 | this.clear(); |
669 | this.loading = false; | 669 | this.loading = false; |
670 | this.meetEventDialog = false; | 670 | this.meetEventDialog = false; |
671 | }) | 671 | }) |
672 | .catch(error => { | 672 | .catch(error => { |
673 | this.snackbar = true; | 673 | this.snackbar = true; |
674 | this.text = error.response.data.message; | 674 | this.text = error.response.data.message; |
675 | this.color = "error"; | 675 | this.color = "error"; |
676 | this.loading = false; | 676 | this.loading = false; |
677 | }); | 677 | }); |
678 | } | 678 | } |
679 | }, | 679 | }, |
680 | clear() { | 680 | clear() { |
681 | this.$refs.form.reset(); | 681 | this.$refs.form.reset(); |
682 | }, | 682 | }, |
683 | save() { | 683 | save() { |
684 | console.log('=======this.editedItem=====', this.editedItem); | ||
685 | if (this.editedItem.courseId) { | ||
686 | this.editedItem.courseId = this.editedItem.courseId._id; | ||
687 | } | ||
684 | delete this.editedItem.classId; | 688 | delete this.editedItem.classId; |
685 | this.editedItem.courseId = this.editedItem.courseId._id; | 689 | |
686 | this.editedItem.startTime = moment(this.editedItem.startTime, "hh:mm").format("LT"); | 690 | this.editedItem.startTime = moment(this.editedItem.startTime, "hh:mm").format("LT"); |
687 | http() | 691 | http() |
688 | .put("/updateMeetingEvent", this.editedItem) | 692 | .put("/updateMeetingEvent", this.editedItem) |
689 | .then(response => { | 693 | .then(response => { |
690 | this.snackbar = true; | 694 | this.snackbar = true; |
691 | this.text = response.data.message; | 695 | this.text = response.data.message; |
692 | this.color = "green"; | 696 | this.color = "green"; |
693 | this.getEvents(); | 697 | this.getEvents(); |
694 | this.close(); | 698 | this.close(); |
695 | }) | 699 | }) |
696 | .catch(error => { | 700 | .catch(error => { |
697 | this.snackbar = true; | 701 | this.snackbar = true; |
698 | this.text = error.response.data.message; | 702 | this.text = error.response.data.message; |
699 | this.color = "error"; | 703 | this.color = "error"; |
700 | }); | 704 | }); |
701 | }, | 705 | }, |
702 | displaySearch() { | 706 | displaySearch() { |
703 | (this.show = false), (this.showSearch = true); | 707 | (this.show = false), (this.showSearch = true); |
704 | }, | 708 | }, |
705 | closeSearch() { | 709 | closeSearch() { |
706 | this.showSearch = false; | 710 | this.showSearch = false; |
707 | this.show = true; | 711 | this.show = true; |
708 | this.search = ""; | 712 | this.search = ""; |
709 | } | 713 | } |
710 | }, | 714 | }, |
711 | mounted() { | 715 | mounted() { |
712 | this.loginId = this.$store.state.id; | 716 | this.loginId = this.$store.state.id; |
713 | this.getEvents(); | 717 | this.getEvents(); |
714 | this.getAllClass(); | 718 | this.getAllClass(); |
715 | } | 719 | } |
716 | }; | 720 | }; |
717 | </script> | 721 | </script> |