Commit aa63ee55a2bc948af8654aa305d85ba26ab0868a
1 parent
b4b24ab447
Exists in
master
and in
3 other branches
fixed validation and loader in time table
Showing
1 changed file
with
51 additions
and
35 deletions
Show diff stats
src/pages/TimeTable/timeTable.vue
1 | <template> | 1 | <template> |
2 | <v-app id="pages-dasboard"> | 2 | <v-app id="pages-dasboard"> |
3 | <v-tabs grow slider-color="gray"> | 3 | <v-tabs grow slider-color="gray"> |
4 | <v-tab | 4 | <v-tab |
5 | ripple | 5 | ripple |
6 | @click="activeTab('existing')" | 6 | @click="activeTab('existing')" |
7 | v-bind:class="{ active: isActive }" | 7 | v-bind:class="{ active: isActive }" |
8 | id="tab" | 8 | id="tab" |
9 | class="subheading" | 9 | class="subheading" |
10 | >Existing Time Table</v-tab> | 10 | >Existing Time Table</v-tab> |
11 | <v-tab | 11 | <v-tab |
12 | ripple | 12 | ripple |
13 | @click="activeTab('new')" | 13 | @click="activeTab('new')" |
14 | v-bind:class="{ active: newActive }" | 14 | v-bind:class="{ active: newActive }" |
15 | id="tab1" | 15 | id="tab1" |
16 | User | 16 | User |
17 | class="subheading" | 17 | class="subheading" |
18 | >Add New Time Table</v-tab> | 18 | >Add New Time Table</v-tab> |
19 | 19 | ||
20 | <!-- ****** EDITS TIME-TABLE****** --> | 20 | <!-- ****** EDITS TIME-TABLE****** --> |
21 | 21 | ||
22 | <v-tab-item> | 22 | <v-tab-item> |
23 | <v-snackbar | 23 | <v-snackbar |
24 | :timeout="timeout" | 24 | :timeout="timeout" |
25 | :top="y === 'top'" | 25 | :top="y === 'top'" |
26 | :right="x === 'right'" | 26 | :right="x === 'right'" |
27 | :vertical="mode === 'vertical'" | 27 | :vertical="mode === 'vertical'" |
28 | v-model="snackbar" | 28 | v-model="snackbar" |
29 | color="success" | 29 | color="success" |
30 | >{{ text }}</v-snackbar> | 30 | >{{ text }}</v-snackbar> |
31 | <v-dialog v-model="dialog" max-width="600px"> | 31 | <v-dialog v-model="dialog" max-width="600px"> |
32 | <v-flex xs12 sm12> | 32 | <v-flex xs12 sm12> |
33 | <v-toolbar color="grey lighten-2"> | 33 | <v-toolbar color="grey lighten-2"> |
34 | <v-spacer></v-spacer> | 34 | <v-spacer></v-spacer> |
35 | <v-toolbar-title> | 35 | <v-toolbar-title> |
36 | <h3>Edit Time Table</h3> | 36 | <h3>Edit Time Table</h3> |
37 | </v-toolbar-title> | 37 | </v-toolbar-title> |
38 | <v-spacer></v-spacer> | 38 | <v-spacer></v-spacer> |
39 | </v-toolbar> | 39 | </v-toolbar> |
40 | <v-card flat class="pa-2"> | 40 | <v-card flat class="pa-2"> |
41 | <!-- <v-layout> | 41 | <!-- <v-layout> |
42 | <v-flex | 42 | <v-flex |
43 | xs12 | 43 | xs12 |
44 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 44 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
45 | > | 45 | > |
46 | <v-avatar size="100px"> | 46 | <v-avatar size="100px"> |
47 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 47 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
48 | </v-avatar> | 48 | </v-avatar> |
49 | <input | 49 | <input |
50 | type="file" | 50 | type="file" |
51 | style="display: none" | 51 | style="display: none" |
52 | ref="image" | 52 | ref="image" |
53 | accept="image/*" | 53 | accept="image/*" |
54 | @change="onFilePicked" | 54 | @change="onFilePicked" |
55 | /> | 55 | /> |
56 | <img | 56 | <img |
57 | :src="imageData.imageUrl" | 57 | :src="imageData.imageUrl" |
58 | height="150" | 58 | height="150" |
59 | v-if="imageUrl" | 59 | v-if="imageUrl" |
60 | style="border-radius:50%; width:200px" | 60 | style="border-radius:50%; width:200px" |
61 | /> | 61 | /> |
62 | </v-flex> | 62 | </v-flex> |
63 | </v-layout>--> | 63 | </v-layout>--> |
64 | <v-flex xs12 sm12> | 64 | <v-flex xs12 sm12> |
65 | <v-layout> | 65 | <v-layout> |
66 | <v-flex xs4 class="pt-4 subheading"> | 66 | <v-flex xs4 class="pt-4 subheading"> |
67 | <label class="right">class No:</label> | 67 | <label class="right">class No:</label> |
68 | </v-flex> | 68 | </v-flex> |
69 | <v-flex xs8 sm5 class="ml-3"> | 69 | <v-flex xs8 sm5 class="ml-3"> |
70 | <v-select | 70 | <v-select |
71 | :items="addclass" | 71 | :items="addclass" |
72 | label="Select Class" | 72 | label="Select Class" |
73 | v-model="editedItem.classNum" | 73 | v-model="editedItem.classNum" |
74 | item-text="classNum" | 74 | item-text="classNum" |
75 | item-value="_id" | 75 | item-value="_id" |
76 | @change="getSections(editedItem.classNum)" | 76 | @change="getSections(editedItem.classNum)" |
77 | ></v-select> | 77 | ></v-select> |
78 | </v-flex> | 78 | </v-flex> |
79 | </v-layout> | 79 | </v-layout> |
80 | </v-flex> | 80 | </v-flex> |
81 | <v-flex xs12 sm12> | 81 | <v-flex xs12 sm12> |
82 | <v-layout> | 82 | <v-layout> |
83 | <v-flex xs4 class="pt-4 subheading"> | 83 | <v-flex xs4 class="pt-4 subheading"> |
84 | <label class="right hidden-xs-only hidden-sm-only">Section Name:</label> | 84 | <label class="right hidden-xs-only hidden-sm-only">Section Name:</label> |
85 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> | 85 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> |
86 | </v-flex> | 86 | </v-flex> |
87 | <v-flex xs8 sm5 class="ml-3"> | 87 | <v-flex xs8 sm5 class="ml-3"> |
88 | <v-select | 88 | <v-select |
89 | :items="addSection" | 89 | :items="addSection" |
90 | label="Select Section" | 90 | label="Select Section" |
91 | v-model="editedItem.selectSection" | 91 | v-model="editedItem.selectSection" |
92 | item-text="name" | 92 | item-text="name" |
93 | item-value="_id" | 93 | item-value="_id" |
94 | ></v-select> | 94 | ></v-select> |
95 | </v-flex> | 95 | </v-flex> |
96 | </v-layout> | 96 | </v-layout> |
97 | </v-flex> | 97 | </v-flex> |
98 | <v-layout> | 98 | <v-layout> |
99 | <v-flex xs12 sm9 offset-sm1> | 99 | <v-flex xs12 sm9 offset-sm1> |
100 | <v-card-actions> | 100 | <v-card-actions> |
101 | <v-btn round dark @click.native="close">Cancel</v-btn> | 101 | <v-btn round dark @click.native="close">Cancel</v-btn> |
102 | <v-spacer></v-spacer> | 102 | <v-spacer></v-spacer> |
103 | <v-btn round dark @click="save">Save</v-btn> | 103 | <v-btn round dark @click="save">Save</v-btn> |
104 | </v-card-actions> | 104 | </v-card-actions> |
105 | </v-flex> | 105 | </v-flex> |
106 | </v-layout> | 106 | </v-layout> |
107 | </v-card> | 107 | </v-card> |
108 | </v-flex> | 108 | </v-flex> |
109 | </v-dialog> | 109 | </v-dialog> |
110 | 110 | ||
111 | <!-- ****** ADD Dialog Schedule IN TIME-TABLE ****** --> | 111 | <!-- ****** ADD Dialog Schedule IN TIME-TABLE ****** --> |
112 | 112 | ||
113 | <v-dialog v-model="dialogSchedule" max-width="600px"> | 113 | <v-dialog v-model="dialogSchedule" max-width="600px"> |
114 | <v-flex xs12 sm12> | 114 | <v-flex xs12 sm12> |
115 | <v-toolbar color="grey lighten-2"> | 115 | <v-toolbar color="grey lighten-2"> |
116 | <v-spacer></v-spacer> | 116 | <v-spacer></v-spacer> |
117 | <v-toolbar-title> | 117 | <v-toolbar-title> |
118 | <h3>Add Schedule</h3> | 118 | <h3>Add Schedule</h3> |
119 | </v-toolbar-title> | 119 | </v-toolbar-title> |
120 | <v-spacer></v-spacer> | 120 | <v-spacer></v-spacer> |
121 | </v-toolbar> | 121 | </v-toolbar> |
122 | <v-card flat> | 122 | <v-card flat> |
123 | <v-form> | 123 | <v-form ref="formAddDay" v-model="validAddDay" lazy-validation> |
124 | <v-container fluid> | 124 | <v-container fluid> |
125 | <v-flex xs12 sm12 class="py-3"> | 125 | <v-flex xs12 sm12 class="py-3"> |
126 | <v-layout> | 126 | <v-layout> |
127 | <v-flex xs4 class="pt-4 subheading"> | 127 | <v-flex xs4 class="pt-4 subheading"> |
128 | <label class="right hidden-xs-only hidden-sm-only">Select Day:</label> | 128 | <label class="right hidden-xs-only hidden-sm-only">Select Day:</label> |
129 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Day:</label> | 129 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Day:</label> |
130 | </v-flex> | 130 | </v-flex> |
131 | <v-flex xs12 sm5 class="pl-3"> | 131 | <v-flex xs12 sm5 class="pl-3"> |
132 | <v-select | 132 | <v-select |
133 | :items="addOneDay" | 133 | :items="addOneDay" |
134 | label="Select Day" | 134 | label="Select Day" |
135 | v-model="schedule.selectDay" | 135 | v-model="schedule.selectDay" |
136 | :rules="selecDayRule" | ||
136 | ></v-select> | 137 | ></v-select> |
137 | </v-flex> | 138 | </v-flex> |
138 | </v-layout> | 139 | </v-layout> |
139 | </v-flex> | 140 | </v-flex> |
140 | <v-layout> | 141 | <v-layout> |
141 | <v-flex xs12 sm8 offset-sm2> | 142 | <v-flex xs12 sm8 offset-sm2> |
142 | <v-card-actions> | 143 | <v-card-actions> |
143 | <v-spacer></v-spacer> | 144 | <v-spacer></v-spacer> |
144 | <v-btn round dark @click="submitSchedule">Save</v-btn> | 145 | <v-btn round dark @click="submitSchedule">Save</v-btn> |
145 | <v-spacer></v-spacer> | 146 | <v-spacer></v-spacer> |
146 | </v-card-actions> | 147 | </v-card-actions> |
147 | </v-flex> | 148 | </v-flex> |
148 | </v-layout> | 149 | </v-layout> |
149 | </v-container> | 150 | </v-container> |
150 | </v-form> | 151 | </v-form> |
151 | </v-card> | 152 | </v-card> |
152 | </v-flex> | 153 | </v-flex> |
153 | </v-dialog> | 154 | </v-dialog> |
154 | 155 | ||
155 | <!-- ****** ADD LECTURES IN TIME-TABLE ****** --> | 156 | <!-- ****** ADD LECTURES IN TIME-TABLE ****** --> |
156 | 157 | ||
157 | <v-dialog v-model="dialogAddLecture" max-width="1000px"> | 158 | <v-dialog v-model="dialogAddLecture" max-width="1000px"> |
158 | <v-flex xs12 sm12> | 159 | <v-flex xs12 sm12> |
159 | <v-toolbar color="grey lighten-2"> | 160 | <v-toolbar color="grey lighten-2"> |
160 | <v-spacer></v-spacer> | 161 | <v-spacer></v-spacer> |
161 | <v-toolbar-title> | 162 | <v-toolbar-title> |
162 | <h3>Add Lecture</h3> | 163 | <h3>Add Lecture</h3> |
163 | </v-toolbar-title> | 164 | </v-toolbar-title> |
164 | <v-spacer></v-spacer> | 165 | <v-spacer></v-spacer> |
165 | </v-toolbar> | 166 | </v-toolbar> |
166 | <v-card flat> | 167 | <v-card flat> |
167 | <v-form ref="lectureForm" v-model="valid" lazy-validation> | 168 | <v-form ref="lectureForm" v-model="valid" lazy-validation> |
168 | <v-container fluid> | 169 | <v-container fluid> |
169 | <v-flex xs12 sm12> | 170 | <v-flex xs12 sm12> |
170 | <v-layout> | 171 | <v-layout> |
171 | <v-flex xs4 class="pt-4 subheading"> | 172 | <v-flex xs4 class="pt-4 subheading"> |
172 | <label class="right">Subject Name:</label> | 173 | <label class="right">Subject Name:</label> |
173 | </v-flex> | 174 | </v-flex> |
174 | <v-flex xs5 class="ml-3"> | 175 | <v-flex xs5 class="ml-3"> |
175 | <v-text-field | 176 | <v-text-field |
176 | v-model="addlectures.subjectName" | 177 | v-model="addlectures.subjectName" |
177 | :rules="subjectNameRules" | 178 | :rules="subjectNameRules" |
178 | placeholder="fill your Subject Name" | 179 | placeholder="fill your Subject Name" |
179 | type="text" | 180 | type="text" |
180 | ></v-text-field> | 181 | ></v-text-field> |
181 | </v-flex> | 182 | </v-flex> |
182 | </v-layout> | 183 | </v-layout> |
183 | </v-flex> | 184 | </v-flex> |
184 | <v-flex xs12 sm12> | 185 | <v-flex xs12 sm12> |
185 | <v-layout> | 186 | <v-layout> |
186 | <v-flex xs4 class="pt-4 subheading"> | 187 | <v-flex xs4 class="pt-4 subheading"> |
187 | <label class="right">Time In:</label> | 188 | <label class="right">Time In:</label> |
188 | </v-flex> | 189 | </v-flex> |
189 | <v-flex xs5 class="ml-3"> | 190 | <v-flex xs5 class="ml-3"> |
190 | <v-menu | 191 | <v-menu |
191 | ref="menuD" | 192 | ref="menuD" |
192 | :close-on-content-click="false" | 193 | :close-on-content-click="false" |
193 | v-model="menu5" | 194 | v-model="menu5" |
194 | :nudge-right="40" | 195 | :nudge-right="40" |
195 | lazy | 196 | lazy |
196 | transition="scale-transition" | 197 | transition="scale-transition" |
197 | offset-y | 198 | offset-y |
198 | full-width | 199 | full-width |
199 | max-width="290px" | 200 | max-width="290px" |
200 | min-width="290px" | 201 | min-width="290px" |
201 | > | 202 | > |
202 | <v-text-field | 203 | <v-text-field |
203 | slot="activator" | 204 | slot="activator" |
204 | v-model="addlectures.timeIn" | 205 | v-model="addlectures.timeIn" |
205 | label="Select your Time In" | 206 | label="Select your Time In" |
206 | append-icon="access_time" | 207 | append-icon="access_time" |
207 | :rules="timeInRules" | 208 | :rules="timeInRules" |
208 | ></v-text-field> | 209 | ></v-text-field> |
209 | <v-time-picker v-model="addlectures.timeIn" @change="menu5 = false"></v-time-picker> | 210 | <v-time-picker v-model="addlectures.timeIn" @change="menu5 = false"></v-time-picker> |
210 | </v-menu> | 211 | </v-menu> |
211 | </v-flex> | 212 | </v-flex> |
212 | </v-layout> | 213 | </v-layout> |
213 | </v-flex> | 214 | </v-flex> |
214 | <v-flex xs12 sm12> | 215 | <v-flex xs12 sm12> |
215 | <v-layout> | 216 | <v-layout> |
216 | <v-flex xs4 class="pt-4 subheading"> | 217 | <v-flex xs4 class="pt-4 subheading"> |
217 | <label class="right">Time Out:</label> | 218 | <label class="right">Time Out:</label> |
218 | </v-flex> | 219 | </v-flex> |
219 | <v-flex xs5 class="ml-3"> | 220 | <v-flex xs5 class="ml-3"> |
220 | <v-menu | 221 | <v-menu |
221 | ref="menuE" | 222 | ref="menuE" |
222 | :close-on-content-click="false" | 223 | :close-on-content-click="false" |
223 | v-model="menu6" | 224 | v-model="menu6" |
224 | :nudge-right="40" | 225 | :nudge-right="40" |
225 | lazy | 226 | lazy |
226 | transition="scale-transition" | 227 | transition="scale-transition" |
227 | offset-y | 228 | offset-y |
228 | full-width | 229 | full-width |
229 | max-width="290px" | 230 | max-width="290px" |
230 | min-width="290px" | 231 | min-width="290px" |
231 | > | 232 | > |
232 | <v-text-field | 233 | <v-text-field |
233 | slot="activator" | 234 | slot="activator" |
234 | :rules="timeOutRules" | 235 | :rules="timeOutRules" |
235 | v-model="addlectures.timeOut" | 236 | v-model="addlectures.timeOut" |
236 | label="Select your Time Out" | 237 | label="Select your Time Out" |
237 | append-icon="access_time" | 238 | append-icon="access_time" |
238 | ></v-text-field> | 239 | ></v-text-field> |
239 | <v-time-picker v-model="addlectures.timeOut" @change="menu6 = false"></v-time-picker> | 240 | <v-time-picker v-model="addlectures.timeOut" @change="menu6 = false"></v-time-picker> |
240 | </v-menu> | 241 | </v-menu> |
241 | </v-flex> | 242 | </v-flex> |
242 | </v-layout> | 243 | </v-layout> |
243 | </v-flex> | 244 | </v-flex> |
244 | <v-flex xs12 sm12> | 245 | <v-flex xs12 sm12> |
245 | <v-layout> | 246 | <v-layout> |
246 | <v-flex xs4 class="pt-4 subheading"> | 247 | <v-flex xs4 class="pt-4 subheading"> |
247 | <label class="right">Select Teacher:</label> | 248 | <label class="right">Select Teacher:</label> |
248 | </v-flex> | 249 | </v-flex> |
249 | <v-flex xs5 class="ml-3"> | 250 | <v-flex xs5 class="ml-3"> |
250 | <v-select | 251 | <v-select |
251 | :items="addTeachers" | 252 | :items="addTeachers" |
252 | v-model="addlectures.teacherId" | 253 | v-model="addlectures.teacherId" |
253 | :rules="subjectNameRules" | 254 | :rules="subjectNameRules" |
254 | item-text="name" | 255 | item-text="name" |
255 | item-value="_id" | 256 | item-value="_id" |
256 | required | 257 | required |
257 | ></v-select> | 258 | ></v-select> |
258 | </v-flex> | 259 | </v-flex> |
259 | </v-layout> | 260 | </v-layout> |
260 | </v-flex> | 261 | </v-flex> |
261 | <v-layout> | 262 | <v-layout> |
262 | <v-flex xs12 sm8 offset-sm2> | 263 | <v-flex xs12 sm8 offset-sm2> |
263 | <v-card-actions> | 264 | <v-card-actions> |
264 | <v-btn round dark @click.native="closedialogLecture">Cancel</v-btn> | 265 | <v-btn round dark @click.native="closedialogLecture">Cancel</v-btn> |
265 | <v-spacer></v-spacer> | 266 | <v-spacer></v-spacer> |
266 | <v-btn round dark @click="AddLecture">Save</v-btn> | 267 | <v-btn round dark @click="AddLecture">Save</v-btn> |
267 | </v-card-actions> | 268 | </v-card-actions> |
268 | </v-flex> | 269 | </v-flex> |
269 | </v-layout> | 270 | </v-layout> |
270 | </v-container> | 271 | </v-container> |
271 | </v-form> | 272 | </v-form> |
272 | </v-card> | 273 | </v-card> |
273 | </v-flex> | 274 | </v-flex> |
274 | </v-dialog> | 275 | </v-dialog> |
275 | 276 | ||
276 | <!-- ****** EDIT PARTICULAR LECTURES TIME-TABLE ****** --> | 277 | <!-- ****** EDIT PARTICULAR LECTURES TIME-TABLE ****** --> |
277 | 278 | ||
278 | <v-dialog v-model="dialogUpdateLectures" max-width="600px"> | 279 | <v-dialog v-model="dialogUpdateLectures" max-width="600px"> |
279 | <v-flex xs12 sm12 class> | 280 | <v-flex xs12 sm12 class> |
280 | <v-toolbar color="grey lighten-2"> | 281 | <v-toolbar color="grey lighten-2"> |
281 | <v-spacer></v-spacer> | 282 | <v-spacer></v-spacer> |
282 | <v-toolbar-title>Edit Lecture</v-toolbar-title> | 283 | <v-toolbar-title>Edit Lecture</v-toolbar-title> |
283 | <v-spacer></v-spacer> | 284 | <v-spacer></v-spacer> |
284 | </v-toolbar> | 285 | </v-toolbar> |
285 | <v-card flat class="pa-2"> | 286 | <v-card flat class="pa-2"> |
286 | <v-flex xs12 sm12> | 287 | <v-flex xs12 sm12> |
287 | <v-layout> | 288 | <v-layout> |
288 | <v-flex xs5 sm4 class="pt-4 subheading"> | 289 | <v-flex xs5 sm4 class="pt-4 subheading"> |
289 | <label class="right">Subject Name:</label> | 290 | <label class="right">Subject Name:</label> |
290 | </v-flex> | 291 | </v-flex> |
291 | <v-flex xs7 sm6 class="ml-3"> | 292 | <v-flex xs7 sm6 class="ml-3"> |
292 | <v-text-field | 293 | <v-text-field |
293 | v-model="updateLectures.subjectName" | 294 | v-model="updateLectures.subjectName" |
294 | placeholder="fill your Subject Name" | 295 | placeholder="fill your Subject Name" |
295 | type="text" | 296 | type="text" |
296 | ></v-text-field> | 297 | ></v-text-field> |
297 | </v-flex> | 298 | </v-flex> |
298 | </v-layout> | 299 | </v-layout> |
299 | </v-flex> | 300 | </v-flex> |
300 | <v-flex xs12 sm12> | 301 | <v-flex xs12 sm12> |
301 | <v-layout> | 302 | <v-layout> |
302 | <v-flex xs5 sm4 class="pt-4 subheading"> | 303 | <v-flex xs5 sm4 class="pt-4 subheading"> |
303 | <label class="right">Time In:</label> | 304 | <label class="right">Time In:</label> |
304 | </v-flex> | 305 | </v-flex> |
305 | <v-flex xs7 sm6 class="ml-3"> | 306 | <v-flex xs7 sm6 class="ml-3"> |
306 | <v-menu | 307 | <v-menu |
307 | ref="menuC" | 308 | ref="menuC" |
308 | :close-on-content-click="false" | 309 | :close-on-content-click="false" |
309 | v-model="menu4" | 310 | v-model="menu4" |
310 | :nudge-right="40" | 311 | :nudge-right="40" |
311 | lazy | 312 | lazy |
312 | transition="scale-transition" | 313 | transition="scale-transition" |
313 | offset-y | 314 | offset-y |
314 | full-width | 315 | full-width |
315 | max-width="290px" | 316 | max-width="290px" |
316 | min-width="290px" | 317 | min-width="290px" |
317 | > | 318 | > |
318 | <v-text-field | 319 | <v-text-field |
319 | slot="activator" | 320 | slot="activator" |
320 | v-model="updateLectures.timeIn" | 321 | v-model="updateLectures.timeIn" |
321 | placeholder="Select your Time In" | 322 | placeholder="Select your Time In" |
322 | append-icon="access_time" | 323 | append-icon="access_time" |
323 | ></v-text-field> | 324 | ></v-text-field> |
324 | <v-time-picker v-model="updateLectures.timeIn" @change="menu4= false"></v-time-picker> | 325 | <v-time-picker v-model="updateLectures.timeIn" @change="menu4= false"></v-time-picker> |
325 | </v-menu> | 326 | </v-menu> |
326 | </v-flex> | 327 | </v-flex> |
327 | </v-layout> | 328 | </v-layout> |
328 | </v-flex> | 329 | </v-flex> |
329 | <v-flex xs12 sm12> | 330 | <v-flex xs12 sm12> |
330 | <v-layout> | 331 | <v-layout> |
331 | <v-flex xs5 sm4 class="pt-4 subheading"> | 332 | <v-flex xs5 sm4 class="pt-4 subheading"> |
332 | <label class="right">Time Out:</label> | 333 | <label class="right">Time Out:</label> |
333 | </v-flex> | 334 | </v-flex> |
334 | <v-flex xs7 sm6 class="ml-3"> | 335 | <v-flex xs7 sm6 class="ml-3"> |
335 | <v-menu | 336 | <v-menu |
336 | ref="menuB" | 337 | ref="menuB" |
337 | :close-on-content-click="false" | 338 | :close-on-content-click="false" |
338 | v-model="menu3" | 339 | v-model="menu3" |
339 | :nudge-right="40" | 340 | :nudge-right="40" |
340 | lazy | 341 | lazy |
341 | transition="scale-transition" | 342 | transition="scale-transition" |
342 | offset-y | 343 | offset-y |
343 | full-width | 344 | full-width |
344 | max-width="290px" | 345 | max-width="290px" |
345 | min-width="290px" | 346 | min-width="290px" |
346 | > | 347 | > |
347 | <v-text-field | 348 | <v-text-field |
348 | slot="activator" | 349 | slot="activator" |
349 | v-model="updateLectures.timeOut" | 350 | v-model="updateLectures.timeOut" |
350 | placeholder="Select your Time Out" | 351 | placeholder="Select your Time Out" |
351 | append-icon="access_time" | 352 | append-icon="access_time" |
352 | ></v-text-field> | 353 | ></v-text-field> |
353 | <v-time-picker v-model="updateLectures.timeOut" @change="menu3 = false"></v-time-picker> | 354 | <v-time-picker v-model="updateLectures.timeOut" @change="menu3 = false"></v-time-picker> |
354 | </v-menu> | 355 | </v-menu> |
355 | </v-flex> | 356 | </v-flex> |
356 | </v-layout> | 357 | </v-layout> |
357 | </v-flex> | 358 | </v-flex> |
358 | <v-flex xs12 sm12> | 359 | <v-flex xs12 sm12> |
359 | <v-layout> | 360 | <v-layout> |
360 | <v-flex xs5 sm4 class="pt-4 subheading"> | 361 | <v-flex xs5 sm4 class="pt-4 subheading"> |
361 | <label class="right">Select Teacher:</label> | 362 | <label class="right">Select Teacher:</label> |
362 | </v-flex> | 363 | </v-flex> |
363 | <v-flex xs7 sm6 class="ml-3"> | 364 | <v-flex xs7 sm6 class="ml-3"> |
364 | <v-select | 365 | <v-select |
365 | :items="addTeachers" | 366 | :items="addTeachers" |
366 | label="Select Teacher" | 367 | label="Select Teacher" |
367 | v-model="updateLectures.teacherId" | 368 | v-model="updateLectures.teacherId" |
368 | item-text="name" | 369 | item-text="name" |
369 | item-value="_id" | 370 | item-value="_id" |
370 | required | 371 | required |
371 | ></v-select> | 372 | ></v-select> |
372 | </v-flex> | 373 | </v-flex> |
373 | </v-layout> | 374 | </v-layout> |
374 | </v-flex> | 375 | </v-flex> |
375 | <v-layout> | 376 | <v-layout> |
376 | <v-flex xs12 sm10 offset-sm1> | 377 | <v-flex xs12 sm10 offset-sm1> |
377 | <v-card-actions> | 378 | <v-card-actions> |
378 | <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn> | 379 | <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn> |
379 | <v-spacer></v-spacer> | 380 | <v-spacer></v-spacer> |
380 | <v-btn | 381 | <v-btn |
381 | round | 382 | round |
382 | dark | 383 | dark |
383 | @click="updateParticularTable(updateLectures.timeIn,updateLectures.timeOut)" | 384 | @click="updateParticularTable(updateLectures.timeIn,updateLectures.timeOut)" |
384 | >Save</v-btn> | 385 | >Save</v-btn> |
385 | </v-card-actions> | 386 | </v-card-actions> |
386 | </v-flex> | 387 | </v-flex> |
387 | </v-layout> | 388 | </v-layout> |
388 | </v-card> | 389 | </v-card> |
389 | </v-flex> | 390 | </v-flex> |
390 | </v-dialog> | 391 | </v-dialog> |
391 | <v-snackbar | 392 | <v-snackbar |
392 | :timeout="timeout" | 393 | :timeout="timeout" |
393 | :top="y === 'top'" | 394 | :top="y === 'top'" |
394 | :right="x === 'right'" | 395 | :right="x === 'right'" |
395 | :vertical="mode === 'vertical'" | 396 | :vertical="mode === 'vertical'" |
396 | v-model="snackbar" | 397 | v-model="snackbar" |
397 | color="success" | 398 | color="success" |
398 | >{{ text }}</v-snackbar> | 399 | >{{ text }}</v-snackbar> |
399 | 400 | ||
400 | <!-- ****** EXISTING-USERS TIME-TABLE ****** --> | 401 | <!-- ****** EXISTING-USERS TIME-TABLE ****** --> |
401 | 402 | ||
402 | <v-card flat> | 403 | <v-card flat> |
403 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 404 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
404 | <v-layout> | 405 | <v-layout> |
405 | <label class="right mt-4 ml-5">Select Class:</label> | 406 | <label class="right mt-4 ml-5">Select Class:</label> |
406 | <v-select | 407 | <v-select |
407 | :items="addclass" | 408 | :items="addclass" |
408 | label="Select Class" | 409 | label="Select Class" |
409 | v-model="selectTimeTable.select" | 410 | v-model="selectTimeTable.select" |
410 | item-text="classNum" | 411 | item-text="classNum" |
411 | item-value="_id" | 412 | item-value="_id" |
412 | name="Select Class" | 413 | name="Select Class" |
413 | @change="getSections(selectTimeTable.select)" | 414 | @change="getSections(selectTimeTable.select)" |
414 | class="px-4" | 415 | class="px-4" |
415 | required | 416 | required |
416 | ></v-select> | 417 | ></v-select> |
417 | <label class="right mt-4">Select Section:</label> | 418 | <label class="right mt-4">Select Section:</label> |
418 | <v-select | 419 | <v-select |
419 | :items="addSection" | 420 | :items="addSection" |
420 | label="Select Section" | 421 | label="Select Section" |
421 | v-model="selectTimeTable.selectSection" | 422 | v-model="selectTimeTable.selectSection" |
422 | item-text="name" | 423 | item-text="name" |
423 | item-value="_id" | 424 | item-value="_id" |
424 | name="Select Section" | 425 | name="Select Section" |
425 | class="pl-3" | 426 | class="pl-3" |
426 | required | 427 | required |
427 | ></v-select> | 428 | ></v-select> |
428 | </v-layout> | 429 | </v-layout> |
429 | <v-spacer></v-spacer> | 430 | <v-spacer></v-spacer> |
430 | <v-btn @click="findTimeTable()" round dark :loading="loading" class="left">Find</v-btn> | 431 | <v-btn @click="findTimeTable()" round dark :loading="loadingFindData" class="left">Find</v-btn> |
431 | </v-card-actions> | 432 | </v-card-actions> |
432 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 433 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
433 | <v-flex xs4 sm2 class="mt-4 ml-2"> | 434 | <v-flex xs4 sm2 class="mt-4 ml-2"> |
434 | <label>Select Class:</label> | 435 | <label>Select Class:</label> |
435 | </v-flex> | 436 | </v-flex> |
436 | <v-flex xs6 sm9> | 437 | <v-flex xs6 sm9> |
437 | <v-select | 438 | <v-select |
438 | :items="addclass" | 439 | :items="addclass" |
439 | label="Select Class" | 440 | label="Select Class" |
440 | v-model="selectTimeTable.select" | 441 | v-model="selectTimeTable.select" |
441 | item-text="classNum" | 442 | item-text="classNum" |
442 | item-value="_id" | 443 | item-value="_id" |
443 | name="Select Class" | 444 | name="Select Class" |
444 | @change="getSections(selectTimeTable.select)" | 445 | @change="getSections(selectTimeTable.select)" |
445 | required | 446 | required |
446 | ></v-select> | 447 | ></v-select> |
447 | </v-flex> | 448 | </v-flex> |
448 | </v-layout> | 449 | </v-layout> |
449 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 450 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
450 | <v-flex xs4 sm2 class="mt-4 ml-2"> | 451 | <v-flex xs4 sm2 class="mt-4 ml-2"> |
451 | <label>Select Section:</label> | 452 | <label>Select Section:</label> |
452 | </v-flex> | 453 | </v-flex> |
453 | <v-flex xs6 sm9> | 454 | <v-flex xs6 sm9> |
454 | <v-select | 455 | <v-select |
455 | :items="addSection" | 456 | :items="addSection" |
456 | label="Select Section" | 457 | label="Select Section" |
457 | v-model="selectTimeTable.selectSection" | 458 | v-model="selectTimeTable.selectSection" |
458 | item-text="name" | 459 | item-text="name" |
459 | item-value="_id" | 460 | item-value="_id" |
460 | name="Select Section" | 461 | name="Select Section" |
461 | required | 462 | required |
462 | ></v-select> | 463 | ></v-select> |
463 | </v-flex> | 464 | </v-flex> |
464 | </v-layout> | 465 | </v-layout> |
465 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 466 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
466 | <v-flex xs12> | 467 | <v-flex xs12> |
467 | <v-btn | 468 | <v-btn |
468 | @click="findTimeTable()" | 469 | @click="findTimeTable()" |
469 | round | 470 | round |
470 | dark | 471 | dark |
471 | :loading="loading" | 472 | :loading="loading" |
472 | class="right mr-4 mb-2" | 473 | class="right mr-4 mb-2" |
473 | >Find</v-btn> | 474 | >Find</v-btn> |
474 | </v-flex> | 475 | </v-flex> |
475 | </v-layout> | 476 | </v-layout> |
476 | </v-card> | 477 | </v-card> |
477 | <v-flex xs12> | 478 | <v-flex xs12> |
478 | <v-data-table | 479 | <v-data-table |
479 | :headers="headers" | 480 | :headers="headers" |
480 | :items="desserts" | 481 | :items="desserts" |
481 | :pagination.sync="pagination" | 482 | :pagination.sync="pagination" |
482 | :search="search" | 483 | :search="search" |
483 | item-key="_id" | 484 | item-key="_id" |
484 | > | 485 | > |
485 | <template slot="items" slot-scope="props"> | 486 | <template slot="items" slot-scope="props"> |
486 | <tr | 487 | <tr |
487 | style="cursor: pointer;" | 488 | style="cursor: pointer;" |
488 | @click="getTimeTable(props.item), props.expanded = !props.expanded" | 489 | @click="getTimeTable(props.item), props.expanded = !props.expanded" |
489 | > | 490 | > |
490 | <td class="text-xs-center">{{ props.index + 1}}</td> | 491 | <td class="text-xs-center">{{ props.index + 1}}</td> |
491 | <td class="text-xs-center">{{ props.item.classData.classNum}}</td> | 492 | <td class="text-xs-center">{{ props.item.classData.classNum}}</td> |
492 | <td class="text-xs-center">{{ props.item.sectionData.name }}</td> | 493 | <td class="text-xs-center">{{ props.item.sectionData.name }}</td> |
493 | <td class="text-xs-center"> | 494 | <td class="text-xs-center"> |
494 | <span> | 495 | <span> |
495 | <v-tooltip top> | 496 | <v-tooltip top> |
496 | <img | 497 | <img |
497 | slot="activator" | 498 | slot="activator" |
498 | style="cursor:pointer; width:20px; height:18px; " | 499 | style="cursor:pointer; width:20px; height:18px; " |
499 | class="mr5" | 500 | class="mr5" |
500 | @click="editItem(props.item)" | 501 | @click="editItem(props.item)" |
501 | src="/static/icon/edit1.png" | 502 | src="/static/icon/edit1.png" |
502 | /> | 503 | /> |
503 | <span>Edit</span> | 504 | <span>Edit</span> |
504 | </v-tooltip> | 505 | </v-tooltip> |
505 | <v-tooltip top> | 506 | <v-tooltip top> |
506 | <img | 507 | <img |
507 | slot="activator" | 508 | slot="activator" |
508 | style="cursor:pointer; width:20px; height:20px; " | 509 | style="cursor:pointer; width:20px; height:20px; " |
509 | class="mr5" | 510 | class="mr5" |
510 | @click="deleteItem(props.item)" | 511 | @click="deleteItem(props.item)" |
511 | src="/static/icon/delete1.png" | 512 | src="/static/icon/delete1.png" |
512 | /> | 513 | /> |
513 | <span>Delete</span> | 514 | <span>Delete</span> |
514 | </v-tooltip> | 515 | </v-tooltip> |
515 | <v-tooltip top> | 516 | <v-tooltip top> |
516 | <img | 517 | <img |
517 | slot="activator" | 518 | slot="activator" |
518 | style="cursor:pointer; width:20px; height:20px; " | 519 | style="cursor:pointer; width:20px; height:20px; " |
519 | src="/static/icon/add1.png" | 520 | src="/static/icon/add1.png" |
520 | @click="addSchedule(props.item._id)" | 521 | @click="addSchedule(props.item._id)" |
521 | /> | 522 | /> |
522 | <span>Add</span> | 523 | <span>Add</span> |
523 | </v-tooltip> | 524 | </v-tooltip> |
524 | <!-- <v-icon color="black" >add_circle_outline</v-icon> --> | ||
525 | </span> | 525 | </span> |
526 | </td> | 526 | </td> |
527 | </tr> | 527 | </tr> |
528 | </template> | 528 | </template> |
529 | <template slot="expand" slot-scope="props"> | 529 | <template slot="expand" slot-scope="props"> |
530 | <v-data-table | 530 | <v-data-table |
531 | :items="timeTableList.schedule" | 531 | :items="timeTableList.schedule" |
532 | hide-actions | 532 | hide-actions |
533 | item-key="title" | 533 | item-key="title" |
534 | style="width: auto;" | 534 | style="width: auto;" |
535 | > | 535 | > |
536 | <template slot="items" slot-scope="props"> | 536 | <template slot="items" slot-scope="props"> |
537 | <tr> | 537 | <tr> |
538 | <td class="text-xs-left subheading table-td"> | 538 | <td class="text-xs-left subheading table-td"> |
539 | <b>{{ props.item.day }}</b> | 539 | <b>{{ props.item.day }}</b> |
540 | </td> | 540 | </td> |
541 | <td class="table-td"> | 541 | <td class="table-td"> |
542 | <b>Subject</b> | 542 | <b>Subject</b> |
543 | <br /> | 543 | <br /> |
544 | <b>Time In</b> | 544 | <b>Time In</b> |
545 | <br /> | 545 | <br /> |
546 | <b>Time Out</b> | 546 | <b>Time Out</b> |
547 | </td> | 547 | </td> |
548 | <td v-for="list in props.item.lectures" class="table-td"> | 548 | <td v-for="list in props.item.lectures" class="table-td"> |
549 | <b>{{ list.subjectName }}</b> | 549 | <b>{{ list.subjectName }}</b> |
550 | <img | 550 | <img |
551 | style="cursor:pointer; width:20px; height:18px; " | 551 | style="cursor:pointer; width:20px; height:18px; " |
552 | class="mr-2 ml-2" | 552 | class="mr-2 ml-2" |
553 | src="/static/icon/edit1.png" | 553 | src="/static/icon/edit1.png" |
554 | @click="updateTimeTable(list, timeTableList)" | 554 | @click="updateTimeTable(list, timeTableList)" |
555 | /> | 555 | /> |
556 | <img | 556 | <img |
557 | style="cursor:pointer; width:20px; height:20px; " | 557 | style="cursor:pointer; width:20px; height:20px; " |
558 | src="/static/icon/delete1.png" | 558 | src="/static/icon/delete1.png" |
559 | @click="deleteTimeTable(list,props.item.lectures)" | 559 | @click="deleteTimeTable(list,props.item.lectures)" |
560 | /> | 560 | /> |
561 | <br /> | 561 | <br /> |
562 | {{list.timeIn}} | 562 | {{list.timeIn}} |
563 | <br /> | 563 | <br /> |
564 | {{list.timeOut}} | 564 | {{list.timeOut}} |
565 | </td> | 565 | </td> |
566 | <td> | 566 | <td> |
567 | <v-tooltip top> | 567 | <v-tooltip top> |
568 | <v-icon | 568 | <v-icon |
569 | slot="activator" | 569 | slot="activator" |
570 | color="black" | 570 | color="black" |
571 | @click="addLecture(props.item._id, timeTableList._id)" | 571 | @click="addLecture(props.item._id, timeTableList._id)" |
572 | >add_circle_outline</v-icon> | 572 | >add_circle_outline</v-icon> |
573 | <span>Add</span> | 573 | <span>Add</span> |
574 | </v-tooltip> | 574 | </v-tooltip> |
575 | </td> | 575 | </td> |
576 | </tr> | 576 | </tr> |
577 | </template> | 577 | </template> |
578 | </v-data-table> | 578 | </v-data-table> |
579 | </template> | 579 | </template> |
580 | <v-alert | 580 | <v-alert |
581 | slot="no-results" | 581 | slot="no-results" |
582 | :value="true" | 582 | :value="true" |
583 | color="error" | 583 | color="error" |
584 | icon="warning" | 584 | icon="warning" |
585 | >Your search for "{{ search }}" found no results.</v-alert> | 585 | >Your search for "{{ search }}" found no results.</v-alert> |
586 | </v-data-table> | 586 | </v-data-table> |
587 | <br /> | 587 | <br /> |
588 | <br /> | 588 | <br /> |
589 | </v-flex> | 589 | </v-flex> |
590 | </v-tab-item> | 590 | </v-tab-item> |
591 | 591 | ||
592 | <!-- ****** ADD MULTIPLE TIME-TABLE ****** --> | 592 | <!-- ****** ADD MULTIPLE TIME-TABLE ****** --> |
593 | 593 | ||
594 | <v-tab-item> | 594 | <v-tab-item> |
595 | <v-container> | 595 | <v-container> |
596 | <v-snackbar | 596 | <v-snackbar |
597 | :timeout="timeout" | 597 | :timeout="timeout" |
598 | :top="y === 'top'" | 598 | :top="y === 'top'" |
599 | :right="x === 'right'" | 599 | :right="x === 'right'" |
600 | :vertical="mode === 'vertical'" | 600 | :vertical="mode === 'vertical'" |
601 | v-model="snackbar" | 601 | v-model="snackbar" |
602 | color="success" | 602 | color="success" |
603 | >{{ text }}</v-snackbar> | 603 | >{{ text }}</v-snackbar> |
604 | <v-flex xs12 sm12 class="my-5"> | 604 | <v-flex xs12 sm12 class="my-5"> |
605 | <v-card flat> | 605 | <v-card flat> |
606 | <v-form ref="form" v-model="valid" lazy-validation> | 606 | <v-form ref="form" v-model="valid" lazy-validation> |
607 | <v-container fluid class="pt-3"> | 607 | <v-container fluid class="pt-3"> |
608 | <v-flex xs12> | 608 | <v-flex xs12> |
609 | <v-layout> | 609 | <v-layout> |
610 | <v-flex xs4 class="pt-4 subheading"> | 610 | <v-flex xs4 class="pt-4 subheading"> |
611 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 611 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
612 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 612 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
613 | </v-flex> | 613 | </v-flex> |
614 | <v-flex xs8 sm4 class="ml-3"> | 614 | <v-flex xs8 sm4 class="ml-3"> |
615 | <v-select | 615 | <v-select |
616 | :items="addclass" | 616 | :items="addclass" |
617 | label="Select Class" | 617 | label="Select Class" |
618 | v-model="timeTable.select" | 618 | v-model="timeTable.select" |
619 | item-text="classNum" | 619 | item-text="classNum" |
620 | item-value="_id" | 620 | item-value="_id" |
621 | @change="getSections(timeTable.select)" | 621 | @change="getSections(timeTable.select)" |
622 | :rules="classRules" | ||
622 | required | 623 | required |
623 | ></v-select> | 624 | ></v-select> |
624 | </v-flex> | 625 | </v-flex> |
625 | </v-layout> | 626 | </v-layout> |
626 | </v-flex> | 627 | </v-flex> |
627 | <v-flex xs12> | 628 | <v-flex xs12> |
628 | <v-layout> | 629 | <v-layout> |
629 | <v-flex xs4 class="pt-4 subheading"> | 630 | <v-flex xs4 class="pt-4 subheading"> |
630 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> | 631 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> |
631 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> | 632 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> |
632 | </v-flex> | 633 | </v-flex> |
633 | <v-flex sm4 xs8 class="ml-3"> | 634 | <v-flex sm4 xs8 class="ml-3"> |
634 | <v-select | 635 | <v-select |
635 | :items="addSection" | 636 | :items="addSection" |
636 | label="Select Section" | 637 | label="Select Section" |
637 | v-model="timeTable.selectSection" | 638 | v-model="timeTable.selectSection" |
638 | item-text="name" | 639 | item-text="name" |
639 | item-value="_id" | 640 | item-value="_id" |
641 | :rules="sectionRules" | ||
640 | required | 642 | required |
641 | ></v-select> | 643 | ></v-select> |
642 | </v-flex> | 644 | </v-flex> |
643 | </v-layout> | 645 | </v-layout> |
644 | </v-flex> | 646 | </v-flex> |
645 | <v-flex xs12> | 647 | <v-flex xs12> |
646 | <v-layout> | 648 | <v-layout> |
647 | <v-flex xs4 class="pt-4 subheading"> | 649 | <v-flex xs4 class="pt-4 subheading"> |
648 | <label class="right hidden-xs-only hidden-sm-only">Select Teacher:</label> | 650 | <label class="right hidden-xs-only hidden-sm-only">Select Teacher:</label> |
649 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Teacher:</label> | 651 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Teacher:</label> |
650 | </v-flex> | 652 | </v-flex> |
651 | <v-flex xs8 sm4 class="ml-3"> | 653 | <v-flex xs8 sm4 class="ml-3"> |
652 | <v-select | 654 | <v-select |
653 | :items="addTeachers" | 655 | :items="addTeachers" |
654 | label="Select Teacher" | 656 | label="Select Teacher" |
655 | v-model="timeTable.selectTeacher" | 657 | v-model="timeTable.selectTeacher" |
656 | item-text="name" | 658 | item-text="name" |
657 | item-value="_id" | 659 | item-value="_id" |
660 | :rules="teacherRules" | ||
658 | required | 661 | required |
659 | ></v-select> | 662 | ></v-select> |
660 | </v-flex> | 663 | </v-flex> |
661 | </v-layout> | 664 | </v-layout> |
662 | </v-flex> | 665 | </v-flex> |
663 | <v-flex xs12> | 666 | <v-flex xs12> |
664 | <v-layout> | 667 | <v-layout> |
665 | <v-flex xs4 class="pt-4 subheading"> | 668 | <v-flex xs4 class="pt-4 subheading"> |
666 | <label class="right">Select Day:</label> | 669 | <label class="right">Select Day:</label> |
667 | </v-flex> | 670 | </v-flex> |
668 | <v-flex xs8 sm4 class="ml-3"> | 671 | <v-flex xs8 sm4 class="ml-3"> |
669 | <v-select | 672 | <v-select |
670 | :items="addOneDay" | 673 | :items="addOneDay" |
671 | label="Select Day" | 674 | label="Select Day" |
672 | v-model="timeTable.selectDay" | 675 | v-model="timeTable.selectDay" |
676 | :rules="dayRules" | ||
673 | item-text="name" | 677 | item-text="name" |
674 | item-value="_id" | 678 | item-value="_id" |
675 | required | 679 | required |
676 | ></v-select> | 680 | ></v-select> |
677 | </v-flex> | 681 | </v-flex> |
678 | </v-layout> | 682 | </v-layout> |
679 | </v-flex> | 683 | </v-flex> |
680 | <v-flex xs12> | 684 | <v-flex xs12> |
681 | <v-layout> | 685 | <v-layout> |
682 | <v-flex xs4 class="pt-4 subheading"> | 686 | <v-flex xs4 class="pt-4 subheading"> |
683 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> | 687 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> |
684 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> | 688 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> |
685 | </v-flex> | 689 | </v-flex> |
686 | <v-flex xs8 sm4 class="ml-3"> | 690 | <v-flex xs8 sm4 class="ml-3"> |
687 | <v-text-field | 691 | <v-text-field |
688 | placeholder="fill your Subject Name" | 692 | placeholder="fill your Subject Name" |
689 | :rules="subjectNameRules" | 693 | :rules="subjectNameRules" |
690 | v-model="timeTable.subjectName" | 694 | v-model="timeTable.subjectName" |
691 | type="text" | 695 | type="text" |
692 | required | 696 | required |
693 | ></v-text-field> | 697 | ></v-text-field> |
694 | </v-flex> | 698 | </v-flex> |
695 | </v-layout> | 699 | </v-layout> |
696 | </v-flex> | 700 | </v-flex> |
697 | <v-flex xs12> | 701 | <v-flex xs12> |
698 | <v-layout> | 702 | <v-layout> |
699 | <v-flex xs4 class="pt-4 subheading"> | 703 | <v-flex xs4 class="pt-4 subheading"> |
700 | <label class="right">Time In:</label> | 704 | <label class="right">Time In:</label> |
701 | </v-flex> | 705 | </v-flex> |
702 | <v-flex xs8 sm4 class="ml-3"> | 706 | <v-flex xs8 sm4 class="ml-3"> |
703 | <v-menu | 707 | <v-menu |
704 | ref="menuA" | 708 | ref="menuA" |
705 | :close-on-content-click="false" | 709 | :close-on-content-click="false" |
706 | v-model="menu2" | 710 | v-model="menu2" |
707 | :nudge-right="40" | 711 | :nudge-right="40" |
708 | :return-value.sync="timeTable.timeIn" | 712 | :return-value.sync="timeTable.timeIn" |
709 | lazy | 713 | lazy |
710 | transition="scale-transition" | 714 | transition="scale-transition" |
711 | offset-y | 715 | offset-y |
712 | full-width | 716 | full-width |
713 | max-width="290px" | 717 | max-width="290px" |
714 | min-width="290px" | 718 | min-width="290px" |
715 | > | 719 | > |
716 | <v-text-field | 720 | <v-text-field |
717 | slot="activator" | 721 | slot="activator" |
718 | v-model="timeTable.timeIn" | 722 | v-model="timeTable.timeIn" |
719 | label="Select your timeIn" | 723 | label="Select your timeIn" |
720 | append-icon="access_time" | 724 | append-icon="access_time" |
725 | :rules="timeInRules" | ||
721 | ></v-text-field> | 726 | ></v-text-field> |
722 | <v-time-picker | 727 | <v-time-picker |
723 | v-model="timeTable.timeIn" | 728 | v-model="timeTable.timeIn" |
724 | @change="$refs.menuA.save(timeTable.timeIn)" | 729 | @change="$refs.menuA.save(timeTable.timeIn)" |
725 | ></v-time-picker> | 730 | ></v-time-picker> |
726 | </v-menu> | 731 | </v-menu> |
727 | </v-flex> | 732 | </v-flex> |
728 | </v-layout> | 733 | </v-layout> |
729 | </v-flex> | 734 | </v-flex> |
730 | <v-flex xs12> | 735 | <v-flex xs12> |
731 | <v-layout> | 736 | <v-layout> |
732 | <v-flex xs4 class="pt-4 subheading"> | 737 | <v-flex xs4 class="pt-4 subheading"> |
733 | <label class="right">Time Out:</label> | 738 | <label class="right">Time Out:</label> |
734 | </v-flex> | 739 | </v-flex> |
735 | <v-flex xs8 sm4 class="ml-3"> | 740 | <v-flex xs8 sm4 class="ml-3"> |
736 | <v-menu | 741 | <v-menu |
737 | ref="menu" | 742 | ref="menu" |
738 | :close-on-content-click="false" | 743 | :close-on-content-click="false" |
739 | v-model="menu1" | 744 | v-model="menu1" |
740 | :nudge-right="40" | 745 | :nudge-right="40" |
741 | :return-value.sync="timeTable.timeOut" | 746 | :return-value.sync="timeTable.timeOut" |
742 | lazy | 747 | lazy |
743 | transition="scale-transition" | 748 | transition="scale-transition" |
744 | offset-y | 749 | offset-y |
745 | full-width | 750 | full-width |
746 | max-width="290px" | 751 | max-width="290px" |
747 | min-width="290px" | 752 | min-width="290px" |
748 | > | 753 | > |
749 | <v-text-field | 754 | <v-text-field |
750 | slot="activator" | 755 | slot="activator" |
751 | v-model="timeTable.timeOut" | 756 | v-model="timeTable.timeOut" |
752 | label="Select your Time Out" | 757 | label="Select your Time Out" |
753 | append-icon="access_time" | 758 | append-icon="access_time" |
759 | :rules="timeOutRules" | ||
754 | ></v-text-field> | 760 | ></v-text-field> |
755 | <v-time-picker | 761 | <v-time-picker |
756 | v-model="timeTable.timeOut" | 762 | v-model="timeTable.timeOut" |
757 | @change="$refs.menu.save(timeTable.timeOut)" | 763 | @change="$refs.menu.save(timeTable.timeOut)" |
758 | ></v-time-picker> | 764 | ></v-time-picker> |
759 | </v-menu> | 765 | </v-menu> |
760 | </v-flex> | 766 | </v-flex> |
761 | </v-layout> | 767 | </v-layout> |
762 | </v-flex> | 768 | </v-flex> |
763 | <v-layout> | 769 | <v-layout> |
764 | <v-flex xs12 sm12> | 770 | <v-flex xs12 sm12> |
765 | <v-layout> | 771 | <v-layout> |
766 | <v-flex xs4 md4 class="ml-4"> | 772 | <v-flex xs4 md4 class="ml-4"> |
767 | <v-btn @click="clear" round class="right" dark>clear</v-btn> | 773 | <v-btn @click="clear" round class="right" dark>clear</v-btn> |
768 | </v-flex> | 774 | </v-flex> |
769 | <v-flex xs8 sm5 md4> | 775 | <v-flex xs8 sm5 md4> |
770 | <v-btn @click="submit" round dark :loading="loading" class="right">Add</v-btn> | 776 | <v-btn @click="submit" round dark :loading="loading" class="right">Add</v-btn> |
771 | </v-flex> | 777 | </v-flex> |
772 | </v-layout> | 778 | </v-layout> |
773 | </v-flex> | 779 | </v-flex> |
774 | </v-layout> | 780 | </v-layout> |
775 | </v-container> | 781 | </v-container> |
776 | </v-form> | 782 | </v-form> |
777 | </v-card> | 783 | </v-card> |
778 | </v-flex> | 784 | </v-flex> |
779 | </v-container> | 785 | </v-container> |
780 | </v-tab-item> | 786 | </v-tab-item> |
781 | </v-tabs> | 787 | </v-tabs> |
782 | <div class="loader" v-if="showLoader"> | 788 | <div class="loader" v-if="showLoader"> |
783 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 789 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
784 | </div> | 790 | </div> |
785 | </v-app> | 791 | </v-app> |
786 | </template> | 792 | </template> |
787 | <script> | 793 | <script> |
788 | import http from "@/Services/http.js"; | 794 | import http from "@/Services/http.js"; |
789 | import Util from "@/util"; | 795 | import Util from "@/util"; |
790 | 796 | ||
791 | export default { | 797 | export default { |
792 | data: () => ({ | 798 | data: () => ({ |
793 | y: "top", | 799 | y: "top", |
794 | x: "right", | 800 | x: "right", |
795 | mode: "", | 801 | mode: "", |
796 | timeout: 3000, | 802 | timeout: 3000, |
797 | text: "", | 803 | text: "", |
798 | search: "", | 804 | search: "", |
799 | snackbar: false, | 805 | snackbar: false, |
800 | loading: false, | 806 | loading: false, |
801 | showLoader: false, | 807 | showLoader: false, |
802 | dialog: false, | 808 | dialog: false, |
803 | dialogAddLecture: false, | 809 | dialogAddLecture: false, |
804 | dialogUpdateLectures: false, | 810 | dialogUpdateLectures: false, |
805 | dialogSchedule: false, | 811 | dialogSchedule: false, |
806 | dialog1: false, | 812 | dialog1: false, |
807 | valid: true, | 813 | valid: true, |
814 | validAddDay: true, | ||
808 | isActive: true, | 815 | isActive: true, |
809 | newActive: false, | 816 | newActive: false, |
817 | loadingFindData: false, | ||
810 | addclass: [], | 818 | addclass: [], |
811 | addSection: [], | 819 | addSection: [], |
812 | addTeachers: [], | 820 | addTeachers: [], |
813 | gender: ["Male", "Female"], | 821 | gender: ["Male", "Female"], |
814 | AddUsercredentials: {}, | 822 | AddUsercredentials: {}, |
815 | pagination: { | 823 | pagination: { |
816 | rowsPerPage: 15 | 824 | rowsPerPage: 15 |
817 | }, | 825 | }, |
818 | imageData: {}, | 826 | imageData: {}, |
819 | imageName: "", | 827 | imageName: "", |
820 | imageUrl: "", | 828 | imageUrl: "", |
821 | imageFile: "", | 829 | imageFile: "", |
822 | timeInRules: [v => !!v || "Time In is required"], | 830 | timeInRules: [v => !!v || "Time In is required"], |
823 | timeOutRules: [v => !!v || "Time Out is required"], | 831 | timeOutRules: [v => !!v || "Time Out is required"], |
824 | lectureRules: [v => !!v || "Lecture No is required"], | 832 | lectureRules: [v => !!v || "Lecture No is required"], |
825 | subjectNameRules: [v => !!v || "Subject Name is required"], | 833 | subjectNameRules: [v => !!v || "Subject Name is required"], |
834 | classRules: [v => !!v || "Class Name is required"], | ||
835 | sectionRules: [v => !!v || "Section Name is required"], | ||
836 | sectionRules: [v => !!v || "Section Name is required"], | ||
837 | teacherRules: [v => !!v || "Teacher Name is required"], | ||
838 | selecDayRule: [v => !!v || "Day is required"], | ||
839 | dayRules: [v => !!v || "Day is required"], | ||
826 | getParticulerLecture: "", | 840 | getParticulerLecture: "", |
827 | headers: [ | 841 | headers: [ |
828 | { | 842 | { |
829 | text: "No", | 843 | text: "No", |
830 | align: "center", | 844 | align: "center", |
831 | sortable: false, | 845 | sortable: false, |
832 | value: "No" | 846 | value: "No" |
833 | }, | 847 | }, |
834 | { | 848 | { |
835 | text: "Class Name", | 849 | text: "Class Name", |
836 | value: "classData.classNum", | 850 | value: "classData.classNum", |
837 | sortable: false, | 851 | sortable: false, |
838 | align: "center" | 852 | align: "center" |
839 | }, | 853 | }, |
840 | { | 854 | { |
841 | text: "Section Name", | 855 | text: "Section Name", |
842 | value: "sectionData.name", | 856 | value: "sectionData.name", |
843 | sortable: false, | 857 | sortable: false, |
844 | align: "center" | 858 | align: "center" |
845 | }, | 859 | }, |
846 | { text: "Action", value: "", sortable: false, align: "center" } | 860 | { text: "Action", value: "", sortable: false, align: "center" } |
847 | ], | 861 | ], |
848 | daysHeaders: [ | 862 | daysHeaders: [ |
849 | { text: "Day", value: "dayday", sortable: false, align: "center" }, | 863 | { text: "Day", value: "dayday", sortable: false, align: "center" }, |
850 | { | 864 | { |
851 | text: "Subject Name", | 865 | text: "Subject Name", |
852 | value: "subjectName", | 866 | value: "subjectName", |
853 | sortable: false, | 867 | sortable: false, |
854 | align: "center" | 868 | align: "center" |
855 | }, | 869 | }, |
856 | { text: "Time In", value: "timeIn", sortable: false, align: "center" }, | 870 | { text: "Time In", value: "timeIn", sortable: false, align: "center" }, |
857 | { text: "Time Out", value: "timeOut", sortable: false, align: "center" } | 871 | { text: "Time Out", value: "timeOut", sortable: false, align: "center" } |
858 | ], | 872 | ], |
859 | addOneDay: [ | 873 | addOneDay: [ |
860 | "Monday", | 874 | "Monday", |
861 | "Tuesday", | 875 | "Tuesday", |
862 | "Wednesday", | 876 | "Wednesday", |
863 | "Thursday", | 877 | "Thursday", |
864 | "Friday", | 878 | "Friday", |
865 | "Saturday", | 879 | "Saturday", |
866 | "Sunday" | 880 | "Sunday" |
867 | ], | 881 | ], |
868 | schedule: { | 882 | schedule: { |
869 | selectDay: "" | 883 | selectDay: "" |
870 | }, | 884 | }, |
871 | desserts: [], | 885 | desserts: [], |
872 | timeTableList: [], | 886 | timeTableList: [], |
873 | editedIndex: -1, | 887 | editedIndex: -1, |
874 | selectTimeTable: { | 888 | selectTimeTable: { |
875 | select: "", | 889 | select: "", |
876 | selectSection: "" | 890 | selectSection: "" |
877 | }, | 891 | }, |
878 | timeTable: { | 892 | timeTable: { |
879 | select: "", | 893 | select: "", |
880 | selectSection: "", | 894 | selectSection: "", |
881 | selectDay: "", | 895 | selectDay: "", |
882 | timeIn: null, | 896 | timeIn: null, |
883 | timeOut: null, | 897 | timeOut: null, |
884 | subjectName: "", | 898 | subjectName: "", |
885 | selectTeacher: "" | 899 | selectTeacher: "" |
886 | }, | 900 | }, |
887 | editedItem: { | 901 | editedItem: { |
888 | classNum: "", | 902 | classNum: "", |
889 | selectSection: "" | 903 | selectSection: "" |
890 | }, | 904 | }, |
891 | addlectures: { | 905 | addlectures: { |
892 | timeIn: null, | 906 | timeIn: null, |
893 | timeOut: null, | 907 | timeOut: null, |
894 | subjectName: "", | 908 | subjectName: "", |
895 | teacherId: "", | 909 | teacherId: "", |
896 | scheduleId: "", | 910 | scheduleId: "", |
897 | timeTableId: "" | 911 | timeTableId: "" |
898 | }, | 912 | }, |
899 | updateLectures: { | 913 | updateLectures: { |
900 | timeIn: null, | 914 | timeIn: null, |
901 | timeOut: null, | 915 | timeOut: null, |
902 | subjectName: "", | 916 | subjectName: "", |
903 | teacherId: "" | 917 | teacherId: "" |
904 | }, | 918 | }, |
905 | updateLecturesId: { | 919 | updateLecturesId: { |
906 | lectureId: "", | 920 | lectureId: "", |
907 | scheduleId: "" | 921 | scheduleId: "" |
908 | }, | 922 | }, |
909 | menu1: false, | 923 | menu1: false, |
910 | menu2: false, | 924 | menu2: false, |
911 | menu3: false, | 925 | menu3: false, |
912 | menu4: false, | 926 | menu4: false, |
913 | menu5: false, | 927 | menu5: false, |
914 | menu6: false, | 928 | menu6: false, |
915 | scheduleDayId: "" | 929 | scheduleDayId: "" |
916 | }), | 930 | }), |
917 | methods: { | 931 | methods: { |
918 | findTimeTable() { | 932 | findTimeTable() { |
933 | this.loadingFindData = true; | ||
919 | http() | 934 | http() |
920 | .get("/getParticularClassTimeTable", { | 935 | .get("/getParticularClassTimeTable", { |
921 | params: { | 936 | params: { |
922 | sectionId: this.selectTimeTable.selectSection, | 937 | sectionId: this.selectTimeTable.selectSection, |
923 | classId: this.selectTimeTable.select | 938 | classId: this.selectTimeTable.select |
924 | } | 939 | } |
925 | }) | 940 | }) |
926 | .then(response => { | 941 | .then(response => { |
927 | this.desserts = response.data.data; | 942 | this.desserts = response.data.data; |
943 | this.loadingFindData = false; | ||
928 | }) | 944 | }) |
929 | .catch(error => { | 945 | .catch(error => { |
930 | if ((this.snackbar = true)) { | 946 | this.loadingFindData = false; |
931 | this.text = error.response.data.message; | 947 | this.snackbar = true; |
932 | this.text = error.response.data.statusText; | 948 | this.text = error.response.data.message; |
933 | } | 949 | this.text = error.response.data.statusText; |
934 | }); | 950 | }); |
935 | }, | 951 | }, |
936 | getSections(_id) { | 952 | getSections(_id) { |
937 | var token = this.$store.state.token; | 953 | var token = this.$store.state.token; |
938 | http() | 954 | http() |
939 | .get( | 955 | .get( |
940 | "/getSectionsList", | 956 | "/getSectionsList", |
941 | { params: { classId: _id } }, | 957 | { params: { classId: _id } }, |
942 | { | 958 | { |
943 | headers: { Authorization: "Bearer " + token } | 959 | headers: { Authorization: "Bearer " + token } |
944 | } | 960 | } |
945 | ) | 961 | ) |
946 | .then(response => { | 962 | .then(response => { |
947 | this.addSection = response.data.data; | 963 | this.addSection = response.data.data; |
948 | }) | 964 | }) |
949 | .catch(err => { | 965 | .catch(err => { |
950 | // console.log("err====>", err); | 966 | // console.log("err====>", err); |
951 | }); | 967 | }); |
952 | }, | 968 | }, |
953 | getTimeTable(item) { | 969 | getTimeTable(item) { |
954 | this.showLoader = true; | 970 | this.showLoader = true; |
955 | this.getParticulerLecture = item._id; | 971 | this.getParticulerLecture = item._id; |
972 | this.getTimeTableDayData(); | ||
973 | }, | ||
974 | getTimeTableDayData() { | ||
956 | var token = this.$store.state.token; | 975 | var token = this.$store.state.token; |
957 | http() | 976 | http() |
958 | .get( | 977 | .get( |
959 | "/getParticularTimeTable", | 978 | "/getParticularTimeTable", |
960 | { params: { timeTableId: item._id } }, | 979 | { params: { timeTableId: this.getParticulerLecture } }, |
961 | { | 980 | { |
962 | headers: { Authorization: "Bearer " + token } | 981 | headers: { Authorization: "Bearer " + token } |
963 | } | 982 | } |
964 | ) | 983 | ) |
965 | .then(response => { | 984 | .then(response => { |
966 | this.timeTableList = response.data.data; | 985 | this.timeTableList = response.data.data; |
967 | this.showLoader = false; | 986 | this.showLoader = false; |
968 | }) | 987 | }) |
969 | .catch(err => { | 988 | .catch(err => { |
970 | this.showLoader = false; | 989 | this.showLoader = false; |
971 | // console.log("err====>", err); | 990 | // console.log("err====>", err); |
972 | }); | 991 | }); |
973 | }, | 992 | }, |
974 | pickFile() { | 993 | pickFile() { |
975 | this.$refs.image.click(); | 994 | this.$refs.image.click(); |
976 | }, | 995 | }, |
977 | 996 | ||
978 | onFilePicked(e) { | 997 | onFilePicked(e) { |
979 | const files = e.target.files; | 998 | const files = e.target.files; |
980 | this.imageData.upload = e.target.files[0]; | 999 | this.imageData.upload = e.target.files[0]; |
981 | if (files[0] !== undefined) { | 1000 | if (files[0] !== undefined) { |
982 | this.imageName = files[0].name; | 1001 | this.imageName = files[0].name; |
983 | if (this.imageName.lastIndexOf(".") <= 0) { | 1002 | if (this.imageName.lastIndexOf(".") <= 0) { |
984 | return; | 1003 | return; |
985 | } | 1004 | } |
986 | const fr = new FileReader(); | 1005 | const fr = new FileReader(); |
987 | fr.readAsDataURL(files[0]); | 1006 | fr.readAsDataURL(files[0]); |
988 | fr.addEventListener("load", () => { | 1007 | fr.addEventListener("load", () => { |
989 | this.imageUrl = fr.result; | 1008 | this.imageUrl = fr.result; |
990 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 1009 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
991 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 1010 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
992 | }); | 1011 | }); |
993 | } else { | 1012 | } else { |
994 | this.imageName = ""; | 1013 | this.imageName = ""; |
995 | this.imageFile = ""; | 1014 | this.imageFile = ""; |
996 | this.imageUrl = ""; | 1015 | this.imageUrl = ""; |
997 | } | 1016 | } |
998 | }, | 1017 | }, |
999 | // getTimeTableList() { | 1018 | // getTimeTableList() { |
1000 | // this.showLoader = true; | 1019 | // this.showLoader = true; |
1001 | // var token = this.$store.state.token; | 1020 | // var token = this.$store.state.token; |
1002 | // http() | 1021 | // http() |
1003 | // .get("/getTimeTablesList", { | 1022 | // .get("/getTimeTablesList", { |
1004 | // headers: { Authorization: "Bearer " + token } | 1023 | // headers: { Authorization: "Bearer " + token } |
1005 | // }) | 1024 | // }) |
1006 | // .then(response => { | 1025 | // .then(response => { |
1007 | // this.desserts = response.data.data; | 1026 | // this.desserts = response.data.data; |
1008 | // this.showLoader = false; | 1027 | // this.showLoader = false; |
1009 | // // console.log("getTimeTableList=====>", response.data.data); | 1028 | // // console.log("getTimeTableList=====>", response.data.data); |
1010 | // }) | 1029 | // }) |
1011 | // .catch(err => { | 1030 | // .catch(err => { |
1012 | // // console.log("err====>", err); | 1031 | // // console.log("err====>", err); |
1013 | // this.showLoader = false; | 1032 | // this.showLoader = false; |
1014 | // this.$router.replace({ path: "/" }); | 1033 | // this.$router.replace({ path: "/" }); |
1015 | // }); | 1034 | // }); |
1016 | // }, | 1035 | // }, |
1017 | editItem(item) { | 1036 | editItem(item) { |
1018 | this.editedIndex = this.desserts.indexOf(item); | 1037 | this.editedIndex = this.desserts.indexOf(item); |
1019 | this.editedItem = Object.assign({}, item); | 1038 | this.editedItem = Object.assign({}, item); |
1020 | this.dialog = true; | 1039 | this.dialog = true; |
1021 | }, | 1040 | }, |
1022 | updateTimeTable(timeToUpdate, classToUpdate) { | 1041 | updateTimeTable(timeToUpdate, classToUpdate) { |
1023 | console.log( | 1042 | // console.log( |
1024 | "timeToUpdate, classToUpdate", | 1043 | // "timeToUpdate, classToUpdate", |
1025 | timeToUpdate._id, | 1044 | // timeToUpdate._id, |
1026 | classToUpdate.schedule | 1045 | // classToUpdate.schedule |
1027 | ); | 1046 | // ); |
1028 | for (let i = 0; i < classToUpdate.schedule.length; i++) { | 1047 | for (let i = 0; i < classToUpdate.schedule.length; i++) { |
1029 | this.updateLecturesId.scheduleId = classToUpdate.schedule[i]._id; | 1048 | this.updateLecturesId.scheduleId = classToUpdate.schedule[i]._id; |
1030 | } | 1049 | } |
1031 | (this.updateLecturesId.lectureId = timeToUpdate._id), | 1050 | (this.updateLecturesId.lectureId = timeToUpdate._id), |
1032 | (this.updateLectures = timeToUpdate); | 1051 | (this.updateLectures = timeToUpdate); |
1033 | this.dialogUpdateLectures = true; | 1052 | this.dialogUpdateLectures = true; |
1034 | }, | 1053 | }, |
1035 | addLecture(scheduleId, timeTableId) { | 1054 | addLecture(scheduleId, timeTableId) { |
1036 | this.addlectures.scheduleId = scheduleId; | 1055 | this.addlectures.scheduleId = scheduleId; |
1037 | this.addlectures.timeTableId = timeTableId; | 1056 | this.addlectures.timeTableId = timeTableId; |
1038 | this.dialogAddLecture = true; | 1057 | this.dialogAddLecture = true; |
1039 | }, | 1058 | }, |
1040 | AddLecture() { | 1059 | AddLecture() { |
1041 | if (this.$refs.lectureForm.validate()) { | 1060 | if (this.$refs.lectureForm.validate()) { |
1042 | http() | 1061 | http() |
1043 | .post("/addLecture", this.addlectures) | 1062 | .post("/addLecture", this.addlectures) |
1044 | .then(response => { | 1063 | .then(response => { |
1045 | this.snackbar = true; | 1064 | this.snackbar = true; |
1046 | this.text = "New Add Lecture successfully"; | 1065 | this.text = "New Add Lecture successfully"; |
1047 | var token = this.$store.state.token; | 1066 | var token = this.$store.state.token; |
1048 | http() | 1067 | http() |
1049 | .get( | 1068 | .get( |
1050 | "/getParticularTimeTable", | 1069 | "/getParticularTimeTable", |
1051 | { params: { timeTableId: this.getParticulerLecture } }, | 1070 | { params: { timeTableId: this.getParticulerLecture } }, |
1052 | { | 1071 | { |
1053 | headers: { Authorization: "Bearer " + token } | 1072 | headers: { Authorization: "Bearer " + token } |
1054 | } | 1073 | } |
1055 | ) | 1074 | ) |
1056 | .then(response => { | 1075 | .then(response => { |
1057 | this.timeTableList = response.data.data; | 1076 | this.timeTableList = response.data.data; |
1058 | this.showLoader = false; | 1077 | this.showLoader = false; |
1059 | }) | 1078 | }) |
1060 | .catch(err => { | 1079 | .catch(err => { |
1061 | this.showLoader = false; | 1080 | this.showLoader = false; |
1062 | // console.log("err====>", err); | 1081 | // console.log("err====>", err); |
1063 | }); | 1082 | }); |
1064 | this.closedialogLecture(); | 1083 | this.closedialogLecture(); |
1065 | this.clearLeactureData(); | 1084 | this.clearLeactureData(); |
1066 | }) | 1085 | }) |
1067 | .catch(error => { | 1086 | .catch(error => { |
1068 | this.snackbar = true; | 1087 | this.snackbar = true; |
1069 | this.text = error.response.data.message; | 1088 | this.text = error.response.data.message; |
1070 | this.text = error.response.data.statusText; | 1089 | this.text = error.response.data.statusText; |
1071 | }); | 1090 | }); |
1072 | } | 1091 | } |
1073 | }, | 1092 | }, |
1074 | updateParticularTable() { | 1093 | updateParticularTable() { |
1075 | let EditLecture = { | 1094 | let EditLecture = { |
1076 | lectureId: this.updateLecturesId.lectureId, | 1095 | lectureId: this.updateLecturesId.lectureId, |
1077 | scheduleId: this.updateLecturesId.scheduleId, | 1096 | scheduleId: this.updateLecturesId.scheduleId, |
1078 | updatedLecture: { | 1097 | updatedLecture: { |
1079 | timeIn: this.updateLectures.timeIn, | 1098 | timeIn: this.updateLectures.timeIn, |
1080 | timeOut: this.updateLectures.timeOut, | 1099 | timeOut: this.updateLectures.timeOut, |
1081 | subjectName: this.updateLectures.subjectName, | 1100 | subjectName: this.updateLectures.subjectName, |
1082 | teacherId: this.updateLectures.teacherId | 1101 | teacherId: this.updateLectures.teacherId |
1083 | } | 1102 | } |
1084 | }; | 1103 | }; |
1085 | http() | 1104 | http() |
1086 | .put("/updateLecture", EditLecture) | 1105 | .put("/updateLecture", EditLecture) |
1087 | .then(response => { | 1106 | .then(response => { |
1088 | console.log("updateLecture", EditLecture); | 1107 | console.log("updateLecture", EditLecture); |
1089 | if ((this.snackbar = true)) { | 1108 | if ((this.snackbar = true)) { |
1090 | this.text = "Successfully Edit Update Lecture"; | 1109 | this.text = "Successfully Edit Update Lecture"; |
1091 | } | 1110 | } |
1092 | this.closeUpdateLectures(); | 1111 | this.closeUpdateLectures(); |
1093 | }) | 1112 | }) |
1094 | .catch(error => { | 1113 | .catch(error => { |
1095 | // console.log(error); | 1114 | // console.log(error); |
1096 | if ((this.snackbar = true)) { | 1115 | if ((this.snackbar = true)) { |
1097 | this.text = error.response.data.message; | 1116 | this.text = error.response.data.message; |
1098 | this.text = error.response.data.statusText; | 1117 | this.text = error.response.data.statusText; |
1099 | } | 1118 | } |
1100 | }); | 1119 | }); |
1101 | }, | 1120 | }, |
1102 | deleteItem(item) { | 1121 | deleteItem(item) { |
1103 | let deleteTimeTable = { | 1122 | let deleteTimeTable = { |
1104 | timeTableId: item._id | 1123 | timeTableId: item._id |
1105 | }; | 1124 | }; |
1106 | http() | 1125 | http() |
1107 | .delete( | 1126 | .delete( |
1108 | "/deleteTimeTable", | 1127 | "/deleteTimeTable", |
1109 | confirm("Are you sure you want to delete this?") && { | 1128 | confirm("Are you sure you want to delete this?") && { |
1110 | params: deleteTimeTable | 1129 | params: deleteTimeTable |
1111 | } | 1130 | } |
1112 | ) | 1131 | ) |
1113 | .then(response => { | 1132 | .then(response => { |
1114 | // console.log("deleteUers",deleteTimeTable) | 1133 | // console.log("deleteUers",deleteTimeTable) |
1115 | this.snackbar = true; | 1134 | this.snackbar = true; |
1116 | this.text = "Successfully delete Existing Time Table"; | 1135 | this.text = "Successfully delete Existing Time Table"; |
1117 | this.findTimeTable(); | 1136 | this.findTimeTable(); |
1118 | }) | 1137 | }) |
1119 | .catch(error => { | 1138 | .catch(error => { |
1120 | // console.log(error); | 1139 | // console.log(error); |
1121 | }); | 1140 | }); |
1122 | }, | 1141 | }, |
1123 | activeTab(type) { | 1142 | activeTab(type) { |
1124 | switch (type) { | 1143 | switch (type) { |
1125 | case "existing": | 1144 | case "existing": |
1126 | this.newActive = false; | 1145 | this.newActive = false; |
1127 | this.isActive = true; | 1146 | this.isActive = true; |
1128 | break; | 1147 | break; |
1129 | 1148 | ||
1130 | default: | 1149 | default: |
1131 | this.newActive = true; | 1150 | this.newActive = true; |
1132 | this.isActive = false; | 1151 | this.isActive = false; |
1133 | break; | 1152 | break; |
1134 | } | 1153 | } |
1135 | }, | 1154 | }, |
1136 | close() { | 1155 | close() { |
1137 | this.dialog = false; | 1156 | this.dialog = false; |
1138 | setTimeout(() => { | ||
1139 | this.editedItem = Object.assign({}, this.defaultItem); | ||
1140 | this.editedIndex = -1; | ||
1141 | }, 300); | ||
1142 | }, | 1157 | }, |
1143 | close1() { | 1158 | close1() { |
1144 | this.dialog1 = false; | 1159 | this.dialog1 = false; |
1145 | }, | 1160 | }, |
1146 | closedialogLecture() { | 1161 | closedialogLecture() { |
1147 | this.dialogAddLecture = false; | 1162 | this.dialogAddLecture = false; |
1148 | }, | 1163 | }, |
1149 | closeUpdateLectures() { | 1164 | closeUpdateLectures() { |
1150 | this.dialogUpdateLectures = false; | 1165 | this.dialogUpdateLectures = false; |
1151 | }, | 1166 | }, |
1152 | submit() { | 1167 | submit() { |
1153 | if (this.$refs.form.validate()) { | 1168 | if (this.$refs.form.validate()) { |
1154 | let imageData = new FormData(); | 1169 | let imageData = new FormData(); |
1155 | imageData.append("upload", this.imageFile); | 1170 | imageData.append("upload", this.imageFile); |
1156 | let addTimeTable = { | 1171 | let addTimeTable = { |
1157 | sectionId: this.timeTable.selectSection, | 1172 | sectionId: this.timeTable.selectSection, |
1158 | classId: this.timeTable.select, | 1173 | classId: this.timeTable.select, |
1159 | schedule: [ | 1174 | schedule: [ |
1160 | { | 1175 | { |
1161 | day: this.timeTable.selectDay, | 1176 | day: this.timeTable.selectDay, |
1162 | lectures: [ | 1177 | lectures: [ |
1163 | { | 1178 | { |
1164 | timeIn: this.timeTable.timeIn, | 1179 | timeIn: this.timeTable.timeIn, |
1165 | timeOut: this.timeTable.timeOut, | 1180 | timeOut: this.timeTable.timeOut, |
1166 | subjectName: this.timeTable.subjectName, | 1181 | subjectName: this.timeTable.subjectName, |
1167 | teacherId: this.timeTable.selectTeacher | 1182 | teacherId: this.timeTable.selectTeacher |
1168 | } | 1183 | } |
1169 | ] | 1184 | ] |
1170 | } | 1185 | } |
1171 | ] | 1186 | ] |
1172 | }; | 1187 | }; |
1173 | this.loading = true; | 1188 | this.loading = true; |
1174 | http() | 1189 | http() |
1175 | .post("/createTimeTable", addTimeTable) | 1190 | .post("/createTimeTable", addTimeTable) |
1176 | .then(response => { | 1191 | .then(response => { |
1177 | // console.log("addTimeTable=====>", addTimeTable); | 1192 | // console.log("addTimeTable=====>", addTimeTable); |
1178 | if ((this.snackbar = true)) { | 1193 | if ((this.snackbar = true)) { |
1179 | this.text = "New Time Table added successfully"; | 1194 | this.text = "New Time Table added successfully"; |
1180 | } | 1195 | } |
1181 | this.clear(); | 1196 | this.clear(); |
1182 | this.loading = false; | 1197 | this.loading = false; |
1183 | }) | 1198 | }) |
1184 | .catch(error => { | 1199 | .catch(error => { |
1185 | // console.log(error); | 1200 | // console.log(error); |
1186 | if ((this.snackbar = true)) { | 1201 | if ((this.snackbar = true)) { |
1187 | this.text = error.response.data.message; | 1202 | this.text = error.response.data.message; |
1188 | } | 1203 | } |
1189 | this.loading = false; | 1204 | this.loading = false; |
1190 | }); | 1205 | }); |
1191 | } | 1206 | } |
1192 | }, | 1207 | }, |
1193 | clear() { | 1208 | clear() { |
1194 | this.$refs.form.reset(); | 1209 | this.$refs.form.reset(); |
1195 | }, | 1210 | }, |
1196 | clearLeactureData() { | 1211 | clearLeactureData() { |
1197 | this.$refs.lectureForm.reset(); | 1212 | this.$refs.lectureForm.reset(); |
1198 | }, | 1213 | }, |
1199 | save() { | 1214 | save() { |
1200 | let imageData = new FormData(); | 1215 | let imageData = new FormData(); |
1201 | imageData.append("upload", this.imageFile); | 1216 | imageData.append("upload", this.imageFile); |
1202 | // console.log(imageData); | 1217 | // console.log(imageData); |
1203 | let editTimeTable = { | 1218 | let editTimeTable = { |
1204 | timeTableId: this.editedItem._id, | 1219 | timeTableId: this.editedItem._id, |
1205 | classId: this.editedItem.classNum, | 1220 | classId: this.editedItem.classNum, |
1206 | sectionId: this.editedItem.selectSection | 1221 | sectionId: this.editedItem.selectSection |
1207 | // imageData | 1222 | // imageData |
1208 | }; | 1223 | }; |
1209 | http() | 1224 | http() |
1210 | .put("/updateTimeTable", editTimeTable) | 1225 | .put("/updateTimeTable", editTimeTable) |
1211 | .then(response => { | 1226 | .then(response => { |
1212 | console.log("editTimeTable", editTimeTable); | 1227 | console.log("editTimeTable", editTimeTable); |
1213 | if ((this.snackbar = true)) { | 1228 | if ((this.snackbar = true)) { |
1214 | this.text = "Successfully Edit Existing Time Table"; | 1229 | this.text = "Successfully Edit Existing Time Table"; |
1215 | } | 1230 | } |
1216 | this.findTimeTable(); | 1231 | this.findTimeTable(); |
1217 | }) | 1232 | }) |
1218 | .catch(error => { | 1233 | .catch(error => { |
1219 | // console.log(error); | 1234 | // console.log(error); |
1220 | if ((this.snackbar = true)) { | 1235 | if ((this.snackbar = true)) { |
1221 | this.text = error.response.data.message; | 1236 | this.text = error.response.data.message; |
1222 | } | 1237 | } |
1223 | }); | 1238 | }); |
1224 | this.close(); | 1239 | this.close(); |
1225 | }, | 1240 | }, |
1226 | deleteTimeTable(timeToDelete, deleteLectures) { | 1241 | deleteTimeTable(timeToDelete, deleteLectures) { |
1227 | let deleteLecture = { | 1242 | let deleteLecture = { |
1228 | lectureId: timeToDelete._id | 1243 | lectureId: timeToDelete._id |
1229 | }; | 1244 | }; |
1230 | http() | 1245 | http() |
1231 | .delete( | 1246 | .delete( |
1232 | "/deleteLecture", | 1247 | "/deleteLecture", |
1233 | confirm("Are you sure you want to delete this?") && { | 1248 | confirm("Are you sure you want to delete this?") && { |
1234 | params: deleteLecture | 1249 | params: deleteLecture |
1235 | } | 1250 | } |
1236 | ) | 1251 | ) |
1237 | .then(response => { | 1252 | .then(response => { |
1238 | if ((this.snackbar = true)) { | 1253 | if ((this.snackbar = true)) { |
1239 | this.text = "Successfully delete Existing User"; | 1254 | this.text = "Successfully delete Existing User"; |
1240 | } | 1255 | } |
1241 | const index = this.timeTableList.schedule.indexOf(deleteLectures); | 1256 | const index = this.timeTableList.schedule.indexOf(deleteLectures); |
1242 | for (let i = 0; i < this.timeTableList.schedule.length; i++) { | 1257 | for (let i = 0; i < this.timeTableList.schedule.length; i++) { |
1243 | this.timeTableList.schedule[i].lectures.splice(index, 1); | 1258 | this.timeTableList.schedule[i].lectures.splice(index, 1); |
1244 | } | 1259 | } |
1245 | }) | 1260 | }) |
1246 | .catch(error => { | 1261 | .catch(error => { |
1247 | console.log(error); | 1262 | console.log(error); |
1248 | }); | 1263 | }); |
1249 | }, | 1264 | }, |
1250 | addSchedule(id) { | 1265 | addSchedule(id) { |
1251 | this.scheduleDayId = id; | 1266 | this.scheduleDayId = id; |
1252 | this.dialogSchedule = true; | 1267 | this.dialogSchedule = true; |
1253 | }, | 1268 | }, |
1254 | submitSchedule() { | 1269 | submitSchedule() { |
1255 | let scheduleDayData = { | 1270 | if (this.$refs.formAddDay.validate()) { |
1256 | timeTableId: this.scheduleDayId, | 1271 | let scheduleDayData = { |
1257 | day: this.schedule.selectDay | 1272 | timeTableId: this.scheduleDayId, |
1258 | }; | 1273 | day: this.schedule.selectDay |
1259 | http() | 1274 | }; |
1260 | .post("/addSchedule", scheduleDayData) | 1275 | http() |
1261 | .then(response => { | 1276 | .post("/addSchedule", scheduleDayData) |
1262 | if ((this.snackbar = true)) { | 1277 | .then(response => { |
1278 | this.snackbar = true; | ||
1263 | this.text = "New Schedule Day added successfully"; | 1279 | this.text = "New Schedule Day added successfully"; |
1264 | } | 1280 | this.dialogSchedule = false; |
1265 | this.dialogSchedule = true; | 1281 | this.loading = false; |
1266 | this.loading = false; | 1282 | this.getTimeTableDayData(); |
1267 | }) | 1283 | }) |
1268 | .catch(error => { | 1284 | .catch(error => { |
1269 | // console.log(error); | 1285 | // console.log(error); |
1270 | if ((this.snackbar = true)) { | 1286 | this.snackbar = true; |
1271 | this.text = error.response.data.message; | 1287 | this.text = error.response.data.message; |
1272 | } | 1288 | this.loading = false; |
1273 | this.loading = false; | 1289 | }); |
1274 | }); | 1290 | } |
1275 | } | 1291 | } |
1276 | }, | 1292 | }, |
1277 | mounted() { | 1293 | mounted() { |
1278 | // this.getTimeTableList(); | 1294 | // this.getTimeTableList(); |
1279 | var token = this.$store.state.token; | 1295 | var token = this.$store.state.token; |
1280 | http() | 1296 | http() |
1281 | .get("/getClassesList", { | 1297 | .get("/getClassesList", { |
1282 | headers: { Authorization: "Bearer " + token } | 1298 | headers: { Authorization: "Bearer " + token } |
1283 | }) | 1299 | }) |
1284 | .then(response => { | 1300 | .then(response => { |
1285 | this.addclass = response.data.data; | 1301 | this.addclass = response.data.data; |
1286 | // console.log("getClassesList=====>",this.addclass) | 1302 | // console.log("getClassesList=====>",this.addclass) |
1287 | }) | 1303 | }) |
1288 | .catch(error => { | 1304 | .catch(error => { |
1289 | this.showLoader = false; | 1305 | this.showLoader = false; |
1290 | if (error.response.status === 401) { | 1306 | if (error.response.status === 401) { |
1291 | this.$router.replace({ path: "/" }); | 1307 | this.$router.replace({ path: "/" }); |
1292 | this.$store.dispatch("setToken", null); | 1308 | this.$store.dispatch("setToken", null); |
1293 | this.$store.dispatch("Id", null); | 1309 | this.$store.dispatch("Id", null); |
1294 | this.$store.dispatch("Role", null); | 1310 | this.$store.dispatch("Role", null); |
1295 | } | 1311 | } |
1296 | }); | 1312 | }); |
1297 | 1313 | ||
1298 | http() | 1314 | http() |
1299 | .get("/getTeachersList", { | 1315 | .get("/getTeachersList", { |
1300 | headers: { Authorization: "Bearer " + token } | 1316 | headers: { Authorization: "Bearer " + token } |
1301 | }) | 1317 | }) |
1302 | .then(response => { | 1318 | .then(response => { |
1303 | this.addTeachers = response.data.data; | 1319 | this.addTeachers = response.data.data; |
1304 | // console.log("getClassesList=====>",this.addTeachers) | 1320 | // console.log("getClassesList=====>",this.addTeachers) |
1305 | }) | 1321 | }) |
1306 | .catch(error => { | 1322 | .catch(error => { |
1307 | this.showLoader = false; | 1323 | this.showLoader = false; |
1308 | if (error.response.status === 401) { | 1324 | if (error.response.status === 401) { |
1309 | this.$router.replace({ path: "/" }); | 1325 | this.$router.replace({ path: "/" }); |
1310 | this.$store.dispatch("setToken", null); | 1326 | this.$store.dispatch("setToken", null); |
1311 | this.$store.dispatch("Id", null); | 1327 | this.$store.dispatch("Id", null); |
1312 | this.$store.dispatch("Role", null); | 1328 | this.$store.dispatch("Role", null); |
1313 | } | 1329 | } |
1314 | }); | 1330 | }); |
1315 | }, | 1331 | }, |
1316 | created() { | 1332 | created() { |
1317 | this.$root.$on("app:search", search => { | 1333 | this.$root.$on("app:search", search => { |
1318 | this.search = search; | 1334 | this.search = search; |
1319 | }); | 1335 | }); |
1320 | }, | 1336 | }, |
1321 | beforeDestroy() { | 1337 | beforeDestroy() { |
1322 | // dont forget to remove the listener | 1338 | // dont forget to remove the listener |
1323 | this.$root.$off("app:search"); | 1339 | this.$root.$off("app:search"); |
1324 | } | 1340 | } |
1325 | }; | 1341 | }; |
1326 | </script> | 1342 | </script> |
1327 | <style scoped> | 1343 | <style scoped> |
1328 | .active { | 1344 | .active { |
1329 | background-color: gray; | 1345 | background-color: gray; |
1330 | color: white !important; | 1346 | color: white !important; |