Commit 8e8d14254aba599c809fbc97d4ad2c789a65389a
1 parent
52d274996e
Exists in
master
and in
2 other branches
Cleared data while clicking outside the add/edit model and also on cross icon wh…
…ile login any role, Improve getParticularClass API, and Improve getStudentWithClass API
Showing
39 changed files
with
1870 additions
and
1118 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 | <v-form ref="formEditAssignment" v-model="validEditAssignment" lazy-validation> | 13 | <v-form ref="formEditAssignment" v-model="validEditAssignment" lazy-validation> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex 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="ml-3"> | 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(editedItem.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(editedItem.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="showAssignment.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-if="showSearch"> | 224 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="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 | autofocus | 231 | autofocus |
232 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 232 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
233 | ></v-text-field> | 233 | ></v-text-field> |
234 | <v-icon @click="closeSearch" color="error">close</v-icon> | 234 | <v-icon @click="closeSearch" color="error">close</v-icon> |
235 | </v-layout> | 235 | </v-layout> |
236 | </v-flex> | 236 | </v-flex> |
237 | </v-toolbar> | 237 | </v-toolbar> |
238 | <v-data-table | 238 | <v-data-table |
239 | :headers="headers" | 239 | :headers="headers" |
240 | :items="assignmentData" | 240 | :items="assignmentData" |
241 | :pagination.sync="pagination" | 241 | :pagination.sync="pagination" |
242 | :search="search" | 242 | :search="search" |
243 | > | 243 | > |
244 | <template slot="items" slot-scope="props"> | 244 | <template slot="items" slot-scope="props"> |
245 | <tr class="tr"> | 245 | <tr class="tr"> |
246 | <td class="td-row td">{{ props.index + 1 }}</td> | 246 | <td class="td-row td">{{ props.index + 1 }}</td> |
247 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> | 247 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> |
248 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> | 248 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> |
249 | <td class="text-xs-center td td-row">{{ props.item.deadline }}</td> | 249 | <td class="text-xs-center td td-row">{{ props.item.deadline }}</td> |
250 | <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td> | 250 | <td class="text-xs-center td td-row">{{ props.item.sectionId.name }}</td> |
251 | <td | 251 | <td |
252 | class="text-xs-center td td-row" | 252 | class="text-xs-center td td-row" |
253 | v-if="role != 'TEACHER' " | 253 | v-if="role != 'TEACHER' " |
254 | >{{ props.item.teacherId.name }}</td> | 254 | >{{ props.item.teacherId.name }}</td> |
255 | <td | 255 | <td |
256 | class="text-xs-center td td-row" | 256 | class="text-xs-center td td-row" |
257 | v-if="role != 'ADMIN'" | 257 | v-if="role != 'ADMIN'" |
258 | >{{ props.item.schoolId .name }}</td> | 258 | >{{ props.item.schoolId .name }}</td> |
259 | <td class="text-xs-center td td-row"> | 259 | <td class="text-xs-center td td-row"> |
260 | <v-btn | 260 | <v-btn |
261 | class="add-button" | 261 | class="add-button" |
262 | @click="generatePDF2Canvas(props.item)" | 262 | @click="generatePDF2Canvas(props.item)" |
263 | :loading="loadingPdf" | 263 | :loading="loadingPdf" |
264 | dark | 264 | dark |
265 | >{{ props.item.fileType }}</v-btn> | 265 | >{{ props.item.fileType }}</v-btn> |
266 | </td> | 266 | </td> |
267 | <td class="text-xs-center td td-row"> | 267 | <td class="text-xs-center td td-row"> |
268 | <span> | 268 | <span> |
269 | <v-tooltip top> | 269 | <v-tooltip top> |
270 | <img | 270 | <img |
271 | slot="activator" | 271 | slot="activator" |
272 | style="cursor:pointer; width:25px; height:25px; " | 272 | style="cursor:pointer; width:25px; height:25px; " |
273 | class="mr-3" | 273 | class="mr-3" |
274 | @click="profile(props.item)" | 274 | @click="profile(props.item)" |
275 | src="/static/icon/view.png" | 275 | src="/static/icon/view.png" |
276 | /> | 276 | /> |
277 | <span>View</span> | 277 | <span>View</span> |
278 | </v-tooltip> | 278 | </v-tooltip> |
279 | <v-tooltip top> | 279 | <v-tooltip top> |
280 | <img | 280 | <img |
281 | slot="activator" | 281 | slot="activator" |
282 | style="cursor:pointer; width:20px; height:18px; " | 282 | style="cursor:pointer; width:20px; height:18px; " |
283 | class="mr-3" | 283 | class="mr-3" |
284 | @click="editItem(props.item)" | 284 | @click="editItem(props.item)" |
285 | src="/static/icon/edit.png" | 285 | src="/static/icon/edit.png" |
286 | /> | 286 | /> |
287 | <span>Edit</span> | 287 | <span>Edit</span> |
288 | </v-tooltip> | 288 | </v-tooltip> |
289 | <v-tooltip top> | 289 | <v-tooltip top> |
290 | <img | 290 | <img |
291 | slot="activator" | 291 | slot="activator" |
292 | style="cursor:pointer; width:20px; height:20px; " | 292 | style="cursor:pointer; width:20px; height:20px; " |
293 | class="mr-3" | 293 | class="mr-3" |
294 | @click="deleteItem(props.item)" | 294 | @click="deleteItem(props.item)" |
295 | src="/static/icon/delete.png" | 295 | src="/static/icon/delete.png" |
296 | /> | 296 | /> |
297 | <span>Delete</span> | 297 | <span>Delete</span> |
298 | </v-tooltip> | 298 | </v-tooltip> |
299 | </span> | 299 | </span> |
300 | </td> | 300 | </td> |
301 | </tr> | 301 | </tr> |
302 | </template> | 302 | </template> |
303 | <v-alert | 303 | <v-alert |
304 | slot="no-results" | 304 | slot="no-results" |
305 | :value="true" | 305 | :value="true" |
306 | color="error" | 306 | color="error" |
307 | icon="warning" | 307 | icon="warning" |
308 | >Your search for "{{ search }}" found no results.</v-alert> | 308 | >Your search for "{{ search }}" found no results.</v-alert> |
309 | </v-data-table> | 309 | </v-data-table> |
310 | <!-- ****** ADD MULTIPLE Subject ****** --> | 310 | <!-- ****** ADD MULTIPLE Subject ****** --> |
311 | <v-snackbar | 311 | <v-snackbar |
312 | :timeout="timeout" | 312 | :timeout="timeout" |
313 | :top="y === 'top'" | 313 | :top="y === 'top'" |
314 | :right="x === 'right'" | 314 | :right="x === 'right'" |
315 | :vertical="mode === 'vertical'" | 315 | :vertical="mode === 'vertical'" |
316 | v-model="snackbar" | 316 | v-model="snackbar" |
317 | :color="color" | 317 | :color="color" |
318 | >{{ text }}</v-snackbar> | 318 | >{{ text }}</v-snackbar> |
319 | <v-dialog v-model="addAssignmentDialog" max-width="400px"> | 319 | <v-dialog v-model="addAssignmentDialog" max-width="400px" v-if="addAssignmentDialog"> |
320 | <v-card flat class="card-style pa-2" dark> | 320 | <v-card flat class="card-style pa-2" dark> |
321 | <v-layout> | 321 | <v-layout> |
322 | <v-flex xs12> | 322 | <v-flex xs12> |
323 | <label class="title text-xs-center">Add Assignment</label> | 323 | <label class="title text-xs-center">Add Assignment</label> |
324 | <v-icon size="24" class="right" @click="addAssignmentDialog = false">cancel</v-icon> | 324 | <v-icon size="24" class="right" @click="closeAddAssignmentModel">cancel</v-icon> |
325 | </v-flex> | 325 | </v-flex> |
326 | </v-layout> | 326 | </v-layout> |
327 | <v-container fluid fill-height> | 327 | <v-container fluid fill-height> |
328 | <v-layout align-center> | 328 | <v-layout align-center> |
329 | <v-flex xs12> | 329 | <v-flex xs12> |
330 | <v-form ref="form" v-model="valid" lazy-validation> | 330 | <v-form ref="form" v-model="valid" lazy-validation> |
331 | <v-layout> | 331 | <v-layout> |
332 | <v-flex xs4 sm4 class="pt-4 subheading"> | 332 | <v-flex xs4 sm4 class="pt-4 subheading"> |
333 | <label class="right">Title :</label> | 333 | <label class="right">Title :</label> |
334 | </v-flex> | 334 | </v-flex> |
335 | <v-flex xs8 sm8 class="ml-3"> | 335 | <v-flex xs8 sm8 class="ml-3"> |
336 | <v-text-field | 336 | <v-text-field |
337 | name="name" | 337 | name="name" |
338 | type="text" | 338 | type="text" |
339 | placeholder="Select Title" | 339 | placeholder="Select Title" |
340 | :rules="titleRules" | 340 | :rules="titleRules" |
341 | v-model="addAssignment.title" | 341 | v-model="addAssignment.title" |
342 | required | 342 | required |
343 | ></v-text-field> | 343 | ></v-text-field> |
344 | </v-flex> | 344 | </v-flex> |
345 | </v-layout> | 345 | </v-layout> |
346 | <v-layout> | 346 | <v-layout> |
347 | <v-flex xs4 sm4 class="pt-4 subheading"> | 347 | <v-flex xs4 sm4 class="pt-4 subheading"> |
348 | <label class="right">Description :</label> | 348 | <label class="right">Description :</label> |
349 | </v-flex> | 349 | </v-flex> |
350 | <v-flex xs8 sm8 class="ml-3"> | 350 | <v-flex xs8 sm8 class="ml-3"> |
351 | <v-text-field | 351 | <v-text-field |
352 | name="name" | 352 | name="name" |
353 | type="text" | 353 | type="text" |
354 | placeholder="Select Description" | 354 | placeholder="Select Description" |
355 | :rules="descriptionRules" | 355 | :rules="descriptionRules" |
356 | v-model="addAssignment.description" | 356 | v-model="addAssignment.description" |
357 | required | 357 | required |
358 | ></v-text-field> | 358 | ></v-text-field> |
359 | </v-flex> | 359 | </v-flex> |
360 | </v-layout> | 360 | </v-layout> |
361 | <v-layout> | 361 | <v-layout> |
362 | <v-flex xs4 sm4 class="pt-4 subheading"> | 362 | <v-flex xs4 sm4 class="pt-4 subheading"> |
363 | <label class="right">Deadline :</label> | 363 | <label class="right">Deadline :</label> |
364 | </v-flex> | 364 | </v-flex> |
365 | <v-flex xs8 sm7 class="ml-3"> | 365 | <v-flex xs8 sm7 class="ml-3"> |
366 | <v-menu | 366 | <v-menu |
367 | ref="menu2" | 367 | ref="menu2" |
368 | :close-on-content-click="false" | 368 | :close-on-content-click="false" |
369 | v-model="menu2" | 369 | v-model="menu2" |
370 | :nudge-right="40" | 370 | :nudge-right="40" |
371 | :return-value.sync="addAssignment.date" | 371 | :return-value.sync="addAssignment.date" |
372 | lazy | 372 | lazy |
373 | transition="scale-transition" | 373 | transition="scale-transition" |
374 | offset-y | 374 | offset-y |
375 | full-width | 375 | full-width |
376 | min-width="290px" | 376 | min-width="290px" |
377 | > | 377 | > |
378 | <v-text-field | 378 | <v-text-field |
379 | slot="activator" | 379 | slot="activator" |
380 | v-model="addAssignment.deadline" | 380 | v-model="addAssignment.deadline" |
381 | :rules="deadlineRules" | 381 | :rules="deadlineRules" |
382 | placeholder="Select Date" | 382 | placeholder="Select Date" |
383 | append-icon="event" | 383 | append-icon="event" |
384 | readonly | 384 | readonly |
385 | ></v-text-field> | 385 | ></v-text-field> |
386 | <v-date-picker | 386 | <v-date-picker |
387 | v-model="addAssignment.deadline" | 387 | v-model="addAssignment.deadline" |
388 | @input="$refs.menu2.save(addAssignment.date)" | 388 | @input="$refs.menu2.save(addAssignment.date)" |
389 | ></v-date-picker> | 389 | ></v-date-picker> |
390 | </v-menu> | 390 | </v-menu> |
391 | </v-flex> | 391 | </v-flex> |
392 | </v-layout> | 392 | </v-layout> |
393 | <v-layout> | 393 | <v-layout> |
394 | <v-flex xs4 sm4 class="pt-4 subheading"> | 394 | <v-flex xs4 sm4 class="pt-4 subheading"> |
395 | <label class="right">Class :</label> | 395 | <label class="right">Class :</label> |
396 | </v-flex> | 396 | </v-flex> |
397 | <v-flex xs8 sm8 class="ml-3"> | 397 | <v-flex xs8 sm8 class="ml-3"> |
398 | <v-select | 398 | <v-select |
399 | :items="classList" | 399 | :items="classList" |
400 | placeholder="Select Class" | 400 | placeholder="Select Class" |
401 | item-text="classNum" | 401 | item-text="classNum" |
402 | item-value="_id" | 402 | item-value="_id" |
403 | v-model="addAssignment.classId" | 403 | v-model="addAssignment.classId" |
404 | name="Select Class" | 404 | name="Select Class" |
405 | :rules="classRules" | 405 | :rules="classRules" |
406 | @change="getSections(addAssignment.classId)" | 406 | @change="getSections(addAssignment.classId)" |
407 | class="pl-2" | 407 | class="pl-2" |
408 | required | 408 | required |
409 | ></v-select> | 409 | ></v-select> |
410 | </v-flex> | 410 | </v-flex> |
411 | </v-layout> | 411 | </v-layout> |
412 | <v-layout> | 412 | <v-layout> |
413 | <v-flex xs4 sm4 class="pt-4 subheading"> | 413 | <v-flex xs4 sm4 class="pt-4 subheading"> |
414 | <label class="right">Section :</label> | 414 | <label class="right">Section :</label> |
415 | </v-flex> | 415 | </v-flex> |
416 | <v-flex xs8 sm8 class="ml-3"> | 416 | <v-flex xs8 sm8 class="ml-3"> |
417 | <v-select | 417 | <v-select |
418 | :items="addSection" | 418 | :items="addSection" |
419 | placeholder="Select Section" | 419 | placeholder="Select Section" |
420 | item-text="name" | 420 | item-text="name" |
421 | item-value="_id" | 421 | item-value="_id" |
422 | v-model="addAssignment.sectionId" | 422 | v-model="addAssignment.sectionId" |
423 | name="Select Section" | 423 | name="Select Section" |
424 | :rules="sectionRules" | 424 | :rules="sectionRules" |
425 | @change="getClassSubject(addAssignment.classId)" | 425 | @change="getClassSubject(addAssignment.classId)" |
426 | class="px-2" | 426 | class="px-2" |
427 | required | 427 | required |
428 | ></v-select> | 428 | ></v-select> |
429 | </v-flex> | 429 | </v-flex> |
430 | </v-layout> | 430 | </v-layout> |
431 | <v-layout> | 431 | <v-layout> |
432 | <v-flex xs3 sm4 class="pt-4 subheading"> | 432 | <v-flex xs3 sm4 class="pt-4 subheading"> |
433 | <label class="right">Subject :</label> | 433 | <label class="right">Subject :</label> |
434 | </v-flex> | 434 | </v-flex> |
435 | <v-flex xs8 sm8 class="ml-2"> | 435 | <v-flex xs8 sm8 class="ml-2"> |
436 | <v-select | 436 | <v-select |
437 | :items="subjectList.subjects" | 437 | :items="subjectList.subjects" |
438 | placeholder="Select your subject" | 438 | placeholder="Select your subject" |
439 | v-model="addAssignment.subjectName" | 439 | v-model="addAssignment.subjectName" |
440 | item-text="subjectName" | 440 | item-text="subjectName" |
441 | item-value="_id" | 441 | item-value="_id" |
442 | :rules="subjectRules" | 442 | :rules="subjectRules" |
443 | required | 443 | required |
444 | ></v-select> | 444 | ></v-select> |
445 | </v-flex> | 445 | </v-flex> |
446 | </v-layout> | 446 | </v-layout> |
447 | <v-layout> | 447 | <v-layout> |
448 | <v-flex xs4 class="pt-4 subheading"> | 448 | <v-flex xs4 class="pt-4 subheading"> |
449 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> | 449 | <label class="right hidden-xs-only hidden-sm-only">Uplaod File:</label> |
450 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File:</label> | 450 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">File:</label> |
451 | </v-flex> | 451 | </v-flex> |
452 | <v-flex xs8 class="ml-3"> | 452 | <v-flex xs8 class="ml-3"> |
453 | <v-text-field | 453 | <v-text-field |
454 | placeholder="Select File" | 454 | placeholder="Select File" |
455 | @click="pickFile" | 455 | @click="pickFile" |
456 | v-model="imageName" | 456 | v-model="imageName" |
457 | append-icon="attach_file" | 457 | append-icon="attach_file" |
458 | ></v-text-field> | 458 | ></v-text-field> |
459 | <input | 459 | <input |
460 | type="file" | 460 | type="file" |
461 | style="display:none" | 461 | style="display:none" |
462 | ref="image" | 462 | ref="image" |
463 | accept="image/*" | 463 | accept="image/*" |
464 | @change="onFilePicked" | 464 | @change="onFilePicked" |
465 | /> | 465 | /> |
466 | </v-flex> | 466 | </v-flex> |
467 | </v-layout> | 467 | </v-layout> |
468 | <v-layout> | 468 | <v-layout> |
469 | <v-flex xs12 sm12> | 469 | <v-flex xs12 sm12> |
470 | <v-card-actions> | 470 | <v-card-actions> |
471 | <v-spacer></v-spacer> | 471 | <v-spacer></v-spacer> |
472 | <v-btn | 472 | <v-btn |
473 | @click="submit" | 473 | @click="submit" |
474 | round | 474 | round |
475 | dark | 475 | dark |
476 | :loading="loading" | 476 | :loading="loading" |
477 | class="add-button" | 477 | class="add-button" |
478 | >Add Assignment</v-btn> | 478 | >Add Assignment</v-btn> |
479 | </v-card-actions> | 479 | </v-card-actions> |
480 | </v-flex> | 480 | </v-flex> |
481 | </v-layout> | 481 | </v-layout> |
482 | </v-form> | 482 | </v-form> |
483 | </v-flex> | 483 | </v-flex> |
484 | </v-layout> | 484 | </v-layout> |
485 | </v-container> | 485 | </v-container> |
486 | </v-card> | 486 | </v-card> |
487 | </v-dialog> | 487 | </v-dialog> |
488 | <div class="loader" v-if="showLoader"> | 488 | <div class="loader" v-if="showLoader"> |
489 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 489 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
490 | </div> | 490 | </div> |
491 | </v-container> | 491 | </v-container> |
492 | </template> | 492 | </template> |
493 | 493 | ||
494 | <script> | 494 | <script> |
495 | import http from "@/Services/http.js"; | 495 | import http from "@/Services/http.js"; |
496 | import Util from "@/util"; | 496 | import Util from "@/util"; |
497 | import moment from "moment"; | 497 | import moment from "moment"; |
498 | import jsPDF from "jspdf"; | 498 | import jsPDF from "jspdf"; |
499 | import { saveAs } from "file-saver"; | 499 | import { saveAs } from "file-saver"; |
500 | 500 | ||
501 | export default { | 501 | export default { |
502 | data: () => ({ | 502 | data: () => ({ |
503 | snackbar: false, | 503 | snackbar: false, |
504 | role: "", | 504 | role: "", |
505 | menu1: false, | 505 | menu1: false, |
506 | menu2: false, | 506 | menu2: false, |
507 | y: "top", | 507 | y: "top", |
508 | x: "right", | 508 | x: "right", |
509 | mode: "", | 509 | mode: "", |
510 | timeout: 3000, | 510 | timeout: 3000, |
511 | text: "", | 511 | text: "", |
512 | color: "", | 512 | color: "", |
513 | show: true, | 513 | show: true, |
514 | showSearch: false, | 514 | showSearch: false, |
515 | showLoader: false, | 515 | showLoader: false, |
516 | loading: false, | 516 | loading: false, |
517 | editLoading: false, | 517 | editLoading: false, |
518 | date: null, | 518 | date: null, |
519 | search: "", | 519 | search: "", |
520 | viewAssignmentDialog: false, | 520 | viewAssignmentDialog: false, |
521 | editAssignmentDialog: false, | 521 | editAssignmentDialog: false, |
522 | valid: true, | 522 | valid: true, |
523 | validEditAssignment: true, | 523 | validEditAssignment: true, |
524 | addAssignmentDialog: false, | 524 | addAssignmentDialog: false, |
525 | 525 | ||
526 | pagination: { | 526 | pagination: { |
527 | rowsPerPage: 10, | 527 | rowsPerPage: 10, |
528 | }, | 528 | }, |
529 | token: "", | 529 | token: "", |
530 | headers: [ | 530 | headers: [ |
531 | { | 531 | { |
532 | text: "No", | 532 | text: "No", |
533 | align: "", | 533 | align: "", |
534 | sortable: false, | 534 | sortable: false, |
535 | value: "No", | 535 | value: "No", |
536 | }, | 536 | }, |
537 | { | 537 | { |
538 | text: "Title", | 538 | text: "Title", |
539 | value: "title", | 539 | value: "title", |
540 | sortable: false, | 540 | sortable: false, |
541 | align: "center", | 541 | align: "center", |
542 | }, | 542 | }, |
543 | { | 543 | { |
544 | text: "Description", | 544 | text: "Description", |
545 | value: "description", | 545 | value: "description", |
546 | sortable: false, | 546 | sortable: false, |
547 | align: "center", | 547 | align: "center", |
548 | }, | 548 | }, |
549 | { | 549 | { |
550 | text: "Deadline", | 550 | text: "Deadline", |
551 | value: "deadline", | 551 | value: "deadline", |
552 | sortable: false, | 552 | sortable: false, |
553 | align: "center", | 553 | align: "center", |
554 | }, | 554 | }, |
555 | { | 555 | { |
556 | text: "Section", | 556 | text: "Section", |
557 | value: "name", | 557 | value: "name", |
558 | sortable: false, | 558 | sortable: false, |
559 | align: "center", | 559 | align: "center", |
560 | }, | 560 | }, |
561 | { | 561 | { |
562 | text: "Uploader", | 562 | text: "Uploader", |
563 | value: "name", | 563 | value: "name", |
564 | sortable: false, | 564 | sortable: false, |
565 | align: "center", | 565 | align: "center", |
566 | }, | 566 | }, |
567 | { | 567 | { |
568 | text: "File", | 568 | text: "File", |
569 | value: "file", | 569 | value: "file", |
570 | sortable: false, | 570 | sortable: false, |
571 | align: "center", | 571 | align: "center", |
572 | }, | 572 | }, |
573 | { text: "Action", value: "", sortable: false, align: "center" }, | 573 | { text: "Action", value: "", sortable: false, align: "center" }, |
574 | ], | 574 | ], |
575 | 575 | ||
576 | showPdfData: false, | 576 | showPdfData: false, |
577 | loadingPdf: false, | 577 | loadingPdf: false, |
578 | hideData: true, | 578 | hideData: true, |
579 | 579 | ||
580 | assignmentData: [], | 580 | assignmentData: [], |
581 | subjectList: [], | 581 | subjectList: [], |
582 | classList: [], | 582 | classList: [], |
583 | addSection: [], | 583 | addSection: [], |
584 | editedIndex: -1, | 584 | editedIndex: -1, |
585 | addSubject: {}, | 585 | addSubject: {}, |
586 | 586 | ||
587 | editedItem: { | 587 | editedItem: { |
588 | title: "", | 588 | title: "", |
589 | description: "", | 589 | description: "", |
590 | deadline: "", | 590 | deadline: "", |
591 | classId: "", | 591 | classId: "", |
592 | sectionId: "", | 592 | sectionId: "", |
593 | subjectName: "", | 593 | subjectName: "", |
594 | fileType: "", | 594 | fileType: "", |
595 | }, | 595 | }, |
596 | addAssignment: {}, | 596 | addAssignment: {}, |
597 | showAssignment: {}, | 597 | showAssignment: {}, |
598 | 598 | ||
599 | imageData: {}, | 599 | imageData: {}, |
600 | imageName: "", | 600 | imageName: "", |
601 | imageUrl: "", | 601 | imageUrl: "", |
602 | imageFile: "", | 602 | imageFile: "", |
603 | 603 | ||
604 | titleRules: [(v) => !!v || " Title is required"], | 604 | titleRules: [(v) => !!v || " Title is required"], |
605 | descriptionRules: [(v) => !!v || " Description is required"], | 605 | descriptionRules: [(v) => !!v || " Description is required"], |
606 | deadlineRules: [(v) => !!v || " Deadline is required"], | 606 | deadlineRules: [(v) => !!v || " Deadline is required"], |
607 | classRules: [(v) => !!v || "Class is required"], | 607 | classRules: [(v) => !!v || "Class is required"], |
608 | sectionRules: [(v) => !!v || "Section is required"], | 608 | sectionRules: [(v) => !!v || "Section is required"], |
609 | subjectRules: [(v) => !!v || "Student is required"], | 609 | subjectRules: [(v) => !!v || "Student is required"], |
610 | fileRules: [(v) => !!v || "File is required"], | 610 | fileRules: [(v) => !!v || "File is required"], |
611 | }), | 611 | }), |
612 | watch: { | ||
613 | addAssignmentDialog: function (val) { | ||
614 | if (!val) { | ||
615 | this.addAssignment = []; | ||
616 | this.imageName = ""; | ||
617 | } | ||
618 | }, | ||
619 | }, | ||
612 | methods: { | 620 | methods: { |
613 | dates: function (date) { | 621 | dates: function (date) { |
614 | return moment(date).format("MMMM DD, YYYY"); | 622 | return moment(date).format("MMMM DD, YYYY"); |
615 | }, | 623 | }, |
616 | pickFile() { | 624 | pickFile() { |
617 | this.$refs.image.click(); | 625 | this.$refs.image.click(); |
618 | }, | 626 | }, |
619 | editItem(item) { | 627 | editItem(item) { |
620 | this.editedIndex = this.assignmentData; | 628 | this.editedIndex = this.assignmentData; |
621 | this.editedItem = Object.assign({}, item); | 629 | this.editedItem = Object.assign({}, item); |
622 | this.dialog = true; | 630 | this.dialog = true; |
623 | this.editAssignmentDialog = true; | 631 | this.editAssignmentDialog = true; |
624 | }, | 632 | }, |
625 | profile(item) { | 633 | profile(item) { |
626 | this.editedIndex = this.assignmentData; | 634 | this.editedIndex = this.assignmentData; |
627 | this.editedItem = Object.assign({}, item); | 635 | this.editedItem = Object.assign({}, item); |
628 | this.dialog1 = true; | 636 | this.dialog1 = true; |
629 | this.viewAssignmentDialog = true; | 637 | this.viewAssignmentDialog = true; |
630 | }, | 638 | }, |
631 | deleteItem(item) { | 639 | deleteItem(item) { |
632 | let deleteAssignment = { | 640 | let deleteAssignment = { |
633 | assignmentId: item._id, | 641 | assignmentId: item._id, |
634 | }; | 642 | }; |
635 | http() | 643 | http() |
636 | .delete( | 644 | .delete( |
637 | "/deleteAssignment", | 645 | "/deleteAssignment", |
638 | confirm("Are you sure you want to delete this?") && { | 646 | confirm("Are you sure you want to delete this?") && { |
639 | params: deleteAssignment, | 647 | params: deleteAssignment, |
640 | }, | 648 | }, |
641 | { | 649 | { |
642 | headers: { Authorization: "Bearer " + this.token }, | 650 | headers: { Authorization: "Bearer " + this.token }, |
643 | } | 651 | } |
644 | ) | 652 | ) |
645 | .then((response) => { | 653 | .then((response) => { |
646 | this.getAssignmentList(); | 654 | this.getAssignmentList(); |
647 | this.snackbar = true; | 655 | this.snackbar = true; |
648 | this.text = "Successfully delete Existing Assignment"; | 656 | this.text = "Successfully delete Existing Assignment"; |
649 | this.color = "green"; | 657 | this.color = "green"; |
650 | }) | 658 | }) |
651 | .catch((error) => { | 659 | .catch((error) => { |
652 | this.snackbar = true; | 660 | this.snackbar = true; |
653 | this.text = error.response.data.message; | 661 | this.text = error.response.data.message; |
654 | this.color = "error"; | 662 | this.color = "error"; |
655 | }); | 663 | }); |
656 | }, | 664 | }, |
657 | close() { | 665 | close() { |
658 | this.editAssignmentDialog = false; | 666 | this.editAssignmentDialog = false; |
659 | }, | 667 | }, |
660 | close1() { | 668 | close1() { |
661 | this.viewAssignmentDialog = false; | 669 | this.viewAssignmentDialog = false; |
662 | }, | 670 | }, |
671 | closeAddAssignmentModel() { | ||
672 | this.addAssignmentDialog = false; | ||
673 | this.assignmentData = []; | ||
674 | this.addAssignment = []; | ||
675 | this.imageName = ""; | ||
676 | }, | ||
663 | submit() { | 677 | submit() { |
664 | var addAssignment = { | 678 | var addAssignment = { |
665 | title: this.addAssignment.title, | 679 | title: this.addAssignment.title, |
666 | description: this.addAssignment.description, | 680 | description: this.addAssignment.description, |
667 | deadline: this.addAssignment.deadline, | 681 | deadline: this.addAssignment.deadline, |
668 | classId: this.addAssignment.classId, | 682 | classId: this.addAssignment.classId, |
669 | sectionId: this.addAssignment.sectionId, | 683 | sectionId: this.addAssignment.sectionId, |
670 | subjectName: this.addAssignment.subjectName, | 684 | subjectName: this.addAssignment.subjectName, |
671 | file: this.addAssignment.imageName, | 685 | file: this.addAssignment.imageName, |
672 | fileName: this.imageName, | 686 | fileName: this.imageName, |
673 | }; | 687 | }; |
674 | var signatures = { | 688 | var signatures = { |
675 | JVBERi0: "other", | 689 | JVBERi0: "other", |
676 | iVBORw0KGgo: "image", | 690 | iVBORw0KGgo: "image", |
677 | UEsDBBQ: "other", | 691 | UEsDBBQ: "other", |
678 | "/": "image", | 692 | "/": "image", |
679 | AAABAA: "image", | 693 | AAABAA: "image", |
680 | IywiV2hhdC: "other", | 694 | IywiV2hhdC: "other", |
681 | bmFtZSxl: "other", | 695 | bmFtZSxl: "other", |
682 | }; | 696 | }; |
683 | function detectMimeType(b64) { | 697 | function detectMimeType(b64) { |
684 | for (var s in signatures) { | 698 | for (var s in signatures) { |
685 | if (b64.indexOf(s) === 0) { | 699 | if (b64.indexOf(s) === 0) { |
686 | return signatures[s]; | 700 | return signatures[s]; |
687 | } | 701 | } |
688 | } | 702 | } |
689 | } | 703 | } |
690 | if (this.$refs.form.validate()) { | 704 | if (this.$refs.form.validate()) { |
691 | if (this.imageUrl) { | 705 | if (this.imageUrl) { |
692 | var str = this.imageUrl; | 706 | var str = this.imageUrl; |
693 | const [baseUrl, imageUrl] = str.split(/,/); | 707 | const [baseUrl, imageUrl] = str.split(/,/); |
694 | addAssignment.upload = imageUrl; | 708 | addAssignment.upload = imageUrl; |
695 | addAssignment.fileType = detectMimeType(imageUrl); | 709 | addAssignment.fileType = detectMimeType(imageUrl); |
696 | } | 710 | } |
697 | console.log("data===>", addAssignment); | 711 | console.log("data===>", addAssignment); |
698 | http() | 712 | http() |
699 | .post("/createAssignment", addAssignment) | 713 | .post("/createAssignment", addAssignment) |
700 | .then((response) => { | 714 | .then((response) => { |
701 | this.getAssignmentList(); | 715 | this.getAssignmentList(); |
702 | this.snackbar = true; | 716 | this.snackbar = true; |
703 | this.text = "Syllabus added successfully"; | 717 | this.text = "Syllabus added successfully"; |
704 | this.color = "green"; | 718 | this.color = "green"; |
705 | this.addAssignmentDialog = false; | 719 | this.addAssignmentDialog = false; |
706 | this.clear(); | 720 | this.clear(); |
707 | }) | 721 | }) |
708 | .catch((error) => { | 722 | .catch((error) => { |
709 | // console.log(error); | 723 | // console.log(error); |
710 | this.snackbar = true; | 724 | this.snackbar = true; |
711 | this.text = error.response.data.message; | 725 | this.text = error.response.data.message; |
712 | this.color = "red"; | 726 | this.color = "red"; |
713 | }); | 727 | }); |
714 | } | 728 | } |
715 | }, | 729 | }, |
716 | getAssignmentList() { | 730 | getAssignmentList() { |
717 | if (this.addAssignment.classId) { | 731 | if (this.addAssignment.classId) { |
718 | this.addAssignment.classId = this.addAssignment.classId; | 732 | this.addAssignment.classId = this.addAssignment.classId; |
719 | } | 733 | } |
720 | this.showLoader = true; | 734 | this.showLoader = true; |
721 | http() | 735 | http() |
722 | .get( | 736 | .get( |
723 | "/getAssignmentList", | 737 | "/getAssignmentList", |
724 | { | 738 | { |
725 | params: { classId: this.showAssignment.classId }, | 739 | params: { classId: this.showAssignment.classId }, |
726 | }, | 740 | }, |
727 | { | 741 | { |
728 | headers: { Authorization: "Bearer " + this.token }, | 742 | headers: { Authorization: "Bearer " + this.token }, |
729 | } | 743 | } |
730 | ) | 744 | ) |
731 | .then((response) => { | 745 | .then((response) => { |
732 | this.assignmentData = response.data.data; | 746 | this.assignmentData = response.data.data; |
733 | this.showLoader = false; | 747 | this.showLoader = false; |
734 | this.loadingSearch = false; | 748 | this.loadingSearch = false; |
735 | }) | 749 | }) |
736 | .catch((error) => { | 750 | .catch((error) => { |
737 | // console.log("err====>", err); | 751 | // console.log("err====>", err); |
738 | this.showLoader = false; | 752 | this.showLoader = false; |
739 | this.loadingSearch = false; | 753 | this.loadingSearch = false; |
740 | this.snackbar = true; | 754 | this.snackbar = true; |
741 | this.text = error.response.data.message; | 755 | this.text = error.response.data.message; |
742 | if (error.response.status === 401) { | 756 | if (error.response.status === 401) { |
743 | this.$router.replace({ path: "/" }); | 757 | this.$router.replace({ path: "/" }); |
744 | this.$store.dispatch("setToken", null); | 758 | this.$store.dispatch("setToken", null); |
745 | this.$store.dispatch("Id", null); | 759 | this.$store.dispatch("Id", null); |
746 | } | 760 | } |
747 | }); | 761 | }); |
748 | }, | 762 | }, |
749 | clear() { | 763 | clear() { |
750 | this.$refs.form.reset(); | 764 | this.$refs.form.reset(); |
751 | }, | 765 | }, |
752 | save() { | 766 | save() { |
753 | if (this.$refs.formEditAssignment.validate()) { | 767 | if (this.$refs.formEditAssignment.validate()) { |
754 | let editAssignment = { | 768 | let editAssignment = { |
755 | assignmentId: this.editedItem._id, | 769 | assignmentId: this.editedItem._id, |
756 | title: this.addAssignment.title, | 770 | title: this.addAssignment.title, |
757 | description: this.addAssignment.description, | 771 | description: this.addAssignment.description, |
758 | deadline: this.addAssignment.deadline, | 772 | deadline: this.addAssignment.deadline, |
759 | classId: this.addAssignment.classId, | 773 | classId: this.addAssignment.classId, |
760 | sectionId: this.addAssignment.sectionId, | 774 | sectionId: this.addAssignment.sectionId, |
761 | subjectName: this.addAssignment.subjectName, | 775 | subjectName: this.addAssignment.subjectName, |
762 | file: this.addAssignment.imageName, | 776 | file: this.addAssignment.imageName, |
763 | fileName: this.imageName, | 777 | fileName: this.imageName, |
764 | }; | 778 | }; |
765 | this.editLoading = true; | 779 | this.editLoading = true; |
766 | var signatures = { | 780 | var signatures = { |
767 | JVBERi0: "other", | 781 | JVBERi0: "other", |
768 | iVBORw0KGgo: "image", | 782 | iVBORw0KGgo: "image", |
769 | UEsDBBQ: "other", | 783 | UEsDBBQ: "other", |
770 | "/": "image", | 784 | "/": "image", |
771 | AAABAA: "image", | 785 | AAABAA: "image", |
772 | IywiV2hhdC: "other", | 786 | IywiV2hhdC: "other", |
773 | bmFtZSxl: "other", | 787 | bmFtZSxl: "other", |
774 | }; | 788 | }; |
775 | function detectMimeType(b64) { | 789 | function detectMimeType(b64) { |
776 | for (var s in signatures) { | 790 | for (var s in signatures) { |
777 | if (b64.indexOf(s) === 0) { | 791 | if (b64.indexOf(s) === 0) { |
778 | return signatures[s]; | 792 | return signatures[s]; |
779 | } | 793 | } |
780 | } | 794 | } |
781 | } | 795 | } |
782 | if (this.imageUrl) { | 796 | if (this.imageUrl) { |
783 | var str = this.imageUrl; | 797 | var str = this.imageUrl; |
784 | const [baseUrl, imageUrl] = str.split(/,/); | 798 | const [baseUrl, imageUrl] = str.split(/,/); |
785 | editAssignment.upload = imageUrl; | 799 | editAssignment.upload = imageUrl; |
786 | editAssignment.fileType = detectMimeType(imageUrl); | 800 | editAssignment.fileType = detectMimeType(imageUrl); |
787 | } | 801 | } |
788 | http() | 802 | http() |
789 | .put("/updateAssignment", editAssignment) | 803 | .put("/updateAssignment", editAssignment) |
790 | .then((response) => { | 804 | .then((response) => { |
791 | this.snackbar = true; | 805 | this.snackbar = true; |
792 | this.text = "Successfully Edit Existing Assignment"; | 806 | this.text = "Successfully Edit Existing Assignment"; |
793 | this.color = "green"; | 807 | this.color = "green"; |
794 | this.getAssignmentList(); | 808 | this.getAssignmentList(); |
795 | this.editLoading = false; | 809 | this.editLoading = false; |
796 | this.editAssignmentDialog = false; | 810 | this.editAssignmentDialog = false; |
797 | }) | 811 | }) |
798 | .catch((error) => { | 812 | .catch((error) => { |
799 | this.editLoading = false; | 813 | this.editLoading = false; |
800 | // console.log(error); | 814 | // console.log(error); |
801 | }); | 815 | }); |
802 | } | 816 | } |
803 | }, | 817 | }, |
804 | getClass() { | 818 | getClass() { |
805 | http() | 819 | http() |
806 | .get("/getClassesList", { | 820 | .get("/getClassesList", { |
807 | headers: { Authorization: "Bearer " + this.token }, | 821 | headers: { Authorization: "Bearer " + this.token }, |
808 | }) | 822 | }) |
809 | .then((response) => { | 823 | .then((response) => { |
810 | this.classList = response.data.data; | 824 | this.classList = response.data.data; |
811 | }) | 825 | }) |
812 | .catch((error) => { | 826 | .catch((error) => { |
813 | if (error.response.status === 401) { | 827 | if (error.response.status === 401) { |
814 | this.$router.replace({ path: "/" }); | 828 | this.$router.replace({ path: "/" }); |
815 | this.$store.dispatch("setToken", null); | 829 | this.$store.dispatch("setToken", null); |
816 | this.$store.dispatch("Id", null); | 830 | this.$store.dispatch("Id", null); |
817 | } | 831 | } |
818 | }); | 832 | }); |
819 | }, | 833 | }, |
820 | getSections(_id) { | 834 | getSections(_id) { |
821 | var token = this.$store.state.token; | 835 | var token = this.$store.state.token; |
822 | this.showLoader = true; | 836 | this.showLoader = true; |
823 | http() | 837 | http() |
824 | .get( | 838 | .get( |
825 | "/getSectionsList", | 839 | "/getSectionsList", |
826 | { params: { classId: _id } }, | 840 | { params: { classId: _id } }, |
827 | { | 841 | { |
828 | headers: { Authorization: "Bearer " + token }, | 842 | headers: { Authorization: "Bearer " + token }, |
829 | } | 843 | } |
830 | ) | 844 | ) |
831 | .then((response) => { | 845 | .then((response) => { |
832 | this.addSection = response.data.data; | 846 | this.addSection = response.data.data; |
833 | this.showLoader = false; | 847 | this.showLoader = false; |
834 | }) | 848 | }) |
835 | .catch((err) => { | 849 | .catch((err) => { |
836 | this.showLoader = false; | 850 | this.showLoader = false; |
837 | }); | 851 | }); |
838 | }, | 852 | }, |
839 | getClassSubject(_id) { | 853 | getClassSubject(_id) { |
840 | this.showLoader = true; | 854 | this.showLoader = true; |
841 | // this.classId = this.classId; | 855 | // this.classId = this.classId; |
842 | http() | 856 | http() |
843 | .get( | 857 | .get( |
844 | "/getParticularClass", | 858 | "/getParticularClass", |
845 | { params: { classId: _id } }, | 859 | { params: { classId: _id } }, |
846 | { | 860 | { |
847 | headers: { Authorization: "Bearer " + this.token }, | 861 | headers: { Authorization: "Bearer " + this.token }, |
848 | } | 862 | } |
849 | ) | 863 | ) |
850 | .then((response) => { | 864 | .then((response) => { |
851 | this.subjectList = response.data.data; | 865 | this.subjectList = response.data.data; |
852 | this.showLoader = false; | 866 | this.showLoader = false; |
853 | }) | 867 | }) |
854 | .catch((err) => { | 868 | .catch((err) => { |
855 | this.showLoader = false; | 869 | this.showLoader = false; |
856 | }); | 870 | }); |
857 | }, | 871 | }, |
858 | onFilePicked(e) { | 872 | onFilePicked(e) { |
859 | const files = e.target.files; | 873 | const files = e.target.files; |
860 | this.upload = e.target.files[0]; | 874 | this.upload = e.target.files[0]; |
861 | if (files[0] !== undefined) { | 875 | if (files[0] !== undefined) { |
862 | this.imageName = files[0].name; | 876 | this.imageName = files[0].name; |
863 | if (this.imageName.lastIndexOf(".") <= 0) { | 877 | if (this.imageName.lastIndexOf(".") <= 0) { |
864 | return; | 878 | return; |
865 | } | 879 | } |
866 | const fr = new FileReader(); | 880 | const fr = new FileReader(); |
867 | fr.readAsDataURL(files[0]); | 881 | fr.readAsDataURL(files[0]); |
868 | fr.addEventListener("load", () => { | 882 | fr.addEventListener("load", () => { |
869 | this.imageUrl = fr.result; | 883 | this.imageUrl = fr.result; |
870 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 884 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
871 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 885 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
872 | }); | 886 | }); |
873 | // console.log("this.imageName", this.imageName); | 887 | // console.log("this.imageName", this.imageName); |
874 | } else { | 888 | } else { |
875 | this.imageName = ""; | 889 | this.imageName = ""; |
876 | this.imageFile = ""; | 890 | this.imageFile = ""; |
877 | this.imageUrl = ""; | 891 | this.imageUrl = ""; |
878 | } | 892 | } |
879 | }, | 893 | }, |
880 | displaySearch() { | 894 | displaySearch() { |
881 | (this.show = false), (this.showSearch = true); | 895 | (this.show = false), (this.showSearch = true); |
882 | }, | 896 | }, |
883 | closeSearch() { | 897 | closeSearch() { |
884 | this.showSearch = false; | 898 | this.showSearch = false; |
885 | this.show = true; | 899 | this.show = true; |
886 | this.search = ""; | 900 | this.search = ""; |
887 | }, | 901 | }, |
888 | 902 | ||
889 | async generatePDF2Canvas(item) { | 903 | async generatePDF2Canvas(item) { |
890 | var dataType = ""; | 904 | var dataType = ""; |
891 | var type = ""; | 905 | var type = ""; |
892 | if (item.fileType == "image") { | 906 | if (item.fileType == "image") { |
893 | dataType = "file.jpg"; | 907 | dataType = "file.jpg"; |
894 | } else if (item.fileType == "other") { | 908 | } else if (item.fileType == "other") { |
895 | dataType = "file.pdf"; | 909 | dataType = "file.pdf"; |
896 | type = "application/pdf"; | 910 | type = "application/pdf"; |
897 | } | 911 | } |
898 | var FileSaver = require("file-saver"); | 912 | var FileSaver = require("file-saver"); |
899 | FileSaver.saveAs(item.file, "image.jpg"); | 913 | FileSaver.saveAs(item.file, "image.jpg"); |
900 | }, | 914 | }, |
901 | }, | 915 | }, |
902 | mounted() { | 916 | mounted() { |
903 | this.token = this.$store.state.token; | 917 | this.token = this.$store.state.token; |
904 | this.role = this.$store.state.role; | 918 | this.role = this.$store.state.role; |
905 | this.getClass(); | 919 | this.getClass(); |
906 | }, | 920 | }, |
907 | }; | 921 | }; |
908 | </script> | 922 | </script> |
src/pages/Academic/routine.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT Subject ****** --> | 3 | <!-- ****** EDIT Subject ****** --> |
4 | <v-dialog v-model="editRoutineDialog" max-width="600px" persistent> | 4 | <v-dialog v-model="editRoutineDialog" max-width="600px" persistent> |
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 Routine</label> | 8 | <label class="title text-xs-center">Edit Routine</label> |
9 | <v-icon size="24" class="right" @click="editRoutineDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editRoutineDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-container fluid> | 12 | <v-container fluid> |
13 | <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation> | 13 | <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs3 sm4 class="pt-4 subheading"> | 15 | <v-flex xs3 sm4 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 sm8 class="ml-2"> | 18 | <v-flex xs8 sm8 class="ml-2"> |
19 | <v-select | 19 | <v-select |
20 | :items="classList" | 20 | :items="classList" |
21 | label="Select your Class" | 21 | label="Select your Class" |
22 | v-model="editedItem.classId" | 22 | v-model="editedItem.classId" |
23 | item-text="classNum" | 23 | item-text="classNum" |
24 | item-value="_id" | 24 | item-value="_id" |
25 | :rules="classRules" | 25 | :rules="classRules" |
26 | @change="getClassSubject(addRoutine.classId)" | 26 | @change="getClassSubject(editedItem.classId)" |
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 xs3 sm4 class="pt-4 subheading"> | 32 | <v-flex xs3 sm4 class="pt-4 subheading"> |
33 | <label class="right">Subject :</label> | 33 | <label class="right">Subject :</label> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs8 sm8 class="ml-2"> | 35 | <v-flex xs8 sm8 class="ml-2"> |
36 | <v-select | 36 | <v-select |
37 | :items="subjectList.subjects" | 37 | :items="subjectList.subjects" |
38 | label="Select your subject" | 38 | label="Select your subject" |
39 | v-model="editedItem.subjectName" | 39 | v-model="editedItem.subjectName" |
40 | item-text="subjectName" | 40 | item-text="subjectName" |
41 | item-value="_id" | 41 | item-value="_id" |
42 | :rules="subjectRules" | 42 | :rules="subjectRules" |
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">Teacher Name :</label> | 49 | <label class="right">Teacher Name :</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="teacherList" | 53 | :items="teacherList" |
54 | label="Select your teacher" | 54 | label="Select your teacher" |
55 | v-model="editedItem.teacherId" | 55 | v-model="editedItem.teacherId" |
56 | item-text="name" | 56 | item-text="name" |
57 | item-value="_id" | 57 | item-value="_id" |
58 | :rules="teacherRules" | 58 | :rules="teacherRules" |
59 | required | 59 | required |
60 | ></v-select> | 60 | ></v-select> |
61 | </v-flex> | 61 | </v-flex> |
62 | </v-layout> | 62 | </v-layout> |
63 | <v-layout> | 63 | <v-layout> |
64 | <v-flex xs5 sm4 class="pt-4 subheading"> | 64 | <v-flex xs5 sm4 class="pt-4 subheading"> |
65 | <label class="right">Starting time:</label> | 65 | <label class="right">Starting time:</label> |
66 | </v-flex> | 66 | </v-flex> |
67 | <v-flex xs7 sm6 class="ml-3"> | 67 | <v-flex xs7 sm6 class="ml-3"> |
68 | <v-menu | 68 | <v-menu |
69 | ref="menuC" | 69 | ref="menuC" |
70 | :close-on-content-click="false" | 70 | :close-on-content-click="false" |
71 | v-model="menu4" | 71 | v-model="menu4" |
72 | :nudge-right="40" | 72 | :nudge-right="40" |
73 | lazy | 73 | lazy |
74 | transition="scale-transition" | 74 | transition="scale-transition" |
75 | offset-y | 75 | offset-y |
76 | full-width | 76 | full-width |
77 | max-width="290px" | 77 | max-width="290px" |
78 | min-width="290px" | 78 | min-width="290px" |
79 | > | 79 | > |
80 | <v-text-field | 80 | <v-text-field |
81 | slot="activator" | 81 | slot="activator" |
82 | v-model="editedItem.startingTime" | 82 | v-model="editedItem.startingTime" |
83 | placeholder="Select your starting time" | 83 | placeholder="Select your starting time" |
84 | append-icon="access_time" | 84 | append-icon="access_time" |
85 | readonly | 85 | readonly |
86 | ></v-text-field> | 86 | ></v-text-field> |
87 | <v-time-picker v-model="editedItem.startingTime" @change="menu4= false"></v-time-picker> | 87 | <v-time-picker v-model="editedItem.startingTime" @change="menu4= false"></v-time-picker> |
88 | </v-menu> | 88 | </v-menu> |
89 | </v-flex> | 89 | </v-flex> |
90 | </v-layout> | 90 | </v-layout> |
91 | <v-layout> | 91 | <v-layout> |
92 | <v-flex xs5 sm4 class="pt-4 subheading"> | 92 | <v-flex xs5 sm4 class="pt-4 subheading"> |
93 | <label class="right">Ending Time:</label> | 93 | <label class="right">Ending Time:</label> |
94 | </v-flex> | 94 | </v-flex> |
95 | <v-flex xs7 sm6 class="ml-3"> | 95 | <v-flex xs7 sm6 class="ml-3"> |
96 | <v-menu | 96 | <v-menu |
97 | ref="menuB" | 97 | ref="menuB" |
98 | :close-on-content-click="false" | 98 | :close-on-content-click="false" |
99 | v-model="menu3" | 99 | v-model="menu3" |
100 | :nudge-right="40" | 100 | :nudge-right="40" |
101 | lazy | 101 | lazy |
102 | transition="scale-transition" | 102 | transition="scale-transition" |
103 | offset-y | 103 | offset-y |
104 | full-width | 104 | full-width |
105 | max-width="290px" | 105 | max-width="290px" |
106 | min-width="290px" | 106 | min-width="290px" |
107 | > | 107 | > |
108 | <v-text-field | 108 | <v-text-field |
109 | slot="activator" | 109 | slot="activator" |
110 | v-model="editedItem.endingTime" | 110 | v-model="editedItem.endingTime" |
111 | placeholder="Select your end time" | 111 | placeholder="Select your end time" |
112 | append-icon="access_time" | 112 | append-icon="access_time" |
113 | readonly | 113 | readonly |
114 | ></v-text-field> | 114 | ></v-text-field> |
115 | <v-time-picker v-model="editedItem.endingTime" @change="menu3 = false"></v-time-picker> | 115 | <v-time-picker v-model="editedItem.endingTime" @change="menu3 = false"></v-time-picker> |
116 | </v-menu> | 116 | </v-menu> |
117 | </v-flex> | 117 | </v-flex> |
118 | </v-layout> | 118 | </v-layout> |
119 | <v-layout> | 119 | <v-layout> |
120 | <v-flex xs4 sm4 class="pt-4 subheading"> | 120 | <v-flex xs4 sm4 class="pt-4 subheading"> |
121 | <label class="right">Room:</label> | 121 | <label class="right">Room:</label> |
122 | </v-flex> | 122 | </v-flex> |
123 | <v-flex xs8 sm8 class="ml-3"> | 123 | <v-flex xs8 sm8 class="ml-3"> |
124 | <v-text-field | 124 | <v-text-field |
125 | label="fill your room" | 125 | label="fill your room" |
126 | :rules="roomRules" | 126 | :rules="roomRules" |
127 | v-model="editedItem.room" | 127 | v-model="editedItem.room" |
128 | @keyup.enter="submit" | 128 | @keyup.enter="submit" |
129 | ></v-text-field> | 129 | ></v-text-field> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | <v-layout> | 132 | <v-layout> |
133 | <v-flex xs4 sm4 class="pt-4 subheading"> | 133 | <v-flex xs4 sm4 class="pt-4 subheading"> |
134 | <label class="right">Period:</label> | 134 | <label class="right">Period:</label> |
135 | </v-flex> | 135 | </v-flex> |
136 | <v-flex xs8 sm8 class="ml-3"> | 136 | <v-flex xs8 sm8 class="ml-3"> |
137 | <v-text-field | 137 | <v-text-field |
138 | label="fill your period" | 138 | label="fill your period" |
139 | :rules="periodRules" | 139 | :rules="periodRules" |
140 | v-model="editedItem.period" | 140 | v-model="editedItem.period" |
141 | @keyup.enter="submit" | 141 | @keyup.enter="submit" |
142 | ></v-text-field> | 142 | ></v-text-field> |
143 | </v-flex> | 143 | </v-flex> |
144 | </v-layout> | 144 | </v-layout> |
145 | <v-layout> | 145 | <v-layout> |
146 | <v-flex xs12 sm12> | 146 | <v-flex xs12 sm12> |
147 | <v-card-actions> | 147 | <v-card-actions> |
148 | <v-spacer></v-spacer> | 148 | <v-spacer></v-spacer> |
149 | <v-btn | 149 | <v-btn |
150 | @click="update" | 150 | @click="update" |
151 | round | 151 | round |
152 | dark | 152 | dark |
153 | :loading="loading" | 153 | :loading="loading" |
154 | class="add-button" | 154 | class="add-button" |
155 | >Update Routine</v-btn> | 155 | >Update Routine</v-btn> |
156 | </v-card-actions> | 156 | </v-card-actions> |
157 | </v-flex> | 157 | </v-flex> |
158 | </v-layout> | 158 | </v-layout> |
159 | </v-form> | 159 | </v-form> |
160 | </v-container> | 160 | </v-container> |
161 | </v-card> | 161 | </v-card> |
162 | </v-dialog> | 162 | </v-dialog> |
163 | 163 | ||
164 | <!-- ****** EXISTING ROUTINE TABLE ****** --> | 164 | <!-- ****** EXISTING ROUTINE TABLE ****** --> |
165 | <v-toolbar color="transparent" flat> | 165 | <v-toolbar color="transparent" flat> |
166 | <v-btn | 166 | <v-btn |
167 | fab | 167 | fab |
168 | dark | 168 | dark |
169 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 169 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
170 | small | 170 | small |
171 | @click="addRoutineDialog = true" | 171 | @click="addRoutineDialog = true" |
172 | > | 172 | > |
173 | <v-icon dark>add</v-icon> | 173 | <v-icon dark>add</v-icon> |
174 | </v-btn> | 174 | </v-btn> |
175 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> | 175 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> |
176 | <v-btn | 176 | <v-btn |
177 | round | 177 | round |
178 | class="open-dialog-button" | 178 | class="open-dialog-button" |
179 | dark | 179 | dark |
180 | @click="addRoutineDialog = true" | 180 | @click="addRoutineDialog = true" |
181 | v-if="role != 'TEACHER' " | 181 | v-if="role != 'TEACHER' " |
182 | > | 182 | > |
183 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Routine | 183 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Routine |
184 | </v-btn> | 184 | </v-btn> |
185 | </v-flex> | 185 | </v-flex> |
186 | <v-spacer></v-spacer> | 186 | <v-spacer></v-spacer> |
187 | <v-flex lg2 md2 xs12 v-show="show"> | 187 | <v-flex lg2 md2 xs12 v-show="show"> |
188 | <v-select | 188 | <v-select |
189 | :items="classList" | 189 | :items="classList" |
190 | label="Select Your Class" | 190 | label="Select Your Class" |
191 | v-model="addRoutineList.classId" | 191 | v-model="addRoutineList.classId" |
192 | item-text="classNum" | 192 | item-text="classNum" |
193 | item-value="_id" | 193 | item-value="_id" |
194 | name="Select Class" | 194 | name="Select Class" |
195 | :rules="classRules" | 195 | :rules="classRules" |
196 | @change="getSections(addRoutineList.classId)" | 196 | @change="getSections(addRoutineList.classId)" |
197 | class="pl-2" | 197 | class="pl-2" |
198 | required | 198 | required |
199 | ></v-select> | 199 | ></v-select> |
200 | </v-flex> | 200 | </v-flex> |
201 | <v-flex xs8 sm3 md2 class="mr-3"> | 201 | <v-flex xs8 sm3 md2 class="mr-3"> |
202 | <v-select | 202 | <v-select |
203 | v-model="addRoutineList.sectionId" | 203 | v-model="addRoutineList.sectionId" |
204 | label="Select your section" | 204 | label="Select your section" |
205 | :items="addSection" | 205 | :items="addSection" |
206 | item-text="name" | 206 | item-text="name" |
207 | item-value="_id" | 207 | item-value="_id" |
208 | name="Select Section" | 208 | name="Select Section" |
209 | :rules="sectionRules" | 209 | :rules="sectionRules" |
210 | @change="getRoutineList()" | 210 | @change="getRoutineList()" |
211 | class="pl-2" | 211 | class="pl-2" |
212 | required | 212 | required |
213 | ></v-select> | 213 | ></v-select> |
214 | </v-flex> | 214 | </v-flex> |
215 | <v-card-title class="body-1" v-show="show"> | 215 | <v-card-title class="body-1" v-show="show"> |
216 | <v-btn icon flat @click="displaySearch"> | 216 | <v-btn icon flat @click="displaySearch"> |
217 | <v-avatar size="27"> | 217 | <v-avatar size="27"> |
218 | <img src="/static/icon/search.png" alt="icon" /> | 218 | <img src="/static/icon/search.png" alt="icon" /> |
219 | </v-avatar> | 219 | </v-avatar> |
220 | </v-btn> | 220 | </v-btn> |
221 | </v-card-title> | 221 | </v-card-title> |
222 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="showSearch"> | 222 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="showSearch"> |
223 | <v-layout> | 223 | <v-layout> |
224 | <v-text-field | 224 | <v-text-field |
225 | autofocus | 225 | autofocus |
226 | v-model="search" | 226 | v-model="search" |
227 | label="Search" | 227 | label="Search" |
228 | prepend-inner-icon="search" | 228 | prepend-inner-icon="search" |
229 | color="primary" | 229 | color="primary" |
230 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 230 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
231 | ></v-text-field> | 231 | ></v-text-field> |
232 | <v-icon @click="closeSearch" color="error">close</v-icon> | 232 | <v-icon @click="closeSearch" color="error">close</v-icon> |
233 | </v-layout> | 233 | </v-layout> |
234 | </v-flex> | 234 | </v-flex> |
235 | </v-toolbar> | 235 | </v-toolbar> |
236 | 236 | ||
237 | <div class="col-sm-12"> | 237 | <div class="col-sm-12"> |
238 | <div class="box-body"> | 238 | <div class="box-body"> |
239 | <div class="row"> | 239 | <div class="row"> |
240 | <div class="col-sm-12"> | 240 | <div class="col-sm-12"> |
241 | <div class="nav-tabs-custom"> | 241 | <div class="nav-tabs-custom"> |
242 | <ul class="nav nav-tabs"> | 242 | <ul class="nav nav-tabs"> |
243 | <li class="active"> | 243 | <li class="active"> |
244 | <a data-toggle="tab" href="#all" aria-expanded="true">All Routines</a> | 244 | <a data-toggle="tab" href="#all" aria-expanded="true">All Routines</a> |
245 | </li> | 245 | </li> |
246 | </ul> | 246 | </ul> |
247 | 247 | ||
248 | <div class="tab-content" v-show="hideTable"> | 248 | <div class="tab-content" v-show="hideTable"> |
249 | <div id="all" class="tab-pane active mCustomScrollbar _mCS_1 mCS_no_scrollbar"> | 249 | <div id="all" class="tab-pane active mCustomScrollbar _mCS_1 mCS_no_scrollbar"> |
250 | <div | 250 | <div |
251 | id="mCSB_1" | 251 | id="mCSB_1" |
252 | class="mCustomScrollBox mCS-light" | 252 | class="mCustomScrollBox mCS-light" |
253 | style="max-height: none;" | 253 | style="max-height: none;" |
254 | tabindex="0" | 254 | tabindex="0" |
255 | > | 255 | > |
256 | <div | 256 | <div |
257 | id="mCSB_1_container" | 257 | id="mCSB_1_container" |
258 | class="mCSB_container mCS_x_hidden mCS_no_scrollbar_x" | 258 | class="mCSB_container mCS_x_hidden mCS_no_scrollbar_x" |
259 | style="position: relative; top: 0px; left: 0px; width: 100%;" | 259 | style="position: relative; top: 0px; left: 0px; width: 100%;" |
260 | dir="ltr" | 260 | dir="ltr" |
261 | > | 261 | > |
262 | <div id="hide-table-2"> | 262 | <div id="hide-table-2"> |
263 | <table id="table" class="table table-striped"> | 263 | <table id="table" class="table table-striped"> |
264 | <tbody> | 264 | <tbody> |
265 | <tr> | 265 | <tr> |
266 | <td>MONDAY</td> | 266 | <td>MONDAY</td> |
267 | </tr> | 267 | </tr> |
268 | <tr> | 268 | <tr> |
269 | <td>TUESDAY</td> | 269 | <td>TUESDAY</td> |
270 | </tr> | 270 | </tr> |
271 | <tr> | 271 | <tr> |
272 | <td>WEDNESDAY</td> | 272 | <td>WEDNESDAY</td> |
273 | </tr> | 273 | </tr> |
274 | <tr> | 274 | <tr> |
275 | <td>THURSDAY</td> | 275 | <td>THURSDAY</td> |
276 | </tr> | 276 | </tr> |
277 | <tr> | 277 | <tr> |
278 | <td>FRIDAY</td> | 278 | <td>FRIDAY</td> |
279 | </tr> | 279 | </tr> |
280 | <tr> | 280 | <tr> |
281 | <td>SATURDAY</td> | 281 | <td>SATURDAY</td> |
282 | </tr> | 282 | </tr> |
283 | </tbody> | 283 | </tbody> |
284 | </table> | 284 | </table> |
285 | </div> | 285 | </div> |
286 | </div> | 286 | </div> |
287 | <div | 287 | <div |
288 | id="mCSB_1_scrollbar_horizontal" | 288 | id="mCSB_1_scrollbar_horizontal" |
289 | class="mCSB_scrollTools mCSB_1_scrollbar mCS-light mCSB_scrollTools_horizontal" | 289 | class="mCSB_scrollTools mCSB_1_scrollbar mCS-light mCSB_scrollTools_horizontal" |
290 | style="display: none;" | 290 | style="display: none;" |
291 | > | 291 | > |
292 | <div class="mCSB_draggerContainer"> | 292 | <div class="mCSB_draggerContainer"> |
293 | <div | 293 | <div |
294 | id="mCSB_1_dragger_horizontal" | 294 | id="mCSB_1_dragger_horizontal" |
295 | class="mCSB_dragger" | 295 | class="mCSB_dragger" |
296 | style="position: absolute; min-width: 30px; width: 0px; left: 0px;" | 296 | style="position: absolute; min-width: 30px; width: 0px; left: 0px;" |
297 | > | 297 | > |
298 | <div class="mCSB_dragger_bar"></div> | 298 | <div class="mCSB_dragger_bar"></div> |
299 | </div> | 299 | </div> |
300 | <div class="mCSB_draggerRail"></div> | 300 | <div class="mCSB_draggerRail"></div> |
301 | </div> | 301 | </div> |
302 | </div> | 302 | </div> |
303 | </div> | 303 | </div> |
304 | </div> | 304 | </div> |
305 | </div> | 305 | </div> |
306 | <div> | 306 | <div> |
307 | <table id="table" class="table table-bordered" v-show="showTable"> | 307 | <table id="table" class="table table-bordered" v-show="showTable"> |
308 | <tbody> | 308 | <tbody> |
309 | <div class="nav-tabs-custom"> | 309 | <div class="nav-tabs-custom"> |
310 | <div class="tab-content" id="scrolling"> | 310 | <div class="tab-content" id="scrolling"> |
311 | <div id="hide-table-2"> | 311 | <div id="hide-table-2"> |
312 | <v-data-table :items="routineList"> | 312 | <v-data-table :items="routineList"> |
313 | <template slot="items" slot-scope="props"> | 313 | <template slot="items" slot-scope="props"> |
314 | <tr class="tr"> | 314 | <tr class="tr"> |
315 | <td>{{ props.item.day }}</td> | 315 | <td>{{ props.item.day }}</td> |
316 | <td class="text-center" v-for="list in props.item.lectureRoutine"> | 316 | <td class="text-center" v-for="list in props.item.lectureRoutine"> |
317 | {{ props.item.classId.classNum }} | 317 | {{ props.item.classId.classNum }} |
318 | <br /> | 318 | <br /> |
319 | {{ props.item.sectionId.name }} | 319 | {{ props.item.sectionId.name }} |
320 | <br /> | 320 | <br /> |
321 | {{ list.startingTime }} - {{ list.endingTime }} | 321 | {{ list.startingTime }} - {{ list.endingTime }} |
322 | <br /> | 322 | <br /> |
323 | {{ list.room }} | 323 | {{ list.room }} |
324 | <br /> | 324 | <br /> |
325 | {{ list.subjectName }} | 325 | {{ list.subjectName }} |
326 | <br /> | 326 | <br /> |
327 | {{ list.teacherId.name}} | 327 | {{ list.teacherId.name}} |
328 | <br /> | 328 | <br /> |
329 | <span> | 329 | <span> |
330 | <v-tooltip top> | 330 | <v-tooltip top> |
331 | <img | 331 | <img |
332 | slot="activator" | 332 | slot="activator" |
333 | style="cursor:pointer; width:20px; height:18px; " | 333 | style="cursor:pointer; width:20px; height:18px; " |
334 | class="mr-3" | 334 | class="mr-3" |
335 | @click="editItem(list, props.item)" | 335 | @click="editItem(list, props.item)" |
336 | src="/static/icon/edit.png" | 336 | src="/static/icon/edit.png" |
337 | /> | 337 | /> |
338 | <span>Edit</span> | 338 | <span>Edit</span> |
339 | </v-tooltip> | 339 | </v-tooltip> |
340 | <v-tooltip top> | 340 | <v-tooltip top> |
341 | <img | 341 | <img |
342 | slot="activator" | 342 | slot="activator" |
343 | style="cursor:pointer; width:20px; height:18px; " | 343 | style="cursor:pointer; width:20px; height:18px; " |
344 | class="mr-3" | 344 | class="mr-3" |
345 | @click="deleteItem(props.item)" | 345 | @click="deleteItem(props.item)" |
346 | src="/static/icon/delete.png" | 346 | src="/static/icon/delete.png" |
347 | /> | 347 | /> |
348 | <span>Delete</span> | 348 | <span>Delete</span> |
349 | </v-tooltip> | 349 | </v-tooltip> |
350 | </span> | 350 | </span> |
351 | </td> | 351 | </td> |
352 | </tr> | 352 | </tr> |
353 | </template> | 353 | </template> |
354 | </v-data-table> | 354 | </v-data-table> |
355 | </div> | 355 | </div> |
356 | </div> | 356 | </div> |
357 | </div> | 357 | </div> |
358 | </tbody> | 358 | </tbody> |
359 | </table> | 359 | </table> |
360 | </div> | 360 | </div> |
361 | </div> | 361 | </div> |
362 | </div> | 362 | </div> |
363 | </div> | 363 | </div> |
364 | </div> | 364 | </div> |
365 | </div> | 365 | </div> |
366 | <!-- ****** ADD MULTIPLE Subject ****** --> | 366 | <!-- ****** ADD MULTIPLE Subject ****** --> |
367 | <v-snackbar | 367 | <v-snackbar |
368 | :timeout="timeout" | 368 | :timeout="timeout" |
369 | :top="y === 'top'" | 369 | :top="y === 'top'" |
370 | :right="x === 'right'" | 370 | :right="x === 'right'" |
371 | :vertical="mode === 'vertical'" | 371 | :vertical="mode === 'vertical'" |
372 | v-model="snackbar" | 372 | v-model="snackbar" |
373 | :color="color" | 373 | :color="color" |
374 | >{{ text }}</v-snackbar> | 374 | >{{ text }}</v-snackbar> |
375 | <v-dialog v-model="addRoutineDialog" max-width="600px"> | 375 | <v-dialog v-model="addRoutineDialog" max-width="600px" v-if="addRoutineDialog"> |
376 | v-if="addRoutineDialog" | ||
376 | <v-card flat class="card-style pa-2" dark> | 377 | <v-card flat class="card-style pa-2" dark> |
377 | <v-layout> | 378 | <v-layout> |
378 | <v-flex xs12> | 379 | <v-flex xs12> |
379 | <label class="title text-xs-center">Add Routine</label> | 380 | <label class="title text-xs-center">Add Routine</label> |
380 | <v-icon size="24" class="right" @click="addRoutineDialog = false">cancel</v-icon> | 381 | <v-icon size="24" class="right" @click="closeAddRoutineModel">cancel</v-icon> |
381 | </v-flex> | 382 | </v-flex> |
382 | </v-layout> | 383 | </v-layout> |
383 | <v-container fluid fill-height> | 384 | <v-container fluid fill-height> |
384 | <v-layout align-center> | 385 | <v-layout align-center> |
385 | <v-flex xs12> | 386 | <v-flex xs12> |
386 | <v-form ref="form" v-model="valid" lazy-validation> | 387 | <v-form ref="form" v-model="valid" lazy-validation> |
387 | <v-layout> | 388 | <v-layout> |
388 | <v-flex xs4 sm4 class="pt-4 subheading"> | 389 | <v-flex xs4 sm4 class="pt-4 subheading"> |
389 | <label class="right">School Year :</label> | 390 | <label class="right">School Year :</label> |
390 | </v-flex> | 391 | </v-flex> |
391 | <v-flex xs8 sm8 class="ml-3"> | 392 | <v-flex xs8 sm8 class="ml-3"> |
392 | <v-text-field | 393 | <v-text-field |
393 | label="fill your year" | 394 | label="fill your year" |
394 | :rules="schoolRules" | 395 | :rules="schoolRules" |
395 | v-model="addRoutine.schoolYear" | 396 | v-model="addRoutine.schoolYear" |
396 | ></v-text-field> | 397 | ></v-text-field> |
397 | </v-flex> | 398 | </v-flex> |
398 | </v-layout> | 399 | </v-layout> |
399 | <v-layout> | 400 | <v-layout> |
400 | <v-flex xs4 sm4 class="pt-4 subheading"> | 401 | <v-flex xs4 sm4 class="pt-4 subheading"> |
401 | <label class="right">Class :</label> | 402 | <label class="right">Class :</label> |
402 | </v-flex> | 403 | </v-flex> |
403 | <v-flex xs8 sm8 class="ml-3"> | 404 | <v-flex xs8 sm8 class="ml-3"> |
404 | <v-select | 405 | <v-select |
405 | :items="classList" | 406 | :items="classList" |
406 | item-text="classNum" | 407 | item-text="classNum" |
407 | item-value="_id" | 408 | item-value="_id" |
408 | v-model="addRoutine.classId" | 409 | v-model="addRoutine.classId" |
409 | label="Select Class" | 410 | label="Select Class" |
410 | :rules="classRules" | 411 | :rules="classRules" |
411 | @change="getSections(addRoutine.classId)" | 412 | @change="getSections(addRoutine.classId)" |
412 | class="pl-2" | 413 | class="pl-2" |
413 | required | 414 | required |
414 | ></v-select> | 415 | ></v-select> |
415 | </v-flex> | 416 | </v-flex> |
416 | </v-layout> | 417 | </v-layout> |
417 | <v-layout> | 418 | <v-layout> |
418 | <v-flex xs4 sm4 class="pt-4 subheading"> | 419 | <v-flex xs4 sm4 class="pt-4 subheading"> |
419 | <label class="right">Section :</label> | 420 | <label class="right">Section :</label> |
420 | </v-flex> | 421 | </v-flex> |
421 | <v-flex xs8 sm8 class="ml-3"> | 422 | <v-flex xs8 sm8 class="ml-3"> |
422 | <v-select | 423 | <v-select |
423 | :items="addSection" | 424 | :items="addSection" |
424 | item-text="name" | 425 | item-text="name" |
425 | item-value="_id" | 426 | item-value="_id" |
426 | v-model="addRoutine.sectionId" | 427 | v-model="addRoutine.sectionId" |
427 | label="Select Section" | 428 | label="Select Section" |
428 | :rules="sectionRules" | 429 | :rules="sectionRules" |
429 | @change="getClassSubject(addRoutine.classId)" | 430 | @change="getClassSubject(addRoutine.classId)" |
430 | class="px-2" | 431 | class="px-2" |
431 | required | 432 | required |
432 | ></v-select> | 433 | ></v-select> |
433 | </v-flex> | 434 | </v-flex> |
434 | </v-layout> | 435 | </v-layout> |
435 | <v-layout> | 436 | <v-layout> |
436 | <v-flex xs3 sm4 class="pt-4 subheading"> | 437 | <v-flex xs3 sm4 class="pt-4 subheading"> |
437 | <label class="right">Subject :</label> | 438 | <label class="right">Subject :</label> |
438 | </v-flex> | 439 | </v-flex> |
439 | <v-flex xs8 sm8 class="ml-2"> | 440 | <v-flex xs8 sm8 class="ml-2"> |
440 | <v-select | 441 | <v-select |
441 | :items="subjectList.subjects" | 442 | :items="subjectList.subjects" |
442 | label="Select your subject" | 443 | label="Select your subject" |
443 | v-model="addRoutine.subjectName" | 444 | v-model="addRoutine.subjectName" |
444 | item-text="subjectName" | 445 | item-text="subjectName" |
445 | item-value="subjectName" | 446 | item-value="subjectName" |
446 | :rules="subjectRules" | 447 | :rules="subjectRules" |
447 | required | 448 | required |
448 | ></v-select> | 449 | ></v-select> |
449 | </v-flex> | 450 | </v-flex> |
450 | </v-layout> | 451 | </v-layout> |
451 | <v-layout> | 452 | <v-layout> |
452 | <v-flex xs3 sm4 class="pt-4 subheading"> | 453 | <v-flex xs3 sm4 class="pt-4 subheading"> |
453 | <label class="right">Day :</label> | 454 | <label class="right">Day :</label> |
454 | </v-flex> | 455 | </v-flex> |
455 | <v-flex xs8 sm8 class="ml-2"> | 456 | <v-flex xs8 sm8 class="ml-2"> |
456 | <v-select | 457 | <v-select |
457 | :items="day" | 458 | :items="day" |
458 | label="Select your day" | 459 | label="Select your day" |
459 | v-model="addRoutine.day" | 460 | v-model="addRoutine.day" |
460 | item-text="text" | 461 | item-text="text" |
461 | :rules="dayRules" | 462 | :rules="dayRules" |
462 | required | 463 | required |
463 | ></v-select> | 464 | ></v-select> |
464 | </v-flex> | 465 | </v-flex> |
465 | </v-layout> | 466 | </v-layout> |
466 | <v-layout> | 467 | <v-layout> |
467 | <v-flex xs4 sm4 class="pt-4 subheading"> | 468 | <v-flex xs4 sm4 class="pt-4 subheading"> |
468 | <label class="right">Teacher Name :</label> | 469 | <label class="right">Teacher Name :</label> |
469 | </v-flex> | 470 | </v-flex> |
470 | <v-flex xs8 sm8 class="ml-3"> | 471 | <v-flex xs8 sm8 class="ml-3"> |
471 | <v-select | 472 | <v-select |
472 | v-model="addRoutine.teacherId" | 473 | v-model="addRoutine.teacherId" |
473 | label="Select your teacher" | 474 | label="Select your teacher" |
474 | type="text" | 475 | type="text" |
475 | :items="teacherList" | 476 | :items="teacherList" |
476 | item-text="name" | 477 | item-text="name" |
477 | item-value="_id" | 478 | item-value="_id" |
478 | :rules="teacherRules" | 479 | :rules="teacherRules" |
479 | required | 480 | required |
480 | ></v-select> | 481 | ></v-select> |
481 | </v-flex> | 482 | </v-flex> |
482 | </v-layout> | 483 | </v-layout> |
483 | <v-layout> | 484 | <v-layout> |
484 | <v-flex xs4 class="pt-4 subheading"> | 485 | <v-flex xs4 class="pt-4 subheading"> |
485 | <label class="right">Starting time:</label> | 486 | <label class="right">Starting time:</label> |
486 | </v-flex> | 487 | </v-flex> |
487 | <v-flex xs8 sm6 class="ml-3"> | 488 | <v-flex xs8 sm6 class="ml-3"> |
488 | <v-menu | 489 | <v-menu |
489 | ref="menuA" | 490 | ref="menuA" |
490 | :close-on-content-click="false" | 491 | :close-on-content-click="false" |
491 | v-model="menu2" | 492 | v-model="menu2" |
492 | :nudge-right="40" | 493 | :nudge-right="40" |
493 | :return-value.sync="addRoutine.startingTime" | 494 | :return-value.sync="addRoutine.startingTime" |
494 | lazy | 495 | lazy |
495 | transition="scale-transition" | 496 | transition="scale-transition" |
496 | offset-y | 497 | offset-y |
497 | full-width | 498 | full-width |
498 | max-width="290px" | 499 | max-width="290px" |
499 | min-width="290px" | 500 | min-width="290px" |
500 | > | 501 | > |
501 | <v-text-field | 502 | <v-text-field |
502 | slot="activator" | 503 | slot="activator" |
503 | v-model="addRoutine.startingTime" | 504 | v-model="addRoutine.startingTime" |
504 | label="Select your starting time" | 505 | label="Select your starting time" |
505 | append-icon="access_time" | 506 | append-icon="access_time" |
506 | :rules="timeInRules" | 507 | :rules="timeInRules" |
507 | readonly | 508 | readonly |
508 | ></v-text-field> | 509 | ></v-text-field> |
509 | <v-time-picker | 510 | <v-time-picker |
510 | v-model="addRoutine.startingTime" | 511 | v-model="addRoutine.startingTime" |
511 | @change="$refs.menuA.save(addRoutine.startingTime)" | 512 | @change="$refs.menuA.save(addRoutine.startingTime)" |
512 | ></v-time-picker> | 513 | ></v-time-picker> |
513 | </v-menu> | 514 | </v-menu> |
514 | </v-flex> | 515 | </v-flex> |
515 | </v-layout> | 516 | </v-layout> |
516 | <v-layout> | 517 | <v-layout> |
517 | <v-flex xs4 class="pt-4 subheading"> | 518 | <v-flex xs4 class="pt-4 subheading"> |
518 | <label class="right">Ending Time:</label> | 519 | <label class="right">Ending Time:</label> |
519 | </v-flex> | 520 | </v-flex> |
520 | <v-flex xs8 sm6 class="ml-3"> | 521 | <v-flex xs8 sm6 class="ml-3"> |
521 | <v-menu | 522 | <v-menu |
522 | ref="menu" | 523 | ref="menu" |
523 | :close-on-content-click="false" | 524 | :close-on-content-click="false" |
524 | v-model="menu1" | 525 | v-model="menu1" |
525 | :nudge-right="40" | 526 | :nudge-right="40" |
526 | :return-value.sync="addRoutine.endingTime" | 527 | :return-value.sync="addRoutine.endingTime" |
527 | lazy | 528 | lazy |
528 | transition="scale-transition" | 529 | transition="scale-transition" |
529 | offset-y | 530 | offset-y |
530 | full-width | 531 | full-width |
531 | max-width="290px" | 532 | max-width="290px" |
532 | min-width="290px" | 533 | min-width="290px" |
533 | > | 534 | > |
534 | <v-text-field | 535 | <v-text-field |
535 | slot="activator" | 536 | slot="activator" |
536 | v-model="addRoutine.endingTime" | 537 | v-model="addRoutine.endingTime" |
537 | label="Select your end time" | 538 | label="Select your end time" |
538 | append-icon="access_time" | 539 | append-icon="access_time" |
539 | :rules="timeOutRules" | 540 | :rules="timeOutRules" |
540 | readonly | 541 | readonly |
541 | ></v-text-field> | 542 | ></v-text-field> |
542 | <v-time-picker | 543 | <v-time-picker |
543 | v-model="addRoutine.endingTime" | 544 | v-model="addRoutine.endingTime" |
544 | @change="$refs.menu.save(addRoutine.endingTime)" | 545 | @change="$refs.menu.save(addRoutine.endingTime)" |
545 | ></v-time-picker> | 546 | ></v-time-picker> |
546 | </v-menu> | 547 | </v-menu> |
547 | </v-flex> | 548 | </v-flex> |
548 | </v-layout> | 549 | </v-layout> |
549 | <v-layout> | 550 | <v-layout> |
550 | <v-flex xs4 sm4 class="pt-4 subheading"> | 551 | <v-flex xs4 sm4 class="pt-4 subheading"> |
551 | <label class="right">Room:</label> | 552 | <label class="right">Room:</label> |
552 | </v-flex> | 553 | </v-flex> |
553 | <v-flex xs8 sm8 class="ml-3"> | 554 | <v-flex xs8 sm8 class="ml-3"> |
554 | <v-text-field | 555 | <v-text-field |
555 | label="fill your room" | 556 | label="fill your room" |
556 | :rules="roomRules" | 557 | :rules="roomRules" |
557 | v-model="addRoutine.room" | 558 | v-model="addRoutine.room" |
558 | @keyup.enter="submit" | 559 | @keyup.enter="submit" |
559 | ></v-text-field> | 560 | ></v-text-field> |
560 | </v-flex> | 561 | </v-flex> |
561 | </v-layout> | 562 | </v-layout> |
562 | <v-layout> | 563 | <v-layout> |
563 | <v-flex xs4 sm4 class="pt-4 subheading"> | 564 | <v-flex xs4 sm4 class="pt-4 subheading"> |
564 | <label class="right">Period:</label> | 565 | <label class="right">Period:</label> |
565 | </v-flex> | 566 | </v-flex> |
566 | <v-flex xs8 sm8 class="ml-3"> | 567 | <v-flex xs8 sm8 class="ml-3"> |
567 | <v-text-field | 568 | <v-text-field |
568 | label="fill your period" | 569 | label="fill your period" |
569 | :rules="periodRules" | 570 | :rules="periodRules" |
570 | v-model="addRoutine.period" | 571 | v-model="addRoutine.period" |
571 | @keyup.enter="submit" | 572 | @keyup.enter="submit" |
572 | ></v-text-field> | 573 | ></v-text-field> |
573 | </v-flex> | 574 | </v-flex> |
574 | </v-layout> | 575 | </v-layout> |
575 | <v-layout> | 576 | <v-layout> |
576 | <v-flex xs12 sm12> | 577 | <v-flex xs12 sm12> |
577 | <v-card-actions> | 578 | <v-card-actions> |
578 | <v-spacer></v-spacer> | 579 | <v-spacer></v-spacer> |
579 | <v-btn | 580 | <v-btn |
580 | @click="create" | 581 | @click="create" |
581 | round | 582 | round |
582 | dark | 583 | dark |
583 | :loading="loading" | 584 | :loading="loading" |
584 | class="add-button" | 585 | class="add-button" |
585 | >Add Routine</v-btn> | 586 | >Add Routine</v-btn> |
586 | </v-card-actions> | 587 | </v-card-actions> |
587 | </v-flex> | 588 | </v-flex> |
588 | </v-layout> | 589 | </v-layout> |
589 | </v-form> | 590 | </v-form> |
590 | </v-flex> | 591 | </v-flex> |
591 | </v-layout> | 592 | </v-layout> |
592 | </v-container> | 593 | </v-container> |
593 | </v-card> | 594 | </v-card> |
594 | </v-dialog> | 595 | </v-dialog> |
595 | <div class="loader" v-if="showLoader"> | 596 | <div class="loader" v-if="showLoader"> |
596 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 597 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
597 | </div> | 598 | </div> |
598 | </v-container> | 599 | </v-container> |
599 | </template> | 600 | </template> |
600 | 601 | ||
601 | <script> | 602 | <script> |
602 | import http from "@/Services/http.js"; | 603 | import http from "@/Services/http.js"; |
603 | import Util from "@/util"; | 604 | import Util from "@/util"; |
604 | 605 | ||
605 | export default { | 606 | export default { |
606 | data: () => ({ | 607 | data: () => ({ |
607 | snackbar: false, | 608 | snackbar: false, |
608 | y: "top", | 609 | y: "top", |
609 | x: "right", | 610 | x: "right", |
610 | role: "", | 611 | role: "", |
611 | mode: "", | 612 | mode: "", |
612 | timeout: 3000, | 613 | timeout: 3000, |
613 | text: "", | 614 | text: "", |
614 | color: "", | 615 | color: "", |
615 | show: true, | 616 | show: true, |
616 | showSearch: false, | 617 | showSearch: false, |
617 | showLoader: false, | 618 | showLoader: false, |
618 | loading: false, | 619 | loading: false, |
619 | editLoading: false, | 620 | editLoading: false, |
620 | date: null, | 621 | date: null, |
621 | search: "", | 622 | search: "", |
622 | editRoutineDialog: false, | 623 | editRoutineDialog: false, |
623 | valid: true, | 624 | valid: true, |
624 | validEditRoutine: true, | 625 | validEditRoutine: true, |
625 | addRoutineDialog: false, | 626 | addRoutineDialog: false, |
626 | showTable: false, | 627 | showTable: false, |
627 | hideTable: true, | 628 | hideTable: true, |
628 | name: "", | 629 | name: "", |
629 | 630 | ||
630 | day: [ | 631 | day: [ |
631 | "Monday", | 632 | "Monday", |
632 | "Tuesday", | 633 | "Tuesday", |
633 | "Wednesday", | 634 | "Wednesday", |
634 | "Thursday", | 635 | "Thursday", |
635 | "Friday", | 636 | "Friday", |
636 | "Saturday", | 637 | "Saturday", |
637 | "Sunday", | 638 | "Sunday", |
638 | ], | 639 | ], |
639 | 640 | ||
640 | token: "", | 641 | token: "", |
641 | 642 | ||
642 | menu1: false, | 643 | menu1: false, |
643 | menu2: false, | 644 | menu2: false, |
644 | menu4: false, | 645 | menu4: false, |
645 | menu3: false, | 646 | menu3: false, |
646 | 647 | ||
647 | schoolRules: [(v) => !!v || "School Year is required"], | 648 | schoolRules: [(v) => !!v || "School Year is required"], |
648 | classRules: [(v) => !!v || " Class Name is required"], | 649 | classRules: [(v) => !!v || " Class Name is required"], |
649 | teacherRules: [(v) => !!v || " Teacher Name is required"], | 650 | teacherRules: [(v) => !!v || " Teacher Name is required"], |
650 | sectionRules: [(v) => !!v || "Section is required"], | 651 | sectionRules: [(v) => !!v || "Section is required"], |
651 | studentRules: [(v) => !!v || " Student is required"], | 652 | studentRules: [(v) => !!v || " Student is required"], |
652 | finalRules: [(v) => !!v || "Final MArk is required"], | 653 | finalRules: [(v) => !!v || "Final MArk is required"], |
653 | subjectRules: [(v) => !!v || " Subject Name is required"], | 654 | subjectRules: [(v) => !!v || " Subject Name is required"], |
654 | dayRules: [(v) => !!v || "Day is required"], | 655 | dayRules: [(v) => !!v || "Day is required"], |
655 | timeInRules: [(v) => !!v || "Start Time is required"], | 656 | timeInRules: [(v) => !!v || "Start Time is required"], |
656 | timeOutRules: [(v) => !!v || "End Time is required"], | 657 | timeOutRules: [(v) => !!v || "End Time is required"], |
657 | roomRules: [(v) => !!v || "Room is required"], | 658 | roomRules: [(v) => !!v || "Room is required"], |
658 | periodRules: [(v) => !!v || "Period is required"], | 659 | periodRules: [(v) => !!v || "Period is required"], |
659 | 660 | ||
660 | classList: [], | 661 | classList: [], |
661 | addSection: [], | 662 | addSection: [], |
662 | subjectList: [], | 663 | subjectList: [], |
663 | teacherList: [], | 664 | teacherList: [], |
664 | titleRules: [], | 665 | titleRules: [], |
665 | markRules: [], | 666 | markRules: [], |
666 | typeRules: [], | 667 | typeRules: [], |
667 | routineList: [], | 668 | routineList: [], |
668 | editedIndex: -1, | 669 | editedIndex: -1, |
669 | addRoutine: {}, | 670 | addRoutine: {}, |
670 | addRoutineList: {}, | 671 | addRoutineList: {}, |
671 | startingTime: "", | 672 | startingTime: "", |
672 | editedItem: {}, | 673 | editedItem: {}, |
673 | }), | 674 | }), |
675 | watch: { | ||
676 | addRoutineDialog: function (val) { | ||
677 | if (!val) { | ||
678 | this.addRoutine = []; | ||
679 | } | ||
680 | }, | ||
681 | }, | ||
674 | methods: { | 682 | methods: { |
675 | editItem(item, routineData) { | 683 | editItem(item, routineData) { |
676 | console.log("routineData", routineData); | 684 | console.log("routineData", routineData); |
677 | console.log("item", item); | 685 | console.log("item", item); |
678 | this.editedIndex = this.routineList; | 686 | this.editedIndex = this.routineList; |
679 | this.editedItem = Object.assign({}, item); | 687 | this.editedItem = Object.assign({}, item); |
680 | this.editedItem.lectureRoutineId = item._id; | 688 | this.editedItem.lectureRoutineId = item._id; |
681 | this.editedItem.routineId = routineData._id; | 689 | this.editedItem.routineId = routineData._id; |
682 | this.dialog = true; | 690 | this.dialog = true; |
683 | this.editRoutineDialog = true; | 691 | this.editRoutineDialog = true; |
684 | }, | 692 | }, |
685 | deleteItem(item) { | 693 | deleteItem(item) { |
686 | let deleteLecture = { | 694 | let deleteLecture = { |
687 | routineId: item._id, | 695 | routineId: item._id, |
688 | lectureId: item.lectureRoutine[0]._id, | 696 | lectureId: item.lectureRoutine[0]._id, |
689 | }; | 697 | }; |
690 | http() | 698 | http() |
691 | .delete( | 699 | .delete( |
692 | "/deleteRoutineLecture", | 700 | "/deleteRoutineLecture", |
693 | confirm("Are you sure you want to delete this?") && { | 701 | confirm("Are you sure you want to delete this?") && { |
694 | params: deleteLecture, | 702 | params: deleteLecture, |
695 | } | 703 | } |
696 | ) | 704 | ) |
697 | .then((response) => { | 705 | .then((response) => { |
698 | this.snackbar = true; | 706 | this.snackbar = true; |
699 | this.text = "Successfully delete Existing Routine"; | 707 | this.text = "Successfully delete Existing Routine"; |
700 | this.color = "green"; | 708 | this.color = "green"; |
701 | this.getRoutineList(); | 709 | this.getRoutineList(); |
702 | }) | 710 | }) |
703 | .catch((error) => { | 711 | .catch((error) => { |
704 | this.snackbar = true; | 712 | this.snackbar = true; |
705 | this.text = error.response.data.message; | 713 | this.text = error.response.data.message; |
706 | this.color = "error"; | 714 | this.color = "error"; |
707 | }); | 715 | }); |
708 | }, | 716 | }, |
709 | close() { | 717 | close() { |
710 | this.editRoutineDialog = false; | 718 | this.editRoutineDialog = false; |
711 | }, | 719 | }, |
712 | 720 | closeAddRoutineModel() { | |
721 | this.addRoutineDialog = false; | ||
722 | this.classList = []; | ||
723 | this.addRoutine = []; | ||
724 | }, | ||
713 | create() { | 725 | create() { |
714 | var routineData = { | 726 | var routineData = { |
715 | schoolYear: this.addRoutine.schoolYear, | 727 | schoolYear: this.addRoutine.schoolYear, |
716 | classId: this.addRoutine.classId, | 728 | classId: this.addRoutine.classId, |
717 | sectionId: this.addRoutine.sectionId, | 729 | sectionId: this.addRoutine.sectionId, |
718 | day: this.addRoutine.day, | 730 | day: this.addRoutine.day, |
719 | lectureRoutine: [], | 731 | lectureRoutine: [], |
720 | }; | 732 | }; |
721 | if (this.$refs.form.validate()) { | 733 | if (this.$refs.form.validate()) { |
722 | routineData.lectureRoutine.push({ | 734 | routineData.lectureRoutine.push({ |
723 | teacherId: this.addRoutine.teacherId, | 735 | teacherId: this.addRoutine.teacherId, |
724 | startingTime: this.addRoutine.startingTime, | 736 | startingTime: this.addRoutine.startingTime, |
725 | endingTime: this.addRoutine.endingTime, | 737 | endingTime: this.addRoutine.endingTime, |
726 | room: this.addRoutine.room, | 738 | room: this.addRoutine.room, |
727 | period: this.addRoutine.period, | 739 | period: this.addRoutine.period, |
728 | subjectName: this.addRoutine.subjectName, | 740 | subjectName: this.addRoutine.subjectName, |
729 | }); | 741 | }); |
730 | http() | 742 | http() |
731 | .post("/createRoutine", routineData) | 743 | .post("/createRoutine", routineData) |
732 | .then((response) => { | 744 | .then((response) => { |
733 | this.getRoutineList(); | 745 | this.getRoutineList(); |
734 | this.text = "Routine added successfully"; | 746 | this.text = "Routine added successfully"; |
735 | this.clear(); | 747 | this.clear(); |
736 | this.snackbar = true; | 748 | this.snackbar = true; |
737 | this.color = "green"; | 749 | this.color = "green"; |
738 | this.addRoutineDialog = false; | 750 | this.addRoutineDialog = false; |
739 | }) | 751 | }) |
740 | .catch((error) => { | 752 | .catch((error) => { |
741 | // console.log(error); | 753 | // console.log(error); |
742 | this.snackbar = true; | 754 | this.snackbar = true; |
743 | this.text = error.response.data.message; | 755 | this.text = error.response.data.message; |
744 | this.color = "error"; | 756 | this.color = "error"; |
745 | }); | 757 | }); |
746 | } | 758 | } |
747 | }, | 759 | }, |
748 | clear() { | 760 | clear() { |
749 | this.$refs.form.reset(); | 761 | this.$refs.form.reset(); |
750 | }, | 762 | }, |
751 | 763 | ||
752 | update() { | 764 | update() { |
753 | if (this.$refs.formEditRoutine.validate()) { | 765 | if (this.$refs.formEditRoutine.validate()) { |
754 | let editRoutine = { | 766 | let editRoutine = { |
755 | routineId: this.editedItem.routineId, | 767 | routineId: this.editedItem.routineId, |
756 | lectureRoutineId: this.editedItem.lectureRoutineId, | 768 | lectureRoutineId: this.editedItem.lectureRoutineId, |
757 | subjectName: this.editedItem.subjectName, | 769 | subjectName: this.editedItem.subjectName, |
758 | teacherId: this.editedItem.teacherId._id, | 770 | teacherId: this.editedItem.teacherId._id, |
759 | startingTime: this.editedItem.startingTime, | 771 | startingTime: this.editedItem.startingTime, |
760 | endingTime: this.editedItem.endingTime, | 772 | endingTime: this.editedItem.endingTime, |
761 | room: this.editedItem.room, | 773 | room: this.editedItem.room, |
762 | period: this.editedItem.period, | 774 | period: this.editedItem.period, |
763 | }; | 775 | }; |
764 | this.editLoading = true; | 776 | this.editLoading = true; |
765 | http() | 777 | http() |
766 | .put("/updateRoutine", editRoutine) | 778 | .put("/updateRoutine", editRoutine) |
767 | .then((response) => { | 779 | .then((response) => { |
768 | this.snackbar = true; | 780 | this.snackbar = true; |
769 | this.text = "Successfully Edit Existing Routine"; | 781 | this.text = "Successfully Edit Existing Routine"; |
770 | this.color = "green"; | 782 | this.color = "green"; |
771 | this.editLoading = false; | 783 | this.editLoading = false; |
772 | this.editRoutineDialog = false; | 784 | this.editRoutineDialog = false; |
773 | this.getRoutineList(); | 785 | this.getRoutineList(); |
774 | // http() | 786 | // http() |
775 | // .get( | 787 | // .get( |
776 | // "/getRoutineList", | 788 | // "/getRoutineList", |
777 | // { | 789 | // { |
778 | // params: { | 790 | // params: { |
779 | // classId: this.addRoutine.classId, | 791 | // classId: this.addRoutine.classId, |
780 | // sectionId: this.addRoutine.sectionId | 792 | // sectionId: this.addRoutine.sectionId |
781 | // } | 793 | // } |
782 | // }, | 794 | // }, |
783 | // { | 795 | // { |
784 | // headers: { Authorization: "Bearer " + this.token } | 796 | // headers: { Authorization: "Bearer " + this.token } |
785 | // } | 797 | // } |
786 | // ) | 798 | // ) |
787 | // .then(response => { | 799 | // .then(response => { |
788 | // this.routineList = response.data.data; | 800 | // this.routineList = response.data.data; |
789 | // this.showLoader = false; | 801 | // this.showLoader = false; |
790 | // this.showTable = true; | 802 | // this.showTable = true; |
791 | // this.hideTable = false; | 803 | // this.hideTable = false; |
792 | // }) | 804 | // }) |
793 | // .catch(err => { | 805 | // .catch(err => { |
794 | // console.log("err====>", err); | 806 | // console.log("err====>", err); |
795 | // }); | 807 | // }); |
796 | }) | 808 | }) |
797 | .catch((error) => { | 809 | .catch((error) => { |
798 | this.editLoading = false; | 810 | this.editLoading = false; |
799 | }); | 811 | }); |
800 | } | 812 | } |
801 | }, | 813 | }, |
802 | getClass() { | 814 | getClass() { |
803 | http() | 815 | http() |
804 | .get("/getClassesList", { | 816 | .get("/getClassesList", { |
805 | headers: { Authorization: "Bearer " + this.token }, | 817 | headers: { Authorization: "Bearer " + this.token }, |
806 | }) | 818 | }) |
807 | .then((response) => { | 819 | .then((response) => { |
808 | this.classList = response.data.data; | 820 | this.classList = response.data.data; |
809 | }) | 821 | }) |
810 | .catch((error) => { | 822 | .catch((error) => { |
811 | if (error.response.status === 401) { | 823 | if (error.response.status === 401) { |
812 | this.$router.replace({ path: "/" }); | 824 | this.$router.replace({ path: "/" }); |
813 | this.$store.dispatch("setToken", null); | 825 | this.$store.dispatch("setToken", null); |
814 | this.$store.dispatch("Id", null); | 826 | this.$store.dispatch("Id", null); |
815 | } | 827 | } |
816 | }); | 828 | }); |
817 | }, | 829 | }, |
818 | getSections(_id) { | 830 | getSections(_id) { |
819 | var token = this.$store.state.token; | 831 | var token = this.$store.state.token; |
820 | this.showLoader = true; | 832 | this.showLoader = true; |
821 | http() | 833 | http() |
822 | .get( | 834 | .get( |
823 | "/getSectionsList", | 835 | "/getSectionsList", |
824 | { params: { classId: _id } }, | 836 | { params: { classId: _id } }, |
825 | { | 837 | { |
826 | headers: { Authorization: "Bearer " + token }, | 838 | headers: { Authorization: "Bearer " + token }, |
827 | } | 839 | } |
828 | ) | 840 | ) |
829 | .then((response) => { | 841 | .then((response) => { |
830 | this.addSection = response.data.data; | 842 | this.addSection = response.data.data; |
831 | this.showLoader = false; | 843 | this.showLoader = false; |
832 | }) | 844 | }) |
833 | .catch((err) => { | 845 | .catch((err) => { |
834 | this.showLoader = false; | 846 | this.showLoader = false; |
835 | }); | 847 | }); |
836 | }, | 848 | }, |
837 | getClassSubject(_id) { | 849 | getClassSubject(_id) { |
838 | this.showLoader = true; | 850 | this.showLoader = true; |
839 | // this.classId = this.classId; | 851 | // this.classId = this.classId; |
840 | http() | 852 | http() |
841 | .get( | 853 | .get( |
842 | "/getParticularClass", | 854 | "/getParticularClass", |
843 | { params: { classId: _id } }, | 855 | { params: { classId: _id } }, |
844 | { | 856 | { |
845 | headers: { Authorization: "Bearer " + this.token }, | 857 | headers: { Authorization: "Bearer " + this.token }, |
846 | } | 858 | } |
847 | ) | 859 | ) |
848 | .then((response) => { | 860 | .then((response) => { |
849 | this.subjectList = response.data.data; | 861 | this.subjectList = response.data.data; |
850 | this.showLoader = false; | 862 | this.showLoader = false; |
851 | }) | 863 | }) |
852 | .catch((err) => { | 864 | .catch((err) => { |
853 | this.showLoader = false; | 865 | this.showLoader = false; |
854 | }); | 866 | }); |
855 | }, | 867 | }, |
856 | getTeacherList() { | 868 | getTeacherList() { |
857 | this.showLoader = true; | 869 | this.showLoader = true; |
858 | var token = this.$store.state.token; | 870 | var token = this.$store.state.token; |
859 | http() | 871 | http() |
860 | .get("/getTeachersList", { | 872 | .get("/getTeachersList", { |
861 | headers: { Authorization: "Bearer " + token }, | 873 | headers: { Authorization: "Bearer " + token }, |
862 | }) | 874 | }) |
863 | .then((response) => { | 875 | .then((response) => { |
864 | this.teacherList = response.data.data; | 876 | this.teacherList = response.data.data; |
865 | this.showLoader = false; | 877 | this.showLoader = false; |
866 | // console.log("getTeacherList=====>",this.desserts) | 878 | // console.log("getTeacherList=====>",this.desserts) |
867 | }) | 879 | }) |
868 | .catch((error) => { | 880 | .catch((error) => { |
869 | this.showLoader = false; | 881 | this.showLoader = false; |
870 | if (error.response.status === 401) { | 882 | if (error.response.status === 401) { |
871 | this.$router.replace({ path: "/" }); | 883 | this.$router.replace({ path: "/" }); |
872 | this.$store.dispatch("setToken", null); | 884 | this.$store.dispatch("setToken", null); |
873 | this.$store.dispatch("Id", null); | 885 | this.$store.dispatch("Id", null); |
874 | } | 886 | } |
875 | }); | 887 | }); |
876 | }, | 888 | }, |
877 | getRoutineList() { | 889 | getRoutineList() { |
878 | this.showLoader = true; | 890 | this.showLoader = true; |
879 | http() | 891 | http() |
880 | .get( | 892 | .get( |
881 | "/getRoutineList", | 893 | "/getRoutineList", |
882 | { | 894 | { |
883 | params: { | 895 | params: { |
884 | classId: this.addRoutineList.classId, | 896 | classId: this.addRoutineList.classId, |
885 | sectionId: this.addRoutineList.sectionId, | 897 | sectionId: this.addRoutineList.sectionId, |
886 | }, | 898 | }, |
887 | }, | 899 | }, |
888 | { | 900 | { |
889 | headers: { Authorization: "Bearer " + this.token }, | 901 | headers: { Authorization: "Bearer " + this.token }, |
890 | } | 902 | } |
891 | ) | 903 | ) |
892 | .then((response) => { | 904 | .then((response) => { |
893 | this.routineList = response.data.data; | 905 | this.routineList = response.data.data; |
894 | this.showLoader = false; | 906 | this.showLoader = false; |
895 | this.showTable = true; | 907 | this.showTable = true; |
896 | this.hideTable = false; | 908 | this.hideTable = false; |
897 | }) | 909 | }) |
898 | .catch((err) => { | 910 | .catch((err) => { |
899 | this.showLoader = false; | 911 | this.showLoader = false; |
900 | }); | 912 | }); |
901 | }, | 913 | }, |
902 | displaySearch() { | 914 | displaySearch() { |
903 | (this.show = false), (this.showSearch = true); | 915 | (this.show = false), (this.showSearch = true); |
904 | }, | 916 | }, |
905 | closeSearch() { | 917 | closeSearch() { |
906 | this.showSearch = false; | 918 | this.showSearch = false; |
907 | this.show = true; | 919 | this.show = true; |
908 | this.search = ""; | 920 | this.search = ""; |
909 | }, | 921 | }, |
910 | }, | 922 | }, |
911 | mounted() { | 923 | mounted() { |
912 | this.token = this.$store.state.token; | 924 | this.token = this.$store.state.token; |
913 | this.getClass(); | 925 | this.getClass(); |
914 | this.getTeacherList(); | 926 | this.getTeacherList(); |
915 | this.role = this.$store.state.role; | 927 | this.role = this.$store.state.role; |
916 | }, | 928 | }, |
917 | }; | 929 | }; |
918 | </script> | 930 | </script> |
919 | 931 | ||
920 | <style scoped> | 932 | <style scoped> |
921 | html, | 933 | html, |
922 | body { | 934 | body { |
923 | font-family: "OpenSans Regular"; | 935 | font-family: "OpenSans Regular"; |
924 | } | 936 | } |
925 | .box .box-body { | 937 | .box .box-body { |
926 | padding: 15px; | 938 | padding: 15px; |
927 | border-top-left-radius: 0; | 939 | border-top-left-radius: 0; |
928 | border-top-right-radius: 0; | 940 | border-top-right-radius: 0; |
929 | border-bottom-right-radius: 3px; | 941 | border-bottom-right-radius: 3px; |
930 | border-bottom-left-radius: 3px; | 942 | border-bottom-left-radius: 3px; |
931 | } | 943 | } |
932 | .nav-tabs-custom { | 944 | .nav-tabs-custom { |
933 | margin-bottom: 20px; | 945 | margin-bottom: 20px; |
934 | background: #fff; | 946 | background: #fff; |
935 | box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); | 947 | box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); |
936 | } | 948 | } |
937 | .nav-tabs { | 949 | .nav-tabs { |
938 | border-bottom: 1px solid #ddd; | 950 | border-bottom: 1px solid #ddd; |
939 | } | 951 | } |
940 | .nav { | 952 | .nav { |
941 | padding-left: 0; | 953 | padding-left: 0; |
942 | list-style: none; | 954 | list-style: none; |
943 | } | 955 | } |
944 | .tab-content > .active { | 956 | .tab-content > .active { |
945 | display: block; | 957 | display: block; |
946 | } | 958 | } |
947 | .nav-tabs-custom > .nav-tabs > li.active > a { | 959 | .nav-tabs-custom > .nav-tabs > li.active > a { |
948 | border-top: 0; | 960 | border-top: 0; |
949 | border-left-color: #09a3a3; | 961 | border-left-color: #09a3a3; |
950 | border-right-color: #09a3a3; | 962 | border-right-color: #09a3a3; |
951 | } | 963 | } |
952 | .nav-tabs-custom > .nav-tabs { | 964 | .nav-tabs-custom > .nav-tabs { |
953 | background-color: #e5e5e5; | 965 | background-color: #e5e5e5; |
954 | margin: 0; | 966 | margin: 0; |
955 | border-bottom-color: #e5e5e5; | 967 | border-bottom-color: #e5e5e5; |
956 | } | 968 | } |
957 | .nav-tabs-custom > .nav-tabs > li:first-of-type { | 969 | .nav-tabs-custom > .nav-tabs > li:first-of-type { |
958 | margin-left: 0px; | 970 | margin-left: 0px; |
959 | } | 971 | } |
960 | .nav-tabs-custom > .nav-tabs > li.active { | 972 | .nav-tabs-custom > .nav-tabs > li.active { |
961 | border-bottom-color: #09a3a3; | 973 | border-bottom-color: #09a3a3; |
962 | } | 974 | } |
963 | .nav-tabs-custom > .nav-tabs > li { | 975 | .nav-tabs-custom > .nav-tabs > li { |
964 | border-bottom: 2px solid transparent; | 976 | border-bottom: 2px solid transparent; |
965 | border-top: 3px solid transparent; | 977 | border-top: 3px solid transparent; |
966 | margin-bottom: -2px; | 978 | margin-bottom: -2px; |
967 | margin-right: 5px; | 979 | margin-right: 5px; |
968 | } | 980 | } |
969 | .nav-tabs-custom > .nav-tabs > li:first-of-type.active > a { | 981 | .nav-tabs-custom > .nav-tabs > li:first-of-type.active > a { |
970 | border-left-width: 0; | 982 | border-left-width: 0; |
971 | } | 983 | } |
972 | .nav-tabs-custom > .nav-tabs > li.active > a { | 984 | .nav-tabs-custom > .nav-tabs > li.active > a { |
973 | border-top: 0; | 985 | border-top: 0; |
974 | border-bottom-color: #09a3a3; | 986 | border-bottom-color: #09a3a3; |
975 | } | 987 | } |
976 | .nav-tabs-custom > .nav-tabs > li.active > a, | 988 | .nav-tabs-custom > .nav-tabs > li.active > a, |
977 | .nav-tabs-custom > .nav-tabs > li.active:hover > a { | 989 | .nav-tabs-custom > .nav-tabs > li.active:hover > a { |
978 | background-color: #e5e5e5; | 990 | background-color: #e5e5e5; |
979 | border: 0px; | 991 | border: 0px; |
980 | color: #000000db; | 992 | color: #000000db; |
981 | } | 993 | } |
982 | .nav-tabs-custom > .nav-tabs > li > a, | 994 | .nav-tabs-custom > .nav-tabs > li > a, |
983 | .nav-tabs-custom > .nav-tabs > li > a:hover { | 995 | .nav-tabs-custom > .nav-tabs > li > a:hover { |
984 | border-radius: 0 !important; | 996 | border-radius: 0 !important; |
985 | } | 997 | } |
986 | .nav-tabs-custom > .tab-content { | 998 | .nav-tabs-custom > .tab-content { |
987 | background: #fff; | 999 | background: #fff; |
988 | padding: 10px; | 1000 | padding: 10px; |
989 | } | 1001 | } |
990 | .page-header { | 1002 | .page-header { |
991 | margin: 10px 0 20px 0; | 1003 | margin: 10px 0 20px 0; |
992 | padding: 0px 0px 16px; | 1004 | padding: 0px 0px 16px; |
993 | font-size: 22px; | 1005 | font-size: 22px; |
994 | border: none; | 1006 | border: none; |
995 | } | 1007 | } |
996 | .table { | 1008 | .table { |
997 | width: 100%; | 1009 | width: 100%; |
998 | border-collapse: collapse; | 1010 | border-collapse: collapse; |
999 | border-spacing: 0; | 1011 | border-spacing: 0; |
1000 | } | 1012 | } |
1001 | .table > tbody > tr > th, | 1013 | .table > tbody > tr > th, |
1002 | .table > tfoot > tr > th, | 1014 | .table > tfoot > tr > th, |
1003 | .table > tbody > tr > td, | 1015 | .table > tbody > tr > td, |
1004 | .table > tfoot > tr > td { | 1016 | .table > tfoot > tr > td { |
1005 | padding: 8px; | 1017 | padding: 8px; |
1006 | line-height: 1.428571429; | 1018 | line-height: 1.428571429; |
1007 | vertical-align: top; | 1019 | vertical-align: top; |
1008 | border-top: 1px solid #ddd; | 1020 | border-top: 1px solid #ddd; |
1009 | } | 1021 | } |
1010 | .nav::before, | 1022 | .nav::before, |
1011 | .nav::after { | 1023 | .nav::after { |
1012 | display: table; | 1024 | display: table; |
1013 | content: ""; | 1025 | content: ""; |
1014 | } | 1026 | } |
1015 | .box .box-body .table { | 1027 | .box .box-body .table { |
1016 | margin-bottom: 0; | 1028 | margin-bottom: 0; |
1017 | } | 1029 | } |
1018 | .table-bordered { | 1030 | .table-bordered { |
1019 | border: 1px solid #e2e7eb; | 1031 | border: 1px solid #e2e7eb; |
1020 | } | 1032 | } |
1021 | .table-striped > tbody > tr:nth-child(2n + 1) > td, | 1033 | .table-striped > tbody > tr:nth-child(2n + 1) > td, |
1022 | .table-striped > tbody > tr:nth-child(2n + 1) > th { | 1034 | .table-striped > tbody > tr:nth-child(2n + 1) > th { |
1023 | background-color: #f0f3f5; | 1035 | background-color: #f0f3f5; |
1024 | } | 1036 | } |
1025 | .table-bordered > tbody > v-data-table > template > tr > th, | 1037 | .table-bordered > tbody > v-data-table > template > tr > th, |
1026 | .table-bordered > tbody > tr > td { | 1038 | .table-bordered > tbody > tr > td { |
1027 | border-color: #e2e7eb; | 1039 | border-color: #e2e7eb; |
1028 | font-size: 12px; | 1040 | font-size: 12px; |
1029 | } | 1041 | } |
1030 | .table-bordered > tbody > tr > td { | 1042 | .table-bordered > tbody > tr > td { |
1031 | color: #707070; | 1043 | color: #707070; |
1032 | } | 1044 | } |
1033 | /* | 1045 | /* |
1034 | .table-bordered > tbody > tr > th, | 1046 | .table-bordered > tbody > tr > th, |
1035 | .table-bordered > tfoot > tr > th, | 1047 | .table-bordered > tfoot > tr > th, |
1036 | .table-bordered > tbody > tr > td, | 1048 | .table-bordered > tbody > tr > td, |
1037 | .table-bordered > tfoot > tr > td { | 1049 | .table-bordered > tfoot > tr > td { |
1038 | border: 1px solid #ddd; | 1050 | border: 1px solid #ddd; |
1039 | } */ | 1051 | } */ |
1040 | .mCustomScrollbar.mCS_no_scrollbar, | 1052 | .mCustomScrollbar.mCS_no_scrollbar, |
1041 | .mCustomScrollbar.mCS_touch_action { | 1053 | .mCustomScrollbar.mCS_touch_action { |
1042 | touch-action: auto; | 1054 | touch-action: auto; |
1043 | } | 1055 | } |
1044 | .mCSB_scrollTools.mCSB_scrollTools_horizontal { | 1056 | .mCSB_scrollTools.mCSB_scrollTools_horizontal { |
1045 | width: auto; | 1057 | width: auto; |
1046 | height: 16px; | 1058 | height: 16px; |
1047 | top: auto; | 1059 | top: auto; |
1048 | right: 0; | 1060 | right: 0; |
1049 | bottom: 0; | 1061 | bottom: 0; |
1050 | left: 0; | 1062 | left: 0; |
1051 | } | 1063 | } |
1052 | .mCSB_scrollTools { | 1064 | .mCSB_scrollTools { |
1053 | opacity: 0.75; | 1065 | opacity: 0.75; |
1054 | } | 1066 | } |
1055 | .mCSB_scrollTools .mCSB_draggerContainer { | 1067 | .mCSB_scrollTools .mCSB_draggerContainer { |
1056 | position: absolute; | 1068 | position: absolute; |
1057 | height: auto; | 1069 | height: auto; |
1058 | top: 0; | 1070 | top: 0; |
1059 | left: 0; | 1071 | left: 0; |
1060 | bottom: 0; | 1072 | bottom: 0; |
1061 | right: 0; | 1073 | right: 0; |
1062 | } | 1074 | } |
1063 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger { | 1075 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger { |
1064 | height: 100%; | 1076 | height: 100%; |
1065 | } | 1077 | } |
1066 | .mCSB_scrollTools .mCSB_dragger { | 1078 | .mCSB_scrollTools .mCSB_dragger { |
1067 | cursor: pointer; | 1079 | cursor: pointer; |
1068 | z-index: 1; | 1080 | z-index: 1; |
1069 | } | 1081 | } |
1070 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar { | 1082 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar { |
1071 | width: 100%; | 1083 | width: 100%; |
1072 | height: 4px; | 1084 | height: 4px; |
1073 | margin: 6px auto; | 1085 | margin: 6px auto; |
1074 | } | 1086 | } |
1075 | .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar { | 1087 | .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar { |
1076 | background-color: rgba(255, 255, 255, 0.75); | 1088 | background-color: rgba(255, 255, 255, 0.75); |
1077 | } | 1089 | } |
1078 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_draggerRail { | 1090 | .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_draggerRail { |
1079 | width: 100%; | 1091 | width: 100%; |
1080 | height: 2px; | 1092 | height: 2px; |
1081 | margin: 7px 0; | 1093 | margin: 7px 0; |
1082 | } | 1094 | } |
1083 | .mCSB_scrollTools .mCSB_draggerRail { | 1095 | .mCSB_scrollTools .mCSB_draggerRail { |
1084 | background-color: rgba(0, 0, 0, 0.4); | 1096 | background-color: rgba(0, 0, 0, 0.4); |
1085 | border-radius: 16px; | 1097 | border-radius: 16px; |
1086 | } | 1098 | } |
1087 | .mCustomScrollBox { | 1099 | .mCustomScrollBox { |
1088 | position: relative; | 1100 | position: relative; |
1089 | overflow: hidden; | 1101 | overflow: hidden; |
1090 | height: 100%; | 1102 | height: 100%; |
1091 | max-width: 100%; | 1103 | max-width: 100%; |
1092 | outline: none; | 1104 | outline: none; |
1093 | direction: ltr; | 1105 | direction: ltr; |
1094 | } | 1106 | } |
1095 | /* .mCSB_horizontal > .mCSB_container.mCS_no_scrollbar_x.mCS_x_hidden { | 1107 | /* .mCSB_horizontal > .mCSB_container.mCS_no_scrollbar_x.mCS_x_hidden { |
1096 | margin-bottom: 0; | 1108 | margin-bottom: 0; |
1097 | } | 1109 | } |
1098 | .mCSB_horizontal.mCSB_inside > .mCSB_container { | 1110 | .mCSB_horizontal.mCSB_inside > .mCSB_container { |
1099 | margin-right: 0; | 1111 | margin-right: 0; |
1100 | } */ | 1112 | } */ |
1101 | .mCSB_container { | 1113 | .mCSB_container { |
1102 | overflow: hidden; | 1114 | overflow: hidden; |
1103 | height: auto; | 1115 | height: auto; |
1104 | } | 1116 | } |
1105 | 1117 | ||
1106 | @media (min-width: 768px) { | 1118 | @media (min-width: 768px) { |
1107 | .col-sm-12 { | 1119 | .col-sm-12 { |
1108 | width: 100%; | 1120 | width: 100%; |
1109 | } | 1121 | } |
1110 | } | 1122 | } |
1111 | </style> | 1123 | </style> |
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 | 136 | <v-btn |
137 | round | 137 | round |
138 | dark | 138 | dark |
139 | @click="save" | 139 | @click="save" |
140 | :loading="editLoading" | 140 | :loading="editLoading" |
141 | class="add-button" | 141 | class="add-button" |
142 | >Update Subject</v-btn> | 142 | >Update Subject</v-btn> |
143 | </v-card-actions> | 143 | </v-card-actions> |
144 | </v-flex> | 144 | </v-flex> |
145 | </v-form> | 145 | </v-form> |
146 | </v-container> | 146 | </v-container> |
147 | </v-card> | 147 | </v-card> |
148 | </v-dialog> | 148 | </v-dialog> |
149 | 149 | ||
150 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> | 150 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> |
151 | 151 | ||
152 | <v-dialog v-model="viewSubjectDialog" max-width="500px"> | 152 | <v-dialog v-model="viewSubjectDialog" max-width="500px"> |
153 | <v-card flat class="card-style pa-3" dark> | 153 | <v-card flat class="card-style pa-3" dark> |
154 | <v-layout> | 154 | <v-layout> |
155 | <v-flex xs12> | 155 | <v-flex xs12> |
156 | <label class="title text-xs-center">View Subject</label> | 156 | <label class="title text-xs-center">View Subject</label> |
157 | <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon> | 157 | <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon> |
158 | </v-flex> | 158 | </v-flex> |
159 | </v-layout> | 159 | </v-layout> |
160 | <v-card-text> | 160 | <v-card-text> |
161 | <v-container grid-list-md> | 161 | <v-container grid-list-md> |
162 | <v-layout wrap> | 162 | <v-layout wrap> |
163 | <v-flex> | 163 | <v-flex> |
164 | <v-layout> | 164 | <v-layout> |
165 | <v-flex xs6 sm4> | 165 | <v-flex xs6 sm4> |
166 | <h5 class="right my-1"> | 166 | <h5 class="right my-1"> |
167 | <b>Subject Name:</b> | 167 | <b>Subject Name:</b> |
168 | </h5> | 168 | </h5> |
169 | </v-flex> | 169 | </v-flex> |
170 | <v-flex sm8 xs6> | 170 | <v-flex sm8 xs6> |
171 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> | 171 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> |
172 | </v-flex> | 172 | </v-flex> |
173 | </v-layout> | 173 | </v-layout> |
174 | <v-layout> | 174 | <v-layout> |
175 | <v-flex xs6 sm4> | 175 | <v-flex xs6 sm4> |
176 | <h5 class="right my-1"> | 176 | <h5 class="right my-1"> |
177 | <b>Subject Author:</b> | 177 | <b>Subject Author:</b> |
178 | </h5> | 178 | </h5> |
179 | </v-flex> | 179 | </v-flex> |
180 | <v-flex sm8 xs6> | 180 | <v-flex sm8 xs6> |
181 | <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5> | 181 | <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5> |
182 | </v-flex> | 182 | </v-flex> |
183 | </v-layout> | 183 | </v-layout> |
184 | <v-layout> | 184 | <v-layout> |
185 | <v-flex xs6 sm4> | 185 | <v-flex xs6 sm4> |
186 | <h5 class="right my-1"> | 186 | <h5 class="right my-1"> |
187 | <b>Subject :</b> | 187 | <b>Subject :</b> |
188 | </h5> | 188 | </h5> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex sm8 xs6> | 190 | <v-flex sm8 xs6> |
191 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> | 191 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> |
192 | </v-flex> | 192 | </v-flex> |
193 | </v-layout> | 193 | </v-layout> |
194 | <!-- <v-layout> | 194 | <!-- <v-layout> |
195 | <v-flex xs6 sm4> | 195 | <v-flex xs6 sm4> |
196 | <h5 class="right my-1"> | 196 | <h5 class="right my-1"> |
197 | <b>Teacher :</b> | 197 | <b>Teacher :</b> |
198 | </h5> | 198 | </h5> |
199 | </v-flex> | 199 | </v-flex> |
200 | <v-flex sm8 xs6> | 200 | <v-flex sm8 xs6> |
201 | <h5 class="my-1">{{ editedItem.teacherId }}</h5> | 201 | <h5 class="my-1">{{ editedItem.teacherId }}</h5> |
202 | </v-flex> | 202 | </v-flex> |
203 | </v-layout>--> | 203 | </v-layout>--> |
204 | <v-layout> | 204 | <v-layout> |
205 | <v-flex xs6 sm4> | 205 | <v-flex xs6 sm4> |
206 | <h5 class="right my-1"> | 206 | <h5 class="right my-1"> |
207 | <b>Pass Marks :</b> | 207 | <b>Pass Marks :</b> |
208 | </h5> | 208 | </h5> |
209 | </v-flex> | 209 | </v-flex> |
210 | <v-flex sm8 xs6> | 210 | <v-flex sm8 xs6> |
211 | <h5 class="my-1">{{ editedItem.passMarks }}</h5> | 211 | <h5 class="my-1">{{ editedItem.passMarks }}</h5> |
212 | </v-flex> | 212 | </v-flex> |
213 | </v-layout> | 213 | </v-layout> |
214 | <v-layout> | 214 | <v-layout> |
215 | <v-flex xs6 sm4> | 215 | <v-flex xs6 sm4> |
216 | <h5 class="right my-1"> | 216 | <h5 class="right my-1"> |
217 | <b>Final Marks :</b> | 217 | <b>Final Marks :</b> |
218 | </h5> | 218 | </h5> |
219 | </v-flex> | 219 | </v-flex> |
220 | <v-flex sm8 xs6> | 220 | <v-flex sm8 xs6> |
221 | <h5 class="my-1">{{ editedItem.finalMarks }}</h5> | 221 | <h5 class="my-1">{{ editedItem.finalMarks }}</h5> |
222 | </v-flex> | 222 | </v-flex> |
223 | </v-layout> | 223 | </v-layout> |
224 | <v-layout> | 224 | <v-layout> |
225 | <v-flex xs6 sm4> | 225 | <v-flex xs6 sm4> |
226 | <h5 class="right my-1"> | 226 | <h5 class="right my-1"> |
227 | <b>Type :</b> | 227 | <b>Type :</b> |
228 | </h5> | 228 | </h5> |
229 | </v-flex> | 229 | </v-flex> |
230 | <v-flex sm8 xs6> | 230 | <v-flex sm8 xs6> |
231 | <h5 class="my-1">{{ editedItem.type }}</h5> | 231 | <h5 class="my-1">{{ editedItem.type }}</h5> |
232 | </v-flex> | 232 | </v-flex> |
233 | </v-layout> | 233 | </v-layout> |
234 | </v-flex> | 234 | </v-flex> |
235 | </v-layout> | 235 | </v-layout> |
236 | </v-container> | 236 | </v-container> |
237 | </v-card-text> | 237 | </v-card-text> |
238 | </v-card> | 238 | </v-card> |
239 | </v-dialog> | 239 | </v-dialog> |
240 | 240 | ||
241 | <!-- ****** EXISTING SUBJECTS TABLE ****** --> | 241 | <!-- ****** EXISTING SUBJECTS TABLE ****** --> |
242 | <v-toolbar color="transparent" flat> | 242 | <v-toolbar color="transparent" flat> |
243 | <v-btn | 243 | <v-btn |
244 | fab | 244 | fab |
245 | dark | 245 | dark |
246 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 246 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
247 | small | 247 | small |
248 | @click="addSubjectDialog = true" | 248 | @click="addSubjectDialog = true" |
249 | > | 249 | > |
250 | <v-icon dark>add</v-icon> | 250 | <v-icon dark>add</v-icon> |
251 | </v-btn> | 251 | </v-btn> |
252 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> | 252 | <v-flex xs1 class="hidden-sm-only hidden-xs-only"> |
253 | <v-btn | 253 | <v-btn |
254 | round | 254 | round |
255 | class="open-dialog-button" | 255 | class="open-dialog-button" |
256 | dark | 256 | dark |
257 | @click="addSubjectDialog = true" | 257 | @click="addSubjectDialog = true" |
258 | v-if="role != 'TEACHER' " | 258 | v-if="role != 'TEACHER' " |
259 | > | 259 | > |
260 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Subject | 260 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Subject |
261 | </v-btn> | 261 | </v-btn> |
262 | </v-flex> | 262 | </v-flex> |
263 | <v-spacer></v-spacer> | 263 | <v-spacer></v-spacer> |
264 | <v-flex lg2 md2 xs12 v-show="show"> | 264 | <v-flex lg2 md2 xs12 v-show="show"> |
265 | <v-select | 265 | <v-select |
266 | :items="classList" | 266 | :items="classList" |
267 | label="Select Your Class" | 267 | label="Select Your Class" |
268 | v-model="getSubject.classId" | 268 | v-model="getSubject.classId" |
269 | item-text="classNum" | 269 | item-text="classNum" |
270 | item-value="_id" | 270 | item-value="_id" |
271 | name="Select Class" | 271 | name="Select Class" |
272 | :rules="classRules" | 272 | :rules="classRules" |
273 | @change="getClassSubject" | 273 | @change="getClassSubject" |
274 | class="pl-2" | 274 | class="pl-2" |
275 | required | 275 | required |
276 | ></v-select> | 276 | ></v-select> |
277 | </v-flex> | 277 | </v-flex> |
278 | <v-card-title class="body-1" v-show="show"> | 278 | <v-card-title class="body-1" v-show="show"> |
279 | <v-btn icon flat @click="displaySearch"> | 279 | <v-btn icon flat @click="displaySearch"> |
280 | <v-avatar size="27"> | 280 | <v-avatar size="27"> |
281 | <img src="/static/icon/search.png" alt="icon" /> | 281 | <img src="/static/icon/search.png" alt="icon" /> |
282 | </v-avatar> | 282 | </v-avatar> |
283 | </v-btn> | 283 | </v-btn> |
284 | </v-card-title> | 284 | </v-card-title> |
285 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="showSearch"> | 285 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="showSearch"> |
286 | <v-layout> | 286 | <v-layout> |
287 | <v-text-field | 287 | <v-text-field |
288 | autofocus | 288 | autofocus |
289 | v-model="search" | 289 | v-model="search" |
290 | label="Search" | 290 | label="Search" |
291 | prepend-inner-icon="search" | 291 | prepend-inner-icon="search" |
292 | color="primary" | 292 | color="primary" |
293 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 293 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
294 | ></v-text-field> | 294 | ></v-text-field> |
295 | <v-icon @click="closeSearch" color="error">close</v-icon> | 295 | <v-icon @click="closeSearch" color="error">close</v-icon> |
296 | </v-layout> | 296 | </v-layout> |
297 | </v-flex> | 297 | </v-flex> |
298 | </v-toolbar> | 298 | </v-toolbar> |
299 | <v-data-table | 299 | <v-data-table |
300 | :headers="headers" | 300 | :headers="headers" |
301 | :items="subjectList.subjects" | 301 | :items="subjectList.subjects" |
302 | :pagination.sync="pagination" | 302 | :pagination.sync="pagination" |
303 | :search="search" | 303 | :search="search" |
304 | > | 304 | > |
305 | <template slot="items" slot-scope="props"> | 305 | <template slot="items" slot-scope="props"> |
306 | <tr class="tr"> | 306 | <tr class="tr"> |
307 | <td class="td-row td">{{ props.index + 1 }}</td> | 307 | <td class="td-row td">{{ props.index + 1 }}</td> |
308 | <td class="text-xs-center td td-row">{{ props.item.subjectName }}</td> | 308 | <td class="text-xs-center td td-row">{{ props.item.subjectName }}</td> |
309 | <td class="text-xs-center td td-row">{{ props.item.subjectAuthor }}</td> | 309 | <td class="text-xs-center td td-row">{{ props.item.subjectAuthor }}</td> |
310 | <td class="text-xs-center td td-row">{{ props.item.subjectCode }}</td> | 310 | <td class="text-xs-center td td-row">{{ props.item.subjectCode }}</td> |
311 | <!-- <td class="text-xs-center td td-row">{{ props.item.teacherId }}</td> --> | 311 | <!-- <td class="text-xs-center td td-row">{{ props.item.teacherId }}</td> --> |
312 | <td class="text-xs-center td td-row">{{ props.item.passMarks }}</td> | 312 | <td class="text-xs-center td td-row">{{ props.item.passMarks }}</td> |
313 | <td class="text-xs-center td td-row">{{ props.item.finalMarks }}</td> | 313 | <td class="text-xs-center td td-row">{{ props.item.finalMarks }}</td> |
314 | <td class="text-xs-center td td-row">{{ props.item.type }}</td> | 314 | <td class="text-xs-center td td-row">{{ props.item.type }}</td> |
315 | 315 | ||
316 | <!-- <td class="text-xs-center td td-row"> | 316 | <!-- <td class="text-xs-center td td-row"> |
317 | <span> | 317 | <span> |
318 | <v-tooltip top> | 318 | <v-tooltip top> |
319 | <img | 319 | <img |
320 | slot="activator" | 320 | slot="activator" |
321 | style="cursor:pointer; width:25px; height:25px; " | 321 | style="cursor:pointer; width:25px; height:25px; " |
322 | class="mr-3" | 322 | class="mr-3" |
323 | @click="profile(props.item)" | 323 | @click="profile(props.item)" |
324 | src="/static/icon/view.png" | 324 | src="/static/icon/view.png" |
325 | /> | 325 | /> |
326 | <span>View</span> | 326 | <span>View</span> |
327 | </v-tooltip> | 327 | </v-tooltip> |
328 | <v-tooltip top> | 328 | <v-tooltip top> |
329 | <img | 329 | <img |
330 | slot="activator" | 330 | slot="activator" |
331 | style="cursor:pointer; width:20px; height:18px; " | 331 | style="cursor:pointer; width:20px; height:18px; " |
332 | class="mr-3" | 332 | class="mr-3" |
333 | @click="editItem(props.item)" | 333 | @click="editItem(props.item)" |
334 | src="/static/icon/edit.png" | 334 | src="/static/icon/edit.png" |
335 | /> | 335 | /> |
336 | <span>Edit</span> | 336 | <span>Edit</span> |
337 | </v-tooltip> | 337 | </v-tooltip> |
338 | <v-tooltip top> | 338 | <v-tooltip top> |
339 | <img | 339 | <img |
340 | slot="activator" | 340 | slot="activator" |
341 | style="cursor:pointer; width:20px; height:20px; " | 341 | style="cursor:pointer; width:20px; height:20px; " |
342 | class="mr-3" | 342 | class="mr-3" |
343 | @click="deleteItem(props.item)" | 343 | @click="deleteItem(props.item)" |
344 | src="/static/icon/delete.png" | 344 | src="/static/icon/delete.png" |
345 | /> | 345 | /> |
346 | <span>Delete</span> | 346 | <span>Delete</span> |
347 | </v-tooltip> | 347 | </v-tooltip> |
348 | </span> | 348 | </span> |
349 | </td>--> | 349 | </td>--> |
350 | </tr> | 350 | </tr> |
351 | </template> | 351 | </template> |
352 | <v-alert | 352 | <v-alert |
353 | slot="no-results" | 353 | slot="no-results" |
354 | :value="true" | 354 | :value="true" |
355 | color="error" | 355 | color="error" |
356 | icon="warning" | 356 | icon="warning" |
357 | >Your search for "{{ search }}" found no results.</v-alert> | 357 | >Your search for "{{ search }}" found no results.</v-alert> |
358 | </v-data-table> | 358 | </v-data-table> |
359 | <!-- ****** ADD MULTIPLE Subject ****** --> | 359 | <!-- ****** ADD MULTIPLE Subject ****** --> |
360 | <v-snackbar | 360 | <v-snackbar |
361 | :timeout="timeout" | 361 | :timeout="timeout" |
362 | :top="y === 'top'" | 362 | :top="y === 'top'" |
363 | :right="x === 'right'" | 363 | :right="x === 'right'" |
364 | :vertical="mode === 'vertical'" | 364 | :vertical="mode === 'vertical'" |
365 | v-model="snackbar" | 365 | v-model="snackbar" |
366 | :color="color" | 366 | :color="color" |
367 | >{{ text }}</v-snackbar> | 367 | >{{ text }}</v-snackbar> |
368 | <v-dialog v-model="addSubjectDialog" max-width="600px"> | 368 | <v-dialog v-model="addSubjectDialog" max-width="600px" v-if="addSubjectDialog"> |
369 | <v-card flat class="card-style pa-2" dark> | 369 | <v-card flat class="card-style pa-2" dark> |
370 | <v-layout> | 370 | <v-layout> |
371 | <v-flex xs12> | 371 | <v-flex xs12> |
372 | <label class="title text-xs-center">Add Subject</label> | 372 | <label class="title text-xs-center">Add Subject</label> |
373 | <v-icon size="24" class="right" @click="$refs.form.reset();addSubjectDialog = false">cancel</v-icon> | 373 | <v-icon |
374 | size="24" | ||
375 | class="right" | ||
376 | @click="$refs.form.reset();addSubjectDialog = false" | ||
377 | >cancel</v-icon> | ||
374 | </v-flex> | 378 | </v-flex> |
375 | </v-layout> | 379 | </v-layout> |
376 | <v-container fluid fill-height> | 380 | <v-container fluid fill-height> |
377 | <v-layout align-center> | 381 | <v-layout align-center> |
378 | <v-flex xs12> | 382 | <v-flex xs12> |
379 | <v-form ref="form" v-model="valid" lazy-validation> | 383 | <v-form ref="form" v-model="valid" lazy-validation> |
380 | <v-layout> | 384 | <v-layout> |
381 | <v-flex xs4 sm4 class="pt-4 subheading"> | 385 | <v-flex xs4 sm4 class="pt-4 subheading"> |
382 | <label class="right">Class Name :</label> | 386 | <label class="right">Class Name :</label> |
383 | </v-flex> | 387 | </v-flex> |
384 | <v-flex xs8 sm8 class="ml-3"> | 388 | <v-flex xs8 sm8 class="ml-3"> |
385 | <v-select | 389 | <v-select |
386 | v-model="addSubject.classId" | 390 | v-model="addSubject.classId" |
387 | label="Select your class" | 391 | label="Select your class" |
388 | type="text" | 392 | type="text" |
389 | :items="classList" | 393 | :items="classList" |
390 | item-text="classNum" | 394 | item-text="classNum" |
391 | item-value="_id" | 395 | item-value="_id" |
392 | :rules="classRules" | 396 | :rules="classRules" |
393 | required | 397 | required |
394 | ></v-select> | 398 | ></v-select> |
395 | </v-flex> | 399 | </v-flex> |
396 | </v-layout> | 400 | </v-layout> |
397 | <v-layout> | 401 | <v-layout> |
398 | <v-flex xs4 sm4 class="pt-4 subheading"> | 402 | <v-flex xs4 sm4 class="pt-4 subheading"> |
399 | <label class="right">Teacher Name :</label> | 403 | <label class="right">Teacher Name :</label> |
400 | </v-flex> | 404 | </v-flex> |
401 | <v-flex xs8 sm8 class="ml-3"> | 405 | <v-flex xs8 sm8 class="ml-3"> |
402 | <v-select | 406 | <v-select |
403 | v-model="addSubject.teacherId" | 407 | v-model="addSubject.teacherId" |
404 | label="Select your teacher" | 408 | label="Select your teacher" |
405 | type="text" | 409 | type="text" |
406 | :items="teacherList" | 410 | :items="teacherList" |
407 | item-text="name" | 411 | item-text="name" |
408 | item-value="_id" | 412 | item-value="_id" |
409 | :rules="teacherRules" | 413 | :rules="teacherRules" |
410 | required | 414 | required |
411 | ></v-select> | 415 | ></v-select> |
412 | </v-flex> | 416 | </v-flex> |
413 | </v-layout> | 417 | </v-layout> |
414 | <v-layout> | 418 | <v-layout> |
415 | <v-flex xs4 sm4 class="pt-4 sybheading"> | 419 | <v-flex xs4 sm4 class="pt-4 sybheading"> |
416 | <label class="right">Type :</label> | 420 | <label class="right">Type :</label> |
417 | </v-flex> | 421 | </v-flex> |
418 | <v-flex xs8 sm8 class="ml-3"> | 422 | <v-flex xs8 sm8 class="ml-3"> |
419 | <v-select | 423 | <v-select |
420 | v-model="addSubject.type" | 424 | v-model="addSubject.type" |
421 | :items="type" | 425 | :items="type" |
422 | label="Select your Type" | 426 | label="Select your Type" |
423 | :rules="typeRules" | 427 | :rules="typeRules" |
424 | required | 428 | required |
425 | ></v-select> | 429 | ></v-select> |
426 | </v-flex> | 430 | </v-flex> |
427 | </v-layout> | 431 | </v-layout> |
428 | <v-layout> | 432 | <v-layout> |
429 | <v-flex xs4 sm4 class="pt-4 subheading"> | 433 | <v-flex xs4 sm4 class="pt-4 subheading"> |
430 | <label class="right">Pass Mark :</label> | 434 | <label class="right">Pass Mark :</label> |
431 | </v-flex> | 435 | </v-flex> |
432 | <v-flex xs8 sm8 class="ml-3"> | 436 | <v-flex xs8 sm8 class="ml-3"> |
433 | <v-text-field | 437 | <v-text-field |
434 | label="Fill your Pass Mark" | 438 | label="Fill your Pass Mark" |
435 | name="name" | 439 | name="name" |
436 | type="text" | 440 | type="text" |
437 | :rules="markRules" | 441 | :rules="markRules" |
438 | v-model="addSubject.passMarks" | 442 | v-model="addSubject.passMarks" |
439 | required | 443 | required |
440 | ></v-text-field> | 444 | ></v-text-field> |
441 | </v-flex> | 445 | </v-flex> |
442 | </v-layout> | 446 | </v-layout> |
443 | <v-layout> | 447 | <v-layout> |
444 | <v-flex xs4 sm4 class="pt-4 subheading"> | 448 | <v-flex xs4 sm4 class="pt-4 subheading"> |
445 | <label class="right">Final Mark :</label> | 449 | <label class="right">Final Mark :</label> |
446 | </v-flex> | 450 | </v-flex> |
447 | <v-flex xs8 sm8 class="ml-3"> | 451 | <v-flex xs8 sm8 class="ml-3"> |
448 | <v-text-field | 452 | <v-text-field |
449 | label="Fill your final mark" | 453 | label="Fill your final mark" |
450 | name="name" | 454 | name="name" |
451 | type="text" | 455 | type="text" |
452 | :rules="finalRules" | 456 | :rules="finalRules" |
453 | v-model="addSubject.finalMarks" | 457 | v-model="addSubject.finalMarks" |
454 | required | 458 | required |
455 | ></v-text-field> | 459 | ></v-text-field> |
456 | </v-flex> | 460 | </v-flex> |
457 | </v-layout> | 461 | </v-layout> |
458 | <v-layout> | 462 | <v-layout> |
459 | <v-flex xs4 sm4 class="pt-4 subheading"> | 463 | <v-flex xs4 sm4 class="pt-4 subheading"> |
460 | <label class="right">Subject :</label> | 464 | <label class="right">Subject :</label> |
461 | </v-flex> | 465 | </v-flex> |
462 | <v-flex xs8 sm8 class="ml-3"> | 466 | <v-flex xs8 sm8 class="ml-3"> |
463 | <v-text-field | 467 | <v-text-field |
464 | v-model="addSubject.subjectName" | 468 | v-model="addSubject.subjectName" |
465 | placeholder="fill your Subject Name" | 469 | placeholder="fill your Subject Name" |
466 | name="name" | 470 | name="name" |
467 | type="text" | 471 | type="text" |
468 | :rules="subjectRules" | 472 | :rules="subjectRules" |
469 | required | 473 | required |
470 | ></v-text-field> | 474 | ></v-text-field> |
471 | </v-flex> | 475 | </v-flex> |
472 | </v-layout> | 476 | </v-layout> |
473 | <v-layout> | 477 | <v-layout> |
474 | <v-flex xs4 sm4 class="pt-4 subheading"> | 478 | <v-flex xs4 sm4 class="pt-4 subheading"> |
475 | <label class="right">Subject Author :</label> | 479 | <label class="right">Subject Author :</label> |
476 | </v-flex> | 480 | </v-flex> |
477 | <v-flex xs8 sm8 class="ml-3"> | 481 | <v-flex xs8 sm8 class="ml-3"> |
478 | <v-text-field | 482 | <v-text-field |
479 | v-model="addSubject.subjectAuthor" | 483 | v-model="addSubject.subjectAuthor" |
480 | placeholder="fill your Subject Author" | 484 | placeholder="fill your Subject Author" |
481 | name="name" | 485 | name="name" |
482 | type="text" | 486 | type="text" |
483 | ></v-text-field> | 487 | ></v-text-field> |
484 | </v-flex> | 488 | </v-flex> |
485 | </v-layout> | 489 | </v-layout> |
486 | <v-layout> | 490 | <v-layout> |
487 | <v-flex xs4 sm4 class="pt-4 subheading"> | 491 | <v-flex xs4 sm4 class="pt-4 subheading"> |
488 | <label class="right">Subject Code:</label> | 492 | <label class="right">Subject Code:</label> |
489 | </v-flex> | 493 | </v-flex> |
490 | <v-flex xs8 sm8 class="ml-3"> | 494 | <v-flex xs8 sm8 class="ml-3"> |
491 | <v-text-field | 495 | <v-text-field |
492 | v-model="addSubject.subjectCode" | 496 | v-model="addSubject.subjectCode" |
493 | placeholder="fill your Subject Code" | 497 | placeholder="fill your Subject Code" |
494 | name="name" | 498 | name="name" |
495 | type="text" | 499 | type="text" |
496 | ></v-text-field> | 500 | ></v-text-field> |
497 | </v-flex> | 501 | </v-flex> |
498 | </v-layout> | 502 | </v-layout> |
499 | <v-layout> | 503 | <v-layout> |
500 | <v-flex xs12 sm12> | 504 | <v-flex xs12 sm12> |
501 | <v-card-actions> | 505 | <v-card-actions> |
502 | <v-spacer></v-spacer> | 506 | <v-spacer></v-spacer> |
503 | <v-btn | 507 | <v-btn |
504 | @click="submit" | 508 | @click="submit" |
505 | round | 509 | round |
506 | dark | 510 | dark |
507 | :loading="addLoading" | 511 | :loading="addLoading" |
508 | class="add-button" | 512 | class="add-button" |
509 | >Add Subject</v-btn> | 513 | >Add Subject</v-btn> |
510 | </v-card-actions> | 514 | </v-card-actions> |
511 | </v-flex> | 515 | </v-flex> |
512 | </v-layout> | 516 | </v-layout> |
513 | </v-form> | 517 | </v-form> |
514 | </v-flex> | 518 | </v-flex> |
515 | </v-layout> | 519 | </v-layout> |
516 | </v-container> | 520 | </v-container> |
517 | </v-card> | 521 | </v-card> |
518 | </v-dialog> | 522 | </v-dialog> |
519 | <div class="loader" v-if="showLoader"> | 523 | <div class="loader" v-if="showLoader"> |
520 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 524 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
521 | </div> | 525 | </div> |
522 | </v-container> | 526 | </v-container> |
523 | </template> | 527 | </template> |
524 | 528 | ||
525 | <script> | 529 | <script> |
526 | import http from "@/Services/http.js"; | 530 | import http from "@/Services/http.js"; |
527 | import Util from "@/util"; | 531 | import Util from "@/util"; |
528 | 532 | ||
529 | export default { | 533 | export default { |
530 | data: () => ({ | 534 | data: () => ({ |
531 | snackbar: false, | 535 | snackbar: false, |
532 | y: "top", | 536 | y: "top", |
533 | x: "right", | 537 | x: "right", |
534 | role: "", | 538 | role: "", |
535 | mode: "", | 539 | mode: "", |
536 | timeout: 3000, | 540 | timeout: 3000, |
537 | text: "", | 541 | text: "", |
538 | color: "", | 542 | color: "", |
539 | show: true, | 543 | show: true, |
540 | showSearch: false, | 544 | showSearch: false, |
541 | showLoader: false, | 545 | showLoader: false, |
542 | loading: false, | 546 | loading: false, |
543 | editLoading: false, | 547 | editLoading: false, |
544 | addLoading: false, | 548 | addLoading: false, |
545 | date: null, | 549 | date: null, |
546 | search: "", | 550 | search: "", |
547 | viewSubjectDialog: false, | 551 | viewSubjectDialog: false, |
548 | editSubjectDialog: false, | 552 | editSubjectDialog: false, |
549 | valid: true, | 553 | valid: true, |
550 | validEditSubject: true, | 554 | validEditSubject: true, |
551 | addSubjectDialog: false, | 555 | addSubjectDialog: false, |
552 | // isActive: true, | 556 | // isActive: true, |
553 | // newActive: false, | 557 | // newActive: false, |
554 | type: ["Optional", "Mandatory"], | 558 | type: ["Optional", "Mandatory"], |
555 | pagination: { | 559 | pagination: { |
556 | rowsPerPage: 10, | 560 | rowsPerPage: 10, |
557 | }, | 561 | }, |
558 | token: "", | 562 | token: "", |
559 | classRules: [(v) => !!v || " Class Name is required"], | 563 | classRules: [(v) => !!v || " Class Name is required"], |
560 | teacherRules: [(v) => !!v || " Teacher Name is required"], | 564 | teacherRules: [(v) => !!v || " Teacher Name is required"], |
561 | typeRules: [(v) => !!v || "Type is required"], | 565 | typeRules: [(v) => !!v || "Type is required"], |
562 | markRules: [(v) => !!v || " Pass Mark is required"], | 566 | markRules: [(v) => !!v || " Pass Mark is required"], |
563 | finalRules: [(v) => !!v || "Final MArk is required"], | 567 | finalRules: [(v) => !!v || "Final MArk is required"], |
564 | subjectRules: [(v) => !!v || " Subject Name is required"], | 568 | subjectRules: [(v) => !!v || " Subject Name is required"], |
565 | headers: [ | 569 | headers: [ |
566 | { | 570 | { |
567 | text: "No", | 571 | text: "No", |
568 | align: "", | 572 | align: "", |
569 | sortable: false, | 573 | sortable: false, |
570 | value: "No", | 574 | value: "No", |
571 | }, | 575 | }, |
572 | { | 576 | { |
573 | text: "Subject Name", | 577 | text: "Subject Name", |
574 | value: "subjectName", | 578 | value: "subjectName", |
575 | sortable: false, | 579 | sortable: false, |
576 | align: "center", | 580 | align: "center", |
577 | }, | 581 | }, |
578 | { | 582 | { |
579 | text: "Subject Author", | 583 | text: "Subject Author", |
580 | value: "subjectAuthor", | 584 | value: "subjectAuthor", |
581 | sortable: false, | 585 | sortable: false, |
582 | align: "center", | 586 | align: "center", |
583 | }, | 587 | }, |
584 | { | 588 | { |
585 | text: "Subject Code", | 589 | text: "Subject Code", |
586 | value: "subjectCode", | 590 | value: "subjectCode", |
587 | sortable: false, | 591 | sortable: false, |
588 | align: "center", | 592 | align: "center", |
589 | }, | 593 | }, |
590 | // { | 594 | // { |
591 | // text: "Teacher", | 595 | // text: "Teacher", |
592 | // value: "teacherId", | 596 | // value: "teacherId", |
593 | // sortable: false, | 597 | // sortable: false, |
594 | // align: "center" | 598 | // align: "center" |
595 | // }, | 599 | // }, |
596 | { | 600 | { |
597 | text: "Pass Marks", | 601 | text: "Pass Marks", |
598 | value: "passMarks", | 602 | value: "passMarks", |
599 | sortable: false, | 603 | sortable: false, |
600 | align: "center", | 604 | align: "center", |
601 | }, | 605 | }, |
602 | { | 606 | { |
603 | text: "Final Marks", | 607 | text: "Final Marks", |
604 | value: "finalMarks", | 608 | value: "finalMarks", |
605 | sortable: false, | 609 | sortable: false, |
606 | align: "center", | 610 | align: "center", |
607 | }, | 611 | }, |
608 | { | 612 | { |
609 | text: "Type", | 613 | text: "Type", |
610 | value: "type", | 614 | value: "type", |
611 | sortable: false, | 615 | sortable: false, |
612 | align: "center", | 616 | align: "center", |
613 | }, | 617 | }, |
614 | // { text: "Action", value: "", sortable: false, align: "center" } | 618 | // { text: "Action", value: "", sortable: false, align: "center" } |
615 | ], | 619 | ], |
616 | subjectList: [], | 620 | subjectList: [], |
617 | classList: [], | 621 | classList: [], |
618 | teacherList: [], | 622 | teacherList: [], |
619 | editedIndex: -1, | 623 | editedIndex: -1, |
620 | addSubject: {}, | 624 | addSubject: {}, |
621 | getSubject: {}, | 625 | getSubject: {}, |
622 | 626 | ||
623 | editedItem: { | 627 | editedItem: { |
624 | // subjectName: "", | 628 | // subjectName: "", |
625 | // subjectAuthor: "" | 629 | // subjectAuthor: "" |
626 | }, | 630 | }, |
627 | }), | 631 | }), |
632 | watch: { | ||
633 | addSubjectDialog: function (val) { | ||
634 | if (!val) { | ||
635 | this.addSubject = []; | ||
636 | } | ||
637 | }, | ||
638 | }, | ||
628 | methods: { | 639 | methods: { |
629 | pickFile() { | 640 | pickFile() { |
630 | this.$refs.image.click(); | 641 | this.$refs.image.click(); |
631 | }, | 642 | }, |
632 | editItem(item) { | 643 | editItem(item) { |
633 | this.editedIndex = this.subjectList.subjects; | 644 | this.editedIndex = this.subjectList.subjects; |
634 | this.editedItem = Object.assign({}, item); | 645 | this.editedItem = Object.assign({}, item); |
635 | this.dialog = true; | 646 | this.dialog = true; |
636 | this.editSubjectDialog = true; | 647 | this.editSubjectDialog = true; |
637 | }, | 648 | }, |
638 | profile(item) { | 649 | profile(item) { |
639 | this.editedIndex = this.subjectList.subjects; | 650 | this.editedIndex = this.subjectList.subjects; |
640 | this.editedItem = Object.assign({}, item); | 651 | this.editedItem = Object.assign({}, item); |
641 | this.dialog1 = true; | 652 | this.dialog1 = true; |
642 | this.viewSubjectDialog = true; | 653 | this.viewSubjectDialog = true; |
643 | }, | 654 | }, |
644 | deleteItem(item) { | 655 | deleteItem(item) { |
645 | let deleteSubject = { | 656 | let deleteSubject = { |
646 | classId: this.addSubject.classId, | 657 | classId: this.addSubject.classId, |
647 | subjectId: item._id, | 658 | subjectId: item._id, |
648 | }; | 659 | }; |
649 | http() | 660 | http() |
650 | .delete( | 661 | .delete( |
651 | "/deleteSubject", | 662 | "/deleteSubject", |
652 | confirm("Are you sure you want to delete this?") && { | 663 | confirm("Are you sure you want to delete this?") && { |
653 | params: deleteSubject, | 664 | params: deleteSubject, |
654 | } | 665 | } |
655 | ) | 666 | ) |
656 | .then((response) => { | 667 | .then((response) => { |
657 | this.snackbar = true; | 668 | this.snackbar = true; |
658 | this.color = "green"; | 669 | this.color = "green"; |
659 | this.text = "Successfully delete Existing Subject"; | 670 | this.text = "Successfully delete Existing Subject"; |
660 | this.getClassSubject(this.addSubject.classId); | 671 | this.getClassSubject(this.addSubject.classId); |
661 | }) | 672 | }) |
662 | .catch((error) => { | 673 | .catch((error) => { |
663 | // this.snackbar = true; | 674 | // this.snackbar = true; |
664 | // this.text = error.response.data.message; | 675 | // this.text = error.response.data.message; |
665 | // this.color = "error"; | 676 | // this.color = "error"; |
666 | console.log("error", error); | 677 | console.log("error", error); |
667 | }); | 678 | }); |
668 | }, | 679 | }, |
669 | close() { | 680 | close() { |
670 | this.editSubjectDialog = false; | 681 | this.editSubjectDialog = false; |
671 | }, | 682 | }, |
672 | close1() { | 683 | close1() { |
673 | this.viewSubjectDialog = false; | 684 | this.viewSubjectDialog = false; |
674 | }, | 685 | }, |
675 | submit() { | 686 | submit() { |
676 | if (this.$refs.form.validate()) { | 687 | if (this.$refs.form.validate()) { |
677 | this.addLoading = true; | 688 | this.addLoading = true; |
678 | http() | 689 | http() |
679 | .post("/addSubject", this.addSubject) | 690 | .post("/addSubject", this.addSubject) |
680 | .then((response) => { | 691 | .then((response) => { |
681 | this.snackbar = true; | 692 | this.snackbar = true; |
682 | this.text = "New Subject added successfully"; | 693 | this.text = "New Subject added successfully"; |
683 | this.color = "green"; | 694 | this.color = "green"; |
684 | this.addLoading = false; | 695 | this.addLoading = false; |
685 | this.$refs.form.reset() | 696 | this.$refs.form.reset(); |
686 | this.addSubjectDialog = false; | 697 | this.addSubjectDialog = false; |
687 | this.getClassSubject(_id); | 698 | this.getClassSubject(_id); |
688 | }) | 699 | }) |
689 | .catch((error) => { | 700 | .catch((error) => { |
690 | this.addLoading = false; | 701 | this.addLoading = false; |
691 | }); | 702 | }); |
692 | } | 703 | } |
693 | }, | 704 | }, |
694 | clear() { | 705 | clear() { |
695 | this.$refs.form.reset(); | 706 | this.$refs.form.reset(); |
696 | }, | 707 | }, |
697 | save() { | 708 | save() { |
698 | if (this.$refs.formEditSubject.validate()) { | 709 | if (this.$refs.formEditSubject.validate()) { |
699 | let editSubject = { | 710 | let editSubject = { |
700 | classId: this.editedItem.classId, | 711 | classId: this.editedItem.classId, |
701 | subjectId: this.editedItem._id, | 712 | subjectId: this.editedItem._id, |
702 | teacherId: this.editedItem.teacherId, | 713 | teacherId: this.editedItem.teacherId, |
703 | type: this.editedItem.type, | 714 | type: this.editedItem.type, |
704 | passMarks: this.editedItem.passMarks, | 715 | passMarks: this.editedItem.passMarks, |
705 | finalMarks: this.editedItem.finalMarks, | 716 | finalMarks: this.editedItem.finalMarks, |
706 | subjectAuthor: this.editedItem.subjectAuthor, | 717 | subjectAuthor: this.editedItem.subjectAuthor, |
707 | subjectCode: this.editedItem.subjectCode, | 718 | subjectCode: this.editedItem.subjectCode, |
708 | subjectName: this.editedItem.subjectName, | 719 | subjectName: this.editedItem.subjectName, |
709 | }; | 720 | }; |
710 | this.editLoading = true; | 721 | this.editLoading = true; |
711 | http() | 722 | http() |
712 | .put("/updateSubject", editSubject) | 723 | .put("/updateSubject", editSubject) |
713 | .then((response) => { | 724 | .then((response) => { |
714 | this.snackbar = true; | 725 | this.snackbar = true; |
715 | this.text = "Successfully Edit Existing Subject"; | 726 | this.text = "Successfully Edit Existing Subject"; |
716 | this.color = "green"; | 727 | this.color = "green"; |
717 | this.editLoading = false; | 728 | this.editLoading = false; |
718 | this.editSubjectDialog = false; | 729 | this.editSubjectDialog = false; |
719 | this.getClassSubject(this.editedItem.classId); | 730 | this.getClassSubject(this.editedItem.classId); |
720 | }) | 731 | }) |
721 | .catch((error) => { | 732 | .catch((error) => { |
722 | this.editLoading = false; | 733 | this.editLoading = false; |
723 | 734 | ||
724 | // console.log(error); | 735 | // console.log(error); |
725 | }); | 736 | }); |
726 | } | 737 | } |
727 | }, | 738 | }, |
728 | getClassSubject(_id) { | 739 | getClassSubject(_id) { |
729 | this.showLoader = true; | 740 | this.showLoader = true; |
730 | console.log("class", _id); | 741 | console.log("class", _id); |
731 | // this.classId = this.classId; | 742 | // this.classId = this.classId; |
732 | http() | 743 | http() |
733 | .get( | 744 | .get( |
734 | "/getParticularClass", | 745 | "/getParticularClass", |
735 | { params: { classId: _id } }, | 746 | { params: { classId: _id } }, |
736 | { | 747 | { |
737 | headers: { Authorization: "Bearer " + this.token }, | 748 | headers: { Authorization: "Bearer " + this.token }, |
738 | } | 749 | } |
739 | ) | 750 | ) |
740 | .then((response) => { | 751 | .then((response) => { |
741 | this.subjectList = response.data.data; | 752 | this.subjectList = response.data.data; |
742 | this.showLoader = false; | 753 | this.showLoader = false; |
743 | }) | 754 | }) |
744 | .catch((err) => { | 755 | .catch((err) => { |
745 | this.showLoader = false; | 756 | this.showLoader = false; |
746 | }); | 757 | }); |
747 | }, | 758 | }, |
748 | getClass() { | 759 | getClass() { |
749 | http() | 760 | http() |
750 | .get("/getClassesList", { | 761 | .get("/getClassesList", { |
751 | headers: { Authorization: "Bearer " + this.token }, | 762 | headers: { Authorization: "Bearer " + this.token }, |
752 | }) | 763 | }) |
753 | .then((response) => { | 764 | .then((response) => { |
754 | this.classList = response.data.data; | 765 | this.classList = response.data.data; |
755 | }) | 766 | }) |
756 | .catch((error) => { | 767 | .catch((error) => { |
757 | if (error.response.status === 401) { | 768 | if (error.response.status === 401) { |
758 | this.$router.replace({ path: "/" }); | 769 | this.$router.replace({ path: "/" }); |
759 | this.$store.dispatch("setToken", null); | 770 | this.$store.dispatch("setToken", null); |
760 | this.$store.dispatch("Id", null); | 771 | this.$store.dispatch("Id", null); |
761 | } | 772 | } |
762 | }); | 773 | }); |
763 | }, | 774 | }, |
764 | getTeacherList() { | 775 | getTeacherList() { |
765 | this.showLoader = true; | 776 | this.showLoader = true; |
766 | var token = this.$store.state.token; | 777 | var token = this.$store.state.token; |
767 | http() | 778 | http() |
768 | .get("/getTeachersList", { | 779 | .get("/getTeachersList", { |
769 | headers: { Authorization: "Bearer " + token }, | 780 | headers: { Authorization: "Bearer " + token }, |
770 | }) | 781 | }) |
771 | .then((response) => { | 782 | .then((response) => { |
772 | this.teacherList = response.data.data; | 783 | this.teacherList = response.data.data; |
773 | this.showLoader = false; | 784 | this.showLoader = false; |
774 | // console.log("getTeacherList=====>",this.desserts) | 785 | // console.log("getTeacherList=====>",this.desserts) |
775 | }) | 786 | }) |
776 | .catch((error) => { | 787 | .catch((error) => { |
777 | this.showLoader = false; | 788 | this.showLoader = false; |
778 | if (error.response.status === 401) { | 789 | if (error.response.status === 401) { |
779 | this.$router.replace({ path: "/" }); | 790 | this.$router.replace({ path: "/" }); |
780 | this.$store.dispatch("setToken", null); | 791 | this.$store.dispatch("setToken", null); |
781 | this.$store.dispatch("Id", null); | 792 | this.$store.dispatch("Id", null); |
782 | } | 793 | } |
783 | }); | 794 | }); |
784 | }, | 795 | }, |
785 | displaySearch() { | 796 | displaySearch() { |
786 | (this.show = false), (this.showSearch = true); | 797 | (this.show = false), (this.showSearch = true); |
787 | }, | 798 | }, |
788 | closeSearch() { | 799 | closeSearch() { |
789 | this.showSearch = false; | 800 | this.showSearch = false; |
790 | this.show = true; | 801 | this.show = true; |
791 | this.search = ""; | 802 | this.search = ""; |
792 | }, | 803 | }, |
793 | }, | 804 | }, |
794 | mounted() { | 805 | mounted() { |
795 | this.token = this.$store.state.token; | 806 | this.token = this.$store.state.token; |
796 | // this.getNoticeDataList(); | 807 | // this.getNoticeDataList(); |
797 | this.getClass(); | 808 | this.getClass(); |
798 | this.getTeacherList(); | 809 | this.getTeacherList(); |
799 | this.role = this.$store.state.role; | 810 | this.role = this.$store.state.role; |
800 | }, | 811 | }, |
801 | }; | 812 | }; |
802 | </script> | 813 | </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="showSyllabus.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-if="showSearch"> | 165 | <v-flex xs9 sm9 md2 lg2 xl2 v-if="showSearch"> |
166 | <v-layout> | 166 | <v-layout> |
167 | <v-text-field | 167 | <v-text-field |
168 | autofocus | 168 | autofocus |
169 | v-model="search" | 169 | v-model="search" |
170 | label="Search" | 170 | label="Search" |
171 | prepend-inner-icon="search" | 171 | prepend-inner-icon="search" |
172 | color="primary" | 172 | color="primary" |
173 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 173 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
174 | ></v-text-field> | 174 | ></v-text-field> |
175 | <v-icon @click="closeSearch" color="error">close</v-icon> | 175 | <v-icon @click="closeSearch" color="error">close</v-icon> |
176 | </v-layout> | 176 | </v-layout> |
177 | </v-flex> | 177 | </v-flex> |
178 | </v-toolbar> | 178 | </v-toolbar> |
179 | <v-data-table | 179 | <v-data-table |
180 | :headers="headers" | 180 | :headers="headers" |
181 | :items="syllabusList" | 181 | :items="syllabusList" |
182 | :pagination.sync="pagination" | 182 | :pagination.sync="pagination" |
183 | :search="search" | 183 | :search="search" |
184 | > | 184 | > |
185 | <template slot="items" slot-scope="props"> | 185 | <template slot="items" slot-scope="props"> |
186 | <tr class="tr"> | 186 | <tr class="tr"> |
187 | <td class="td-row td">{{ props.index + 1 }}</td> | 187 | <td class="td-row td">{{ props.index + 1 }}</td> |
188 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> | 188 | <td class="text-xs-center td td-row">{{ props.item.title }}</td> |
189 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> | 189 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> |
190 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> | 190 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> |
191 | <td | 191 | <td |
192 | class="text-xs-center td td-row" | 192 | class="text-xs-center td td-row" |
193 | v-if="props.item.teacherId" | 193 | v-if="props.item.teacherId" |
194 | >{{ props.item.teacherId.name }}</td> | 194 | >{{ props.item.teacherId.name }}</td> |
195 | <td | 195 | <td class="text-xs-center td td-row" v-else>{{ props.item.schoolId.name }}</td> |
196 | class="text-xs-center td td-row" | ||
197 | v-else | ||
198 | >{{ props.item.schoolId.name }}</td> | ||
199 | <td class="text-xs-center td td-row"> | 196 | <td class="text-xs-center td td-row"> |
200 | <v-btn | 197 | <v-btn |
201 | class="add-button" | 198 | class="add-button" |
202 | @click="generatePDF2Canvas(props.item)" | 199 | @click="generatePDF2Canvas(props.item)" |
203 | :loading="loadingPdf" | 200 | :loading="loadingPdf" |
204 | dark | 201 | dark |
205 | >{{ props.item.fileType }}</v-btn> | 202 | >{{ props.item.fileType }}</v-btn> |
206 | </td> | 203 | </td> |
207 | <td class="text-xs-center td td-row"> | 204 | <td class="text-xs-center td td-row"> |
208 | <span> | 205 | <span> |
209 | <v-tooltip top> | 206 | <v-tooltip top> |
210 | <img | 207 | <img |
211 | slot="activator" | 208 | slot="activator" |
212 | style="cursor:pointer; width:20px; height:18px; " | 209 | style="cursor:pointer; width:20px; height:18px; " |
213 | class="mr-3" | 210 | class="mr-3" |
214 | @click="editItem(props.item)" | 211 | @click="editItem(props.item)" |
215 | src="/static/icon/edit.png" | 212 | src="/static/icon/edit.png" |
216 | /> | 213 | /> |
217 | <span>Edit</span> | 214 | <span>Edit</span> |
218 | </v-tooltip> | 215 | </v-tooltip> |
219 | <v-tooltip top> | 216 | <v-tooltip top> |
220 | <img | 217 | <img |
221 | slot="activator" | 218 | slot="activator" |
222 | style="cursor:pointer; width:20px; height:20px; " | 219 | style="cursor:pointer; width:20px; height:20px; " |
223 | class="mr-3" | 220 | class="mr-3" |
224 | @click="deleteItem(props.item)" | 221 | @click="deleteItem(props.item)" |
225 | src="/static/icon/delete.png" | 222 | src="/static/icon/delete.png" |
226 | /> | 223 | /> |
227 | <span>Delete</span> | 224 | <span>Delete</span> |
228 | </v-tooltip> | 225 | </v-tooltip> |
229 | </span> | 226 | </span> |
230 | </td> | 227 | </td> |
231 | </tr> | 228 | </tr> |
232 | </template> | 229 | </template> |
233 | <v-alert | 230 | <v-alert |
234 | slot="no-results" | 231 | slot="no-results" |
235 | :value="true" | 232 | :value="true" |
236 | color="error" | 233 | color="error" |
237 | icon="warning" | 234 | icon="warning" |
238 | >Your search for "{{ search }}" found no results.</v-alert> | 235 | >Your search for "{{ search }}" found no results.</v-alert> |
239 | </v-data-table> | 236 | </v-data-table> |
240 | <!-- ****** ADD SYLLABUS ****** --> | 237 | <!-- ****** ADD SYLLABUS ****** --> |
241 | <v-snackbar | 238 | <v-snackbar |
242 | :timeout="timeout" | 239 | :timeout="timeout" |
243 | :top="y === 'top'" | 240 | :top="y === 'top'" |
244 | :right="x === 'right'" | 241 | :right="x === 'right'" |
245 | :vertical="mode === 'vertical'" | 242 | :vertical="mode === 'vertical'" |
246 | v-model="snackbar" | 243 | v-model="snackbar" |
247 | :color="color" | 244 | :color="color" |
248 | >{{ text }}</v-snackbar> | 245 | >{{ text }}</v-snackbar> |
249 | <v-dialog v-model="addSyllabusDialog" max-width="400px"> | 246 | <v-dialog v-model="addSyllabusDialog" max-width="400px" v-if="addSyllabusDialog"> |
250 | <v-card flat class="card-style pa-2" dark> | 247 | <v-card flat class="card-style pa-2" dark> |
251 | <v-layout> | 248 | <v-layout> |
252 | <v-flex xs12> | 249 | <v-flex xs12> |
253 | <label class="title text-xs-center">Add Syllabus</label> | 250 | <label class="title text-xs-center">Add Syllabus</label> |
254 | <v-icon size="24" class="right" @click="addSyllabusDialog = false">cancel</v-icon> | 251 | <v-icon size="24" class="right" @click="closeAddStudentModel">cancel</v-icon> |
255 | </v-flex> | 252 | </v-flex> |
256 | </v-layout> | 253 | </v-layout> |
257 | <v-container fluid fill-height> | 254 | <v-container fluid fill-height> |
258 | <v-layout align-center> | 255 | <v-layout align-center> |
259 | <v-flex xs12> | 256 | <v-flex xs12> |
260 | <v-form ref="form" v-model="valid" lazy-validation> | 257 | <v-form ref="form" v-model="valid" lazy-validation> |
261 | <v-layout> | 258 | <v-layout> |
262 | <v-flex xs4 sm4 class="pt-4 subheading"> | 259 | <v-flex xs4 sm4 class="pt-4 subheading"> |
263 | <label class="right">Title :</label> | 260 | <label class="right">Title :</label> |
264 | </v-flex> | 261 | </v-flex> |
265 | <v-flex xs8 sm8 class="ml-3"> | 262 | <v-flex xs8 sm8 class="ml-3"> |
266 | <v-text-field | 263 | <v-text-field |
267 | v-model="addSyllabus.title" | 264 | v-model="addSyllabus.title" |
268 | name="name" | 265 | name="name" |
269 | type="text" | 266 | type="text" |
270 | placeholder="Add Title" | 267 | placeholder="Add Title" |
271 | :rules="titleRules" | 268 | :rules="titleRules" |
272 | required | 269 | required |
273 | ></v-text-field> | 270 | ></v-text-field> |
274 | </v-flex> | 271 | </v-flex> |
275 | </v-layout> | 272 | </v-layout> |
276 | <v-layout> | 273 | <v-layout> |
277 | <v-flex xs4 sm4 class="pt-4 subheading"> | 274 | <v-flex xs4 sm4 class="pt-4 subheading"> |
278 | <label class="right">Description :</label> | 275 | <label class="right">Description :</label> |
279 | </v-flex> | 276 | </v-flex> |
280 | <v-flex xs8 sm8 class="ml-3"> | 277 | <v-flex xs8 sm8 class="ml-3"> |
281 | <v-text-field | 278 | <v-text-field |
282 | v-model="addSyllabus.description" | 279 | v-model="addSyllabus.description" |
283 | name="name" | 280 | name="name" |
284 | type="text" | 281 | type="text" |
285 | placeholder="Add Description" | 282 | placeholder="Add Description" |
286 | :rules="descriptionRules" | 283 | :rules="descriptionRules" |
287 | required | 284 | required |
288 | ></v-text-field> | 285 | ></v-text-field> |
289 | </v-flex> | 286 | </v-flex> |
290 | </v-layout> | 287 | </v-layout> |
291 | <v-layout> | 288 | <v-layout> |
292 | <v-flex xs4 class="pt-4 subheading"> | 289 | <v-flex xs4 class="pt-4 subheading"> |
293 | <label class="right">Class:</label> | 290 | <label class="right">Class:</label> |
294 | </v-flex> | 291 | </v-flex> |
295 | <v-flex xs8 class="ml-3"> | 292 | <v-flex xs8 class="ml-3"> |
296 | <v-select | 293 | <v-select |
297 | :items="classList" | 294 | :items="classList" |
298 | v-model="addSyllabus.classId" | 295 | v-model="addSyllabus.classId" |
299 | label="Select Class" | 296 | label="Select Class" |
300 | item-text="classNum" | 297 | item-text="classNum" |
301 | item-value="_id" | 298 | item-value="_id" |
302 | name="Select Class" | 299 | name="Select Class" |
303 | @change="getSections(addSyllabus.classId)" | 300 | @change="getSections(addSyllabus.classId)" |
304 | required | 301 | required |
305 | ></v-select> | 302 | ></v-select> |
306 | </v-flex> | 303 | </v-flex> |
307 | </v-layout> | 304 | </v-layout> |
308 | <!-- <v-layout> | 305 | <!-- <v-layout> |
309 | <v-flex xs4 sm4 class="pt-4 subheading"> | 306 | <v-flex xs4 sm4 class="pt-4 subheading"> |
310 | <label class="right">Section :</label> | 307 | <label class="right">Section :</label> |
311 | </v-flex> | 308 | </v-flex> |
312 | <v-flex xs8 sm8 class="ml-3"> | 309 | <v-flex xs8 sm8 class="ml-3"> |
313 | <v-select | 310 | <v-select |
314 | :items="addSection" | 311 | :items="addSection" |
315 | label="Select Section" | 312 | label="Select Section" |
316 | item-text="name" | 313 | item-text="name" |
317 | item-value="_id" | 314 | item-value="_id" |
318 | v-model="addSyllabus.sectionId" | 315 | v-model="addSyllabus.sectionId" |
319 | name="Select Section" | 316 | name="Select Section" |
320 | class="px-2" | 317 | class="px-2" |
321 | required | 318 | required |
322 | ></v-select> | 319 | ></v-select> |
323 | </v-flex> | 320 | </v-flex> |
324 | </v-layout>--> | 321 | </v-layout>--> |
325 | <v-layout> | 322 | <v-layout> |
326 | <v-flex xs4 class="pt-4 subheading"> | 323 | <v-flex xs4 class="pt-4 subheading"> |
327 | <label class="right">File:</label> | 324 | <label class="right">File:</label> |
328 | </v-flex> | 325 | </v-flex> |
329 | <v-flex xs8 sm6 class="ml-3"> | 326 | <v-flex xs8 sm6 class="ml-3"> |
330 | <v-text-field | 327 | <v-text-field |
331 | label="Select file" | 328 | label="Select file" |
332 | @click="pickFile" | 329 | @click="pickFile" |
333 | v-model="imageName" | 330 | v-model="imageName" |
334 | append-icon="attach_file" | 331 | append-icon="attach_file" |
335 | ></v-text-field> | 332 | ></v-text-field> |
336 | <input | 333 | <input |
337 | type="file" | 334 | type="file" |
338 | style="display:none" | 335 | style="display:none" |
339 | ref="image" | 336 | ref="image" |
340 | accept="image/*" | 337 | accept="image/*" |
341 | @change="onFilePicked" | 338 | @change="onFilePicked" |
342 | /> | 339 | /> |
343 | </v-flex> | 340 | </v-flex> |
344 | </v-layout> | 341 | </v-layout> |
345 | <v-layout> | 342 | <v-layout> |
346 | <v-flex xs12 sm12> | 343 | <v-flex xs12 sm12> |
347 | <v-card-actions> | 344 | <v-card-actions> |
348 | <v-spacer></v-spacer> | 345 | <v-spacer></v-spacer> |
349 | <v-btn | 346 | <v-btn |
350 | @click="submit" | 347 | @click="submit" |
351 | round | 348 | round |
352 | dark | 349 | dark |
353 | :loading="loading" | 350 | :loading="loading" |
354 | class="add-button" | 351 | class="add-button" |
355 | >Add Syllabus</v-btn> | 352 | >Add Syllabus</v-btn> |
356 | </v-card-actions> | 353 | </v-card-actions> |
357 | </v-flex> | 354 | </v-flex> |
358 | </v-layout> | 355 | </v-layout> |
359 | </v-form> | 356 | </v-form> |
360 | </v-flex> | 357 | </v-flex> |
361 | </v-layout> | 358 | </v-layout> |
362 | </v-container> | 359 | </v-container> |
363 | </v-card> | 360 | </v-card> |
364 | </v-dialog> | 361 | </v-dialog> |
365 | <div class="loader" v-if="showLoader"> | 362 | <div class="loader" v-if="showLoader"> |
366 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 363 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
367 | </div> | 364 | </div> |
368 | </v-container> | 365 | </v-container> |
369 | </template> | 366 | </template> |
370 | 367 | ||
371 | <script> | 368 | <script> |
372 | import http from "@/Services/http.js"; | 369 | import http from "@/Services/http.js"; |
373 | import Util from "@/util"; | 370 | import Util from "@/util"; |
374 | import moment from "moment"; | 371 | import moment from "moment"; |
375 | import jsPDF from "jspdf"; | 372 | import jsPDF from "jspdf"; |
376 | import { saveAs } from "file-saver"; | 373 | import { saveAs } from "file-saver"; |
377 | 374 | ||
378 | export default { | 375 | export default { |
379 | data: () => ({ | 376 | data: () => ({ |
380 | snackbar: false, | 377 | snackbar: false, |
381 | y: "top", | 378 | y: "top", |
382 | x: "right", | 379 | x: "right", |
383 | mode: "", | 380 | mode: "", |
384 | timeout: 3000, | 381 | timeout: 3000, |
385 | text: "", | 382 | text: "", |
386 | color: "", | 383 | color: "", |
387 | show: true, | 384 | show: true, |
388 | showSearch: false, | 385 | showSearch: false, |
389 | showLoader: false, | 386 | showLoader: false, |
390 | loading: false, | 387 | loading: false, |
391 | editLoading: false, | 388 | editLoading: false, |
392 | date: null, | 389 | date: null, |
393 | search: "", | 390 | search: "", |
394 | editSyllabusDialog: false, | 391 | editSyllabusDialog: false, |
395 | valid: true, | 392 | valid: true, |
396 | validEditSyllabus: true, | 393 | validEditSyllabus: true, |
397 | addSyllabusDialog: false, | 394 | addSyllabusDialog: false, |
398 | loadingPdf: false, | 395 | loadingPdf: false, |
399 | 396 | ||
400 | pagination: { | 397 | pagination: { |
401 | rowsPerPage: 10 | 398 | rowsPerPage: 10, |
402 | }, | 399 | }, |
403 | token: "", | 400 | token: "", |
404 | upload: "", | 401 | upload: "", |
405 | titleRules: [v => !!v || " Title is required"], | 402 | titleRules: [(v) => !!v || " Title is required"], |
406 | descriptionRules: [v => !!v || " Description is required"], | 403 | descriptionRules: [(v) => !!v || " Description is required"], |
407 | classRules: [v => !!v || " Class Name is required"], | 404 | classRules: [(v) => !!v || " Class Name is required"], |
408 | fileRules: [v => !!v || " File is required"], | 405 | fileRules: [(v) => !!v || " File is required"], |
409 | headers: [ | 406 | headers: [ |
410 | { | 407 | { |
411 | text: "No", | 408 | text: "No", |
412 | align: "", | 409 | align: "", |
413 | sortable: false, | 410 | sortable: false, |
414 | value: "No" | 411 | value: "No", |
415 | }, | 412 | }, |
416 | { | 413 | { |
417 | text: "Title", | 414 | text: "Title", |
418 | value: "title", | 415 | value: "title", |
419 | sortable: false, | 416 | sortable: false, |
420 | align: "center" | 417 | align: "center", |
421 | }, | 418 | }, |
422 | { | 419 | { |
423 | text: "Description", | 420 | text: "Description", |
424 | value: "description", | 421 | value: "description", |
425 | sortable: false, | 422 | sortable: false, |
426 | align: "center" | 423 | align: "center", |
427 | }, | 424 | }, |
428 | { | 425 | { |
429 | text: "Date", | 426 | text: "Date", |
430 | value: "created", | 427 | value: "created", |
431 | sortable: false, | 428 | sortable: false, |
432 | align: "center" | 429 | align: "center", |
433 | }, | 430 | }, |
434 | { | 431 | { |
435 | text: "Uploader", | 432 | text: "Uploader", |
436 | value: "upload", | 433 | value: "upload", |
437 | sortable: false, | 434 | sortable: false, |
438 | align: "center" | 435 | align: "center", |
439 | }, | 436 | }, |
440 | { | 437 | { |
441 | text: "File", | 438 | text: "File", |
442 | value: "documentUrl", | 439 | value: "documentUrl", |
443 | sortable: false, | 440 | sortable: false, |
444 | align: "center" | 441 | align: "center", |
445 | }, | 442 | }, |
446 | { text: "Action", value: "", sortable: false, align: "center" } | 443 | { text: "Action", value: "", sortable: false, align: "center" }, |
447 | ], | 444 | ], |
448 | syllabusList: [], | 445 | syllabusList: [], |
449 | classList: [], | 446 | classList: [], |
450 | addSection: [], | 447 | addSection: [], |
451 | editedIndex: -1, | 448 | editedIndex: -1, |
452 | addSyllabus: {}, | 449 | addSyllabus: {}, |
453 | showSyllabus: {}, | 450 | showSyllabus: {}, |
454 | 451 | ||
455 | editedItem: { | 452 | editedItem: { |
456 | subjectName: "" | 453 | subjectName: "", |
457 | }, | 454 | }, |
458 | imageData: {}, | 455 | imageData: {}, |
459 | imageName: "", | 456 | imageName: "", |
460 | imageUrl: "", | 457 | imageUrl: "", |
461 | imageFile: "" | 458 | imageFile: "", |
462 | }), | 459 | }), |
463 | 460 | ||
461 | watch: { | ||
462 | addSyllabusDialog: function (val) { | ||
463 | if (!val) { | ||
464 | this.addSyllabus = []; | ||
465 | this.imageName = ""; | ||
466 | } | ||
467 | }, | ||
468 | }, | ||
469 | |||
464 | methods: { | 470 | methods: { |
465 | pickFile() { | 471 | pickFile() { |
466 | this.$refs.image.click(); | 472 | this.$refs.image.click(); |
467 | }, | 473 | }, |
468 | dates: function(date) { | 474 | dates: function (date) { |
469 | return moment(date).format("MMMM DD, YYYY"); | 475 | return moment(date).format("MMMM DD, YYYY"); |
470 | }, | 476 | }, |
471 | editItem(item) { | 477 | editItem(item) { |
472 | this.editedIndex = this.syllabusList; | 478 | this.editedIndex = this.syllabusList; |
473 | this.editedItem = Object.assign({}, item); | 479 | this.editedItem = Object.assign({}, item); |
474 | this.dialog = true; | 480 | this.dialog = true; |
475 | this.editSyllabusDialog = true; | 481 | this.editSyllabusDialog = true; |
476 | }, | 482 | }, |
477 | download(item) { | 483 | download(item) { |
478 | this.editedIndex = this.syllabusList; | 484 | this.editedIndex = this.syllabusList; |
479 | this.editedItem = Object.assign({}, item); | 485 | this.editedItem = Object.assign({}, item); |
480 | this.dialog1 = true; | 486 | this.dialog1 = true; |
481 | }, | 487 | }, |
482 | deleteItem(item) { | 488 | deleteItem(item) { |
483 | let deleteSyallabus = { | 489 | let deleteSyallabus = { |
484 | syallabusId: item._id | 490 | syallabusId: item._id, |
485 | }; | 491 | }; |
486 | http() | 492 | http() |
487 | .delete( | 493 | .delete( |
488 | "/deleteSyallabus", | 494 | "/deleteSyallabus", |
489 | confirm("Are you sure you want to delete this?") && { | 495 | confirm("Are you sure you want to delete this?") && { |
490 | params: deleteSyallabus | 496 | params: deleteSyallabus, |
491 | } | 497 | } |
492 | ) | 498 | ) |
493 | .then(response => { | 499 | .then((response) => { |
494 | this.getSyallabusList(); | 500 | this.getSyallabusList(); |
495 | this.snackbar = true; | 501 | this.snackbar = true; |
496 | this.color = "green"; | 502 | this.color = "green"; |
497 | this.text = "Successfully delete Existing Syllabus"; | 503 | this.text = "Successfully delete Existing Syllabus"; |
498 | }) | 504 | }) |
499 | .catch(error => { | 505 | .catch((error) => { |
500 | this.snackbar = true; | 506 | this.snackbar = true; |
501 | this.text = error.response.data.message; | 507 | this.text = error.response.data.message; |
502 | this.color = "error"; | 508 | this.color = "error"; |
503 | }); | 509 | }); |
504 | }, | 510 | }, |
505 | close() { | 511 | close() { |
506 | this.editSyllabusDialog = false; | 512 | this.editSyllabusDialog = false; |
507 | }, | 513 | }, |
514 | closeAddStudentModel() { | ||
515 | this.addSyllabusDialog = false; | ||
516 | this.syllabusList = []; | ||
517 | this.addSyllabus = []; | ||
518 | this.imageName = ""; | ||
519 | }, | ||
508 | 520 | ||
509 | submit() { | 521 | submit() { |
510 | // var addSyllabus = { | 522 | // var addSyllabus = { |
511 | // classId: this.addSyllabus.classId, | 523 | // classId: this.addSyllabus.classId, |
512 | // title: this.addSyllabus.title, | 524 | // title: this.addSyllabus.title, |
513 | // description: this.addSyllabus.description, | 525 | // description: this.addSyllabus.description, |
514 | // upload: this.addSyllabus.upload, | 526 | // upload: this.addSyllabus.upload, |
515 | // fileType: this.addSyllabus.fileType | 527 | // fileType: this.addSyllabus.fileType |
516 | // }; | 528 | // }; |
517 | var signatures = { | 529 | var signatures = { |
518 | JVBERi0: "other", | 530 | JVBERi0: "other", |
519 | iVBORw0KGgo: "image", | 531 | iVBORw0KGgo: "image", |
520 | UEsDBBQ: "other", | 532 | UEsDBBQ: "other", |
521 | "/": "image", | 533 | "/": "image", |
522 | AAABAA: "image", | 534 | AAABAA: "image", |
523 | IywiV2hhdC: "other", | 535 | IywiV2hhdC: "other", |
524 | bmFtZSxl: "other" | 536 | bmFtZSxl: "other", |
525 | }; | 537 | }; |
526 | function detectMimeType(b64) { | 538 | function detectMimeType(b64) { |
527 | for (var s in signatures) { | 539 | for (var s in signatures) { |
528 | if (b64.indexOf(s) === 0) { | 540 | if (b64.indexOf(s) === 0) { |
529 | return signatures[s]; | 541 | return signatures[s]; |
530 | } | 542 | } |
531 | } | 543 | } |
532 | } | 544 | } |
533 | if (this.$refs.form.validate()) { | 545 | if (this.$refs.form.validate()) { |
534 | if (this.imageUrl) { | 546 | if (this.imageUrl) { |
535 | var str = this.imageUrl; | 547 | var str = this.imageUrl; |
536 | const [baseUrl, imageUrl] = str.split(/,/); | 548 | const [baseUrl, imageUrl] = str.split(/,/); |
537 | this.addSyllabus.upload = imageUrl; | 549 | this.addSyllabus.upload = imageUrl; |
538 | this.addSyllabus.fileType = detectMimeType(imageUrl); | 550 | this.addSyllabus.fileType = detectMimeType(imageUrl); |
539 | this.addSyllabus.fileName = this.imageName; | 551 | this.addSyllabus.fileName = this.imageName; |
540 | } | 552 | } |
541 | http() | 553 | http() |
542 | .post("/createSyallabus", this.addSyllabus) | 554 | .post("/createSyallabus", this.addSyllabus) |
543 | .then(response => { | 555 | .then((response) => { |
544 | this.getSyallabusList(); | 556 | this.getSyallabusList(); |
545 | this.snackbar = true; | 557 | this.snackbar = true; |
546 | this.text = "Syllabus added successfully"; | 558 | this.text = "Syllabus added successfully"; |
547 | this.clear(); | 559 | this.clear(); |
548 | this.color = "green"; | 560 | this.color = "green"; |
549 | this.addSyllabusDialog = false; | 561 | this.addSyllabusDialog = false; |
550 | }) | 562 | }) |
551 | .catch(error => { | 563 | .catch((error) => { |
552 | // console.log(error); | 564 | // console.log(error); |
553 | this.snackbar = true; | 565 | this.snackbar = true; |
554 | this.text = error.response.data.message; | 566 | this.text = error.response.data.message; |
555 | this.color = "error"; | 567 | this.color = "error"; |
556 | }); | 568 | }); |
557 | } | 569 | } |
558 | }, | 570 | }, |
559 | onFilePicked(e) { | 571 | onFilePicked(e) { |
560 | const files = e.target.files; | 572 | const files = e.target.files; |
561 | this.upload = e.target.files[0]; | 573 | this.upload = e.target.files[0]; |
562 | if (files[0] !== undefined) { | 574 | if (files[0] !== undefined) { |
563 | this.imageName = files[0].name; | 575 | this.imageName = files[0].name; |
564 | if (this.imageName.lastIndexOf(".") <= 0) { | 576 | if (this.imageName.lastIndexOf(".") <= 0) { |
565 | return; | 577 | return; |
566 | } | 578 | } |
567 | const fr = new FileReader(); | 579 | const fr = new FileReader(); |
568 | fr.readAsDataURL(files[0]); | 580 | fr.readAsDataURL(files[0]); |
569 | fr.addEventListener("load", () => { | 581 | fr.addEventListener("load", () => { |
570 | this.imageUrl = fr.result; | 582 | this.imageUrl = fr.result; |
571 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 583 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
572 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 584 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
573 | }); | 585 | }); |
574 | } else { | 586 | } else { |
575 | this.imageName = ""; | 587 | this.imageName = ""; |
576 | this.imageFile = ""; | 588 | this.imageFile = ""; |
577 | this.imageUrl = ""; | 589 | this.imageUrl = ""; |
578 | } | 590 | } |
579 | }, | 591 | }, |
580 | clear() { | 592 | clear() { |
581 | this.$refs.form.reset(); | 593 | this.$refs.form.reset(); |
582 | }, | 594 | }, |
583 | save() { | 595 | save() { |
584 | if (this.$refs.formEditSyllabus.validate()) { | 596 | if (this.$refs.formEditSyllabus.validate()) { |
585 | let syllabusData = { | 597 | let syllabusData = { |
586 | syallabusId: this.editedItem._id, | 598 | syallabusId: this.editedItem._id, |
587 | classId: this.editedItem.classId._id, | 599 | classId: this.editedItem.classId._id, |
588 | // sectionId: this.editedItem.sectionId, | 600 | // sectionId: this.editedItem.sectionId, |
589 | title: this.editedItem.title, | 601 | title: this.editedItem.title, |
590 | description: this.editedItem.description, | 602 | description: this.editedItem.description, |
591 | upload: this.editedItem.upload, | 603 | upload: this.editedItem.upload, |
592 | fileType: this.editedItem.fileType, | 604 | fileType: this.editedItem.fileType, |
593 | fileName: this.imageName | 605 | fileName: this.imageName, |
594 | }; | 606 | }; |
595 | this.editLoading = true; | 607 | this.editLoading = true; |
596 | var signatures = { | 608 | var signatures = { |
597 | JVBERi0: "other", | 609 | JVBERi0: "other", |
598 | iVBORw0KGgo: "image", | 610 | iVBORw0KGgo: "image", |
599 | UEsDBBQ: "other", | 611 | UEsDBBQ: "other", |
600 | "/": "image", | 612 | "/": "image", |
601 | AAABAA: "image", | 613 | AAABAA: "image", |
602 | IywiV2hhdC: "other" | 614 | IywiV2hhdC: "other", |
603 | }; | 615 | }; |
604 | function detectMimeType(b64) { | 616 | function detectMimeType(b64) { |
605 | for (var s in signatures) { | 617 | for (var s in signatures) { |
606 | if (b64.indexOf(s) === 0) { | 618 | if (b64.indexOf(s) === 0) { |
607 | return signatures[s]; | 619 | return signatures[s]; |
608 | } | 620 | } |
609 | } | 621 | } |
610 | } | 622 | } |
611 | if (this.imageUrl) { | 623 | if (this.imageUrl) { |
612 | var str = this.imageUrl; | 624 | var str = this.imageUrl; |
613 | const [baseUrl, imageUrl] = str.split(/,/); | 625 | const [baseUrl, imageUrl] = str.split(/,/); |
614 | syllabusData.upload = imageUrl; | 626 | syllabusData.upload = imageUrl; |
615 | syllabusData.fileType = detectMimeType(imageUrl); | 627 | syllabusData.fileType = detectMimeType(imageUrl); |
616 | } | 628 | } |
617 | http() | 629 | http() |
618 | .put("/updateSyallabus", syllabusData) | 630 | .put("/updateSyallabus", syllabusData) |
619 | .then(response => { | 631 | .then((response) => { |
620 | this.snackbar = true; | 632 | this.snackbar = true; |
621 | this.text = "Successfully Edit Existing Syllabus"; | 633 | this.text = "Successfully Edit Existing Syllabus"; |
622 | this.color = "green"; | 634 | this.color = "green"; |
623 | this.editLoading = false; | 635 | this.editLoading = false; |
624 | this.editSyllabusDialog = false; | 636 | this.editSyllabusDialog = false; |
625 | http() | 637 | http() |
626 | .get( | 638 | .get( |
627 | "/getSyallabusList", | 639 | "/getSyallabusList", |
628 | { params: { classId: this.addSyllabus.classId } }, | 640 | { params: { classId: this.addSyllabus.classId } }, |
629 | { | 641 | { |
630 | headers: { Authorization: "Bearer " + this.token } | 642 | headers: { Authorization: "Bearer " + this.token }, |
631 | } | 643 | } |
632 | ) | 644 | ) |
633 | .then(response => { | 645 | .then((response) => { |
634 | this.syllabusList = response.data.data; | 646 | this.syllabusList = response.data.data; |
635 | this.getSyallabusList(); | 647 | this.getSyallabusList(); |
636 | this.snackbar = true; | 648 | this.snackbar = true; |
637 | this.color = "green"; | 649 | this.color = "green"; |
638 | this.close(); | 650 | this.close(); |
639 | }) | 651 | }) |
640 | .catch(err => { | 652 | .catch((err) => { |
641 | console.log("err====>", err); | 653 | console.log("err====>", err); |
642 | this.text = error.response.data.message; | 654 | this.text = error.response.data.message; |
643 | this.color = "error"; | 655 | this.color = "error"; |
644 | }); | 656 | }); |
645 | }) | 657 | }) |
646 | .catch(error => { | 658 | .catch((error) => { |
647 | this.editLoading = false; | 659 | this.editLoading = false; |
648 | }); | 660 | }); |
649 | } | 661 | } |
650 | }, | 662 | }, |
651 | getSyallabusList() { | 663 | getSyallabusList() { |
652 | this.showLoader = true; | 664 | this.showLoader = true; |
653 | http() | 665 | http() |
654 | .get( | 666 | .get( |
655 | "/getSyallabusList", | 667 | "/getSyallabusList", |
656 | { params: { classId: this.showSyllabus.classId } }, | 668 | { params: { classId: this.showSyllabus.classId } }, |
657 | { | 669 | { |
658 | headers: { Authorization: "Bearer " + this.token } | 670 | headers: { Authorization: "Bearer " + this.token }, |
659 | } | 671 | } |
660 | ) | 672 | ) |
661 | .then(response => { | 673 | .then((response) => { |
662 | this.syllabusList = response.data.data; | 674 | this.syllabusList = response.data.data; |
663 | this.showLoader = false; | 675 | this.showLoader = false; |
664 | }) | 676 | }) |
665 | .catch(err => { | 677 | .catch((err) => { |
666 | this.showLoader = false; | 678 | this.showLoader = false; |
667 | }); | 679 | }); |
668 | }, | 680 | }, |
669 | getClass() { | 681 | getClass() { |
670 | http() | 682 | http() |
671 | .get("/getClassesList", { | 683 | .get("/getClassesList", { |
672 | headers: { Authorization: "Bearer " + this.token } | 684 | headers: { Authorization: "Bearer " + this.token }, |
673 | }) | 685 | }) |
674 | .then(response => { | 686 | .then((response) => { |
675 | this.classList = response.data.data; | 687 | this.classList = response.data.data; |
676 | }) | 688 | }) |
677 | .catch(error => { | 689 | .catch((error) => { |
678 | if (error.response.status === 401) { | 690 | if (error.response.status === 401) { |
679 | this.$router.replace({ path: "/" }); | 691 | this.$router.replace({ path: "/" }); |
680 | this.$store.dispatch("setToken", null); | 692 | this.$store.dispatch("setToken", null); |
681 | this.$store.dispatch("Id", null); | 693 | this.$store.dispatch("Id", null); |
682 | } | 694 | } |
683 | }); | 695 | }); |
684 | }, | 696 | }, |
685 | getSections(_id) { | 697 | getSections(_id) { |
686 | var token = this.$store.state.token; | 698 | var token = this.$store.state.token; |
687 | this.showLoader = true; | 699 | this.showLoader = true; |
688 | http() | 700 | http() |
689 | .get( | 701 | .get( |
690 | "/getSectionsList", | 702 | "/getSectionsList", |
691 | { params: { classId: _id } }, | 703 | { params: { classId: _id } }, |
692 | { | 704 | { |
693 | headers: { Authorization: "Bearer " + token } | 705 | headers: { Authorization: "Bearer " + token }, |
694 | } | 706 | } |
695 | ) | 707 | ) |
696 | .then(response => { | 708 | .then((response) => { |
697 | this.addSection = response.data.data; | 709 | this.addSection = response.data.data; |
698 | this.showLoader = false; | 710 | this.showLoader = false; |
699 | }) | 711 | }) |
700 | .catch(err => { | 712 | .catch((err) => { |
701 | this.showLoader = false; | 713 | this.showLoader = false; |
702 | }); | 714 | }); |
703 | }, | 715 | }, |
704 | displaySearch() { | 716 | displaySearch() { |
705 | (this.show = false), (this.showSearch = true); | 717 | (this.show = false), (this.showSearch = true); |
706 | }, | 718 | }, |
707 | closeSearch() { | 719 | closeSearch() { |
708 | this.showSearch = false; | 720 | this.showSearch = false; |
709 | this.show = true; | 721 | this.show = true; |
710 | this.search = ""; | 722 | this.search = ""; |
711 | }, | 723 | }, |
712 | 724 | ||
713 | async generatePDF2Canvas(item) { | 725 | async generatePDF2Canvas(item) { |
714 | // console.log("documentUrl", documentUrl); | 726 | // console.log("documentUrl", documentUrl); |
715 | // this.loadingPdf = true; | 727 | // this.loadingPdf = true; |
716 | // const el = this.$refs.printMe; | 728 | // const el = this.$refs.printMe; |
717 | // add option type to get the image version | 729 | // add option type to get the image version |
718 | // if not provided the promise will return | 730 | // if not provided the promise will return |
719 | // the canvas. | 731 | // the canvas. |
720 | // const options = { | 732 | // const options = { |
721 | // type: "dataURL" | 733 | // type: "dataURL" |
722 | // }; | 734 | // }; |
723 | // this.output = await this.$html2canvas(el, options); | 735 | // this.output = await this.$html2canvas(el, options); |
724 | // console.log("el,option", this.output); | 736 | // console.log("el,option", this.output); |
725 | // if (this.output) { | 737 | // if (this.output) { |
726 | // this.loadingPdf = false; | 738 | // this.loadingPdf = false; |
727 | // } | 739 | // } |
728 | // let doc = new jsPDF(); | 740 | // let doc = new jsPDF(); |
729 | // doc.addImage(this.output,"JPEG", 5, 10, 200, 280); | 741 | // doc.addImage(this.output,"JPEG", 5, 10, 200, 280); |
730 | // doc.save("File.pdf"); | 742 | // doc.save("File.pdf"); |
731 | 743 | ||
732 | // function download(documentUrl, filename) { | 744 | // function download(documentUrl, filename) { |
733 | // fetch(documentUrl).then(function(t) { | 745 | // fetch(documentUrl).then(function(t) { |
734 | // return t.blob().then(b => { | 746 | // return t.blob().then(b => { |
735 | // var a = document.createElement("a"); | 747 | // var a = document.createElement("a"); |
736 | // a.href = URL.createObjectURL(b); | 748 | // a.href = URL.createObjectURL(b); |
737 | // a.setAttribute("download", "filename"); | 749 | // a.setAttribute("download", "filename"); |
738 | // a.click(); | 750 | // a.click(); |
739 | // }); | 751 | // }); |
740 | // }); | 752 | // }); |
741 | // } | 753 | // } |
742 | var dataType = ""; | 754 | var dataType = ""; |
743 | var type = ""; | 755 | var type = ""; |
744 | if (item.fileType == "image") { | 756 | if (item.fileType == "image") { |
745 | dataType = "file.jpg"; | 757 | dataType = "file.jpg"; |
746 | } else if (item.fileType == "other") { | 758 | } else if (item.fileType == "other") { |
747 | dataType = "file.pdf"; | 759 | dataType = "file.pdf"; |
748 | type = "application/pdf"; | 760 | type = "application/pdf"; |
749 | } | 761 | } |
750 | var FileSaver = require("file-saver"); | 762 | var FileSaver = require("file-saver"); |
751 | FileSaver.saveAs(item.documentUrl, "image.jpg"); | 763 | FileSaver.saveAs(item.documentUrl, "image.jpg"); |
752 | 764 | ||
753 | // var blob = new Blob([item.documentUrl], { | 765 | // var blob = new Blob([item.documentUrl], { |
754 | // type: type | 766 | // type: type |
755 | // }); | 767 | // }); |
756 | // FileSaver.saveAs(blob, dataType); | 768 | // FileSaver.saveAs(blob, dataType); |
757 | // const url = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); | 769 | // const url = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); |
758 | // console.log("document", item.documentUrl); | 770 | // console.log("document", item.documentUrl); |
759 | // const link = document.createElement("a"); | 771 | // const link = document.createElement("a"); |
760 | // link.href = url; | 772 | // link.href = url; |
761 | // link.setAttribute("download", dataType); //or any other extension | 773 | // link.setAttribute("download", dataType); //or any other extension |
762 | // document.body.appendChild(link); | 774 | // document.body.appendChild(link); |
763 | // link.click(); | 775 | // link.click(); |
764 | 776 | ||
765 | // const blob = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); | 777 | // const blob = window.URL.createObjectURL(new Blob([item.documentUrl],{ type: type } )); |
766 | // const link = document.createElement('a') | 778 | // const link = document.createElement('a') |
767 | // link.href = URL.createObjectURL(blob) | 779 | // link.href = URL.createObjectURL(blob) |
768 | // link.download = dataType | 780 | // link.download = dataType |
769 | // link.click() | 781 | // link.click() |
770 | // URL.revokeObjectURL(link.href) | 782 | // URL.revokeObjectURL(link.href) |
771 | } | 783 | }, |
772 | }, | 784 | }, |
773 | mounted() { | 785 | mounted() { |
774 | this.token = this.$store.state.token; | 786 | this.token = this.$store.state.token; |
775 | this.role = this.$store.state.role; | 787 | this.role = this.$store.state.role; |
776 | this.getClass(); | 788 | this.getClass(); |
src/pages/Account/expense.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT EXPENSE ****** --> | 3 | <!-- ****** EDIT EXPENSE ****** --> |
4 | <v-dialog v-model="editExpenseDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editExpenseDialog" max-width="600px" 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 Expense Profile</label> | 8 | <label class="title text-xs-center">Edit Expense Profile</label> |
9 | <v-icon size="24" class="right" @click="editExpenseDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editExpenseDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-card-text style="height: 600px;"> | 12 | <v-card-text style="height: 600px;"> |
13 | <v-layout> | 13 | <v-layout> |
14 | <v-flex | 14 | <v-flex |
15 | xs12 | 15 | xs12 |
16 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" | 16 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" |
17 | > | 17 | > |
18 | <v-avatar size="140px" v-if="!editedItem.fileUrl && !imageUrl"> | 18 | <v-avatar size="140px" v-if="!editedItem.fileUrl && !imageUrl"> |
19 | <img src="/static/icon/user.png" /> | 19 | <img src="/static/icon/user.png" /> |
20 | </v-avatar> | 20 | </v-avatar> |
21 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl && !imageUrl" style="border-radius:50%; width:150px"/> | 21 | <img |
22 | :src="editedItem.fileUrl" | ||
23 | v-else-if="editedItem.fileUrl && !imageUrl" | ||
24 | style="border-radius:50%; width:150px" | ||
25 | /> | ||
22 | <img | 26 | <img |
23 | v-if="imageUrl" | 27 | v-if="imageUrl" |
24 | :src="imageUrl" | 28 | :src="imageUrl" |
25 | height="150" | 29 | height="150" |
26 | style="border-radius:50%; width:150px" | 30 | style="border-radius:50%; width:150px" |
27 | /> | 31 | /> |
28 | <input | 32 | <input |
29 | type="file" | 33 | type="file" |
30 | style="display:none" | 34 | style="display:none" |
31 | ref="image" | 35 | ref="image" |
32 | accept="image/*" | 36 | accept="image/*" |
33 | @change="onFilePicked" | 37 | @change="onFilePicked" |
34 | /> | 38 | /> |
35 | </v-flex> | 39 | </v-flex> |
36 | </v-layout> | 40 | </v-layout> |
37 | <v-layout wrap> | 41 | <v-layout wrap> |
38 | <v-flex xs12 sm12> | 42 | <v-flex xs12 sm12> |
39 | <v-layout> | 43 | <v-layout> |
40 | <v-flex xs4 class="pt-4 subheading"> | 44 | <v-flex xs4 class="pt-4 subheading"> |
41 | <label class="right">Name:</label> | 45 | <label class="right">Name:</label> |
42 | </v-flex> | 46 | </v-flex> |
43 | <v-flex xs7 class="ml-3"> | 47 | <v-flex xs7 class="ml-3"> |
44 | <v-text-field | 48 | <v-text-field |
45 | v-model="editedItem.name" | 49 | v-model="editedItem.name" |
46 | placeholder="fill your full Name" | 50 | placeholder="fill your full Name" |
47 | name="name" | 51 | name="name" |
48 | type="text" | 52 | type="text" |
49 | required | 53 | required |
50 | ></v-text-field> | 54 | ></v-text-field> |
51 | </v-flex> | 55 | </v-flex> |
52 | </v-layout> | 56 | </v-layout> |
53 | </v-flex> | 57 | </v-flex> |
54 | </v-layout> | 58 | </v-layout> |
55 | <v-layout wrap> | 59 | <v-layout wrap> |
56 | <v-flex xs12> | 60 | <v-flex xs12> |
57 | <v-layout> | 61 | <v-layout> |
58 | <v-flex xs4 class="pt-4 subheading"> | 62 | <v-flex xs4 class="pt-4 subheading"> |
59 | <label class="right">Date:</label> | 63 | <label class="right">Date:</label> |
60 | </v-flex> | 64 | </v-flex> |
61 | <v-flex xs7 class="ml-3"> | 65 | <v-flex xs7 class="ml-3"> |
62 | <v-menu | 66 | <v-menu |
63 | ref="menu" | 67 | ref="menu" |
64 | :close-on-content-click="false" | 68 | :close-on-content-click="false" |
65 | v-model="menu3" | 69 | v-model="menu3" |
66 | :nudge-right="40" | 70 | :nudge-right="40" |
67 | lazy | 71 | lazy |
68 | transition="scale-transition" | 72 | transition="scale-transition" |
69 | offset-y | 73 | offset-y |
70 | full-width | 74 | full-width |
71 | min-width="290px" | 75 | min-width="290px" |
72 | > | 76 | > |
73 | <v-text-field | 77 | <v-text-field |
74 | slot="activator" | 78 | slot="activator" |
75 | v-model="editedItem.date" | 79 | v-model="editedItem.date" |
76 | placeholder="Select date" | 80 | placeholder="Select date" |
77 | ></v-text-field> | 81 | ></v-text-field> |
78 | <v-date-picker | 82 | <v-date-picker |
79 | ref="picker" | 83 | ref="picker" |
80 | v-model="editedItem.date" | 84 | v-model="editedItem.date" |
81 | @input="$refs.menu.save(editedItem.date)" | 85 | @input="$refs.menu.save(editedItem.date)" |
82 | ></v-date-picker> | 86 | ></v-date-picker> |
83 | </v-menu> | 87 | </v-menu> |
84 | </v-flex> | 88 | </v-flex> |
85 | </v-layout> | 89 | </v-layout> |
86 | </v-flex> | 90 | </v-flex> |
87 | <v-layout wrap> | 91 | <v-layout wrap> |
88 | <v-flex xs12 sm12> | 92 | <v-flex xs12 sm12> |
89 | <v-layout> | 93 | <v-layout> |
90 | <v-flex xs4 class="pt-4 subheading"> | 94 | <v-flex xs4 class="pt-4 subheading"> |
91 | <label class="right">Amount:</label> | 95 | <label class="right">Amount:</label> |
92 | </v-flex> | 96 | </v-flex> |
93 | <v-flex xs7 class="ml-3"> | 97 | <v-flex xs7 class="ml-3"> |
94 | <v-text-field v-model="editedItem.amount" required></v-text-field> | 98 | <v-text-field v-model="editedItem.amount" required></v-text-field> |
95 | </v-flex> | 99 | </v-flex> |
96 | </v-layout> | 100 | </v-layout> |
97 | </v-flex> | 101 | </v-flex> |
98 | </v-layout> | 102 | </v-layout> |
99 | <v-flex xs12> | 103 | <v-flex xs12> |
100 | <v-layout wrap> | 104 | <v-layout wrap> |
101 | <v-flex xs4 class="pt-4 subheading"> | 105 | <v-flex xs4 class="pt-4 subheading"> |
102 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 106 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
103 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> | 107 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> |
104 | </v-flex> | 108 | </v-flex> |
105 | <v-flex xs7 class="ml-3"> | 109 | <v-flex xs7 class="ml-3"> |
106 | <v-text-field | 110 | <v-text-field |
107 | label="Select Image" | 111 | label="Select Image" |
108 | @click="pickFile" | 112 | @click="pickFile" |
109 | v-model="imageName" | 113 | v-model="imageName" |
110 | append-icon="attach_file" | 114 | append-icon="attach_file" |
111 | ></v-text-field> | 115 | ></v-text-field> |
112 | </v-flex> | 116 | </v-flex> |
113 | </v-layout> | 117 | </v-layout> |
114 | </v-flex> | 118 | </v-flex> |
115 | <v-flex xs12> | 119 | <v-flex xs12> |
116 | <v-layout> | 120 | <v-layout> |
117 | <v-flex xs4 class="pt-4 subheading"> | 121 | <v-flex xs4 class="pt-4 subheading"> |
118 | <label class="right">Note:</label> | 122 | <label class="right">Note:</label> |
119 | </v-flex> | 123 | </v-flex> |
120 | <v-flex xs7 class="ml-3"> | 124 | <v-flex xs7 class="ml-3"> |
121 | <v-textarea | 125 | <v-textarea |
122 | name="input-7-1" | 126 | name="input-7-1" |
123 | v-model="editedItem.note" | 127 | v-model="editedItem.note" |
124 | placeholder="fill your Note" | 128 | placeholder="fill your Note" |
125 | type="text" | 129 | type="text" |
126 | :rules="noteRules" | 130 | :rules="noteRules" |
127 | multi-line | 131 | multi-line |
128 | required | 132 | required |
129 | ></v-textarea> | 133 | ></v-textarea> |
130 | </v-flex> | 134 | </v-flex> |
131 | </v-layout> | 135 | </v-layout> |
132 | </v-flex> | 136 | </v-flex> |
133 | </v-layout> | 137 | </v-layout> |
134 | <v-layout> | 138 | <v-layout> |
135 | <v-flex xs12 sm12> | 139 | <v-flex xs12 sm12> |
136 | <v-card-actions> | 140 | <v-card-actions> |
137 | <v-spacer></v-spacer> | 141 | <v-spacer></v-spacer> |
138 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> | 142 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> |
139 | </v-card-actions> | 143 | </v-card-actions> |
140 | </v-flex> | 144 | </v-flex> |
141 | </v-layout> | 145 | </v-layout> |
142 | </v-card-text> | 146 | </v-card-text> |
143 | </v-card> | 147 | </v-card> |
144 | </v-dialog> | 148 | </v-dialog> |
145 | 149 | ||
146 | <!-- ****** PROFILE VIEW EXPENSE DETAILS ****** --> | 150 | <!-- ****** PROFILE VIEW EXPENSE DETAILS ****** --> |
147 | 151 | ||
148 | <v-dialog v-model="viewExpenseDialog" max-width="600px" scrollable> | 152 | <v-dialog v-model="viewExpenseDialog" max-width="600px" scrollable> |
149 | <v-card flat class="card-style pa-3" dark> | 153 | <v-card flat class="card-style pa-3" dark> |
150 | <v-layout> | 154 | <v-layout> |
151 | <v-flex xs12> | 155 | <v-flex xs12> |
152 | <label class="title text-xs-center">View Expense</label> | 156 | <label class="title text-xs-center">View Expense</label> |
153 | <v-icon size="24" class="right" @click="viewExpenseDialog = false">cancel</v-icon> | 157 | <v-icon size="24" class="right" @click="viewExpenseDialog = false">cancel</v-icon> |
154 | </v-flex> | 158 | </v-flex> |
155 | </v-layout> | 159 | </v-layout> |
156 | <v-card-text> | 160 | <v-card-text> |
157 | <v-container grid-list-md> | 161 | <v-container grid-list-md> |
158 | <v-layout wrap> | 162 | <v-layout wrap> |
159 | <v-flex> | 163 | <v-flex> |
160 | <v-flex align-center justify-center layout text-xs-center> | 164 | <v-flex align-center justify-center layout text-xs-center> |
161 | <v-avatar size="160px"> | 165 | <v-avatar size="160px"> |
162 | <img src="/static/icon/user.png" v-if="!editedItem.fileUrl" /> | 166 | <img src="/static/icon/user.png" v-if="!editedItem.fileUrl" /> |
163 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" /> | 167 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" /> |
164 | </v-avatar> | 168 | </v-avatar> |
165 | </v-flex> | 169 | </v-flex> |
166 | <v-layout> | 170 | <v-layout> |
167 | <v-flex xs5 sm6> | 171 | <v-flex xs5 sm6> |
168 | <h5 class="right my-1"> | 172 | <h5 class="right my-1"> |
169 | <b>Name:</b> | 173 | <b>Name:</b> |
170 | </h5> | 174 | </h5> |
171 | </v-flex> | 175 | </v-flex> |
172 | <v-flex sm6 xs8> | 176 | <v-flex sm6 xs8> |
173 | <h5 class="my-1">{{ editedItem.name }}</h5> | 177 | <h5 class="my-1">{{ editedItem.name }}</h5> |
174 | </v-flex> | 178 | </v-flex> |
175 | </v-layout> | 179 | </v-layout> |
176 | <v-layout> | 180 | <v-layout> |
177 | <v-flex xs5 sm6> | 181 | <v-flex xs5 sm6> |
178 | <h5 class="right my-1"> | 182 | <h5 class="right my-1"> |
179 | <b>Amount:</b> | 183 | <b>Amount:</b> |
180 | </h5> | 184 | </h5> |
181 | </v-flex> | 185 | </v-flex> |
182 | <v-flex sm6 xs8> | 186 | <v-flex sm6 xs8> |
183 | <h5 class="my-1">{{ editedItem.amount }}</h5> | 187 | <h5 class="my-1">{{ editedItem.amount }}</h5> |
184 | </v-flex> | 188 | </v-flex> |
185 | </v-layout> | 189 | </v-layout> |
186 | <v-layout> | 190 | <v-layout> |
187 | <v-flex xs5 sm6> | 191 | <v-flex xs5 sm6> |
188 | <h5 class="right my-1"> | 192 | <h5 class="right my-1"> |
189 | <b>Date:</b> | 193 | <b>Date:</b> |
190 | </h5> | 194 | </h5> |
191 | </v-flex> | 195 | </v-flex> |
192 | <v-flex sm6 xs8> | 196 | <v-flex sm6 xs8> |
193 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> | 197 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> |
194 | </v-flex> | 198 | </v-flex> |
195 | </v-layout> | 199 | </v-layout> |
196 | <v-layout> | 200 | <v-layout> |
197 | <v-flex xs5 sm6> | 201 | <v-flex xs5 sm6> |
198 | <h5 class="right my-1"> | 202 | <h5 class="right my-1"> |
199 | <b>Note:</b> | 203 | <b>Note:</b> |
200 | </h5> | 204 | </h5> |
201 | </v-flex> | 205 | </v-flex> |
202 | <v-flex sm6 xs8> | 206 | <v-flex sm6 xs8> |
203 | <h5 class="my-1">{{ editedItem.note }}</h5> | 207 | <h5 class="my-1">{{ editedItem.note }}</h5> |
204 | </v-flex> | 208 | </v-flex> |
205 | </v-layout> | 209 | </v-layout> |
206 | </v-flex> | 210 | </v-flex> |
207 | </v-layout> | 211 | </v-layout> |
208 | </v-container> | 212 | </v-container> |
209 | </v-card-text> | 213 | </v-card-text> |
210 | </v-card> | 214 | </v-card> |
211 | </v-dialog> | 215 | </v-dialog> |
212 | <!-- ****** EXPENSE TABLE ****** --> | 216 | <!-- ****** EXPENSE TABLE ****** --> |
213 | <v-toolbar color="transparent" flat> | 217 | <v-toolbar color="transparent" flat> |
214 | <v-btn | 218 | <v-btn |
215 | fab | 219 | fab |
216 | dark | 220 | dark |
217 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 221 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
218 | small | 222 | small |
219 | @click="addExpenseDialog = true" | 223 | @click="addExpenseDialog = true" |
220 | > | 224 | > |
221 | <v-icon dark>add</v-icon> | 225 | <v-icon dark>add</v-icon> |
222 | </v-btn> | 226 | </v-btn> |
223 | <v-btn | 227 | <v-btn |
224 | round | 228 | round |
225 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 229 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
226 | dark | 230 | dark |
227 | @click="addExpenseDialog = true" | 231 | @click="addExpenseDialog = true" |
228 | > | 232 | > |
229 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Expense | 233 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Expense |
230 | </v-btn> | 234 | </v-btn> |
231 | <v-spacer></v-spacer> | 235 | <v-spacer></v-spacer> |
232 | <v-card-title class="body-1" v-show="show"> | 236 | <v-card-title class="body-1" v-show="show"> |
233 | <v-btn icon large flat @click="displaySearch"> | 237 | <v-btn icon large flat @click="displaySearch"> |
234 | <v-avatar size="27"> | 238 | <v-avatar size="27"> |
235 | <img src="/static/icon/search.png" alt="icon" /> | 239 | <img src="/static/icon/search.png" alt="icon" /> |
236 | </v-avatar> | 240 | </v-avatar> |
237 | </v-btn> | 241 | </v-btn> |
238 | </v-card-title> | 242 | </v-card-title> |
239 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 243 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
240 | <v-layout> | 244 | <v-layout> |
241 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 245 | <v-text-field |
246 | autofocus | ||
247 | v-model="search" | ||
248 | label="Search" | ||
249 | prepend-inner-icon="search" | ||
250 | color="primary" | ||
251 | ></v-text-field> | ||
242 | <v-icon @click="closeSearch" color="error">close</v-icon> | 252 | <v-icon @click="closeSearch" color="error">close</v-icon> |
243 | </v-layout> | 253 | </v-layout> |
244 | </v-flex> | 254 | </v-flex> |
245 | </v-toolbar> | 255 | </v-toolbar> |
246 | <v-data-table | 256 | <v-data-table |
247 | :headers="headers" | 257 | :headers="headers" |
248 | :items="expenseList" | 258 | :items="expenseList" |
249 | :pagination.sync="pagination" | 259 | :pagination.sync="pagination" |
250 | :search="search" | 260 | :search="search" |
251 | > | 261 | > |
252 | <template slot="items" slot-scope="props"> | 262 | <template slot="items" slot-scope="props"> |
253 | <tr class="tr"> | 263 | <tr class="tr"> |
254 | <td class="td td-row">{{ props.index + 1}}</td> | 264 | <td class="td td-row">{{ props.index + 1}}</td> |
255 | <td class="text-xs-center td td-row"> | 265 | <td class="text-xs-center td td-row"> |
256 | <v-avatar> | 266 | <v-avatar> |
257 | <img :src="props.item.fileUrl" v-if="props.item.fileUrl" /> | 267 | <img :src="props.item.fileUrl" v-if="props.item.fileUrl" /> |
258 | <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" /> | 268 | <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" /> |
259 | </v-avatar> | 269 | </v-avatar> |
260 | </td> | 270 | </td> |
261 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 271 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
262 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> | 272 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> |
263 | <td class="text-xs-center td td-row">{{ props.item.user }}</td> | 273 | <td class="text-xs-center td td-row">{{ props.item.user }}</td> |
264 | <td class="text-xs-center td td-row">{{ props.item.amount }}</td> | 274 | <td class="text-xs-center td td-row">{{ props.item.amount }}</td> |
265 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> | 275 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> |
266 | <td class="text-xs-center td td-row"> | 276 | <td class="text-xs-center td td-row"> |
267 | <span> | 277 | <span> |
268 | <v-tooltip top> | 278 | <v-tooltip top> |
269 | <img | 279 | <img |
270 | slot="activator" | 280 | slot="activator" |
271 | style="cursor:pointer; width:25px; height:25px; " | 281 | style="cursor:pointer; width:25px; height:25px; " |
272 | class="mr-3" | 282 | class="mr-3" |
273 | @click="profile(props.item)" | 283 | @click="profile(props.item)" |
274 | src="/static/icon/view.png" | 284 | src="/static/icon/view.png" |
275 | /> | 285 | /> |
276 | <span>View</span> | 286 | <span>View</span> |
277 | </v-tooltip> | 287 | </v-tooltip> |
278 | <v-tooltip top> | 288 | <v-tooltip top> |
279 | <img | 289 | <img |
280 | slot="activator" | 290 | slot="activator" |
281 | style="cursor:pointer; width:20px; height:18px; " | 291 | style="cursor:pointer; width:20px; height:18px; " |
282 | class="mr-3" | 292 | class="mr-3" |
283 | @click="editItem(props.item)" | 293 | @click="editItem(props.item)" |
284 | src="/static/icon/edit.png" | 294 | src="/static/icon/edit.png" |
285 | /> | 295 | /> |
286 | <span>Edit</span> | 296 | <span>Edit</span> |
287 | </v-tooltip> | 297 | </v-tooltip> |
288 | <v-tooltip top> | 298 | <v-tooltip top> |
289 | <img | 299 | <img |
290 | slot="activator" | 300 | slot="activator" |
291 | style="cursor:pointer; width:20px; height:20px; " | 301 | style="cursor:pointer; width:20px; height:20px; " |
292 | @click="deleteItem(props.item)" | 302 | @click="deleteItem(props.item)" |
293 | src="/static/icon/delete.png" | 303 | src="/static/icon/delete.png" |
294 | /> | 304 | /> |
295 | <span>Delete</span> | 305 | <span>Delete</span> |
296 | </v-tooltip> | 306 | </v-tooltip> |
297 | </span> | 307 | </span> |
298 | </td> | 308 | </td> |
299 | </tr> | 309 | </tr> |
300 | </template> | 310 | </template> |
301 | <v-alert | 311 | <v-alert |
302 | slot="no-results" | 312 | slot="no-results" |
303 | :value="true" | 313 | :value="true" |
304 | color="error" | 314 | color="error" |
305 | icon="warning" | 315 | icon="warning" |
306 | >Your search for "{{ search }}" found no results.</v-alert> | 316 | >Your search for "{{ search }}" found no results.</v-alert> |
307 | </v-data-table> | 317 | </v-data-table> |
308 | 318 | ||
309 | <!-- ****** Add Expense Data ****** --> | 319 | <!-- ****** Add Expense Data ****** --> |
310 | <v-dialog v-model="addExpenseDialog" max-width="600px"> | 320 | <v-dialog v-model="addExpenseDialog" max-width="600px" v-if="addExpenseDialog"> |
311 | <v-card flat class="card-style pa-2" dark> | 321 | <v-card flat class="card-style pa-2" dark> |
312 | <v-layout> | 322 | <v-layout> |
313 | <v-flex xs12> | 323 | <v-flex xs12> |
314 | <label class="title text-xs-center">Add Expense</label> | 324 | <label class="title text-xs-center">Add Expense</label> |
315 | <v-icon size="24" class="right" @click="addExpenseDialog = false">cancel</v-icon> | 325 | <v-icon size="24" class="right" @click="closeAddExpenseModel">cancel</v-icon> |
316 | </v-flex> | 326 | </v-flex> |
317 | </v-layout> | 327 | </v-layout> |
318 | <v-flex xs12 sm12> | 328 | <v-flex xs12 sm12> |
319 | <v-form ref="form" v-model="valid" lazy-validation> | 329 | <v-form ref="form" v-model="valid" lazy-validation> |
320 | <v-container fluid> | 330 | <v-container fluid> |
321 | <v-layout> | 331 | <v-layout> |
322 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 332 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
323 | <v-avatar size="80px"> | 333 | <v-avatar size="80px"> |
324 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 334 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
325 | </v-avatar> | 335 | </v-avatar> |
326 | <img | 336 | <img |
327 | :src="imageUrl" | 337 | :src="imageUrl" |
328 | height="150" | 338 | height="150" |
329 | v-if="imageUrl" | 339 | v-if="imageUrl" |
330 | style="border-radius:50%; width:150px" | 340 | style="border-radius:50%; width:150px" |
331 | /> | 341 | /> |
332 | </v-flex> | 342 | </v-flex> |
333 | </v-layout> | 343 | </v-layout> |
334 | <v-layout> | 344 | <v-layout> |
335 | <v-flex xs12 sm12> | 345 | <v-flex xs12 sm12> |
336 | <v-layout> | 346 | <v-layout> |
337 | <v-flex xs4 class="pt-4 subheading"> | 347 | <v-flex xs4 class="pt-4 subheading"> |
338 | <label class="right">Name:</label> | 348 | <label class="right">Name:</label> |
339 | </v-flex> | 349 | </v-flex> |
340 | <v-flex xs8 sm6 class="ml-3"> | 350 | <v-flex xs8 sm6 class="ml-3"> |
341 | <v-text-field | 351 | <v-text-field |
342 | v-model="addExpense.name" | 352 | v-model="addExpense.name" |
343 | placeholder="fill your full Name" | 353 | placeholder="fill your full Name" |
344 | name="name" | 354 | name="name" |
345 | type="text" | 355 | type="text" |
346 | :rules="nameRules" | 356 | :rules="nameRules" |
347 | required | 357 | required |
348 | ></v-text-field> | 358 | ></v-text-field> |
349 | </v-flex> | 359 | </v-flex> |
350 | </v-layout> | 360 | </v-layout> |
351 | </v-flex> | 361 | </v-flex> |
352 | </v-layout> | 362 | </v-layout> |
353 | <v-layout> | 363 | <v-layout> |
354 | <v-flex xs12 sm12> | 364 | <v-flex xs12 sm12> |
355 | <v-layout> | 365 | <v-layout> |
356 | <v-flex xs4 class="pt-4 subheading"> | 366 | <v-flex xs4 class="pt-4 subheading"> |
357 | <label class="right">Amount:</label> | 367 | <label class="right">Amount:</label> |
358 | </v-flex> | 368 | </v-flex> |
359 | <v-flex xs8 sm6 class="ml-3"> | 369 | <v-flex xs8 sm6 class="ml-3"> |
360 | <v-text-field | 370 | <v-text-field |
361 | v-model="addExpense.amount" | 371 | v-model="addExpense.amount" |
362 | placeholder="fill your Amount" | 372 | placeholder="fill your Amount" |
363 | name="name" | 373 | name="name" |
364 | type="text" | 374 | type="text" |
365 | :rules="amountRules" | 375 | :rules="amountRules" |
366 | required | 376 | required |
367 | ></v-text-field> | 377 | ></v-text-field> |
368 | </v-flex> | 378 | </v-flex> |
369 | </v-layout> | 379 | </v-layout> |
370 | </v-flex> | 380 | </v-flex> |
371 | </v-layout> | 381 | </v-layout> |
372 | <v-layout> | 382 | <v-layout> |
373 | <v-flex xs12 sm12> | 383 | <v-flex xs12 sm12> |
374 | <v-layout> | 384 | <v-layout> |
375 | <v-flex xs4 class="pt-4 subheading"> | 385 | <v-flex xs4 class="pt-4 subheading"> |
376 | <label class="right">Date</label> | 386 | <label class="right">Date</label> |
377 | </v-flex> | 387 | </v-flex> |
378 | <v-flex xs8 sm6 class="ml-3"> | 388 | <v-flex xs8 sm6 class="ml-3"> |
379 | <v-menu | 389 | <v-menu |
380 | ref="menu1" | 390 | ref="menu1" |
381 | :close-on-content-click="false" | 391 | :close-on-content-click="false" |
382 | v-model="menu1" | 392 | v-model="menu1" |
383 | :nudge-right="40" | 393 | :nudge-right="40" |
384 | lazy | 394 | lazy |
385 | transition="scale-transition" | 395 | transition="scale-transition" |
386 | offset-y | 396 | offset-y |
387 | full-width | 397 | full-width |
388 | min-width="290px" | 398 | min-width="290px" |
389 | > | 399 | > |
390 | <v-text-field | 400 | <v-text-field |
391 | slot="activator" | 401 | slot="activator" |
392 | :rules="joinDateRules" | 402 | :rules="joinDateRules" |
393 | v-model="addExpense.date" | 403 | v-model="addExpense.date" |
394 | placeholder="Select date" | 404 | placeholder="Select date" |
395 | ></v-text-field> | 405 | ></v-text-field> |
396 | <v-date-picker | 406 | <v-date-picker |
397 | ref="picker" | 407 | ref="picker" |
398 | v-model="addExpense.date" | 408 | v-model="addExpense.date" |
399 | @input="$refs.menu1.save(addExpense.date)" | 409 | @input="$refs.menu1.save(addExpense.date)" |
400 | ></v-date-picker> | 410 | ></v-date-picker> |
401 | </v-menu> | 411 | </v-menu> |
402 | </v-flex> | 412 | </v-flex> |
403 | </v-layout> | 413 | </v-layout> |
404 | </v-flex> | 414 | </v-flex> |
405 | </v-layout> | 415 | </v-layout> |
406 | <v-layout> | 416 | <v-layout> |
407 | <v-flex xs12 sm12> | 417 | <v-flex xs12 sm12> |
408 | <v-layout> | 418 | <v-layout> |
409 | <v-flex xs4 class="pt-4 subheading"> | 419 | <v-flex xs4 class="pt-4 subheading"> |
410 | <label class="right">File:</label> | 420 | <label class="right">File:</label> |
411 | </v-flex> | 421 | </v-flex> |
412 | <v-flex xs8 sm6 class="ml-3"> | 422 | <v-flex xs8 sm6 class="ml-3"> |
413 | <v-text-field | 423 | <v-text-field |
414 | label="Select file" | 424 | label="Select file" |
415 | @click="pickFile" | 425 | @click="pickFile" |
416 | v-model="imageName" | 426 | v-model="imageName" |
417 | append-icon="attach_file" | 427 | append-icon="attach_file" |
418 | ></v-text-field> | 428 | ></v-text-field> |
419 | <input | 429 | <input |
420 | type="file" | 430 | type="file" |
421 | style="display:none" | 431 | style="display:none" |
422 | ref="image" | 432 | ref="image" |
423 | accept="image/*" | 433 | accept="image/*" |
424 | @change="onFilePicked" | 434 | @change="onFilePicked" |
425 | /> | 435 | /> |
426 | </v-flex> | 436 | </v-flex> |
427 | </v-layout> | 437 | </v-layout> |
428 | </v-flex> | 438 | </v-flex> |
429 | </v-layout> | 439 | </v-layout> |
430 | <v-layout> | 440 | <v-layout> |
431 | <v-flex xs12 sm12> | 441 | <v-flex xs12 sm12> |
432 | <v-layout> | 442 | <v-layout> |
433 | <v-flex xs4 class="pt-4 subheading"> | 443 | <v-flex xs4 class="pt-4 subheading"> |
434 | <label class="right">Note:</label> | 444 | <label class="right">Note:</label> |
435 | </v-flex> | 445 | </v-flex> |
436 | <v-flex xs8 sm6 class="ml-3"> | 446 | <v-flex xs8 sm6 class="ml-3"> |
437 | <v-textarea | 447 | <v-textarea |
438 | name="input-7-1" | 448 | name="input-7-1" |
439 | v-model="addExpense.note" | 449 | v-model="addExpense.note" |
440 | placeholder="fill your Note" | 450 | placeholder="fill your Note" |
441 | type="text" | 451 | type="text" |
442 | :rules="noteRules" | 452 | :rules="noteRules" |
443 | multi-line | 453 | multi-line |
444 | required | 454 | required |
445 | ></v-textarea> | 455 | ></v-textarea> |
446 | </v-flex> | 456 | </v-flex> |
447 | </v-layout> | 457 | </v-layout> |
448 | </v-flex> | 458 | </v-flex> |
449 | </v-layout> | 459 | </v-layout> |
450 | <v-layout> | 460 | <v-layout> |
451 | <v-flex xs11> | 461 | <v-flex xs11> |
452 | <v-layout> | 462 | <v-layout> |
453 | <v-spacer></v-spacer> | 463 | <v-spacer></v-spacer> |
454 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 464 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
455 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 465 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
456 | </v-layout> | 466 | </v-layout> |
457 | </v-flex> | 467 | </v-flex> |
458 | </v-layout> | 468 | </v-layout> |
459 | </v-container> | 469 | </v-container> |
460 | </v-form> | 470 | </v-form> |
461 | </v-flex> | 471 | </v-flex> |
462 | </v-card> | 472 | </v-card> |
463 | </v-dialog> | 473 | </v-dialog> |
464 | <div class="loader" v-if="showLoader"> | 474 | <div class="loader" v-if="showLoader"> |
465 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 475 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
466 | </div> | 476 | </div> |
467 | <v-snackbar | 477 | <v-snackbar |
468 | :timeout="timeout" | 478 | :timeout="timeout" |
469 | :top="y === 'top'" | 479 | :top="y === 'top'" |
470 | :right="x === 'right'" | 480 | :right="x === 'right'" |
471 | :vertical="mode === 'vertical'" | 481 | :vertical="mode === 'vertical'" |
472 | v-model="snackbar" | 482 | v-model="snackbar" |
473 | :color="color" | 483 | :color="color" |
474 | >{{ text }}</v-snackbar> | 484 | >{{ text }}</v-snackbar> |
475 | </v-container> | 485 | </v-container> |
476 | </template> | 486 | </template> |
477 | 487 | ||
478 | <script> | 488 | <script> |
479 | import http from "@/Services/http.js"; | 489 | import http from "@/Services/http.js"; |
480 | import moment from "moment"; | 490 | import moment from "moment"; |
481 | 491 | ||
482 | export default { | 492 | export default { |
483 | data: () => ({ | 493 | data: () => ({ |
484 | component: "report-generate", | 494 | component: "report-generate", |
485 | snackbar: false, | 495 | snackbar: false, |
486 | y: "top", | 496 | y: "top", |
487 | x: "right", | 497 | x: "right", |
488 | mode: "", | 498 | mode: "", |
489 | timeout: 5000, | 499 | timeout: 5000, |
490 | text: "", | 500 | text: "", |
491 | color: "", | 501 | color: "", |
492 | showLoader: false, | 502 | showLoader: false, |
493 | loading: false, | 503 | loading: false, |
494 | date: null, | 504 | date: null, |
495 | search: "", | 505 | search: "", |
496 | menu: false, | 506 | menu: false, |
497 | menu1: false, | 507 | menu1: false, |
498 | menu2: false, | 508 | menu2: false, |
499 | menu3: false, | 509 | menu3: false, |
500 | editExpenseDialog: false, | 510 | editExpenseDialog: false, |
501 | viewExpenseDialog: false, | 511 | viewExpenseDialog: false, |
502 | valid: true, | 512 | valid: true, |
503 | show: true, | 513 | show: true, |
504 | addExpenseDialog: false, | 514 | addExpenseDialog: false, |
505 | showSearch: false, | 515 | showSearch: false, |
506 | pagination: { | 516 | pagination: { |
507 | rowsPerPage: 10 | 517 | rowsPerPage: 10, |
508 | }, | 518 | }, |
509 | imageData: {}, | 519 | imageData: {}, |
510 | token: "", | 520 | token: "", |
511 | imageName: "", | 521 | imageName: "", |
512 | imageUrl: "", | 522 | imageUrl: "", |
513 | imageFile: "", | 523 | imageFile: "", |
514 | nameRules: [v => !!v || " Full Name is required"], | 524 | nameRules: [(v) => !!v || " Full Name is required"], |
515 | amountRules: [v => !!v || "Amount is required"], | 525 | amountRules: [(v) => !!v || "Amount is required"], |
516 | noteRules: [v => !!v || "Note Name is required"], | 526 | noteRules: [(v) => !!v || "Note Name is required"], |
517 | joinDateRules: [v => !!v || "Date is required"], | 527 | joinDateRules: [(v) => !!v || "Date is required"], |
518 | errorMessages: "", | 528 | errorMessages: "", |
519 | headers: [ | 529 | headers: [ |
520 | { | 530 | { |
521 | text: "No", | 531 | text: "No", |
522 | align: "center", | 532 | align: "center", |
523 | sortable: false, | 533 | sortable: false, |
524 | value: "No" | 534 | value: "No", |
525 | }, | 535 | }, |
526 | { | 536 | { |
527 | text: "Profile Pic", | 537 | text: "Profile Pic", |
528 | value: "profilePicUrl", | 538 | value: "profilePicUrl", |
529 | sortable: false, | 539 | sortable: false, |
530 | align: "center" | 540 | align: "center", |
531 | }, | 541 | }, |
532 | { text: "Name", value: "name", sortable: false, align: "center" }, | 542 | { text: "Name", value: "name", sortable: false, align: "center" }, |
533 | { text: "Date", value: "date", sortable: false, align: "center" }, | 543 | { text: "Date", value: "date", sortable: false, align: "center" }, |
534 | { text: "User", value: "user", sortable: false, align: "center" }, | 544 | { text: "User", value: "user", sortable: false, align: "center" }, |
535 | { text: "Amount", value: "amount", sortable: false, align: "center" }, | 545 | { text: "Amount", value: "amount", sortable: false, align: "center" }, |
536 | { text: "Note", value: "note", sortable: false, align: "center" }, | 546 | { text: "Note", value: "note", sortable: false, align: "center" }, |
537 | { text: "Action", value: "", sortable: false, align: "center" } | 547 | { text: "Action", value: "", sortable: false, align: "center" }, |
538 | ], | 548 | ], |
539 | expenseList: [], | 549 | expenseList: [], |
540 | editedIndex: -1, | 550 | editedIndex: -1, |
541 | upload: "", | 551 | upload: "", |
542 | editedItem: { | 552 | editedItem: { |
543 | role: "TEACHER", | 553 | role: "TEACHER", |
544 | name: "", | 554 | name: "", |
545 | email: "", | 555 | email: "", |
546 | date: null, | 556 | date: null, |
547 | city: "", | 557 | city: "", |
548 | pincode: "", | 558 | pincode: "", |
549 | country: "", | 559 | country: "", |
550 | permanentAddress: "", | 560 | permanentAddress: "", |
551 | presentAddress: "", | 561 | presentAddress: "", |
552 | mobileNo: "", | 562 | mobileNo: "", |
553 | state: "", | 563 | state: "", |
554 | joinDate: null | 564 | joinDate: null, |
555 | }, | 565 | }, |
556 | addExpense: {} | 566 | addExpense: {}, |
557 | }), | 567 | }), |
558 | watch: { | 568 | watch: { |
559 | menu(val) { | 569 | menu(val) { |
560 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 570 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
561 | }, | 571 | }, |
562 | menu1(val) { | 572 | menu1(val) { |
563 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 573 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
564 | } | 574 | }, |
575 | addExpenseDialog: function (val) { | ||
576 | if (!val) { | ||
577 | this.addExpense = []; | ||
578 | this.menu1 = false; | ||
579 | this.imageName = ""; | ||
580 | this.imageFile = ""; | ||
581 | this.imageUrl = ""; | ||
582 | } | ||
583 | }, | ||
565 | }, | 584 | }, |
566 | methods: { | 585 | methods: { |
567 | save(date) { | 586 | save(date) { |
568 | this.$refs.menu.save(date); | 587 | this.$refs.menu.save(date); |
569 | }, | 588 | }, |
570 | save(date) { | 589 | save(date) { |
571 | this.$refs.menu1.save(date); | 590 | this.$refs.menu1.save(date); |
572 | }, | 591 | }, |
573 | pickFile() { | 592 | pickFile() { |
574 | this.$refs.image.click(); | 593 | this.$refs.image.click(); |
575 | }, | 594 | }, |
576 | dates: function(date) { | 595 | dates: function (date) { |
577 | return moment(date).format("MMMM DD, YYYY"); | 596 | return moment(date).format("MMMM DD, YYYY"); |
578 | }, | 597 | }, |
579 | onFilePicked(e) { | 598 | onFilePicked(e) { |
580 | // console.log(e) | 599 | // console.log(e) |
581 | const files = e.target.files; | 600 | const files = e.target.files; |
582 | this.upload = e.target.files[0]; | 601 | this.upload = e.target.files[0]; |
583 | console.log("imageData-upload========>", this.upload); | 602 | console.log("imageData-upload========>", this.upload); |
584 | if (files[0] !== undefined) { | 603 | if (files[0] !== undefined) { |
585 | this.imageName = files[0].name; | 604 | this.imageName = files[0].name; |
586 | if (this.imageName.lastIndexOf(".") <= 0) { | 605 | if (this.imageName.lastIndexOf(".") <= 0) { |
587 | return; | 606 | return; |
588 | } | 607 | } |
589 | const fr = new FileReader(); | 608 | const fr = new FileReader(); |
590 | fr.readAsDataURL(files[0]); | 609 | fr.readAsDataURL(files[0]); |
591 | fr.addEventListener("load", () => { | 610 | fr.addEventListener("load", () => { |
592 | this.imageUrl = fr.result; | 611 | this.imageUrl = fr.result; |
593 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 612 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
594 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 613 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
595 | // console.log("upload=======>", this.imageData.imageUrl); | 614 | // console.log("upload=======>", this.imageData.imageUrl); |
596 | console.log("imageFile", this.imageUrl); | 615 | console.log("imageFile", this.imageUrl); |
597 | }); | 616 | }); |
598 | } else { | 617 | } else { |
599 | this.imageName = ""; | 618 | this.imageName = ""; |
600 | this.imageFile = ""; | 619 | this.imageFile = ""; |
601 | this.imageUrl = ""; | 620 | this.imageUrl = ""; |
602 | } | 621 | } |
603 | }, | 622 | }, |
604 | getExpenseList() { | 623 | getExpenseList() { |
605 | http() | 624 | http() |
606 | .get("/getExpensesList", { | 625 | .get("/getExpensesList", { |
607 | params: { schoolId: this.$store.state.schoolId }, | 626 | params: { schoolId: this.$store.state.schoolId }, |
608 | headers: { Authorization: "Bearer " + this.token } | 627 | headers: { Authorization: "Bearer " + this.token }, |
609 | }) | 628 | }) |
610 | .then(response => { | 629 | .then((response) => { |
611 | this.expenseList = response.data.data; | 630 | this.expenseList = response.data.data; |
612 | this.showLoader = false; | 631 | this.showLoader = false; |
613 | // console.log("getTeacherList=====>",this.expenseList) | 632 | // console.log("getTeacherList=====>",this.expenseList) |
614 | }) | 633 | }) |
615 | .catch(error => { | 634 | .catch((error) => { |
616 | this.showLoader = false; | 635 | this.showLoader = false; |
617 | // if (error.response.status === 401) { | 636 | // if (error.response.status === 401) { |
618 | // this.$router.replace({ path: "/" }); | 637 | // this.$router.replace({ path: "/" }); |
619 | // this.$store.dispatch("setToken", null); | 638 | // this.$store.dispatch("setToken", null); |
620 | // this.$store.dispatch("Id", null); | 639 | // this.$store.dispatch("Id", null); |
621 | // } | 640 | // } |
622 | }); | 641 | }); |
623 | }, | 642 | }, |
624 | editItem(item) { | 643 | editItem(item) { |
625 | this.editedIndex = this.expenseList.indexOf(item); | 644 | this.editedIndex = this.expenseList.indexOf(item); |
626 | this.editedItem = Object.assign({}, item); | 645 | this.editedItem = Object.assign({}, item); |
627 | this.editedItem.date = | 646 | this.editedItem.date = |
628 | this.editedItem.date != undefined | 647 | this.editedItem.date != undefined |
629 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 648 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
630 | : (this.editedItem.date = ""); | 649 | : (this.editedItem.date = ""); |
631 | 650 | ||
632 | this.editExpenseDialog = true; | 651 | this.editExpenseDialog = true; |
633 | }, | 652 | }, |
634 | profile(item) { | 653 | profile(item) { |
635 | this.editedIndex = this.expenseList.indexOf(item); | 654 | this.editedIndex = this.expenseList.indexOf(item); |
636 | this.editedItem = Object.assign({}, item); | 655 | this.editedItem = Object.assign({}, item); |
637 | this.viewExpenseDialog = true; | 656 | this.viewExpenseDialog = true; |
638 | }, | 657 | }, |
639 | deleteItem(item) { | 658 | deleteItem(item) { |
640 | let deleteExpense = { | 659 | let deleteExpense = { |
641 | expenseId: item._id | 660 | expenseId: item._id, |
642 | }; | 661 | }; |
643 | // console.log("deleteUers",deleteTeachers) | 662 | // console.log("deleteUers",deleteTeachers) |
644 | http() | 663 | http() |
645 | .delete( | 664 | .delete( |
646 | "/deleteExpense", | 665 | "/deleteExpense", |
647 | confirm("Are you sure you want to delete this?") && { | 666 | confirm("Are you sure you want to delete this?") && { |
648 | params: deleteExpense | 667 | params: deleteExpense, |
649 | } | 668 | } |
650 | ) | 669 | ) |
651 | .then(response => { | 670 | .then((response) => { |
652 | // console.log("deleteUers",deleteTeachers) | 671 | // console.log("deleteUers",deleteTeachers) |
653 | this.snackbar = true; | 672 | this.snackbar = true; |
654 | this.text = response.data.message; | 673 | this.text = response.data.message; |
655 | this.color = "green"; | 674 | this.color = "green"; |
656 | this.getExpenseList(); | 675 | this.getExpenseList(); |
657 | }) | 676 | }) |
658 | .catch(error => { | 677 | .catch((error) => { |
659 | this.snackbar = true; | 678 | this.snackbar = true; |
660 | this.text = error.response.data.message; | 679 | this.text = error.response.data.message; |
661 | this.color = "error"; | 680 | this.color = "error"; |
662 | }); | 681 | }); |
663 | }, | 682 | }, |
664 | close() { | 683 | close() { |
665 | this.editExpenseDialog = false; | 684 | this.editExpenseDialog = false; |
666 | }, | 685 | }, |
686 | closeAddExpenseModel() { | ||
687 | this.addExpenseDialog = false; | ||
688 | this.addExpense = []; | ||
689 | this.menu1 = false; | ||
690 | this.imageName = ""; | ||
691 | this.imageFile = ""; | ||
692 | this.imageUrl = ""; | ||
693 | }, | ||
667 | submit() { | 694 | submit() { |
668 | if (this.$refs.form.validate()) { | 695 | if (this.$refs.form.validate()) { |
669 | if (this.imageUrl) { | 696 | if (this.imageUrl) { |
670 | var str = this.imageUrl; | 697 | var str = this.imageUrl; |
671 | const [baseUrl, imageUrl] = str.split(/,/); | 698 | const [baseUrl, imageUrl] = str.split(/,/); |
672 | this.addExpense.upload = imageUrl; | 699 | this.addExpense.upload = imageUrl; |
673 | } | 700 | } |
674 | this.loading = true; | 701 | this.loading = true; |
675 | // this.addExpense = this.$store.state.schoolId; | 702 | // this.addExpense = this.$store.state.schoolId; |
676 | http() | 703 | http() |
677 | .post("/createExpense", this.addExpense) | 704 | .post("/createExpense", this.addExpense) |
678 | .then(response => { | 705 | .then((response) => { |
679 | this.getExpenseList(); | 706 | this.getExpenseList(); |
680 | this.snackbar = true; | 707 | this.snackbar = true; |
681 | this.text = response.data.message; | 708 | this.text = response.data.message; |
682 | this.color = "green"; | 709 | this.color = "green"; |
683 | this.clear(); | 710 | this.clear(); |
684 | this.imageUrl = ""; | 711 | this.imageUrl = ""; |
685 | this.loading = false; | 712 | this.loading = false; |
686 | this.addExpenseDialog = false; | 713 | this.addExpenseDialog = false; |
687 | }) | 714 | }) |
688 | .catch(error => { | 715 | .catch((error) => { |
689 | // console.log(error); | 716 | // console.log(error); |
690 | this.snackbar = true; | 717 | this.snackbar = true; |
691 | this.color = "error"; | 718 | this.color = "error"; |
692 | this.text = error.response.data.message; | 719 | this.text = error.response.data.message; |
693 | this.loading = false; | 720 | this.loading = false; |
694 | }); | 721 | }); |
695 | } | 722 | } |
696 | }, | 723 | }, |
697 | clear() { | 724 | clear() { |
698 | this.$refs.form.reset(); | 725 | this.$refs.form.reset(); |
699 | }, | 726 | }, |
700 | save() { | 727 | save() { |
701 | this.loading = true; | 728 | this.loading = true; |
702 | this.editedItem.expenseId = this.editedItem._id; | 729 | this.editedItem.expenseId = this.editedItem._id; |
703 | if (this.imageUrl) { | 730 | if (this.imageUrl) { |
704 | var str = this.imageUrl; | 731 | var str = this.imageUrl; |
705 | const [baseUrl, imageUrl] = str.split(/,/); | 732 | const [baseUrl, imageUrl] = str.split(/,/); |
706 | this.editedItem.upload = imageUrl; | 733 | this.editedItem.upload = imageUrl; |
707 | } | 734 | } |
708 | http() | 735 | http() |
709 | .put("/updateExpense", this.editedItem) | 736 | .put("/updateExpense", this.editedItem) |
710 | .then(response => { | 737 | .then((response) => { |
711 | this.snackbar = true; | 738 | this.snackbar = true; |
712 | this.text = response.data.message; | 739 | this.text = response.data.message; |
713 | this.color = "green"; | 740 | this.color = "green"; |
714 | this.loading = false; | 741 | this.loading = false; |
715 | this.getExpenseList(); | 742 | this.getExpenseList(); |
716 | this.close(); | 743 | this.close(); |
717 | }) | 744 | }) |
718 | .catch(error => { | 745 | .catch((error) => { |
719 | this.snackbar = true; | 746 | this.snackbar = true; |
720 | this.text = error.response.data.message; | 747 | this.text = error.response.data.message; |
721 | this.color = "error"; | 748 | this.color = "error"; |
722 | }); | 749 | }); |
723 | }, | 750 | }, |
724 | displaySearch() { | 751 | displaySearch() { |
725 | (this.show = false), (this.showSearch = true); | 752 | (this.show = false), (this.showSearch = true); |
726 | }, | 753 | }, |
727 | closeSearch() { | 754 | closeSearch() { |
728 | this.showSearch = false; | 755 | this.showSearch = false; |
729 | this.show = true; | 756 | this.show = true; |
730 | this.search = ""; | 757 | this.search = ""; |
731 | } | 758 | }, |
732 | }, | 759 | }, |
733 | mounted() { | 760 | mounted() { |
734 | this.token = this.$store.state.token; | 761 | this.token = this.$store.state.token; |
735 | this.getExpenseList(); | 762 | this.getExpenseList(); |
736 | } | 763 | }, |
737 | }; | 764 | }; |
738 | </script> | 765 | </script> |
src/pages/Account/feeTypes.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT SECTION ****** --> | 3 | <!-- ****** EDIT SECTION ****** --> |
4 | <v-dialog v-model="editFeeTypeDialog" max-width="600px"> | 4 | <v-dialog v-model="editFeeTypeDialog" 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 Fee Type</label> | 8 | <label class="title text-xs-center">Edit Fee Type</label> |
9 | <v-icon size="24" class="right" @click="editFeeTypeDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editFeeTypeDialog = 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 wrap justify-center> | 13 | <v-layout wrap justify-center> |
14 | <v-flex xs12 sm11> | 14 | <v-flex xs12 sm11> |
15 | <v-layout> | 15 | <v-layout> |
16 | <v-flex xs4 class="pt-4 subheading"> | 16 | <v-flex xs4 class="pt-4 subheading"> |
17 | <label class="right">Fee Type:</label> | 17 | <label class="right">Fee Type:</label> |
18 | </v-flex> | 18 | </v-flex> |
19 | <v-flex xs8> | 19 | <v-flex xs8> |
20 | <v-text-field | 20 | <v-text-field |
21 | class="ml-3" | 21 | class="ml-3" |
22 | v-model="editedItem.feeType" | 22 | v-model="editedItem.feeType" |
23 | placeholder="fill your Fee Type" | 23 | placeholder="fill your Fee Type" |
24 | required | 24 | required |
25 | ></v-text-field> | 25 | ></v-text-field> |
26 | </v-flex> | 26 | </v-flex> |
27 | </v-layout> | 27 | </v-layout> |
28 | <v-layout> | 28 | <v-layout> |
29 | <v-flex xs4 class="pt-4 subheading"> | 29 | <v-flex xs4 class="pt-4 subheading"> |
30 | <label class="right">Note:</label> | 30 | <label class="right">Note:</label> |
31 | </v-flex> | 31 | </v-flex> |
32 | <v-flex xs8> | 32 | <v-flex xs8> |
33 | <v-textarea | 33 | <v-textarea |
34 | name="input-7-1" | 34 | name="input-7-1" |
35 | class="ml-3" | 35 | class="ml-3" |
36 | v-model="editedItem.note" | 36 | v-model="editedItem.note" |
37 | placeholder="fill your Note" | 37 | placeholder="fill your Note" |
38 | multi-line | 38 | multi-line |
39 | required | 39 | required |
40 | ></v-textarea> | 40 | ></v-textarea> |
41 | </v-flex> | 41 | </v-flex> |
42 | </v-layout> | 42 | </v-layout> |
43 | <v-card-actions class="hidden-xs-only hidden-sm-only "> | 43 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
44 | <v-spacer></v-spacer> | 44 | <v-spacer></v-spacer> |
45 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 45 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
46 | </v-card-actions> | 46 | </v-card-actions> |
47 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 47 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
48 | <v-spacer></v-spacer> | 48 | <v-spacer></v-spacer> |
49 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 49 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
50 | <v-spacer></v-spacer> | 50 | <v-spacer></v-spacer> |
51 | </v-card-actions> | 51 | </v-card-actions> |
52 | </v-flex> | 52 | </v-flex> |
53 | </v-layout> | 53 | </v-layout> |
54 | </v-container> | 54 | </v-container> |
55 | </v-card> | 55 | </v-card> |
56 | </v-dialog> | 56 | </v-dialog> |
57 | 57 | ||
58 | <!-- ****** PROFILE VIEW FEE TYPE DATA ****** --> | 58 | <!-- ****** PROFILE VIEW FEE TYPE DATA ****** --> |
59 | 59 | ||
60 | <v-dialog v-model="viewFeeTypeDialog" max-width="400px"> | 60 | <v-dialog v-model="viewFeeTypeDialog" max-width="400px"> |
61 | <v-card flat class="card-style pa-3" dark> | 61 | <v-card flat class="card-style pa-3" dark> |
62 | <v-layout> | 62 | <v-layout> |
63 | <v-flex xs12> | 63 | <v-flex xs12> |
64 | <label class="title text-xs-center">View Fee Type</label> | 64 | <label class="title text-xs-center">View Fee Type</label> |
65 | <v-icon size="24" class="right" @click="viewFeeTypeDialog = false">cancel</v-icon> | 65 | <v-icon size="24" class="right" @click="viewFeeTypeDialog = false">cancel</v-icon> |
66 | </v-flex> | 66 | </v-flex> |
67 | </v-layout> | 67 | </v-layout> |
68 | <v-container grid-list-md> | 68 | <v-container grid-list-md> |
69 | <v-layout wrap> | 69 | <v-layout wrap> |
70 | <v-flex> | 70 | <v-flex> |
71 | <v-layout> | 71 | <v-layout> |
72 | <v-flex xs5 sm6> | 72 | <v-flex xs5 sm6> |
73 | <h5 class="right my-1"> | 73 | <h5 class="right my-1"> |
74 | <b>Fee Type:</b> | 74 | <b>Fee Type:</b> |
75 | </h5> | 75 | </h5> |
76 | </v-flex> | 76 | </v-flex> |
77 | <v-flex sm6 xs8> | 77 | <v-flex sm6 xs8> |
78 | <h5 class="my-1">{{ editedItem.feeType }}</h5> | 78 | <h5 class="my-1">{{ editedItem.feeType }}</h5> |
79 | </v-flex> | 79 | </v-flex> |
80 | </v-layout> | 80 | </v-layout> |
81 | <v-layout> | 81 | <v-layout> |
82 | <v-flex xs5 sm6> | 82 | <v-flex xs5 sm6> |
83 | <h5 class="right my-1"> | 83 | <h5 class="right my-1"> |
84 | <b>Note:</b> | 84 | <b>Note:</b> |
85 | </h5> | 85 | </h5> |
86 | </v-flex> | 86 | </v-flex> |
87 | <v-flex sm6 xs8> | 87 | <v-flex sm6 xs8> |
88 | <h5 class="my-1">{{ editedItem.note }}</h5> | 88 | <h5 class="my-1">{{ editedItem.note }}</h5> |
89 | </v-flex> | 89 | </v-flex> |
90 | </v-layout> | 90 | </v-layout> |
91 | </v-flex> | 91 | </v-flex> |
92 | </v-layout> | 92 | </v-layout> |
93 | </v-container> | 93 | </v-container> |
94 | </v-card> | 94 | </v-card> |
95 | </v-dialog> | 95 | </v-dialog> |
96 | 96 | ||
97 | <!-- ****** EXISTING-FEETYPE TABLE ****** --> | 97 | <!-- ****** EXISTING-FEETYPE TABLE ****** --> |
98 | <v-toolbar color="transparent" flat> | 98 | <v-toolbar color="transparent" flat> |
99 | <v-btn | 99 | <v-btn |
100 | fab | 100 | fab |
101 | dark | 101 | dark |
102 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 102 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
103 | small | 103 | small |
104 | @click="addFeeTypeDialog = true" | 104 | @click="addFeeTypeDialog = true" |
105 | > | 105 | > |
106 | <v-icon dark>add</v-icon> | 106 | <v-icon dark>add</v-icon> |
107 | </v-btn> | 107 | </v-btn> |
108 | <v-btn | 108 | <v-btn |
109 | round | 109 | round |
110 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 110 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
111 | dark | 111 | dark |
112 | @click="addFeeTypeDialog = true" | 112 | @click="addFeeTypeDialog = true" |
113 | > | 113 | > |
114 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Fee Type | 114 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Fee Type |
115 | </v-btn> | 115 | </v-btn> |
116 | <v-spacer></v-spacer> | 116 | <v-spacer></v-spacer> |
117 | <v-card-title class="body-1" v-show="show"> | 117 | <v-card-title class="body-1" v-show="show"> |
118 | <v-btn icon large flat @click="displaySearch"> | 118 | <v-btn icon large flat @click="displaySearch"> |
119 | <v-avatar size="27"> | 119 | <v-avatar size="27"> |
120 | <img src="/static/icon/search.png" alt="icon" /> | 120 | <img src="/static/icon/search.png" alt="icon" /> |
121 | </v-avatar> | 121 | </v-avatar> |
122 | </v-btn> | 122 | </v-btn> |
123 | </v-card-title> | 123 | </v-card-title> |
124 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 124 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
125 | <v-layout> | 125 | <v-layout> |
126 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 126 | <v-text-field |
127 | autofocus | ||
128 | v-model="search" | ||
129 | label="Search" | ||
130 | prepend-inner-icon="search" | ||
131 | color="primary" | ||
132 | ></v-text-field> | ||
127 | <v-icon @click="closeSearch" color="error">close</v-icon> | 133 | <v-icon @click="closeSearch" color="error">close</v-icon> |
128 | </v-layout> | 134 | </v-layout> |
129 | </v-flex> | 135 | </v-flex> |
130 | </v-toolbar> | 136 | </v-toolbar> |
131 | <v-data-table | 137 | <v-data-table |
132 | :headers="headers" | 138 | :headers="headers" |
133 | :items="feeTypeList" | 139 | :items="feeTypeList" |
134 | :pagination.sync="pagination" | 140 | :pagination.sync="pagination" |
135 | :search="search" | 141 | :search="search" |
136 | > | 142 | > |
137 | <template slot="items" slot-scope="props"> | 143 | <template slot="items" slot-scope="props"> |
138 | <tr class="tr"> | 144 | <tr class="tr"> |
139 | <td class="td td-row">{{ props.index + 1}}</td> | 145 | <td class="td td-row">{{ props.index + 1}}</td> |
140 | <td class="text-xs-center td td-row">{{ props.item.feeType }}</td> | 146 | <td class="text-xs-center td td-row">{{ props.item.feeType }}</td> |
141 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> | 147 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> |
142 | <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> --> | 148 | <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> --> |
143 | 149 | ||
144 | <td class="text-xs-center td td-row"> | 150 | <td class="text-xs-center td td-row"> |
145 | <!-- <span> --> | 151 | <!-- <span> --> |
146 | <v-tooltip top> | 152 | <v-tooltip top> |
147 | <img | 153 | <img |
148 | slot="activator" | 154 | slot="activator" |
149 | style="cursor:pointer; width:25px; height:25px; " | 155 | style="cursor:pointer; width:25px; height:25px; " |
150 | class="mr-3" | 156 | class="mr-3" |
151 | @click="profile(props.item)" | 157 | @click="profile(props.item)" |
152 | src="/static/icon/view.png" | 158 | src="/static/icon/view.png" |
153 | /> | 159 | /> |
154 | <span>View</span> | 160 | <span>View</span> |
155 | </v-tooltip> | 161 | </v-tooltip> |
156 | <v-tooltip top> | 162 | <v-tooltip top> |
157 | <img | 163 | <img |
158 | slot="activator" | 164 | slot="activator" |
159 | style="cursor:pointer; width:20px; height:18px; " | 165 | style="cursor:pointer; width:20px; height:18px; " |
160 | class="mr-3" | 166 | class="mr-3" |
161 | @click="editItem(props.item)" | 167 | @click="editItem(props.item)" |
162 | src="/static/icon/edit.png" | 168 | src="/static/icon/edit.png" |
163 | /> | 169 | /> |
164 | <span>Edit</span> | 170 | <span>Edit</span> |
165 | </v-tooltip> | 171 | </v-tooltip> |
166 | <v-tooltip top> | 172 | <v-tooltip top> |
167 | <img | 173 | <img |
168 | slot="activator" | 174 | slot="activator" |
169 | style="cursor:pointer; width:20px; height:20px; " | 175 | style="cursor:pointer; width:20px; height:20px; " |
170 | @click="deleteItem(props.item)" | 176 | @click="deleteItem(props.item)" |
171 | class="mr-3" | 177 | class="mr-3" |
172 | src="/static/icon/delete.png" | 178 | src="/static/icon/delete.png" |
173 | /> | 179 | /> |
174 | <span>Delete</span> | 180 | <span>Delete</span> |
175 | </v-tooltip> | 181 | </v-tooltip> |
176 | <!-- </span> --> | 182 | <!-- </span> --> |
177 | </td> | 183 | </td> |
178 | </tr> | 184 | </tr> |
179 | </template> | 185 | </template> |
180 | <v-alert | 186 | <v-alert |
181 | slot="no-results" | 187 | slot="no-results" |
182 | :value="true" | 188 | :value="true" |
183 | color="error" | 189 | color="error" |
184 | icon="warning" | 190 | icon="warning" |
185 | >Your search for "{{ search }}" found no results.</v-alert> | 191 | >Your search for "{{ search }}" found no results.</v-alert> |
186 | </v-data-table> | 192 | </v-data-table> |
187 | 193 | ||
188 | <!-- ****** ADD Fee Type ****** --> | 194 | <!-- ****** ADD Fee Type ****** --> |
189 | <v-dialog v-model="addFeeTypeDialog" max-width="500px"> | 195 | <v-dialog v-model="addFeeTypeDialog" max-width="500px" v-if="addFeeTypeDialog"> |
190 | <v-card flat class="card-style pa-2" dark> | 196 | <v-card flat class="card-style pa-2" dark> |
191 | <v-layout> | 197 | <v-layout> |
192 | <v-flex xs12> | 198 | <v-flex xs12> |
193 | <label class="title text-xs-center">Add Fee Type</label> | 199 | <label class="title text-xs-center">Add Fee Type</label> |
194 | <v-icon size="24" class="right" @click="addFeeTypeDialog = false">cancel</v-icon> | 200 | <v-icon size="24" class="right" @click="closeAddFeeTypeModel">cancel</v-icon> |
195 | </v-flex> | 201 | </v-flex> |
196 | </v-layout> | 202 | </v-layout> |
197 | <v-container fluid fill-height> | 203 | <v-container fluid fill-height> |
198 | <v-layout align-center> | 204 | <v-layout align-center> |
199 | <v-flex xs12 class="mt-4"> | 205 | <v-flex xs12 class="mt-4"> |
200 | <v-form ref="form" v-model="valid" lazy-validation> | 206 | <v-form ref="form" v-model="valid" lazy-validation> |
201 | <v-layout> | 207 | <v-layout> |
202 | <v-flex xs4 class="pt-4 subheading"> | 208 | <v-flex xs4 class="pt-4 subheading"> |
203 | <label class="right">Fee Type:</label> | 209 | <label class="right">Fee Type:</label> |
204 | </v-flex> | 210 | </v-flex> |
205 | <v-flex xs7 class="ml-3"> | 211 | <v-flex xs7 class="ml-3"> |
206 | <v-text-field | 212 | <v-text-field |
207 | v-model="feeTypeData.feeType" | 213 | v-model="feeTypeData.feeType" |
208 | placeholder="fill your Fee Type" | 214 | placeholder="fill your Fee Type" |
209 | type="text" | 215 | type="text" |
210 | :rules="feetTypeRules" | 216 | :rules="feetTypeRules" |
211 | required | 217 | required |
212 | ></v-text-field> | 218 | ></v-text-field> |
213 | </v-flex> | 219 | </v-flex> |
214 | </v-layout> | 220 | </v-layout> |
215 | <v-layout> | 221 | <v-layout> |
216 | <v-flex xs4 class="pt-4 subheading"> | 222 | <v-flex xs4 class="pt-4 subheading"> |
217 | <label class="right">Note:</label> | 223 | <label class="right">Note:</label> |
218 | </v-flex> | 224 | </v-flex> |
219 | <v-flex xs7 class="ml-3"> | 225 | <v-flex xs7 class="ml-3"> |
220 | <v-textarea | 226 | <v-textarea |
221 | name="input-7-1" | 227 | name="input-7-1" |
222 | v-model="feeTypeData.note" | 228 | v-model="feeTypeData.note" |
223 | placeholder="fill your Note" | 229 | placeholder="fill your Note" |
224 | type="text" | 230 | type="text" |
225 | multi-line | 231 | multi-line |
226 | required | 232 | required |
227 | ></v-textarea> | 233 | ></v-textarea> |
228 | </v-flex> | 234 | </v-flex> |
229 | </v-layout> | 235 | </v-layout> |
230 | <!-- <v-layout> | 236 | <!-- <v-layout> |
231 | <v-flex xs4 class="pt-4 subheading"> | 237 | <v-flex xs4 class="pt-4 subheading"> |
232 | <label class="right">Monthly:</label> | 238 | <label class="right">Monthly:</label> |
233 | </v-flex> | 239 | </v-flex> |
234 | <v-flex xs6 class="ml-3"> | 240 | <v-flex xs6 class="ml-3"> |
235 | <v-checkbox | 241 | <v-checkbox |
236 | v-model="feeTypeData.monthly" | 242 | v-model="feeTypeData.monthly" |
237 | :rules="monthlyRules" | 243 | :rules="monthlyRules" |
238 | multi-line | 244 | multi-line |
239 | required | 245 | required |
240 | ></v-checkbox> | 246 | ></v-checkbox> |
241 | </v-flex> | 247 | </v-flex> |
242 | </v-layout>--> | 248 | </v-layout>--> |
243 | <v-layout> | 249 | <v-layout> |
244 | <v-flex xs12> | 250 | <v-flex xs12> |
245 | <v-card-actions> | 251 | <v-card-actions> |
246 | <v-spacer></v-spacer> | 252 | <v-spacer></v-spacer> |
247 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 253 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
248 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 254 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
249 | </v-card-actions> | 255 | </v-card-actions> |
250 | </v-flex> | 256 | </v-flex> |
251 | </v-layout> | 257 | </v-layout> |
252 | </v-form> | 258 | </v-form> |
253 | </v-flex> | 259 | </v-flex> |
254 | </v-layout> | 260 | </v-layout> |
255 | </v-container> | 261 | </v-container> |
256 | </v-card> | 262 | </v-card> |
257 | </v-dialog> | 263 | </v-dialog> |
258 | <div class="loader" v-if="showLoader"> | 264 | <div class="loader" v-if="showLoader"> |
259 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 265 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
260 | </div> | 266 | </div> |
261 | <v-snackbar | 267 | <v-snackbar |
262 | :timeout="timeout" | 268 | :timeout="timeout" |
263 | :top="y === 'top'" | 269 | :top="y === 'top'" |
264 | :right="x === 'right'" | 270 | :right="x === 'right'" |
265 | :vertical="mode === 'vertical'" | 271 | :vertical="mode === 'vertical'" |
266 | v-model="snackbar" | 272 | v-model="snackbar" |
267 | :color="color" | 273 | :color="color" |
268 | >{{ text }}</v-snackbar> | 274 | >{{ text }}</v-snackbar> |
269 | </v-container> | 275 | </v-container> |
270 | </template> | 276 | </template> |
271 | 277 | ||
272 | <script> | 278 | <script> |
273 | import http from "@/Services/http.js"; | 279 | import http from "@/Services/http.js"; |
274 | 280 | ||
275 | export default { | 281 | export default { |
276 | data: () => ({ | 282 | data: () => ({ |
277 | snackbar: false, | 283 | snackbar: false, |
278 | y: "top", | 284 | y: "top", |
279 | x: "right", | 285 | x: "right", |
280 | mode: "", | 286 | mode: "", |
281 | timeout: 5000, | 287 | timeout: 5000, |
282 | text: "", | 288 | text: "", |
283 | color: "", | 289 | color: "", |
284 | showLoader: false, | 290 | showLoader: false, |
285 | loading: false, | 291 | loading: false, |
286 | date: null, | 292 | date: null, |
287 | search: "", | 293 | search: "", |
288 | editFeeTypeDialog: false, | 294 | editFeeTypeDialog: false, |
289 | viewFeeTypeDialog: false, | 295 | viewFeeTypeDialog: false, |
290 | valid: true, | 296 | valid: true, |
291 | show: true, | 297 | show: true, |
292 | showSearch: false, | 298 | showSearch: false, |
293 | addFeeTypeDialog: false, | 299 | addFeeTypeDialog: false, |
294 | validEdit: true, | 300 | validEdit: true, |
295 | pagination: { | 301 | pagination: { |
296 | rowsPerPage: 10 | 302 | rowsPerPage: 10, |
297 | }, | 303 | }, |
298 | feetTypeRules: [v => !!v || " Fee Type Name is required"], | 304 | feetTypeRules: [(v) => !!v || " Fee Type Name is required"], |
299 | monthlyRules: [v => !!v || " Select Monthly"], | 305 | monthlyRules: [(v) => !!v || " Select Monthly"], |
300 | noteRules: [v => !!v || " Note is required"], | 306 | noteRules: [(v) => !!v || " Note is required"], |
301 | headers: [ | 307 | headers: [ |
302 | { | 308 | { |
303 | text: "No", | 309 | text: "No", |
304 | align: "", | 310 | align: "", |
305 | sortable: false, | 311 | sortable: false, |
306 | value: "No" | 312 | value: "No", |
307 | }, | 313 | }, |
308 | { | 314 | { |
309 | text: "fee Type", | 315 | text: "fee Type", |
310 | value: "feeType", | 316 | value: "feeType", |
311 | sortable: false, | 317 | sortable: false, |
312 | align: "center" | 318 | align: "center", |
313 | }, | 319 | }, |
314 | { text: "Note", value: "note", sortable: false, align: "center" }, | 320 | { text: "Note", value: "note", sortable: false, align: "center" }, |
315 | // { text: "Session", value: "session", sortable: false, align: "center" }, | 321 | // { text: "Session", value: "session", sortable: false, align: "center" }, |
316 | { text: "Action", value: "", sortable: false, align: "center" } | 322 | { text: "Action", value: "", sortable: false, align: "center" }, |
317 | ], | 323 | ], |
318 | feeTypeList: [], | 324 | feeTypeList: [], |
319 | select: "", | 325 | select: "", |
320 | token: "", | 326 | token: "", |
321 | editedItem: {}, | 327 | editedItem: {}, |
322 | feeTypeData: {} | 328 | feeTypeData: {}, |
323 | }), | 329 | }), |
330 | watch: { | ||
331 | addFeeTypeDialog: function (val) { | ||
332 | if (!val) { | ||
333 | this.feeTypeData = []; | ||
334 | } | ||
335 | }, | ||
336 | }, | ||
324 | methods: { | 337 | methods: { |
325 | getFeeTypeList() { | 338 | getFeeTypeList() { |
326 | this.showLoader = true; | 339 | this.showLoader = true; |
327 | http() | 340 | http() |
328 | .get("/getFeesList", { | 341 | .get("/getFeesList", { |
329 | params: { schoolId: this.$store.state.schoolId }, | 342 | params: { schoolId: this.$store.state.schoolId }, |
330 | headers: { Authorization: "Bearer " + this.token } | 343 | headers: { Authorization: "Bearer " + this.token }, |
331 | }) | 344 | }) |
332 | .then(response => { | 345 | .then((response) => { |
333 | this.feeTypeList = response.data.data; | 346 | this.feeTypeList = response.data.data; |
334 | this.showLoader = false; | 347 | this.showLoader = false; |
335 | }) | 348 | }) |
336 | .catch(error => { | 349 | .catch((error) => { |
337 | this.showLoader = false; | 350 | this.showLoader = false; |
338 | if (error.response.status === 401) { | 351 | if (error.response.status === 401) { |
339 | this.$router.replace({ path: "/" }); | 352 | this.$router.replace({ path: "/" }); |
340 | this.$store.dispatch("setToken", null); | 353 | this.$store.dispatch("setToken", null); |
341 | this.$store.dispatch("Id", null); | 354 | this.$store.dispatch("Id", null); |
342 | this.$store.dispatch("Role", null); | 355 | this.$store.dispatch("Role", null); |
343 | } | 356 | } |
344 | }); | 357 | }); |
345 | }, | 358 | }, |
346 | editItem(item) { | 359 | editItem(item) { |
347 | this.editedIndex = this.feeTypeList.indexOf(item); | 360 | this.editedIndex = this.feeTypeList.indexOf(item); |
348 | this.editedItem = Object.assign({}, item); | 361 | this.editedItem = Object.assign({}, item); |
349 | this.editFeeTypeDialog = true; | 362 | this.editFeeTypeDialog = true; |
350 | }, | 363 | }, |
351 | profile(item) { | 364 | profile(item) { |
352 | this.editedIndex = this.feeTypeList.indexOf(item); | 365 | this.editedIndex = this.feeTypeList.indexOf(item); |
353 | this.editedItem = Object.assign({}, item); | 366 | this.editedItem = Object.assign({}, item); |
354 | this.viewFeeTypeDialog = true; | 367 | this.viewFeeTypeDialog = true; |
355 | }, | 368 | }, |
356 | deleteItem(item) { | 369 | deleteItem(item) { |
357 | let deleteFeeType = { | 370 | let deleteFeeType = { |
358 | feeId: item._id | 371 | feeId: item._id, |
359 | }; | 372 | }; |
360 | http() | 373 | http() |
361 | .delete( | 374 | .delete( |
362 | "/deleteFee", | 375 | "/deleteFee", |
363 | confirm("Are you sure you want to delete this?") && { | 376 | confirm("Are you sure you want to delete this?") && { |
364 | params: deleteFeeType | 377 | params: deleteFeeType, |
365 | } | 378 | } |
366 | ) | 379 | ) |
367 | .then(response => { | 380 | .then((response) => { |
368 | this.snackbar = true; | 381 | this.snackbar = true; |
369 | this.text = response.data.message; | 382 | this.text = response.data.message; |
370 | this.color = "green"; | 383 | this.color = "green"; |
371 | this.getFeeTypeList(); | 384 | this.getFeeTypeList(); |
372 | }) | 385 | }) |
373 | .catch(error => { | 386 | .catch((error) => { |
374 | this.snackbar = true; | 387 | this.snackbar = true; |
375 | this.color = "error"; | 388 | this.color = "error"; |
376 | this.text = error.response.data.message; | 389 | this.text = error.response.data.message; |
377 | }); | 390 | }); |
378 | }, | 391 | }, |
379 | close() { | 392 | close() { |
380 | this.dialog = false; | 393 | this.dialog = false; |
381 | }, | 394 | }, |
382 | close1() { | 395 | close1() { |
383 | this.dialog1 = false; | 396 | this.dialog1 = false; |
384 | }, | 397 | }, |
385 | close2() { | 398 | close2() { |
386 | this.dialog2 = false; | 399 | this.dialog2 = false; |
387 | }, | 400 | }, |
401 | closeAddFeeTypeModel() { | ||
402 | this.addFeeTypeDialog = false; | ||
403 | this.feeTypeData = []; | ||
404 | }, | ||
388 | submit() { | 405 | submit() { |
389 | if (this.$refs.form.validate()) { | 406 | if (this.$refs.form.validate()) { |
390 | this.loading = true; | 407 | this.loading = true; |
391 | this.schoolId = this.$store.state.schoolId; | 408 | this.schoolId = this.$store.state.schoolId; |
392 | http() | 409 | http() |
393 | .post("/createFee", this.feeTypeData) | 410 | .post("/createFee", this.feeTypeData) |
394 | .then(response => { | 411 | .then((response) => { |
395 | this.getFeeTypeList(); | 412 | this.getFeeTypeList(); |
396 | this.snackbar = true; | 413 | this.snackbar = true; |
397 | this.text = response.data.message; | 414 | this.text = response.data.message; |
398 | this.color = "green"; | 415 | this.color = "green"; |
399 | this.clear(); | 416 | this.clear(); |
400 | this.addFeeTypeDialog = false; | 417 | this.addFeeTypeDialog = false; |
401 | this.loading = false; | 418 | this.loading = false; |
402 | }) | 419 | }) |
403 | .catch(error => { | 420 | .catch((error) => { |
404 | // console.log(error); | 421 | // console.log(error); |
405 | this.snackbar = true; | 422 | this.snackbar = true; |
406 | this.color = "error"; | 423 | this.color = "error"; |
407 | this.text = error.response.data.message; | 424 | this.text = error.response.data.message; |
408 | this.loading = false; | 425 | this.loading = false; |
409 | }); | 426 | }); |
410 | } | 427 | } |
411 | }, | 428 | }, |
412 | clear() { | 429 | clear() { |
413 | this.$refs.form.reset(); | 430 | this.$refs.form.reset(); |
414 | }, | 431 | }, |
415 | save() { | 432 | save() { |
416 | this.editedItem.feeId = this.editedItem._id; | 433 | this.editedItem.feeId = this.editedItem._id; |
417 | http() | 434 | http() |
418 | .put("/updateFee", this.editedItem) | 435 | .put("/updateFee", this.editedItem) |
419 | .then(response => { | 436 | .then((response) => { |
420 | this.snackbar = true; | 437 | this.snackbar = true; |
421 | this.text = response.data.message; | 438 | this.text = response.data.message; |
422 | this.color = "green"; | 439 | this.color = "green"; |
423 | this.getFeeTypeList(); | 440 | this.getFeeTypeList(); |
424 | this.editFeeTypeDialog = false; | 441 | this.editFeeTypeDialog = false; |
425 | this.close(); | 442 | this.close(); |
426 | }) | 443 | }) |
427 | .catch(error => { | 444 | .catch((error) => { |
428 | this.snackbar = true; | 445 | this.snackbar = true; |
429 | this.color = "error"; | 446 | this.color = "error"; |
430 | this.text = error.response.data.message; | 447 | this.text = error.response.data.message; |
431 | }); | 448 | }); |
432 | }, | 449 | }, |
433 | displaySearch() { | 450 | displaySearch() { |
434 | (this.show = false), (this.showSearch = true); | 451 | (this.show = false), (this.showSearch = true); |
435 | }, | 452 | }, |
436 | closeSearch() { | 453 | closeSearch() { |
437 | this.showSearch = false; | 454 | this.showSearch = false; |
438 | this.show = true; | 455 | this.show = true; |
439 | this.search = ""; | 456 | this.search = ""; |
440 | } | 457 | }, |
441 | }, | 458 | }, |
442 | mounted() { | 459 | mounted() { |
443 | this.token = this.$store.state.token; | 460 | this.token = this.$store.state.token; |
444 | this.getFeeTypeList(); | 461 | this.getFeeTypeList(); |
445 | } | 462 | }, |
446 | }; | 463 | }; |
447 | </script> | 464 | </script> |
src/pages/Account/income.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT Income DETAILS ****** --> | 3 | <!-- ****** EDIT Income DETAILS ****** --> |
4 | <v-dialog v-model="editIncomeDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editIncomeDialog" max-width="600px" 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 Income</label> | 8 | <label class="title text-xs-center">Edit Income</label> |
9 | <v-icon size="24" class="right" @click="editIncomeDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editIncomeDialog = 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-layout> | 13 | <v-layout> |
14 | <v-flex | 14 | <v-flex |
15 | xs12 | 15 | xs12 |
16 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" | 16 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" |
17 | > | 17 | > |
18 | <v-avatar size="160px"> | 18 | <v-avatar size="160px"> |
19 | <img src="/static/icon/user.png" v-if="!editedItem.fileUrl && !imageUrl" /> | 19 | <img src="/static/icon/user.png" v-if="!editedItem.fileUrl && !imageUrl" /> |
20 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl && !imageUrl" /> | 20 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl && !imageUrl" /> |
21 | <img | 21 | <img |
22 | v-if="imageUrl" | 22 | v-if="imageUrl" |
23 | :src="imageUrl" | 23 | :src="imageUrl" |
24 | height="150" | 24 | height="150" |
25 | style="border-radius:50%; width:200px" | 25 | style="border-radius:50%; width:200px" |
26 | /> | 26 | /> |
27 | </v-avatar> | 27 | </v-avatar> |
28 | <input | 28 | <input |
29 | type="file" | 29 | type="file" |
30 | style="display:none" | 30 | style="display:none" |
31 | ref="image" | 31 | ref="image" |
32 | accept="image/*" | 32 | accept="image/*" |
33 | @change="onFilePicked" | 33 | @change="onFilePicked" |
34 | /> | 34 | /> |
35 | </v-flex> | 35 | </v-flex> |
36 | </v-layout> | 36 | </v-layout> |
37 | <v-layout wrap> | 37 | <v-layout wrap> |
38 | <v-flex xs12 sm12> | 38 | <v-flex xs12 sm12> |
39 | <v-layout> | 39 | <v-layout> |
40 | <v-flex xs4 class="pt-4 subheading"> | 40 | <v-flex xs4 class="pt-4 subheading"> |
41 | <label class="right">Name:</label> | 41 | <label class="right">Name:</label> |
42 | </v-flex> | 42 | </v-flex> |
43 | <v-flex xs8 sm6 class="ml-3"> | 43 | <v-flex xs8 sm6 class="ml-3"> |
44 | <v-text-field | 44 | <v-text-field |
45 | v-model="editedItem.name" | 45 | v-model="editedItem.name" |
46 | placeholder="fill your full Name" | 46 | placeholder="fill your full Name" |
47 | name="name" | 47 | name="name" |
48 | type="text" | 48 | type="text" |
49 | required | 49 | required |
50 | ></v-text-field> | 50 | ></v-text-field> |
51 | </v-flex> | 51 | </v-flex> |
52 | </v-layout> | 52 | </v-layout> |
53 | </v-flex> | 53 | </v-flex> |
54 | </v-layout> | 54 | </v-layout> |
55 | <v-layout wrap> | 55 | <v-layout wrap> |
56 | <v-flex xs12> | 56 | <v-flex xs12> |
57 | <v-layout> | 57 | <v-layout> |
58 | <v-flex xs4 class="pt-4 subheading"> | 58 | <v-flex xs4 class="pt-4 subheading"> |
59 | <label class="right">Date:</label> | 59 | <label class="right">Date:</label> |
60 | </v-flex> | 60 | </v-flex> |
61 | <v-flex xs8 sm6 class="ml-3"> | 61 | <v-flex xs8 sm6 class="ml-3"> |
62 | <v-menu | 62 | <v-menu |
63 | ref="menu" | 63 | ref="menu" |
64 | :close-on-content-click="false" | 64 | :close-on-content-click="false" |
65 | v-model="menu3" | 65 | v-model="menu3" |
66 | :nudge-right="40" | 66 | :nudge-right="40" |
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 | min-width="290px" | 71 | min-width="290px" |
72 | > | 72 | > |
73 | <v-text-field | 73 | <v-text-field |
74 | slot="activator" | 74 | slot="activator" |
75 | v-model="editedItem.date" | 75 | v-model="editedItem.date" |
76 | placeholder="Select date" | 76 | placeholder="Select date" |
77 | ></v-text-field> | 77 | ></v-text-field> |
78 | <v-date-picker | 78 | <v-date-picker |
79 | ref="picker" | 79 | ref="picker" |
80 | v-model="editedItem.date" | 80 | v-model="editedItem.date" |
81 | @input="$refs.menu.save(editedItem.date)" | 81 | @input="$refs.menu.save(editedItem.date)" |
82 | ></v-date-picker> | 82 | ></v-date-picker> |
83 | </v-menu> | 83 | </v-menu> |
84 | </v-flex> | 84 | </v-flex> |
85 | </v-layout> | 85 | </v-layout> |
86 | </v-flex> | 86 | </v-flex> |
87 | <v-layout wrap> | 87 | <v-layout wrap> |
88 | <v-flex xs12 sm12> | 88 | <v-flex xs12 sm12> |
89 | <v-layout> | 89 | <v-layout> |
90 | <v-flex xs4 class="pt-4 subheading"> | 90 | <v-flex xs4 class="pt-4 subheading"> |
91 | <label class="right">Amount:</label> | 91 | <label class="right">Amount:</label> |
92 | </v-flex> | 92 | </v-flex> |
93 | <v-flex xs8 sm6 class="ml-3"> | 93 | <v-flex xs8 sm6 class="ml-3"> |
94 | <v-text-field v-model="editedItem.amount" required></v-text-field> | 94 | <v-text-field v-model="editedItem.amount" required></v-text-field> |
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> | 99 | <v-flex xs12> |
100 | <v-layout> | 100 | <v-layout> |
101 | <v-flex xs4 class="pt-4 subheading"> | 101 | <v-flex xs4 class="pt-4 subheading"> |
102 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 102 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
103 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> | 103 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> |
104 | </v-flex> | 104 | </v-flex> |
105 | <v-flex xs8 sm6 class="ml-3"> | 105 | <v-flex xs8 sm6 class="ml-3"> |
106 | <v-text-field | 106 | <v-text-field |
107 | label="Select Image" | 107 | label="Select Image" |
108 | @click="pickFile" | 108 | @click="pickFile" |
109 | v-model="imageName" | 109 | v-model="imageName" |
110 | append-icon="attach_file" | 110 | append-icon="attach_file" |
111 | ></v-text-field> | 111 | ></v-text-field> |
112 | </v-flex> | 112 | </v-flex> |
113 | </v-layout> | 113 | </v-layout> |
114 | </v-flex> | 114 | </v-flex> |
115 | <v-flex xs12> | 115 | <v-flex xs12> |
116 | <v-layout> | 116 | <v-layout> |
117 | <v-flex xs4 class="pt-4 subheading"> | 117 | <v-flex xs4 class="pt-4 subheading"> |
118 | <label class="right">Note:</label> | 118 | <label class="right">Note:</label> |
119 | </v-flex> | 119 | </v-flex> |
120 | <v-flex xs8 sm6 class="ml-3"> | 120 | <v-flex xs8 sm6 class="ml-3"> |
121 | <v-textarea | 121 | <v-textarea |
122 | name="input-7-1" | 122 | name="input-7-1" |
123 | v-model="editedItem.note" | 123 | v-model="editedItem.note" |
124 | placeholder="fill your Note" | 124 | placeholder="fill your Note" |
125 | type="text" | 125 | type="text" |
126 | :rules="noteRules" | 126 | :rules="noteRules" |
127 | multi-line | 127 | multi-line |
128 | required | 128 | required |
129 | ></v-textarea> | 129 | ></v-textarea> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | </v-flex> | 132 | </v-flex> |
133 | </v-layout> | 133 | </v-layout> |
134 | <v-layout> | 134 | <v-layout> |
135 | <v-flex xs12 > | 135 | <v-flex xs12> |
136 | <v-card-actions> | 136 | <v-card-actions> |
137 | <v-spacer></v-spacer> | 137 | <v-spacer></v-spacer> |
138 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> | 138 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> |
139 | <v-spacer></v-spacer> | 139 | <v-spacer></v-spacer> |
140 | </v-card-actions> | 140 | </v-card-actions> |
141 | </v-flex> | 141 | </v-flex> |
142 | </v-layout> | 142 | </v-layout> |
143 | </v-card-text> | 143 | </v-card-text> |
144 | </v-card> | 144 | </v-card> |
145 | </v-dialog> | 145 | </v-dialog> |
146 | 146 | ||
147 | <!-- ****** PROFILE VIEW INCOME DETAILS ****** --> | 147 | <!-- ****** PROFILE VIEW INCOME DETAILS ****** --> |
148 | <v-dialog v-model="profileIncomeDialog" max-width="400px"> | 148 | <v-dialog v-model="profileIncomeDialog" max-width="400px"> |
149 | <v-card flat class="card-style pa-3" dark> | 149 | <v-card flat class="card-style pa-3" dark> |
150 | <v-layout> | 150 | <v-layout> |
151 | <v-flex xs12> | 151 | <v-flex xs12> |
152 | <label class="title text-xs-center">View Income</label> | 152 | <label class="title text-xs-center">View Income</label> |
153 | <v-icon size="24" class="right" @click="profileIncomeDialog = false">cancel</v-icon> | 153 | <v-icon size="24" class="right" @click="profileIncomeDialog = false">cancel</v-icon> |
154 | </v-flex> | 154 | </v-flex> |
155 | </v-layout> | 155 | </v-layout> |
156 | <v-card-text> | 156 | <v-card-text> |
157 | <v-container grid-list-md> | 157 | <v-container grid-list-md> |
158 | <v-layout wrap> | 158 | <v-layout wrap> |
159 | <v-flex> | 159 | <v-flex> |
160 | <v-flex align-center justify-center layout text-xs-center> | 160 | <v-flex align-center justify-center layout text-xs-center> |
161 | <v-avatar size="80px" v-if="!editedItem.fileUrl"> | 161 | <v-avatar size="80px" v-if="!editedItem.fileUrl"> |
162 | <img src="/static/icon/user.png" /> | 162 | <img src="/static/icon/user.png" /> |
163 | </v-avatar> | 163 | </v-avatar> |
164 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" width="150" /> | 164 | <img :src="editedItem.fileUrl" v-else-if="editedItem.fileUrl" width="150" /> |
165 | </v-flex> | 165 | </v-flex> |
166 | <v-layout> | 166 | <v-layout> |
167 | <v-flex xs5 sm6> | 167 | <v-flex xs5 sm6> |
168 | <h5 class="right my-1"> | 168 | <h5 class="right my-1"> |
169 | <b>Name:</b> | 169 | <b>Name:</b> |
170 | </h5> | 170 | </h5> |
171 | </v-flex> | 171 | </v-flex> |
172 | <v-flex sm6 xs8> | 172 | <v-flex sm6 xs8> |
173 | <h5 class="my-1">{{ editedItem.name }}</h5> | 173 | <h5 class="my-1">{{ editedItem.name }}</h5> |
174 | </v-flex> | 174 | </v-flex> |
175 | </v-layout> | 175 | </v-layout> |
176 | <v-layout> | 176 | <v-layout> |
177 | <v-flex xs5 sm6> | 177 | <v-flex xs5 sm6> |
178 | <h5 class="right my-1"> | 178 | <h5 class="right my-1"> |
179 | <b>Amount:</b> | 179 | <b>Amount:</b> |
180 | </h5> | 180 | </h5> |
181 | </v-flex> | 181 | </v-flex> |
182 | <v-flex sm6 xs8> | 182 | <v-flex sm6 xs8> |
183 | <h5 class="my-1">{{ editedItem.amount }}</h5> | 183 | <h5 class="my-1">{{ editedItem.amount }}</h5> |
184 | </v-flex> | 184 | </v-flex> |
185 | </v-layout> | 185 | </v-layout> |
186 | <v-layout> | 186 | <v-layout> |
187 | <v-flex xs5 sm6> | 187 | <v-flex xs5 sm6> |
188 | <h5 class="right my-1"> | 188 | <h5 class="right my-1"> |
189 | <b>Date:</b> | 189 | <b>Date:</b> |
190 | </h5> | 190 | </h5> |
191 | </v-flex> | 191 | </v-flex> |
192 | <v-flex sm6 xs8> | 192 | <v-flex sm6 xs8> |
193 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> | 193 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> |
194 | </v-flex> | 194 | </v-flex> |
195 | </v-layout> | 195 | </v-layout> |
196 | <v-layout> | 196 | <v-layout> |
197 | <v-flex xs5 sm6> | 197 | <v-flex xs5 sm6> |
198 | <h5 class="right my-1"> | 198 | <h5 class="right my-1"> |
199 | <b>Note:</b> | 199 | <b>Note:</b> |
200 | </h5> | 200 | </h5> |
201 | </v-flex> | 201 | </v-flex> |
202 | <v-flex sm6 xs8> | 202 | <v-flex sm6 xs8> |
203 | <h5 class="my-1">{{ editedItem.note }}</h5> | 203 | <h5 class="my-1">{{ editedItem.note }}</h5> |
204 | </v-flex> | 204 | </v-flex> |
205 | </v-layout> | 205 | </v-layout> |
206 | </v-flex> | 206 | </v-flex> |
207 | </v-layout> | 207 | </v-layout> |
208 | </v-container> | 208 | </v-container> |
209 | </v-card-text> | 209 | </v-card-text> |
210 | </v-card> | 210 | </v-card> |
211 | </v-dialog> | 211 | </v-dialog> |
212 | <!-- ****** EXISTING-EXPENSE TABLE DATA****** --> | 212 | <!-- ****** EXISTING-EXPENSE TABLE DATA****** --> |
213 | 213 | ||
214 | <v-toolbar color="transparent" flat> | 214 | <v-toolbar color="transparent" flat> |
215 | <v-btn | 215 | <v-btn |
216 | fab | 216 | fab |
217 | dark | 217 | dark |
218 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 218 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
219 | small | 219 | small |
220 | @click="addIncomeDialog = true" | 220 | @click="addIncomeDialog = true" |
221 | > | 221 | > |
222 | <v-icon dark>add</v-icon> | 222 | <v-icon dark>add</v-icon> |
223 | </v-btn> | 223 | </v-btn> |
224 | <v-btn | 224 | <v-btn |
225 | round | 225 | round |
226 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 226 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
227 | dark | 227 | dark |
228 | @click="addIncomeDialog = true" | 228 | @click="addIncomeDialog = true" |
229 | > | 229 | > |
230 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Income | 230 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Income |
231 | </v-btn> | 231 | </v-btn> |
232 | <v-spacer></v-spacer> | 232 | <v-spacer></v-spacer> |
233 | <v-card-title class="body-1" v-show="show"> | 233 | <v-card-title class="body-1" v-show="show"> |
234 | <v-btn icon large flat @click="displaySearch"> | 234 | <v-btn icon large flat @click="displaySearch"> |
235 | <v-avatar size="27"> | 235 | <v-avatar size="27"> |
236 | <img src="/static/icon/search.png" alt="icon" /> | 236 | <img src="/static/icon/search.png" alt="icon" /> |
237 | </v-avatar> | 237 | </v-avatar> |
238 | </v-btn> | 238 | </v-btn> |
239 | </v-card-title> | 239 | </v-card-title> |
240 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 240 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
241 | <v-layout> | 241 | <v-layout> |
242 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 242 | <v-text-field |
243 | autofocus | ||
244 | v-model="search" | ||
245 | label="Search" | ||
246 | prepend-inner-icon="search" | ||
247 | color="primary" | ||
248 | ></v-text-field> | ||
243 | <v-icon @click="closeSearch" color="error">close</v-icon> | 249 | <v-icon @click="closeSearch" color="error">close</v-icon> |
244 | </v-layout> | 250 | </v-layout> |
245 | </v-flex> | 251 | </v-flex> |
246 | </v-toolbar> | 252 | </v-toolbar> |
247 | <v-data-table | 253 | <v-data-table |
248 | :headers="headers" | 254 | :headers="headers" |
249 | :items="incomeList" | 255 | :items="incomeList" |
250 | :pagination.sync="pagination" | 256 | :pagination.sync="pagination" |
251 | :search="search" | 257 | :search="search" |
252 | > | 258 | > |
253 | <template slot="items" slot-scope="props"> | 259 | <template slot="items" slot-scope="props"> |
254 | <tr class="tr"> | 260 | <tr class="tr"> |
255 | <td class="text-xs-center td td-row">{{ props.index + 1}}</td> | 261 | <td class="text-xs-center td td-row">{{ props.index + 1}}</td> |
256 | <td class="text-xs-center td td-row"> | 262 | <td class="text-xs-center td td-row"> |
257 | <v-avatar class="40"> | 263 | <v-avatar class="40"> |
258 | <img :src="props.item.fileUrl" v-if="props.item.fileUrl" /> | 264 | <img :src="props.item.fileUrl" v-if="props.item.fileUrl" /> |
259 | <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" /> | 265 | <img src="/static/icon/user.png" v-else-if="!props.item.fileUrl" /> |
260 | </v-avatar> | 266 | </v-avatar> |
261 | </td> | 267 | </td> |
262 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 268 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
263 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> | 269 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> |
264 | <td class="text-xs-center td td-row">{{ props.item.user }}</td> | 270 | <td class="text-xs-center td td-row">{{ props.item.user }}</td> |
265 | <td class="text-xs-center td td-row">{{ props.item.amount }}</td> | 271 | <td class="text-xs-center td td-row">{{ props.item.amount }}</td> |
266 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> | 272 | <td class="text-xs-center td td-row">{{ props.item.note }}</td> |
267 | <td class="text-xs-center td td-row"> | 273 | <td class="text-xs-center td td-row"> |
268 | <span> | 274 | <span> |
269 | <v-tooltip top> | 275 | <v-tooltip top> |
270 | <img | 276 | <img |
271 | slot="activator" | 277 | slot="activator" |
272 | style="cursor:pointer; width:25px; height:25px; " | 278 | style="cursor:pointer; width:25px; height:25px; " |
273 | class="mr-3" | 279 | class="mr-3" |
274 | @click="profile(props.item)" | 280 | @click="profile(props.item)" |
275 | src="/static/icon/view.png" | 281 | src="/static/icon/view.png" |
276 | /> | 282 | /> |
277 | <span>View</span> | 283 | <span>View</span> |
278 | </v-tooltip> | 284 | </v-tooltip> |
279 | <v-tooltip top> | 285 | <v-tooltip top> |
280 | <img | 286 | <img |
281 | slot="activator" | 287 | slot="activator" |
282 | style="cursor:pointer; width:20px; height:18px; " | 288 | style="cursor:pointer; width:20px; height:18px; " |
283 | class="mr-3" | 289 | class="mr-3" |
284 | @click="editItem(props.item)" | 290 | @click="editItem(props.item)" |
285 | src="/static/icon/edit.png" | 291 | src="/static/icon/edit.png" |
286 | /> | 292 | /> |
287 | <span>Edit</span> | 293 | <span>Edit</span> |
288 | </v-tooltip> | 294 | </v-tooltip> |
289 | <v-tooltip top> | 295 | <v-tooltip top> |
290 | <img | 296 | <img |
291 | slot="activator" | 297 | slot="activator" |
292 | style="cursor:pointer; width:20px; height:20px; " | 298 | style="cursor:pointer; width:20px; height:20px; " |
293 | @click="deleteItem(props.item)" | 299 | @click="deleteItem(props.item)" |
294 | src="/static/icon/delete.png" | 300 | src="/static/icon/delete.png" |
295 | /> | 301 | /> |
296 | <span>Delete</span> | 302 | <span>Delete</span> |
297 | </v-tooltip> | 303 | </v-tooltip> |
298 | </span> | 304 | </span> |
299 | </td> | 305 | </td> |
300 | </tr> | 306 | </tr> |
301 | </template> | 307 | </template> |
302 | <v-alert | 308 | <v-alert |
303 | slot="no-results" | 309 | slot="no-results" |
304 | :value="true" | 310 | :value="true" |
305 | color="error" | 311 | color="error" |
306 | icon="warning" | 312 | icon="warning" |
307 | >Your search for "{{ search }}" found no results.</v-alert> | 313 | >Your search for "{{ search }}" found no results.</v-alert> |
308 | </v-data-table> | 314 | </v-data-table> |
309 | 315 | ||
310 | <!-- ****** Add Income Data****** --> | 316 | <!-- ****** Add Income Data****** --> |
311 | <v-dialog v-model="addIncomeDialog" max-width="600px"> | 317 | <v-dialog v-model="addIncomeDialog" max-width="600px" v-if="addIncomeDialog"> |
312 | <v-card flat class="card-style pa-2" dark> | 318 | <v-card flat class="card-style pa-2" dark> |
313 | <v-layout> | 319 | <v-layout> |
314 | <v-flex xs12> | 320 | <v-flex xs12> |
315 | <label class="title text-xs-center">Add Income</label> | 321 | <label class="title text-xs-center">Add Income</label> |
316 | <v-icon size="24" class="right" @click="addIncomeDialog = false">cancel</v-icon> | 322 | <v-icon size="24" class="right" @click="closeAddIncomeModel">cancel</v-icon> |
317 | </v-flex> | 323 | </v-flex> |
318 | </v-layout> | 324 | </v-layout> |
319 | <v-form ref="form" v-model="valid" lazy-validation> | 325 | <v-form ref="form" v-model="valid" lazy-validation> |
320 | <v-container fluid> | 326 | <v-container fluid> |
321 | <v-layout> | 327 | <v-layout> |
322 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 328 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
323 | <v-avatar size="80px"> | 329 | <v-avatar size="80px"> |
324 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 330 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
325 | </v-avatar> | 331 | </v-avatar> |
326 | <img | 332 | <img |
327 | :src="imageUrl" | 333 | :src="imageUrl" |
328 | height="150" | 334 | height="150" |
329 | v-if="imageUrl" | 335 | v-if="imageUrl" |
330 | style="border-radius:50%; width:200px" | 336 | style="border-radius:50%; width:200px" |
331 | /> | 337 | /> |
332 | </v-flex> | 338 | </v-flex> |
333 | </v-layout> | 339 | </v-layout> |
334 | <v-layout> | 340 | <v-layout> |
335 | <v-flex xs12 sm12> | 341 | <v-flex xs12 sm12> |
336 | <v-layout> | 342 | <v-layout> |
337 | <v-flex xs4 class="pt-4 subheading"> | 343 | <v-flex xs4 class="pt-4 subheading"> |
338 | <label class="right">Name:</label> | 344 | <label class="right">Name:</label> |
339 | </v-flex> | 345 | </v-flex> |
340 | <v-flex xs8 sm6 class="ml-3"> | 346 | <v-flex xs8 sm6 class="ml-3"> |
341 | <v-text-field | 347 | <v-text-field |
342 | v-model="addIncome.name" | 348 | v-model="addIncome.name" |
343 | placeholder="fill your full Name" | 349 | placeholder="fill your full Name" |
344 | name="name" | 350 | name="name" |
345 | type="text" | 351 | type="text" |
346 | :rules="nameRules" | 352 | :rules="nameRules" |
347 | required | 353 | required |
348 | ></v-text-field> | 354 | ></v-text-field> |
349 | </v-flex> | 355 | </v-flex> |
350 | </v-layout> | 356 | </v-layout> |
351 | </v-flex> | 357 | </v-flex> |
352 | </v-layout> | 358 | </v-layout> |
353 | <v-layout> | 359 | <v-layout> |
354 | <v-flex xs12 sm12> | 360 | <v-flex xs12 sm12> |
355 | <v-layout> | 361 | <v-layout> |
356 | <v-flex xs4 class="pt-4 subheading"> | 362 | <v-flex xs4 class="pt-4 subheading"> |
357 | <label class="right">Amount:</label> | 363 | <label class="right">Amount:</label> |
358 | </v-flex> | 364 | </v-flex> |
359 | <v-flex xs8 sm6 class="ml-3"> | 365 | <v-flex xs8 sm6 class="ml-3"> |
360 | <v-text-field | 366 | <v-text-field |
361 | v-model="addIncome.amount" | 367 | v-model="addIncome.amount" |
362 | placeholder="fill your Amount" | 368 | placeholder="fill your Amount" |
363 | name="name" | 369 | name="name" |
364 | type="text" | 370 | type="text" |
365 | :rules="amountRules" | 371 | :rules="amountRules" |
366 | required | 372 | required |
367 | ></v-text-field> | 373 | ></v-text-field> |
368 | </v-flex> | 374 | </v-flex> |
369 | </v-layout> | 375 | </v-layout> |
370 | </v-flex> | 376 | </v-flex> |
371 | </v-layout> | 377 | </v-layout> |
372 | <v-layout> | 378 | <v-layout> |
373 | <v-flex xs12 sm12> | 379 | <v-flex xs12 sm12> |
374 | <v-layout> | 380 | <v-layout> |
375 | <v-flex xs4 class="pt-4 subheading"> | 381 | <v-flex xs4 class="pt-4 subheading"> |
376 | <label class="right">Date</label> | 382 | <label class="right">Date</label> |
377 | </v-flex> | 383 | </v-flex> |
378 | <v-flex xs8 sm6 class="ml-3"> | 384 | <v-flex xs8 sm6 class="ml-3"> |
379 | <v-menu | 385 | <v-menu |
380 | ref="menu1" | 386 | ref="menu1" |
381 | :close-on-content-click="false" | 387 | :close-on-content-click="false" |
382 | v-model="menu1" | 388 | v-model="menu1" |
383 | :nudge-right="40" | 389 | :nudge-right="40" |
384 | lazy | 390 | lazy |
385 | transition="scale-transition" | 391 | transition="scale-transition" |
386 | offset-y | 392 | offset-y |
387 | full-width | 393 | full-width |
388 | min-width="290px" | 394 | min-width="290px" |
389 | > | 395 | > |
390 | <v-text-field | 396 | <v-text-field |
391 | slot="activator" | 397 | slot="activator" |
392 | :rules="joinDateRules" | 398 | :rules="joinDateRules" |
393 | v-model="addIncome.date" | 399 | v-model="addIncome.date" |
394 | placeholder="Select date" | 400 | placeholder="Select date" |
395 | ></v-text-field> | 401 | ></v-text-field> |
396 | <v-date-picker | 402 | <v-date-picker |
397 | ref="picker" | 403 | ref="picker" |
398 | v-model="addIncome.date" | 404 | v-model="addIncome.date" |
399 | @input="$refs.menu1.save(addIncome.date)" | 405 | @input="$refs.menu1.save(addIncome.date)" |
400 | ></v-date-picker> | 406 | ></v-date-picker> |
401 | </v-menu> | 407 | </v-menu> |
402 | </v-flex> | 408 | </v-flex> |
403 | </v-layout> | 409 | </v-layout> |
404 | </v-flex> | 410 | </v-flex> |
405 | </v-layout> | 411 | </v-layout> |
406 | <v-layout> | 412 | <v-layout> |
407 | <v-flex xs12 sm12> | 413 | <v-flex xs12 sm12> |
408 | <v-layout> | 414 | <v-layout> |
409 | <v-flex xs4 class="pt-4 subheading"> | 415 | <v-flex xs4 class="pt-4 subheading"> |
410 | <label class="right">File:</label> | 416 | <label class="right">File:</label> |
411 | </v-flex> | 417 | </v-flex> |
412 | <v-flex xs8 sm6 class="ml-3"> | 418 | <v-flex xs8 sm6 class="ml-3"> |
413 | <v-text-field | 419 | <v-text-field |
414 | label="Select file" | 420 | label="Select file" |
415 | @click="pickFile" | 421 | @click="pickFile" |
416 | v-model="imageName" | 422 | v-model="imageName" |
417 | append-icon="attach_file" | 423 | append-icon="attach_file" |
418 | ></v-text-field> | 424 | ></v-text-field> |
419 | <input | 425 | <input |
420 | type="file" | 426 | type="file" |
421 | style="display:none" | 427 | style="display:none" |
422 | ref="image" | 428 | ref="image" |
423 | accept="image/*" | 429 | accept="image/*" |
424 | @change="onFilePicked" | 430 | @change="onFilePicked" |
425 | /> | 431 | /> |
426 | </v-flex> | 432 | </v-flex> |
427 | </v-layout> | 433 | </v-layout> |
428 | </v-flex> | 434 | </v-flex> |
429 | </v-layout> | 435 | </v-layout> |
430 | <v-layout> | 436 | <v-layout> |
431 | <v-flex xs12 sm12> | 437 | <v-flex xs12 sm12> |
432 | <v-layout> | 438 | <v-layout> |
433 | <v-flex xs4 class="pt-4 subheading"> | 439 | <v-flex xs4 class="pt-4 subheading"> |
434 | <label class="right">Note:</label> | 440 | <label class="right">Note:</label> |
435 | </v-flex> | 441 | </v-flex> |
436 | <v-flex xs8 sm6 class="ml-3"> | 442 | <v-flex xs8 sm6 class="ml-3"> |
437 | <v-textarea | 443 | <v-textarea |
438 | name="input-7-1" | 444 | name="input-7-1" |
439 | v-model="addIncome.note" | 445 | v-model="addIncome.note" |
440 | placeholder="fill your Note" | 446 | placeholder="fill your Note" |
441 | type="text" | 447 | type="text" |
442 | :rules="noteRules" | 448 | :rules="noteRules" |
443 | multi-line | 449 | multi-line |
444 | required | 450 | required |
445 | ></v-textarea> | 451 | ></v-textarea> |
446 | </v-flex> | 452 | </v-flex> |
447 | </v-layout> | 453 | </v-layout> |
448 | </v-flex> | 454 | </v-flex> |
449 | </v-layout> | 455 | </v-layout> |
450 | <v-layout> | 456 | <v-layout> |
451 | <v-flex xs12 sm11> | 457 | <v-flex xs12 sm11> |
452 | <v-layout> | 458 | <v-layout> |
453 | <v-spacer></v-spacer> | 459 | <v-spacer></v-spacer> |
454 | <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> |
455 | <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> |
456 | </v-layout> | 462 | </v-layout> |
457 | </v-flex> | 463 | </v-flex> |
458 | </v-layout> | 464 | </v-layout> |
459 | </v-container> | 465 | </v-container> |
460 | </v-form> | 466 | </v-form> |
461 | </v-card> | 467 | </v-card> |
462 | </v-dialog> | 468 | </v-dialog> |
463 | <div class="loader" v-if="showLoader"> | 469 | <div class="loader" v-if="showLoader"> |
464 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 470 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
465 | </div> | 471 | </div> |
466 | </v-container> | 472 | </v-container> |
467 | </template> | 473 | </template> |
468 | 474 | ||
469 | <script> | 475 | <script> |
470 | import http from "@/Services/http.js"; | 476 | import http from "@/Services/http.js"; |
471 | import Util from "@/util"; | 477 | import Util from "@/util"; |
472 | import moment from "moment"; | 478 | import moment from "moment"; |
473 | 479 | ||
474 | export default { | 480 | export default { |
475 | data: () => ({ | 481 | data: () => ({ |
476 | component: "report-generate", | 482 | component: "report-generate", |
477 | snackbar: false, | 483 | snackbar: false, |
478 | y: "top", | 484 | y: "top", |
479 | x: "right", | 485 | x: "right", |
480 | mode: "", | 486 | mode: "", |
481 | timeout: 3000, | 487 | timeout: 3000, |
482 | text: "", | 488 | text: "", |
483 | show: true, | 489 | show: true, |
484 | showSearch: false, | 490 | showSearch: false, |
485 | showLoader: false, | 491 | showLoader: false, |
486 | loading: false, | 492 | loading: false, |
487 | date: null, | 493 | date: null, |
488 | search: "", | 494 | search: "", |
489 | addIncomeDialog: false, | 495 | addIncomeDialog: false, |
490 | menu: false, | 496 | menu: false, |
491 | menu1: false, | 497 | menu1: false, |
492 | menu2: false, | 498 | menu2: false, |
493 | menu3: false, | 499 | menu3: false, |
494 | editIncomeDialog: false, | 500 | editIncomeDialog: false, |
495 | profileIncomeDialog: false, | 501 | profileIncomeDialog: false, |
496 | valid: true, | 502 | valid: true, |
497 | pagination: { | 503 | pagination: { |
498 | rowsPerPage: 10 | 504 | rowsPerPage: 10, |
499 | }, | 505 | }, |
500 | imageData: {}, | 506 | imageData: {}, |
501 | imageName: "", | 507 | imageName: "", |
502 | imageUrl: "", | 508 | imageUrl: "", |
503 | imageFile: "", | 509 | imageFile: "", |
504 | nameRules: [v => !!v || " Full Name is required"], | 510 | nameRules: [(v) => !!v || " Full Name is required"], |
505 | amountRules: [v => !!v || "Amount is required"], | 511 | amountRules: [(v) => !!v || "Amount is required"], |
506 | noteRules: [v => !!v || "Note Name is required"], | 512 | noteRules: [(v) => !!v || "Note Name is required"], |
507 | joinDateRules: [v => !!v || "Date is required"], | 513 | joinDateRules: [(v) => !!v || "Date is required"], |
508 | errorMessages: "", | 514 | errorMessages: "", |
509 | headers: [ | 515 | headers: [ |
510 | { | 516 | { |
511 | text: "No", | 517 | text: "No", |
512 | align: "", | 518 | align: "", |
513 | sortable: false, | 519 | sortable: false, |
514 | value: "No" | 520 | value: "No", |
515 | }, | 521 | }, |
516 | { | 522 | { |
517 | text: "Profile Pic", | 523 | text: "Profile Pic", |
518 | value: "profilePicUrl", | 524 | value: "profilePicUrl", |
519 | sortable: false, | 525 | sortable: false, |
520 | align: "center" | 526 | align: "center", |
521 | }, | 527 | }, |
522 | { text: "Name", value: "name", sortable: false, align: "center" }, | 528 | { text: "Name", value: "name", sortable: false, align: "center" }, |
523 | { text: "Date", value: "date", sortable: false, align: "center" }, | 529 | { text: "Date", value: "date", sortable: false, align: "center" }, |
524 | { text: "User", value: "user", sortable: false, align: "center" }, | 530 | { text: "User", value: "user", sortable: false, align: "center" }, |
525 | { text: "Amount", value: "amount", sortable: false, align: "center" }, | 531 | { text: "Amount", value: "amount", sortable: false, align: "center" }, |
526 | { text: "Note", value: "note", sortable: false, align: "center" }, | 532 | { text: "Note", value: "note", sortable: false, align: "center" }, |
527 | { text: "Action", value: "", sortable: false, align: "center" } | 533 | { text: "Action", value: "", sortable: false, align: "center" }, |
528 | ], | 534 | ], |
529 | incomeList: [], | 535 | incomeList: [], |
530 | editedIndex: -1, | 536 | editedIndex: -1, |
531 | upload: "", | 537 | upload: "", |
532 | editedItem: {}, | 538 | editedItem: {}, |
533 | addIncome: {} | 539 | addIncome: {}, |
534 | }), | 540 | }), |
535 | watch: { | 541 | watch: { |
536 | menu(val) { | 542 | menu(val) { |
537 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 543 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
538 | }, | 544 | }, |
539 | menu1(val) { | 545 | menu1(val) { |
540 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 546 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
541 | } | 547 | }, |
548 | addIncomeDialog: function (val) { | ||
549 | if (!val) { | ||
550 | this.addIncome = []; | ||
551 | this.menu1 = false; | ||
552 | this.imageName = ""; | ||
553 | this.imageUrl = ""; | ||
554 | this.imageFile = ""; | ||
555 | } | ||
556 | }, | ||
542 | }, | 557 | }, |
543 | methods: { | 558 | methods: { |
544 | save(date) { | 559 | save(date) { |
545 | this.$refs.menu.save(date); | 560 | this.$refs.menu.save(date); |
546 | }, | 561 | }, |
547 | save(date) { | 562 | save(date) { |
548 | this.$refs.menu1.save(date); | 563 | this.$refs.menu1.save(date); |
549 | }, | 564 | }, |
550 | pickFile() { | 565 | pickFile() { |
551 | this.$refs.image.click(); | 566 | this.$refs.image.click(); |
552 | }, | 567 | }, |
553 | onFilePicked(e) { | 568 | onFilePicked(e) { |
554 | // console.log(e) | 569 | // console.log(e) |
555 | const files = e.target.files; | 570 | const files = e.target.files; |
556 | this.upload = e.target.files[0]; | 571 | this.upload = e.target.files[0]; |
557 | console.log("imageData-upload========>", this.upload); | 572 | console.log("imageData-upload========>", this.upload); |
558 | if (files[0] !== undefined) { | 573 | if (files[0] !== undefined) { |
559 | this.imageName = files[0].name; | 574 | this.imageName = files[0].name; |
560 | if (this.imageName.lastIndexOf(".") <= 0) { | 575 | if (this.imageName.lastIndexOf(".") <= 0) { |
561 | return; | 576 | return; |
562 | } | 577 | } |
563 | const fr = new FileReader(); | 578 | const fr = new FileReader(); |
564 | fr.readAsDataURL(files[0]); | 579 | fr.readAsDataURL(files[0]); |
565 | fr.addEventListener("load", () => { | 580 | fr.addEventListener("load", () => { |
566 | this.imageUrl = fr.result; | 581 | this.imageUrl = fr.result; |
567 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 582 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
568 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 583 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
569 | // console.log("upload=======>", this.imageData.imageUrl); | 584 | // console.log("upload=======>", this.imageData.imageUrl); |
570 | console.log("imageFile", this.imageUrl); | 585 | console.log("imageFile", this.imageUrl); |
571 | }); | 586 | }); |
572 | } else { | 587 | } else { |
573 | this.imageName = ""; | 588 | this.imageName = ""; |
574 | this.imageFile = ""; | 589 | this.imageFile = ""; |
575 | this.imageUrl = ""; | 590 | this.imageUrl = ""; |
576 | } | 591 | } |
577 | }, | 592 | }, |
578 | dates: function(date) { | 593 | dates: function (date) { |
579 | return moment(date).format("MMMM DD, YYYY"); | 594 | return moment(date).format("MMMM DD, YYYY"); |
580 | }, | 595 | }, |
581 | getIncomeList() { | 596 | getIncomeList() { |
582 | this.showLoader = true; | 597 | this.showLoader = true; |
583 | var token = this.$store.state.token; | 598 | var token = this.$store.state.token; |
584 | http() | 599 | http() |
585 | .get("/getIncomesList", { | 600 | .get("/getIncomesList", { |
586 | params: { schoolId: this.$store.state.schoolId }, | 601 | params: { schoolId: this.$store.state.schoolId }, |
587 | headers: { Authorization: "Bearer " + token } | 602 | headers: { Authorization: "Bearer " + token }, |
588 | }) | 603 | }) |
589 | .then(response => { | 604 | .then((response) => { |
590 | this.incomeList = response.data.data; | 605 | this.incomeList = response.data.data; |
591 | this.showLoader = false; | 606 | this.showLoader = false; |
592 | // console.log("getTeacherList=====>",this.incomeList) | 607 | // console.log("getTeacherList=====>",this.incomeList) |
593 | }) | 608 | }) |
594 | .catch(error => { | 609 | .catch((error) => { |
595 | this.showLoader = false; | 610 | this.showLoader = false; |
596 | if (error.response.status === 401) { | 611 | if (error.response.status === 401) { |
597 | this.$router.replace({ path: "/" }); | 612 | this.$router.replace({ path: "/" }); |
598 | this.$store.dispatch("setToken", null); | 613 | this.$store.dispatch("setToken", null); |
599 | this.$store.dispatch("Id", null); | 614 | this.$store.dispatch("Id", null); |
600 | } | 615 | } |
601 | }); | 616 | }); |
602 | }, | 617 | }, |
603 | editItem(item) { | 618 | editItem(item) { |
604 | this.editedIndex = this.incomeList.indexOf(item); | 619 | this.editedIndex = this.incomeList.indexOf(item); |
605 | this.editedItem = Object.assign({}, item); | 620 | this.editedItem = Object.assign({}, item); |
606 | this.editedItem.date = | 621 | this.editedItem.date = |
607 | this.editedItem.date != undefined | 622 | this.editedItem.date != undefined |
608 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 623 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
609 | : (this.editedItem.date = ""); | 624 | : (this.editedItem.date = ""); |
610 | 625 | ||
611 | this.editIncomeDialog = true; | 626 | this.editIncomeDialog = true; |
612 | }, | 627 | }, |
613 | profile(item) { | 628 | profile(item) { |
614 | this.editedIndex = this.incomeList.indexOf(item); | 629 | this.editedIndex = this.incomeList.indexOf(item); |
615 | this.editedItem = Object.assign({}, item); | 630 | this.editedItem = Object.assign({}, item); |
616 | this.profileIncomeDialog = true; | 631 | this.profileIncomeDialog = true; |
617 | }, | 632 | }, |
618 | deleteItem(item) { | 633 | deleteItem(item) { |
619 | let deleteIncome = { | 634 | let deleteIncome = { |
620 | incomeId: item._id | 635 | incomeId: item._id, |
621 | }; | 636 | }; |
622 | http() | 637 | http() |
623 | .delete( | 638 | .delete( |
624 | "/deleteIncome", | 639 | "/deleteIncome", |
625 | confirm("Are you sure you want to delete this?") && { | 640 | confirm("Are you sure you want to delete this?") && { |
626 | params: deleteIncome | 641 | params: deleteIncome, |
627 | } | 642 | } |
628 | ) | 643 | ) |
629 | .then(response => { | 644 | .then((response) => { |
630 | // console.log("deleteUers",deleteTeachers) | 645 | // console.log("deleteUers",deleteTeachers) |
631 | if ((this.snackbar = true)) { | 646 | if ((this.snackbar = true)) { |
632 | this.text = "Successfully delete Existing Income"; | 647 | this.text = "Successfully delete Existing Income"; |
633 | } | 648 | } |
634 | this.getIncomeList(); | 649 | this.getIncomeList(); |
635 | }) | 650 | }) |
636 | .catch(error => { | 651 | .catch((error) => { |
637 | console.log(error); | 652 | console.log(error); |
638 | }); | 653 | }); |
639 | }, | 654 | }, |
640 | close() { | 655 | close() { |
641 | this.editIncomeDialog = false; | 656 | this.editIncomeDialog = false; |
642 | }, | 657 | }, |
643 | close1() { | 658 | close1() { |
644 | this.dialog1 = false; | 659 | this.dialog1 = false; |
645 | }, | 660 | }, |
661 | closeAddIncomeModel() { | ||
662 | this.addIncomeDialog = false; | ||
663 | this.addIncome = []; | ||
664 | this.menu1 = false; | ||
665 | this.imageName = ""; | ||
666 | this.imageUrl = ""; | ||
667 | this.imageFile = ""; | ||
668 | }, | ||
646 | submit() { | 669 | submit() { |
647 | if (this.$refs.form.validate()) { | 670 | if (this.$refs.form.validate()) { |
648 | if (this.imageUrl) { | 671 | if (this.imageUrl) { |
649 | var str = this.imageUrl; | 672 | var str = this.imageUrl; |
650 | const [baseUrl, imageUrl] = str.split(/,/); | 673 | const [baseUrl, imageUrl] = str.split(/,/); |
651 | this.addIncome.upload = imageUrl; | 674 | this.addIncome.upload = imageUrl; |
652 | } | 675 | } |
653 | this.loading = true; | 676 | this.loading = true; |
654 | // this.addIncome = this.$store.state.schoolId; | 677 | // this.addIncome = this.$store.state.schoolId; |
655 | http() | 678 | http() |
656 | .post("/createIncome", this.addIncome) | 679 | .post("/createIncome", this.addIncome) |
657 | .then(response => { | 680 | .then((response) => { |
658 | this.getIncomeList(); | 681 | this.getIncomeList(); |
659 | this.snackbar = true; | 682 | this.snackbar = true; |
660 | this.text = response.data.message; | 683 | this.text = response.data.message; |
661 | this.color = "green"; | 684 | this.color = "green"; |
662 | this.addIncomeDialog = false; | 685 | this.addIncomeDialog = false; |
663 | this.clear(); | 686 | this.clear(); |
664 | this.loading = false; | 687 | this.loading = false; |
665 | }) | 688 | }) |
666 | .catch(error => { | 689 | .catch((error) => { |
667 | // console.log(error); | 690 | // console.log(error); |
668 | this.loading = false; | 691 | this.loading = false; |
669 | this.snackbar = true; | 692 | this.snackbar = true; |
670 | this.color = "error"; | 693 | this.color = "error"; |
671 | this.text = error.response.data.message; | 694 | this.text = error.response.data.message; |
672 | }); | 695 | }); |
673 | } | 696 | } |
674 | }, | 697 | }, |
675 | clear() { | 698 | clear() { |
676 | this.$refs.form.reset(); | 699 | this.$refs.form.reset(); |
677 | }, | 700 | }, |
678 | save() { | 701 | save() { |
679 | this.loading = true; | 702 | this.loading = true; |
680 | this.editedItem.incomeId = this.editedItem._id; | 703 | this.editedItem.incomeId = this.editedItem._id; |
681 | if (this.imageUrl) { | 704 | if (this.imageUrl) { |
682 | var str = this.imageUrl; | 705 | var str = this.imageUrl; |
683 | const [baseUrl, imageUrl] = str.split(/,/); | 706 | const [baseUrl, imageUrl] = str.split(/,/); |
684 | this.editedItem.upload = imageUrl; | 707 | this.editedItem.upload = imageUrl; |
685 | } | 708 | } |
686 | http() | 709 | http() |
687 | .put("/updateIncome", this.editedItem) | 710 | .put("/updateIncome", this.editedItem) |
688 | .then(response => { | 711 | .then((response) => { |
689 | this.snackbar = true; | 712 | this.snackbar = true; |
690 | this.text = response.data.message; | 713 | this.text = response.data.message; |
691 | this.color = "green"; | 714 | this.color = "green"; |
692 | this.loading = false; | 715 | this.loading = false; |
693 | this.getIncomeList(); | 716 | this.getIncomeList(); |
694 | this.close(); | 717 | this.close(); |
695 | }) | 718 | }) |
696 | .catch(error => { | 719 | .catch((error) => { |
697 | this.loading = false; | 720 | this.loading = false; |
698 | this.snackbar = true; | 721 | this.snackbar = true; |
699 | this.color = "error"; | 722 | this.color = "error"; |
700 | this.loading = false; | 723 | this.loading = false; |
701 | }); | 724 | }); |
702 | }, | 725 | }, |
703 | 726 | ||
704 | displaySearch() { | 727 | displaySearch() { |
705 | (this.show = false), (this.showSearch = true); | 728 | (this.show = false), (this.showSearch = true); |
706 | }, | 729 | }, |
707 | closeSearch() { | 730 | closeSearch() { |
708 | this.showSearch = false; | 731 | this.showSearch = false; |
709 | this.show = true; | 732 | this.show = true; |
710 | this.search = ""; | 733 | this.search = ""; |
711 | } | 734 | }, |
712 | }, | 735 | }, |
713 | mounted() { | 736 | mounted() { |
714 | this.getIncomeList(); | 737 | this.getIncomeList(); |
715 | } | 738 | }, |
716 | }; | 739 | }; |
717 | </script> | 740 | </script> |
src/pages/Account/invoice.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit INVOICE ****** --> | 3 | <!-- ****** Edit INVOICE ****** --> |
4 | <v-dialog v-model="editInvoiceDialog"> | 4 | <v-dialog v-model="editInvoiceDialog"> |
5 | <v-card flat class="text-xs-center white--text"> | 5 | <v-card flat class="text-xs-center white--text"> |
6 | <v-layout> | 6 | <v-layout> |
7 | <v-flex xs12 class="card-styles pa-2"> | 7 | <v-flex xs12 class="card-styles pa-2"> |
8 | <label class="title text-xs-center">Edit Invoice</label> | 8 | <label class="title text-xs-center">Edit Invoice</label> |
9 | <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" /> | 12 | <editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" /> |
13 | </v-card> | 13 | </v-card> |
14 | </v-dialog> | 14 | </v-dialog> |
15 | 15 | ||
16 | <!-- ****PAYMENT INVOICE DIALOG --> | 16 | <!-- ****PAYMENT INVOICE DIALOG --> |
17 | <v-dialog v-model="paymentInvoiceDialog"> | 17 | <v-dialog v-model="paymentInvoiceDialog"> |
18 | <v-card flat class="text-xs-center white--text"> | 18 | <v-card flat class="text-xs-center white--text"> |
19 | <v-layout> | 19 | <v-layout> |
20 | <v-flex xs12 class="card-styles pa-2"> | 20 | <v-flex xs12 class="card-styles pa-2"> |
21 | <label class="title text-xs-center">Payment Template</label> | 21 | <label class="title text-xs-center">Payment Template</label> |
22 | <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon> | 22 | <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon> |
23 | </v-flex> | 23 | </v-flex> |
24 | </v-layout> | 24 | </v-layout> |
25 | <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" /> | 25 | <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" /> |
26 | </v-card> | 26 | </v-card> |
27 | </v-dialog> | 27 | </v-dialog> |
28 | 28 | ||
29 | <!-- ****** PROFILE VIEW SECTION DATA ****** --> | 29 | <!-- ****** PROFILE VIEW SECTION DATA ****** --> |
30 | 30 | ||
31 | <v-dialog v-model="dialog1" max-width="800px"> | 31 | <v-dialog v-model="dialog1" max-width="800px"> |
32 | <v-card flat class="text-xs-center white--text"> | 32 | <v-card flat class="text-xs-center white--text"> |
33 | <v-layout> | 33 | <v-layout> |
34 | <v-flex xs12 class="card-style pa-2"> | 34 | <v-flex xs12 class="card-style pa-2"> |
35 | <label class="title text-xs-center">View Payments</label> | 35 | <label class="title text-xs-center">View Payments</label> |
36 | <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon> | 36 | <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon> |
37 | </v-flex> | 37 | </v-flex> |
38 | </v-layout> | 38 | </v-layout> |
39 | <table class="feeTypeTable tableRsponsive"> | 39 | <table class="feeTypeTable tableRsponsive"> |
40 | <tr style="color: black"> | 40 | <tr style="color: black"> |
41 | <th>#</th> | 41 | <th>#</th> |
42 | <th>Date</th> | 42 | <th>Date</th> |
43 | <th>Paid By</th> | 43 | <th>Paid By</th> |
44 | <th>Payment Amount</th> | 44 | <th>Payment Amount</th> |
45 | <th>Weaver</th> | 45 | <th>Weaver</th> |
46 | <th>Action</th> | 46 | <th>Action</th> |
47 | </tr> | 47 | </tr> |
48 | <tr v-if="editedItem.paymentStatus != 'NOT_PAID'"> | 48 | <tr v-if="editedItem.paymentStatus != 'NOT_PAID'"> |
49 | <td style="width:40px ; color:black" class="tdFeeType">1</td> | 49 | <td style="width:40px ; color:black" class="tdFeeType">1</td> |
50 | <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td> | 50 | <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td> |
51 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td> | 51 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td> |
52 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td> | 52 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td> |
53 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td> | 53 | <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td> |
54 | <td class="text-xs-center td td-row"> | 54 | <td class="text-xs-center td td-row"> |
55 | <router-link | 55 | <router-link |
56 | :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }" | 56 | :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }" |
57 | > | 57 | > |
58 | <v-tooltip top> | 58 | <v-tooltip top> |
59 | <img | 59 | <img |
60 | slot="activator" | 60 | slot="activator" |
61 | style="cursor:pointer; width:25px; height:25px; " | 61 | style="cursor:pointer; width:25px; height:25px; " |
62 | class="mr-3" | 62 | class="mr-3" |
63 | src="/static/icon/view.png" | 63 | src="/static/icon/view.png" |
64 | /> | 64 | /> |
65 | <span>View</span> | 65 | <span>View</span> |
66 | </v-tooltip> | 66 | </v-tooltip> |
67 | </router-link> | 67 | </router-link> |
68 | <v-tooltip top> | 68 | <v-tooltip top> |
69 | <img | 69 | <img |
70 | slot="activator" | 70 | slot="activator" |
71 | style="cursor:pointer;width:20px; height:20px; " | 71 | style="cursor:pointer;width:20px; height:20px; " |
72 | class="mr-3" | 72 | class="mr-3" |
73 | @click="deletePayment(editedItem)" | 73 | @click="deletePayment(editedItem)" |
74 | src="/static/icon/delete.png" | 74 | src="/static/icon/delete.png" |
75 | /> | 75 | /> |
76 | <span>Delete</span> | 76 | <span>Delete</span> |
77 | </v-tooltip> | 77 | </v-tooltip> |
78 | </td> | 78 | </td> |
79 | </tr> | 79 | </tr> |
80 | <tr v-if="editedItem.paymentStatus == 'NOT_PAID'"> | 80 | <tr v-if="editedItem.paymentStatus == 'NOT_PAID'"> |
81 | <td style="width:40px ; color:black" class="tdFeeType'">-</td> | 81 | <td style="width:40px ; color:black" class="tdFeeType'">-</td> |
82 | <td style="width:120px; color:black" class="tdFeeType">-</td> | 82 | <td style="width:120px; color:black" class="tdFeeType">-</td> |
83 | <td style="width:120px; color:black" class="tdFeeType">-</td> | 83 | <td style="width:120px; color:black" class="tdFeeType">-</td> |
84 | <td style="width:120px; color:black" class="tdFeeType">-</td> | 84 | <td style="width:120px; color:black" class="tdFeeType">-</td> |
85 | <td style="width:120px; color:black" class="tdFeeType">-</td> | 85 | <td style="width:120px; color:black" class="tdFeeType">-</td> |
86 | <td class="text-xs-center td td-row"></td> | 86 | <td class="text-xs-center td td-row"></td> |
87 | </tr> | 87 | </tr> |
88 | </table> | 88 | </table> |
89 | </v-card> | 89 | </v-card> |
90 | </v-dialog> | 90 | </v-dialog> |
91 | 91 | ||
92 | <!-- ****** Invoice Table ****** --> | 92 | <!-- ****** Invoice Table ****** --> |
93 | <v-toolbar color="transparent" flat> | 93 | <v-toolbar color="transparent" flat> |
94 | <v-btn | 94 | <v-btn |
95 | fab | 95 | fab |
96 | dark | 96 | dark |
97 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 97 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
98 | small | 98 | small |
99 | @click="addInvoiceDialog = true" | 99 | @click="addInvoiceDialog = true" |
100 | > | 100 | > |
101 | <v-icon dark>add</v-icon> | 101 | <v-icon dark>add</v-icon> |
102 | </v-btn> | 102 | </v-btn> |
103 | <v-btn | 103 | <v-btn |
104 | round | 104 | round |
105 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 105 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
106 | dark | 106 | dark |
107 | @click="addInvoiceDialog = true" | 107 | @click="addInvoiceDialog = true" |
108 | > | 108 | > |
109 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice | 109 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice |
110 | </v-btn> | 110 | </v-btn> |
111 | <v-spacer></v-spacer> | 111 | <v-spacer></v-spacer> |
112 | <v-card-title class="body-1" v-show="show"> | 112 | <v-card-title class="body-1" v-show="show"> |
113 | <v-btn icon large flat @click="displaySearch"> | 113 | <v-btn icon large flat @click="displaySearch"> |
114 | <v-avatar size="27"> | 114 | <v-avatar size="27"> |
115 | <img src="/static/icon/search.png" alt="icon" /> | 115 | <img src="/static/icon/search.png" alt="icon" /> |
116 | </v-avatar> | 116 | </v-avatar> |
117 | </v-btn> | 117 | </v-btn> |
118 | </v-card-title> | 118 | </v-card-title> |
119 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 119 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
120 | <v-layout> | 120 | <v-layout> |
121 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 121 | <v-text-field |
122 | autofocus | ||
123 | v-model="search" | ||
124 | label="Search" | ||
125 | prepend-inner-icon="search" | ||
126 | color="primary" | ||
127 | ></v-text-field> | ||
122 | <v-icon @click="closeSearch" color="error">close</v-icon> | 128 | <v-icon @click="closeSearch" color="error">close</v-icon> |
123 | </v-layout> | 129 | </v-layout> |
124 | </v-flex> | 130 | </v-flex> |
125 | </v-toolbar> | 131 | </v-toolbar> |
126 | <v-data-table | 132 | <v-data-table |
127 | :headers="headers" | 133 | :headers="headers" |
128 | :items="invoiceList" | 134 | :items="invoiceList" |
129 | :pagination.sync="pagination" | 135 | :pagination.sync="pagination" |
130 | :search="search" | 136 | :search="search" |
131 | > | 137 | > |
132 | <template slot="items" slot-scope="props"> | 138 | <template slot="items" slot-scope="props"> |
133 | <tr class="tr"> | 139 | <tr class="tr"> |
134 | <td class="td td-row">{{ props.index + 1 }}</td> | 140 | <td class="td td-row">{{ props.index + 1 }}</td> |
135 | <td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td> | 141 | <td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td> |
136 | <td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td> | 142 | <td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td> |
137 | <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td> | 143 | <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td> |
138 | <td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td> | 144 | <td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td> |
139 | <td | 145 | <td |
140 | class="text-xs-center td td-row" | 146 | class="text-xs-center td td-row" |
141 | >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td> | 147 | >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td> |
142 | <td | 148 | <td |
143 | class="text-xs-center td td-row" | 149 | class="text-xs-center td td-row" |
144 | >{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td> | 150 | >{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td> |
145 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'"> | 151 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'"> |
146 | <span | 152 | <span |
147 | class="red lighten-1 py-1 px-2 white--text paymentStatus" | 153 | class="red lighten-1 py-1 px-2 white--text paymentStatus" |
148 | >{{ props.item.paymentStatus }}</span> | 154 | >{{ props.item.paymentStatus }}</span> |
149 | </td> | 155 | </td> |
150 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'"> | 156 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'"> |
151 | <span | 157 | <span |
152 | class="green lighten-1 py-1 px-2 white--text paymentStatus" | 158 | class="green lighten-1 py-1 px-2 white--text paymentStatus" |
153 | >{{ props.item.paymentStatus }}</span> | 159 | >{{ props.item.paymentStatus }}</span> |
154 | </td> | 160 | </td> |
155 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> | 161 | <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> |
156 | <span | 162 | <span |
157 | class="yellow darken-3 py-1 px-2 white--text paymentStatus" | 163 | class="yellow darken-3 py-1 px-2 white--text paymentStatus" |
158 | >{{ props.item.paymentStatus }}</span> | 164 | >{{ props.item.paymentStatus }}</span> |
159 | </td> | 165 | </td> |
160 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> | 166 | <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> |
161 | <td class="text-xs-center td td-row"> | 167 | <td class="text-xs-center td td-row"> |
162 | <router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }"> | 168 | <router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }"> |
163 | <v-tooltip top> | 169 | <v-tooltip top> |
164 | <img | 170 | <img |
165 | slot="activator" | 171 | slot="activator" |
166 | style="cursor:pointer; width:25px; height:25px; " | 172 | style="cursor:pointer; width:25px; height:25px; " |
167 | class="mr-3" | 173 | class="mr-3" |
168 | src="/static/icon/view.png" | 174 | src="/static/icon/view.png" |
169 | /> | 175 | /> |
170 | <span>View</span> | 176 | <span>View</span> |
171 | </v-tooltip> | 177 | </v-tooltip> |
172 | </router-link> | 178 | </router-link> |
173 | <span v-if="props.item.paymentStatus === 'NOT_PAID'"> | 179 | <span v-if="props.item.paymentStatus === 'NOT_PAID'"> |
174 | <!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }"> | 180 | <!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }"> |
175 | <v-tooltip top> | 181 | <v-tooltip top> |
176 | <img | 182 | <img |
177 | slot="activator" | 183 | slot="activator" |
178 | style="cursor:pointer; width:20px; height:18px; " | 184 | style="cursor:pointer; width:20px; height:18px; " |
179 | class="mr-3" | 185 | class="mr-3" |
180 | @click="editItem(props.item)" | 186 | @click="editItem(props.item)" |
181 | src="/static/icon/edit.png" | 187 | src="/static/icon/edit.png" |
182 | /> | 188 | /> |
183 | <span>Edit</span> | 189 | <span>Edit</span> |
184 | </v-tooltip> | 190 | </v-tooltip> |
185 | </router-link>--> | 191 | </router-link>--> |
186 | <v-tooltip top> | 192 | <v-tooltip top> |
187 | <img | 193 | <img |
188 | slot="activator" | 194 | slot="activator" |
189 | style="cursor:pointer; width:20px; height:18px; " | 195 | style="cursor:pointer; width:20px; height:18px; " |
190 | class="mr-3" | 196 | class="mr-3" |
191 | @click="editItem(props.item)" | 197 | @click="editItem(props.item)" |
192 | src="/static/icon/edit.png" | 198 | src="/static/icon/edit.png" |
193 | /> | 199 | /> |
194 | <span>Edit</span> | 200 | <span>Edit</span> |
195 | </v-tooltip> | 201 | </v-tooltip> |
196 | <v-tooltip top> | 202 | <v-tooltip top> |
197 | <img | 203 | <img |
198 | slot="activator" | 204 | slot="activator" |
199 | style="cursor:pointer;width:20px; height:20px; " | 205 | style="cursor:pointer;width:20px; height:20px; " |
200 | class="mr-3" | 206 | class="mr-3" |
201 | @click="deleteItem(props.item)" | 207 | @click="deleteItem(props.item)" |
202 | src="/static/icon/delete.png" | 208 | src="/static/icon/delete.png" |
203 | /> | 209 | /> |
204 | <span>Delete</span> | 210 | <span>Delete</span> |
205 | </v-tooltip> | 211 | </v-tooltip> |
206 | <v-tooltip top> | 212 | <v-tooltip top> |
207 | <img | 213 | <img |
208 | slot="activator" | 214 | slot="activator" |
209 | style="cursor:pointer; width:20px; height:18px; " | 215 | style="cursor:pointer; width:20px; height:18px; " |
210 | class="mr-3" | 216 | class="mr-3" |
211 | @click="paymentItem(props.item)" | 217 | @click="paymentItem(props.item)" |
212 | src="/static/schoolIcons/Account.png" | 218 | src="/static/schoolIcons/Account.png" |
213 | /> | 219 | /> |
214 | <span>Payment</span> | 220 | <span>Payment</span> |
215 | </v-tooltip> | 221 | </v-tooltip> |
216 | </span> | 222 | </span> |
217 | <span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> | 223 | <span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> |
218 | <v-tooltip top> | 224 | <v-tooltip top> |
219 | <img | 225 | <img |
220 | slot="activator" | 226 | slot="activator" |
221 | style="cursor:pointer; width:20px; height:18px; " | 227 | style="cursor:pointer; width:20px; height:18px; " |
222 | class="mr-3" | 228 | class="mr-3" |
223 | @click="paymentItem(props.item)" | 229 | @click="paymentItem(props.item)" |
224 | src="/static/schoolIcons/Account.png" | 230 | src="/static/schoolIcons/Account.png" |
225 | /> | 231 | /> |
226 | <span>Payment</span> | 232 | <span>Payment</span> |
227 | </v-tooltip> | 233 | </v-tooltip> |
228 | </span> | 234 | </span> |
229 | <v-tooltip top> | 235 | <v-tooltip top> |
230 | <img | 236 | <img |
231 | slot="activator" | 237 | slot="activator" |
232 | style="cursor:pointer; width:18px; height:17px;" | 238 | style="cursor:pointer; width:18px; height:17px;" |
233 | @click="profile(props.item)" | 239 | @click="profile(props.item)" |
234 | src="/static/icon/eye1.png" | 240 | src="/static/icon/eye1.png" |
235 | /> | 241 | /> |
236 | <span>View Payment</span> | 242 | <span>View Payment</span> |
237 | </v-tooltip> | 243 | </v-tooltip> |
238 | </td> | 244 | </td> |
239 | </tr> | 245 | </tr> |
240 | </template> | 246 | </template> |
241 | <v-alert | 247 | <v-alert |
242 | slot="no-results" | 248 | slot="no-results" |
243 | :value="true" | 249 | :value="true" |
244 | color="error" | 250 | color="error" |
245 | icon="warning" | 251 | icon="warning" |
246 | >Your search for "{{ search }}" found no results.</v-alert> | 252 | >Your search for "{{ search }}" found no results.</v-alert> |
247 | </v-data-table> | 253 | </v-data-table> |
248 | 254 | ||
249 | <!-- ****** ADD INVOICE ****** --> | 255 | <!-- ****** ADD INVOICE ****** --> |
250 | <v-snackbar | 256 | <v-snackbar |
251 | :timeout="timeout" | 257 | :timeout="timeout" |
252 | :top="y === 'top'" | 258 | :top="y === 'top'" |
253 | :right="x === 'right'" | 259 | :right="x === 'right'" |
254 | :vertical="mode === 'vertical'" | 260 | :vertical="mode === 'vertical'" |
255 | v-model="snackbar" | 261 | v-model="snackbar" |
256 | :color="color" | 262 | :color="color" |
257 | >{{ text }}</v-snackbar> | 263 | >{{ text }}</v-snackbar> |
258 | <v-dialog v-model="addInvoiceDialog"> | 264 | <v-dialog v-model="addInvoiceDialog" v-if="addInvoiceDialog"> |
259 | <v-card flat class="text-xs-center white--text"> | 265 | <v-card flat class="text-xs-center white--text"> |
260 | <v-layout> | 266 | <v-layout> |
261 | <v-flex xs12 class="card-styles pa-2"> | 267 | <v-flex xs12 class="card-styles pa-2"> |
262 | <label class="title text-xs-center">Add Invoice</label> | 268 | <label class="title text-xs-center">Add Invoice</label> |
263 | <v-icon size="24" class="right white--text" @click="addInvoiceDialog = false">cancel</v-icon> | 269 | <v-icon size="24" class="right white--text" @click="closeAddInvoiceModel">cancel</v-icon> |
264 | </v-flex> | 270 | </v-flex> |
265 | </v-layout> | 271 | </v-layout> |
266 | <v-flex xs12 sm12> | 272 | <v-flex xs12 sm12> |
267 | <v-container fluid grid-list-md> | 273 | <v-container fluid grid-list-md> |
268 | <v-layout wrap> | 274 | <v-layout wrap> |
269 | <v-flex xs12 sm12 md5> | 275 | <v-flex xs12 sm12 md5> |
270 | <v-card flat> | 276 | <v-card flat> |
271 | <v-toolbar dark class="card-styles" flat> | 277 | <v-toolbar dark class="card-styles" flat> |
272 | <v-spacer></v-spacer> | 278 | <v-spacer></v-spacer> |
273 | <h3>Invoice</h3> | 279 | <h3>Invoice</h3> |
274 | <v-spacer></v-spacer> | 280 | <v-spacer></v-spacer> |
275 | </v-toolbar> | 281 | </v-toolbar> |
276 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> | 282 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> |
277 | <v-layout> | 283 | <v-layout> |
278 | <v-flex xs4 class="pt-4 subheading"> | 284 | <v-flex xs4 class="pt-4 subheading"> |
279 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 285 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
280 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 286 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
281 | </v-flex> | 287 | </v-flex> |
282 | <v-flex xs6 class="ml-3"> | 288 | <v-flex xs6 class="ml-3"> |
283 | <v-select | 289 | <v-select |
284 | :items="addclass" | 290 | :items="addclass" |
285 | label="Select Class" | 291 | label="Select Class" |
286 | v-model="invoiceData.classNum" | 292 | v-model="invoiceData.classNum" |
287 | item-text="classNum" | 293 | item-text="classNum" |
288 | item-value="_id" | 294 | item-value="_id" |
289 | @change="getAllStudents()" | 295 | @change="getAllStudents()" |
290 | :rules="classRules" | 296 | :rules="classRules" |
291 | required | 297 | required |
292 | ></v-select> | 298 | ></v-select> |
293 | </v-flex> | 299 | </v-flex> |
294 | </v-layout> | 300 | </v-layout> |
295 | <v-layout> | 301 | <v-layout> |
296 | <v-flex xs4 class="pt-4 subheading"> | 302 | <v-flex xs4 class="pt-4 subheading"> |
297 | <label class="right hidden-xs-only hidden-sm-only">Select Student:</label> | 303 | <label class="right hidden-xs-only hidden-sm-only">Select Student:</label> |
298 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label> | 304 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label> |
299 | </v-flex> | 305 | </v-flex> |
300 | <v-flex xs6 class="ml-3"> | 306 | <v-flex xs6 class="ml-3"> |
301 | <v-select | 307 | <v-select |
302 | :items="studentList" | 308 | :items="studentList" |
303 | label="Select Student" | 309 | label="Select Student" |
304 | v-model="invoiceData.studentId" | 310 | v-model="invoiceData.studentId" |
305 | item-text="name" | 311 | item-text="name" |
306 | item-value="_id" | 312 | item-value="_id" |
307 | :rules="inchargeRules" | 313 | :rules="inchargeRules" |
308 | @change="selectAllStudent()" | 314 | @change="selectAllStudent()" |
309 | required | 315 | required |
310 | ></v-select> | 316 | ></v-select> |
311 | </v-flex> | 317 | </v-flex> |
312 | </v-layout> | 318 | </v-layout> |
313 | <v-layout> | 319 | <v-layout> |
314 | <v-flex xs4 class="pt-4 subheading"> | 320 | <v-flex xs4 class="pt-4 subheading"> |
315 | <label class="right">Date:</label> | 321 | <label class="right">Date:</label> |
316 | </v-flex> | 322 | </v-flex> |
317 | <v-flex xs6 class="ml-3"> | 323 | <v-flex xs6 class="ml-3"> |
318 | <v-menu | 324 | <v-menu |
319 | ref="menu1" | 325 | ref="menu1" |
320 | :close-on-content-click="false" | 326 | :close-on-content-click="false" |
321 | v-model="menu1" | 327 | v-model="menu1" |
322 | :nudge-right="40" | 328 | :nudge-right="40" |
323 | lazy | 329 | lazy |
324 | :return-value.sync="invoiceData.date" | 330 | :return-value.sync="invoiceData.date" |
325 | transition="scale-transition" | 331 | transition="scale-transition" |
326 | offset-y | 332 | offset-y |
327 | full-width | 333 | full-width |
328 | min-width="290px" | 334 | min-width="290px" |
329 | > | 335 | > |
330 | <v-text-field | 336 | <v-text-field |
331 | slot="activator" | 337 | slot="activator" |
332 | :rules="dateRules" | 338 | :rules="dateRules" |
333 | v-model="invoiceData.date" | 339 | v-model="invoiceData.date" |
334 | placeholder="Select date" | 340 | placeholder="Select date" |
335 | ></v-text-field> | 341 | ></v-text-field> |
336 | <v-date-picker | 342 | <v-date-picker |
337 | v-model="invoiceData.date" | 343 | v-model="invoiceData.date" |
338 | @input="$refs.menu1.save(invoiceData.date)" | 344 | @input="$refs.menu1.save(invoiceData.date)" |
339 | ></v-date-picker> | 345 | ></v-date-picker> |
340 | </v-menu> | 346 | </v-menu> |
341 | </v-flex> | 347 | </v-flex> |
342 | </v-layout> | 348 | </v-layout> |
343 | <v-layout> | 349 | <v-layout> |
344 | <v-flex xs4 class="pt-4 subheading"> | 350 | <v-flex xs4 class="pt-4 subheading"> |
345 | <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label> | 351 | <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label> |
346 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label> | 352 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label> |
347 | </v-flex> | 353 | </v-flex> |
348 | <v-flex xs6 class="ml-3"> | 354 | <v-flex xs6 class="ml-3"> |
349 | <v-select | 355 | <v-select |
350 | :items="paymentStatus" | 356 | :items="paymentStatus" |
351 | v-model="invoiceData.paymentStatus" | 357 | v-model="invoiceData.paymentStatus" |
352 | item-text="name" | 358 | item-text="name" |
353 | item-value="value" | 359 | item-value="value" |
354 | label="Select Payment Status" | 360 | label="Select Payment Status" |
355 | @change="getPayMethodList" | 361 | @change="getPayMethodList" |
356 | :rules="paymentStatusRules" | 362 | :rules="paymentStatusRules" |
357 | required | 363 | required |
358 | ></v-select> | 364 | ></v-select> |
359 | </v-flex> | 365 | </v-flex> |
360 | </v-layout> | 366 | </v-layout> |
361 | <v-layout v-show="showPayMethods"> | 367 | <v-layout v-show="showPayMethods"> |
362 | <v-flex xs4 class="pt-4 subheading"> | 368 | <v-flex xs4 class="pt-4 subheading"> |
363 | <label class="right">Payment Method:</label> | 369 | <label class="right">Payment Method:</label> |
364 | </v-flex> | 370 | </v-flex> |
365 | <v-flex xs6 class="ml-3"> | 371 | <v-flex xs6 class="ml-3"> |
366 | <v-select | 372 | <v-select |
367 | :items="paymentMethods" | 373 | :items="paymentMethods" |
368 | v-model="invoiceData.paymentMethod" | 374 | v-model="invoiceData.paymentMethod" |
369 | :rules="paymentMethodRules" | 375 | :rules="paymentMethodRules" |
370 | label="Select Payment Method" | 376 | label="Select Payment Method" |
371 | required | 377 | required |
372 | ></v-select> | 378 | ></v-select> |
373 | </v-flex> | 379 | </v-flex> |
374 | </v-layout> | 380 | </v-layout> |
375 | <v-layout> | 381 | <v-layout> |
376 | <v-flex xs12 sm11> | 382 | <v-flex xs12 sm11> |
377 | <v-card-actions> | 383 | <v-card-actions> |
378 | <v-spacer></v-spacer> | 384 | <v-spacer></v-spacer> |
379 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 385 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
380 | <v-btn | 386 | <v-btn |
381 | @click="submit" | 387 | @click="submit" |
382 | round | 388 | round |
383 | dark | 389 | dark |
384 | :loading="loading" | 390 | :loading="loading" |
385 | class="add-button" | 391 | class="add-button" |
386 | >Add</v-btn> | 392 | >Add</v-btn> |
387 | </v-card-actions> | 393 | </v-card-actions> |
388 | </v-flex> | 394 | </v-flex> |
389 | </v-layout> | 395 | </v-layout> |
390 | </v-form> | 396 | </v-form> |
391 | </v-card> | 397 | </v-card> |
392 | </v-flex> | 398 | </v-flex> |
393 | <v-flex xs12 sm12 md7> | 399 | <v-flex xs12 sm12 md7> |
394 | <v-card> | 400 | <v-card> |
395 | <v-toolbar dark class="card-styles" flat> | 401 | <v-toolbar dark class="card-styles" flat> |
396 | <v-spacer></v-spacer> | 402 | <v-spacer></v-spacer> |
397 | <h3>Fee Type List</h3> | 403 | <h3>Fee Type List</h3> |
398 | <v-spacer></v-spacer> | 404 | <v-spacer></v-spacer> |
399 | </v-toolbar> | 405 | </v-toolbar> |
400 | <v-layout> | 406 | <v-layout> |
401 | <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only"> | 407 | <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only"> |
402 | <label class="right title">Fee Type:</label> | 408 | <label class="right title">Fee Type:</label> |
403 | </v-flex> | 409 | </v-flex> |
404 | <v-flex xs8 sm4> | 410 | <v-flex xs8 sm4> |
405 | <v-select | 411 | <v-select |
406 | :items="feeTypes" | 412 | :items="feeTypes" |
407 | v-model="feeType.feeTypeName" | 413 | v-model="feeType.feeTypeName" |
408 | item-text="feeType" | 414 | item-text="feeType" |
409 | item-value="feeType" | 415 | item-value="feeType" |
410 | label="Select Fee Type" | 416 | label="Select Fee Type" |
411 | required | 417 | required |
412 | ></v-select> | 418 | ></v-select> |
413 | </v-flex> | 419 | </v-flex> |
414 | <v-flex xs4 sm6> | 420 | <v-flex xs4 sm6> |
415 | <v-btn | 421 | <v-btn |
416 | color="open-dialog-button" | 422 | color="open-dialog-button" |
417 | round | 423 | round |
418 | dark | 424 | dark |
419 | class="right mt-3" | 425 | class="right mt-3" |
420 | @click="selectFeeType" | 426 | @click="selectFeeType" |
421 | >ADD</v-btn> | 427 | >ADD</v-btn> |
422 | </v-flex> | 428 | </v-flex> |
423 | </v-layout> | 429 | </v-layout> |
424 | <table class="feeTypeTable tableRsponsive"> | 430 | <table class="feeTypeTable tableRsponsive"> |
425 | <tr class="info white--text"> | 431 | <tr class="info white--text"> |
426 | <th>#</th> | 432 | <th>#</th> |
427 | <th>Fee Type</th> | 433 | <th>Fee Type</th> |
428 | <th>Amount</th> | 434 | <th>Amount</th> |
429 | <th>Discount</th> | 435 | <th>Discount</th> |
430 | <th>Subtotal</th> | 436 | <th>Subtotal</th> |
431 | <th>Paid Amount</th> | 437 | <th>Paid Amount</th> |
432 | <th>Action</th> | 438 | <th>Action</th> |
433 | </tr> | 439 | </tr> |
434 | <tr | 440 | <tr |
435 | v-show="showFeeType" | 441 | v-show="showFeeType" |
436 | v-for="(feeType, index) in feeTypeData" | 442 | v-for="(feeType, index) in feeTypeData" |
437 | :key="index" | 443 | :key="index" |
438 | v-on:keyup="getAmmountDetails(feeType)" | 444 | v-on:keyup="getAmmountDetails(feeType)" |
439 | > | 445 | > |
440 | <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td> | 446 | <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td> |
441 | <td | 447 | <td |
442 | style="width:120px" | 448 | style="width:120px" |
443 | class="tdFeeType" | 449 | class="tdFeeType" |
444 | :rules="feeTypeNameRules" | 450 | :rules="feeTypeNameRules" |
445 | >{{ feeType.feeTypeName }}</td> | 451 | >{{ feeType.feeTypeName }}</td> |
446 | <td class="tdFeeType"> | 452 | <td class="tdFeeType"> |
447 | <v-text-field | 453 | <v-text-field |
448 | placeholder="fill your Amount" | 454 | placeholder="fill your Amount" |
449 | v-model="feeType.amount" | 455 | v-model="feeType.amount" |
450 | type="number" | 456 | type="number" |
451 | :rules="amountRules" | 457 | :rules="amountRules" |
452 | required | 458 | required |
453 | ></v-text-field> | 459 | ></v-text-field> |
454 | </td> | 460 | </td> |
455 | <td class="tdFeeType"> | 461 | <td class="tdFeeType"> |
456 | <v-text-field | 462 | <v-text-field |
457 | placeholder="fill your Discount" | 463 | placeholder="fill your Discount" |
458 | v-model="feeType.discount" | 464 | v-model="feeType.discount" |
459 | type="number" | 465 | type="number" |
460 | :rules="discountRules" | 466 | :rules="discountRules" |
461 | required | 467 | required |
462 | ></v-text-field> | 468 | ></v-text-field> |
463 | </td> | 469 | </td> |
464 | <td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td> | 470 | <td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td> |
465 | <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'"> | 471 | <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'"> |
466 | <v-text-field | 472 | <v-text-field |
467 | placeholder="fill your Paid Amount" | 473 | placeholder="fill your Paid Amount" |
468 | v-model="feeType.paidAmount" | 474 | v-model="feeType.paidAmount" |
469 | type="number" | 475 | type="number" |
470 | :disabled="disabled" | 476 | :disabled="disabled" |
471 | ></v-text-field> | 477 | ></v-text-field> |
472 | </td> | 478 | </td> |
473 | <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''"> | 479 | <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''"> |
474 | <v-text-field | 480 | <v-text-field |
475 | placeholder="fill your Paid Amount" | 481 | placeholder="fill your Paid Amount" |
476 | v-model="feeType.paidAmount" | 482 | v-model="feeType.paidAmount" |
477 | type="number" | 483 | type="number" |
478 | :disabled="disabled" | 484 | :disabled="disabled" |
479 | ></v-text-field> | 485 | ></v-text-field> |
480 | </td> | 486 | </td> |
481 | <td | 487 | <td |
482 | class="tdFeeType" | 488 | class="tdFeeType" |
483 | v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''" | 489 | v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''" |
484 | > | 490 | > |
485 | <v-text-field | 491 | <v-text-field |
486 | placeholder="fill your Paid Amount" | 492 | placeholder="fill your Paid Amount" |
487 | v-model="feeType.paidAmount" | 493 | v-model="feeType.paidAmount" |
488 | type="number" | 494 | type="number" |
489 | ></v-text-field> | 495 | ></v-text-field> |
490 | </td> | 496 | </td> |
491 | <td class="tdFeeType"> | 497 | <td class="tdFeeType"> |
492 | <v-icon color="error" @click="deleteSelectFee(index,feeType)">delete</v-icon> | 498 | <v-icon color="error" @click="deleteSelectFee(index,feeType)">delete</v-icon> |
493 | </td> | 499 | </td> |
494 | </tr> | 500 | </tr> |
495 | <tfoot> | 501 | <tfoot> |
496 | <tr> | 502 | <tr> |
497 | <td colspan="2" class="tdFeeType">Total:</td> | 503 | <td colspan="2" class="tdFeeType">Total:</td> |
498 | <td class="tdFeeType">{{ feeType.amount }}</td> | 504 | <td class="tdFeeType">{{ feeType.amount }}</td> |
499 | <td class="tdFeeType">{{ feeType.discount }}</td> | 505 | <td class="tdFeeType">{{ feeType.discount }}</td> |
500 | <td class="tdFeeType">{{ feeType.subTotal }}</td> | 506 | <td class="tdFeeType">{{ feeType.subTotal }}</td> |
501 | <td class="tdFeeType">{{ feeType.paidAmount }}</td> | 507 | <td class="tdFeeType">{{ feeType.paidAmount }}</td> |
502 | <!-- <td class="tdFeeType"> | 508 | <!-- <td class="tdFeeType"> |
503 | <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon> | 509 | <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon> |
504 | </td>--> | 510 | </td>--> |
505 | </tr> | 511 | </tr> |
506 | </tfoot> | 512 | </tfoot> |
507 | </table> | 513 | </table> |
508 | </v-card> | 514 | </v-card> |
509 | </v-flex> | 515 | </v-flex> |
510 | </v-layout> | 516 | </v-layout> |
511 | </v-container> | 517 | </v-container> |
512 | </v-flex> | 518 | </v-flex> |
513 | </v-card> | 519 | </v-card> |
514 | </v-dialog> | 520 | </v-dialog> |
515 | <div class="loader" v-if="showLoader"> | 521 | <div class="loader" v-if="showLoader"> |
516 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 522 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
517 | </div> | 523 | </div> |
518 | </v-container> | 524 | </v-container> |
519 | </template> | 525 | </template> |
520 | 526 | ||
521 | <script> | 527 | <script> |
522 | import http from "@/Services/http.js"; | 528 | import http from "@/Services/http.js"; |
523 | import editInvoice from "./editInvoice"; | 529 | import editInvoice from "./editInvoice"; |
524 | import paymentTemplate from "./paymentTemplate.vue"; | 530 | import paymentTemplate from "./paymentTemplate.vue"; |
525 | import moment from "moment"; | 531 | import moment from "moment"; |
526 | 532 | ||
527 | export default { | 533 | export default { |
528 | components: { | 534 | components: { |
529 | editInvoice: editInvoice, | 535 | editInvoice: editInvoice, |
530 | paymentTemplate: paymentTemplate | 536 | paymentTemplate: paymentTemplate, |
531 | }, | 537 | }, |
532 | data: () => ({ | 538 | data: () => ({ |
533 | snackbar: false, | 539 | snackbar: false, |
534 | showPayMethods: false, | 540 | showPayMethods: false, |
535 | y: "top", | 541 | y: "top", |
536 | x: "right", | 542 | x: "right", |
537 | mode: "", | 543 | mode: "", |
538 | timeout: 5000, | 544 | timeout: 5000, |
539 | text: "", | 545 | text: "", |
540 | color: "", | 546 | color: "", |
541 | show: true, | 547 | show: true, |
542 | showSearch: false, | 548 | showSearch: false, |
543 | showLoader: false, | 549 | showLoader: false, |
544 | loading: false, | 550 | loading: false, |
545 | date: null, | 551 | date: null, |
546 | search: "", | 552 | search: "", |
547 | dialog: false, | 553 | dialog: false, |
548 | dialog1: false, | 554 | dialog1: false, |
549 | valid: true, | 555 | valid: true, |
550 | validEdit: true, | 556 | validEdit: true, |
551 | isActive: true, | 557 | isActive: true, |
552 | newActive: false, | 558 | newActive: false, |
553 | showFeeType: true, | 559 | showFeeType: true, |
554 | addInvoiceDialog: false, | 560 | addInvoiceDialog: false, |
555 | editInvoiceDialog: false, | 561 | editInvoiceDialog: false, |
556 | paymentInvoiceDialog: false, | 562 | paymentInvoiceDialog: false, |
557 | disabled: true, | 563 | disabled: true, |
558 | details: [], | 564 | details: [], |
559 | feeTypes: [], | 565 | feeTypes: [], |
560 | invoiceData: [], | 566 | invoiceData: [], |
561 | editData: [], | 567 | editData: [], |
562 | invoiceList: [], | 568 | invoiceList: [], |
563 | editPayment: { | 569 | editPayment: { |
564 | studentId: { | 570 | studentId: { |
565 | name: "", | 571 | name: "", |
566 | rollNo: "" | 572 | rollNo: "", |
567 | }, | 573 | }, |
568 | classId: { | 574 | classId: { |
569 | classNum: "" | 575 | classNum: "", |
570 | } | 576 | }, |
571 | }, | 577 | }, |
572 | menu1: false, | 578 | menu1: false, |
573 | paymentMethods: ["Cash", "Cheque"], | 579 | paymentMethods: ["Cash", "Cheque"], |
574 | feeType: { | 580 | feeType: { |
575 | amount: "0.00", | 581 | amount: "0.00", |
576 | discount: "0.00", | 582 | discount: "0.00", |
577 | subTotal: "0.00", | 583 | subTotal: "0.00", |
578 | paidAmount: "0.00", | 584 | paidAmount: "0.00", |
579 | feeTypeName: "" | 585 | feeTypeName: "", |
580 | }, | 586 | }, |
581 | 587 | ||
582 | feeTypeData: [], | 588 | feeTypeData: [], |
583 | editFeeTypeData: [], | 589 | editFeeTypeData: [], |
584 | paymentFeeTypeData: [], | 590 | paymentFeeTypeData: [], |
585 | pagination: { | 591 | pagination: { |
586 | rowsPerPage: 10 | 592 | rowsPerPage: 10, |
587 | }, | 593 | }, |
588 | classRules: [v => !!v || " Class Name is required"], | 594 | classRules: [(v) => !!v || " Class Name is required"], |
589 | inchargeRules: [v => !!v || "Student Name is required"], | 595 | inchargeRules: [(v) => !!v || "Student Name is required"], |
590 | dateRules: [v => !!v || " Date is required"], | 596 | dateRules: [(v) => !!v || " Date is required"], |
591 | paymentStatusRules: [v => !!v || "Payment Status is required"], | 597 | paymentStatusRules: [(v) => !!v || "Payment Status is required"], |
592 | paymentMethodsRules: [v => !!v || "payment Method is required"], | 598 | paymentMethodsRules: [(v) => !!v || "payment Method is required"], |
593 | feeTypeRules: [v => !!v || "Fee Type is required"], | 599 | feeTypeRules: [(v) => !!v || "Fee Type is required"], |
594 | feeTypeNameRules: [v => !!v || "Fee Type Name is required"], | 600 | feeTypeNameRules: [(v) => !!v || "Fee Type Name is required"], |
595 | amountRules: [v => !!v || "Amount is required"], | 601 | amountRules: [(v) => !!v || "Amount is required"], |
596 | discountRules: [v => !!v || "Discount is required"], | 602 | discountRules: [(v) => !!v || "Discount is required"], |
597 | subtotalRules: [v => !!v || "Subtotal is required"], | 603 | subtotalRules: [(v) => !!v || "Subtotal is required"], |
598 | paymentRules: [v => !!v || "Payment is required"], | 604 | paymentRules: [(v) => !!v || "Payment is required"], |
599 | paidAmountRules: [v => !!v || "Paid Amount is required"], | 605 | paidAmountRules: [(v) => !!v || "Paid Amount is required"], |
600 | paymentMethodRules: [], | 606 | paymentMethodRules: [], |
601 | headers: [ | 607 | headers: [ |
602 | { | 608 | { |
603 | text: "No", | 609 | text: "No", |
604 | align: "", | 610 | align: "", |
605 | sortable: false, | 611 | sortable: false, |
606 | value: "No" | 612 | value: "No", |
607 | }, | 613 | }, |
608 | { | 614 | { |
609 | text: "Student", | 615 | text: "Student", |
610 | value: "name", | 616 | value: "name", |
611 | sortable: false, | 617 | sortable: false, |
612 | align: "center" | 618 | align: "center", |
613 | }, | 619 | }, |
614 | { text: "Class", value: "class", sortable: false, align: "center" }, | 620 | { text: "Class", value: "class", sortable: false, align: "center" }, |
615 | { text: "Total", value: "subtotal", sortable: false, align: "center" }, | 621 | { text: "Total", value: "subtotal", sortable: false, align: "center" }, |
616 | { | 622 | { |
617 | text: "Discount", | 623 | text: "Discount", |
618 | value: "discount", | 624 | value: "discount", |
619 | sortable: false, | 625 | sortable: false, |
620 | align: "center" | 626 | align: "center", |
621 | }, | 627 | }, |
622 | { | 628 | { |
623 | text: "Paid Amount", | 629 | text: "Paid Amount", |
624 | value: "paidAmount", | 630 | value: "paidAmount", |
625 | sortable: false, | 631 | sortable: false, |
626 | align: "center" | 632 | align: "center", |
627 | }, | 633 | }, |
628 | { | 634 | { |
629 | text: "Balance", | 635 | text: "Balance", |
630 | value: "Balance", | 636 | value: "Balance", |
631 | sortable: false, | 637 | sortable: false, |
632 | align: "center" | 638 | align: "center", |
633 | }, | 639 | }, |
634 | { | 640 | { |
635 | text: "Status", | 641 | text: "Status", |
636 | value: "paymentStatus", | 642 | value: "paymentStatus", |
637 | sortable: false, | 643 | sortable: false, |
638 | align: "center" | 644 | align: "center", |
639 | }, | 645 | }, |
640 | { | 646 | { |
641 | text: "Date", | 647 | text: "Date", |
642 | value: "date", | 648 | value: "date", |
643 | sortable: false, | 649 | sortable: false, |
644 | align: "center" | 650 | align: "center", |
645 | }, | 651 | }, |
646 | { text: "Action", value: "", sortable: false, align: "center" } | 652 | { text: "Action", value: "", sortable: false, align: "center" }, |
647 | ], | 653 | ], |
648 | 654 | ||
649 | studentId: { | 655 | studentId: { |
650 | name: "" | 656 | name: "", |
651 | }, | 657 | }, |
652 | token: "", | 658 | token: "", |
653 | editedItem: {}, | 659 | editedItem: {}, |
654 | invoiceData: { | 660 | invoiceData: { |
655 | paymentStatus: "", | 661 | paymentStatus: "", |
656 | students: [] | 662 | students: [], |
657 | }, | 663 | }, |
658 | addclass: [], | 664 | addclass: [], |
659 | studentList: [], | 665 | studentList: [], |
660 | paymentStatus: [ | 666 | paymentStatus: [ |
661 | { | 667 | { |
662 | name: "Not Paid", | 668 | name: "Not Paid", |
663 | value: "NOT_PAID" | 669 | value: "NOT_PAID", |
664 | }, | 670 | }, |
665 | { | 671 | { |
666 | name: "Partially Paid", | 672 | name: "Partially Paid", |
667 | value: "PARTIALLY_PAID" | 673 | value: "PARTIALLY_PAID", |
668 | }, | 674 | }, |
669 | { | 675 | { |
670 | name: "Fully Paid", | 676 | name: "Fully Paid", |
671 | value: "FULLY_PAID" | 677 | value: "FULLY_PAID", |
672 | } | 678 | }, |
673 | ] | 679 | ], |
674 | }), | 680 | }), |
681 | watch: { | ||
682 | addInvoiceDialog: function (val) { | ||
683 | if (!val) { | ||
684 | this.invoiceData = []; | ||
685 | this.menu1 = false; | ||
686 | this.feeType = []; | ||
687 | this.feeTypeData = []; | ||
688 | } | ||
689 | }, | ||
690 | }, | ||
675 | methods: { | 691 | methods: { |
676 | save(date) { | 692 | save(date) { |
677 | this.$refs.menu1.save(date); | 693 | this.$refs.menu1.save(date); |
678 | }, | 694 | }, |
679 | dates: function(date) { | 695 | dates: function (date) { |
680 | return moment(date).format("MMMM DD, YYYY"); | 696 | return moment(date).format("MMMM DD, YYYY"); |
681 | }, | 697 | }, |
682 | profile(item) { | 698 | profile(item) { |
683 | // console.log("item", item); | 699 | // console.log("item", item); |
684 | this.editedIndex = this.invoiceList.indexOf(item); | 700 | this.editedIndex = this.invoiceList.indexOf(item); |
685 | this.editedItem = Object.assign({}, item); | 701 | this.editedItem = Object.assign({}, item); |
686 | console.log("editedItem", this.editedItem); | 702 | console.log("editedItem", this.editedItem); |
687 | this.dialog1 = true; | 703 | this.dialog1 = true; |
688 | }, | 704 | }, |
689 | editItem(item) { | 705 | editItem(item) { |
690 | this.editedIndex = this.invoiceList.indexOf(item); | 706 | this.editedIndex = this.invoiceList.indexOf(item); |
691 | this.editData = Object.assign({}, item); | 707 | this.editData = Object.assign({}, item); |
692 | this.editData.date = this.editData.date.slice(0, 10); | 708 | this.editData.date = this.editData.date.slice(0, 10); |
693 | // console.log("invoiceData", this.editData); | 709 | // console.log("invoiceData", this.editData); |
694 | this.editFeeTypeData = this.editData.feeType; | 710 | this.editFeeTypeData = this.editData.feeType; |
695 | this.editInvoiceDialog = true; | 711 | this.editInvoiceDialog = true; |
696 | }, | 712 | }, |
697 | paymentItem(item) { | 713 | paymentItem(item) { |
698 | // console.log("item", item); | 714 | // console.log("item", item); |
699 | this.editedIndex = this.invoiceList.indexOf(item); | 715 | this.editedIndex = this.invoiceList.indexOf(item); |
700 | this.editPayment = Object.assign({}, item); | 716 | this.editPayment = Object.assign({}, item); |
701 | this.editPayment.date = this.editPayment.date.slice(0, 10); | 717 | this.editPayment.date = this.editPayment.date.slice(0, 10); |
702 | if (this.editPayment.paymentStatus == "NOT_PAID") { | 718 | if (this.editPayment.paymentStatus == "NOT_PAID") { |
703 | for (let i = 0; i < this.editPayment.feeType.length; i++) { | 719 | for (let i = 0; i < this.editPayment.feeType.length; i++) { |
704 | this.editPayment.feeType[i].paidAmount = "0.00"; | 720 | this.editPayment.feeType[i].paidAmount = "0.00"; |
705 | } | 721 | } |
706 | } | 722 | } |
707 | // console.log("this.editPayment", this.editPayment); | 723 | // console.log("this.editPayment", this.editPayment); |
708 | this.paymentFeeTypeData = this.editPayment.feeType; | 724 | this.paymentFeeTypeData = this.editPayment.feeType; |
709 | this.paymentInvoiceDialog = true; | 725 | this.paymentInvoiceDialog = true; |
710 | }, | 726 | }, |
711 | deleteItem(item) { | 727 | deleteItem(item) { |
712 | let deleteInvoice = { | 728 | let deleteInvoice = { |
713 | invoiceId: item._id | 729 | invoiceId: item._id, |
714 | }; | 730 | }; |
715 | http() | 731 | http() |
716 | .delete( | 732 | .delete( |
717 | "/deleteInvoice", | 733 | "/deleteInvoice", |
718 | confirm("Are you sure you want to delete this?") && { | 734 | confirm("Are you sure you want to delete this?") && { |
719 | params: deleteInvoice | 735 | params: deleteInvoice, |
720 | } | 736 | } |
721 | ) | 737 | ) |
722 | .then(response => { | 738 | .then((response) => { |
723 | this.snackbar = true; | 739 | this.snackbar = true; |
724 | this.text = "Successfully delete Existing Invoice"; | 740 | this.text = "Successfully delete Existing Invoice"; |
725 | this.color = "green"; | 741 | this.color = "green"; |
726 | this.dialog1 = false; | 742 | this.dialog1 = false; |
727 | this.getInvoiceList(); | 743 | this.getInvoiceList(); |
728 | }) | 744 | }) |
729 | .catch(error => { | 745 | .catch((error) => { |
730 | // console.log(error); | 746 | // console.log(error); |
731 | }); | 747 | }); |
732 | }, | 748 | }, |
733 | deletePayment(editedItem) { | 749 | deletePayment(editedItem) { |
734 | let deleteInvoice = { | 750 | let deleteInvoice = { |
735 | invoiceId: editedItem._id | 751 | invoiceId: editedItem._id, |
736 | }; | 752 | }; |
737 | http() | 753 | http() |
738 | .put( | 754 | .put( |
739 | "/removePayment", | 755 | "/removePayment", |
740 | deleteInvoice, | 756 | deleteInvoice, |
741 | confirm("Are you sure you want to delete this?") && { | 757 | confirm("Are you sure you want to delete this?") && { |
742 | headers: { | 758 | headers: { |
743 | Authorization: "Bearer " + this.token | 759 | Authorization: "Bearer " + this.token, |
744 | } | 760 | }, |
745 | } | 761 | } |
746 | ) | 762 | ) |
747 | .then(response => { | 763 | .then((response) => { |
748 | this.snackbar = true; | 764 | this.snackbar = true; |
749 | this.text = "Successfully delete Existing Invoice"; | 765 | this.text = "Successfully delete Existing Invoice"; |
750 | this.color = "green"; | 766 | this.color = "green"; |
751 | this.dialog1 = false; | 767 | this.dialog1 = false; |
752 | this.getInvoiceList(); | 768 | this.getInvoiceList(); |
753 | }) | 769 | }) |
754 | .catch(error => { | 770 | .catch((error) => { |
755 | // console.log(error); | 771 | // console.log(error); |
756 | }); | 772 | }); |
757 | }, | 773 | }, |
758 | close() { | 774 | close() { |
759 | this.dialog = false; | 775 | this.dialog = false; |
760 | }, | 776 | }, |
777 | closeAddInvoiceModel() { | ||
778 | this.addInvoiceDialog = false; | ||
779 | this.invoiceData = []; | ||
780 | this.menu1 = false; | ||
781 | this.feeType = []; | ||
782 | this.feeTypeData = []; | ||
783 | }, | ||
761 | // totalAmount() { | 784 | // totalAmount() { |
762 | // // console.log("this.feeType.paidAmount ", this.feeType.paidAmount); | 785 | // // console.log("this.feeType.paidAmount ", this.feeType.paidAmount); |
763 | // // console.log( | 786 | // // console.log( |
764 | // // "this.feeType.subTotalAAAAAAAAAAAAAAA ", | 787 | // // "this.feeType.subTotalAAAAAAAAAAAAAAA ", |
765 | // // this.feeType.subTotal | 788 | // // this.feeType.subTotal |
766 | // // ); | 789 | // // ); |
767 | 790 | ||
768 | // if (this.feeType.paidAmount < this.feeType.subTotal) { | 791 | // if (this.feeType.paidAmount < this.feeType.subTotal) { |
769 | // console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal); | 792 | // console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal); |
770 | 793 | ||
771 | // this.feeType.paidAmount = this.feeType.subTotal; | 794 | // this.feeType.paidAmount = this.feeType.subTotal; |
772 | // console.log( | 795 | // console.log( |
773 | // "this.feeType.paidAmount BBBBBBBBBBB", | 796 | // "this.feeType.paidAmount BBBBBBBBBBB", |
774 | // this.feeType.paidAmount | 797 | // this.feeType.paidAmount |
775 | // ); | 798 | // ); |
776 | // } | 799 | // } |
777 | // }, | 800 | // }, |
778 | submit() { | 801 | submit() { |
779 | let feeTypeId = ""; | 802 | let feeTypeId = ""; |
780 | for (let i = 0; i < this.feeTypes.length; i++) { | 803 | for (let i = 0; i < this.feeTypes.length; i++) { |
781 | if (this.feeTypes[i].feeType === this.feeType.feeTypeName) { | 804 | if (this.feeTypes[i].feeType === this.feeType.feeTypeName) { |
782 | feeTypeId = this.feeTypes[i]._id; | 805 | feeTypeId = this.feeTypes[i]._id; |
783 | } | 806 | } |
784 | } | 807 | } |
785 | if (this.$refs.form.validate()) { | 808 | if (this.$refs.form.validate()) { |
786 | let invoiceData = { | 809 | let invoiceData = { |
787 | classId: this.invoiceData.classNum, | 810 | classId: this.invoiceData.classNum, |
788 | students: this.invoiceData.students, | 811 | students: this.invoiceData.students, |
789 | date: this.invoiceData.date, | 812 | date: this.invoiceData.date, |
790 | paymentStatus: this.invoiceData.paymentStatus, | 813 | paymentStatus: this.invoiceData.paymentStatus, |
791 | paymentMethod: this.invoiceData.paymentMethod, | 814 | paymentMethod: this.invoiceData.paymentMethod, |
792 | feeType: this.feeTypeData, | 815 | feeType: this.feeTypeData, |
793 | totalAmount: this.feeType.amount.toString(), | 816 | totalAmount: this.feeType.amount.toString(), |
794 | totalDiscount: this.feeType.discount.toString(), | 817 | totalDiscount: this.feeType.discount.toString(), |
795 | totalSubTotal: this.feeType.subTotal.toString(), | 818 | totalSubTotal: this.feeType.subTotal.toString(), |
796 | totalPaidAmount: this.feeType.paidAmount | 819 | totalPaidAmount: this.feeType.paidAmount, |
797 | }; | 820 | }; |
798 | 821 | ||
799 | if (invoiceData.paymentStatus == "NOT_PAID") { | 822 | if (invoiceData.paymentStatus == "NOT_PAID") { |
800 | delete invoiceData.paymentMethod; | 823 | delete invoiceData.paymentMethod; |
801 | } | 824 | } |
802 | if (this.feeType.paidAmount != "0.00") { | 825 | if (this.feeType.paidAmount != "0.00") { |
803 | if (this.feeType.subTotal == this.feeType.paidAmount) { | 826 | if (this.feeType.subTotal == this.feeType.paidAmount) { |
804 | invoiceData.paymentStatus = "FULLY_PAID"; | 827 | invoiceData.paymentStatus = "FULLY_PAID"; |
805 | // console.log("FULLY_PAID"); | 828 | // console.log("FULLY_PAID"); |
806 | } | 829 | } |
807 | if (invoiceData.totalPaidAmount) { | 830 | if (invoiceData.totalPaidAmount) { |
808 | if (this.feeType.subTotal != this.feeType.paidAmount) { | 831 | if (this.feeType.subTotal != this.feeType.paidAmount) { |
809 | invoiceData.paymentStatus = "PARTIALLY_PAID"; | 832 | invoiceData.paymentStatus = "PARTIALLY_PAID"; |
810 | // console.log("PARTIALLY_PAID"); | 833 | // console.log("PARTIALLY_PAID"); |
811 | } | 834 | } |
812 | } | 835 | } |
813 | } | 836 | } |
814 | 837 | ||
815 | if (invoiceData.totalSubTotal == "0.00") { | 838 | if (invoiceData.totalSubTotal == "0.00") { |
816 | invoiceData.paymentStatus = "FULLY_PAID"; | 839 | invoiceData.paymentStatus = "FULLY_PAID"; |
817 | } else if (invoiceData.totalSubTotal != "0.00") { | 840 | } else if (invoiceData.totalSubTotal != "0.00") { |
818 | if (this.feeType.paidAmount === "0.00") { | 841 | if (this.feeType.paidAmount === "0.00") { |
819 | invoiceData.paymentStatus = "NOT_PAID"; | 842 | invoiceData.paymentStatus = "NOT_PAID"; |
820 | delete invoiceData.paymentMethod; | 843 | delete invoiceData.paymentMethod; |
821 | } | 844 | } |
822 | } | 845 | } |
823 | http() | 846 | http() |
824 | .post("/createInvoice", invoiceData) | 847 | .post("/createInvoice", invoiceData) |
825 | .then(response => { | 848 | .then((response) => { |
826 | this.getInvoiceList(); | 849 | this.getInvoiceList(); |
827 | this.snackbar = true; | 850 | this.snackbar = true; |
828 | this.text = "New Invoice added successfully"; | 851 | this.text = "New Invoice added successfully"; |
829 | this.color = "green"; | 852 | this.color = "green"; |
830 | this.clear(); | 853 | this.clear(); |
831 | this.feeTypeData = []; | 854 | this.feeTypeData = []; |
832 | if (this.feeTypeData.length == 0) { | 855 | if (this.feeTypeData.length == 0) { |
833 | this.feeType = { | 856 | this.feeType = { |
834 | amount: "0.00", | 857 | amount: "0.00", |
835 | discount: "0.00", | 858 | discount: "0.00", |
836 | paidAmount: "0.00", | 859 | paidAmount: "0.00", |
837 | subTotal: "0.00", | 860 | subTotal: "0.00", |
838 | feeTypeList: "" | 861 | feeTypeList: "", |
839 | }; | 862 | }; |
840 | } | 863 | } |
841 | this.loading = false; | 864 | this.loading = false; |
842 | this.addInvoiceDialog = false; | 865 | this.addInvoiceDialog = false; |
843 | }) | 866 | }) |
844 | .catch(error => { | 867 | .catch((error) => { |
845 | this.snackbar = true; | 868 | this.snackbar = true; |
846 | this.text = error.response.data.errors[0].messages[0]; | 869 | this.text = error.response.data.errors[0].messages[0]; |
847 | this.color = "error"; | 870 | this.color = "error"; |
848 | this.loading = false; | 871 | this.loading = false; |
849 | }); | 872 | }); |
850 | } | 873 | } |
851 | }, | 874 | }, |
852 | clear() { | 875 | clear() { |
853 | this.$refs.form.reset(); | 876 | this.$refs.form.reset(); |
854 | }, | 877 | }, |
855 | getInvoiceList() { | 878 | getInvoiceList() { |
856 | this.showLoader = true; | 879 | this.showLoader = true; |
857 | http() | 880 | http() |
858 | .get("/getInvoicesList", { | 881 | .get("/getInvoicesList", { |
859 | params: { schoolId: this.$store.state.schoolId }, | 882 | params: { schoolId: this.$store.state.schoolId }, |
860 | headers: { Authorization: "Bearer " + this.token } | 883 | headers: { Authorization: "Bearer " + this.token }, |
861 | }) | 884 | }) |
862 | .then(response => { | 885 | .then((response) => { |
863 | this.invoiceList = response.data.data; | 886 | this.invoiceList = response.data.data; |
864 | this.showLoader = false; | 887 | this.showLoader = false; |
865 | }) | 888 | }) |
866 | .catch(error => { | 889 | .catch((error) => { |
867 | // console.log("err====>", err); | 890 | // console.log("err====>", err); |
868 | this.showLoader = false; | 891 | this.showLoader = false; |
869 | if (error.response.status === 401) { | 892 | if (error.response.status === 401) { |
870 | this.$router.replace({ path: "/" }); | 893 | this.$router.replace({ path: "/" }); |
871 | this.$store.dispatch("setToken", null); | 894 | this.$store.dispatch("setToken", null); |
872 | this.$store.dispatch("Id", null); | 895 | this.$store.dispatch("Id", null); |
873 | } | 896 | } |
874 | }); | 897 | }); |
875 | }, | 898 | }, |
876 | selectFeeType() { | 899 | selectFeeType() { |
877 | this.showFeeType = true; | 900 | this.showFeeType = true; |
878 | this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName }); | 901 | this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName }); |
879 | }, | 902 | }, |
880 | deleteSelectFee: function(index, feeTyp) { | 903 | deleteSelectFee: function (index, feeTyp) { |
881 | console.log("---index----", index); | 904 | console.log("---index----", index); |
882 | this.feeTypeData.splice(index, 1); | 905 | this.feeTypeData.splice(index, 1); |
883 | this.getAmmountDetails(feeTyp); | 906 | this.getAmmountDetails(feeTyp); |
884 | if (this.feeTypeData.length == 0) { | 907 | if (this.feeTypeData.length == 0) { |
885 | this.feeType = { | 908 | this.feeType = { |
886 | amount: "0.00", | 909 | amount: "0.00", |
887 | discount: "0.00", | 910 | discount: "0.00", |
888 | paidAmount: "0.00", | 911 | paidAmount: "0.00", |
889 | subTotal: "0.00", | 912 | subTotal: "0.00", |
890 | feeTypeName: "" | 913 | feeTypeName: "", |
891 | }; | 914 | }; |
892 | } | 915 | } |
893 | }, | 916 | }, |
894 | getAllClasses() { | 917 | getAllClasses() { |
895 | http() | 918 | http() |
896 | .get("/getClassesList", { | 919 | .get("/getClassesList", { |
897 | params: { schoolId: this.$store.state.schoolId }, | 920 | params: { schoolId: this.$store.state.schoolId }, |
898 | headers: { Authorization: "Bearer " + this.token } | 921 | headers: { Authorization: "Bearer " + this.token }, |
899 | }) | 922 | }) |
900 | .then(response => { | 923 | .then((response) => { |
901 | this.addclass = response.data.data; | 924 | this.addclass = response.data.data; |
902 | }) | 925 | }) |
903 | .catch(err => { | 926 | .catch((err) => { |
904 | // console.log("err====>", err); | 927 | // console.log("err====>", err); |
905 | // this.$router.replace({ path: "/" }); | 928 | // this.$router.replace({ path: "/" }); |
906 | }); | 929 | }); |
907 | }, | 930 | }, |
908 | getAllStudents() { | 931 | getAllStudents() { |
909 | this.showLoader = true; | 932 | this.showLoader = true; |
910 | http() | 933 | http() |
911 | .get("/getStudentsList", { | 934 | .get("/getStudentsList", { |
912 | params: { | 935 | params: { |
913 | classId: this.invoiceData.classNum, | 936 | classId: this.invoiceData.classNum, |
914 | schoolId: this.$store.state.schoolId | 937 | schoolId: this.$store.state.schoolId, |
915 | }, | 938 | }, |
916 | headers: { Authorization: "Bearer " + this.token } | 939 | headers: { Authorization: "Bearer " + this.token }, |
917 | }) | 940 | }) |
918 | .then(response => { | 941 | .then((response) => { |
919 | response.data.data.unshift({ | 942 | response.data.data.unshift({ |
920 | name: "Select All", | 943 | name: "Select All", |
921 | _id: "Select All" | 944 | _id: "Select All", |
922 | }); | 945 | }); |
923 | this.studentList = response.data.data; | 946 | this.studentList = response.data.data; |
924 | this.showLoader = false; | 947 | this.showLoader = false; |
925 | }) | 948 | }) |
926 | .catch(err => { | 949 | .catch((err) => { |
927 | this.showLoader = false; | 950 | this.showLoader = false; |
928 | // console.log("err====>", err); | 951 | // console.log("err====>", err); |
929 | // this.$router.replace({ path: "/" }); | 952 | // this.$router.replace({ path: "/" }); |
930 | }); | 953 | }); |
931 | }, | 954 | }, |
932 | getfeeType() { | 955 | getfeeType() { |
933 | http() | 956 | http() |
934 | .get("/getFeesList", { | 957 | .get("/getFeesList", { |
935 | params: { | 958 | params: { |
936 | schoolId: this.$store.state.schoolId | 959 | schoolId: this.$store.state.schoolId, |
937 | }, | 960 | }, |
938 | headers: { Authorization: "Bearer " + this.token } | 961 | headers: { Authorization: "Bearer " + this.token }, |
939 | }) | 962 | }) |
940 | .then(response => { | 963 | .then((response) => { |
941 | this.feeTypes = response.data.data; | 964 | this.feeTypes = response.data.data; |
942 | }) | 965 | }) |
943 | .catch(err => { | 966 | .catch((err) => { |
944 | // console.log("err====>", err); | 967 | // console.log("err====>", err); |
945 | // this.$router.replace({ path: "/" }); | 968 | // this.$router.replace({ path: "/" }); |
946 | }); | 969 | }); |
947 | }, | 970 | }, |
948 | 971 | ||
949 | getAmmountDetails(feeTyp) { | 972 | getAmmountDetails(feeTyp) { |
950 | let feeType = { | 973 | let feeType = { |
951 | amount: "0.00", | 974 | amount: "0.00", |
952 | discount: "0.00", | 975 | discount: "0.00", |
953 | subTotal: "0.00", | 976 | subTotal: "0.00", |
954 | subParticularTotal: "0.00", | 977 | subParticularTotal: "0.00", |
955 | paidAmount: "" | 978 | paidAmount: "", |
956 | }; | 979 | }; |
957 | for (let i = 0; i < this.feeTypeData.length; i++) { | 980 | for (let i = 0; i < this.feeTypeData.length; i++) { |
958 | // *********** AMOUNT *********** | 981 | // *********** AMOUNT *********** |
959 | if (this.feeTypeData[i].amount) { | 982 | if (this.feeTypeData[i].amount) { |
960 | feeType.amount = | 983 | feeType.amount = |
961 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); | 984 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); |
962 | this.feeType.amount = feeType.amount; | 985 | this.feeType.amount = feeType.amount; |
963 | this.feeType.subTotal = feeType.amount; | 986 | this.feeType.subTotal = feeType.amount; |
964 | this.feeTypeData[i].subTotal = this.feeTypeData[i].amount; | 987 | this.feeTypeData[i].subTotal = this.feeTypeData[i].amount; |
965 | } else if (this.feeTypeData[0].amount == "") { | 988 | } else if (this.feeTypeData[0].amount == "") { |
966 | this.feeType.amount = "0.00"; | 989 | this.feeType.amount = "0.00"; |
967 | this.feeTypeData[i].subTotal = "0.00"; | 990 | this.feeTypeData[i].subTotal = "0.00"; |
968 | this.feeType.subTotal = "0.00"; | 991 | this.feeType.subTotal = "0.00"; |
969 | } else if (this.feeTypeData[i].amount == "") { | 992 | } else if (this.feeTypeData[i].amount == "") { |
970 | this.feeType.amount = | 993 | this.feeType.amount = |
971 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); | 994 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); |
972 | this.feeTypeData[i].subTotal = | 995 | this.feeTypeData[i].subTotal = |
973 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); | 996 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); |
974 | this.feeType.subTotal = | 997 | this.feeType.subTotal = |
975 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); | 998 | Number(feeType.amount) + Number(this.feeTypeData[i].amount); |
976 | } | 999 | } |
977 | // *********** DISCOUNT *********** | 1000 | // *********** DISCOUNT *********** |
978 | if (this.feeTypeData[i].discount) { | 1001 | if (this.feeTypeData[i].discount) { |
979 | if ( | 1002 | if ( |
980 | Number(this.feeTypeData[i].discount) < this.feeTypeData[i].amount | 1003 | Number(this.feeTypeData[i].discount) < this.feeTypeData[i].amount |
981 | ) { | 1004 | ) { |
982 | feeType.discount = | 1005 | feeType.discount = |
983 | Number(feeType.discount) + Number(this.feeTypeData[i].discount); | 1006 | Number(feeType.discount) + Number(this.feeTypeData[i].discount); |
984 | this.feeType.discount = feeType.discount; | 1007 | this.feeType.discount = feeType.discount; |
985 | feeType.subParticularTotal = | 1008 | feeType.subParticularTotal = |
986 | this.feeTypeData[i].amount - this.feeTypeData[i].discount; | 1009 | this.feeTypeData[i].amount - this.feeTypeData[i].discount; |
987 | this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed( | 1010 | this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed( |
988 | 2 | 1011 | 2 |
989 | ); | 1012 | ); |
990 | } else if ( | 1013 | } else if ( |
991 | Number(this.feeTypeData[i].discount) >= this.feeTypeData[i].amount | 1014 | Number(this.feeTypeData[i].discount) >= this.feeTypeData[i].amount |
992 | ) { | 1015 | ) { |
993 | this.feeTypeData[i].discount = this.feeTypeData[i].amount; | 1016 | this.feeTypeData[i].discount = this.feeTypeData[i].amount; |
994 | feeType.discount = | 1017 | feeType.discount = |
995 | Number(feeType.discount) + Number(this.feeTypeData[i].discount); | 1018 | Number(feeType.discount) + Number(this.feeTypeData[i].discount); |
996 | this.feeType.discount = feeType.discount.toString(); | 1019 | this.feeType.discount = feeType.discount.toString(); |
997 | feeType.subParticularTotal = | 1020 | feeType.subParticularTotal = |
998 | this.feeTypeData[i].amount - this.feeTypeData[i].discount; | 1021 | this.feeTypeData[i].amount - this.feeTypeData[i].discount; |
999 | this.feeTypeData[ | 1022 | this.feeTypeData[ |
1000 | i | 1023 | i |
1001 | ].subTotal = feeType.subParticularTotal.toString(); | 1024 | ].subTotal = feeType.subParticularTotal.toString(); |
1002 | } | 1025 | } |
1003 | } else if (this.feeTypeData[0].discount == "") { | 1026 | } else if (this.feeTypeData[0].discount == "") { |
1004 | this.feeType.discount = "0.00"; | 1027 | this.feeType.discount = "0.00"; |
1005 | } | 1028 | } |
1006 | // else if (this.feeTypeData[i].discount == "") { | 1029 | // else if (this.feeTypeData[i].discount == "") { |
1007 | // this.feeType.discount = | 1030 | // this.feeType.discount = |
1008 | // Number(feeType.discount) + Number(this.feeTypeData[i].discount); | 1031 | // Number(feeType.discount) + Number(this.feeTypeData[i].discount); |
1009 | // } | 1032 | // } |
1010 | 1033 | ||
1011 | // *********** SUBTOTAL *********** | 1034 | // *********** SUBTOTAL *********** |
1012 | if (this.feeTypeData[i].subTotal) { | 1035 | if (this.feeTypeData[i].subTotal) { |
1013 | feeType.subTotal = | 1036 | feeType.subTotal = |
1014 | Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal); | 1037 | Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal); |
1015 | this.feeType.subTotal = feeType.subTotal.toFixed(2); | 1038 | this.feeType.subTotal = feeType.subTotal.toFixed(2); |
1016 | } | 1039 | } |
1017 | 1040 | ||
1018 | // *********** PAID-AMOUNT *********** | 1041 | // *********** PAID-AMOUNT *********** |
1019 | if (this.feeTypeData[i].paidAmount) { | 1042 | if (this.feeTypeData[i].paidAmount) { |
1020 | feeType.paidAmount = | 1043 | feeType.paidAmount = |
1021 | Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); | 1044 | Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); |
1022 | this.feeType.paidAmount = feeType.paidAmount.toFixed(2); | 1045 | this.feeType.paidAmount = feeType.paidAmount.toFixed(2); |
1023 | } else if (this.feeTypeData[0].paidAmount == "") { | 1046 | } else if (this.feeTypeData[0].paidAmount == "") { |
1024 | this.feeType.paidAmount = "0.00"; | 1047 | this.feeType.paidAmount = "0.00"; |
1025 | } else if (this.feeTypeData[i].paidAmount == "") { | 1048 | } else if (this.feeTypeData[i].paidAmount == "") { |
1026 | this.feeType.paidAmount = feeType.paidAmount = | 1049 | this.feeType.paidAmount = feeType.paidAmount = |
1027 | Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); | 1050 | Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); |
1028 | } | 1051 | } |
1029 | 1052 | ||
1030 | // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value. | 1053 | // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value. |
1031 | if (feeType.paidAmount > feeType.subTotal) { | 1054 | if (feeType.paidAmount > feeType.subTotal) { |
1032 | this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal; | 1055 | this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal; |
1033 | this.feeType.paidAmount = feeType.subTotal; | 1056 | this.feeType.paidAmount = feeType.subTotal; |
1034 | } | 1057 | } |
1035 | } | 1058 | } |
1036 | }, | 1059 | }, |
1037 | getPayMethodList() { | 1060 | getPayMethodList() { |
1038 | if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") { | 1061 | if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") { |
1039 | this.showPayMethods = true; | 1062 | this.showPayMethods = true; |
1040 | this.paymentMethodRules = [v => !!v || "Payment Method is required"]; | 1063 | this.paymentMethodRules = [(v) => !!v || "Payment Method is required"]; |
1041 | } else if (this.invoiceData.paymentStatus == "FULLY_PAID") { | 1064 | } else if (this.invoiceData.paymentStatus == "FULLY_PAID") { |
1042 | this.showPayMethods = true; | 1065 | this.showPayMethods = true; |
1043 | this.paymentMethodRules = [v => !!v || "Payment Method is required"]; | 1066 | this.paymentMethodRules = [(v) => !!v || "Payment Method is required"]; |
1044 | } else if (this.invoiceData.paymentStatus == "NOT_PAID") { | 1067 | } else if (this.invoiceData.paymentStatus == "NOT_PAID") { |
1045 | for (let i = 0; i < this.feeTypeData.length; i++) { | 1068 | for (let i = 0; i < this.feeTypeData.length; i++) { |
1046 | this.feeTypeData[i].paidAmount = "0.00"; | 1069 | this.feeTypeData[i].paidAmount = "0.00"; |
1047 | this.feeType.paidAmount = "0.00"; | 1070 | this.feeType.paidAmount = "0.00"; |
1048 | } | 1071 | } |
1049 | this.paymentMethodRules = ""; | 1072 | this.paymentMethodRules = ""; |
1050 | this.showPayMethods = false; | 1073 | this.showPayMethods = false; |
1051 | } else { | 1074 | } else { |
1052 | this.showPayMethods = false; | 1075 | this.showPayMethods = false; |
1053 | } | 1076 | } |
1054 | }, | 1077 | }, |
1055 | selectAllStudent() { | 1078 | selectAllStudent() { |
1056 | this.invoiceData.students = []; | 1079 | this.invoiceData.students = []; |
1057 | if (this.invoiceData.studentId === "Select All") { | 1080 | if (this.invoiceData.studentId === "Select All") { |
1058 | for (let i = 1; i < this.studentList.length; i++) { | 1081 | for (let i = 1; i < this.studentList.length; i++) { |
1059 | this.invoiceData.students.push(this.studentList[i]._id); | 1082 | this.invoiceData.students.push(this.studentList[i]._id); |
1060 | console.log("data", this.invoiceData.students); | 1083 | console.log("data", this.invoiceData.students); |
1061 | // data.push(this.studentList[i]._id); | 1084 | // data.push(this.studentList[i]._id); |
1062 | // console.log("data", data); | 1085 | // console.log("data", data); |
1063 | } | 1086 | } |
1064 | } else { | 1087 | } else { |
1065 | this.invoiceData.students.push(this.invoiceData.studentId); | 1088 | this.invoiceData.students.push(this.invoiceData.studentId); |
1066 | } | 1089 | } |
1067 | }, | 1090 | }, |
1068 | displaySearch() { | 1091 | displaySearch() { |
1069 | this.show = false; | 1092 | this.show = false; |
1070 | this.showSearch = true; | 1093 | this.showSearch = true; |
1071 | }, | 1094 | }, |
1072 | closeSearch() { | 1095 | closeSearch() { |
1073 | this.showSearch = false; | 1096 | this.showSearch = false; |
1074 | this.show = true; | 1097 | this.show = true; |
1075 | this.search = ""; | 1098 | this.search = ""; |
1076 | }, | 1099 | }, |
1077 | updateDoneInvoice() { | 1100 | updateDoneInvoice() { |
1078 | this.editInvoiceDialog = false; | 1101 | this.editInvoiceDialog = false; |
1079 | this.getInvoiceList(); | 1102 | this.getInvoiceList(); |
1080 | }, | 1103 | }, |
1081 | updatePayment() { | 1104 | updatePayment() { |
1082 | this.paymentInvoiceDialog = false; | 1105 | this.paymentInvoiceDialog = false; |
1083 | this.getInvoiceList(); | 1106 | this.getInvoiceList(); |
1084 | this.snackbar = true; | 1107 | this.snackbar = true; |
1085 | this.text = "Payment added successfully"; | 1108 | this.text = "Payment added successfully"; |
1086 | this.color = "green"; | 1109 | this.color = "green"; |
1087 | } | 1110 | }, |
1088 | }, | 1111 | }, |
1089 | mounted() { | 1112 | mounted() { |
1090 | this.token = this.$store.state.token; | 1113 | this.token = this.$store.state.token; |
1091 | this.getInvoiceList(); | 1114 | this.getInvoiceList(); |
1092 | this.getAllClasses(); | 1115 | this.getAllClasses(); |
1093 | this.getfeeType(); | 1116 | this.getfeeType(); |
1094 | this.getAllStudents(); | 1117 | this.getAllStudents(); |
1095 | } | 1118 | }, |
1096 | }; | 1119 | }; |
1097 | </script> | 1120 | </script> |
1098 | 1121 | ||
1099 | 1122 | ||
1100 | <style scoped> | 1123 | <style scoped> |
1101 | table { | 1124 | table { |
1102 | border-collapse: collapse; | 1125 | border-collapse: collapse; |
1103 | border: 1px solid #e2e7eb; | 1126 | border: 1px solid #e2e7eb; |
1104 | } | 1127 | } |
1105 | 1128 | ||
1106 | th, | 1129 | th, |
1107 | .tdFeeType { | 1130 | .tdFeeType { |
1108 | border: 1px solid #e2e7eb; | 1131 | border: 1px solid #e2e7eb; |
1109 | padding: 10px; | 1132 | padding: 10px; |
1110 | text-align: center; | 1133 | text-align: center; |
1111 | } | 1134 | } |
1112 | table.feeTypeTable { | 1135 | table.feeTypeTable { |
1113 | table-layout: auto !important; | 1136 | table-layout: auto !important; |
1114 | width: 100% !important; | 1137 | width: 100% !important; |
1115 | } | 1138 | } |
1116 | .card-style { | 1139 | .card-style { |
1117 | background: #7f62f8 !important; | 1140 | background: #7f62f8 !important; |
1118 | border-color: #7f62f8 !important; | 1141 | border-color: #7f62f8 !important; |
1119 | border-radius: 12px; | 1142 | border-radius: 12px; |
1120 | text-align: center !important; | 1143 | text-align: center !important; |
1121 | padding-top: 10px !important; | 1144 | padding-top: 10px !important; |
1122 | } | 1145 | } |
1123 | .add-button { | 1146 | .add-button { |
1124 | background: #feb83c !important; | 1147 | background: #feb83c !important; |
1125 | border-color: #feb83c !important; | 1148 | border-color: #feb83c !important; |
1126 | text-transform: none !important; | 1149 | text-transform: none !important; |
1127 | -webkit-box-shadow: none !important; | 1150 | -webkit-box-shadow: none !important; |
1128 | box-shadow: none !important; | 1151 | box-shadow: none !important; |
1129 | } | 1152 | } |
1130 | .clear-button { | 1153 | .clear-button { |
1131 | background: #fa7676 !important; | 1154 | background: #fa7676 !important; |
1132 | border-color: #fa7676 !important; | 1155 | border-color: #fa7676 !important; |
1133 | text-transform: none !important; | 1156 | text-transform: none !important; |
1134 | -webkit-box-shadow: none !important; | 1157 | -webkit-box-shadow: none !important; |
1135 | box-shadow: none !important; | 1158 | box-shadow: none !important; |
1136 | } | 1159 | } |
1137 | .card-styles { | 1160 | .card-styles { |
1138 | background: #7f62f8 !important; | 1161 | background: #7f62f8 !important; |
1139 | border-color: #7f62f8 !important; | 1162 | border-color: #7f62f8 !important; |
1140 | } | 1163 | } |
1141 | .v-card__actions .v-btn { | 1164 | .v-card__actions .v-btn { |
1142 | margin: 0 15px !important; | 1165 | margin: 0 15px !important; |
1143 | min-width: 96px !important; | 1166 | min-width: 96px !important; |
1144 | } | 1167 | } |
1145 | </style> | 1168 | </style> |
src/pages/Administrator/academicYear.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT ACADEMIC YEAR ****** --> | 3 | <!-- ****** EDIT ACADEMIC YEAR ****** --> |
4 | <v-dialog v-model="editAcademinYearDialog" max-width="600px"> | 4 | <v-dialog v-model="editAcademinYearDialog" 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 Academic Year</label> | 8 | <label class="title text-xs-center">Edit Academic Year</label> |
9 | <v-icon size="24" class="right" @click="editAcademinYearDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editAcademinYearDialog = 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">Year:</label> | 16 | <label class="right">Year:</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs8 sm7 class="ml-3"> | 18 | <v-flex xs8 sm7 class="ml-3"> |
19 | <v-text-field | 19 | <v-text-field |
20 | v-model="editedItem.year" | 20 | v-model="editedItem.year" |
21 | placeholder="fill your Title" | 21 | placeholder="fill your Title" |
22 | name="name" | 22 | name="name" |
23 | type="text" | 23 | type="text" |
24 | ></v-text-field> | 24 | ></v-text-field> |
25 | </v-flex> | 25 | </v-flex> |
26 | </v-layout> | 26 | </v-layout> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs12 sm12> | 28 | <v-flex xs12 sm12> |
29 | <v-layout> | 29 | <v-layout> |
30 | <v-flex xs4 class="pt-4 subheading"> | 30 | <v-flex xs4 class="pt-4 subheading"> |
31 | <label class="right">Year Title:</label> | 31 | <label class="right">Year Title:</label> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs8 sm7 class="ml-3"> | 33 | <v-flex xs8 sm7 class="ml-3"> |
34 | <v-text-field | 34 | <v-text-field |
35 | v-model="editedItem.yearTitle" | 35 | v-model="editedItem.yearTitle" |
36 | placeholder="fill your Year Title" | 36 | placeholder="fill your Year Title" |
37 | name="name" | 37 | name="name" |
38 | type="text" | 38 | type="text" |
39 | ></v-text-field> | 39 | ></v-text-field> |
40 | </v-flex> | 40 | </v-flex> |
41 | </v-layout> | 41 | </v-layout> |
42 | </v-flex> | 42 | </v-flex> |
43 | <v-flex xs12 sm12> | 43 | <v-flex xs12 sm12> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs4 class="pt-4 subheading"> | 45 | <v-flex xs4 class="pt-4 subheading"> |
46 | <label class="right hidden-xs-only hidden-sm-only">Starting Date:</label> | 46 | <label class="right hidden-xs-only hidden-sm-only">Starting Date:</label> |
47 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">StartingDate:</label> | 47 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">StartingDate:</label> |
48 | </v-flex> | 48 | </v-flex> |
49 | <v-flex xs8 sm7 class="ml-3"> | 49 | <v-flex xs8 sm7 class="ml-3"> |
50 | <v-menu | 50 | <v-menu |
51 | ref="menu" | 51 | ref="menu" |
52 | :close-on-content-click="false" | 52 | :close-on-content-click="false" |
53 | v-model="menu" | 53 | v-model="menu" |
54 | :nudge-right="40" | 54 | :nudge-right="40" |
55 | lazy | 55 | lazy |
56 | transition="scale-transition" | 56 | transition="scale-transition" |
57 | offset-y | 57 | offset-y |
58 | full-width | 58 | full-width |
59 | min-width="290px" | 59 | min-width="290px" |
60 | > | 60 | > |
61 | <v-text-field | 61 | <v-text-field |
62 | slot="activator" | 62 | slot="activator" |
63 | v-model="editedItem.startingDate" | 63 | v-model="editedItem.startingDate" |
64 | placeholder="Select date" | 64 | placeholder="Select date" |
65 | ></v-text-field> | 65 | ></v-text-field> |
66 | <v-date-picker | 66 | <v-date-picker |
67 | color="info" | 67 | color="info" |
68 | ref="picker" | 68 | ref="picker" |
69 | v-model="editedItem.startingDate" | 69 | v-model="editedItem.startingDate" |
70 | @input="$refs.menu.save(editedItem.startingDate)" | 70 | @input="$refs.menu.save(editedItem.startingDate)" |
71 | ></v-date-picker> | 71 | ></v-date-picker> |
72 | </v-menu> | 72 | </v-menu> |
73 | </v-flex> | 73 | </v-flex> |
74 | </v-layout> | 74 | </v-layout> |
75 | </v-flex> | 75 | </v-flex> |
76 | <v-flex xs12 sm12> | 76 | <v-flex xs12 sm12> |
77 | <v-layout> | 77 | <v-layout> |
78 | <v-flex xs4 class="pt-4 subheading"> | 78 | <v-flex xs4 class="pt-4 subheading"> |
79 | <label class="right hidden-xs-only hidden-sm-only">Ending Date:</label> | 79 | <label class="right hidden-xs-only hidden-sm-only">Ending Date:</label> |
80 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">EndingDate:</label> | 80 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">EndingDate:</label> |
81 | </v-flex> | 81 | </v-flex> |
82 | <v-flex xs8 sm7 class="ml-3"> | 82 | <v-flex xs8 sm7 class="ml-3"> |
83 | <v-menu | 83 | <v-menu |
84 | ref="menuEndDate" | 84 | ref="menuEndDate" |
85 | :close-on-content-click="false" | 85 | :close-on-content-click="false" |
86 | v-model="menuEndDate" | 86 | v-model="menuEndDate" |
87 | :nudge-right="40" | 87 | :nudge-right="40" |
88 | lazy | 88 | lazy |
89 | transition="scale-transition" | 89 | transition="scale-transition" |
90 | offset-y | 90 | offset-y |
91 | full-width | 91 | full-width |
92 | min-width="290px" | 92 | min-width="290px" |
93 | > | 93 | > |
94 | <v-text-field | 94 | <v-text-field |
95 | slot="activator" | 95 | slot="activator" |
96 | v-model="editedItem.endingDate" | 96 | v-model="editedItem.endingDate" |
97 | placeholder="Select date" | 97 | placeholder="Select date" |
98 | ></v-text-field> | 98 | ></v-text-field> |
99 | <v-date-picker | 99 | <v-date-picker |
100 | color="info" | 100 | color="info" |
101 | ref="picker" | 101 | ref="picker" |
102 | v-model="editedItem.endingDate" | 102 | v-model="editedItem.endingDate" |
103 | @input="$refs.menuEndDate.save(editedItem.endingDate)" | 103 | @input="$refs.menuEndDate.save(editedItem.endingDate)" |
104 | ></v-date-picker> | 104 | ></v-date-picker> |
105 | </v-menu> | 105 | </v-menu> |
106 | </v-flex> | 106 | </v-flex> |
107 | </v-layout> | 107 | </v-layout> |
108 | </v-flex> | 108 | </v-flex> |
109 | <v-layout> | 109 | <v-layout> |
110 | <v-flex xs12> | 110 | <v-flex xs12> |
111 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 111 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
112 | <v-spacer></v-spacer> | 112 | <v-spacer></v-spacer> |
113 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 113 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
114 | <v-spacer></v-spacer> | 114 | <v-spacer></v-spacer> |
115 | </v-card-actions> | 115 | </v-card-actions> |
116 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 116 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
117 | <v-spacer></v-spacer> | 117 | <v-spacer></v-spacer> |
118 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 118 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
119 | <v-spacer></v-spacer> | 119 | <v-spacer></v-spacer> |
120 | </v-card-actions> | 120 | </v-card-actions> |
121 | </v-flex> | 121 | </v-flex> |
122 | </v-layout> | 122 | </v-layout> |
123 | </v-container> | 123 | </v-container> |
124 | </v-card> | 124 | </v-card> |
125 | </v-dialog> | 125 | </v-dialog> |
126 | <!-- ****** PROFILE ACADEMIC YEAR DEATILS ****** --> | 126 | <!-- ****** PROFILE ACADEMIC YEAR DEATILS ****** --> |
127 | <v-dialog v-model="viewAcademinYearDialog" max-width="500px"> | 127 | <v-dialog v-model="viewAcademinYearDialog" max-width="500px"> |
128 | <v-card flat class="card-style pa-3" dark> | 128 | <v-card flat class="card-style pa-3" dark> |
129 | <v-layout> | 129 | <v-layout> |
130 | <v-flex xs12> | 130 | <v-flex xs12> |
131 | <label class="title text-xs-center">View Academic Year</label> | 131 | <label class="title text-xs-center">View Academic Year</label> |
132 | <v-icon size="24" class="right" @click="viewAcademinYearDialog = false">cancel</v-icon> | 132 | <v-icon size="24" class="right" @click="viewAcademinYearDialog = false">cancel</v-icon> |
133 | </v-flex> | 133 | </v-flex> |
134 | </v-layout> | 134 | </v-layout> |
135 | <v-card-text> | 135 | <v-card-text> |
136 | <v-container grid-list-md> | 136 | <v-container grid-list-md> |
137 | <v-layout wrap> | 137 | <v-layout wrap> |
138 | <v-flex> | 138 | <v-flex> |
139 | <v-layout> | 139 | <v-layout> |
140 | <v-flex xs5 sm6> | 140 | <v-flex xs5 sm6> |
141 | <h5 class="right my-1"> | 141 | <h5 class="right my-1"> |
142 | <b>Title:</b> | 142 | <b>Title:</b> |
143 | </h5> | 143 | </h5> |
144 | </v-flex> | 144 | </v-flex> |
145 | <v-flex sm6 xs7> | 145 | <v-flex sm6 xs7> |
146 | <h5 class="my-1">{{ editedItem.year }}</h5> | 146 | <h5 class="my-1">{{ editedItem.year }}</h5> |
147 | </v-flex> | 147 | </v-flex> |
148 | </v-layout> | 148 | </v-layout> |
149 | <v-layout> | 149 | <v-layout> |
150 | <v-flex xs5 sm6> | 150 | <v-flex xs5 sm6> |
151 | <h5 class="right my-1"> | 151 | <h5 class="right my-1"> |
152 | <b>Year Title:</b> | 152 | <b>Year Title:</b> |
153 | </h5> | 153 | </h5> |
154 | </v-flex> | 154 | </v-flex> |
155 | <v-flex sm6 xs7> | 155 | <v-flex sm6 xs7> |
156 | <h5 class="my-1">{{ editedItem.yearTitle }}</h5> | 156 | <h5 class="my-1">{{ editedItem.yearTitle }}</h5> |
157 | </v-flex> | 157 | </v-flex> |
158 | </v-layout> | 158 | </v-layout> |
159 | <v-layout> | 159 | <v-layout> |
160 | <v-flex xs5 sm6> | 160 | <v-flex xs5 sm6> |
161 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> | 161 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> |
162 | <b>Starting Date:</b> | 162 | <b>Starting Date:</b> |
163 | </h5> | 163 | </h5> |
164 | <h5 class="right my-1 hidden-md-only hidden-lg-only hidden-xl-only"> | 164 | <h5 class="right my-1 hidden-md-only hidden-lg-only hidden-xl-only"> |
165 | <b>StartingDate:</b> | 165 | <b>StartingDate:</b> |
166 | </h5> | 166 | </h5> |
167 | </v-flex> | 167 | </v-flex> |
168 | <v-flex sm6 xs7> | 168 | <v-flex sm6 xs7> |
169 | <h5 class="my-1">{{dates(editedItem.startingDate)}}</h5> | 169 | <h5 class="my-1">{{dates(editedItem.startingDate)}}</h5> |
170 | </v-flex> | 170 | </v-flex> |
171 | </v-layout> | 171 | </v-layout> |
172 | <v-layout> | 172 | <v-layout> |
173 | <v-flex xs5 sm6> | 173 | <v-flex xs5 sm6> |
174 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> | 174 | <h5 class="right my-1 hidden-xs-only hidden-sm-only"> |
175 | <b>Ending Date:</b> | 175 | <b>Ending Date:</b> |
176 | </h5> | 176 | </h5> |
177 | <h5 class="right my-1 hidden-md-only hidden-lg-only hidden-xl-only"> | 177 | <h5 class="right my-1 hidden-md-only hidden-lg-only hidden-xl-only"> |
178 | <b>EndingDate:</b> | 178 | <b>EndingDate:</b> |
179 | </h5> | 179 | </h5> |
180 | </v-flex> | 180 | </v-flex> |
181 | <v-flex sm6 xs7> | 181 | <v-flex sm6 xs7> |
182 | <h5 class="my-1">{{dates(editedItem.endingDate)}}</h5> | 182 | <h5 class="my-1">{{dates(editedItem.endingDate)}}</h5> |
183 | </v-flex> | 183 | </v-flex> |
184 | </v-layout> | 184 | </v-layout> |
185 | </v-flex> | 185 | </v-flex> |
186 | </v-layout> | 186 | </v-layout> |
187 | </v-container> | 187 | </v-container> |
188 | </v-card-text> | 188 | </v-card-text> |
189 | </v-card> | 189 | </v-card> |
190 | </v-dialog> | 190 | </v-dialog> |
191 | <!-- ****** EXISTING ACADEMIC YEAR TABLE ****** --> | 191 | <!-- ****** EXISTING ACADEMIC YEAR TABLE ****** --> |
192 | <v-toolbar color="transparent" flat> | 192 | <v-toolbar color="transparent" flat> |
193 | <v-btn | 193 | <v-btn |
194 | fab | 194 | fab |
195 | dark | 195 | dark |
196 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 196 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
197 | small | 197 | small |
198 | @click="addAcademicYearDialog = true" | 198 | @click="addAcademicYearDialog = true" |
199 | > | 199 | > |
200 | <v-icon dark>add</v-icon> | 200 | <v-icon dark>add</v-icon> |
201 | </v-btn> | 201 | </v-btn> |
202 | <v-btn | 202 | <v-btn |
203 | round | 203 | round |
204 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 204 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
205 | dark | 205 | dark |
206 | @click="addAcademicYearDialog = true" | 206 | @click="addAcademicYearDialog = true" |
207 | > | 207 | > |
208 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Academic Year | 208 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Academic Year |
209 | </v-btn> | 209 | </v-btn> |
210 | <v-spacer></v-spacer> | 210 | <v-spacer></v-spacer> |
211 | <v-card-title class="body-1" v-show="show"> | 211 | <v-card-title class="body-1" v-show="show"> |
212 | <v-btn icon large flat @click="displaySearch"> | 212 | <v-btn icon large flat @click="displaySearch"> |
213 | <v-avatar size="27"> | 213 | <v-avatar size="27"> |
214 | <img src="/static/icon/search.png" alt="icon" /> | 214 | <img src="/static/icon/search.png" alt="icon" /> |
215 | </v-avatar> | 215 | </v-avatar> |
216 | </v-btn> | 216 | </v-btn> |
217 | </v-card-title> | 217 | </v-card-title> |
218 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 218 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
219 | <v-layout> | 219 | <v-layout> |
220 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 220 | <v-text-field |
221 | autofocus | ||
222 | v-model="search" | ||
223 | label="Search" | ||
224 | prepend-inner-icon="search" | ||
225 | color="primary" | ||
226 | ></v-text-field> | ||
221 | <v-icon @click="closeSearch" color="error">close</v-icon> | 227 | <v-icon @click="closeSearch" color="error">close</v-icon> |
222 | </v-layout> | 228 | </v-layout> |
223 | </v-flex> | 229 | </v-flex> |
224 | </v-toolbar> | 230 | </v-toolbar> |
225 | <v-data-table | 231 | <v-data-table |
226 | :headers="headers" | 232 | :headers="headers" |
227 | :items="getAcademicYearList" | 233 | :items="getAcademicYearList" |
228 | :pagination.sync="pagination" | 234 | :pagination.sync="pagination" |
229 | :search="search" | 235 | :search="search" |
230 | > | 236 | > |
231 | <template slot="items" slot-scope="props"> | 237 | <template slot="items" slot-scope="props"> |
232 | <tr class="tr"> | 238 | <tr class="tr"> |
233 | <td class="td td-row">{{ props.index + 1}}</td> | 239 | <td class="td td-row">{{ props.index + 1}}</td> |
234 | <td class="td td-row text-xs-center">{{ props.item.year}}</td> | 240 | <td class="td td-row text-xs-center">{{ props.item.year}}</td> |
235 | <td class="td td-row text-xs-center">{{ props.item.yearTitle}}</td> | 241 | <td class="td td-row text-xs-center">{{ props.item.yearTitle}}</td> |
236 | <td class="td td-row text-xs-center">{{ dates(props.item.startingDate)}}</td> | 242 | <td class="td td-row text-xs-center">{{ dates(props.item.startingDate)}}</td> |
237 | <td class="td td-row text-xs-center">{{ dates(props.item.endingDate)}}</td> | 243 | <td class="td td-row text-xs-center">{{ dates(props.item.endingDate)}}</td> |
238 | <td class="td td-row text-xs-center"> | 244 | <td class="td td-row text-xs-center"> |
239 | <span> | 245 | <span> |
240 | <v-tooltip top> | 246 | <v-tooltip top> |
241 | <img | 247 | <img |
242 | slot="activator" | 248 | slot="activator" |
243 | style="cursor:pointer; width:25px; height:25px; " | 249 | style="cursor:pointer; width:25px; height:25px; " |
244 | class="mr-3" | 250 | class="mr-3" |
245 | @click="profile(props.item)" | 251 | @click="profile(props.item)" |
246 | src="/static/icon/view.png" | 252 | src="/static/icon/view.png" |
247 | /> | 253 | /> |
248 | <span>View</span> | 254 | <span>View</span> |
249 | </v-tooltip> | 255 | </v-tooltip> |
250 | <v-tooltip top> | 256 | <v-tooltip top> |
251 | <img | 257 | <img |
252 | slot="activator" | 258 | slot="activator" |
253 | style="cursor:pointer; width:20px; height:18px; " | 259 | style="cursor:pointer; width:20px; height:18px; " |
254 | class="mr-3" | 260 | class="mr-3" |
255 | @click="editItem(props.item)" | 261 | @click="editItem(props.item)" |
256 | src="/static/icon/edit.png" | 262 | src="/static/icon/edit.png" |
257 | /> | 263 | /> |
258 | <span>Edit</span> | 264 | <span>Edit</span> |
259 | </v-tooltip> | 265 | </v-tooltip> |
260 | <v-tooltip top> | 266 | <v-tooltip top> |
261 | <img | 267 | <img |
262 | slot="activator" | 268 | slot="activator" |
263 | style="cursor:pointer; width:20px; height:20px; " | 269 | style="cursor:pointer; width:20px; height:20px; " |
264 | @click="deleteItem(props.item)" | 270 | @click="deleteItem(props.item)" |
265 | class="mr-3" | 271 | class="mr-3" |
266 | src="/static/icon/delete.png" | 272 | src="/static/icon/delete.png" |
267 | /> | 273 | /> |
268 | <span>Delete</span> | 274 | <span>Delete</span> |
269 | </v-tooltip> | 275 | </v-tooltip> |
270 | </span> | 276 | </span> |
271 | </td> | 277 | </td> |
272 | </tr> | 278 | </tr> |
273 | </template> | 279 | </template> |
274 | <v-alert | 280 | <v-alert |
275 | slot="no-results" | 281 | slot="no-results" |
276 | :value="true" | 282 | :value="true" |
277 | color="error" | 283 | color="error" |
278 | icon="warning" | 284 | icon="warning" |
279 | >Your search for "{{ search }}" found no results.</v-alert> | 285 | >Your search for "{{ search }}" found no results.</v-alert> |
280 | </v-data-table> | 286 | </v-data-table> |
281 | <!-- ****** ADD ACADEMIC YEAR ****** --> | 287 | <!-- ****** ADD ACADEMIC YEAR ****** --> |
282 | <v-dialog v-model="addAcademicYearDialog" max-width="600px"> | 288 | <v-dialog v-model="addAcademicYearDialog" max-width="600px" v-if="addAcademicYearDialog"> |
283 | <v-card flat class="card-style pa-2" dark> | 289 | <v-card flat class="card-style pa-2" dark> |
284 | <v-layout> | 290 | <v-layout> |
285 | <v-flex xs12> | 291 | <v-flex xs12> |
286 | <label class="title text-xs-center">Add Academic Year</label> | 292 | <label class="title text-xs-center">Add Academic Year</label> |
287 | <v-icon size="24" class="right" @click="addAcademicYearDialog = false">cancel</v-icon> | 293 | <v-icon size="24" class="right" @click="closeAddAcademicYearModel">cancel</v-icon> |
288 | </v-flex> | 294 | </v-flex> |
289 | </v-layout> | 295 | </v-layout> |
290 | <v-form ref="form" v-model="valid" lazy-validation> | 296 | <v-form ref="form" v-model="valid" lazy-validation> |
291 | <v-container fluid> | 297 | <v-container fluid> |
292 | <v-flex xs12> | 298 | <v-flex xs12> |
293 | <v-layout> | 299 | <v-layout> |
294 | <v-flex xs5 sm4 class="pt-4 subheading"> | 300 | <v-flex xs5 sm4 class="pt-4 subheading"> |
295 | <label class="right">Year:</label> | 301 | <label class="right">Year:</label> |
296 | </v-flex> | 302 | </v-flex> |
297 | <v-flex xs7 class="ml-3"> | 303 | <v-flex xs7 class="ml-3"> |
298 | <v-text-field | 304 | <v-text-field |
299 | v-model="addAcademicYear.year" | 305 | v-model="addAcademicYear.year" |
300 | placeholder="fill Year (2019-2020)" | 306 | placeholder="fill Year (2019-2020)" |
301 | type="text" | 307 | type="text" |
302 | :rules="yearRules" | 308 | :rules="yearRules" |
303 | required | 309 | required |
304 | ></v-text-field> | 310 | ></v-text-field> |
305 | </v-flex> | 311 | </v-flex> |
306 | </v-layout> | 312 | </v-layout> |
307 | </v-flex> | 313 | </v-flex> |
308 | <v-flex xs12> | 314 | <v-flex xs12> |
309 | <v-layout> | 315 | <v-layout> |
310 | <v-flex xs5 sm4 class="pt-4 subheading"> | 316 | <v-flex xs5 sm4 class="pt-4 subheading"> |
311 | <label class="right">Year Title:</label> | 317 | <label class="right">Year Title:</label> |
312 | </v-flex> | 318 | </v-flex> |
313 | <v-flex xs7 class="ml-3"> | 319 | <v-flex xs7 class="ml-3"> |
314 | <v-text-field | 320 | <v-text-field |
315 | placeholder="fill your Year Title" | 321 | placeholder="fill your Year Title" |
316 | :rules="yearTitleRules" | 322 | :rules="yearTitleRules" |
317 | v-model="addAcademicYear.yearTitle" | 323 | v-model="addAcademicYear.yearTitle" |
318 | type="text" | 324 | type="text" |
319 | required | 325 | required |
320 | ></v-text-field> | 326 | ></v-text-field> |
321 | </v-flex> | 327 | </v-flex> |
322 | </v-layout> | 328 | </v-layout> |
323 | </v-flex> | 329 | </v-flex> |
324 | <v-flex xs12> | 330 | <v-flex xs12> |
325 | <v-layout> | 331 | <v-layout> |
326 | <v-flex xs5 sm4 class="pt-4 subheading"> | 332 | <v-flex xs5 sm4 class="pt-4 subheading"> |
327 | <label class="right hidden-xs-only hidden-sm-only">Starting Date:</label> | 333 | <label class="right hidden-xs-only hidden-sm-only">Starting Date:</label> |
328 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">StartingDate:</label> | 334 | <label class="right hidden-md-only hidden-lg-only hidden-xl-only">StartingDate:</label> |
329 | </v-flex> | 335 | </v-flex> |
330 | <v-flex xs7 class="ml-3"> | 336 | <v-flex xs7 class="ml-3"> |
331 | <v-menu | 337 | <v-menu |
332 | ref="menuStart" | 338 | ref="menuStart" |
333 | :close-on-content-click="false" | 339 | :close-on-content-click="false" |
334 | v-model="menuStart" | 340 | v-model="menuStart" |
335 | :nudge-right="40" | 341 | :nudge-right="40" |
336 | :return-value.sync="addAcademicYear.startingDate" | 342 | :return-value.sync="addAcademicYear.startingDate" |
337 | app | 343 | app |
338 | lazy | 344 | lazy |
339 | transition="scale-transition" | 345 | transition="scale-transition" |
340 | offset-y | 346 | offset-y |
341 | full-width | 347 | full-width |
342 | min-width="290px" | 348 | min-width="290px" |
343 | > | 349 | > |
344 | <v-text-field | 350 | <v-text-field |
345 | slot="activator" | 351 | slot="activator" |
346 | :rules="startDateRules" | 352 | :rules="startDateRules" |
347 | v-model="addAcademicYear.startingDate" | 353 | v-model="addAcademicYear.startingDate" |
348 | append-icon="event" | 354 | append-icon="event" |
349 | placeholder="Select starting date" | 355 | placeholder="Select starting date" |
350 | ></v-text-field> | 356 | ></v-text-field> |
351 | <v-date-picker | 357 | <v-date-picker |
352 | color="info" | 358 | color="info" |
353 | v-model="addAcademicYear.startingDate" | 359 | v-model="addAcademicYear.startingDate" |
354 | @input="$refs.menuStart.save(addAcademicYear.startingDate)" | 360 | @input="$refs.menuStart.save(addAcademicYear.startingDate)" |
355 | ></v-date-picker> | 361 | ></v-date-picker> |
356 | </v-menu> | 362 | </v-menu> |
357 | </v-flex> | 363 | </v-flex> |
358 | </v-layout> | 364 | </v-layout> |
359 | </v-flex> | 365 | </v-flex> |
360 | <v-flex xs12> | 366 | <v-flex xs12> |
361 | <v-layout> | 367 | <v-layout> |
362 | <v-flex xs5 sm4 class="pt-4 subheading"> | 368 | <v-flex xs5 sm4 class="pt-4 subheading"> |
363 | <label class="right">Ending Date:</label> | 369 | <label class="right">Ending Date:</label> |
364 | </v-flex> | 370 | </v-flex> |
365 | <v-flex xs7 class="ml-3"> | 371 | <v-flex xs7 class="ml-3"> |
366 | <v-menu | 372 | <v-menu |
367 | ref="menu1" | 373 | ref="menu1" |
368 | :close-on-content-click="false" | 374 | :close-on-content-click="false" |
369 | v-model="menu1" | 375 | v-model="menu1" |
370 | :nudge-right="40" | 376 | :nudge-right="40" |
371 | :return-value.sync="addAcademicYear.endingDate" | 377 | :return-value.sync="addAcademicYear.endingDate" |
372 | app | 378 | app |
373 | lazy | 379 | lazy |
374 | transition="scale-transition" | 380 | transition="scale-transition" |
375 | offset-y | 381 | offset-y |
376 | full-width | 382 | full-width |
377 | min-width="290px" | 383 | min-width="290px" |
378 | > | 384 | > |
379 | <v-text-field | 385 | <v-text-field |
380 | slot="activator" | 386 | slot="activator" |
381 | :rules="endDateRules" | 387 | :rules="endDateRules" |
382 | v-model="addAcademicYear.endingDate" | 388 | v-model="addAcademicYear.endingDate" |
383 | append-icon="event" | 389 | append-icon="event" |
384 | placeholder="Select ending date" | 390 | placeholder="Select ending date" |
385 | ></v-text-field> | 391 | ></v-text-field> |
386 | <v-date-picker | 392 | <v-date-picker |
387 | color="info" | 393 | color="info" |
388 | v-model="addAcademicYear.endingDate" | 394 | v-model="addAcademicYear.endingDate" |
389 | @input="$refs.menu1.save(addAcademicYear.endingDate)" | 395 | @input="$refs.menu1.save(addAcademicYear.endingDate)" |
390 | ></v-date-picker> | 396 | ></v-date-picker> |
391 | </v-menu> | 397 | </v-menu> |
392 | </v-flex> | 398 | </v-flex> |
393 | </v-layout> | 399 | </v-layout> |
394 | </v-flex> | 400 | </v-flex> |
395 | <v-layout> | 401 | <v-layout> |
396 | <v-flex xs12> | 402 | <v-flex xs12> |
397 | <v-layout> | 403 | <v-layout> |
398 | <v-spacer></v-spacer> | 404 | <v-spacer></v-spacer> |
399 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 405 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
400 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 406 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
401 | </v-layout> | 407 | </v-layout> |
402 | </v-flex> | 408 | </v-flex> |
403 | </v-layout> | 409 | </v-layout> |
404 | </v-container> | 410 | </v-container> |
405 | </v-form> | 411 | </v-form> |
406 | </v-card> | 412 | </v-card> |
407 | </v-dialog> | 413 | </v-dialog> |
408 | <div class="loader" v-if="showLoader"> | 414 | <div class="loader" v-if="showLoader"> |
409 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 415 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
410 | </div> | 416 | </div> |
411 | <v-snackbar | 417 | <v-snackbar |
412 | :timeout="timeout" | 418 | :timeout="timeout" |
413 | :top="y === 'top'" | 419 | :top="y === 'top'" |
414 | :right="x === 'right'" | 420 | :right="x === 'right'" |
415 | :vertical="mode === 'vertical'" | 421 | :vertical="mode === 'vertical'" |
416 | v-model="snackbar" | 422 | v-model="snackbar" |
417 | :color="color" | 423 | :color="color" |
418 | >{{ text }}</v-snackbar> | 424 | >{{ text }}</v-snackbar> |
419 | </v-container> | 425 | </v-container> |
420 | </template> | 426 | </template> |
421 | 427 | ||
422 | <script> | 428 | <script> |
423 | import http from "@/Services/http.js"; | 429 | import http from "@/Services/http.js"; |
424 | import Util from "@/util"; | 430 | import Util from "@/util"; |
425 | import moment from "moment"; | 431 | import moment from "moment"; |
426 | 432 | ||
427 | export default { | 433 | export default { |
428 | data: () => ({ | 434 | data: () => ({ |
429 | snackbar: false, | 435 | snackbar: false, |
430 | y: "top", | 436 | y: "top", |
431 | x: "right", | 437 | x: "right", |
432 | mode: "", | 438 | mode: "", |
433 | timeout: 5000, | 439 | timeout: 5000, |
434 | text: "", | 440 | text: "", |
435 | color: "", | 441 | color: "", |
436 | loading: false, | 442 | loading: false, |
437 | date: null, | 443 | date: null, |
438 | show: true, | 444 | show: true, |
439 | showSearch: false, | 445 | showSearch: false, |
440 | search: "", | 446 | search: "", |
441 | showLoader: false, | 447 | showLoader: false, |
442 | addAcademicYearDialog: false, | 448 | addAcademicYearDialog: false, |
443 | editAcademinYearDialog: false, | 449 | editAcademinYearDialog: false, |
444 | viewAcademinYearDialog: false, | 450 | viewAcademinYearDialog: false, |
445 | valid: true, | 451 | valid: true, |
446 | pagination: { | 452 | pagination: { |
447 | rowsPerPage: 10 | 453 | rowsPerPage: 10, |
448 | }, | 454 | }, |
449 | date: null, | 455 | date: null, |
450 | menu1: false, | 456 | menu1: false, |
451 | menu: false, | 457 | menu: false, |
452 | menuStart: false, | 458 | menuStart: false, |
453 | menuEndDate: false, | 459 | menuEndDate: false, |
454 | yearRules: [v => !!v || "Year is required"], | 460 | yearRules: [(v) => !!v || "Year is required"], |
455 | yearTitleRules: [v => !!v || "Year Title is required"], | 461 | yearTitleRules: [(v) => !!v || "Year Title is required"], |
456 | startDateRules: [v => !!v || "startDate is required"], | 462 | startDateRules: [(v) => !!v || "startDate is required"], |
457 | endDateRules: [v => !!v || "endDate is required"], | 463 | endDateRules: [(v) => !!v || "endDate is required"], |
458 | headers: [ | 464 | headers: [ |
459 | { | 465 | { |
460 | text: "No", | 466 | text: "No", |
461 | align: "center", | 467 | align: "center", |
462 | sortable: false, | 468 | sortable: false, |
463 | value: "No" | 469 | value: "No", |
464 | }, | 470 | }, |
465 | { text: "Year", value: "year", sortable: false, align: "center" }, | 471 | { text: "Year", value: "year", sortable: false, align: "center" }, |
466 | { | 472 | { |
467 | text: "Year Title", | 473 | text: "Year Title", |
468 | value: "yearTitle", | 474 | value: "yearTitle", |
469 | sortable: false, | 475 | sortable: false, |
470 | align: "center" | 476 | align: "center", |
471 | }, | 477 | }, |
472 | 478 | ||
473 | { | 479 | { |
474 | text: "Starting Date", | 480 | text: "Starting Date", |
475 | value: "startingDate", | 481 | value: "startingDate", |
476 | sortable: false, | 482 | sortable: false, |
477 | align: "center" | 483 | align: "center", |
478 | }, | 484 | }, |
479 | { | 485 | { |
480 | text: "Ending Date", | 486 | text: "Ending Date", |
481 | value: "endingDate", | 487 | value: "endingDate", |
482 | sortable: false, | 488 | sortable: false, |
483 | align: "center" | 489 | align: "center", |
484 | }, | 490 | }, |
485 | { text: "Action", value: "", sortable: false, align: "center" } | 491 | { text: "Action", value: "", sortable: false, align: "center" }, |
486 | ], | 492 | ], |
487 | getAcademicYearList: [], | 493 | getAcademicYearList: [], |
488 | editedIndex: -1, | 494 | editedIndex: -1, |
489 | addAcademicYear: {}, | 495 | addAcademicYear: {}, |
490 | editedItem: {}, | 496 | editedItem: {}, |
491 | token: "" | 497 | token: "", |
492 | }), | 498 | }), |
499 | watch: { | ||
500 | addAcademicYearDialog: function (val) { | ||
501 | if (!val) { | ||
502 | this.addAcademicYear = []; | ||
503 | } | ||
504 | }, | ||
505 | }, | ||
493 | methods: { | 506 | methods: { |
494 | dates: function(date) { | 507 | dates: function (date) { |
495 | return moment(date).format("MMMM DD, YYYY"); | 508 | return moment(date).format("MMMM DD, YYYY"); |
496 | }, | 509 | }, |
497 | getAcademicYear() { | 510 | getAcademicYear() { |
498 | this.showLoader = true; | 511 | this.showLoader = true; |
499 | http() | 512 | http() |
500 | .get("/getAcademicsList", { | 513 | .get("/getAcademicsList", { |
501 | headers: { Authorization: "Bearer " + this.token } | 514 | headers: { Authorization: "Bearer " + this.token }, |
502 | }) | 515 | }) |
503 | .then(response => { | 516 | .then((response) => { |
504 | this.getAcademicYearList = response.data.data; | 517 | this.getAcademicYearList = response.data.data; |
505 | this.showLoader = false; | 518 | this.showLoader = false; |
506 | }) | 519 | }) |
507 | .catch(error => { | 520 | .catch((error) => { |
508 | this.showLoader = false; | 521 | this.showLoader = false; |
509 | if (error.response.status === 401) { | 522 | if (error.response.status === 401) { |
510 | this.$router.replace({ path: "/" }); | 523 | this.$router.replace({ path: "/" }); |
511 | this.$store.dispatch("setToken", null); | 524 | this.$store.dispatch("setToken", null); |
512 | this.$store.dispatch("Id", null); | 525 | this.$store.dispatch("Id", null); |
513 | } | 526 | } |
514 | }); | 527 | }); |
515 | }, | 528 | }, |
516 | editItem(item) { | 529 | editItem(item) { |
517 | this.editedIndex = this.getAcademicYearList.indexOf(item); | 530 | this.editedIndex = this.getAcademicYearList.indexOf(item); |
518 | this.editedItem = Object.assign({}, item); | 531 | this.editedItem = Object.assign({}, item); |
519 | this.editedItem.schoolEventId = item._id; | 532 | this.editedItem.schoolEventId = item._id; |
520 | this.editAcademinYearDialog = true; | 533 | this.editAcademinYearDialog = true; |
521 | }, | 534 | }, |
522 | profile(item) { | 535 | profile(item) { |
523 | this.editedIndex = this.getAcademicYearList.indexOf(item); | 536 | this.editedIndex = this.getAcademicYearList.indexOf(item); |
524 | this.editedItem = Object.assign({}, item); | 537 | this.editedItem = Object.assign({}, item); |
525 | this.viewAcademinYearDialog = true; | 538 | this.viewAcademinYearDialog = true; |
526 | }, | 539 | }, |
527 | 540 | ||
528 | deleteItem(item) { | 541 | deleteItem(item) { |
529 | let deleteAcademic = { | 542 | let deleteAcademic = { |
530 | academicId: item._id | 543 | academicId: item._id, |
531 | }; | 544 | }; |
532 | http() | 545 | http() |
533 | .delete( | 546 | .delete( |
534 | "/deleteAcademic", | 547 | "/deleteAcademic", |
535 | confirm("Are you sure you want to delete this?") && { | 548 | confirm("Are you sure you want to delete this?") && { |
536 | params: deleteAcademic | 549 | params: deleteAcademic, |
537 | } | 550 | } |
538 | ) | 551 | ) |
539 | .then(response => { | 552 | .then((response) => { |
540 | this.snackbar = true; | 553 | this.snackbar = true; |
541 | this.text = response.data.message; | 554 | this.text = response.data.message; |
542 | this.color = "green"; | 555 | this.color = "green"; |
543 | this.getAcademicYear(); | 556 | this.getAcademicYear(); |
544 | }) | 557 | }) |
545 | .catch(error => { | 558 | .catch((error) => { |
546 | this.snackbar = true; | 559 | this.snackbar = true; |
547 | this.text = error.response.data.message; | 560 | this.text = error.response.data.message; |
548 | this.color = "error"; | 561 | this.color = "error"; |
549 | }); | 562 | }); |
550 | }, | 563 | }, |
551 | close() { | 564 | close() { |
552 | this.editAcademinYearDialog = false; | 565 | this.editAcademinYearDialog = false; |
553 | }, | 566 | }, |
567 | closeAddAcademicYearModel() { | ||
568 | this.addAcademicYearDialog = false; | ||
569 | this.getAcademicYearList = []; | ||
570 | this.addAcademicYear = []; | ||
571 | }, | ||
554 | submit() { | 572 | submit() { |
555 | if (this.$refs.form.validate()) { | 573 | if (this.$refs.form.validate()) { |
556 | this.loading = true; | 574 | this.loading = true; |
557 | http() | 575 | http() |
558 | .post("/createAcademic", this.addAcademicYear) | 576 | .post("/createAcademic", this.addAcademicYear) |
559 | .then(response => { | 577 | .then((response) => { |
560 | this.snackbar = true; | 578 | this.snackbar = true; |
561 | this.text = response.data.message; | 579 | this.text = response.data.message; |
562 | this.color = "green"; | 580 | this.color = "green"; |
563 | this.getAcademicYear(); | 581 | this.getAcademicYear(); |
564 | this.clear(); | 582 | this.clear(); |
565 | this.loading = false; | 583 | this.loading = false; |
566 | this.addAcademicYearDialog = false; | 584 | this.addAcademicYearDialog = false; |
567 | }) | 585 | }) |
568 | .catch(error => { | 586 | .catch((error) => { |
569 | this.snackbar = true; | 587 | this.snackbar = true; |
570 | this.text = error.response.data.message; | 588 | this.text = error.response.data.message; |
571 | this.color = "error"; | 589 | this.color = "error"; |
572 | this.loading = false; | 590 | this.loading = false; |
573 | }); | 591 | }); |
574 | } | 592 | } |
575 | }, | 593 | }, |
576 | clear() { | 594 | clear() { |
577 | this.$refs.form.reset(); | 595 | this.$refs.form.reset(); |
578 | }, | 596 | }, |
579 | save() { | 597 | save() { |
580 | this.editedItem.academicId = this.editedItem._id; | 598 | this.editedItem.academicId = this.editedItem._id; |
581 | http() | 599 | http() |
582 | .put("/updateAcademic", this.editedItem, { | 600 | .put("/updateAcademic", this.editedItem, { |
583 | headers: { Authorization: "Bearer " + this.token } | 601 | headers: { Authorization: "Bearer " + this.token }, |
584 | }) | 602 | }) |
585 | .then(response => { | 603 | .then((response) => { |
586 | this.snackbar = true; | 604 | this.snackbar = true; |
587 | this.text = response.data.message; | 605 | this.text = response.data.message; |
588 | this.color = "green"; | 606 | this.color = "green"; |
589 | this.getAcademicYear(); | 607 | this.getAcademicYear(); |
590 | this.close(); | 608 | this.close(); |
591 | }) | 609 | }) |
592 | .catch(error => { | 610 | .catch((error) => { |
593 | this.snackbar = true; | 611 | this.snackbar = true; |
594 | this.text = error.response.data.message; | 612 | this.text = error.response.data.message; |
595 | this.color = "error"; | 613 | this.color = "error"; |
596 | }); | 614 | }); |
597 | }, | 615 | }, |
598 | displaySearch() { | 616 | displaySearch() { |
599 | (this.show = false), (this.showSearch = true); | 617 | (this.show = false), (this.showSearch = true); |
600 | }, | 618 | }, |
601 | closeSearch() { | 619 | closeSearch() { |
602 | this.showSearch = false; | 620 | this.showSearch = false; |
603 | this.show = true; | 621 | this.show = true; |
604 | this.search = ""; | 622 | this.search = ""; |
605 | } | 623 | }, |
606 | }, | 624 | }, |
607 | mounted() { | 625 | mounted() { |
608 | this.token = this.$store.state.token; | 626 | this.token = this.$store.state.token; |
609 | this.getAcademicYear(); | 627 | this.getAcademicYear(); |
610 | } | 628 | }, |
611 | }; | 629 | }; |
612 | </script> | 630 | </script> |
src/pages/Annoucement/annoucement.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS COURSES DETAILS ****** --> | 3 | <!-- ****** EDITS COURSES DETAILS ****** --> |
4 | <v-dialog v-model="editStudentDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editStudentDialog" max-width="600px" 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 Annoucement</label> | 8 | <label class="title text-xs-center">Edit Annoucement</label> |
9 | <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editStudentDialog = 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> | 15 | <v-layout> |
16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
17 | <v-avatar size="100px" v-if="!editedItem.attachementUrl && !editImageUrl"> | 17 | <v-avatar size="100px" v-if="!editedItem.attachementUrl && !editImageUrl"> |
18 | <img src="/static/icon/user.png" /> | 18 | <img src="/static/icon/user.png" /> |
19 | </v-avatar> | 19 | </v-avatar> |
20 | <img | 20 | <img |
21 | :src="editedItem.attachementUrl" | 21 | :src="editedItem.attachementUrl" |
22 | v-else-if="editedItem.attachementUrl && !editImageUrl" | 22 | v-else-if="editedItem.attachementUrl && !editImageUrl" |
23 | height="150" | 23 | height="150" |
24 | style="border-radius:50%; width:150px" | 24 | style="border-radius:50%; width:150px" |
25 | /> | 25 | /> |
26 | <img | 26 | <img |
27 | v-if="editImageUrl" | 27 | v-if="editImageUrl" |
28 | :src="editImageUrl" | 28 | :src="editImageUrl" |
29 | style="border-radius:50%; width:150px;height:150px" | 29 | style="border-radius:50%; width:150px;height:150px" |
30 | /> | 30 | /> |
31 | <input | 31 | <input |
32 | type="file" | 32 | type="file" |
33 | style="display: none" | 33 | style="display: none" |
34 | ref="editDataImage" | 34 | ref="editDataImage" |
35 | accept="image/*" | 35 | accept="image/*" |
36 | @change="onEditFilePicked" | 36 | @change="onEditFilePicked" |
37 | /> | 37 | /> |
38 | </v-flex> | 38 | </v-flex> |
39 | </v-layout> | 39 | </v-layout> |
40 | <v-layout wrap> | 40 | <v-layout wrap> |
41 | <v-flex xs12 sm12> | 41 | <v-flex xs12 sm12> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-flex xs4 sm5 class="pt-4 subheading"> | 43 | <v-flex xs4 sm5 class="pt-4 subheading"> |
44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
46 | </v-flex> | 46 | </v-flex> |
47 | <v-flex xs8 sm7 class="ml-3"> | 47 | <v-flex xs8 sm7 class="ml-3"> |
48 | <v-select | 48 | <v-select |
49 | :items="addclass" | 49 | :items="addclass" |
50 | label="Select Class" | 50 | label="Select Class" |
51 | v-model="editedItem.select" | 51 | v-model="editedItem.select" |
52 | item-text="classNum" | 52 | item-text="classNum" |
53 | item-value="_id" | 53 | item-value="_id" |
54 | name="Select Class" | 54 | name="Select Class" |
55 | required | 55 | required |
56 | ></v-select> | 56 | ></v-select> |
57 | </v-flex> | 57 | </v-flex> |
58 | </v-layout> | 58 | </v-layout> |
59 | <v-layout> | 59 | <v-layout> |
60 | <v-flex xs4 sm5 class="pt-4 subheading"> | 60 | <v-flex xs4 sm5 class="pt-4 subheading"> |
61 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | 61 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> |
62 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | 62 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> |
63 | </v-flex> | 63 | </v-flex> |
64 | <v-flex xs8 sm7 class="ml-3"> | 64 | <v-flex xs8 sm7 class="ml-3"> |
65 | <v-select | 65 | <v-select |
66 | :items="courseData" | 66 | :items="courseData" |
67 | item-text="courseName" | 67 | item-text="courseName" |
68 | item-value="_id" | 68 | item-value="_id" |
69 | v-model="editedItem.courseName" | 69 | v-model="editedItem.courseName" |
70 | placeholder="fill your Course name" | 70 | placeholder="fill your Course name" |
71 | type="text" | 71 | type="text" |
72 | :rules="courseRules" | 72 | :rules="courseRules" |
73 | required | 73 | required |
74 | ></v-select> | 74 | ></v-select> |
75 | </v-flex> | 75 | </v-flex> |
76 | </v-layout> | 76 | </v-layout> |
77 | <v-layout> | 77 | <v-layout> |
78 | <v-flex xs4 sm5 class="pt-4 subheading"> | 78 | <v-flex xs4 sm5 class="pt-4 subheading"> |
79 | <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> | 79 | <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> |
80 | <label | 80 | <label |
81 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 81 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
82 | >DiscussionType:</label> | 82 | >DiscussionType:</label> |
83 | </v-flex> | 83 | </v-flex> |
84 | <v-flex xs8 sm7 class="ml-3"> | 84 | <v-flex xs8 sm7 class="ml-3"> |
85 | <v-text-field | 85 | <v-text-field |
86 | v-model="editedItem.discussionType" | 86 | v-model="editedItem.discussionType" |
87 | placeholder="fill your Course Name" | 87 | placeholder="fill your Course Name" |
88 | type="text" | 88 | type="text" |
89 | required | 89 | required |
90 | ></v-text-field> | 90 | ></v-text-field> |
91 | </v-flex> | 91 | </v-flex> |
92 | </v-layout> | 92 | </v-layout> |
93 | <v-layout> | 93 | <v-layout> |
94 | <v-flex xs4 sm5 class="pt-4 subheading"> | 94 | <v-flex xs4 sm5 class="pt-4 subheading"> |
95 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | 95 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> |
96 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> | 96 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> |
97 | </v-flex> | 97 | </v-flex> |
98 | <v-flex xs8 sm7 class="ml-3"> | 98 | <v-flex xs8 sm7 class="ml-3"> |
99 | <v-text-field | 99 | <v-text-field |
100 | label="Select Image" | 100 | label="Select Image" |
101 | @click="pickEditFile" | 101 | @click="pickEditFile" |
102 | v-model="editImageName" | 102 | v-model="editImageName" |
103 | append-icon="attach_file" | 103 | append-icon="attach_file" |
104 | ></v-text-field> | 104 | ></v-text-field> |
105 | </v-flex> | 105 | </v-flex> |
106 | </v-layout> | 106 | </v-layout> |
107 | </v-flex> | 107 | </v-flex> |
108 | </v-layout> | 108 | </v-layout> |
109 | <v-layout> | 109 | <v-layout> |
110 | <v-flex xs12 sm12 class="px-0 mx-0"> | 110 | <v-flex xs12 sm12 class="px-0 mx-0"> |
111 | <v-layout class="right"> | 111 | <v-layout class="right"> |
112 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> | 112 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> |
113 | </v-layout> | 113 | </v-layout> |
114 | </v-flex> | 114 | </v-flex> |
115 | </v-layout> | 115 | </v-layout> |
116 | </v-container> | 116 | </v-container> |
117 | </v-form> | 117 | </v-form> |
118 | </v-card-text> | 118 | </v-card-text> |
119 | </v-card> | 119 | </v-card> |
120 | </v-dialog> | 120 | </v-dialog> |
121 | 121 | ||
122 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> | 122 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> |
123 | 123 | ||
124 | <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> | 124 | <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> |
125 | <v-card flat class="card-style pa-3" dark> | 125 | <v-card flat class="card-style pa-3" dark> |
126 | <v-layout> | 126 | <v-layout> |
127 | <v-flex xs12> | 127 | <v-flex xs12> |
128 | <label class="title text-xs-center">View Annoucement</label> | 128 | <label class="title text-xs-center">View Annoucement</label> |
129 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> | 129 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | <v-card-text> | 132 | <v-card-text> |
133 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 133 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
134 | <v-avatar size="100px"> | 134 | <v-avatar size="100px"> |
135 | <img src="/static/icon/user.png" v-if="!editedItem.attachementUrl" /> | 135 | <img src="/static/icon/user.png" v-if="!editedItem.attachementUrl" /> |
136 | <img :src="editedItem.attachementUrl" v-else-if="editedItem.attachementUrl" /> | 136 | <img :src="editedItem.attachementUrl" v-else-if="editedItem.attachementUrl" /> |
137 | </v-avatar> | 137 | </v-avatar> |
138 | </v-flex> | 138 | </v-flex> |
139 | <v-container grid-list-md> | 139 | <v-container grid-list-md> |
140 | <v-layout wrap> | 140 | <v-layout wrap> |
141 | <v-flex xs12> | 141 | <v-flex xs12> |
142 | <v-layout> | 142 | <v-layout> |
143 | <v-flex xs6 sm6> | 143 | <v-flex xs6 sm6> |
144 | <h5 class="right my-1"> | 144 | <h5 class="right my-1"> |
145 | <b>Discussion Type :</b> | 145 | <b>Discussion Type :</b> |
146 | </h5> | 146 | </h5> |
147 | </v-flex> | 147 | </v-flex> |
148 | <v-flex sm6 xs6> | 148 | <v-flex sm6 xs6> |
149 | <h5 class="my-1 left">{{ editedItem.discussionType }}</h5> | 149 | <h5 class="my-1 left">{{ editedItem.discussionType }}</h5> |
150 | </v-flex> | 150 | </v-flex> |
151 | </v-layout> | 151 | </v-layout> |
152 | </v-flex> | 152 | </v-flex> |
153 | </v-layout> | 153 | </v-layout> |
154 | </v-container> | 154 | </v-container> |
155 | </v-card-text> | 155 | </v-card-text> |
156 | </v-card> | 156 | </v-card> |
157 | </v-dialog> | 157 | </v-dialog> |
158 | 158 | ||
159 | <!-- ****** Annoucement TABLE ****** --> | 159 | <!-- ****** Annoucement TABLE ****** --> |
160 | <v-toolbar color="transparent" flat> | 160 | <v-toolbar color="transparent" flat> |
161 | <v-btn | 161 | <v-btn |
162 | fab | 162 | fab |
163 | dark | 163 | dark |
164 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 164 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
165 | small | 165 | small |
166 | @click="addAnnoucementDialog = true" | 166 | @click="addAnnoucementDialog = true" |
167 | > | 167 | > |
168 | <v-icon dark>add</v-icon> | 168 | <v-icon dark>add</v-icon> |
169 | </v-btn> | 169 | </v-btn> |
170 | <v-btn | 170 | <v-btn |
171 | round | 171 | round |
172 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 172 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
173 | dark | 173 | dark |
174 | @click="addAnnoucementDialog = true" | 174 | @click="addAnnoucementDialog = true" |
175 | > | 175 | > |
176 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Annoucement | 176 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Annoucement |
177 | </v-btn> | 177 | </v-btn> |
178 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 178 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
179 | <v-flex md13 lg12> | 179 | <v-flex md13 lg12> |
180 | <v-layout> | 180 | <v-layout> |
181 | <v-flex lg6 md12> | 181 | <v-flex lg6 md12> |
182 | <v-layout> | 182 | <v-layout> |
183 | <v-select | 183 | <v-select |
184 | :items="addclass" | 184 | :items="addclass" |
185 | label="Select Class" | 185 | label="Select Class" |
186 | v-model="selectAnnoucement.classId" | 186 | v-model="selectAnnoucement.classId" |
187 | item-text="classNum" | 187 | item-text="classNum" |
188 | item-value="_id" | 188 | item-value="_id" |
189 | name="Select Class" | 189 | name="Select Class" |
190 | :rules="classRules" | 190 | :rules="classRules" |
191 | required | 191 | required |
192 | class="ml-2" | 192 | class="ml-2" |
193 | @change="getCourses(selectAnnoucement.classId)" | 193 | @change="getCourses(selectAnnoucement.classId)" |
194 | ></v-select> | 194 | ></v-select> |
195 | <v-select | 195 | <v-select |
196 | :items="courseData" | 196 | :items="courseData" |
197 | label="Select Course" | 197 | label="Select Course" |
198 | v-model="selectAnnoucement.courseId" | 198 | v-model="selectAnnoucement.courseId" |
199 | item-text="courseName" | 199 | item-text="courseName" |
200 | item-value="_id" | 200 | item-value="_id" |
201 | :rules="courseRules" | 201 | :rules="courseRules" |
202 | required | 202 | required |
203 | class="ml-4" | 203 | class="ml-4" |
204 | ></v-select> | 204 | ></v-select> |
205 | </v-layout> | 205 | </v-layout> |
206 | </v-flex> | 206 | </v-flex> |
207 | </v-layout> | 207 | </v-layout> |
208 | </v-flex> | 208 | </v-flex> |
209 | </v-card-actions> | 209 | </v-card-actions> |
210 | <v-spacer></v-spacer> | 210 | <v-spacer></v-spacer> |
211 | <v-btn | 211 | <v-btn |
212 | @click="getAnnoucementes()" | 212 | @click="getAnnoucementes()" |
213 | round | 213 | round |
214 | dark | 214 | dark |
215 | :loading="loading" | 215 | :loading="loading" |
216 | class="open-dialog-button hidden-xs-only hidden-sm-only" | 216 | class="open-dialog-button hidden-xs-only hidden-sm-only" |
217 | >Find</v-btn> | 217 | >Find</v-btn> |
218 | <v-card-title class="body-1" v-show="show"> | 218 | <v-card-title class="body-1" v-show="show"> |
219 | <v-btn icon large flat @click="displaySearch"> | 219 | <v-btn icon large flat @click="displaySearch"> |
220 | <v-avatar size="27"> | 220 | <v-avatar size="27"> |
221 | <img src="/static/icon/search.png" alt="icon" /> | 221 | <img src="/static/icon/search.png" alt="icon" /> |
222 | </v-avatar> | 222 | </v-avatar> |
223 | </v-btn> | 223 | </v-btn> |
224 | </v-card-title> | 224 | </v-card-title> |
225 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> | 225 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> |
226 | <v-layout> | 226 | <v-layout> |
227 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 227 | <v-text-field |
228 | autofocus | ||
229 | v-model="search" | ||
230 | label="Search" | ||
231 | prepend-inner-icon="search" | ||
232 | color="primary" | ||
233 | ></v-text-field> | ||
228 | <v-icon @click="closeSearch" color="error">close</v-icon> | 234 | <v-icon @click="closeSearch" color="error">close</v-icon> |
229 | </v-layout> | 235 | </v-layout> |
230 | </v-flex> | 236 | </v-flex> |
231 | </v-toolbar> | 237 | </v-toolbar> |
232 | <v-card flat class="elevation-0 transparent"> | 238 | <v-card flat class="elevation-0 transparent"> |
233 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> | 239 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> |
234 | <v-layout> | 240 | <v-layout> |
235 | <v-flex xs12> | 241 | <v-flex xs12> |
236 | <v-select | 242 | <v-select |
237 | :items="addclass" | 243 | :items="addclass" |
238 | label="Select Class" | 244 | label="Select Class" |
239 | v-model="selectAnnoucement.select" | 245 | v-model="selectAnnoucement.select" |
240 | item-text="classNum" | 246 | item-text="classNum" |
241 | item-value="_id" | 247 | item-value="_id" |
242 | name="Select Class" | 248 | name="Select Class" |
243 | :rules="classRules" | 249 | :rules="classRules" |
244 | class="px-2" | 250 | class="px-2" |
245 | ></v-select> | 251 | ></v-select> |
246 | </v-flex> | 252 | </v-flex> |
247 | </v-layout> | 253 | </v-layout> |
248 | <v-layout> | 254 | <v-layout> |
249 | <v-flex xs5 class="mx-auto mb-2"> | 255 | <v-flex xs5 class="mx-auto mb-2"> |
250 | <v-btn | 256 | <v-btn |
251 | @click="getAnnoucementes()" | 257 | @click="getAnnoucementes()" |
252 | block | 258 | block |
253 | round | 259 | round |
254 | dark | 260 | dark |
255 | :loading="loading" | 261 | :loading="loading" |
256 | class="add-button" | 262 | class="add-button" |
257 | >Find</v-btn> | 263 | >Find</v-btn> |
258 | </v-flex> | 264 | </v-flex> |
259 | </v-layout> | 265 | </v-layout> |
260 | </v-flex> | 266 | </v-flex> |
261 | </v-card> | 267 | </v-card> |
262 | <v-data-table | 268 | <v-data-table |
263 | :headers="headers" | 269 | :headers="headers" |
264 | :items="annoucementData" | 270 | :items="annoucementData" |
265 | :pagination.sync="pagination" | 271 | :pagination.sync="pagination" |
266 | :search="search" | 272 | :search="search" |
267 | > | 273 | > |
268 | <template slot="items" slot-scope="props"> | 274 | <template slot="items" slot-scope="props"> |
269 | <tr class="tr row-click" @click="rowAnnoucement(props.item._id)"> | 275 | <tr class="tr row-click" @click="rowAnnoucement(props.item._id)"> |
270 | <td class="text-xs-center td td-row"> | 276 | <td class="text-xs-center td td-row"> |
271 | <v-avatar size="40"> | 277 | <v-avatar size="40"> |
272 | <img :src="props.item.attachementUrl" v-if="props.item.attachementUrl" /> | 278 | <img :src="props.item.attachementUrl" v-if="props.item.attachementUrl" /> |
273 | <img src="/static/icon/user.png" v-else-if="!props.item.attachementUrl" /> | 279 | <img src="/static/icon/user.png" v-else-if="!props.item.attachementUrl" /> |
274 | </v-avatar> | 280 | </v-avatar> |
275 | </td> | 281 | </td> |
276 | <td class="text-xs-center td td-row">{{ props.item.discussionType}}</td> | 282 | <td class="text-xs-center td td-row">{{ props.item.discussionType}}</td> |
277 | <td class="text-xs-center td td-row"> | 283 | <td class="text-xs-center td td-row"> |
278 | <span> | 284 | <span> |
279 | <v-tooltip top> | 285 | <v-tooltip top> |
280 | <img | 286 | <img |
281 | slot="activator" | 287 | slot="activator" |
282 | style="cursor:pointer; width:25px; height:25px; " | 288 | style="cursor:pointer; width:25px; height:25px; " |
283 | class="mr-3" | 289 | class="mr-3" |
284 | @click="profile(props.item)" | 290 | @click="profile(props.item)" |
285 | src="/static/icon/view.png" | 291 | src="/static/icon/view.png" |
286 | /> | 292 | /> |
287 | <span>View</span> | 293 | <span>View</span> |
288 | </v-tooltip> | 294 | </v-tooltip> |
289 | <v-tooltip top> | 295 | <v-tooltip top> |
290 | <img | 296 | <img |
291 | slot="activator" | 297 | slot="activator" |
292 | style="cursor:pointer; width:20px; height:18px; " | 298 | style="cursor:pointer; width:20px; height:18px; " |
293 | class="mr-3" | 299 | class="mr-3" |
294 | @click="editItem(props.item)" | 300 | @click="editItem(props.item)" |
295 | src="/static/icon/edit.png" | 301 | src="/static/icon/edit.png" |
296 | /> | 302 | /> |
297 | <span>Edit</span> | 303 | <span>Edit</span> |
298 | </v-tooltip> | 304 | </v-tooltip> |
299 | <v-tooltip top> | 305 | <v-tooltip top> |
300 | <img | 306 | <img |
301 | slot="activator" | 307 | slot="activator" |
302 | style="cursor:pointer; width:20px; height:20px; " | 308 | style="cursor:pointer; width:20px; height:20px; " |
303 | class="mr-3" | 309 | class="mr-3" |
304 | @click="deleteItem(props.item)" | 310 | @click="deleteItem(props.item)" |
305 | src="/static/icon/delete.png" | 311 | src="/static/icon/delete.png" |
306 | /> | 312 | /> |
307 | <span>Delete</span> | 313 | <span>Delete</span> |
308 | </v-tooltip> | 314 | </v-tooltip> |
309 | </span> | 315 | </span> |
310 | </td> | 316 | </td> |
311 | </tr> | 317 | </tr> |
312 | </template> | 318 | </template> |
313 | <v-alert | 319 | <v-alert |
314 | slot="no-results" | 320 | slot="no-results" |
315 | :value="true" | 321 | :value="true" |
316 | color="error" | 322 | color="error" |
317 | icon="warning" | 323 | icon="warning" |
318 | >Your search for "{{ search }}" found no results.</v-alert> | 324 | >Your search for "{{ search }}" found no results.</v-alert> |
319 | </v-data-table> | 325 | </v-data-table> |
320 | <!-- ****** Add Annoucement DETAILS******--> | 326 | <!-- ****** Add Annoucement DETAILS******--> |
321 | <v-dialog v-model="addAnnoucementDialog" max-width="500"> | 327 | <v-dialog v-model="addAnnoucementDialog" max-width="500" v-if="addAnnoucementDialog"> |
322 | <v-card flat class="card-style pa-2" dark> | 328 | <v-card flat class="card-style pa-2" dark> |
323 | <v-layout> | 329 | <v-layout> |
324 | <v-flex xs12> | 330 | <v-flex xs12> |
325 | <label class="title text-xs-center">Add Annoucement</label> | 331 | <label class="title text-xs-center">Add Annoucement</label> |
326 | <v-icon size="24" class="right" @click="$refs.form.reset();addAnnoucementDialog = false">cancel</v-icon> | 332 | <v-icon |
333 | size="24" | ||
334 | class="right" | ||
335 | @click="$refs.form.reset();addAnnoucementDialog = false" | ||
336 | >cancel</v-icon> | ||
327 | </v-flex> | 337 | </v-flex> |
328 | </v-layout> | 338 | </v-layout> |
329 | <v-container fluid> | 339 | <v-container fluid> |
330 | <v-layout align-center> | 340 | <v-layout align-center> |
331 | <v-flex xs12> | 341 | <v-flex xs12> |
332 | <v-flex xs12 sm12> | 342 | <v-flex xs12 sm12> |
333 | <v-form ref="form" v-model="valid" lazy-validation> | 343 | <v-form ref="form" v-model="valid" lazy-validation> |
334 | <v-layout> | 344 | <v-layout> |
335 | <v-flex | 345 | <v-flex |
336 | xs12 | 346 | xs12 |
337 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 347 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
338 | > | 348 | > |
339 | <v-avatar size="100px" v-if="!imageUrl"> | 349 | <v-avatar size="100px" v-if="!imageUrl"> |
340 | <img src="/static/icon/user.png" /> | 350 | <img src="/static/icon/user.png" /> |
341 | </v-avatar> | 351 | </v-avatar> |
342 | <input | 352 | <input |
343 | type="file" | 353 | type="file" |
344 | style="display: none" | 354 | style="display: none" |
345 | ref="image" | 355 | ref="image" |
346 | accept="image/*" | 356 | accept="image/*" |
347 | @change="onFilePicked" | 357 | @change="onFilePicked" |
348 | /> | 358 | /> |
349 | <img | 359 | <img |
350 | :src="imageData.imageUrl" | 360 | :src="imageData.imageUrl" |
351 | height="150" | 361 | height="150" |
352 | width="150" | 362 | width="150" |
353 | v-if="imageUrl" | 363 | v-if="imageUrl" |
354 | style="border-radius:50%; width:200px" | 364 | style="border-radius:50%; width:200px" |
355 | /> | 365 | /> |
356 | </v-flex> | 366 | </v-flex> |
357 | </v-layout> | 367 | </v-layout> |
358 | <v-layout wrap> | 368 | <v-layout wrap> |
359 | <v-flex xs12 sm12> | 369 | <v-flex xs12 sm12> |
360 | <v-layout> | 370 | <v-layout> |
361 | <v-flex x4 sm4 class="pt-4 subheading"> | 371 | <v-flex x4 sm4 class="pt-4 subheading"> |
362 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 372 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
363 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 373 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
364 | </v-flex> | 374 | </v-flex> |
365 | <v-flex xs8 sm8 class="ml-3"> | 375 | <v-flex xs8 sm8 class="ml-3"> |
366 | <v-select | 376 | <v-select |
367 | :items="addclass" | 377 | :items="addclass" |
368 | label="Select Class" | 378 | label="Select Class" |
369 | v-model="addAnnoucement.select" | 379 | v-model="addAnnoucement.select" |
370 | item-text="classNum" | 380 | item-text="classNum" |
371 | item-value="_id" | 381 | item-value="_id" |
372 | name="Select Class" | 382 | name="Select Class" |
373 | :rules="classRules" | 383 | :rules="classRules" |
374 | @change="getCourses(addAnnoucement.select)" | 384 | @change="getCourses(addAnnoucement.select)" |
375 | required | 385 | required |
376 | ></v-select> | 386 | ></v-select> |
377 | </v-flex> | 387 | </v-flex> |
378 | </v-layout> | 388 | </v-layout> |
379 | </v-flex> | 389 | </v-flex> |
380 | </v-layout> | 390 | </v-layout> |
381 | <v-layout wrap> | 391 | <v-layout wrap> |
382 | <v-flex xs12 sm12> | 392 | <v-flex xs12 sm12> |
383 | <v-layout> | 393 | <v-layout> |
384 | <v-flex xs4 sm4 class="pt-4 subheading"> | 394 | <v-flex xs4 sm4 class="pt-4 subheading"> |
385 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | 395 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> |
386 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | 396 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> |
387 | </v-flex> | 397 | </v-flex> |
388 | <v-flex xs8 sm8 class="ml-3"> | 398 | <v-flex xs8 sm8 class="ml-3"> |
389 | <v-select | 399 | <v-select |
390 | :items="courseData" | 400 | :items="courseData" |
391 | item-text="courseName" | 401 | item-text="courseName" |
392 | item-value="_id" | 402 | item-value="_id" |
393 | v-model="addAnnoucement.courseName" | 403 | v-model="addAnnoucement.courseName" |
394 | placeholder="fill your Course name" | 404 | placeholder="fill your Course name" |
395 | type="text" | 405 | type="text" |
396 | :rules="courseRules" | 406 | :rules="courseRules" |
397 | required | 407 | required |
398 | ></v-select> | 408 | ></v-select> |
399 | </v-flex> | 409 | </v-flex> |
400 | </v-layout> | 410 | </v-layout> |
401 | </v-flex> | 411 | </v-flex> |
402 | <v-flex xs12 sm12> | 412 | <v-flex xs12 sm12> |
403 | <v-layout> | 413 | <v-layout> |
404 | <v-flex xs4 sm4 class="pt-4 subheading"> | 414 | <v-flex xs4 sm4 class="pt-4 subheading"> |
405 | <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> | 415 | <label class="right hidden-xs-only hidden-sm-only">Discussion Type:</label> |
406 | <label | 416 | <label |
407 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 417 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
408 | >DiscussionType:</label> | 418 | >DiscussionType:</label> |
409 | </v-flex> | 419 | </v-flex> |
410 | <v-flex xs8 sm8 class="ml-3"> | 420 | <v-flex xs8 sm8 class="ml-3"> |
411 | <v-text-field | 421 | <v-text-field |
412 | v-model="addAnnoucement.discussionType" | 422 | v-model="addAnnoucement.discussionType" |
413 | placeholder="fill your Course name" | 423 | placeholder="fill your Course name" |
414 | type="text" | 424 | type="text" |
415 | :rules="courseRules" | 425 | :rules="courseRules" |
416 | required | 426 | required |
417 | ></v-text-field> | 427 | ></v-text-field> |
418 | </v-flex> | 428 | </v-flex> |
419 | </v-layout> | 429 | </v-layout> |
420 | </v-flex> | 430 | </v-flex> |
421 | <v-flex xs12 sm12> | 431 | <v-flex xs12 sm12> |
422 | <v-layout> | 432 | <v-layout> |
423 | <v-flex xs4 class="pt-4 subheading"> | 433 | <v-flex xs4 class="pt-4 subheading"> |
424 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | 434 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> |
425 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> | 435 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> |
426 | </v-flex> | 436 | </v-flex> |
427 | <v-flex xs8 class="ml-3"> | 437 | <v-flex xs8 class="ml-3"> |
428 | <v-text-field | 438 | <v-text-field |
429 | label="Select Image" | 439 | label="Select Image" |
430 | @click="pickFile" | 440 | @click="pickFile" |
431 | v-model="imageName" | 441 | v-model="imageName" |
432 | append-icon="attach_file" | 442 | append-icon="attach_file" |
433 | ></v-text-field> | 443 | ></v-text-field> |
434 | </v-flex> | 444 | </v-flex> |
435 | </v-layout> | 445 | </v-layout> |
436 | </v-flex> | 446 | </v-flex> |
437 | </v-layout> | 447 | </v-layout> |
438 | <v-layout> | 448 | <v-layout> |
439 | <v-flex xs12 sm12> | 449 | <v-flex xs12 sm12> |
440 | <v-layout class="right"> | 450 | <v-layout class="right"> |
441 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 451 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
442 | </v-layout> | 452 | </v-layout> |
443 | </v-flex> | 453 | </v-flex> |
444 | </v-layout> | 454 | </v-layout> |
445 | </v-form> | 455 | </v-form> |
446 | </v-flex> | 456 | </v-flex> |
447 | </v-flex> | 457 | </v-flex> |
448 | </v-layout> | 458 | </v-layout> |
449 | </v-container> | 459 | </v-container> |
450 | </v-card> | 460 | </v-card> |
451 | </v-dialog> | 461 | </v-dialog> |
452 | <v-snackbar | 462 | <v-snackbar |
453 | :timeout="timeout" | 463 | :timeout="timeout" |
454 | :top="y === 'top'" | 464 | :top="y === 'top'" |
455 | :right="x === 'right'" | 465 | :right="x === 'right'" |
456 | :vertical="mode === 'vertical'" | 466 | :vertical="mode === 'vertical'" |
457 | v-model="snackbar" | 467 | v-model="snackbar" |
458 | :color="color" | 468 | :color="color" |
459 | >{{ text }}</v-snackbar> | 469 | >{{ text }}</v-snackbar> |
460 | <div class="loader" v-if="showLoader"> | 470 | <div class="loader" v-if="showLoader"> |
461 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 471 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
462 | </div> | 472 | </div> |
463 | </v-container> | 473 | </v-container> |
464 | </template> | 474 | </template> |
465 | 475 | ||
466 | <script> | 476 | <script> |
467 | import http from "@/Services/http.js"; | 477 | import http from "@/Services/http.js"; |
468 | import moment from "moment"; | 478 | import moment from "moment"; |
469 | import countryList from "@/script/country.js"; | 479 | import countryList from "@/script/country.js"; |
470 | import parent from "@/script/parents.js"; | 480 | import parent from "@/script/parents.js"; |
471 | 481 | ||
472 | export default { | 482 | export default { |
473 | data: () => ({ | 483 | data: () => ({ |
474 | showNext: false, | 484 | showNext: false, |
475 | snackbar: false, | 485 | snackbar: false, |
476 | y: "top", | 486 | y: "top", |
477 | x: "right", | 487 | x: "right", |
478 | role: "", | 488 | role: "", |
479 | mode: "", | 489 | mode: "", |
480 | append: "", | 490 | append: "", |
481 | timeout: 3000, | 491 | timeout: 3000, |
482 | text: "", | 492 | text: "", |
483 | show: true, | 493 | show: true, |
484 | color: "", | 494 | color: "", |
485 | showSearch: false, | 495 | showSearch: false, |
486 | showLoader: false, | 496 | showLoader: false, |
487 | loading: false, | 497 | loading: false, |
488 | editLoading: false, | 498 | editLoading: false, |
489 | date: null, | 499 | date: null, |
490 | search: "", | 500 | search: "", |
491 | menu: false, | 501 | menu: false, |
492 | menu1: false, | 502 | menu1: false, |
493 | editStudentDialog: false, | 503 | editStudentDialog: false, |
494 | profileStudentDialog: false, | 504 | profileStudentDialog: false, |
495 | addAnnoucementDialog: false, | 505 | addAnnoucementDialog: false, |
496 | valid: true, | 506 | valid: true, |
497 | addclass: [], | 507 | addclass: [], |
498 | addSection: [], | 508 | addSection: [], |
499 | pagination: { | 509 | pagination: { |
500 | rowsPerPage: 10, | 510 | rowsPerPage: 10, |
501 | }, | 511 | }, |
502 | imageData: {}, | 512 | imageData: {}, |
503 | imageName: "", | 513 | imageName: "", |
504 | imageUrl: "", | 514 | imageUrl: "", |
505 | imageFile: "", | 515 | imageFile: "", |
506 | editImageName: "", | 516 | editImageName: "", |
507 | editImageUrl: "", | 517 | editImageUrl: "", |
508 | courseRules: [(v) => !!v || " Course Name is required"], | 518 | courseRules: [(v) => !!v || " Course Name is required"], |
509 | classRules: [(v) => !!v || " Class Name is required"], | 519 | classRules: [(v) => !!v || " Class Name is required"], |
510 | sectionRules: [(v) => !!v || "Section Name is required"], | 520 | sectionRules: [(v) => !!v || "Section Name is required"], |
511 | errorMessages: "", | 521 | errorMessages: "", |
512 | headers: [ | 522 | headers: [ |
513 | { | 523 | { |
514 | text: "Image", | 524 | text: "Image", |
515 | value: "attachementUrl", | 525 | value: "attachementUrl", |
516 | sortable: false, | 526 | sortable: false, |
517 | align: "center", | 527 | align: "center", |
518 | }, | 528 | }, |
519 | { | 529 | { |
520 | text: "Discussion Type", | 530 | text: "Discussion Type", |
521 | value: "discussionType", | 531 | value: "discussionType", |
522 | sortable: false, | 532 | sortable: false, |
523 | align: "center", | 533 | align: "center", |
524 | }, | 534 | }, |
525 | { text: "Action", value: "", sortable: false, align: "center" }, | 535 | { text: "Action", value: "", sortable: false, align: "center" }, |
526 | ], | 536 | ], |
527 | courseData: [], | 537 | courseData: [], |
528 | editedIndex: -1, | 538 | editedIndex: -1, |
529 | addAnnoucement: { | 539 | addAnnoucement: { |
530 | select: "", | 540 | select: "", |
531 | }, | 541 | }, |
532 | selectAnnoucement: {}, | 542 | selectAnnoucement: {}, |
533 | editedItem: {}, | 543 | editedItem: {}, |
534 | annoucementData: [], | 544 | annoucementData: [], |
535 | }), | 545 | }), |
546 | watch: { | ||
547 | addAnnoucementDialog: function (val) { | ||
548 | if (!val) { | ||
549 | this.addAnnoucement = []; | ||
550 | this.imageName = ""; | ||
551 | this.imageFile = ""; | ||
552 | this.imageUrl = ""; | ||
553 | } | ||
554 | }, | ||
555 | }, | ||
536 | methods: { | 556 | methods: { |
537 | getCourses(selectCourseId) { | 557 | getCourses(selectCourseId) { |
538 | this.showLoader = true; | 558 | this.showLoader = true; |
539 | http() | 559 | http() |
540 | .get("/getCourseesList", { | 560 | .get("/getCourseesList", { |
541 | params: { | 561 | params: { |
542 | classId: selectCourseId, | 562 | classId: selectCourseId, |
543 | }, | 563 | }, |
544 | }) | 564 | }) |
545 | .then((response) => { | 565 | .then((response) => { |
546 | this.courseData = response.data.data; | 566 | this.courseData = response.data.data; |
547 | this.showLoader = false; | 567 | this.showLoader = false; |
548 | }) | 568 | }) |
549 | .catch((err) => { | 569 | .catch((err) => { |
550 | console.log("err====>", err); | 570 | console.log("err====>", err); |
551 | this.showLoader = false; | 571 | this.showLoader = false; |
552 | }); | 572 | }); |
553 | }, | 573 | }, |
554 | getAnnoucementes() { | 574 | getAnnoucementes() { |
555 | this.showLoader = true; | 575 | this.showLoader = true; |
556 | http() | 576 | http() |
557 | .get("/getAnnoucementesList", { | 577 | .get("/getAnnoucementesList", { |
558 | params: { | 578 | params: { |
559 | courseId: this.selectAnnoucement.courseId, | 579 | courseId: this.selectAnnoucement.courseId, |
560 | classId: this.selectAnnoucement.classId, | 580 | classId: this.selectAnnoucement.classId, |
561 | }, | 581 | }, |
562 | }) | 582 | }) |
563 | .then((response) => { | 583 | .then((response) => { |
564 | this.annoucementData = response.data.data; | 584 | this.annoucementData = response.data.data; |
565 | this.showLoader = false; | 585 | this.showLoader = false; |
566 | }) | 586 | }) |
567 | .catch((err) => { | 587 | .catch((err) => { |
568 | console.log("err====>", err); | 588 | console.log("err====>", err); |
569 | this.showLoader = false; | 589 | this.showLoader = false; |
570 | }); | 590 | }); |
571 | }, | 591 | }, |
572 | // getSections(_id) { | 592 | // getSections(_id) { |
573 | // var token = this.$store.state.token; | 593 | // var token = this.$store.state.token; |
574 | // this.showLoader = true; | 594 | // this.showLoader = true; |
575 | // http() | 595 | // http() |
576 | // .get( | 596 | // .get( |
577 | // "/getSectionsList", | 597 | // "/getSectionsList", |
578 | // { params: { classId: _id } }, | 598 | // { params: { classId: _id } }, |
579 | // { | 599 | // { |
580 | // headers: { Authorization: "Bearer " + token } | 600 | // headers: { Authorization: "Bearer " + token } |
581 | // } | 601 | // } |
582 | // ) | 602 | // ) |
583 | // .then(response => { | 603 | // .then(response => { |
584 | // this.addSection = response.data.data; | 604 | // this.addSection = response.data.data; |
585 | // this.showLoader = false; | 605 | // this.showLoader = false; |
586 | // }) | 606 | // }) |
587 | // .catch(err => { | 607 | // .catch(err => { |
588 | // this.showLoader = false; | 608 | // this.showLoader = false; |
589 | // }); | 609 | // }); |
590 | // }, | 610 | // }, |
591 | pickFile() { | 611 | pickFile() { |
592 | this.$refs.image.click(); | 612 | this.$refs.image.click(); |
593 | }, | 613 | }, |
594 | pickEditFile() { | 614 | pickEditFile() { |
595 | this.$refs.editDataImage.click(); | 615 | this.$refs.editDataImage.click(); |
596 | }, | 616 | }, |
597 | dates: function (date) { | 617 | dates: function (date) { |
598 | return moment(date).format("MMMM DD, YYYY"); | 618 | return moment(date).format("MMMM DD, YYYY"); |
599 | return date; | 619 | return date; |
600 | }, | 620 | }, |
601 | onFilePicked(e) { | 621 | onFilePicked(e) { |
602 | // console.log(e) | 622 | // console.log(e) |
603 | const files = e.target.files; | 623 | const files = e.target.files; |
604 | this.imageData.upload = e.target.files[0]; | 624 | this.imageData.upload = e.target.files[0]; |
605 | if (files[0] !== undefined) { | 625 | if (files[0] !== undefined) { |
606 | this.imageName = files[0].name; | 626 | this.imageName = files[0].name; |
607 | if (this.imageName.lastIndexOf(".") <= 0) { | 627 | if (this.imageName.lastIndexOf(".") <= 0) { |
608 | return; | 628 | return; |
609 | } | 629 | } |
610 | const fr = new FileReader(); | 630 | const fr = new FileReader(); |
611 | fr.readAsDataURL(files[0]); | 631 | fr.readAsDataURL(files[0]); |
612 | fr.addEventListener("load", () => { | 632 | fr.addEventListener("load", () => { |
613 | this.imageUrl = fr.result; | 633 | this.imageUrl = fr.result; |
614 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 634 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
615 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 635 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
616 | }); | 636 | }); |
617 | } else { | 637 | } else { |
618 | this.imageName = ""; | 638 | this.imageName = ""; |
619 | this.imageFile = ""; | 639 | this.imageFile = ""; |
620 | this.imageUrl = ""; | 640 | this.imageUrl = ""; |
621 | } | 641 | } |
622 | }, | 642 | }, |
623 | onEditFilePicked(e) { | 643 | onEditFilePicked(e) { |
624 | console.log(e); | 644 | console.log(e); |
625 | const files = e.target.files; | 645 | const files = e.target.files; |
626 | if (files[0] !== undefined) { | 646 | if (files[0] !== undefined) { |
627 | this.editImageName = files[0].name; | 647 | this.editImageName = files[0].name; |
628 | if (this.editImageName.lastIndexOf(".") <= 0) { | 648 | if (this.editImageName.lastIndexOf(".") <= 0) { |
629 | return; | 649 | return; |
630 | } | 650 | } |
631 | const fr = new FileReader(); | 651 | const fr = new FileReader(); |
632 | fr.readAsDataURL(files[0]); | 652 | fr.readAsDataURL(files[0]); |
633 | fr.addEventListener("load", () => { | 653 | fr.addEventListener("load", () => { |
634 | this.editImageUrl = fr.result; | 654 | this.editImageUrl = fr.result; |
635 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... | 655 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... |
636 | }); | 656 | }); |
637 | } else { | 657 | } else { |
638 | this.editImageName = ""; | 658 | this.editImageName = ""; |
639 | this.editiImageFile = ""; | 659 | this.editiImageFile = ""; |
640 | } | 660 | } |
641 | }, | 661 | }, |
642 | editItem(item) { | 662 | editItem(item) { |
643 | this.editedIndex = this.courseData.indexOf(item); | 663 | this.editedIndex = this.courseData.indexOf(item); |
644 | this.editedItem = Object.assign({}, item); | 664 | this.editedItem = Object.assign({}, item); |
645 | this.editStudentDialog = true; | 665 | this.editStudentDialog = true; |
646 | }, | 666 | }, |
647 | profile(item) { | 667 | profile(item) { |
648 | this.editedIndex = this.courseData.indexOf(item); | 668 | this.editedIndex = this.courseData.indexOf(item); |
649 | this.editedItem = Object.assign({}, item); | 669 | this.editedItem = Object.assign({}, item); |
650 | this.profileStudentDialog = true; | 670 | this.profileStudentDialog = true; |
651 | }, | 671 | }, |
652 | deleteItem(item) { | 672 | deleteItem(item) { |
653 | let deleteAnnoucement = { | 673 | let deleteAnnoucement = { |
654 | annoucementId: item._id, | 674 | annoucementId: item._id, |
655 | }; | 675 | }; |
656 | http() | 676 | http() |
657 | .delete( | 677 | .delete( |
658 | "/deleteAnnoucement", | 678 | "/deleteAnnoucement", |
659 | confirm("Are you sure you want to delete this?") && { | 679 | confirm("Are you sure you want to delete this?") && { |
660 | params: deleteAnnoucement, | 680 | params: deleteAnnoucement, |
661 | } | 681 | } |
662 | ) | 682 | ) |
663 | .then((response) => { | 683 | .then((response) => { |
664 | this.snackbar = true; | 684 | this.snackbar = true; |
665 | this.text = response.data.message; | 685 | this.text = response.data.message; |
666 | this.color = "green"; | 686 | this.color = "green"; |
667 | this.getAnnoucementes(); | 687 | this.getAnnoucementes(); |
668 | }) | 688 | }) |
669 | .catch((error) => { | 689 | .catch((error) => { |
670 | this.snackbar = true; | 690 | this.snackbar = true; |
671 | this.text = error.response.data.message; | 691 | this.text = error.response.data.message; |
672 | this.color = "error"; | 692 | this.color = "error"; |
673 | }); | 693 | }); |
674 | }, | 694 | }, |
675 | close() { | 695 | close() { |
676 | this.editStudentDialog = false; | 696 | this.editStudentDialog = false; |
677 | }, | 697 | }, |
678 | closeStudentProfile() { | 698 | closeStudentProfile() { |
679 | this.profileStudentDialog = false; | 699 | this.profileStudentDialog = false; |
680 | }, | 700 | }, |
681 | rowAnnoucement(id) { | 701 | rowAnnoucement(id) { |
682 | this.$router.push({ | 702 | this.$router.push({ |
683 | name: "Annoucement Forum", | 703 | name: "Annoucement Forum", |
684 | params: { annoucementId: id }, | 704 | params: { annoucementId: id }, |
685 | }); | 705 | }); |
686 | }, | 706 | }, |
687 | submit() { | 707 | submit() { |
688 | if (this.$refs.form.validate()) { | 708 | if (this.$refs.form.validate()) { |
689 | let addCourse = { | 709 | let addCourse = { |
690 | classId: this.addAnnoucement.select, | 710 | classId: this.addAnnoucement.select, |
691 | sectionId: this.addAnnoucement.selectSection, | 711 | sectionId: this.addAnnoucement.selectSection, |
692 | discussionType: this.addAnnoucement.discussionType, | 712 | discussionType: this.addAnnoucement.discussionType, |
693 | courseId: this.addAnnoucement.courseName, | 713 | courseId: this.addAnnoucement.courseName, |
694 | }; | 714 | }; |
695 | if (this.imageUrl) { | 715 | if (this.imageUrl) { |
696 | var str = this.imageUrl; | 716 | var str = this.imageUrl; |
697 | const [baseUrl, imageUrl] = str.split(/,/); | 717 | const [baseUrl, imageUrl] = str.split(/,/); |
698 | addCourse.upload = imageUrl; | 718 | addCourse.upload = imageUrl; |
699 | } | 719 | } |
700 | this.loading = true; | 720 | this.loading = true; |
701 | http() | 721 | http() |
702 | .post("/createAnnoucement", addCourse) | 722 | .post("/createAnnoucement", addCourse) |
703 | .then((response) => { | 723 | .then((response) => { |
704 | this.snackbar = true; | 724 | this.snackbar = true; |
705 | this.text = "New Annoucement added successfully"; | 725 | this.text = "New Annoucement added successfully"; |
706 | this.color = "green"; | 726 | this.color = "green"; |
707 | this.addAnnoucementDialog = false; | 727 | this.addAnnoucementDialog = false; |
708 | this.clear(); | 728 | this.clear(); |
709 | this.loading = false; | 729 | this.loading = false; |
710 | }) | 730 | }) |
711 | .catch((error) => { | 731 | .catch((error) => { |
712 | this.snackbar = true; | 732 | this.snackbar = true; |
713 | this.text = error.response.data.message; | 733 | this.text = error.response.data.message; |
714 | this.color = "error"; | 734 | this.color = "error"; |
715 | this.loading = false; | 735 | this.loading = false; |
716 | }); | 736 | }); |
717 | } | 737 | } |
718 | }, | 738 | }, |
719 | clear() { | 739 | clear() { |
720 | this.$refs.form.reset(); | 740 | this.$refs.form.reset(); |
721 | this.imageUrl = ""; | 741 | this.imageUrl = ""; |
722 | }, | 742 | }, |
723 | save() { | 743 | save() { |
724 | let editAnnoucement = { | 744 | let editAnnoucement = { |
725 | annoucementId: this.editedItem._id, | 745 | annoucementId: this.editedItem._id, |
726 | discussionType: this.editedItem.discussionType, | 746 | discussionType: this.editedItem.discussionType, |
727 | classId: this.editedItem.select, | 747 | classId: this.editedItem.select, |
728 | courseId: this.editedItem.courseName, | 748 | courseId: this.editedItem.courseName, |
729 | }; | 749 | }; |
730 | if (this.editImageUrl) { | 750 | if (this.editImageUrl) { |
731 | var str = this.editImageUrl; | 751 | var str = this.editImageUrl; |
732 | const [baseUrl, editImageUrl] = str.split(/,/); | 752 | const [baseUrl, editImageUrl] = str.split(/,/); |
733 | editAnnoucement.upload = editImageUrl; | 753 | editAnnoucement.upload = editImageUrl; |
734 | } | 754 | } |
735 | this.editLoading = true; | 755 | this.editLoading = true; |
736 | http() | 756 | http() |
737 | .put("/updateAnnoucement", editAnnoucement) | 757 | .put("/updateAnnoucement", editAnnoucement) |
738 | .then((response) => { | 758 | .then((response) => { |
739 | this.snackbar = true; | 759 | this.snackbar = true; |
740 | this.text = response.data.message; | 760 | this.text = response.data.message; |
741 | this.color = "green"; | 761 | this.color = "green"; |
742 | this.imageUrl = ""; | 762 | this.imageUrl = ""; |
743 | this.getAnnoucementes(); | 763 | this.getAnnoucementes(); |
744 | this.close(); | 764 | this.close(); |
745 | this.editLoading = false; | 765 | this.editLoading = false; |
746 | }) | 766 | }) |
747 | .catch((error) => { | 767 | .catch((error) => { |
748 | this.snackbar = true; | 768 | this.snackbar = true; |
749 | this.text = error.response.data.statusText; | 769 | this.text = error.response.data.statusText; |
750 | this.color = "error"; | 770 | this.color = "error"; |
751 | this.editLoading = false; | 771 | this.editLoading = false; |
752 | }); | 772 | }); |
753 | }, | 773 | }, |
754 | displaySearch() { | 774 | displaySearch() { |
755 | this.show = false; | 775 | this.show = false; |
756 | this.showSearch = true; | 776 | this.showSearch = true; |
757 | }, | 777 | }, |
758 | closeSearch() { | 778 | closeSearch() { |
759 | this.showSearch = false; | 779 | this.showSearch = false; |
760 | this.show = true; | 780 | this.show = true; |
761 | this.search = ""; | 781 | this.search = ""; |
762 | }, | 782 | }, |
763 | }, | 783 | }, |
764 | mounted() { | 784 | mounted() { |
765 | var token = this.$store.state.token; | 785 | var token = this.$store.state.token; |
766 | http() | 786 | http() |
767 | .get("/getClassesList", { | 787 | .get("/getClassesList", { |
768 | headers: { Authorization: "Bearer " + token }, | 788 | headers: { Authorization: "Bearer " + token }, |
769 | }) | 789 | }) |
770 | .then((response) => { | 790 | .then((response) => { |
771 | this.addclass = response.data.data; | 791 | this.addclass = response.data.data; |
772 | }) | 792 | }) |
773 | .catch((error) => { | 793 | .catch((error) => { |
774 | this.showLoader = false; | 794 | this.showLoader = false; |
775 | if (error.response.status === 401) { | 795 | if (error.response.status === 401) { |
776 | this.$router.replace({ path: "/" }); | 796 | this.$router.replace({ path: "/" }); |
777 | this.$store.dispatch("setToken", null); | 797 | this.$store.dispatch("setToken", null); |
778 | this.$store.dispatch("Id", null); | 798 | this.$store.dispatch("Id", null); |
779 | this.$store.dispatch("Role", null); | 799 | this.$store.dispatch("Role", null); |
780 | } | 800 | } |
781 | }); | 801 | }); |
782 | }, | 802 | }, |
783 | }; | 803 | }; |
784 | </script> | 804 | </script> |
785 | <style> | 805 | <style> |
786 | .row-click { | 806 | .row-click { |
787 | cursor: pointer; | 807 | cursor: pointer; |
788 | } | 808 | } |
789 | </style> | 809 | </style> |
src/pages/Attendence/studentAttendence.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <v-snackbar | 3 | <v-snackbar |
4 | :timeout="timeout" | 4 | :timeout="timeout" |
5 | :top="y === 'top'" | 5 | :top="y === 'top'" |
6 | :right="x === 'right'" | 6 | :right="x === 'right'" |
7 | :vertical="mode === 'vertical'" | 7 | :vertical="mode === 'vertical'" |
8 | v-model="snackbar" | 8 | v-model="snackbar" |
9 | color="success" | 9 | color="success" |
10 | >{{ text }}</v-snackbar> | 10 | >{{ text }}</v-snackbar> |
11 | <!-- ****** ATTENDENCE STUDENTS TABLE ****** --> | 11 | <!-- ****** ATTENDENCE STUDENTS TABLE ****** --> |
12 | <!-- <download-csv :data="json_data"> | 12 | <!-- <download-csv :data="json_data"> |
13 | <v-btn>Download Data</v-btn> | 13 | <v-btn>Download Data</v-btn> |
14 | </download-csv>--> | 14 | </download-csv>--> |
15 | <v-toolbar color="transparent" flat> | 15 | <v-toolbar color="transparent" flat> |
16 | <v-btn | 16 | <v-btn |
17 | fab | 17 | fab |
18 | dark | 18 | dark |
19 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 19 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
20 | small | 20 | small |
21 | @click="addStudentAttendenceDialog = true" | 21 | @click="addStudentAttendenceDialog = true" |
22 | > | 22 | > |
23 | <v-icon dark>add</v-icon> | 23 | <v-icon dark>add</v-icon> |
24 | </v-btn> | 24 | </v-btn> |
25 | <v-btn | 25 | <v-btn |
26 | v-if="role != 'ADMIN' && schoolRole != 'SCHOOLADMIN' " | 26 | v-if="role != 'ADMIN' && schoolRole != 'SCHOOLADMIN' " |
27 | round | 27 | round |
28 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 28 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
29 | dark | 29 | dark |
30 | @click="addStudentAttendenceDialog = true" | 30 | @click="addStudentAttendenceDialog = true" |
31 | > | 31 | > |
32 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Student Attendence | 32 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Student Attendence |
33 | </v-btn> | 33 | </v-btn> |
34 | 34 | ||
35 | <v-spacer></v-spacer> | 35 | <v-spacer></v-spacer> |
36 | <v-flex xs12 sm4 md2> | 36 | <v-flex xs12 sm4 md2> |
37 | <v-select | 37 | <v-select |
38 | small | 38 | small |
39 | :items="addclass" | 39 | :items="addclass" |
40 | label="Select Class" | 40 | label="Select Class" |
41 | v-model="getAttendence.classId" | 41 | v-model="getAttendence.classId" |
42 | item-text="classNum" | 42 | item-text="classNum" |
43 | item-value="_id" | 43 | item-value="_id" |
44 | name="Select Class" | 44 | name="Select Class" |
45 | @change="getSection(getAttendence.classId)" | 45 | @change="getSection(getAttendence.classId)" |
46 | class="px-2" | 46 | class="px-2" |
47 | required | 47 | required |
48 | ></v-select> | 48 | ></v-select> |
49 | </v-flex> | 49 | </v-flex> |
50 | <v-flex xs12 sm4 md2> | 50 | <v-flex xs12 sm4 md2> |
51 | <v-select | 51 | <v-select |
52 | small | 52 | small |
53 | :items="addSection" | 53 | :items="addSection" |
54 | label="Select Section" | 54 | label="Select Section" |
55 | v-model="getAttendence.sectionId" | 55 | v-model="getAttendence.sectionId" |
56 | item-text="name" | 56 | item-text="name" |
57 | item-value="_id" | 57 | item-value="_id" |
58 | name="Select Section" | 58 | name="Select Section" |
59 | @change="getStudents(getAttendence.sectionId)" | 59 | @change="getStudentsDetail(getAttendence.sectionId)" |
60 | class="px-2" | 60 | class="px-2" |
61 | required | 61 | required |
62 | ></v-select> | 62 | ></v-select> |
63 | </v-flex> | 63 | </v-flex> |
64 | <v-card-title class="body-1" v-show="show"> | 64 | <v-card-title class="body-1" v-show="show"> |
65 | <v-btn icon large flat @click="displaySearch"> | 65 | <v-btn icon large flat @click="displaySearch"> |
66 | <v-avatar size="27"> | 66 | <v-avatar size="27"> |
67 | <img src="/static/icon/search.png" alt="icon" /> | 67 | <img src="/static/icon/search.png" alt="icon" /> |
68 | </v-avatar> | 68 | </v-avatar> |
69 | </v-btn> | 69 | </v-btn> |
70 | </v-card-title> | 70 | </v-card-title> |
71 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 71 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
72 | <v-layout> | 72 | <v-layout> |
73 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 73 | <v-text-field |
74 | autofocus | ||
75 | v-model="search" | ||
76 | label="Search" | ||
77 | prepend-inner-icon="search" | ||
78 | color="primary" | ||
79 | ></v-text-field> | ||
74 | <v-icon @click="closeSearch" color="error">close</v-icon> | 80 | <v-icon @click="closeSearch" color="error">close</v-icon> |
75 | </v-layout> | 81 | </v-layout> |
76 | </v-flex> | 82 | </v-flex> |
77 | </v-toolbar> | 83 | </v-toolbar> |
78 | <v-data-table | 84 | <v-data-table |
79 | :headers="headers" | 85 | :headers="headers" |
80 | :items="studentsData" | 86 | :items="studentsData" |
81 | :pagination.sync="pagination" | 87 | :pagination.sync="pagination" |
82 | :search="search" | 88 | :search="search" |
83 | > | 89 | > |
84 | <template slot="items" slot-scope="props"> | 90 | <template slot="items" slot-scope="props"> |
85 | <tr class="tr"> | 91 | <tr class="tr"> |
86 | <td class="td td-row">{{ props.index + 1}}</td> | 92 | <td class="td td-row">{{ props.index + 1}}</td> |
87 | <td class="text-xs-center td td-row"> | 93 | <td class="text-xs-center td td-row"> |
88 | <v-avatar size="40"> | 94 | <v-avatar size="40"> |
89 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 95 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
90 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 96 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
91 | </v-avatar> | 97 | </v-avatar> |
92 | </td> | 98 | </td> |
93 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 99 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
94 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo}}</td> | 100 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo}}</td> |
95 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> | 101 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> |
96 | <td class="text-xs-center td td-row"> | 102 | <td class="text-xs-center td td-row"> |
97 | <router-link :to="{ name:'View Students Attendence',params: { id:props.item._id } }"> | 103 | <router-link :to="{ name:'View Students Attendence',params: { id:props.item._id } }"> |
98 | <v-tooltip top> | 104 | <v-tooltip top> |
99 | <img | 105 | <img |
100 | slot="activator" | 106 | slot="activator" |
101 | style="cursor:pointer; width:20px; height:25px; " | 107 | style="cursor:pointer; width:20px; height:25px; " |
102 | class="mr-3" | 108 | class="mr-3" |
103 | src="/static/icon/view.png" | 109 | src="/static/icon/view.png" |
104 | /> | 110 | /> |
105 | <span>View</span> | 111 | <span>View</span> |
106 | </v-tooltip> | 112 | </v-tooltip> |
107 | </router-link> | 113 | </router-link> |
108 | </td> | 114 | </td> |
109 | </tr> | 115 | </tr> |
110 | </template> | 116 | </template> |
111 | <v-alert | 117 | <v-alert |
112 | slot="no-results" | 118 | slot="no-results" |
113 | :value="true" | 119 | :value="true" |
114 | color="error" | 120 | color="error" |
115 | icon="warning" | 121 | icon="warning" |
116 | >Your search for "{{ search }}" found no results.</v-alert> | 122 | >Your search for "{{ search }}" found no results.</v-alert> |
117 | </v-data-table> | 123 | </v-data-table> |
118 | <!-- ****** Add Students Attendece****** --> | 124 | <!-- ****** Add Students Attendece****** --> |
119 | <v-dialog v-model="addStudentAttendenceDialog" width="1600"> | 125 | <v-dialog v-model="addStudentAttendenceDialog" width="1600" v-if="addStudentAttendenceDialog"> |
120 | <v-card flat class="pa-2"> | 126 | <v-card flat class="pa-2"> |
121 | <v-layout> | 127 | <v-layout> |
122 | <v-flex xs12> | 128 | <v-flex xs12> |
123 | <label class="title text-xs-center">Add Student Attendence</label> | 129 | <label class="title text-xs-center">Add Student Attendence</label> |
124 | <v-icon size="24" class="right" @click="$refs.form.reset();addStudentAttendenceDialog = false">cancel</v-icon> | 130 | <v-icon |
131 | size="24" | ||
132 | class="right" | ||
133 | @click="$refs.form.reset();addStudentAttendenceDialog = false" | ||
134 | >cancel</v-icon> | ||
125 | </v-flex> | 135 | </v-flex> |
126 | </v-layout> | 136 | </v-layout> |
127 | <v-flex xs12 class="mt-4"> | 137 | <v-flex xs12 class="mt-4"> |
128 | <v-form ref="form" v-model="valid" lazy-validation> | 138 | <v-form ref="form" v-model="valid" lazy-validation> |
129 | <v-flex xs12 sm12 lg12> | 139 | <v-flex xs12 sm12 lg12> |
130 | <v-layout wrap> | 140 | <v-layout wrap> |
131 | <v-flex xs6 sm6 lg3 md4> | 141 | <v-flex xs6 sm6 lg3 md4> |
132 | <v-layout> | 142 | <v-layout> |
133 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 143 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
134 | <label class="right">Class:</label> | 144 | <label class="right">Class:</label> |
135 | </v-flex> | 145 | </v-flex> |
136 | <v-flex xs9 sm6 lg8 class="ml-2"> | 146 | <v-flex xs9 sm6 lg8 class="ml-2"> |
137 | <v-select | 147 | <v-select |
138 | v-model="getReport.classId" | 148 | v-model="getReport.classId" |
139 | label="Select your class" | 149 | label="Select your class" |
140 | type="text" | 150 | type="text" |
141 | :items="addclass" | 151 | :items="addclass" |
142 | item-text="classNum" | 152 | item-text="classNum" |
143 | item-value="_id" | 153 | item-value="_id" |
144 | :rules="classRules" | 154 | :rules="classRules" |
145 | @change="getSection(getReport.classId)" | 155 | @change="getSection(getReport.classId)" |
146 | required | 156 | required |
147 | ></v-select> | 157 | ></v-select> |
148 | </v-flex> | 158 | </v-flex> |
149 | </v-layout> | 159 | </v-layout> |
150 | </v-flex> | 160 | </v-flex> |
151 | <v-flex xs6 sm6 lg3 md8> | 161 | <v-flex xs6 sm6 lg3 md8> |
152 | <v-layout> | 162 | <v-layout> |
153 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 163 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
154 | <label class="right">Section:</label> | 164 | <label class="right">Section:</label> |
155 | </v-flex> | 165 | </v-flex> |
156 | <v-flex xs9 sm6 lg8 class="ml-2"> | 166 | <v-flex xs9 sm6 lg8 class="ml-2"> |
157 | <v-select | 167 | <v-select |
158 | :items="addSection" | 168 | :items="addSection" |
159 | label="Select your Section" | 169 | label="Select your Section" |
160 | v-model="getReport.sectionId" | 170 | v-model="getReport.sectionId" |
161 | item-text="name" | 171 | item-text="name" |
162 | item-value="_id" | 172 | item-value="_id" |
163 | name="Select Section" | 173 | name="Select Section" |
164 | :rules="sectionRules" | 174 | :rules="sectionRules" |
165 | required | 175 | required |
166 | ></v-select> | 176 | ></v-select> |
167 | </v-flex> | 177 | </v-flex> |
168 | </v-layout> | 178 | </v-layout> |
169 | </v-flex> | 179 | </v-flex> |
170 | <v-flex xs6 sm6 lg3 md4> | 180 | <v-flex xs6 sm6 lg3 md4> |
171 | <v-menu | 181 | <v-menu |
172 | ref="menu" | 182 | ref="menu" |
173 | :close-on-content-click="false" | 183 | :close-on-content-click="false" |
174 | v-model="menu" | 184 | v-model="menu" |
175 | :nudge-right="40" | 185 | :nudge-right="40" |
176 | lazy | 186 | lazy |
177 | transition="scale-transition" | 187 | transition="scale-transition" |
178 | offset-y | 188 | offset-y |
179 | full-width | 189 | full-width |
180 | min-width="290px" | 190 | min-width="290px" |
181 | > | 191 | > |
182 | <v-text-field | 192 | <v-text-field |
183 | slot="activator" | 193 | slot="activator" |
184 | v-model="date" | 194 | v-model="date" |
185 | label="Select Date" | 195 | label="Select Date" |
186 | append-icon="event" | 196 | append-icon="event" |
187 | :rules="dataValid" | 197 | :rules="dataValid" |
188 | readonly | 198 | readonly |
189 | ></v-text-field> | 199 | ></v-text-field> |
190 | <v-date-picker | 200 | <v-date-picker |
191 | ref="picker" | 201 | ref="picker" |
192 | v-model="date" | 202 | v-model="date" |
193 | :max="new Date().toISOString().substr(0, 10)" | 203 | :max="new Date().toISOString().substr(0, 10)" |
194 | min="1950-01-01" | 204 | min="1950-01-01" |
195 | @change="save" | 205 | @change="save" |
196 | ></v-date-picker> | 206 | ></v-date-picker> |
197 | </v-menu> | 207 | </v-menu> |
198 | </v-flex> | 208 | </v-flex> |
199 | <v-flex xs6 sm6 lg9 md8> | 209 | <v-flex xs6 sm6 lg9 md8> |
200 | <v-btn round dark class="add-button" @click="showTable">Attendence</v-btn> | 210 | <v-btn round dark class="add-button" @click="showTable">Attendence</v-btn> |
201 | </v-flex> | 211 | </v-flex> |
202 | </v-layout> | 212 | </v-layout> |
203 | </v-flex> | 213 | </v-flex> |
204 | </v-form> | 214 | </v-form> |
205 | </v-flex> | 215 | </v-flex> |
206 | <v-flex xs12 v-show="attendeceTable" class> | 216 | <v-flex xs12 v-show="attendeceTable" class> |
207 | <v-data-table | 217 | <v-data-table |
208 | :headers="headers" | 218 | :headers="headers" |
209 | :items="studentsData" | 219 | :items="studentsData" |
210 | :pagination.sync="pagination" | 220 | :pagination.sync="pagination" |
211 | :search="search" | 221 | :search="search" |
212 | > | 222 | > |
213 | <template slot="items" slot-scope="props"> | 223 | <template slot="items" slot-scope="props"> |
214 | <tr class="tr"> | 224 | <tr class="tr"> |
215 | <td class="td td-row">{{ props.index + 1}}</td> | 225 | <td class="td td-row">{{ props.index + 1}}</td> |
216 | <td class="text-xs-center td td-row"> | 226 | <td class="text-xs-center td td-row"> |
217 | <v-avatar size="40"> | 227 | <v-avatar size="40"> |
218 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 228 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
219 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 229 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
220 | </v-avatar> | 230 | </v-avatar> |
221 | </td> | 231 | </td> |
222 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 232 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
223 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo }}</td> | 233 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo }}</td> |
224 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> | 234 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> |
225 | <td class="text-xs-center td td-row"> | 235 | <td class="text-xs-center td td-row"> |
226 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> | 236 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> |
227 | <v-radio | 237 | <v-radio |
228 | v-for="attendences in attendenceType" | 238 | v-for="attendences in attendenceType" |
229 | :key="attendences.value" | 239 | :key="attendences.value" |
230 | :label="`${attendences.label}`" | 240 | :label="`${attendences.label}`" |
231 | :value="attendences.value" | 241 | :value="attendences.value" |
232 | ></v-radio> | 242 | ></v-radio> |
233 | </v-radio-group> | 243 | </v-radio-group> |
234 | </td> | 244 | </td> |
235 | </tr> | 245 | </tr> |
236 | </template> | 246 | </template> |
237 | </v-data-table> | 247 | </v-data-table> |
238 | <v-flex xs12> | 248 | <v-flex xs12> |
239 | <v-card-actions> | 249 | <v-card-actions> |
240 | <v-spacer></v-spacer> | 250 | <v-spacer></v-spacer> |
241 | <v-btn @click="update()" class="add-button" round dark>Submit</v-btn> | 251 | <v-btn @click="update()" class="add-button" round dark>Submit</v-btn> |
242 | </v-card-actions> | 252 | </v-card-actions> |
243 | </v-flex> | 253 | </v-flex> |
244 | </v-flex> | 254 | </v-flex> |
245 | </v-card> | 255 | </v-card> |
246 | </v-dialog> | 256 | </v-dialog> |
247 | <v-snackbar | 257 | <v-snackbar |
248 | :timeout="timeout" | 258 | :timeout="timeout" |
249 | :top="y === 'top'" | 259 | :top="y === 'top'" |
250 | :right="x === 'right'" | 260 | :right="x === 'right'" |
251 | :vertical="mode === 'vertical'" | 261 | :vertical="mode === 'vertical'" |
252 | v-model="snackbar" | 262 | v-model="snackbar" |
253 | color="success" | 263 | color="success" |
254 | >{{ text }}</v-snackbar> | 264 | >{{ text }}</v-snackbar> |
255 | <div class="loader" v-if="showLoader"> | 265 | <div class="loader" v-if="showLoader"> |
256 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 266 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
257 | </div> | 267 | </div> |
258 | </v-container> | 268 | </v-container> |
259 | </template> | 269 | </template> |
260 | 270 | ||
261 | <script> | 271 | <script> |
262 | import http from "@/Services/http.js"; | 272 | import http from "@/Services/http.js"; |
263 | import moment from "moment"; | 273 | import moment from "moment"; |
264 | 274 | ||
265 | export default { | 275 | export default { |
266 | data: () => ({ | 276 | data: () => ({ |
267 | snackbar: false, | 277 | snackbar: false, |
268 | y: "top", | 278 | y: "top", |
269 | x: "right", | 279 | x: "right", |
270 | mode: "", | 280 | mode: "", |
271 | timeout: 3000, | 281 | timeout: 3000, |
272 | text: "", | 282 | text: "", |
273 | show: true, | 283 | show: true, |
274 | showSearch: false, | 284 | showSearch: false, |
275 | showLoader: false, | 285 | showLoader: false, |
276 | loading: false, | 286 | loading: false, |
277 | date: null, | 287 | date: null, |
278 | search: "", | 288 | search: "", |
279 | addclass: [], | 289 | addclass: [], |
280 | pagination: { | 290 | pagination: { |
281 | rowsPerPage: 10, | 291 | rowsPerPage: 10, |
282 | }, | 292 | }, |
283 | imageData: {}, | 293 | imageData: {}, |
284 | imageName: "", | 294 | imageName: "", |
285 | imageUrl: "", | 295 | imageUrl: "", |
286 | imageFile: "", | 296 | imageFile: "", |
287 | headers: [ | 297 | headers: [ |
288 | { | 298 | { |
289 | text: "No", | 299 | text: "No", |
290 | align: "", | 300 | align: "", |
291 | sortable: false, | 301 | sortable: false, |
292 | value: "index", | 302 | value: "index", |
293 | }, | 303 | }, |
294 | { | 304 | { |
295 | text: "Profile Pic", | 305 | text: "Profile Pic", |
296 | value: "profilprofilePicUrlePicUrl", | 306 | value: "profilprofilePicUrlePicUrl", |
297 | sortable: false, | 307 | sortable: false, |
298 | align: "center", | 308 | align: "center", |
299 | }, | 309 | }, |
300 | { text: "Name", value: "name", sortable: false, align: "center" }, | 310 | { text: "Name", value: "name", sortable: false, align: "center" }, |
301 | { | 311 | { |
302 | text: "Mobile No", | 312 | text: "Mobile No", |
303 | value: "fatherCellNo", | 313 | value: "fatherCellNo", |
304 | sortable: false, | 314 | sortable: false, |
305 | align: "center", | 315 | align: "center", |
306 | }, | 316 | }, |
307 | { text: "Email", value: "email", sortable: false, align: "center" }, | 317 | { text: "Email", value: "email", sortable: false, align: "center" }, |
308 | { text: "Attendance", value: "", sortable: false, align: "center" }, | 318 | { text: "Attendance", value: "", sortable: false, align: "center" }, |
309 | ], | 319 | ], |
310 | // json_data: [], | 320 | // json_data: [], |
311 | parentId: "", | 321 | parentId: "", |
312 | token: "", | 322 | token: "", |
313 | selectStudents: { | 323 | selectStudents: { |
314 | select: "", | 324 | select: "", |
315 | selectSection: "", | 325 | selectSection: "", |
316 | }, | 326 | }, |
317 | 327 | ||
318 | role: "", | 328 | role: "", |
319 | schoolRole: "", | 329 | schoolRole: "", |
320 | addStudentAttendenceDialog: false, | 330 | addStudentAttendenceDialog: false, |
321 | attendeceTable: false, | 331 | attendeceTable: false, |
322 | menu: false, | 332 | menu: false, |
323 | valid: true, | 333 | valid: true, |
324 | 334 | ||
325 | getReport: {}, | 335 | getReport: {}, |
326 | getAttendence: {}, | 336 | getAttendence: {}, |
327 | studentsList: [], | 337 | studentsList: [], |
328 | studentsData: [], | 338 | studentsData: [], |
329 | addSection: [], | 339 | addSection: [], |
330 | 340 | ||
331 | SectionName: ["A", "B", "C", "D", "E", "F"], | 341 | SectionName: ["A", "B", "C", "D", "E", "F"], |
332 | classRules: [(v) => !!v || "Class is required"], | 342 | classRules: [(v) => !!v || "Class is required"], |
333 | sectionRules: [(v) => !!v || "Class is required"], | 343 | sectionRules: [(v) => !!v || "Class is required"], |
334 | studentRules: [(v) => !!v || "Student is required"], | 344 | studentRules: [(v) => !!v || "Student is required"], |
335 | dataValid: [(v) => !!v || "Date is required"], | 345 | dataValid: [(v) => !!v || "Date is required"], |
336 | 346 | ||
337 | attendenceType: [ | 347 | attendenceType: [ |
338 | { | 348 | { |
339 | label: "Present", | 349 | label: "Present", |
340 | value: true, | 350 | value: true, |
341 | }, | 351 | }, |
342 | { | 352 | { |
343 | label: "Absent", | 353 | label: "Absent", |
344 | value: false, | 354 | value: false, |
345 | }, | 355 | }, |
346 | ], | 356 | ], |
347 | }), | 357 | }), |
358 | watch: { | ||
359 | addStudentAttendenceDialog: function (val) { | ||
360 | if (!val) { | ||
361 | this.getReport = []; | ||
362 | this.studentsData = []; | ||
363 | } | ||
364 | }, | ||
365 | }, | ||
348 | methods: { | 366 | methods: { |
349 | save(date) { | 367 | save(date) { |
350 | this.$refs.menu.save(date); | 368 | this.$refs.menu.save(date); |
351 | }, | 369 | }, |
352 | showTable() { | 370 | showTable() { |
353 | this.attendeceTable = true; | 371 | this.attendeceTable = true; |
354 | this.getStudents(); | 372 | this.getStudents(); |
355 | }, | 373 | }, |
356 | getAllClass() { | 374 | getAllClass() { |
357 | http() | 375 | http() |
358 | .get("/getClassesList", { | 376 | .get("/getClassesList", { |
359 | headers: { Authorization: "Bearer " + this.token }, | 377 | headers: { Authorization: "Bearer " + this.token }, |
360 | }) | 378 | }) |
361 | .then((response) => { | 379 | .then((response) => { |
362 | this.addclass = response.data.data; | 380 | this.addclass = response.data.data; |
363 | }) | 381 | }) |
364 | .catch((error) => { | 382 | .catch((error) => { |
365 | // console.log("err====>", err); | 383 | // console.log("err====>", err); |
366 | // this.$router.replace({ path: "/" }); | 384 | // this.$router.replace({ path: "/" }); |
367 | }); | 385 | }); |
368 | }, | 386 | }, |
369 | getSection(_id) { | 387 | getSection(_id) { |
370 | this.showLoader = true; | 388 | this.showLoader = true; |
371 | http() | 389 | http() |
372 | .get( | 390 | .get( |
373 | "/getSectionsList", | 391 | "/getSectionsList", |
374 | { params: { classId: _id } }, | 392 | { params: { classId: _id } }, |
375 | { | 393 | { |
376 | headers: { Authorization: "Bearer " + this.token }, | 394 | headers: { Authorization: "Bearer " + this.token }, |
377 | } | 395 | } |
378 | ) | 396 | ) |
379 | .then((response) => { | 397 | .then((response) => { |
380 | this.addSection = response.data.data; | 398 | this.addSection = response.data.data; |
381 | this.showLoader = false; | 399 | this.showLoader = false; |
382 | }) | 400 | }) |
383 | .catch((err) => { | 401 | .catch((err) => { |
384 | this.showLoader = false; | 402 | this.showLoader = false; |
385 | // console.log("err====>", err); | 403 | // console.log("err====>", err); |
386 | }); | 404 | }); |
387 | }, | 405 | }, |
388 | getStudents(_id) { | 406 | getStudents(_id) { |
389 | this.showLoader = true; | 407 | this.showLoader = true; |
390 | http() | 408 | http() |
391 | .get("/getStudentWithClass", { | 409 | .get("/getStudentWithClass", { |
392 | params: { | 410 | params: { |
411 | classId: this.getReport.classId, | ||
412 | sectionId: this.getReport.sectionId, | ||
413 | }, | ||
414 | }) | ||
415 | .then((response) => { | ||
416 | this.studentsData = response.data.data; | ||
417 | this.showLoader = false; | ||
418 | // this.addStudentAttendenceDialog = false; | ||
419 | var attendence = ""; | ||
420 | for (let i = 0; i < this.studentsData.length; i++) { | ||
421 | this.studentsData[i].attendence = true; | ||
422 | } | ||
423 | }) | ||
424 | .catch((error) => { | ||
425 | console.log("err====>", error); | ||
426 | this.showLoader = false; | ||
427 | }); | ||
428 | }, | ||
429 | getStudentsDetail(_id) { | ||
430 | this.showLoader = true; | ||
431 | http() | ||
432 | .get("/getStudentWithClass", { | ||
433 | params: { | ||
393 | classId: this.getAttendence.classId, | 434 | classId: this.getAttendence.classId, |
394 | sectionId: this.getAttendence.sectionId, | 435 | sectionId: this.getAttendence.sectionId, |
395 | }, | 436 | }, |
396 | }) | 437 | }) |
397 | .then((response) => { | 438 | .then((response) => { |
398 | this.studentsData = response.data.data; | 439 | this.studentsData = response.data.data; |
399 | this.showLoader = false; | 440 | this.showLoader = false; |
400 | // this.addStudentAttendenceDialog = false; | 441 | // this.addStudentAttendenceDialog = false; |
401 | var attendence = ""; | 442 | var attendence = ""; |
402 | for (let i = 0; i < this.studentsData.length; i++) { | 443 | for (let i = 0; i < this.studentsData.length; i++) { |
403 | this.studentsData[i].attendence = true; | 444 | this.studentsData[i].attendence = true; |
404 | } | 445 | } |
405 | }) | 446 | }) |
406 | .catch((error) => { | 447 | .catch((error) => { |
407 | console.log("err====>", error); | 448 | console.log("err====>", error); |
408 | this.showLoader = false; | 449 | this.showLoader = false; |
409 | }); | 450 | }); |
410 | }, | 451 | }, |
411 | update() { | 452 | update() { |
412 | var studentsAttendence = []; | 453 | var studentsAttendence = []; |
413 | for (var j = 0; j < this.studentsData.length; j++) { | 454 | for (var j = 0; j < this.studentsData.length; j++) { |
414 | studentsAttendence.push({ | 455 | studentsAttendence.push({ |
415 | studentId: this.studentsData[j]._id, | 456 | studentId: this.studentsData[j]._id, |
416 | isPresent: this.studentsData[j].attendence, | 457 | isPresent: this.studentsData[j].attendence, |
417 | }); | 458 | }); |
418 | } | 459 | } |
419 | if (this.$refs.form.validate()) { | 460 | if (this.$refs.form.validate()) { |
420 | let attendanceData = { | 461 | let attendanceData = { |
421 | sectionId: this.getReport.sectionId, | 462 | sectionId: this.getReport.sectionId, |
422 | date: this.date, | 463 | date: this.date, |
423 | students: studentsAttendence, | 464 | students: studentsAttendence, |
424 | }; | 465 | }; |
425 | http() | 466 | http() |
426 | .put("/updateAttendance", attendanceData) | 467 | .put("/updateAttendance", attendanceData) |
427 | .then((response) => { | 468 | .then((response) => { |
428 | this.snackbar = true; | 469 | this.snackbar = true; |
429 | this.text = response.data.message; | 470 | this.text = response.data.message; |
430 | this.addStudentAttendenceDialog = false; | 471 | this.addStudentAttendenceDialog = false; |
431 | }) | 472 | }) |
432 | .catch((error) => { | 473 | .catch((error) => { |
433 | this.snackbar = true; | 474 | this.snackbar = true; |
434 | this.text = error.response.data.message; | 475 | this.text = error.response.data.message; |
435 | }); | 476 | }); |
436 | } | 477 | } |
437 | }, | 478 | }, |
438 | 479 | ||
439 | displaySearch() { | 480 | displaySearch() { |
440 | this.show = false | 481 | this.show = false; |
441 | this.showSearch = true; | 482 | this.showSearch = true; |
442 | }, | 483 | }, |
443 | closeSearch() { | 484 | closeSearch() { |
444 | this.showSearch = false; | 485 | this.showSearch = false; |
445 | this.show = true; | 486 | this.show = true; |
446 | this.search = ""; | 487 | this.search = ""; |
447 | }, | 488 | }, |
448 | }, | 489 | }, |
449 | mounted() { | 490 | mounted() { |
450 | // this.getStudentList(); | 491 | // this.getStudentList(); |
451 | this.token = this.$store.state.token; | 492 | this.token = this.$store.state.token; |
452 | this.getAllClass(); | 493 | this.getAllClass(); |
453 | this.role = this.$store.state.role; | 494 | this.role = this.$store.state.role; |
454 | }, | 495 | }, |
455 | }; | 496 | }; |
456 | </script> | 497 | </script> |
src/pages/Attendence/teacherAttendence.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** ATTENDENCE TACHERS TABLE ****** --> | 3 | <!-- ****** ATTENDENCE TACHERS 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="addTeacherAttendenceDialog = true" | 10 | @click="addTeacherAttendenceDialog = 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 | v-if="role != 'TEACHER' " | 15 | v-if="role != 'TEACHER' " |
16 | round | 16 | round |
17 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 17 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
18 | dark | 18 | dark |
19 | @click="addTeacherAttendenceDialog = true" | 19 | @click="addTeacherAttendenceDialog = true" |
20 | > | 20 | > |
21 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Teacher Attendence | 21 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Teacher Attendence |
22 | </v-btn> | 22 | </v-btn> |
23 | <v-spacer></v-spacer> | 23 | <v-spacer></v-spacer> |
24 | <v-card-title class="body-1" v-show="show"> | 24 | <v-card-title class="body-1" v-show="show"> |
25 | <v-btn icon large flat @click="displaySearch"> | 25 | <v-btn icon large flat @click="displaySearch"> |
26 | <v-avatar size="27"> | 26 | <v-avatar size="27"> |
27 | <img src="/static/icon/search.png" alt="icon" /> | 27 | <img src="/static/icon/search.png" alt="icon" /> |
28 | </v-avatar> | 28 | </v-avatar> |
29 | </v-btn> | 29 | </v-btn> |
30 | </v-card-title> | 30 | </v-card-title> |
31 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 31 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
32 | <v-layout> | 32 | <v-layout> |
33 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 33 | <v-text-field |
34 | autofocus | ||
35 | v-model="search" | ||
36 | label="Search" | ||
37 | prepend-inner-icon="search" | ||
38 | color="primary" | ||
39 | ></v-text-field> | ||
34 | <v-icon @click="closeSearch" color="error">close</v-icon> | 40 | <v-icon @click="closeSearch" color="error">close</v-icon> |
35 | </v-layout> | 41 | </v-layout> |
36 | </v-flex> | 42 | </v-flex> |
37 | </v-toolbar> | 43 | </v-toolbar> |
38 | <v-data-table | 44 | <v-data-table |
39 | :headers="headers" | 45 | :headers="headers" |
40 | :items="teachersData" | 46 | :items="teachersData" |
41 | :pagination.sync="pagination" | 47 | :pagination.sync="pagination" |
42 | :search="search" | 48 | :search="search" |
43 | > | 49 | > |
44 | <template slot="items" slot-scope="props"> | 50 | <template slot="items" slot-scope="props"> |
45 | <tr class="tr"> | 51 | <tr class="tr"> |
46 | <td class="td td-row">{{ props.index + 1}}</td> | 52 | <td class="td td-row">{{ props.index + 1}}</td> |
47 | <td class="text-xs-center td td-row"> | 53 | <td class="text-xs-center td td-row"> |
48 | <v-avatar size="40"> | 54 | <v-avatar size="40"> |
49 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 55 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
50 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 56 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
51 | </v-avatar> | 57 | </v-avatar> |
52 | </td> | 58 | </td> |
53 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 59 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
54 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> | 60 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
55 | <td class="td td-row text-xs-center">{{ props.item.mobileNo }}</td> | 61 | <td class="td td-row text-xs-center">{{ props.item.mobileNo }}</td> |
56 | <td class="text-xs-center td td-row"> | 62 | <td class="text-xs-center td td-row"> |
57 | <router-link | 63 | <router-link |
58 | :to="{ name:'View Teacher Attendence',params: { teacherId:props.item._id } }" | 64 | :to="{ name:'View Teacher Attendence',params: { teacherId:props.item._id } }" |
59 | > | 65 | > |
60 | <span> | 66 | <span> |
61 | <v-tooltip top> | 67 | <v-tooltip top> |
62 | <img | 68 | <img |
63 | slot="activator" | 69 | slot="activator" |
64 | style="cursor:pointer; width:25px; height:25px; " | 70 | style="cursor:pointer; width:25px; height:25px; " |
65 | src="/static/icon/view.png" | 71 | src="/static/icon/view.png" |
66 | /> | 72 | /> |
67 | <span>View</span> | 73 | <span>View</span> |
68 | </v-tooltip> | 74 | </v-tooltip> |
69 | </span> | 75 | </span> |
70 | </router-link> | 76 | </router-link> |
71 | </td> | 77 | </td> |
72 | </tr> | 78 | </tr> |
73 | </template> | 79 | </template> |
74 | <v-alert | 80 | <v-alert |
75 | slot="no-results" | 81 | slot="no-results" |
76 | :value="true" | 82 | :value="true" |
77 | color="error" | 83 | color="error" |
78 | icon="warning" | 84 | icon="warning" |
79 | >Your search for "{{ search }}" found no results.</v-alert> | 85 | >Your search for "{{ search }}" found no results.</v-alert> |
80 | </v-data-table> | 86 | </v-data-table> |
81 | <!-- ****** Add Teachers Attendece****** --> | 87 | <!-- ****** Add Teachers Attendece****** --> |
82 | <v-dialog v-model="addTeacherAttendenceDialog" width="1600"> | 88 | <v-dialog v-model="addTeacherAttendenceDialog" width="1600" v-if="addTeacherAttendenceDialog"> |
83 | <v-card flat class="pa-2"> | 89 | <v-card flat class="pa-2"> |
84 | <v-layout> | 90 | <v-layout> |
85 | <v-flex xs12> | 91 | <v-flex xs12> |
86 | <label class="title text-xs-center">Add Teacher Attendence</label> | 92 | <label class="title text-xs-center">Add Teacher Attendence</label> |
87 | <v-icon size="24" class="right" @click="$refs.form.reset();addTeacherAttendenceDialog = false">cancel</v-icon> | 93 | <v-icon |
94 | size="24" | ||
95 | class="right" | ||
96 | @click="$refs.form.reset();addTeacherAttendenceDialog = false" | ||
97 | >cancel</v-icon> | ||
88 | </v-flex> | 98 | </v-flex> |
89 | </v-layout> | 99 | </v-layout> |
90 | <v-flex xs12 class="mt-4"> | 100 | <v-flex xs12 class="mt-4"> |
91 | <v-form ref="form" v-model="valid" lazy-validation> | 101 | <v-form ref="form" v-model="valid" lazy-validation> |
92 | <v-layout wrap> | 102 | <v-layout wrap> |
93 | <v-flex xs12 class="px-4"> | 103 | <v-flex xs12 class="px-4"> |
94 | <v-layout> | 104 | <v-layout> |
95 | <v-flex xs6 sm6 lg3 md4> | 105 | <v-flex xs6 sm6 lg3 md4> |
96 | <v-menu | 106 | <v-menu |
97 | ref="menu" | 107 | ref="menu" |
98 | :close-on-content-click="false" | 108 | :close-on-content-click="false" |
99 | v-model="menu" | 109 | v-model="menu" |
100 | :nudge-right="40" | 110 | :nudge-right="40" |
101 | lazy | 111 | lazy |
102 | transition="scale-transition" | 112 | transition="scale-transition" |
103 | offset-y | 113 | offset-y |
104 | full-width | 114 | full-width |
105 | min-width="290px" | 115 | min-width="290px" |
106 | > | 116 | > |
107 | <v-text-field | 117 | <v-text-field |
108 | slot="activator" | 118 | slot="activator" |
109 | v-model="date" | 119 | v-model="date" |
110 | label="Select Date" | 120 | label="Select Date" |
111 | append-icon="event" | 121 | append-icon="event" |
112 | :rules="dataValid" | 122 | :rules="dataValid" |
113 | readonly | 123 | readonly |
114 | ></v-text-field> | 124 | ></v-text-field> |
115 | <v-date-picker | 125 | <v-date-picker |
116 | ref="picker" | 126 | ref="picker" |
117 | v-model="date" | 127 | v-model="date" |
118 | :max="new Date().toISOString().substr(0, 10)" | 128 | :max="new Date().toISOString().substr(0, 10)" |
119 | min="1950-01-01" | 129 | min="1950-01-01" |
120 | @change="save" | 130 | @change="save" |
121 | ></v-date-picker> | 131 | ></v-date-picker> |
122 | </v-menu> | 132 | </v-menu> |
123 | </v-flex> | 133 | </v-flex> |
124 | <v-flex xs6 sm6 lg9 md8> | 134 | <v-flex xs6 sm6 lg9 md8> |
125 | <v-btn class="right mt-3 add-button" dark round @click="showTable">Attendence</v-btn> | 135 | <v-btn class="right mt-3 add-button" dark round @click="showTable">Attendence</v-btn> |
126 | </v-flex> | 136 | </v-flex> |
127 | </v-layout> | 137 | </v-layout> |
128 | </v-flex> | 138 | </v-flex> |
129 | </v-layout> | 139 | </v-layout> |
130 | </v-form> | 140 | </v-form> |
131 | </v-flex> | 141 | </v-flex> |
132 | <v-flex xs12 v-show="attendeceTable" class> | 142 | <v-flex xs12 v-show="attendeceTable" class> |
133 | <v-data-table | 143 | <v-data-table |
134 | :headers="headers" | 144 | :headers="headers" |
135 | :items="teachersData" | 145 | :items="teachersData" |
136 | :pagination.sync="pagination" | 146 | :pagination.sync="pagination" |
137 | :search="search" | 147 | :search="search" |
138 | > | 148 | > |
139 | <template slot="items" slot-scope="props"> | 149 | <template slot="items" slot-scope="props"> |
140 | <tr class="tr"> | 150 | <tr class="tr"> |
141 | <td class="td td-row">{{ props.index + 1}}</td> | 151 | <td class="td td-row">{{ props.index + 1}}</td> |
142 | <td class="text-xs-center td td-row"> | 152 | <td class="text-xs-center td td-row"> |
143 | <v-avatar size="40"> | 153 | <v-avatar size="40"> |
144 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 154 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
145 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 155 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
146 | </v-avatar> | 156 | </v-avatar> |
147 | </td> | 157 | </td> |
148 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 158 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
149 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> | 159 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> |
150 | <td class="text-xs-center td td-row">{{ props.item.mobileNo }}</td> | 160 | <td class="text-xs-center td td-row">{{ props.item.mobileNo }}</td> |
151 | <td class="text-xs-center td td-row"> | 161 | <td class="text-xs-center td td-row"> |
152 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> | 162 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> |
153 | <v-radio | 163 | <v-radio |
154 | v-for="attendences in attendenceType" | 164 | v-for="attendences in attendenceType" |
155 | :key="attendences.value" | 165 | :key="attendences.value" |
156 | :label="`${attendences.label}`" | 166 | :label="`${attendences.label}`" |
157 | :value="attendences.value" | 167 | :value="attendences.value" |
158 | ></v-radio> | 168 | ></v-radio> |
159 | </v-radio-group> | 169 | </v-radio-group> |
160 | </td> | 170 | </td> |
161 | </tr> | 171 | </tr> |
162 | </template> | 172 | </template> |
163 | </v-data-table> | 173 | </v-data-table> |
164 | <v-flex xs12> | 174 | <v-flex xs12> |
165 | <v-card-actions> | 175 | <v-card-actions> |
166 | <v-spacer></v-spacer> | 176 | <v-spacer></v-spacer> |
167 | <v-btn @click="submit()" class="add-button" round dark>Submit</v-btn> | 177 | <v-btn @click="submit()" class="add-button" round dark>Submit</v-btn> |
168 | </v-card-actions> | 178 | </v-card-actions> |
169 | </v-flex> | 179 | </v-flex> |
170 | </v-flex> | 180 | </v-flex> |
171 | </v-card> | 181 | </v-card> |
172 | </v-dialog> | 182 | </v-dialog> |
173 | <v-snackbar | 183 | <v-snackbar |
174 | :timeout="timeout" | 184 | :timeout="timeout" |
175 | :top="y === 'top'" | 185 | :top="y === 'top'" |
176 | :right="x === 'right'" | 186 | :right="x === 'right'" |
177 | :vertical="mode === 'vertical'" | 187 | :vertical="mode === 'vertical'" |
178 | v-model="snackbar" | 188 | v-model="snackbar" |
179 | color="success" | 189 | color="success" |
180 | >{{ text }}</v-snackbar> | 190 | >{{ text }}</v-snackbar> |
181 | <div class="loader" v-if="showLoader"> | 191 | <div class="loader" v-if="showLoader"> |
182 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 192 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
183 | </div> | 193 | </div> |
184 | </v-container> | 194 | </v-container> |
185 | </template> | 195 | </template> |
186 | 196 | ||
187 | <script> | 197 | <script> |
188 | import http from "@/Services/http.js"; | 198 | import http from "@/Services/http.js"; |
189 | import moment from "moment"; | 199 | import moment from "moment"; |
190 | 200 | ||
191 | export default { | 201 | export default { |
192 | data: () => ({ | 202 | data: () => ({ |
193 | snackbar: false, | 203 | snackbar: false, |
194 | y: "top", | 204 | y: "top", |
195 | x: "right", | 205 | x: "right", |
196 | role: "", | 206 | role: "", |
197 | mode: "", | 207 | mode: "", |
198 | timeout: 5000, | 208 | timeout: 5000, |
199 | text: "", | 209 | text: "", |
200 | date: null, | 210 | date: null, |
201 | menu: false, | 211 | menu: false, |
202 | show: true, | 212 | show: true, |
203 | showSearch: false, | 213 | showSearch: false, |
204 | addTeacherAttendenceDialog: false, | 214 | addTeacherAttendenceDialog: false, |
205 | attendeceTable: false, | 215 | attendeceTable: false, |
206 | showLoader: false, | 216 | showLoader: false, |
207 | loading: false, | 217 | loading: false, |
208 | search: "", | 218 | search: "", |
209 | valid: true, | 219 | valid: true, |
210 | isActive: true, | 220 | isActive: true, |
211 | newActive: false, | 221 | newActive: false, |
212 | dataValid: [v => !!v || "Date is required"], | 222 | dataValid: [(v) => !!v || "Date is required"], |
213 | attendenceType: [ | 223 | attendenceType: [ |
214 | { | 224 | { |
215 | label: "Present", | 225 | label: "Present", |
216 | value: "present" | 226 | value: "present", |
217 | }, | 227 | }, |
218 | { | 228 | { |
219 | label: "Late Present With Excuset", | 229 | label: "Late Present With Excuset", |
220 | value: "latePresentWithExcuse" | 230 | value: "latePresentWithExcuse", |
221 | }, | 231 | }, |
222 | { | 232 | { |
223 | label: "Late Present", | 233 | label: "Late Present", |
224 | value: "latePresent" | 234 | value: "latePresent", |
225 | }, | 235 | }, |
226 | { | 236 | { |
227 | label: "Absent", | 237 | label: "Absent", |
228 | value: "absent" | 238 | value: "absent", |
229 | } | 239 | }, |
230 | ], | 240 | ], |
231 | pagination: { | 241 | pagination: { |
232 | rowsPerPage: 8 | 242 | rowsPerPage: 8, |
233 | }, | 243 | }, |
234 | headers: [ | 244 | headers: [ |
235 | { | 245 | { |
236 | text: "No", | 246 | text: "No", |
237 | align: "", | 247 | align: "", |
238 | sortable: false, | 248 | sortable: false, |
239 | value: "No" | 249 | value: "No", |
240 | }, | 250 | }, |
241 | { | 251 | { |
242 | text: "Profile Pic", | 252 | text: "Profile Pic", |
243 | value: "profilePicUrl", | 253 | value: "profilePicUrl", |
244 | sortable: false, | 254 | sortable: false, |
245 | align: "center" | 255 | align: "center", |
246 | }, | 256 | }, |
247 | { text: "Name", value: "name", sortable: false, align: "center" }, | 257 | { text: "Name", value: "name", sortable: false, align: "center" }, |
248 | { text: "Email", value: "email", sortable: false, align: "center" }, | 258 | { text: "Email", value: "email", sortable: false, align: "center" }, |
249 | { | 259 | { |
250 | text: "Mobile No", | 260 | text: "Mobile No", |
251 | value: "mobileNo", | 261 | value: "mobileNo", |
252 | sortable: false, | 262 | sortable: false, |
253 | align: "center" | 263 | align: "center", |
254 | }, | 264 | }, |
255 | { text: "Attendance", value: "", sortable: false, align: "center" } | 265 | { text: "Attendance", value: "", sortable: false, align: "center" }, |
256 | ], | 266 | ], |
257 | desserts: [], | 267 | desserts: [], |
258 | teachersData: [], | 268 | teachersData: [], |
259 | addTeachers: {} | 269 | addTeachers: {}, |
260 | }), | 270 | }), |
261 | watch: { | 271 | watch: { |
262 | menu(val) { | 272 | menu(val) { |
263 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "DAY")); | 273 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "DAY")); |
264 | } | 274 | }, |
275 | addTeacherAttendenceDialog: function (val) { | ||
276 | if (!val) { | ||
277 | this.teachersData = []; | ||
278 | this.date = null; | ||
279 | this.menu = false; | ||
280 | } | ||
281 | }, | ||
265 | }, | 282 | }, |
266 | methods: { | 283 | methods: { |
267 | save(date) { | 284 | save(date) { |
268 | this.$refs.menu.save(date); | 285 | this.$refs.menu.save(date); |
269 | }, | 286 | }, |
270 | showTable() { | 287 | showTable() { |
271 | this.attendeceTable = true; | 288 | this.attendeceTable = true; |
272 | this.getTeacherList(); | 289 | this.getTeacherList(); |
273 | }, | 290 | }, |
274 | getTeacherList() { | 291 | getTeacherList() { |
275 | this.showLoader = true; | 292 | this.showLoader = true; |
276 | var token = this.$store.state.token; | 293 | var token = this.$store.state.token; |
277 | http() | 294 | http() |
278 | .get("/getTeachersList", { | 295 | .get("/getTeachersList", { |
279 | headers: { Authorization: "Bearer " + token } | 296 | headers: { Authorization: "Bearer " + token }, |
280 | }) | 297 | }) |
281 | .then(response => { | 298 | .then((response) => { |
282 | this.teachersData = response.data.data; | 299 | this.teachersData = response.data.data; |
283 | // this.desserts = response.data.data; | 300 | // this.desserts = response.data.data; |
284 | var attendence = ""; | 301 | var attendence = ""; |
285 | for (let i = 0; i < this.teachersData.length; i++) { | 302 | for (let i = 0; i < this.teachersData.length; i++) { |
286 | this.teachersData[i].attendence = "present"; | 303 | this.teachersData[i].attendence = "present"; |
287 | } | 304 | } |
288 | this.showLoader = false; | 305 | this.showLoader = false; |
289 | // console.log("getTeacherList=====>",this.desserts) | 306 | // console.log("getTeacherList=====>",this.desserts) |
290 | // console.log("getTeacherList=====>",this.teachersData) | 307 | // console.log("getTeacherList=====>",this.teachersData) |
291 | |||
292 | }) | 308 | }) |
293 | .catch(error => { | 309 | .catch((error) => { |
294 | this.showLoader = false; | 310 | this.showLoader = false; |
295 | if (error.response.status === 401) { | 311 | if (error.response.status === 401) { |
296 | this.$router.replace({ path: "/" }); | 312 | this.$router.replace({ path: "/" }); |
297 | this.$store.dispatch("setToken", null); | 313 | this.$store.dispatch("setToken", null); |
298 | this.$store.dispatch("Id", null); | 314 | this.$store.dispatch("Id", null); |
299 | } | 315 | } |
300 | }); | 316 | }); |
301 | }, | 317 | }, |
302 | submit() { | 318 | submit() { |
303 | var teachersAttendence = []; | 319 | var teachersAttendence = []; |
304 | for (var j = 0; j < this.teachersData.length; j++) { | 320 | for (var j = 0; j < this.teachersData.length; j++) { |
305 | teachersAttendence.push({ | 321 | teachersAttendence.push({ |
306 | teacherId: this.teachersData[j]._id, | 322 | teacherId: this.teachersData[j]._id, |
307 | attendanceType: this.teachersData[j].attendence | 323 | attendanceType: this.teachersData[j].attendence, |
308 | }); | 324 | }); |
309 | } | 325 | } |
310 | if (this.$refs.form.validate()) { | 326 | if (this.$refs.form.validate()) { |
311 | let attendanceData = { | 327 | let attendanceData = { |
312 | date: this.date, | 328 | date: this.date, |
313 | teachers: teachersAttendence | 329 | teachers: teachersAttendence, |
314 | }; | 330 | }; |
315 | http() | 331 | http() |
316 | .post("/createTeacherAttendance", attendanceData) | 332 | .post("/createTeacherAttendance", attendanceData) |
317 | .then(response => { | 333 | .then((response) => { |
318 | this.snackbar = true; | 334 | this.snackbar = true; |
319 | this.text = response.data.message; | 335 | this.text = response.data.message; |
320 | this.addTeacherAttendenceDialog = false; | 336 | this.addTeacherAttendenceDialog = false; |
321 | this.clear(); | 337 | this.clear(); |
322 | }) | 338 | }) |
323 | .catch(error => { | 339 | .catch((error) => { |
324 | this.snackbar = true; | 340 | this.snackbar = true; |
325 | this.text = error.response.data.message; | 341 | this.text = error.response.data.message; |
326 | }); | 342 | }); |
327 | } | 343 | } |
328 | }, | 344 | }, |
329 | clear() { | 345 | clear() { |
330 | this.$refs.form.reset(); | 346 | this.$refs.form.reset(); |
331 | this.imageUrl = ""; | 347 | this.imageUrl = ""; |
332 | }, | 348 | }, |
333 | 349 | ||
334 | displaySearch() { | 350 | displaySearch() { |
335 | (this.show = false), (this.showSearch = true); | 351 | (this.show = false), (this.showSearch = true); |
336 | }, | 352 | }, |
337 | closeSearch() { | 353 | closeSearch() { |
338 | this.showSearch = false; | 354 | this.showSearch = false; |
339 | this.show = true; | 355 | this.show = true; |
340 | this.search = ""; | 356 | this.search = ""; |
341 | } | 357 | }, |
342 | }, | 358 | }, |
343 | mounted() { | 359 | mounted() { |
344 | this.getTeacherList(); | 360 | this.getTeacherList(); |
345 | this.role = this.$store.state.role; | 361 | this.role = this.$store.state.role; |
346 | } | 362 | }, |
347 | }; | 363 | }; |
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-if="showSearch"> | 83 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
84 | <v-layout> | 84 | <v-layout> |
85 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 85 | <v-text-field |
86 | autofocus | ||
87 | v-model="search" | ||
88 | label="Search" | ||
89 | prepend-inner-icon="search" | ||
90 | color="primary" | ||
91 | ></v-text-field> | ||
86 | <v-icon @click="closeSearch" color="error">close</v-icon> | 92 | <v-icon @click="closeSearch" color="error">close</v-icon> |
87 | </v-layout> | 93 | </v-layout> |
88 | </v-flex> | 94 | </v-flex> |
89 | </v-toolbar> | 95 | </v-toolbar> |
90 | <v-data-table | 96 | <v-data-table |
91 | :headers="headers" | 97 | :headers="headers" |
92 | :items="classList" | 98 | :items="classList" |
93 | :pagination.sync="pagination" | 99 | :pagination.sync="pagination" |
94 | :search="search" | 100 | :search="search" |
95 | > | 101 | > |
96 | <template slot="items" slot-scope="props"> | 102 | <template slot="items" slot-scope="props"> |
97 | <tr class="tr"> | 103 | <tr class="tr"> |
98 | <td class="td td-row">{{ props.index + 1 }}</td> | 104 | <td class="td td-row">{{ props.index + 1 }}</td> |
99 | <td class="text-xs-center td td-row">{{ props.item.classNum}}</td> | 105 | <td class="text-xs-center td td-row">{{ props.item.classNum}}</td> |
100 | <td class="text-xs-center td td-row"> | 106 | <td class="text-xs-center td td-row"> |
101 | <span> | 107 | <span> |
102 | <v-tooltip top> | 108 | <v-tooltip top> |
103 | <img | 109 | <img |
104 | slot="activator" | 110 | slot="activator" |
105 | style="cursor:pointer; width:25px; height:25px; " | 111 | style="cursor:pointer; width:25px; height:25px; " |
106 | class="mr-3" | 112 | class="mr-3" |
107 | @click="profile(props.item)" | 113 | @click="profile(props.item)" |
108 | src="/static/icon/view.png" | 114 | src="/static/icon/view.png" |
109 | /> | 115 | /> |
110 | <span>View</span> | 116 | <span>View</span> |
111 | </v-tooltip> | 117 | </v-tooltip> |
112 | <v-tooltip top> | 118 | <v-tooltip top> |
113 | <img | 119 | <img |
114 | slot="activator" | 120 | slot="activator" |
115 | style="cursor:pointer; width:20px; height:18px; " | 121 | style="cursor:pointer; width:20px; height:18px; " |
116 | class="mr-3" | 122 | class="mr-3" |
117 | @click="editItem(props.item)" | 123 | @click="editItem(props.item)" |
118 | src="/static/icon/edit.png" | 124 | src="/static/icon/edit.png" |
119 | /> | 125 | /> |
120 | <span>Edit</span> | 126 | <span>Edit</span> |
121 | </v-tooltip> | 127 | </v-tooltip> |
122 | <!-- <v-tooltip top> | 128 | <!-- <v-tooltip top> |
123 | <img | 129 | <img |
124 | slot="activator" | 130 | slot="activator" |
125 | style="cursor:pointer; width:20px; height:20px; " | 131 | style="cursor:pointer; width:20px; height:20px; " |
126 | @click="deleteItem(props.item)" | 132 | @click="deleteItem(props.item)" |
127 | src="/static/icon/delete.png" | 133 | src="/static/icon/delete.png" |
128 | /> | 134 | /> |
129 | <span>Delete</span> | 135 | <span>Delete</span> |
130 | </v-tooltip>--> | 136 | </v-tooltip>--> |
131 | </span> | 137 | </span> |
132 | </td> | 138 | </td> |
133 | </tr> | 139 | </tr> |
134 | </template> | 140 | </template> |
135 | <v-alert | 141 | <v-alert |
136 | slot="no-results" | 142 | slot="no-results" |
137 | :value="true" | 143 | :value="true" |
138 | color="error" | 144 | color="error" |
139 | icon="warning" | 145 | icon="warning" |
140 | >Your search for "{{ search }}" found no results.</v-alert> | 146 | >Your search for "{{ search }}" found no results.</v-alert> |
141 | </v-data-table> | 147 | </v-data-table> |
142 | 148 | ||
143 | <!-- DIALOG BOX - ADD Class --> | 149 | <!-- DIALOG BOX - ADD Class --> |
144 | <v-dialog v-model="addClassDialog" max-width="400px"> | 150 | <v-dialog v-model="addClassDialog" max-width="400px" v-if="addClassDialog"> |
145 | <v-card flat class="card-style pa-2" dark> | 151 | <v-card flat class="card-style pa-2" dark> |
146 | <v-layout> | 152 | <v-layout> |
147 | <v-flex xs12> | 153 | <v-flex xs12> |
148 | <label class="title text-xs-center">Add Class</label> | 154 | <label class="title text-xs-center">Add Class</label> |
149 | <v-icon size="24" class="right" @click="$refs.form.reset();addClassDialog = false">cancel</v-icon> | 155 | <v-icon |
156 | size="24" | ||
157 | class="right" | ||
158 | @click="$refs.form.reset();addClassDialog = false" | ||
159 | >cancel</v-icon> | ||
150 | </v-flex> | 160 | </v-flex> |
151 | </v-layout> | 161 | </v-layout> |
152 | <v-container fluid fill-height> | 162 | <v-container fluid fill-height> |
153 | <v-layout align-center> | 163 | <v-layout align-center> |
154 | <v-flex xs12> | 164 | <v-flex xs12> |
155 | <v-form ref="form" v-model="valid" lazy-validation> | 165 | <v-form ref="form" v-model="valid" lazy-validation> |
156 | <v-flex xs12 class="headline text-xs-center"> | 166 | <v-flex xs12 class="headline text-xs-center"> |
157 | <label>Class</label> | 167 | <label>Class</label> |
158 | </v-flex> | 168 | </v-flex> |
159 | <v-flex xs12> | 169 | <v-flex xs12> |
160 | <v-text-field | 170 | <v-text-field |
161 | v-model="addclasses.classNum" | 171 | v-model="addclasses.classNum" |
162 | placeholder="fill your class Name" | 172 | placeholder="fill your class Name" |
163 | type="text" | 173 | type="text" |
164 | :rules="nameRules" | 174 | :rules="nameRules" |
165 | required | 175 | required |
166 | ></v-text-field> | 176 | ></v-text-field> |
167 | </v-flex> | 177 | </v-flex> |
168 | <v-layout> | 178 | <v-layout> |
169 | <v-flex xs12 sm12> | 179 | <v-flex xs12 sm12> |
170 | <v-card-actions> | 180 | <v-card-actions> |
171 | <v-spacer></v-spacer> | 181 | <v-spacer></v-spacer> |
172 | <v-btn | 182 | <v-btn |
173 | @click="submit" | 183 | @click="submit" |
174 | class="add-button" | 184 | class="add-button" |
175 | round | 185 | round |
176 | dark | 186 | dark |
177 | :loading="loading" | 187 | :loading="loading" |
178 | >Add Class</v-btn> | 188 | >Add Class</v-btn> |
179 | <v-spacer></v-spacer> | 189 | <v-spacer></v-spacer> |
180 | </v-card-actions> | 190 | </v-card-actions> |
181 | </v-flex> | 191 | </v-flex> |
182 | </v-layout> | 192 | </v-layout> |
183 | </v-form> | 193 | </v-form> |
184 | </v-flex> | 194 | </v-flex> |
185 | </v-layout> | 195 | </v-layout> |
186 | </v-container> | 196 | </v-container> |
187 | </v-card> | 197 | </v-card> |
188 | </v-dialog> | 198 | </v-dialog> |
189 | <div class="loader" v-if="showLoader"> | 199 | <div class="loader" v-if="showLoader"> |
190 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 200 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
191 | </div> | 201 | </div> |
192 | <v-snackbar | 202 | <v-snackbar |
193 | :timeout="timeout" | 203 | :timeout="timeout" |
194 | :top="y === 'top'" | 204 | :top="y === 'top'" |
195 | :right="x === 'right'" | 205 | :right="x === 'right'" |
196 | :vertical="mode === 'vertical'" | 206 | :vertical="mode === 'vertical'" |
197 | v-model="snackbar" | 207 | v-model="snackbar" |
198 | :color="color" | 208 | :color="color" |
199 | >{{ text }}</v-snackbar> | 209 | >{{ text }}</v-snackbar> |
200 | </v-container> | 210 | </v-container> |
201 | </template> | 211 | </template> |
202 | 212 | ||
203 | <script> | 213 | <script> |
204 | import http from "@/Services/http.js"; | 214 | import http from "@/Services/http.js"; |
205 | 215 | ||
206 | export default { | 216 | export default { |
207 | data: () => ({ | 217 | data: () => ({ |
208 | snackbar: false, | 218 | snackbar: false, |
209 | y: "top", | 219 | y: "top", |
210 | x: "right", | 220 | x: "right", |
211 | mode: "", | 221 | mode: "", |
212 | timeout: 5000, | 222 | timeout: 5000, |
213 | text: "", | 223 | text: "", |
214 | color: "", | 224 | color: "", |
215 | show: true, | 225 | show: true, |
216 | showSearch: false, | 226 | showSearch: false, |
217 | showLoader: false, | 227 | showLoader: false, |
218 | loading: false, | 228 | loading: false, |
219 | addClassDialog: false, | 229 | addClassDialog: false, |
220 | search: "", | 230 | search: "", |
221 | editClassDialog: false, | 231 | editClassDialog: false, |
222 | profileClassDialog: false, | 232 | profileClassDialog: false, |
223 | valid: true, | 233 | valid: true, |
224 | pagination: { | 234 | pagination: { |
225 | rowsPerPage: 10, | 235 | rowsPerPage: 10, |
226 | }, | 236 | }, |
227 | nameRules: [(v) => !!v || " Class Name is required"], | 237 | nameRules: [(v) => !!v || " Class Name is required"], |
228 | headers: [ | 238 | headers: [ |
229 | { | 239 | { |
230 | text: "No", | 240 | text: "No", |
231 | align: "left", | 241 | align: "left", |
232 | sortable: false, | 242 | sortable: false, |
233 | value: "No", | 243 | value: "No", |
234 | }, | 244 | }, |
235 | { text: "Class No", value: "classNum", sortable: false, align: "center" }, | 245 | { text: "Class No", value: "classNum", sortable: false, align: "center" }, |
236 | 246 | ||
237 | { text: "Action", value: "", sortable: false, align: "center" }, | 247 | { text: "Action", value: "", sortable: false, align: "center" }, |
238 | ], | 248 | ], |
239 | classList: [], | 249 | classList: [], |
240 | editedIndex: -1, | 250 | editedIndex: -1, |
241 | editedItem: { | 251 | editedItem: { |
242 | classNum: "", | 252 | classNum: "", |
243 | }, | 253 | }, |
244 | addclasses: { | 254 | addclasses: { |
245 | classNum: "", | 255 | classNum: "", |
246 | }, | 256 | }, |
247 | }), | 257 | }), |
258 | watch: { | ||
259 | addClassDialog: function (val) { | ||
260 | if (!val) { | ||
261 | this.addclasses = []; | ||
262 | } | ||
263 | }, | ||
264 | }, | ||
248 | methods: { | 265 | methods: { |
249 | getClassList() { | 266 | getClassList() { |
250 | this.showLoader = true; | 267 | this.showLoader = true; |
251 | var token = this.$store.state.token; | 268 | var token = this.$store.state.token; |
252 | http() | 269 | http() |
253 | .get("/getClassesList") | 270 | .get("/getClassesList") |
254 | .then((response) => { | 271 | .then((response) => { |
255 | this.classList = response.data.data; | 272 | this.classList = response.data.data; |
256 | this.showLoader = false; | 273 | this.showLoader = false; |
257 | }) | 274 | }) |
258 | .catch((error) => { | 275 | .catch((error) => { |
259 | this.showLoader = false; | 276 | this.showLoader = false; |
260 | if (error.response.status === 401) { | 277 | if (error.response.status === 401) { |
261 | this.$router.replace({ path: "/" }); | 278 | this.$router.replace({ path: "/" }); |
262 | this.$store.dispatch("setToken", null); | 279 | this.$store.dispatch("setToken", null); |
263 | this.$store.dispatch("Id", null); | 280 | this.$store.dispatch("Id", null); |
264 | } | 281 | } |
265 | }); | 282 | }); |
266 | }, | 283 | }, |
267 | editItem(item) { | 284 | editItem(item) { |
268 | this.editedIndex = this.classList.indexOf(item); | 285 | this.editedIndex = this.classList.indexOf(item); |
269 | this.editedItem = Object.assign({}, item); | 286 | this.editedItem = Object.assign({}, item); |
270 | this.editClassDialog = true; | 287 | this.editClassDialog = true; |
271 | }, | 288 | }, |
272 | profile(item) { | 289 | profile(item) { |
273 | this.editedIndex = this.classList.indexOf(item); | 290 | this.editedIndex = this.classList.indexOf(item); |
274 | this.editedItem = Object.assign({}, item); | 291 | this.editedItem = Object.assign({}, item); |
275 | this.profileClassDialog = true; | 292 | this.profileClassDialog = true; |
276 | }, | 293 | }, |
277 | deleteItem(item) { | 294 | deleteItem(item) { |
278 | let deleteStudent = { | 295 | let deleteStudent = { |
279 | classId: item._id, | 296 | classId: item._id, |
280 | }; | 297 | }; |
281 | http() | 298 | http() |
282 | .delete( | 299 | .delete( |
283 | "/deleteClass", | 300 | "/deleteClass", |
284 | confirm("Are you sure you want to delete this?") && { | 301 | confirm("Are you sure you want to delete this?") && { |
285 | params: deleteStudent, | 302 | params: deleteStudent, |
286 | } | 303 | } |
287 | ) | 304 | ) |
288 | .then((response) => { | 305 | .then((response) => { |
289 | this.snackbar = true; | 306 | this.snackbar = true; |
290 | this.text = response.data.message; | 307 | this.text = response.data.message; |
291 | this.color = "green"; | 308 | this.color = "green"; |
292 | this.getClassList(); | 309 | this.getClassList(); |
293 | }) | 310 | }) |
294 | .catch((error) => { | 311 | .catch((error) => { |
295 | this.snackbar = true; | 312 | this.snackbar = true; |
296 | this.color = "error"; | 313 | this.color = "error"; |
297 | this.text = error.response.data.message; | 314 | this.text = error.response.data.message; |
298 | }); | 315 | }); |
299 | }, | 316 | }, |
300 | close() { | 317 | close() { |
301 | this.editClassDialog = false; | 318 | this.editClassDialog = false; |
302 | }, | 319 | }, |
303 | closeProfile() { | 320 | closeProfile() { |
304 | this.profileClassDialog = false; | 321 | this.profileClassDialog = false; |
305 | }, | 322 | }, |
306 | submit() { | 323 | submit() { |
307 | if (this.$refs.form.validate()) { | 324 | if (this.$refs.form.validate()) { |
308 | let addClass = { | 325 | let addClass = { |
309 | classNum: this.addclasses.classNum, | 326 | classNum: this.addclasses.classNum, |
310 | }; | 327 | }; |
311 | this.loading = true; | 328 | this.loading = true; |
312 | http() | 329 | http() |
313 | .post("/createClass", addClass) | 330 | .post("/createClass", addClass) |
314 | .then((response) => { | 331 | .then((response) => { |
315 | this.getClassList(); | 332 | this.getClassList(); |
316 | this.snackbar = true; | 333 | this.snackbar = true; |
317 | this.text = response.data.message; | 334 | this.text = response.data.message; |
318 | this.color = "green"; | 335 | this.color = "green"; |
319 | // this.clear(); | 336 | // this.clear(); |
320 | this.loading = false; | 337 | this.loading = false; |
321 | this.$refs.form.reset() | 338 | this.$refs.form.reset(); |
322 | this.addClassDialog = false; | 339 | this.addClassDialog = false; |
323 | }) | 340 | }) |
324 | .catch((error) => { | 341 | .catch((error) => { |
325 | this.loading = false; | 342 | this.loading = false; |
326 | this.snackbar = true; | 343 | this.snackbar = true; |
327 | this.color = "error"; | 344 | this.color = "error"; |
328 | this.text = error.response.data.message; | 345 | this.text = error.response.data.message; |
329 | }); | 346 | }); |
330 | } | 347 | } |
331 | }, | 348 | }, |
332 | clear() { | 349 | clear() { |
333 | this.$refs.form.reset(); | 350 | this.$refs.form.reset(); |
334 | }, | 351 | }, |
335 | save() { | 352 | save() { |
336 | let editClass = { | 353 | let editClass = { |
337 | classId: this.editedItem._id, | 354 | classId: this.editedItem._id, |
338 | classNum: this.editedItem.classNum, | 355 | classNum: this.editedItem.classNum, |
339 | }; | 356 | }; |
340 | http() | 357 | http() |
341 | .put("/updateClass", editClass) | 358 | .put("/updateClass", editClass) |
342 | .then((response) => { | 359 | .then((response) => { |
343 | this.snackbar = true; | 360 | this.snackbar = true; |
344 | this.text = response.data.message; | 361 | this.text = response.data.message; |
345 | this.color = "green"; | 362 | this.color = "green"; |
346 | this.getClassList(); | 363 | this.getClassList(); |
347 | this.close(); | 364 | this.close(); |
348 | }) | 365 | }) |
349 | .catch((error) => { | 366 | .catch((error) => { |
350 | this.snackbar = true; | 367 | this.snackbar = true; |
351 | this.text = error.response.data.message; | 368 | this.text = error.response.data.message; |
352 | this.color = "error"; | 369 | this.color = "error"; |
353 | // console.log(error); | 370 | // console.log(error); |
354 | }); | 371 | }); |
355 | }, | 372 | }, |
356 | displaySearch() { | 373 | displaySearch() { |
357 | (this.show = false), (this.showSearch = true); | 374 | (this.show = false), (this.showSearch = true); |
358 | }, | 375 | }, |
359 | closeSearch() { | 376 | closeSearch() { |
360 | this.showSearch = false; | 377 | this.showSearch = false; |
361 | this.show = true; | 378 | this.show = true; |
362 | this.search = ""; | 379 | this.search = ""; |
363 | }, | 380 | }, |
364 | }, | 381 | }, |
365 | mounted() { | 382 | mounted() { |
366 | this.getClassList(); | 383 | this.getClassList(); |
367 | }, | 384 | }, |
368 | // created() { | 385 | // created() { |
369 | // this.$root.$on("app:search", search => { | 386 | // this.$root.$on("app:search", search => { |
370 | // this.search = search; | 387 | // this.search = search; |
371 | // }); | 388 | // }); |
372 | // }, | 389 | // }, |
373 | // beforeDestroy() { | 390 | // beforeDestroy() { |
374 | // // dont forget to remove the listener | 391 | // // dont forget to remove the listener |
375 | // this.$root.$off("app:search"); | 392 | // this.$root.$off("app:search"); |
376 | // } | 393 | // } |
377 | }; | 394 | }; |
378 | </script> | 395 | </script> |
379 | <style> | 396 | <style> |
380 | </style> | 397 | </style> |
src/pages/Course/course.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS COURSES DETAILS ****** --> | 3 | <!-- ****** EDITS COURSES DETAILS ****** --> |
4 | <v-dialog v-model="editStudentDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editStudentDialog" max-width="600px" 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 Course</label> | 8 | <label class="title text-xs-center">Edit Course</label> |
9 | <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editStudentDialog = 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> | 15 | <v-layout> |
16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
17 | <v-avatar size="100px" v-if="!editedItem.courseImageUrl && !editImageUrl"> | 17 | <v-avatar size="100px" v-if="!editedItem.courseImageUrl && !editImageUrl"> |
18 | <img src="/static/icon/user.png" /> | 18 | <img src="/static/icon/user.png" /> |
19 | </v-avatar> | 19 | </v-avatar> |
20 | <img | 20 | <img |
21 | :src="editedItem.courseImageUrl" | 21 | :src="editedItem.courseImageUrl" |
22 | v-else-if="editedItem.courseImageUrl && !editImageUrl" | 22 | v-else-if="editedItem.courseImageUrl && !editImageUrl" |
23 | height="150" | 23 | height="150" |
24 | style="border-radius:50%; width:150px" | 24 | style="border-radius:50%; width:150px" |
25 | /> | 25 | /> |
26 | <img | 26 | <img |
27 | v-if="editImageUrl" | 27 | v-if="editImageUrl" |
28 | :src="editImageUrl" | 28 | :src="editImageUrl" |
29 | style="border-radius:50%; width:150px;height:150px" | 29 | style="border-radius:50%; width:150px;height:150px" |
30 | /> | 30 | /> |
31 | <input | 31 | <input |
32 | type="file" | 32 | type="file" |
33 | style="display: none" | 33 | style="display: none" |
34 | ref="editDataImage" | 34 | ref="editDataImage" |
35 | accept="image/*" | 35 | accept="image/*" |
36 | @change="onEditFilePicked" | 36 | @change="onEditFilePicked" |
37 | /> | 37 | /> |
38 | </v-flex> | 38 | </v-flex> |
39 | </v-layout> | 39 | </v-layout> |
40 | <v-layout wrap> | 40 | <v-layout wrap> |
41 | <v-flex xs12 sm12> | 41 | <v-flex xs12 sm12> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-flex xs4 sm5 class="pt-4 subheading"> | 43 | <v-flex xs4 sm5 class="pt-4 subheading"> |
44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
46 | </v-flex> | 46 | </v-flex> |
47 | <v-flex xs8 sm7 class="ml-3"> | 47 | <v-flex xs8 sm7 class="ml-3"> |
48 | <v-select | 48 | <v-select |
49 | :items="addclass" | 49 | :items="addclass" |
50 | label="Select Class" | 50 | label="Select Class" |
51 | v-model="editedItem.select" | 51 | v-model="editedItem.select" |
52 | item-text="classNum" | 52 | item-text="classNum" |
53 | item-value="_id" | 53 | item-value="_id" |
54 | name="Select Class" | 54 | name="Select Class" |
55 | required | 55 | required |
56 | ></v-select> | 56 | ></v-select> |
57 | </v-flex> | 57 | </v-flex> |
58 | </v-layout> | 58 | </v-layout> |
59 | <v-layout> | 59 | <v-layout> |
60 | <v-flex xs4 sm5 class="pt-4 subheading"> | 60 | <v-flex xs4 sm5 class="pt-4 subheading"> |
61 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | 61 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> |
62 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | 62 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> |
63 | </v-flex> | 63 | </v-flex> |
64 | <v-flex xs8 sm7 class="ml-3"> | 64 | <v-flex xs8 sm7 class="ml-3"> |
65 | <v-text-field | 65 | <v-text-field |
66 | v-model="editedItem.courseName" | 66 | v-model="editedItem.courseName" |
67 | placeholder="fill your Course Name" | 67 | placeholder="fill your Course Name" |
68 | type="text" | 68 | type="text" |
69 | required | 69 | required |
70 | ></v-text-field> | 70 | ></v-text-field> |
71 | </v-flex> | 71 | </v-flex> |
72 | </v-layout> | 72 | </v-layout> |
73 | <v-layout> | 73 | <v-layout> |
74 | <v-flex xs4 sm5 class="pt-4 subheading"> | 74 | <v-flex xs4 sm5 class="pt-4 subheading"> |
75 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | 75 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> |
76 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> | 76 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> |
77 | </v-flex> | 77 | </v-flex> |
78 | <v-flex xs8 sm7 class="ml-3"> | 78 | <v-flex xs8 sm7 class="ml-3"> |
79 | <v-text-field | 79 | <v-text-field |
80 | label="Select Image" | 80 | label="Select Image" |
81 | @click="pickEditFile" | 81 | @click="pickEditFile" |
82 | v-model="editImageName" | 82 | v-model="editImageName" |
83 | append-icon="attach_file" | 83 | append-icon="attach_file" |
84 | ></v-text-field> | 84 | ></v-text-field> |
85 | </v-flex> | 85 | </v-flex> |
86 | </v-layout> | 86 | </v-layout> |
87 | </v-flex> | 87 | </v-flex> |
88 | </v-layout> | 88 | </v-layout> |
89 | <v-layout> | 89 | <v-layout> |
90 | <v-flex xs12 sm12 class="px-0 mx-0"> | 90 | <v-flex xs12 sm12 class="px-0 mx-0"> |
91 | <v-layout class="right"> | 91 | <v-layout class="right"> |
92 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> | 92 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> |
93 | </v-layout> | 93 | </v-layout> |
94 | </v-flex> | 94 | </v-flex> |
95 | </v-layout> | 95 | </v-layout> |
96 | </v-container> | 96 | </v-container> |
97 | </v-form> | 97 | </v-form> |
98 | </v-card-text> | 98 | </v-card-text> |
99 | </v-card> | 99 | </v-card> |
100 | </v-dialog> | 100 | </v-dialog> |
101 | 101 | ||
102 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> | 102 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> |
103 | 103 | ||
104 | <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> | 104 | <v-dialog v-model="profileStudentDialog" max-width="600px" scrollable> |
105 | <v-card flat class="card-style pa-3" dark> | 105 | <v-card flat class="card-style pa-3" dark> |
106 | <v-layout> | 106 | <v-layout> |
107 | <v-flex xs12> | 107 | <v-flex xs12> |
108 | <label class="title text-xs-center">View Course</label> | 108 | <label class="title text-xs-center">View Course</label> |
109 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> | 109 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | <v-card-text> | 112 | <v-card-text> |
113 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 113 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
114 | <v-avatar size="100px"> | 114 | <v-avatar size="100px"> |
115 | <img src="/static/icon/user.png" v-if="!editedItem.courseImageUrl" /> | 115 | <img src="/static/icon/user.png" v-if="!editedItem.courseImageUrl" /> |
116 | <img :src="editedItem.courseImageUrl" v-else-if="editedItem.courseImageUrl" /> | 116 | <img :src="editedItem.courseImageUrl" v-else-if="editedItem.courseImageUrl" /> |
117 | </v-avatar> | 117 | </v-avatar> |
118 | </v-flex> | 118 | </v-flex> |
119 | <v-container grid-list-md> | 119 | <v-container grid-list-md> |
120 | <v-layout wrap> | 120 | <v-layout wrap> |
121 | <v-flex xs12> | 121 | <v-flex xs12> |
122 | <v-layout> | 122 | <v-layout> |
123 | <v-flex xs6 sm6> | 123 | <v-flex xs6 sm6> |
124 | <h5 class="right my-1"> | 124 | <h5 class="right my-1"> |
125 | <b>Course :</b> | 125 | <b>Course :</b> |
126 | </h5> | 126 | </h5> |
127 | </v-flex> | 127 | </v-flex> |
128 | <v-flex sm6 xs6> | 128 | <v-flex sm6 xs6> |
129 | <h5 class="my-1 left">{{ editedItem.courseName }}</h5> | 129 | <h5 class="my-1 left">{{ editedItem.courseName }}</h5> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | </v-flex> | 132 | </v-flex> |
133 | </v-layout> | 133 | </v-layout> |
134 | </v-container> | 134 | </v-container> |
135 | </v-card-text> | 135 | </v-card-text> |
136 | </v-card> | 136 | </v-card> |
137 | </v-dialog> | 137 | </v-dialog> |
138 | 138 | ||
139 | <!-- ****** STUDENTS TABLE ****** --> | 139 | <!-- ****** STUDENTS TABLE ****** --> |
140 | <v-toolbar color="transparent" flat> | 140 | <v-toolbar color="transparent" flat> |
141 | <v-btn | 141 | <v-btn |
142 | fab | 142 | fab |
143 | dark | 143 | dark |
144 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 144 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
145 | small | 145 | small |
146 | @click="addCourseDialog = true" | 146 | @click="addCourseDialog = true" |
147 | > | 147 | > |
148 | <v-icon dark>add</v-icon> | 148 | <v-icon dark>add</v-icon> |
149 | </v-btn> | 149 | </v-btn> |
150 | <v-btn | 150 | <v-btn |
151 | round | 151 | round |
152 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 152 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
153 | dark | 153 | dark |
154 | @click="addCourseDialog = true" | 154 | @click="addCourseDialog = true" |
155 | > | 155 | > |
156 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course | 156 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course |
157 | </v-btn> | 157 | </v-btn> |
158 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 158 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
159 | <v-flex md13 lg12> | 159 | <v-flex md13 lg12> |
160 | <v-layout> | 160 | <v-layout> |
161 | <v-flex lg6 md6> | 161 | <v-flex lg6 md6> |
162 | <v-select | 162 | <v-select |
163 | :items="addclass" | 163 | :items="addclass" |
164 | label="Select Class" | 164 | label="Select Class" |
165 | v-model="selectStudents.select" | 165 | v-model="selectStudents.select" |
166 | item-text="classNum" | 166 | item-text="classNum" |
167 | item-value="_id" | 167 | item-value="_id" |
168 | name="Select Class" | 168 | name="Select Class" |
169 | :rules="classRules" | 169 | :rules="classRules" |
170 | required | 170 | required |
171 | class="ml-2" | 171 | class="ml-2" |
172 | ></v-select> | 172 | ></v-select> |
173 | </v-flex> | 173 | </v-flex> |
174 | </v-layout> | 174 | </v-layout> |
175 | </v-flex> | 175 | </v-flex> |
176 | </v-card-actions> | 176 | </v-card-actions> |
177 | <v-spacer></v-spacer> | 177 | <v-spacer></v-spacer> |
178 | <v-btn | 178 | <v-btn |
179 | @click="getCourses()" | 179 | @click="getCourses()" |
180 | round | 180 | round |
181 | dark | 181 | dark |
182 | :loading="loading" | 182 | :loading="loading" |
183 | class="open-dialog-button hidden-xs-only hidden-sm-only" | 183 | class="open-dialog-button hidden-xs-only hidden-sm-only" |
184 | >Find</v-btn> | 184 | >Find</v-btn> |
185 | <v-card-title class="body-1" v-show="show"> | 185 | <v-card-title class="body-1" v-show="show"> |
186 | <v-btn icon large flat @click="displaySearch"> | 186 | <v-btn icon large flat @click="displaySearch"> |
187 | <v-avatar size="27"> | 187 | <v-avatar size="27"> |
188 | <img src="/static/icon/search.png" alt="icon" /> | 188 | <img src="/static/icon/search.png" alt="icon" /> |
189 | </v-avatar> | 189 | </v-avatar> |
190 | </v-btn> | 190 | </v-btn> |
191 | </v-card-title> | 191 | </v-card-title> |
192 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> | 192 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> |
193 | <v-layout> | 193 | <v-layout> |
194 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 194 | <v-text-field |
195 | autofocus | ||
196 | v-model="search" | ||
197 | label="Search" | ||
198 | prepend-inner-icon="search" | ||
199 | color="primary" | ||
200 | ></v-text-field> | ||
195 | <v-icon @click="closeSearch" color="error">close</v-icon> | 201 | <v-icon @click="closeSearch" color="error">close</v-icon> |
196 | </v-layout> | 202 | </v-layout> |
197 | </v-flex> | 203 | </v-flex> |
198 | </v-toolbar> | 204 | </v-toolbar> |
199 | <v-card flat class="elevation-0 transparent"> | 205 | <v-card flat class="elevation-0 transparent"> |
200 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> | 206 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> |
201 | <v-layout> | 207 | <v-layout> |
202 | <!-- <v-flex xs4> | 208 | <!-- <v-flex xs4> |
203 | <label class="right mt-4">Select Class:</label> | 209 | <label class="right mt-4">Select Class:</label> |
204 | </v-flex>--> | 210 | </v-flex>--> |
205 | <v-flex xs12> | 211 | <v-flex xs12> |
206 | <v-select | 212 | <v-select |
207 | :items="addclass" | 213 | :items="addclass" |
208 | label="Select Class" | 214 | label="Select Class" |
209 | v-model="selectStudents.select" | 215 | v-model="selectStudents.select" |
210 | item-text="classNum" | 216 | item-text="classNum" |
211 | item-value="_id" | 217 | item-value="_id" |
212 | name="Select Class" | 218 | name="Select Class" |
213 | :rules="classRules" | 219 | :rules="classRules" |
214 | class="px-2" | 220 | class="px-2" |
215 | ></v-select> | 221 | ></v-select> |
216 | </v-flex> | 222 | </v-flex> |
217 | </v-layout> | 223 | </v-layout> |
218 | <v-layout> | 224 | <v-layout> |
219 | <v-flex xs5 class="mx-auto mb-2"> | 225 | <v-flex xs5 class="mx-auto mb-2"> |
220 | <v-btn @click="getCourses()" block round dark :loading="loading" class="add-button">Find</v-btn> | 226 | <v-btn @click="getCourses()" block round dark :loading="loading" class="add-button">Find</v-btn> |
221 | </v-flex> | 227 | </v-flex> |
222 | </v-layout> | 228 | </v-layout> |
223 | </v-flex> | 229 | </v-flex> |
224 | </v-card> | 230 | </v-card> |
225 | <v-data-table | 231 | <v-data-table |
226 | :headers="headers" | 232 | :headers="headers" |
227 | :items="courseData" | 233 | :items="courseData" |
228 | :pagination.sync="pagination" | 234 | :pagination.sync="pagination" |
229 | :search="search" | 235 | :search="search" |
230 | > | 236 | > |
231 | <template slot="items" slot-scope="props"> | 237 | <template slot="items" slot-scope="props"> |
232 | <tr class="tr"> | 238 | <tr class="tr"> |
233 | <td class="text-xs-center td td-row"> | 239 | <td class="text-xs-center td td-row"> |
234 | <v-avatar size="40"> | 240 | <v-avatar size="40"> |
235 | <img :src="props.item.courseImageUrl" v-if="props.item.courseImageUrl" /> | 241 | <img :src="props.item.courseImageUrl" v-if="props.item.courseImageUrl" /> |
236 | <img src="/static/icon/user.png" v-else-if="!props.item.courseImageUrl" /> | 242 | <img src="/static/icon/user.png" v-else-if="!props.item.courseImageUrl" /> |
237 | </v-avatar> | 243 | </v-avatar> |
238 | </td> | 244 | </td> |
239 | <td class="text-xs-center td td-row">{{ props.item.courseName}}</td> | 245 | <td class="text-xs-center td td-row">{{ props.item.courseName}}</td> |
240 | <td class="text-xs-center td td-row"> | 246 | <td class="text-xs-center td td-row"> |
241 | <span> | 247 | <span> |
242 | <v-tooltip top> | 248 | <v-tooltip top> |
243 | <img | 249 | <img |
244 | slot="activator" | 250 | slot="activator" |
245 | style="cursor:pointer; width:25px; height:25px; " | 251 | style="cursor:pointer; width:25px; height:25px; " |
246 | class="mr-3" | 252 | class="mr-3" |
247 | @click="profile(props.item)" | 253 | @click="profile(props.item)" |
248 | src="/static/icon/view.png" | 254 | src="/static/icon/view.png" |
249 | /> | 255 | /> |
250 | <span>View</span> | 256 | <span>View</span> |
251 | </v-tooltip> | 257 | </v-tooltip> |
252 | <v-tooltip top> | 258 | <v-tooltip top> |
253 | <img | 259 | <img |
254 | slot="activator" | 260 | slot="activator" |
255 | style="cursor:pointer; width:20px; height:18px; " | 261 | style="cursor:pointer; width:20px; height:18px; " |
256 | class="mr-3" | 262 | class="mr-3" |
257 | @click="editItem(props.item)" | 263 | @click="editItem(props.item)" |
258 | src="/static/icon/edit.png" | 264 | src="/static/icon/edit.png" |
259 | /> | 265 | /> |
260 | <span>Edit</span> | 266 | <span>Edit</span> |
261 | </v-tooltip> | 267 | </v-tooltip> |
262 | <v-tooltip top> | 268 | <v-tooltip top> |
263 | <img | 269 | <img |
264 | slot="activator" | 270 | slot="activator" |
265 | style="cursor:pointer; width:20px; height:20px; " | 271 | style="cursor:pointer; width:20px; height:20px; " |
266 | class="mr-3" | 272 | class="mr-3" |
267 | @click="deleteItem(props.item)" | 273 | @click="deleteItem(props.item)" |
268 | src="/static/icon/delete.png" | 274 | src="/static/icon/delete.png" |
269 | /> | 275 | /> |
270 | <span>Delete</span> | 276 | <span>Delete</span> |
271 | </v-tooltip> | 277 | </v-tooltip> |
272 | </span> | 278 | </span> |
273 | </td> | 279 | </td> |
274 | </tr> | 280 | </tr> |
275 | </template> | 281 | </template> |
276 | <v-alert | 282 | <v-alert |
277 | slot="no-results" | 283 | slot="no-results" |
278 | :value="true" | 284 | :value="true" |
279 | color="error" | 285 | color="error" |
280 | icon="warning" | 286 | icon="warning" |
281 | >Your search for "{{ search }}" found no results.</v-alert> | 287 | >Your search for "{{ search }}" found no results.</v-alert> |
282 | </v-data-table> | 288 | </v-data-table> |
283 | <!-- ****** Add CourseS DETAILS****** --> | 289 | <!-- ****** Add CourseS DETAILS****** --> |
284 | <v-dialog v-model="addCourseDialog" max-width="500"> | 290 | <v-dialog v-model="addCourseDialog" max-width="500" v-if="addCourseDialog"> |
285 | <v-card flat class="card-style pa-2" dark> | 291 | <v-card flat class="card-style pa-2" dark> |
286 | <v-layout> | 292 | <v-layout> |
287 | <v-flex xs12> | 293 | <v-flex xs12> |
288 | <label class="title text-xs-center">Add Course</label> | 294 | <label class="title text-xs-center">Add Course</label> |
289 | <v-icon size="24" class="right" @click="addCourseDialog = false">cancel</v-icon> | 295 | <v-icon size="24" class="right" @click="closeAddCourseModel">cancel</v-icon> |
290 | </v-flex> | 296 | </v-flex> |
291 | </v-layout> | 297 | </v-layout> |
292 | <v-container fluid> | 298 | <v-container fluid> |
293 | <v-layout align-center> | 299 | <v-layout align-center> |
294 | <v-flex xs12> | 300 | <v-flex xs12> |
295 | <v-flex xs12 sm12> | 301 | <v-flex xs12 sm12> |
296 | <v-form ref="form" v-model="valid" lazy-validation> | 302 | <v-form ref="form" v-model="valid" lazy-validation> |
297 | <v-layout> | 303 | <v-layout> |
298 | <v-flex | 304 | <v-flex |
299 | xs12 | 305 | xs12 |
300 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 306 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
301 | > | 307 | > |
302 | <v-avatar size="100px" v-if="!imageUrl"> | 308 | <v-avatar size="100px" v-if="!imageUrl"> |
303 | <img src="/static/icon/user.png" /> | 309 | <img src="/static/icon/user.png" /> |
304 | </v-avatar> | 310 | </v-avatar> |
305 | <input | 311 | <input |
306 | type="file" | 312 | type="file" |
307 | style="display: none" | 313 | style="display: none" |
308 | ref="image" | 314 | ref="image" |
309 | accept="image/*" | 315 | accept="image/*" |
310 | @change="onFilePicked" | 316 | @change="onFilePicked" |
311 | /> | 317 | /> |
312 | <img | 318 | <img |
313 | :src="imageData.imageUrl" | 319 | :src="imageData.imageUrl" |
314 | height="150" | 320 | height="150" |
315 | v-if="imageUrl" | 321 | v-if="imageUrl" |
316 | style="border-radius:50%; width:200px" | 322 | style="border-radius:50%; width:200px" |
317 | /> | 323 | /> |
318 | </v-flex> | 324 | </v-flex> |
319 | </v-layout> | 325 | </v-layout> |
320 | <v-layout wrap> | 326 | <v-layout wrap> |
321 | <v-flex xs12 sm12> | 327 | <v-flex xs12 sm12> |
322 | <v-layout> | 328 | <v-layout> |
323 | <v-flex x4 sm4 class="pt-4 subheading"> | 329 | <v-flex x4 sm4 class="pt-4 subheading"> |
324 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 330 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
325 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 331 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
326 | </v-flex> | 332 | </v-flex> |
327 | <v-flex xs8 sm8 class="ml-3"> | 333 | <v-flex xs8 sm8 class="ml-3"> |
328 | <v-select | 334 | <v-select |
329 | :items="addclass" | 335 | :items="addclass" |
330 | label="Select Class" | 336 | label="Select Class" |
331 | v-model="addCourses.select" | 337 | v-model="addCourses.select" |
332 | item-text="classNum" | 338 | item-text="classNum" |
333 | item-value="_id" | 339 | item-value="_id" |
334 | name="Select Class" | 340 | name="Select Class" |
335 | :rules="classRules" | 341 | :rules="classRules" |
336 | @change="getSections(addCourses.select)" | 342 | @change="getSections(addCourses.select)" |
337 | required | 343 | required |
338 | ></v-select> | 344 | ></v-select> |
339 | </v-flex> | 345 | </v-flex> |
340 | </v-layout> | 346 | </v-layout> |
341 | </v-flex> | 347 | </v-flex> |
342 | </v-layout> | 348 | </v-layout> |
343 | <v-layout wrap> | 349 | <v-layout wrap> |
344 | <v-flex xs12 sm12> | 350 | <v-flex xs12 sm12> |
345 | <v-layout> | 351 | <v-layout> |
346 | <v-flex xs4 sm4 class="pt-4 subheading"> | 352 | <v-flex xs4 sm4 class="pt-4 subheading"> |
347 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> | 353 | <label class="right hidden-xs-only hidden-sm-only">Course Name:</label> |
348 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | 354 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> |
349 | </v-flex> | 355 | </v-flex> |
350 | <v-flex xs8 sm8 class="ml-3"> | 356 | <v-flex xs8 sm8 class="ml-3"> |
351 | <v-text-field | 357 | <v-text-field |
352 | v-model="addCourses.courseName" | 358 | v-model="addCourses.courseName" |
353 | placeholder="fill your Course name" | 359 | placeholder="fill your Course name" |
354 | type="text" | 360 | type="text" |
355 | :rules="courseRules" | 361 | :rules="courseRules" |
356 | required | 362 | required |
357 | ></v-text-field> | 363 | ></v-text-field> |
358 | </v-flex> | 364 | </v-flex> |
359 | </v-layout> | 365 | </v-layout> |
360 | </v-flex> | 366 | </v-flex> |
361 | <v-flex xs12 sm12> | 367 | <v-flex xs12 sm12> |
362 | <v-layout> | 368 | <v-layout> |
363 | <v-flex xs4 class="pt-4 subheading"> | 369 | <v-flex xs4 class="pt-4 subheading"> |
364 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> | 370 | <label class="right hidden-xs-only hidden-sm-only">Upload Image:</label> |
365 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> | 371 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload :</label> |
366 | </v-flex> | 372 | </v-flex> |
367 | <v-flex xs8 class="ml-3"> | 373 | <v-flex xs8 class="ml-3"> |
368 | <v-text-field | 374 | <v-text-field |
369 | label="Select Image" | 375 | label="Select Image" |
370 | @click="pickFile" | 376 | @click="pickFile" |
371 | v-model="imageName" | 377 | v-model="imageName" |
372 | append-icon="attach_file" | 378 | append-icon="attach_file" |
373 | ></v-text-field> | 379 | ></v-text-field> |
374 | </v-flex> | 380 | </v-flex> |
375 | </v-layout> | 381 | </v-layout> |
376 | </v-flex> | 382 | </v-flex> |
377 | </v-layout> | 383 | </v-layout> |
378 | <v-layout> | 384 | <v-layout> |
379 | <v-flex xs12 sm12> | 385 | <v-flex xs12 sm12> |
380 | <v-layout class="right"> | 386 | <v-layout class="right"> |
381 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 387 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
382 | </v-layout> | 388 | </v-layout> |
383 | </v-flex> | 389 | </v-flex> |
384 | </v-layout> | 390 | </v-layout> |
385 | </v-form> | 391 | </v-form> |
386 | </v-flex> | 392 | </v-flex> |
387 | </v-flex> | 393 | </v-flex> |
388 | </v-layout> | 394 | </v-layout> |
389 | </v-container> | 395 | </v-container> |
390 | </v-card> | 396 | </v-card> |
391 | </v-dialog> | 397 | </v-dialog> |
392 | <v-snackbar | 398 | <v-snackbar |
393 | :timeout="timeout" | 399 | :timeout="timeout" |
394 | :top="y === 'top'" | 400 | :top="y === 'top'" |
395 | :right="x === 'right'" | 401 | :right="x === 'right'" |
396 | :vertical="mode === 'vertical'" | 402 | :vertical="mode === 'vertical'" |
397 | v-model="snackbar" | 403 | v-model="snackbar" |
398 | :color="color" | 404 | :color="color" |
399 | >{{ text }}</v-snackbar> | 405 | >{{ text }}</v-snackbar> |
400 | <div class="loader" v-if="showLoader"> | 406 | <div class="loader" v-if="showLoader"> |
401 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 407 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
402 | </div> | 408 | </div> |
403 | </v-container> | 409 | </v-container> |
404 | </template> | 410 | </template> |
405 | 411 | ||
406 | <script> | 412 | <script> |
407 | import http from "@/Services/http.js"; | 413 | import http from "@/Services/http.js"; |
408 | import moment from "moment"; | 414 | import moment from "moment"; |
409 | import countryList from "@/script/country.js"; | 415 | import countryList from "@/script/country.js"; |
410 | import parent from "@/script/parents.js"; | 416 | import parent from "@/script/parents.js"; |
411 | 417 | ||
412 | export default { | 418 | export default { |
413 | data: () => ({ | 419 | data: () => ({ |
414 | showNext: false, | 420 | showNext: false, |
415 | snackbar: false, | 421 | snackbar: false, |
416 | y: "top", | 422 | y: "top", |
417 | x: "right", | 423 | x: "right", |
418 | role: "", | 424 | role: "", |
419 | mode: "", | 425 | mode: "", |
420 | append: "", | 426 | append: "", |
421 | timeout: 3000, | 427 | timeout: 3000, |
422 | text: "", | 428 | text: "", |
423 | show: true, | 429 | show: true, |
424 | color: "", | 430 | color: "", |
425 | showSearch: false, | 431 | showSearch: false, |
426 | showLoader: false, | 432 | showLoader: false, |
427 | loading: false, | 433 | loading: false, |
428 | editLoading: false, | 434 | editLoading: false, |
429 | date: null, | 435 | date: null, |
430 | search: "", | 436 | search: "", |
431 | menu: false, | 437 | menu: false, |
432 | menu1: false, | 438 | menu1: false, |
433 | editStudentDialog: false, | 439 | editStudentDialog: false, |
434 | profileStudentDialog: false, | 440 | profileStudentDialog: false, |
435 | addCourseDialog: false, | 441 | addCourseDialog: false, |
436 | valid: true, | 442 | valid: true, |
437 | addclass: [], | 443 | addclass: [], |
438 | addSection: [], | 444 | addSection: [], |
439 | pagination: { | 445 | pagination: { |
440 | rowsPerPage: 10, | 446 | rowsPerPage: 10, |
441 | }, | 447 | }, |
442 | imageData: {}, | 448 | imageData: {}, |
443 | imageName: "", | 449 | imageName: "", |
444 | imageUrl: "", | 450 | imageUrl: "", |
445 | imageFile: "", | 451 | imageFile: "", |
446 | editImageName: "", | 452 | editImageName: "", |
447 | editImageUrl: "", | 453 | editImageUrl: "", |
448 | courseRules: [(v) => !!v || " Course Name is required"], | 454 | courseRules: [(v) => !!v || " Course Name is required"], |
449 | classRules: [(v) => !!v || " Class Name is required"], | 455 | classRules: [(v) => !!v || " Class Name is required"], |
450 | sectionRules: [(v) => !!v || " Section Name is required"], | 456 | sectionRules: [(v) => !!v || " Section Name is required"], |
451 | errorMessages: "", | 457 | errorMessages: "", |
452 | headers: [ | 458 | headers: [ |
453 | { | 459 | { |
454 | text: "Image", | 460 | text: "Image", |
455 | value: "courseImageUrl", | 461 | value: "courseImageUrl", |
456 | sortable: false, | 462 | sortable: false, |
457 | align: "center", | 463 | align: "center", |
458 | }, | 464 | }, |
459 | { | 465 | { |
460 | text: "Course", | 466 | text: "Course", |
461 | value: "course", | 467 | value: "course", |
462 | sortable: false, | 468 | sortable: false, |
463 | align: "center", | 469 | align: "center", |
464 | }, | 470 | }, |
465 | { text: "Action", value: "", sortable: false, align: "center" }, | 471 | { text: "Action", value: "", sortable: false, align: "center" }, |
466 | ], | 472 | ], |
467 | courseData: [], | 473 | courseData: [], |
468 | editedIndex: -1, | 474 | editedIndex: -1, |
469 | addCourses: {}, | 475 | addCourses: {}, |
470 | selectStudents: { | 476 | selectStudents: { |
471 | select: "", | 477 | select: "", |
472 | selectSection: "", | 478 | selectSection: "", |
473 | }, | 479 | }, |
474 | editedItem: {}, | 480 | editedItem: {}, |
475 | }), | 481 | }), |
482 | watch: { | ||
483 | addCourseDialog: function (val) { | ||
484 | if (!val) { | ||
485 | this.addCourses = []; | ||
486 | this.imageName = ""; | ||
487 | this.imageFile = ""; | ||
488 | this.imageUrl = ""; | ||
489 | } | ||
490 | }, | ||
491 | }, | ||
476 | methods: { | 492 | methods: { |
477 | getCourses() { | 493 | getCourses() { |
478 | this.showLoader = true; | 494 | this.showLoader = true; |
479 | http() | 495 | http() |
480 | .get("/getCourseesList", { | 496 | .get("/getCourseesList", { |
481 | params: { | 497 | params: { |
482 | classId: this.selectStudents.select, | 498 | classId: this.selectStudents.select, |
483 | }, | 499 | }, |
484 | }) | 500 | }) |
485 | .then((response) => { | 501 | .then((response) => { |
486 | this.courseData = response.data.data; | 502 | this.courseData = response.data.data; |
487 | this.showLoader = false; | 503 | this.showLoader = false; |
488 | }) | 504 | }) |
489 | .catch((err) => { | 505 | .catch((err) => { |
490 | console.log("err====>", err); | 506 | console.log("err====>", err); |
491 | this.showLoader = false; | 507 | this.showLoader = false; |
492 | }); | 508 | }); |
493 | }, | 509 | }, |
494 | getSections(_id) { | 510 | getSections(_id) { |
495 | var token = this.$store.state.token; | 511 | var token = this.$store.state.token; |
496 | this.showLoader = true; | 512 | this.showLoader = true; |
497 | http() | 513 | http() |
498 | .get( | 514 | .get( |
499 | "/getSectionsList", | 515 | "/getSectionsList", |
500 | { params: { classId: _id } }, | 516 | { params: { classId: _id } }, |
501 | { | 517 | { |
502 | headers: { Authorization: "Bearer " + token }, | 518 | headers: { Authorization: "Bearer " + token }, |
503 | } | 519 | } |
504 | ) | 520 | ) |
505 | .then((response) => { | 521 | .then((response) => { |
506 | this.addSection = response.data.data; | 522 | this.addSection = response.data.data; |
507 | this.showLoader = false; | 523 | this.showLoader = false; |
508 | }) | 524 | }) |
509 | .catch((err) => { | 525 | .catch((err) => { |
510 | this.showLoader = false; | 526 | this.showLoader = false; |
511 | }); | 527 | }); |
512 | }, | 528 | }, |
513 | pickFile() { | 529 | pickFile() { |
514 | this.$refs.image.click(); | 530 | this.$refs.image.click(); |
515 | }, | 531 | }, |
516 | pickEditFile() { | 532 | pickEditFile() { |
517 | this.$refs.editDataImage.click(); | 533 | this.$refs.editDataImage.click(); |
518 | }, | 534 | }, |
519 | dates: function (date) { | 535 | dates: function (date) { |
520 | return moment(date).format("MMMM DD, YYYY"); | 536 | return moment(date).format("MMMM DD, YYYY"); |
521 | return date; | 537 | return date; |
522 | }, | 538 | }, |
523 | onFilePicked(e) { | 539 | onFilePicked(e) { |
524 | // console.log(e) | 540 | // console.log(e) |
525 | const files = e.target.files; | 541 | const files = e.target.files; |
526 | this.imageData.upload = e.target.files[0]; | 542 | this.imageData.upload = e.target.files[0]; |
527 | if (files[0] !== undefined) { | 543 | if (files[0] !== undefined) { |
528 | this.imageName = files[0].name; | 544 | this.imageName = files[0].name; |
529 | if (this.imageName.lastIndexOf(".") <= 0) { | 545 | if (this.imageName.lastIndexOf(".") <= 0) { |
530 | return; | 546 | return; |
531 | } | 547 | } |
532 | const fr = new FileReader(); | 548 | const fr = new FileReader(); |
533 | fr.readAsDataURL(files[0]); | 549 | fr.readAsDataURL(files[0]); |
534 | fr.addEventListener("load", () => { | 550 | fr.addEventListener("load", () => { |
535 | this.imageUrl = fr.result; | 551 | this.imageUrl = fr.result; |
536 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 552 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
537 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 553 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
538 | }); | 554 | }); |
539 | } else { | 555 | } else { |
540 | this.imageName = ""; | 556 | this.imageName = ""; |
541 | this.imageFile = ""; | 557 | this.imageFile = ""; |
542 | this.imageUrl = ""; | 558 | this.imageUrl = ""; |
543 | } | 559 | } |
544 | }, | 560 | }, |
545 | onEditFilePicked(e) { | 561 | onEditFilePicked(e) { |
546 | console.log(e); | 562 | console.log(e); |
547 | const files = e.target.files; | 563 | const files = e.target.files; |
548 | if (files[0] !== undefined) { | 564 | if (files[0] !== undefined) { |
549 | this.editImageName = files[0].name; | 565 | this.editImageName = files[0].name; |
550 | console.log("this.editImageName", this.editImageName); | 566 | console.log("this.editImageName", this.editImageName); |
551 | 567 | ||
552 | if (this.editImageName.lastIndexOf(".") <= 0) { | 568 | if (this.editImageName.lastIndexOf(".") <= 0) { |
553 | return; | 569 | return; |
554 | } | 570 | } |
555 | const fr = new FileReader(); | 571 | const fr = new FileReader(); |
556 | fr.readAsDataURL(files[0]); | 572 | fr.readAsDataURL(files[0]); |
557 | fr.addEventListener("load", () => { | 573 | fr.addEventListener("load", () => { |
558 | this.editImageUrl = fr.result; | 574 | this.editImageUrl = fr.result; |
559 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... | 575 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... |
560 | }); | 576 | }); |
561 | } else { | 577 | } else { |
562 | this.editImageName = ""; | 578 | this.editImageName = ""; |
563 | this.editiImageFile = ""; | 579 | this.editiImageFile = ""; |
564 | } | 580 | } |
565 | }, | 581 | }, |
566 | editItem(item) { | 582 | editItem(item) { |
567 | this.editedIndex = this.courseData.indexOf(item); | 583 | this.editedIndex = this.courseData.indexOf(item); |
568 | this.editedItem = Object.assign({}, item); | 584 | this.editedItem = Object.assign({}, item); |
569 | this.editStudentDialog = true; | 585 | this.editStudentDialog = true; |
570 | }, | 586 | }, |
571 | profile(item) { | 587 | profile(item) { |
572 | this.editedIndex = this.courseData.indexOf(item); | 588 | this.editedIndex = this.courseData.indexOf(item); |
573 | this.editedItem = Object.assign({}, item); | 589 | this.editedItem = Object.assign({}, item); |
574 | this.profileStudentDialog = true; | 590 | this.profileStudentDialog = true; |
575 | }, | 591 | }, |
576 | deleteItem(item) { | 592 | deleteItem(item) { |
577 | let deleteCourse = { | 593 | let deleteCourse = { |
578 | courseId: item._id, | 594 | courseId: item._id, |
579 | }; | 595 | }; |
580 | http() | 596 | http() |
581 | .delete( | 597 | .delete( |
582 | "/deleteCourse", | 598 | "/deleteCourse", |
583 | confirm("Are you sure you want to delete this?") && { | 599 | confirm("Are you sure you want to delete this?") && { |
584 | params: deleteCourse, | 600 | params: deleteCourse, |
585 | } | 601 | } |
586 | ) | 602 | ) |
587 | .then((response) => { | 603 | .then((response) => { |
588 | this.snackbar = true; | 604 | this.snackbar = true; |
589 | this.text = response.data.message; | 605 | this.text = response.data.message; |
590 | this.color = "green"; | 606 | this.color = "green"; |
591 | this.getCourses(); | 607 | this.getCourses(); |
592 | }) | 608 | }) |
593 | .catch((error) => { | 609 | .catch((error) => { |
594 | this.snackbar = true; | 610 | this.snackbar = true; |
595 | this.text = error.response.data.message; | 611 | this.text = error.response.data.message; |
596 | this.color = "error"; | 612 | this.color = "error"; |
597 | }); | 613 | }); |
598 | }, | 614 | }, |
599 | close() { | 615 | close() { |
600 | this.editStudentDialog = false; | 616 | this.editStudentDialog = false; |
601 | }, | 617 | }, |
602 | closeStudentProfile() { | 618 | closeStudentProfile() { |
603 | this.profileStudentDialog = false; | 619 | this.profileStudentDialog = false; |
604 | }, | 620 | }, |
621 | closeAddCourseModel() { | ||
622 | this.addCourseDialog = false; | ||
623 | this.courseData = []; | ||
624 | this.addCourses = []; | ||
625 | this.imageName = ""; | ||
626 | this.imageFile = ""; | ||
627 | this.imageUrl = ""; | ||
628 | }, | ||
605 | submit() { | 629 | submit() { |
606 | if (this.$refs.form.validate()) { | 630 | if (this.$refs.form.validate()) { |
607 | let addCourse = { | 631 | let addCourse = { |
608 | classId: this.addCourses.select, | 632 | classId: this.addCourses.select, |
609 | sectionId: this.addCourses.selectSection, | 633 | sectionId: this.addCourses.selectSection, |
610 | courseName: this.addCourses.courseName, | 634 | courseName: this.addCourses.courseName, |
611 | }; | 635 | }; |
612 | if (this.imageUrl) { | 636 | if (this.imageUrl) { |
613 | var str = this.imageUrl; | 637 | var str = this.imageUrl; |
614 | const [baseUrl, imageUrl] = str.split(/,/); | 638 | const [baseUrl, imageUrl] = str.split(/,/); |
615 | addCourse.upload = imageUrl; | 639 | addCourse.upload = imageUrl; |
616 | } | 640 | } |
617 | this.loading = true; | 641 | this.loading = true; |
618 | http() | 642 | http() |
619 | .post("/createCourse", addCourse) | 643 | .post("/createCourse", addCourse) |
620 | .then((response) => { | 644 | .then((response) => { |
621 | this.snackbar = true; | 645 | this.snackbar = true; |
622 | this.text = "New Course added successfully"; | 646 | this.text = "New Course added successfully"; |
623 | this.color = "green"; | 647 | this.color = "green"; |
624 | this.addCourseDialog = false; | 648 | this.addCourseDialog = false; |
625 | this.clear(); | 649 | this.clear(); |
626 | this.loading = false; | 650 | this.loading = false; |
627 | }) | 651 | }) |
628 | .catch((error) => { | 652 | .catch((error) => { |
629 | this.snackbar = true; | 653 | this.snackbar = true; |
630 | this.text = error.response.data.message; | 654 | this.text = error.response.data.message; |
631 | this.color = "error"; | 655 | this.color = "error"; |
632 | this.loading = false; | 656 | this.loading = false; |
633 | }); | 657 | }); |
634 | } | 658 | } |
635 | }, | 659 | }, |
636 | clear() { | 660 | clear() { |
637 | this.$refs.form.reset(); | 661 | this.$refs.form.reset(); |
638 | this.imageUrl = ""; | 662 | this.imageUrl = ""; |
639 | }, | 663 | }, |
640 | save() { | 664 | save() { |
641 | let editCourse = { | 665 | let editCourse = { |
642 | courseId: this.editedItem._id, | 666 | courseId: this.editedItem._id, |
643 | courseName: this.editedItem.courseName, | 667 | courseName: this.editedItem.courseName, |
644 | classId: this.editedItem.select, | 668 | classId: this.editedItem.select, |
645 | }; | 669 | }; |
646 | if (this.editImageUrl) { | 670 | if (this.editImageUrl) { |
647 | var str = this.editImageUrl; | 671 | var str = this.editImageUrl; |
648 | const [baseUrl, editImageUrl] = str.split(/,/); | 672 | const [baseUrl, editImageUrl] = str.split(/,/); |
649 | editCourse.upload = editImageUrl; | 673 | editCourse.upload = editImageUrl; |
650 | } | 674 | } |
651 | this.editLoading = true; | 675 | this.editLoading = true; |
652 | http() | 676 | http() |
653 | .put("/updateCourse", editCourse) | 677 | .put("/updateCourse", editCourse) |
654 | .then((response) => { | 678 | .then((response) => { |
655 | this.snackbar = true; | 679 | this.snackbar = true; |
656 | this.text = response.data.message; | 680 | this.text = response.data.message; |
657 | this.color = "green"; | 681 | this.color = "green"; |
658 | this.imageUrl = ""; | 682 | this.imageUrl = ""; |
659 | this.getCourses(); | 683 | this.getCourses(); |
660 | this.close(); | 684 | this.close(); |
661 | this.editLoading = false; | 685 | this.editLoading = false; |
662 | }) | 686 | }) |
663 | .catch((error) => { | 687 | .catch((error) => { |
664 | this.snackbar = true; | 688 | this.snackbar = true; |
665 | this.text = error.response.data.statusText; | 689 | this.text = error.response.data.statusText; |
666 | this.color = "error"; | 690 | this.color = "error"; |
667 | this.editLoading = false; | 691 | this.editLoading = false; |
668 | }); | 692 | }); |
669 | }, | 693 | }, |
670 | displaySearch() { | 694 | displaySearch() { |
671 | this.show = false; | 695 | this.show = false; |
672 | this.showSearch = true; | 696 | this.showSearch = true; |
673 | }, | 697 | }, |
674 | closeSearch() { | 698 | closeSearch() { |
675 | this.showSearch = false; | 699 | this.showSearch = false; |
676 | this.show = true; | 700 | this.show = true; |
677 | this.search = ""; | 701 | this.search = ""; |
678 | }, | 702 | }, |
679 | }, | 703 | }, |
680 | mounted() { | 704 | mounted() { |
681 | var token = this.$store.state.token; | 705 | var token = this.$store.state.token; |
682 | http() | 706 | http() |
683 | .get("/getClassesList", { | 707 | .get("/getClassesList", { |
684 | headers: { Authorization: "Bearer " + token }, | 708 | headers: { Authorization: "Bearer " + token }, |
685 | }) | 709 | }) |
686 | .then((response) => { | 710 | .then((response) => { |
687 | this.addclass = response.data.data; | 711 | this.addclass = response.data.data; |
688 | }) | 712 | }) |
689 | .catch((error) => { | 713 | .catch((error) => { |
690 | this.showLoader = false; | 714 | this.showLoader = false; |
691 | if (error.response.status === 401) { | 715 | if (error.response.status === 401) { |
692 | this.$router.replace({ path: "/" }); | 716 | this.$router.replace({ path: "/" }); |
693 | this.$store.dispatch("setToken", null); | 717 | this.$store.dispatch("setToken", null); |
694 | this.$store.dispatch("Id", null); | 718 | this.$store.dispatch("Id", null); |
695 | this.$store.dispatch("Role", null); | 719 | this.$store.dispatch("Role", null); |
696 | } | 720 | } |
697 | }); | 721 | }); |
698 | }, | 722 | }, |
699 | }; | 723 | }; |
700 | </script> | 724 | </script> |
701 | <style scoped> | 725 | <style scoped> |
702 | .active { | 726 | .active { |
703 | background-color: gray; | 727 | background-color: gray; |
704 | color: white !important; | 728 | color: white !important; |
705 | } | 729 | } |
706 | .activebtn { | 730 | .activebtn { |
707 | color: black !important; | 731 | color: black !important; |
708 | } | 732 | } |
709 | </style> | 733 | </style> |
src/pages/Course/courseDetail.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Chapter detail ****** --> | 3 | <!-- ****** Edit Chapter detail ****** --> |
4 | <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable> | 4 | <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable> |
5 | <v-card class="card-style pa-2" dark> | 5 | <v-card 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 Chapter</label> | 8 | <label class="title text-xs-center">Edit Chapter</label> |
9 | <v-icon size="24" class="right" @click="editCourseDetailDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editCourseDetailDialog = 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-layout wrap> | 13 | <v-layout wrap> |
14 | <v-flex xs12 sm12> | 14 | <v-flex xs12 sm12> |
15 | <v-layout> | 15 | <v-layout> |
16 | <v-flex xs4 class="pt-4 subheading"> | 16 | <v-flex xs4 class="pt-4 subheading"> |
17 | <label class="right">Select Class:</label> | 17 | <label class="right">Select Class:</label> |
18 | </v-flex> | 18 | </v-flex> |
19 | <v-flex xs8 sm6 class="ml-3"> | 19 | <v-flex xs8 sm6 class="ml-3"> |
20 | <v-select | 20 | <v-select |
21 | small | 21 | small |
22 | :items="addclass" | 22 | :items="addclass" |
23 | label="Select Class" | 23 | label="Select Class" |
24 | v-model="editedCourse.classId" | 24 | v-model="editedCourse.classId" |
25 | item-text="classNum" | 25 | item-text="classNum" |
26 | item-value="_id" | 26 | item-value="_id" |
27 | name="Select Class" | 27 | name="Select Class" |
28 | @change="getCourses(editedCourse.classId)" | 28 | @change="getCourses(editedCourse.classId)" |
29 | class="mr-2" | 29 | class="mr-2" |
30 | required | 30 | required |
31 | ></v-select> | 31 | ></v-select> |
32 | </v-flex> | 32 | </v-flex> |
33 | </v-layout> | 33 | </v-layout> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs12 sm12> | 35 | <v-flex xs12 sm12> |
36 | <v-layout> | 36 | <v-layout> |
37 | <v-flex xs4 class="pt-4 subheading"> | 37 | <v-flex xs4 class="pt-4 subheading"> |
38 | <label class="right">Select Course:</label> | 38 | <label class="right">Select Course:</label> |
39 | </v-flex> | 39 | </v-flex> |
40 | <v-flex xs8 sm6 class="ml-3"> | 40 | <v-flex xs8 sm6 class="ml-3"> |
41 | <v-select | 41 | <v-select |
42 | :items="courseData" | 42 | :items="courseData" |
43 | label="Select Course" | 43 | label="Select Course" |
44 | v-model="editedCourse.courseId" | 44 | v-model="editedCourse.courseId" |
45 | item-text="courseName" | 45 | item-text="courseName" |
46 | item-value="_id" | 46 | item-value="_id" |
47 | required | 47 | required |
48 | class="ml-2" | 48 | class="ml-2" |
49 | ></v-select> | 49 | ></v-select> |
50 | </v-flex> | 50 | </v-flex> |
51 | </v-layout> | 51 | </v-layout> |
52 | </v-flex> | 52 | </v-flex> |
53 | </v-layout> | 53 | </v-layout> |
54 | <v-layout> | 54 | <v-layout> |
55 | <v-flex xs12 sm12 md11 lg11> | 55 | <v-flex xs12 sm12 md11 lg11> |
56 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 56 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
57 | <v-spacer></v-spacer> | 57 | <v-spacer></v-spacer> |
58 | <v-btn round dark @click="save" :loading="editLoading" class="add-button mr-4">Save</v-btn> | 58 | <v-btn round dark @click="save" :loading="editLoading" class="add-button mr-4">Save</v-btn> |
59 | </v-card-actions> | 59 | </v-card-actions> |
60 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 60 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
61 | <v-spacer></v-spacer> | 61 | <v-spacer></v-spacer> |
62 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 62 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
63 | <v-spacer></v-spacer> | 63 | <v-spacer></v-spacer> |
64 | </v-card-actions> | 64 | </v-card-actions> |
65 | </v-flex> | 65 | </v-flex> |
66 | </v-layout> | 66 | </v-layout> |
67 | </v-card-text> | 67 | </v-card-text> |
68 | </v-card> | 68 | </v-card> |
69 | </v-dialog> | 69 | </v-dialog> |
70 | <!-- DIALOG BOX - EDIT CHAPTER--> | 70 | <!-- DIALOG BOX - EDIT CHAPTER--> |
71 | <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable> | 71 | <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable> |
72 | <v-card class="card-style pa-2" dark> | 72 | <v-card class="card-style pa-2" dark> |
73 | <v-layout> | 73 | <v-layout> |
74 | <v-flex xs12> | 74 | <v-flex xs12> |
75 | <label class="title text-xs-center">Edit Chapter</label> | 75 | <label class="title text-xs-center">Edit Chapter</label> |
76 | <v-icon | 76 | <v-icon |
77 | size="24" | 77 | size="24" |
78 | class="right" | 78 | class="right" |
79 | @click="editChapterDetailDialog = false; trigger = 'reset'; emptyPdf = 'reset' " | 79 | @click="editChapterDetailDialog = false; trigger = 'reset'; emptyPdf = 'reset' " |
80 | >cancel</v-icon> | 80 | >cancel</v-icon> |
81 | </v-flex> | 81 | </v-flex> |
82 | </v-layout> | 82 | </v-layout> |
83 | <v-card-text> | 83 | <v-card-text> |
84 | <v-layout wrap> | 84 | <v-layout wrap> |
85 | <!-- CHAPTER NAME --> | 85 | <!-- CHAPTER NAME --> |
86 | <v-flex xs12 sm12> | 86 | <v-flex xs12 sm12> |
87 | <v-layout> | 87 | <v-layout> |
88 | <v-flex xs4 class="pt-4 subheading"> | 88 | <v-flex xs4 class="pt-4 subheading"> |
89 | <label class="right">Chapter Name:</label> | 89 | <label class="right">Chapter Name:</label> |
90 | </v-flex> | 90 | </v-flex> |
91 | <v-flex xs8 sm6 class="ml-3"> | 91 | <v-flex xs8 sm6 class="ml-3"> |
92 | <v-text-field | 92 | <v-text-field |
93 | v-model="editChapter.chapterName" | 93 | v-model="editChapter.chapterName" |
94 | placeholder="fill your Title" | 94 | placeholder="fill your Title" |
95 | type="text" | 95 | type="text" |
96 | required | 96 | required |
97 | ></v-text-field> | 97 | ></v-text-field> |
98 | </v-flex> | 98 | </v-flex> |
99 | </v-layout> | 99 | </v-layout> |
100 | </v-flex> | 100 | </v-flex> |
101 | <!-- DESCRIPTION --> | 101 | <!-- DESCRIPTION --> |
102 | <v-flex xs12 sm12> | 102 | <v-flex xs12 sm12> |
103 | <v-layout> | 103 | <v-layout> |
104 | <v-flex xs4 class="pt-4 subheading"> | 104 | <v-flex xs4 class="pt-4 subheading"> |
105 | <label class="right">Description:</label> | 105 | <label class="right">Description:</label> |
106 | </v-flex> | 106 | </v-flex> |
107 | <v-flex xs8 sm6 class="ml-3"> | 107 | <v-flex xs8 sm6 class="ml-3"> |
108 | <v-text-field | 108 | <v-text-field |
109 | placeholder="fill your Description" | 109 | placeholder="fill your Description" |
110 | v-model="editChapter.description" | 110 | v-model="editChapter.description" |
111 | type="text" | 111 | type="text" |
112 | required | 112 | required |
113 | ></v-text-field> | 113 | ></v-text-field> |
114 | </v-flex> | 114 | </v-flex> |
115 | </v-layout> | 115 | </v-layout> |
116 | </v-flex> | 116 | </v-flex> |
117 | <!-- UPLOAD PPT --> | 117 | <!-- UPLOAD PPT --> |
118 | <v-flex xs12> | 118 | <v-flex xs12> |
119 | <v-layout> | 119 | <v-layout> |
120 | <v-flex xs4 class="pt-4 subheading"> | 120 | <v-flex xs4 class="pt-4 subheading"> |
121 | <label class="right">Upload PPT:</label> | 121 | <label class="right">Upload PPT:</label> |
122 | </v-flex> | 122 | </v-flex> |
123 | <v-flex xs8 sm6 class="ml-3"> | 123 | <v-flex xs8 sm6 class="ml-3"> |
124 | <UploadFiles | 124 | <UploadFiles |
125 | @fileSelected="fileSelected($event,'uploadPPT')" | 125 | @fileSelected="fileSelected($event,'uploadPPT')" |
126 | label="Add PPT" | 126 | label="Add PPT" |
127 | reference="EditPpt" | 127 | reference="EditPpt" |
128 | id="editPptInput" | 128 | id="editPptInput" |
129 | :trigger="trigger" | 129 | :trigger="trigger" |
130 | ></UploadFiles> | 130 | ></UploadFiles> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | </v-flex> | 133 | </v-flex> |
134 | <!-- UPLOAD PDF --> | 134 | <!-- UPLOAD PDF --> |
135 | <v-flex xs12> | 135 | <v-flex xs12> |
136 | <v-layout> | 136 | <v-layout> |
137 | <v-flex xs4 class="pt-4 subheading"> | 137 | <v-flex xs4 class="pt-4 subheading"> |
138 | <label class="right">Upload PDF:</label> | 138 | <label class="right">Upload PDF:</label> |
139 | </v-flex> | 139 | </v-flex> |
140 | <v-flex xs8 sm6 class="ml-3"> | 140 | <v-flex xs8 sm6 class="ml-3"> |
141 | <UploadPdf | 141 | <UploadPdf |
142 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" | 142 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" |
143 | label="Add PDF" | 143 | label="Add PDF" |
144 | reference="editPdf" | 144 | reference="editPdf" |
145 | id="editPdfInput" | 145 | id="editPdfInput" |
146 | :emptyPdf="emptyPdf" | 146 | :emptyPdf="emptyPdf" |
147 | ></UploadPdf> | 147 | ></UploadPdf> |
148 | </v-flex> | 148 | </v-flex> |
149 | </v-layout> | 149 | </v-layout> |
150 | </v-flex> | 150 | </v-flex> |
151 | </v-layout> | 151 | </v-layout> |
152 | <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0"> | 152 | <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0"> |
153 | <v-layout | 153 | <v-layout |
154 | wrap | 154 | wrap |
155 | v-for="(editChapterPoint,index) in editChapter.chapterPoints" | 155 | v-for="(editChapterPoint,index) in editChapter.chapterPoints" |
156 | :key="index" | 156 | :key="index" |
157 | > | 157 | > |
158 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> | 158 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> |
159 | <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> | 159 | <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> |
160 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> | 160 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> |
161 | </v-flex> | 161 | </v-flex> |
162 | <v-layout> | 162 | <v-layout> |
163 | <v-flex xs10 sm10 sm5 md9 class="ml-3"> | 163 | <v-flex xs10 sm10 sm5 md9 class="ml-3"> |
164 | <v-text-field :value="editChapterPoint" type="text" required></v-text-field> | 164 | <v-text-field :value="editChapterPoint" type="text" required></v-text-field> |
165 | </v-flex> | 165 | </v-flex> |
166 | <v-flex xs2 class="pt-4"> | 166 | <v-flex xs2 class="pt-4"> |
167 | <v-icon @click="deleteUrl(index)">cancel</v-icon> | 167 | <v-icon @click="deleteUrl(index)">cancel</v-icon> |
168 | </v-flex> | 168 | </v-flex> |
169 | </v-layout> | 169 | </v-layout> |
170 | </v-layout> | 170 | </v-layout> |
171 | </v-flex>--> | 171 | </v-flex>--> |
172 | <v-flex xs12> | 172 | <v-flex xs12> |
173 | <div v-for="(updateImage,index) in updates" :key="index"> | 173 | <div v-for="(updateImage,index) in updates" :key="index"> |
174 | <v-layout wrap> | 174 | <v-layout wrap> |
175 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> | 175 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> |
176 | <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> | 176 | <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> |
177 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> | 177 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> |
178 | </v-flex> | 178 | </v-flex> |
179 | <v-layout> | 179 | <v-layout> |
180 | <v-flex xs10 sm12 md9 class="ml-3"> | 180 | <v-flex xs10 sm12 md9 class="ml-3"> |
181 | <v-text-field | 181 | <v-text-field |
182 | v-model="updateImage.value" | 182 | v-model="updateImage.value" |
183 | placeholder="Upload new Chapter Points" | 183 | placeholder="Upload new Chapter Points" |
184 | required | 184 | required |
185 | ></v-text-field> | 185 | ></v-text-field> |
186 | </v-flex> | 186 | </v-flex> |
187 | <v-flex xs2 class="pt-4"> | 187 | <v-flex xs2 class="pt-4"> |
188 | <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> | 188 | <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> |
189 | <v-icon @click="update">add_circle</v-icon> | 189 | <v-icon @click="update">add_circle</v-icon> |
190 | </v-flex> | 190 | </v-flex> |
191 | </v-layout> | 191 | </v-layout> |
192 | </v-layout> | 192 | </v-layout> |
193 | </div> | 193 | </div> |
194 | </v-flex> | 194 | </v-flex> |
195 | <v-layout> | 195 | <v-layout> |
196 | <v-flex xs12 sm12 md11 lg11> | 196 | <v-flex xs12 sm12 md11 lg11> |
197 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 197 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
198 | <v-spacer></v-spacer> | 198 | <v-spacer></v-spacer> |
199 | <v-btn | 199 | <v-btn |
200 | round | 200 | round |
201 | dark | 201 | dark |
202 | @click="saveChapter" | 202 | @click="saveChapter" |
203 | :loading="editLoading" | 203 | :loading="editLoading" |
204 | class="add-button mr-4" | 204 | class="add-button mr-4" |
205 | >Save</v-btn> | 205 | >Save</v-btn> |
206 | </v-card-actions> | 206 | </v-card-actions> |
207 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 207 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
208 | <v-spacer></v-spacer> | 208 | <v-spacer></v-spacer> |
209 | <v-btn | 209 | <v-btn |
210 | round | 210 | round |
211 | dark | 211 | dark |
212 | @click="saveChapter" | 212 | @click="saveChapter" |
213 | :loading="editLoading" | 213 | :loading="editLoading" |
214 | class="add-button" | 214 | class="add-button" |
215 | >Save</v-btn> | 215 | >Save</v-btn> |
216 | <v-spacer></v-spacer> | 216 | <v-spacer></v-spacer> |
217 | </v-card-actions> | 217 | </v-card-actions> |
218 | </v-flex> | 218 | </v-flex> |
219 | </v-layout> | 219 | </v-layout> |
220 | </v-card-text> | 220 | </v-card-text> |
221 | </v-card> | 221 | </v-card> |
222 | </v-dialog> | 222 | </v-dialog> |
223 | <!-- ADD NEW CHAPTER--> | 223 | <!-- ADD NEW CHAPTER--> |
224 | <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable> | 224 | <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable> |
225 | <v-card class="card-style pa-2" dark> | 225 | <v-card class="card-style pa-2" dark> |
226 | <v-layout> | 226 | <v-layout> |
227 | <v-flex xs12> | 227 | <v-flex xs12> |
228 | <label class="title text-xs-center">Add Chapter Detail</label> | 228 | <label class="title text-xs-center">Add Chapter Detail</label> |
229 | <v-icon | 229 | <v-icon |
230 | size="24" | 230 | size="24" |
231 | class="right" | 231 | class="right" |
232 | @click="addChapterDialog = false; trigger = 'reset'; emptyPdf = 'reset' " | 232 | @click="addChapterDialog = false; trigger = 'reset'; emptyPdf = 'reset' " |
233 | >cancel</v-icon> | 233 | >cancel</v-icon> |
234 | </v-flex> | 234 | </v-flex> |
235 | </v-layout> | 235 | </v-layout> |
236 | <v-card-text> | 236 | <v-card-text> |
237 | <v-layout wrap> | 237 | <v-layout wrap> |
238 | <v-flex xs12 sm12> | 238 | <v-flex xs12 sm12> |
239 | <v-layout> | 239 | <v-layout> |
240 | <v-flex xs4 class="pt-4 subheading"> | 240 | <v-flex xs4 class="pt-4 subheading"> |
241 | <label class="right">Chapter Name:</label> | 241 | <label class="right">Chapter Name:</label> |
242 | </v-flex> | 242 | </v-flex> |
243 | <v-flex xs8 sm6 class="ml-3"> | 243 | <v-flex xs8 sm6 class="ml-3"> |
244 | <v-text-field | 244 | <v-text-field |
245 | v-model="addChapterItem.chapterName" | 245 | v-model="addChapterItem.chapterName" |
246 | placeholder="fill your Title" | 246 | placeholder="fill your Title" |
247 | type="text" | 247 | type="text" |
248 | required | 248 | required |
249 | ></v-text-field> | 249 | ></v-text-field> |
250 | </v-flex> | 250 | </v-flex> |
251 | </v-layout> | 251 | </v-layout> |
252 | </v-flex> | 252 | </v-flex> |
253 | <v-flex xs12 sm12> | 253 | <v-flex xs12 sm12> |
254 | <v-layout> | 254 | <v-layout> |
255 | <v-flex xs4 class="pt-4 subheading"> | 255 | <v-flex xs4 class="pt-4 subheading"> |
256 | <label class="right">Description:</label> | 256 | <label class="right">Description:</label> |
257 | </v-flex> | 257 | </v-flex> |
258 | <v-flex xs8 sm6 class="ml-3"> | 258 | <v-flex xs8 sm6 class="ml-3"> |
259 | <v-text-field | 259 | <v-text-field |
260 | placeholder="fill your Description" | 260 | placeholder="fill your Description" |
261 | v-model="addChapterItem.description" | 261 | v-model="addChapterItem.description" |
262 | type="text" | 262 | type="text" |
263 | required | 263 | required |
264 | ></v-text-field> | 264 | ></v-text-field> |
265 | </v-flex> | 265 | </v-flex> |
266 | </v-layout> | 266 | </v-layout> |
267 | </v-flex> | 267 | </v-flex> |
268 | <!-- UPLOAD PPT --> | 268 | <!-- UPLOAD PPT --> |
269 | <v-flex xs12> | 269 | <v-flex xs12> |
270 | <v-layout> | 270 | <v-layout> |
271 | <v-flex xs4 class="pt-4 subheading"> | 271 | <v-flex xs4 class="pt-4 subheading"> |
272 | <label class="right">Upload PPT:</label> | 272 | <label class="right">Upload PPT:</label> |
273 | </v-flex> | 273 | </v-flex> |
274 | <v-flex xs8 sm6 class="ml-3"> | 274 | <v-flex xs8 sm6 class="ml-3"> |
275 | <UploadFiles | 275 | <UploadFiles |
276 | @fileSelected="fileSelected($event,'uploadPPT')" | 276 | @fileSelected="fileSelected($event,'uploadPPT')" |
277 | label="Add PPT" | 277 | label="Add PPT" |
278 | reference="newChapterPpt" | 278 | reference="newChapterPpt" |
279 | id="newChapterPptInput" | 279 | id="newChapterPptInput" |
280 | :trigger="trigger" | 280 | :trigger="trigger" |
281 | ></UploadFiles> | 281 | ></UploadFiles> |
282 | </v-flex> | 282 | </v-flex> |
283 | </v-layout> | 283 | </v-layout> |
284 | </v-flex> | 284 | </v-flex> |
285 | <!-- UPLOAD PDF --> | 285 | <!-- UPLOAD PDF --> |
286 | <v-flex xs12> | 286 | <v-flex xs12> |
287 | <v-layout> | 287 | <v-layout> |
288 | <v-flex xs4 class="pt-4 subheading"> | 288 | <v-flex xs4 class="pt-4 subheading"> |
289 | <label class="right">Upload PDF:</label> | 289 | <label class="right">Upload PDF:</label> |
290 | </v-flex> | 290 | </v-flex> |
291 | <v-flex xs8 sm6 class="ml-3"> | 291 | <v-flex xs8 sm6 class="ml-3"> |
292 | <UploadPdf | 292 | <UploadPdf |
293 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" | 293 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" |
294 | label="Add PDF" | 294 | label="Add PDF" |
295 | reference="newChapterPdf" | 295 | reference="newChapterPdf" |
296 | id="newChapterPdfInput" | 296 | id="newChapterPdfInput" |
297 | :emptyPdf="emptyPdf" | 297 | :emptyPdf="emptyPdf" |
298 | ></UploadPdf> | 298 | ></UploadPdf> |
299 | </v-flex> | 299 | </v-flex> |
300 | </v-layout> | 300 | </v-layout> |
301 | </v-flex> | 301 | </v-flex> |
302 | </v-layout> | 302 | </v-layout> |
303 | <v-flex xs12> | 303 | <v-flex xs12> |
304 | <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index"> | 304 | <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index"> |
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">Chapter Points:</label> | 307 | <label class="right">Chapter Points:</label> |
308 | </v-flex> | 308 | </v-flex> |
309 | <v-flex xs8 sm8 md6 class="ml-3"> | 309 | <v-flex xs8 sm8 md6 class="ml-3"> |
310 | <v-text-field | 310 | <v-text-field |
311 | placeholder="fill your Chapter Points" | 311 | placeholder="fill your Chapter Points" |
312 | v-model="chapterPoints.value" | 312 | v-model="chapterPoints.value" |
313 | type="text" | 313 | type="text" |
314 | name="link" | 314 | name="link" |
315 | required | 315 | required |
316 | ></v-text-field> | 316 | ></v-text-field> |
317 | </v-flex> | 317 | </v-flex> |
318 | <v-flex xs2 class="pt-4"> | 318 | <v-flex xs2 class="pt-4"> |
319 | <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon> | 319 | <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon> |
320 | <v-icon @click="addChapterPoint()">add_circle</v-icon> | 320 | <v-icon @click="addChapterPoint()">add_circle</v-icon> |
321 | </v-flex> | 321 | </v-flex> |
322 | </v-layout> | 322 | </v-layout> |
323 | </div> | 323 | </div> |
324 | </v-flex> | 324 | </v-flex> |
325 | <v-layout> | 325 | <v-layout> |
326 | <v-flex xs12 sm12 md11 lg11> | 326 | <v-flex xs12 sm12 md11 lg11> |
327 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 327 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
328 | <v-spacer></v-spacer> | 328 | <v-spacer></v-spacer> |
329 | <v-btn | 329 | <v-btn |
330 | round | 330 | round |
331 | dark | 331 | dark |
332 | @click="submitChapter" | 332 | @click="submitChapter" |
333 | :loading="editLoading" | 333 | :loading="editLoading" |
334 | class="add-button mr-4" | 334 | class="add-button mr-4" |
335 | >Submit</v-btn> | 335 | >Submit</v-btn> |
336 | </v-card-actions> | 336 | </v-card-actions> |
337 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 337 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
338 | <v-spacer></v-spacer> | 338 | <v-spacer></v-spacer> |
339 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 339 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
340 | <v-spacer></v-spacer> | 340 | <v-spacer></v-spacer> |
341 | </v-card-actions> | 341 | </v-card-actions> |
342 | </v-flex> | 342 | </v-flex> |
343 | </v-layout> | 343 | </v-layout> |
344 | </v-card-text> | 344 | </v-card-text> |
345 | </v-card> | 345 | </v-card> |
346 | </v-dialog> | 346 | </v-dialog> |
347 | 347 | ||
348 | <!-- ****** PROFILE Gallery ****** --> | 348 | <!-- ****** PROFILE Gallery ****** --> |
349 | 349 | ||
350 | <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable> | 350 | <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable> |
351 | <v-card flat class="card-style pa-3" dark> | 351 | <v-card flat class="card-style pa-3" dark> |
352 | <v-layout> | 352 | <v-layout> |
353 | <v-flex xs12> | 353 | <v-flex xs12> |
354 | <label class="title text-xs-center">View Course Detail</label> | 354 | <label class="title text-xs-center">View Course Detail</label> |
355 | <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> | 355 | <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> |
356 | </v-flex> | 356 | </v-flex> |
357 | </v-layout> | 357 | </v-layout> |
358 | <v-card-text> | 358 | <v-card-text> |
359 | <v-container grid-list-md> | 359 | <v-container grid-list-md> |
360 | <v-layout wrap> | 360 | <v-layout wrap> |
361 | <v-flex xs12> | 361 | <v-flex xs12> |
362 | <v-layout> | 362 | <v-layout> |
363 | <v-flex xs4 sm6> | 363 | <v-flex xs4 sm6> |
364 | <h5 class="right my-1"> | 364 | <h5 class="right my-1"> |
365 | <b>Chapter Name:</b> | 365 | <b>Chapter Name:</b> |
366 | </h5> | 366 | </h5> |
367 | </v-flex> | 367 | </v-flex> |
368 | <v-flex sm6 xs8> | 368 | <v-flex sm6 xs8> |
369 | <h5 class="my-1">{{ editedItem.chapterName }}</h5> | 369 | <h5 class="my-1">{{ editedItem.chapterName }}</h5> |
370 | </v-flex> | 370 | </v-flex> |
371 | </v-layout> | 371 | </v-layout> |
372 | <v-layout> | 372 | <v-layout> |
373 | <v-flex xs4 sm6> | 373 | <v-flex xs4 sm6> |
374 | <h5 class="right my-1"> | 374 | <h5 class="right my-1"> |
375 | <b>Description:</b> | 375 | <b>Description:</b> |
376 | </h5> | 376 | </h5> |
377 | </v-flex> | 377 | </v-flex> |
378 | <v-flex sm6 xs8> | 378 | <v-flex sm6 xs8> |
379 | <h5 class="my-1">{{ editedItem.description }}</h5> | 379 | <h5 class="my-1">{{ editedItem.description }}</h5> |
380 | </v-flex> | 380 | </v-flex> |
381 | </v-layout> | 381 | </v-layout> |
382 | <v-layout> | 382 | <v-layout> |
383 | <v-flex xs5 sm6> | 383 | <v-flex xs5 sm6> |
384 | <h5 class="right my-1"> | 384 | <h5 class="right my-1"> |
385 | <b>Chapter Points:</b> | 385 | <b>Chapter Points:</b> |
386 | </h5> | 386 | </h5> |
387 | </v-flex> | 387 | </v-flex> |
388 | <v-flex sm6 xs8> | 388 | <v-flex sm6 xs8> |
389 | <h5 class="my-1"> | 389 | <h5 class="my-1"> |
390 | <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint"> | 390 | <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint"> |
391 | <li>{{ chapterPoint}}</li> | 391 | <li>{{ chapterPoint}}</li> |
392 | </ul> | 392 | </ul> |
393 | </h5> | 393 | </h5> |
394 | </v-flex> | 394 | </v-flex> |
395 | </v-layout> | 395 | </v-layout> |
396 | <!-- LINK TO PDF --> | 396 | <!-- LINK TO PDF --> |
397 | <v-layout row justify-center> | 397 | <v-layout row justify-center> |
398 | <v-flex xs6> | 398 | <v-flex xs6> |
399 | <div style="width: 100%;"> | 399 | <div style="width: 100%;"> |
400 | <a | 400 | <a |
401 | :href="editedItem.pdfFileUrl" | 401 | :href="editedItem.pdfFileUrl" |
402 | target="_blank" | 402 | target="_blank" |
403 | style="text-decoration: none!important;" | 403 | style="text-decoration: none!important;" |
404 | > | 404 | > |
405 | <v-btn flat block> | 405 | <v-btn flat block> |
406 | <span><h5><b>Open PDF</b></h5></span> | 406 | <span> |
407 | <h5> | ||
408 | <b>Open PDF</b> | ||
409 | </h5> | ||
410 | </span> | ||
407 | </v-btn> | 411 | </v-btn> |
408 | </a> | 412 | </a> |
409 | </div> | 413 | </div> |
410 | </v-flex> | 414 | </v-flex> |
411 | </v-layout> | 415 | </v-layout> |
412 | </v-flex> | 416 | </v-flex> |
413 | </v-layout> | 417 | </v-layout> |
414 | </v-container> | 418 | </v-container> |
415 | </v-card-text> | 419 | </v-card-text> |
416 | </v-card> | 420 | </v-card> |
417 | </v-dialog> | 421 | </v-dialog> |
418 | 422 | ||
419 | <!-- ****** Course Detail TABLE ****** --> | 423 | <!-- ****** Course Detail TABLE ****** --> |
420 | <v-container grid-list-lg class="pa-0"> | 424 | <v-container grid-list-lg class="pa-0"> |
421 | <v-layout row wrap> | 425 | <v-layout row wrap> |
422 | <!-- <v-btn | 426 | <!-- <v-btn |
423 | fab | 427 | fab |
424 | dark | 428 | dark |
425 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 429 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
426 | small | 430 | small |
427 | @click="addCourseDetailDialog = true" | 431 | @click="addCourseDetailDialog = true" |
428 | > | 432 | > |
429 | <v-icon dark>add</v-icon> | 433 | <v-icon dark>add</v-icon> |
430 | </v-btn>--> | 434 | </v-btn>--> |
431 | <v-flex xs12 sm4> | 435 | <v-flex xs12 sm4> |
432 | <v-btn block round class="open-dialog-button" dark @click="addCourseDetailDialog = true"> | 436 | <v-btn block round class="open-dialog-button" dark @click="addCourseDetailDialog = true"> |
433 | <v-icon class="white--text pr-1" size="20">add</v-icon> | 437 | <v-icon class="white--text pr-1" size="20">add</v-icon> |
434 | <span class="hidden-sm-and-down">Add Course Detail</span> | 438 | <span class="hidden-sm-and-down">Add Course Detail</span> |
435 | <span class="hidden-md-and-up">Add</span> | 439 | <span class="hidden-md-and-up">Add</span> |
436 | </v-btn> | 440 | </v-btn> |
437 | </v-flex> | 441 | </v-flex> |
438 | 442 | ||
439 | <v-flex xs12 sm4 md2> | 443 | <v-flex xs12 sm4 md2> |
440 | <v-select | 444 | <v-select |
441 | :items="addclass" | 445 | :items="addclass" |
442 | label="Select Class" | 446 | label="Select Class" |
443 | v-model="getCourse.classId" | 447 | v-model="getCourse.classId" |
444 | item-text="classNum" | 448 | item-text="classNum" |
445 | item-value="_id" | 449 | item-value="_id" |
446 | name="Select Class" | 450 | name="Select Class" |
447 | @change="getCourses(getCourse.classId)" | 451 | @change="getCourses(getCourse.classId)" |
448 | required | 452 | required |
449 | ></v-select> | 453 | ></v-select> |
450 | </v-flex> | 454 | </v-flex> |
451 | <v-flex xs12 sm4 md2> | 455 | <v-flex xs12 sm4 md2> |
452 | <v-select | 456 | <v-select |
453 | :items="courseData" | 457 | :items="courseData" |
454 | label="Select Course" | 458 | label="Select Course" |
455 | v-model="getCourse.courseId" | 459 | v-model="getCourse.courseId" |
456 | item-text="courseName" | 460 | item-text="courseName" |
457 | item-value="_id" | 461 | item-value="_id" |
458 | required | 462 | required |
459 | @change="getCourseDetailsList(getCourse.courseId)" | 463 | @change="getCourseDetailsList(getCourse.courseId)" |
460 | ></v-select> | 464 | ></v-select> |
461 | </v-flex> | 465 | </v-flex> |
462 | 466 | ||
463 | <v-flex xs12 sm1 v-if="show"> | 467 | <v-flex xs12 sm1 v-if="show"> |
464 | <v-btn icon large flat @click="show = false;showSearch = true;"> | 468 | <v-btn icon large flat @click="show = false;showSearch = true;"> |
465 | <v-avatar size="27"> | 469 | <v-avatar size="27"> |
466 | <img src="/static/icon/search.png" alt="icon" /> | 470 | <img src="/static/icon/search.png" alt="icon" /> |
467 | </v-avatar> | 471 | </v-avatar> |
468 | </v-btn> | 472 | </v-btn> |
469 | </v-flex> | 473 | </v-flex> |
470 | 474 | ||
471 | <v-flex xs12 sm3 md3 v-if="showSearch"> | 475 | <v-flex xs12 sm3 md3 v-if="showSearch"> |
472 | <div style="display: inline-block;width: 70%;"> | 476 | <div style="display: inline-block;width: 70%;"> |
473 | <v-text-field | 477 | <v-text-field |
474 | autofocus | 478 | autofocus |
475 | v-model="search" | 479 | v-model="search" |
476 | label="Search" | 480 | label="Search" |
477 | prepend-inner-icon="search" | 481 | prepend-inner-icon="search" |
478 | color="primary" | 482 | color="primary" |
479 | ></v-text-field> | 483 | ></v-text-field> |
480 | </div> | 484 | </div> |
481 | <div style="display: inline-block;"> | 485 | <div style="display: inline-block;"> |
482 | <v-icon @click="closeSearch" color="error">close</v-icon> | 486 | <v-icon @click="closeSearch" color="error">close</v-icon> |
483 | </div> | 487 | </div> |
484 | </v-flex> | 488 | </v-flex> |
485 | </v-layout> | 489 | </v-layout> |
486 | </v-container> | 490 | </v-container> |
487 | <v-data-table | 491 | <v-data-table |
488 | :headers="headers" | 492 | :headers="headers" |
489 | :items="CourseDetailsList" | 493 | :items="CourseDetailsList" |
490 | :pagination.sync="pagination" | 494 | :pagination.sync="pagination" |
491 | :search="search" | 495 | :search="search" |
492 | item-key="_id" | 496 | item-key="_id" |
493 | > | 497 | > |
494 | <template slot="items" slot-scope="props"> | 498 | <template slot="items" slot-scope="props"> |
495 | <tr class="tr" @click="courseTableRow(props.item._id)"> | 499 | <tr class="tr" @click="courseTableRow(props.item._id)"> |
496 | <td class="td td-row">{{ props.index + 1}}</td> | 500 | <td class="td td-row">{{ props.index + 1}}</td> |
497 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td> | 501 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td> |
498 | <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td> | 502 | <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td> |
499 | <td class="td td-row text-xs-center"> | 503 | <td class="td td-row text-xs-center"> |
500 | <div style="vertical-align: top;"> | 504 | <div style="vertical-align: top;"> |
501 | <v-tooltip top> | 505 | <v-tooltip top> |
502 | <v-icon | 506 | <v-icon |
503 | slot="activator" | 507 | slot="activator" |
504 | style="cursor:pointer;font-size:22px;position: relative;top: -4px; " | 508 | style="cursor:pointer;font-size:22px;position: relative;top: -4px; " |
505 | class="mr-3" | 509 | class="mr-3" |
506 | @click="addChapters(props.item)" | 510 | @click="addChapters(props.item)" |
507 | >add_circle_outline</v-icon> | 511 | >add_circle_outline</v-icon> |
508 | <span>Add</span> | 512 | <span>Add</span> |
509 | </v-tooltip> | 513 | </v-tooltip> |
510 | <v-tooltip top> | 514 | <v-tooltip top> |
511 | <img | 515 | <img |
512 | slot="activator" | 516 | slot="activator" |
513 | style="cursor:pointer; width:25px; height:25px; " | 517 | style="cursor:pointer; width:25px; height:25px; " |
514 | class="mr-3" | 518 | class="mr-3" |
515 | @click="props.expanded = !props.expanded" | 519 | @click="props.expanded = !props.expanded" |
516 | src="/static/icon/view.png" | 520 | src="/static/icon/view.png" |
517 | /> | 521 | /> |
518 | <span>View</span> | 522 | <span>View</span> |
519 | </v-tooltip> | 523 | </v-tooltip> |
520 | <v-tooltip top> | 524 | <v-tooltip top> |
521 | <img | 525 | <img |
522 | slot="activator" | 526 | slot="activator" |
523 | style="cursor:pointer; width:20px; height:18px; " | 527 | style="cursor:pointer; width:20px; height:18px; " |
524 | class="mr-3" | 528 | class="mr-3" |
525 | @click="editItem(props.item)" | 529 | @click="editItem(props.item)" |
526 | src="/static/icon/edit.png" | 530 | src="/static/icon/edit.png" |
527 | /> | 531 | /> |
528 | <span>Edit</span> | 532 | <span>Edit</span> |
529 | </v-tooltip> | 533 | </v-tooltip> |
530 | <v-tooltip top> | 534 | <v-tooltip top> |
531 | <img | 535 | <img |
532 | slot="activator" | 536 | slot="activator" |
533 | style="cursor:pointer; width:20px; height:20px; " | 537 | style="cursor:pointer; width:20px; height:20px; " |
534 | class="mr-3" | 538 | class="mr-3" |
535 | @click="deleteItem(props.item)" | 539 | @click="deleteItem(props.item)" |
536 | src="/static/icon/delete.png" | 540 | src="/static/icon/delete.png" |
537 | /> | 541 | /> |
538 | <span>Delete</span> | 542 | <span>Delete</span> |
539 | </v-tooltip> | 543 | </v-tooltip> |
540 | </div> | 544 | </div> |
541 | </td> | 545 | </td> |
542 | </tr> | 546 | </tr> |
543 | </template> | 547 | </template> |
544 | <!-- CHAPTERS IN A COURSE --> | 548 | <!-- CHAPTERS IN A COURSE --> |
545 | <template slot="expand"> | 549 | <template slot="expand"> |
546 | <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;"> | 550 | <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;"> |
547 | <template slot="items" slot-scope="props"> | 551 | <template slot="items" slot-scope="props"> |
548 | <tr class="tr" @click="props.expanded = !props.expanded"> | 552 | <tr class="tr" @click="props.expanded = !props.expanded"> |
549 | <td class="td td-row">{{ props.index + 1}}</td> | 553 | <td class="td td-row">{{ props.index + 1}}</td> |
550 | <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td> | 554 | <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td> |
551 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> | 555 | <td class="text-xs-center td td-row">{{ props.item.description }}</td> |
552 | <td class="text-xs-center td td-row"> | 556 | <td class="text-xs-center td td-row"> |
553 | <v-tooltip top> | 557 | <v-tooltip top> |
554 | <v-icon | 558 | <v-icon |
555 | slot="activator" | 559 | slot="activator" |
556 | style="cursor:pointer;font-size:22px;position: relative;top: -4px; " | 560 | style="cursor:pointer;font-size:22px;position: relative;top: -4px; " |
557 | class="mr-3" | 561 | class="mr-3" |
558 | @click="$router.push({name: 'Live Online Class', query: {chapterId: props.item._id, chapterName: props.item.chapterName, courseId: getCourse.courseId, classId: getCourse.classId }})" | 562 | @click="$router.push({name: 'Live Online Class', query: {chapterId: props.item._id, chapterName: props.item.chapterName, courseId: getCourse.courseId, classId: getCourse.classId }})" |
559 | >video_call</v-icon> | 563 | >video_call</v-icon> |
560 | <span>Live Session</span> | 564 | <span>Live Session</span> |
561 | </v-tooltip> | 565 | </v-tooltip> |
562 | <v-tooltip top> | 566 | <v-tooltip top> |
563 | <img | 567 | <img |
564 | slot="activator" | 568 | slot="activator" |
565 | style="cursor:pointer; width:25px; height:25px; " | 569 | style="cursor:pointer; width:25px; height:25px; " |
566 | class="mr-3" | 570 | class="mr-3" |
567 | @click="profile(props.item)" | 571 | @click="profile(props.item)" |
568 | src="/static/icon/view.png" | 572 | src="/static/icon/view.png" |
569 | /> | 573 | /> |
570 | <span>View</span> | 574 | <span>View</span> |
571 | </v-tooltip> | 575 | </v-tooltip> |
572 | <v-tooltip top> | 576 | <v-tooltip top> |
573 | <img | 577 | <img |
574 | slot="activator" | 578 | slot="activator" |
575 | style="cursor:pointer; width:20px; height:18px; " | 579 | style="cursor:pointer; width:20px; height:18px; " |
576 | class="mr-3" | 580 | class="mr-3" |
577 | @click="editChapterItem(props.item)" | 581 | @click="editChapterItem(props.item)" |
578 | src="/static/icon/edit.png" | 582 | src="/static/icon/edit.png" |
579 | /> | 583 | /> |
580 | <span>Edit</span> | 584 | <span>Edit</span> |
581 | </v-tooltip> | 585 | </v-tooltip> |
582 | <v-tooltip top> | 586 | <v-tooltip top> |
583 | <img | 587 | <img |
584 | slot="activator" | 588 | slot="activator" |
585 | style="cursor:pointer; width:20px; height:20px; " | 589 | style="cursor:pointer; width:20px; height:20px; " |
586 | class="mr-3" | 590 | class="mr-3" |
587 | @click="deleteChapters(props.item)" | 591 | @click="deleteChapters(props.item)" |
588 | src="/static/icon/delete.png" | 592 | src="/static/icon/delete.png" |
589 | /> | 593 | /> |
590 | <span>Delete Chapter</span> | 594 | <span>Delete Chapter</span> |
591 | </v-tooltip> | 595 | </v-tooltip> |
592 | </td> | 596 | </td> |
593 | </tr> | 597 | </tr> |
594 | </template> | 598 | </template> |
595 | </v-data-table> | 599 | </v-data-table> |
596 | </template> | 600 | </template> |
597 | 601 | ||
598 | <v-alert | 602 | <v-alert |
599 | slot="no-results" | 603 | slot="no-results" |
600 | :value="true" | 604 | :value="true" |
601 | color="error" | 605 | color="error" |
602 | icon="warning" | 606 | icon="warning" |
603 | >Your search for "{{ search }}" found no results.</v-alert> | 607 | >Your search for "{{ search }}" found no results.</v-alert> |
604 | </v-data-table> | 608 | </v-data-table> |
605 | <!-- ****** ADD Course Detail ****** --> | 609 | <!-- ****** ADD Course Detail ****** --> |
606 | <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent> | 610 | <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent> |
607 | <v-card flat class="card-style pa-2" dark> | 611 | <v-card flat class="card-style pa-2" dark> |
608 | <v-layout> | 612 | <v-layout> |
609 | <v-flex xs12> | 613 | <v-flex xs12> |
610 | <label class="title text-xs-center">Add Course Details</label> | 614 | <label class="title text-xs-center">Add Course Details</label> |
611 | <v-icon | 615 | <v-icon |
612 | size="24" | 616 | size="24" |
613 | class="right" | 617 | class="right" |
614 | @click="addCourseDetailDialog = false; clear() ; trigger = 'reset' ; emptyPdf = 'reset' " | 618 | @click="addCourseDetailDialog = false; clear() ; trigger = 'reset' ; emptyPdf = 'reset' " |
615 | >cancel</v-icon> | 619 | >cancel</v-icon> |
616 | </v-flex> | 620 | </v-flex> |
617 | </v-layout> | 621 | </v-layout> |
618 | <v-form ref="form" v-model="valid" lazy-validation> | 622 | <v-form ref="form" v-model="valid" lazy-validation> |
619 | <v-container fluid> | 623 | <v-container fluid> |
620 | <v-flex xs12> | 624 | <v-flex xs12> |
621 | <v-layout> | 625 | <v-layout> |
622 | <v-flex xs4 class="pt-4 subheading"> | 626 | <v-flex xs4 class="pt-4 subheading"> |
623 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 627 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
624 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 628 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
625 | </v-flex> | 629 | </v-flex> |
626 | <v-flex xs8 sm8 md7 class="ml-3"> | 630 | <v-flex xs8 sm8 md7 class="ml-3"> |
627 | <v-select | 631 | <v-select |
628 | :items="addclass" | 632 | :items="addclass" |
629 | label="Select Class" | 633 | label="Select Class" |
630 | v-model="addCourseDetail.classId" | 634 | v-model="addCourseDetail.classId" |
631 | item-text="classNum" | 635 | item-text="classNum" |
632 | item-value="_id" | 636 | item-value="_id" |
633 | name="Select Class" | 637 | name="Select Class" |
634 | :rules="clsssRules" | 638 | :rules="clsssRules" |
635 | @change="getCourses(addCourseDetail.classId)" | 639 | @change="getCourses(addCourseDetail.classId)" |
636 | required | 640 | required |
637 | ></v-select> | 641 | ></v-select> |
638 | </v-flex> | 642 | </v-flex> |
639 | </v-layout> | 643 | </v-layout> |
640 | </v-flex> | 644 | </v-flex> |
641 | <v-flex xs12> | 645 | <v-flex xs12> |
642 | <v-layout> | 646 | <v-layout> |
643 | <v-flex xs4 class="pt-4 subheading"> | 647 | <v-flex xs4 class="pt-4 subheading"> |
644 | <label class="right hidden-xs-only hidden-sm-only">Select Course:</label> | 648 | <label class="right hidden-xs-only hidden-sm-only">Select Course:</label> |
645 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> | 649 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> |
646 | </v-flex> | 650 | </v-flex> |
647 | <v-flex xs8 sm8 md7 class="ml-3"> | 651 | <v-flex xs8 sm8 md7 class="ml-3"> |
648 | <v-select | 652 | <v-select |
649 | :items="courseData" | 653 | :items="courseData" |
650 | label="Select Course" | 654 | label="Select Course" |
651 | v-model="addCourseDetail.courseId" | 655 | v-model="addCourseDetail.courseId" |
652 | item-text="courseName" | 656 | item-text="courseName" |
653 | item-value="_id" | 657 | item-value="_id" |
654 | :rules="courseRules" | 658 | :rules="courseRules" |
655 | required | 659 | required |
656 | ></v-select> | 660 | ></v-select> |
657 | </v-flex> | 661 | </v-flex> |
658 | </v-layout> | 662 | </v-layout> |
659 | </v-flex> | 663 | </v-flex> |
660 | <v-flex xs12> | 664 | <v-flex xs12> |
661 | <v-layout> | 665 | <v-layout> |
662 | <v-flex xs4 class="pt-4 subheading"> | 666 | <v-flex xs4 class="pt-4 subheading"> |
663 | <label class="right">Chapter Name:</label> | 667 | <label class="right">Chapter Name:</label> |
664 | </v-flex> | 668 | </v-flex> |
665 | <v-flex xs8 sm8 md7 class="ml-3"> | 669 | <v-flex xs8 sm8 md7 class="ml-3"> |
666 | <v-text-field | 670 | <v-text-field |
667 | v-model="addCourseDetail.chapterName" | 671 | v-model="addCourseDetail.chapterName" |
668 | placeholder="fill your Title" | 672 | placeholder="fill your Title" |
669 | name="name" | 673 | name="name" |
670 | type="text" | 674 | type="text" |
671 | :rules="chapterNameRules" | 675 | :rules="chapterNameRules" |
672 | required | 676 | required |
673 | ></v-text-field> | 677 | ></v-text-field> |
674 | </v-flex> | 678 | </v-flex> |
675 | </v-layout> | 679 | </v-layout> |
676 | </v-flex> | 680 | </v-flex> |
677 | <!-- DESCRIPTION --> | 681 | <!-- DESCRIPTION --> |
678 | <v-flex xs12> | 682 | <v-flex xs12> |
679 | <v-layout> | 683 | <v-layout> |
680 | <v-flex xs4 class="pt-4 subheading"> | 684 | <v-flex xs4 class="pt-4 subheading"> |
681 | <label class="right">Description:</label> | 685 | <label class="right">Description:</label> |
682 | </v-flex> | 686 | </v-flex> |
683 | <v-flex xs8 sm8 md7 class="ml-3"> | 687 | <v-flex xs8 sm8 md7 class="ml-3"> |
684 | <v-text-field | 688 | <v-text-field |
685 | placeholder="fill your Description" | 689 | placeholder="fill your Description" |
686 | :rules="descriptionRules" | 690 | :rules="descriptionRules" |
687 | v-model="addCourseDetail.description" | 691 | v-model="addCourseDetail.description" |
688 | type="text" | 692 | type="text" |
689 | name="email" | 693 | name="email" |
690 | required | 694 | required |
691 | ></v-text-field> | 695 | ></v-text-field> |
692 | </v-flex> | 696 | </v-flex> |
693 | </v-layout> | 697 | </v-layout> |
694 | </v-flex> | 698 | </v-flex> |
695 | <!-- UPLOAD PPT --> | 699 | <!-- UPLOAD PPT --> |
696 | <v-flex xs12> | 700 | <v-flex xs12> |
697 | <v-layout> | 701 | <v-layout> |
698 | <v-flex xs4 class="pt-4 subheading"> | 702 | <v-flex xs4 class="pt-4 subheading"> |
699 | <label class="right">Upload PPT:</label> | 703 | <label class="right">Upload PPT:</label> |
700 | </v-flex> | 704 | </v-flex> |
701 | <v-flex xs8 sm8 md7 class="ml-3"> | 705 | <v-flex xs8 sm8 md7 class="ml-3"> |
702 | <UploadFiles | 706 | <UploadFiles |
703 | @fileSelected="fileSelected($event,'uploadPPT')" | 707 | @fileSelected="fileSelected($event,'uploadPPT')" |
704 | label="Add PPT" | 708 | label="Add PPT" |
705 | reference="newCoursePpt" | 709 | reference="newCoursePpt" |
706 | id="newCoursePptInput" | 710 | id="newCoursePptInput" |
707 | :trigger="trigger" | 711 | :trigger="trigger" |
708 | ></UploadFiles> | 712 | ></UploadFiles> |
709 | </v-flex> | 713 | </v-flex> |
710 | </v-layout> | 714 | </v-layout> |
711 | </v-flex> | 715 | </v-flex> |
712 | <!-- UPLOAD PDF --> | 716 | <!-- UPLOAD PDF --> |
713 | <v-flex xs12> | 717 | <v-flex xs12> |
714 | <v-layout> | 718 | <v-layout> |
715 | <v-flex xs4 class="pt-4 subheading"> | 719 | <v-flex xs4 class="pt-4 subheading"> |
716 | <label class="right">Upload PDF:</label> | 720 | <label class="right">Upload PDF:</label> |
717 | </v-flex> | 721 | </v-flex> |
718 | <v-flex xs8 sm8 md7 class="ml-3"> | 722 | <v-flex xs8 sm8 md7 class="ml-3"> |
719 | <UploadPdf | 723 | <UploadPdf |
720 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" | 724 | @pdfFileSelected="pdfFileSelected($event,'uploadPDF')" |
721 | label="Add PDF" | 725 | label="Add PDF" |
722 | reference="newCoursePdf" | 726 | reference="newCoursePdf" |
723 | id="newCoursePdfInput" | 727 | id="newCoursePdfInput" |
724 | :emptyPdf="emptyPdf" | 728 | :emptyPdf="emptyPdf" |
725 | ></UploadPdf> | 729 | ></UploadPdf> |
726 | </v-flex> | 730 | </v-flex> |
727 | </v-layout> | 731 | </v-layout> |
728 | </v-flex> | 732 | </v-flex> |
729 | <v-layout> | 733 | <v-layout> |
730 | <v-flex xs12> | 734 | <v-flex xs12> |
731 | <div v-for="(chapterPoints,index) in finds" :key="index"> | 735 | <div v-for="(chapterPoints,index) in finds" :key="index"> |
732 | <v-layout> | 736 | <v-layout> |
733 | <v-flex xs4 class="pt-4 subheading"> | 737 | <v-flex xs4 class="pt-4 subheading"> |
734 | <label class="right">Chapter Points:</label> | 738 | <label class="right">Chapter Points:</label> |
735 | </v-flex> | 739 | </v-flex> |
736 | <v-flex xs8 sm8 md6 class="ml-3"> | 740 | <v-flex xs8 sm8 md6 class="ml-3"> |
737 | <v-text-field | 741 | <v-text-field |
738 | placeholder="fill your Chapter Points" | 742 | placeholder="fill your Chapter Points" |
739 | v-model="chapterPoints.value" | 743 | v-model="chapterPoints.value" |
740 | type="text" | 744 | type="text" |
741 | required | 745 | required |
742 | ></v-text-field> | 746 | ></v-text-field> |
743 | </v-flex> | 747 | </v-flex> |
744 | <v-flex xs2 class="pt-4"> | 748 | <v-flex xs2 class="pt-4"> |
745 | <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> | 749 | <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> |
746 | <v-icon @click="addFind">add_circle</v-icon> | 750 | <v-icon @click="addFind">add_circle</v-icon> |
747 | </v-flex> | 751 | </v-flex> |
748 | </v-layout> | 752 | </v-layout> |
749 | </div> | 753 | </div> |
750 | </v-flex> | 754 | </v-flex> |
751 | </v-layout> | 755 | </v-layout> |
752 | <v-layout> | 756 | <v-layout> |
753 | <v-flex xs12 sm12> | 757 | <v-flex xs12 sm12> |
754 | <v-layout class="right"> | 758 | <v-layout class="right"> |
755 | <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn> | 759 | <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn> |
756 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 760 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
757 | </v-layout> | 761 | </v-layout> |
758 | </v-flex> | 762 | </v-flex> |
759 | </v-layout> | 763 | </v-layout> |
760 | </v-container> | 764 | </v-container> |
761 | </v-form> | 765 | </v-form> |
762 | </v-card> | 766 | </v-card> |
763 | </v-dialog> | 767 | </v-dialog> |
764 | <v-snackbar | 768 | <v-snackbar |
765 | :timeout="timeout" | 769 | :timeout="timeout" |
766 | :top="y === 'top'" | 770 | :top="y === 'top'" |
767 | :right="x === 'right'" | 771 | :right="x === 'right'" |
768 | :vertical="mode === 'vertical'" | 772 | :vertical="mode === 'vertical'" |
769 | v-model="snackbar" | 773 | v-model="snackbar" |
770 | :color="color" | 774 | :color="color" |
771 | >{{ text }}</v-snackbar> | 775 | >{{ text }}</v-snackbar> |
772 | <div class="loader" v-if="showLoader"> | 776 | <div class="loader" v-if="showLoader"> |
773 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 777 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
774 | </div> | 778 | </div> |
775 | </v-container> | 779 | </v-container> |
776 | </template> | 780 | </template> |
777 | 781 | ||
778 | <script> | 782 | <script> |
779 | import http from "@/Services/http.js"; | 783 | import http from "@/Services/http.js"; |
780 | import UploadFiles from "@/pages/Common/UploadFiles.vue"; | 784 | import UploadFiles from "@/pages/Common/UploadFiles.vue"; |
781 | import UploadPdf from "@/pages/Common/UploadPdf.vue"; | 785 | import UploadPdf from "@/pages/Common/UploadPdf.vue"; |
782 | import AllApiCalls from "@/Services/AllApiCalls.js"; | 786 | import AllApiCalls from "@/Services/AllApiCalls.js"; |
783 | 787 | ||
784 | export default { | 788 | export default { |
785 | mixins: [AllApiCalls], | 789 | mixins: [AllApiCalls], |
786 | components: { | 790 | components: { |
787 | UploadFiles, | 791 | UploadFiles, |
788 | UploadPdf, | 792 | UploadPdf, |
789 | }, | 793 | }, |
790 | data: () => ({ | 794 | data: () => ({ |
791 | snackbar: false, | 795 | snackbar: false, |
792 | y: "top", | 796 | y: "top", |
793 | x: "right", | 797 | x: "right", |
794 | mode: "", | 798 | mode: "", |
795 | timeout: 3000, | 799 | timeout: 3000, |
796 | text: "", | 800 | text: "", |
797 | loading: false, | 801 | loading: false, |
798 | color: "", | 802 | color: "", |
799 | date: null, | 803 | date: null, |
800 | search: "", | 804 | search: "", |
801 | show: true, | 805 | show: true, |
802 | addCourseDetailDialog: false, | 806 | addCourseDetailDialog: false, |
803 | showSearch: false, | 807 | showSearch: false, |
804 | showLoader: false, | 808 | showLoader: false, |
805 | editCourseDetailDialog: false, | 809 | editCourseDetailDialog: false, |
806 | editChapterDetailDialog: false, | 810 | editChapterDetailDialog: false, |
807 | viewProfileGallery: false, | 811 | viewProfileGallery: false, |
808 | valid: true, | 812 | valid: true, |
809 | editLoading: false, | 813 | editLoading: false, |
810 | addclass: [], | 814 | addclass: [], |
811 | courseData: [], | 815 | courseData: [], |
812 | addSection: [], | 816 | addSection: [], |
813 | getCourse: {}, | 817 | getCourse: {}, |
814 | finds: [{ value: "" }], | 818 | finds: [{ value: "" }], |
815 | findsChapterPoint: [{ value: "" }], | 819 | findsChapterPoint: [{ value: "" }], |
816 | updates: [], | 820 | updates: [], |
817 | youTubeLink: {}, | 821 | youTubeLink: {}, |
818 | addCourseDetail: { | 822 | addCourseDetail: { |
819 | chapters: [ | 823 | chapters: [ |
820 | { | 824 | { |
821 | chapterName: "", | 825 | chapterName: "", |
822 | description: "", | 826 | description: "", |
823 | chapterPoints: [], | 827 | chapterPoints: [], |
824 | }, | 828 | }, |
825 | ], | 829 | ], |
826 | }, | 830 | }, |
827 | chapters: [], | 831 | chapters: [], |
828 | pagination: { | 832 | pagination: { |
829 | rowsPerPage: 10, | 833 | rowsPerPage: 10, |
830 | }, | 834 | }, |
831 | editFiles: [], | 835 | editFiles: [], |
832 | files: [], | 836 | files: [], |
833 | courseData: [], | 837 | courseData: [], |
834 | token: "", | 838 | token: "", |
835 | courseId: "", | 839 | courseId: "", |
836 | clsssRules: [(v) => !!v || " Class is required"], | 840 | clsssRules: [(v) => !!v || " Class is required"], |
837 | courseRules: [(v) => !!v || " Course is required"], | 841 | courseRules: [(v) => !!v || " Course is required"], |
838 | chapterNameRules: [(v) => !!v || " Tilte is required"], | 842 | chapterNameRules: [(v) => !!v || " Tilte is required"], |
839 | descriptionRules: [(v) => !!v || " Description is required"], | 843 | descriptionRules: [(v) => !!v || " Description is required"], |
840 | headers: [ | 844 | headers: [ |
841 | { | 845 | { |
842 | align: "", | 846 | align: "", |
843 | text: "No", | 847 | text: "No", |
844 | sortable: false, | 848 | sortable: false, |
845 | value: "index", | 849 | value: "index", |
846 | }, | 850 | }, |
847 | { | 851 | { |
848 | text: "Class Name", | 852 | text: "Class Name", |
849 | value: "classNum", | 853 | value: "classNum", |
850 | sortable: false, | 854 | sortable: false, |
851 | align: "center", | 855 | align: "center", |
852 | }, | 856 | }, |
853 | { | 857 | { |
854 | text: "Course Name", | 858 | text: "Course Name", |
855 | value: "courseName", | 859 | value: "courseName", |
856 | sortable: false, | 860 | sortable: false, |
857 | align: "center", | 861 | align: "center", |
858 | }, | 862 | }, |
859 | { text: "Action", value: "", sortable: false, align: "center" }, | 863 | { text: "Action", value: "", sortable: false, align: "center" }, |
860 | ], | 864 | ], |
861 | CourseDetailsList: [], | 865 | CourseDetailsList: [], |
862 | editedIndex: -1, | 866 | editedIndex: -1, |
863 | editedItem: {}, | 867 | editedItem: {}, |
864 | editedCourse: {}, | 868 | editedCourse: {}, |
865 | editChapter: { | 869 | editChapter: { |
866 | chapterPoints: [], | 870 | chapterPoints: [], |
867 | }, | 871 | }, |
868 | index: "", | 872 | index: "", |
869 | addChapterItem: {}, | 873 | addChapterItem: {}, |
870 | addChapterItemObj: {}, | 874 | addChapterItemObj: {}, |
871 | addChapterDialog: false, | 875 | addChapterDialog: false, |
872 | }), | 876 | }), |
873 | methods: { | 877 | methods: { |
874 | getCourses(classId) { | 878 | getCourses(classId) { |
875 | this.showLoader = true; | 879 | this.showLoader = true; |
876 | http() | 880 | http() |
877 | .get("/getCourseesList", { | 881 | .get("/getCourseesList", { |
878 | params: { | 882 | params: { |
879 | classId: classId, | 883 | classId: classId, |
880 | }, | 884 | }, |
881 | }) | 885 | }) |
882 | .then((response) => { | 886 | .then((response) => { |
883 | this.editChapter.courseId = ""; | 887 | this.editChapter.courseId = ""; |
884 | this.courseData = response.data.data; | 888 | this.courseData = response.data.data; |
885 | // console.log("this.courseData", this.courseData); | 889 | // console.log("this.courseData", this.courseData); |
886 | this.showLoader = false; | 890 | this.showLoader = false; |
887 | }) | 891 | }) |
888 | .catch((err) => { | 892 | .catch((err) => { |
889 | console.log("err====>", err); | 893 | console.log("err====>", err); |
890 | this.showLoader = false; | 894 | this.showLoader = false; |
891 | }); | 895 | }); |
892 | }, | 896 | }, |
893 | getCourseDetailsList() { | 897 | getCourseDetailsList() { |
894 | this.showLoader = true; | 898 | this.showLoader = true; |
895 | http() | 899 | http() |
896 | .get("/getParticularCourseDetail", { | 900 | .get("/getParticularCourseDetail", { |
897 | params: { | 901 | params: { |
898 | courseId: this.getCourse.courseId, | 902 | courseId: this.getCourse.courseId, |
899 | }, | 903 | }, |
900 | }) | 904 | }) |
901 | .then((response) => { | 905 | .then((response) => { |
902 | this.CourseDetailsList = response.data.data; | 906 | this.CourseDetailsList = response.data.data; |
903 | if (response.data.data[0]) { | 907 | if (response.data.data[0]) { |
904 | this.chapters = response.data.data[0].chapters; | 908 | this.chapters = response.data.data[0].chapters; |
905 | } | 909 | } |
906 | this.showLoader = false; | 910 | this.showLoader = false; |
907 | }) | 911 | }) |
908 | .catch((error) => { | 912 | .catch((error) => { |
909 | // console.log("err====>", err); | 913 | // console.log("err====>", err); |
910 | this.showLoader = false; | 914 | this.showLoader = false; |
911 | if (error.response.status === 401) { | 915 | if (error.response.status === 401) { |
912 | this.$router.replace({ path: "/" }); | 916 | this.$router.replace({ path: "/" }); |
913 | this.$store.dispatch("setToken", null); | 917 | this.$store.dispatch("setToken", null); |
914 | this.$store.dispatch("Id", null); | 918 | this.$store.dispatch("Id", null); |
915 | } | 919 | } |
916 | }); | 920 | }); |
917 | }, | 921 | }, |
918 | courseTableRow(id) { | 922 | courseTableRow(id) { |
919 | this.courseId = id; | 923 | this.courseId = id; |
920 | }, | 924 | }, |
921 | addChapters(item) { | 925 | addChapters(item) { |
922 | this.editedIndex = this.CourseDetailsList.indexOf(item); | 926 | this.editedIndex = this.CourseDetailsList.indexOf(item); |
923 | this.addChapterItemObj = Object.assign({}, item); | 927 | this.addChapterItemObj = Object.assign({}, item); |
924 | this.addChapterItem.courseDetailId = this.addChapterItemObj._id; | 928 | this.addChapterItem.courseDetailId = this.addChapterItemObj._id; |
925 | this.addChapterDialog = true; | 929 | this.addChapterDialog = true; |
926 | }, | 930 | }, |
927 | submitChapter() { | 931 | submitChapter() { |
928 | this.addChapterItem.chapterPoints = []; | 932 | this.addChapterItem.chapterPoints = []; |
929 | for (let i = 0; i < this.findsChapterPoint.length; i++) { | 933 | for (let i = 0; i < this.findsChapterPoint.length; i++) { |
930 | this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value); | 934 | this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value); |
931 | } | 935 | } |
932 | this.loading = true; | 936 | this.loading = true; |
933 | http() | 937 | http() |
934 | .put("/addChapters", this.addChapterItem) | 938 | .put("/addChapters", this.addChapterItem) |
935 | .then((response) => { | 939 | .then((response) => { |
936 | this.addChapterDialog = false; | 940 | this.addChapterDialog = false; |
937 | this.loading = false; | 941 | this.loading = false; |
938 | this.snackbar = true; | 942 | this.snackbar = true; |
939 | this.text = response.data.message; | 943 | this.text = response.data.message; |
940 | this.color = "green"; | 944 | this.color = "green"; |
941 | this.addChapterItem = {}; | 945 | this.addChapterItem = {}; |
942 | this.removeChapterPoint(); | 946 | this.removeChapterPoint(); |
943 | this.getCourseDetailsList(); | 947 | this.getCourseDetailsList(); |
944 | }) | 948 | }) |
945 | .catch((error) => { | 949 | .catch((error) => { |
946 | this.snackbar = true; | 950 | this.snackbar = true; |
947 | this.text = error.response.data.message; | 951 | this.text = error.response.data.message; |
948 | this.color = "error"; | 952 | this.color = "error"; |
949 | this.loading = false; | 953 | this.loading = false; |
950 | }); | 954 | }); |
951 | }, | 955 | }, |
952 | profile(item) { | 956 | profile(item) { |
953 | console.log("chaper - ", item); | 957 | console.log("chaper - ", item); |
954 | this.editedIndex = this.chapters.indexOf(item); | 958 | this.editedIndex = this.chapters.indexOf(item); |
955 | this.editedItem = Object.assign({}, item); | 959 | this.editedItem = Object.assign({}, item); |
956 | this.viewProfileGallery = true; | 960 | this.viewProfileGallery = true; |
957 | }, | 961 | }, |
958 | editItem(item) { | 962 | editItem(item) { |
959 | this.editedIndex = this.CourseDetailsList.indexOf(item); | 963 | this.editedIndex = this.CourseDetailsList.indexOf(item); |
960 | this.editedCourse = Object.assign({}, item); | 964 | this.editedCourse = Object.assign({}, item); |
961 | this.editCourseDetailDialog = true; | 965 | this.editCourseDetailDialog = true; |
962 | }, | 966 | }, |
963 | editChapterItem(item) { | 967 | editChapterItem(item) { |
964 | this.editedIndex = this.chapters.indexOf(item); | 968 | this.editedIndex = this.chapters.indexOf(item); |
965 | this.editChapter = Object.assign({}, item); | 969 | this.editChapter = Object.assign({}, item); |
966 | this.updates = []; | 970 | this.updates = []; |
967 | for (let i = 0; i < this.editChapter.chapterPoints.length; i++) { | 971 | for (let i = 0; i < this.editChapter.chapterPoints.length; i++) { |
968 | this.updates.push({ value: this.editChapter.chapterPoints[i] }); | 972 | this.updates.push({ value: this.editChapter.chapterPoints[i] }); |
969 | } | 973 | } |
970 | this.editChapterDetailDialog = true; | 974 | this.editChapterDetailDialog = true; |
971 | }, | 975 | }, |
972 | deleteItem(item) { | 976 | deleteItem(item) { |
973 | let deleteGallery = { | 977 | let deleteGallery = { |
974 | courseDetailId: item._id, | 978 | courseDetailId: item._id, |
975 | }; | 979 | }; |
976 | http() | 980 | http() |
977 | .delete( | 981 | .delete( |
978 | "/deleteCourseDetail", | 982 | "/deleteCourseDetail", |
979 | confirm("Are you sure you want to delete this?") && { | 983 | confirm("Are you sure you want to delete this?") && { |
980 | params: deleteGallery, | 984 | params: deleteGallery, |
981 | headers: { | 985 | headers: { |
982 | Authorization: "Bearer " + this.token, | 986 | Authorization: "Bearer " + this.token, |
983 | }, | 987 | }, |
984 | } | 988 | } |
985 | ) | 989 | ) |
986 | .then((response) => { | 990 | .then((response) => { |
987 | this.snackbar = true; | 991 | this.snackbar = true; |
988 | this.text = "Successfully delete Course Details"; | 992 | this.text = "Successfully delete Course Details"; |
989 | this.color = "green"; | 993 | this.color = "green"; |
990 | this.getCourseDetailsList(); | 994 | this.getCourseDetailsList(); |
991 | }) | 995 | }) |
992 | .catch((error) => { | 996 | .catch((error) => { |
993 | // console.log(error); | 997 | // console.log(error); |
994 | this.snackbar = true; | 998 | this.snackbar = true; |
995 | this.text = error.response.data.message; | 999 | this.text = error.response.data.message; |
996 | this.color = "error"; | 1000 | this.color = "error"; |
997 | }); | 1001 | }); |
998 | }, | 1002 | }, |
999 | deleteChapters(item) { | 1003 | deleteChapters(item) { |
1000 | // console.log("item", item); | 1004 | // console.log("item", item); |
1001 | let deleteChapters = { | 1005 | let deleteChapters = { |
1002 | courseDetailId: this.courseId, | 1006 | courseDetailId: this.courseId, |
1003 | chapterId: item._id, | 1007 | chapterId: item._id, |
1004 | }; | 1008 | }; |
1005 | http() | 1009 | http() |
1006 | .put( | 1010 | .put( |
1007 | "/deleteChapters", | 1011 | "/deleteChapters", |
1008 | confirm("Are you sure you want to delete this?") && deleteChapters | 1012 | confirm("Are you sure you want to delete this?") && deleteChapters |
1009 | ) | 1013 | ) |
1010 | .then((response) => { | 1014 | .then((response) => { |
1011 | this.snackbar = true; | 1015 | this.snackbar = true; |
1012 | this.text = "Successfully delete Chapters"; | 1016 | this.text = "Successfully delete Chapters"; |
1013 | this.color = "green"; | 1017 | this.color = "green"; |
1014 | this.getCourseDetailsList(); | 1018 | this.getCourseDetailsList(); |
1015 | }) | 1019 | }) |
1016 | .catch((error) => { | 1020 | .catch((error) => { |
1017 | // console.log(error); | 1021 | // console.log(error); |
1018 | this.snackbar = true; | 1022 | this.snackbar = true; |
1019 | this.text = error.response.data.message; | 1023 | this.text = error.response.data.message; |
1020 | this.color = "error"; | 1024 | this.color = "error"; |
1021 | }); | 1025 | }); |
1022 | }, | 1026 | }, |
1023 | close() { | 1027 | close() { |
1024 | this.editCourseDetailDialog = false; | 1028 | this.editCourseDetailDialog = false; |
1025 | }, | 1029 | }, |
1026 | closeProfileGallery() { | 1030 | closeProfileGallery() { |
1027 | this.viewProfileGallery = false; | 1031 | this.viewProfileGallery = false; |
1028 | }, | 1032 | }, |
1029 | submit() { | 1033 | submit() { |
1030 | let chapters = []; | 1034 | let chapters = []; |
1031 | var chapterPoints = []; | 1035 | var chapterPoints = []; |
1032 | for (let i = 0; i < this.finds.length; i++) { | 1036 | for (let i = 0; i < this.finds.length; i++) { |
1033 | chapterPoints.push(this.finds[i].value); | 1037 | chapterPoints.push(this.finds[i].value); |
1034 | // console.log("this.finds[i].value", this.finds[i].value); | 1038 | // console.log("this.finds[i].value", this.finds[i].value); |
1035 | chapters = [ | 1039 | chapters = [ |
1036 | { | 1040 | { |
1037 | chapterName: this.addCourseDetail.chapterName, | 1041 | chapterName: this.addCourseDetail.chapterName, |
1038 | description: this.addCourseDetail.description, | 1042 | description: this.addCourseDetail.description, |
1039 | chapterPoints: chapterPoints, | 1043 | chapterPoints: chapterPoints, |
1040 | uploadPdf: this.pdfFile, | 1044 | uploadPdf: this.pdfFile, |
1041 | uploadPpt: this.pptFile, | 1045 | uploadPpt: this.pptFile, |
1042 | }, | 1046 | }, |
1043 | ]; | 1047 | ]; |
1044 | } | 1048 | } |
1045 | if (this.$refs.form.validate()) { | 1049 | if (this.$refs.form.validate()) { |
1046 | // console.log("this.addCourseDetail", this.addCourseDetail); | 1050 | // console.log("this.addCourseDetail", this.addCourseDetail); |
1047 | var courseDetailsData = { | 1051 | var courseDetailsData = { |
1048 | classId: this.addCourseDetail.classId, | 1052 | classId: this.addCourseDetail.classId, |
1049 | courseId: this.addCourseDetail.courseId, | 1053 | courseId: this.addCourseDetail.courseId, |
1050 | chapters: chapters, | 1054 | chapters: chapters, |
1051 | }; | 1055 | }; |
1052 | this.loading = true; | 1056 | this.loading = true; |
1053 | http() | 1057 | http() |
1054 | .post("/createCourseDetail", courseDetailsData) | 1058 | .post("/createCourseDetail", courseDetailsData) |
1055 | .then((response) => { | 1059 | .then((response) => { |
1056 | this.addCourseDetailDialog = false; | 1060 | this.addCourseDetailDialog = false; |
1057 | this.loading = false; | 1061 | this.loading = false; |
1058 | this.snackbar = true; | 1062 | this.snackbar = true; |
1059 | this.text = response.data.message; | 1063 | this.text = response.data.message; |
1060 | this.color = "green"; | 1064 | this.color = "green"; |
1061 | this.clear(); | 1065 | this.clear(); |
1062 | this.trigger = "reset"; | 1066 | this.trigger = "reset"; |
1063 | this.emptyPdf = "reset"; | 1067 | this.emptyPdf = "reset"; |
1064 | this.removeAddFind(); | 1068 | this.removeAddFind(); |
1065 | }) | 1069 | }) |
1066 | .catch((error) => { | 1070 | .catch((error) => { |
1067 | this.snackbar = true; | 1071 | this.snackbar = true; |
1068 | this.text = error.response.data.message; | 1072 | this.text = error.response.data.message; |
1069 | this.color = "error"; | 1073 | this.color = "error"; |
1070 | this.loading = false; | 1074 | this.loading = false; |
1071 | }); | 1075 | }); |
1072 | } | 1076 | } |
1073 | }, | 1077 | }, |
1074 | clear() { | 1078 | clear() { |
1075 | this.$refs.form.reset(); | 1079 | this.$refs.form.reset(); |
1076 | }, | 1080 | }, |
1077 | saveChapter() { | 1081 | saveChapter() { |
1078 | this.editedItem.courseDetailId = this.editedItem._id; | 1082 | this.editedItem.courseDetailId = this.editedItem._id; |
1079 | // console.log("this.updates", this.updates); | 1083 | // console.log("this.updates", this.updates); |
1080 | var chapterPoints = []; | 1084 | var chapterPoints = []; |
1081 | for (let i = 0; i < this.updates.length; i++) { | 1085 | for (let i = 0; i < this.updates.length; i++) { |
1082 | chapterPoints.push(this.updates[i].value); | 1086 | chapterPoints.push(this.updates[i].value); |
1083 | } | 1087 | } |
1084 | var updateData = { | 1088 | var updateData = { |
1085 | courseDetailId: this.courseId, | 1089 | courseDetailId: this.courseId, |
1086 | chapterId: this.editChapter._id, | 1090 | chapterId: this.editChapter._id, |
1087 | chapterName: this.editChapter.chapterName, | 1091 | chapterName: this.editChapter.chapterName, |
1088 | description: this.editChapter.description, | 1092 | description: this.editChapter.description, |
1089 | chapterPoints: chapterPoints, | 1093 | chapterPoints: chapterPoints, |
1090 | uploadPdf: this.pdfFile, | 1094 | uploadPdf: this.pdfFile, |
1091 | uploadPpt: this.pptFile, | 1095 | uploadPpt: this.pptFile, |
1092 | }; | 1096 | }; |
1093 | this.editLoading = true; | 1097 | this.editLoading = true; |
1094 | http() | 1098 | http() |
1095 | .put("/updateChapters", updateData) | 1099 | .put("/updateChapters", updateData) |
1096 | .then((response) => { | 1100 | .then((response) => { |
1097 | this.editChapterDetailDialog = false; | 1101 | this.editChapterDetailDialog = false; |
1098 | this.snackbar = true; | 1102 | this.snackbar = true; |
1099 | this.text = response.data.message; | 1103 | this.text = response.data.message; |
1100 | this.color = "green"; | 1104 | this.color = "green"; |
1101 | this.editLoading = false; | 1105 | this.editLoading = false; |
1102 | // this.removeUpdatePoints(); | 1106 | // this.removeUpdatePoints(); |
1103 | this.trigger = "reset"; | 1107 | this.trigger = "reset"; |
1104 | this.emptyPdf = "reset"; | 1108 | this.emptyPdf = "reset"; |
1105 | this.getCourseDetailsList(); | 1109 | this.getCourseDetailsList(); |
1106 | }) | 1110 | }) |
1107 | .catch((error) => { | 1111 | .catch((error) => { |
1108 | this.editLoading = false; | 1112 | this.editLoading = false; |
1109 | this.snackbar = true; | 1113 | this.snackbar = true; |
1110 | this.text = error.response.data.message; | 1114 | this.text = error.response.data.message; |
1111 | this.color = "error"; | 1115 | this.color = "error"; |
1112 | }); | 1116 | }); |
1113 | }, | 1117 | }, |
1114 | save() { | 1118 | save() { |
1115 | var updateData = { | 1119 | var updateData = { |
1116 | courseDetailId: this.editedCourse._id, | 1120 | courseDetailId: this.editedCourse._id, |
1117 | courseId: this.editedCourse.courseId, | 1121 | courseId: this.editedCourse.courseId, |
1118 | classId: this.editedCourse.classId, | 1122 | classId: this.editedCourse.classId, |
1119 | }; | 1123 | }; |
1120 | this.editLoading = true; | 1124 | this.editLoading = true; |
1121 | http() | 1125 | http() |
1122 | .put("/updateCourseDetail", updateData) | 1126 | .put("/updateCourseDetail", updateData) |
1123 | .then((response) => { | 1127 | .then((response) => { |
1124 | this.getCourseDetailsList(); | 1128 | this.getCourseDetailsList(); |
1125 | this.editCourseDetailDialog = false; | 1129 | this.editCourseDetailDialog = false; |
1126 | this.snackbar = true; | 1130 | this.snackbar = true; |
1127 | this.text = response.data.message; | 1131 | this.text = response.data.message; |
1128 | this.color = "green"; | 1132 | this.color = "green"; |
1129 | this.editLoading = false; | 1133 | this.editLoading = false; |
1130 | // this.editChapterPointName = ""; | 1134 | // this.editChapterPointName = ""; |
1131 | this.editFiles = []; | 1135 | this.editFiles = []; |
1132 | }) | 1136 | }) |
1133 | .catch((error) => { | 1137 | .catch((error) => { |
1134 | this.editLoading = false; | 1138 | this.editLoading = false; |
1135 | this.snackbar = true; | 1139 | this.snackbar = true; |
1136 | this.text = error.response.data.message; | 1140 | this.text = error.response.data.message; |
1137 | this.color = "error"; | 1141 | this.color = "error"; |
1138 | }); | 1142 | }); |
1139 | }, | 1143 | }, |
1140 | getAllClasses() { | 1144 | getAllClasses() { |
1141 | http() | 1145 | http() |
1142 | .get("/getClassesList", { | 1146 | .get("/getClassesList", { |
1143 | headers: { Authorization: "Bearer " + this.token }, | 1147 | headers: { Authorization: "Bearer " + this.token }, |
1144 | }) | 1148 | }) |
1145 | .then((response) => { | 1149 | .then((response) => { |
1146 | this.addclass = response.data.data; | 1150 | this.addclass = response.data.data; |
1147 | }) | 1151 | }) |
1148 | .catch((err) => { | 1152 | .catch((err) => { |
1149 | // console.log("err====>", err); | 1153 | // console.log("err====>", err); |
1150 | }); | 1154 | }); |
1151 | }, | 1155 | }, |
1152 | removeChapterPoint: function () { | 1156 | removeChapterPoint: function () { |
1153 | this.findsChapterPoint = [{ value: "" }]; | 1157 | this.findsChapterPoint = [{ value: "" }]; |
1154 | }, | 1158 | }, |
1155 | removeAddFind: function () { | 1159 | removeAddFind: function () { |
1156 | this.finds = [{ value: "" }]; | 1160 | this.finds = [{ value: "" }]; |
1157 | }, | 1161 | }, |
1158 | addFind: function () { | 1162 | addFind: function () { |
1159 | this.finds.push({ value: "" }); | 1163 | this.finds.push({ value: "" }); |
1160 | }, | 1164 | }, |
1161 | addChapterPoint: function () { | 1165 | addChapterPoint: function () { |
1162 | this.findsChapterPoint.push({ value: "" }); | 1166 | this.findsChapterPoint.push({ value: "" }); |
1163 | }, | 1167 | }, |
1164 | update: function () { | 1168 | update: function () { |
1165 | this.updates.push({ value: "" }); | 1169 | this.updates.push({ value: "" }); |
1166 | }, | 1170 | }, |
1167 | // removeUpdatePoints: function() { | 1171 | // removeUpdatePoints: function() { |
1168 | // this.updates = [{ value: "" }]; | 1172 | // this.updates = [{ value: "" }]; |
1169 | // }, | 1173 | // }, |
1170 | deleteFind: function (index) { | 1174 | deleteFind: function (index) { |
1171 | this.finds.splice(index, 1); | 1175 | this.finds.splice(index, 1); |
1172 | if (index === 0) this.addFind(); | 1176 | if (index === 0) this.addFind(); |
1173 | }, | 1177 | }, |
1174 | deleteChapterPoint: function (index) { | 1178 | deleteChapterPoint: function (index) { |
1175 | this.findsChapterPoint.splice(index, 1); | 1179 | this.findsChapterPoint.splice(index, 1); |
1176 | if (index === 0) this.addChapterPoint(); | 1180 | if (index === 0) this.addChapterPoint(); |
1177 | }, | 1181 | }, |
1178 | deleteUpdate: function (index) { | 1182 | deleteUpdate: function (index) { |
1179 | this.updates.splice(index, 1); | 1183 | this.updates.splice(index, 1); |
1180 | if (index === 0) this.update(); | 1184 | if (index === 0) this.update(); |
1181 | }, | 1185 | }, |
1182 | deleteUrl: function (index, youTubelinkId, id) { | 1186 | deleteUrl: function (index, youTubelinkId, id) { |
1183 | this.editChapter.chapterPoints.splice(index, 1); | 1187 | this.editChapter.chapterPoints.splice(index, 1); |
1184 | if (index === 0) this.update(); | 1188 | if (index === 0) this.update(); |
1185 | }, | 1189 | }, |
1186 | displaySearch() { | 1190 | displaySearch() { |
1187 | this.show = false; | 1191 | this.show = false; |
1188 | this.showSearch = true; | 1192 | this.showSearch = true; |
1189 | }, | 1193 | }, |
1190 | closeSearch() { | 1194 | closeSearch() { |
1191 | this.showSearch = false; | 1195 | this.showSearch = false; |
1192 | this.show = true; | 1196 | this.show = true; |
1193 | this.search = ""; | 1197 | this.search = ""; |
1194 | }, | 1198 | }, |
1195 | }, | 1199 | }, |
1196 | mounted() { | 1200 | mounted() { |
1197 | this.token = this.$store.state.token; | 1201 | this.token = this.$store.state.token; |
1198 | this.getAllClasses(); | 1202 | this.getAllClasses(); |
1199 | }, | 1203 | }, |
1200 | }; | 1204 | }; |
1201 | </script> | 1205 | </script> |
src/pages/Event/event.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 Event</label> | 8 | <label class="title text-xs-center">Edit 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 | 19 | <v-text-field |
20 | v-model="editedItem.title" | 20 | v-model="editedItem.title" |
21 | placeholder="fill your Title" | 21 | placeholder="fill your Title" |
22 | name="name" | 22 | name="name" |
23 | type="text" | 23 | type="text" |
24 | ></v-text-field> | 24 | ></v-text-field> |
25 | </v-flex> | 25 | </v-flex> |
26 | </v-layout> | 26 | </v-layout> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs12 sm12> | 28 | <v-flex xs12 sm12> |
29 | <v-layout> | 29 | <v-layout> |
30 | <v-flex xs4 class="pt-4 subheading"> | 30 | <v-flex xs4 class="pt-4 subheading"> |
31 | <label class="right">Date:</label> | 31 | <label class="right">Date:</label> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs7 class="ml-3"> | 33 | <v-flex xs7 class="ml-3"> |
34 | <v-menu | 34 | <v-menu |
35 | ref="menu" | 35 | ref="menu" |
36 | :close-on-content-click="false" | 36 | :close-on-content-click="false" |
37 | v-model="menu" | 37 | v-model="menu" |
38 | :nudge-right="40" | 38 | :nudge-right="40" |
39 | lazy | 39 | lazy |
40 | transition="scale-transition" | 40 | transition="scale-transition" |
41 | offset-y | 41 | offset-y |
42 | full-width | 42 | full-width |
43 | min-width="290px" | 43 | min-width="290px" |
44 | > | 44 | > |
45 | <v-text-field | 45 | <v-text-field |
46 | slot="activator" | 46 | slot="activator" |
47 | :rules="dateRules" | 47 | :rules="dateRules" |
48 | v-model="editedItem.dateOfEvent" | 48 | v-model="editedItem.dateOfEvent" |
49 | placeholder="Select date" | 49 | placeholder="Select date" |
50 | ></v-text-field> | 50 | ></v-text-field> |
51 | <v-date-picker | 51 | <v-date-picker |
52 | color="info" | 52 | color="info" |
53 | ref="picker" | 53 | ref="picker" |
54 | v-model="editedItem.dateOfEvent" | 54 | v-model="editedItem.dateOfEvent" |
55 | @input="$refs.menu.save(editedItem.dateOfEvent)" | 55 | @input="$refs.menu.save(editedItem.dateOfEvent)" |
56 | ></v-date-picker> | 56 | ></v-date-picker> |
57 | </v-menu> | 57 | </v-menu> |
58 | </v-flex> | 58 | </v-flex> |
59 | </v-layout> | 59 | </v-layout> |
60 | </v-flex> | 60 | </v-flex> |
61 | <v-flex xs12 sm12> | 61 | <v-flex xs12 sm12> |
62 | <v-layout> | 62 | <v-layout> |
63 | <v-flex xs4 class="pt-4 subheading"> | 63 | <v-flex xs4 class="pt-4 subheading"> |
64 | <label class="right">Description:</label> | 64 | <label class="right">Description:</label> |
65 | </v-flex> | 65 | </v-flex> |
66 | <v-flex xs7 class="ml-3"> | 66 | <v-flex xs7 class="ml-3"> |
67 | <v-text-field | 67 | <v-text-field |
68 | placeholder="fill your Description" | 68 | placeholder="fill your Description" |
69 | v-model="editedItem.description" | 69 | v-model="editedItem.description" |
70 | type="text" | 70 | type="text" |
71 | ></v-text-field> | 71 | ></v-text-field> |
72 | </v-flex> | 72 | </v-flex> |
73 | </v-layout> | 73 | </v-layout> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-layout> | 75 | <v-layout> |
76 | <v-flex xs12> | 76 | <v-flex xs12> |
77 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 77 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
78 | <v-spacer></v-spacer> | 78 | <v-spacer></v-spacer> |
79 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 79 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
80 | </v-card-actions> | 80 | </v-card-actions> |
81 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 81 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
82 | <v-spacer></v-spacer> | 82 | <v-spacer></v-spacer> |
83 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 83 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
84 | <v-spacer></v-spacer> | 84 | <v-spacer></v-spacer> |
85 | </v-card-actions> | 85 | </v-card-actions> |
86 | </v-flex> | 86 | </v-flex> |
87 | </v-layout> | 87 | </v-layout> |
88 | </v-container> | 88 | </v-container> |
89 | </v-card> | 89 | </v-card> |
90 | </v-dialog> | 90 | </v-dialog> |
91 | <!-- ****** PROFILE VIEW EVENT ****** --> | 91 | <!-- ****** PROFILE VIEW EVENT ****** --> |
92 | <v-dialog v-model="viewEventdialog" max-width="500px"> | 92 | <v-dialog v-model="viewEventdialog" max-width="500px"> |
93 | <v-card flat class="card-style pa-3" dark> | 93 | <v-card flat class="card-style pa-3" dark> |
94 | <v-layout> | 94 | <v-layout> |
95 | <v-flex xs12> | 95 | <v-flex xs12> |
96 | <label class="title text-xs-center">View Event</label> | 96 | <label class="title text-xs-center">View Event</label> |
97 | <v-icon size="24" class="right" @click="viewEventdialog = false">cancel</v-icon> | 97 | <v-icon size="24" class="right" @click="viewEventdialog = false">cancel</v-icon> |
98 | </v-flex> | 98 | </v-flex> |
99 | </v-layout> | 99 | </v-layout> |
100 | <v-card-text> | 100 | <v-card-text> |
101 | <v-container grid-list-md> | 101 | <v-container grid-list-md> |
102 | <v-layout wrap> | 102 | <v-layout wrap> |
103 | <v-flex> | 103 | <v-flex> |
104 | <v-layout> | 104 | <v-layout> |
105 | <v-flex xs5 sm6> | 105 | <v-flex xs5 sm6> |
106 | <h5 class="right my-1"> | 106 | <h5 class="right my-1"> |
107 | <b>Title:</b> | 107 | <b>Title:</b> |
108 | </h5> | 108 | </h5> |
109 | </v-flex> | 109 | </v-flex> |
110 | <v-flex sm6 xs8> | 110 | <v-flex sm6 xs8> |
111 | <h5 class="my-1">{{ editedItem.title }}</h5> | 111 | <h5 class="my-1">{{ editedItem.title }}</h5> |
112 | </v-flex> | 112 | </v-flex> |
113 | </v-layout> | 113 | </v-layout> |
114 | <v-layout> | 114 | <v-layout> |
115 | <v-flex xs5 sm6> | 115 | <v-flex xs5 sm6> |
116 | <h5 class="right my-1"> | 116 | <h5 class="right my-1"> |
117 | <b>Date:</b> | 117 | <b>Date:</b> |
118 | </h5> | 118 | </h5> |
119 | </v-flex> | 119 | </v-flex> |
120 | <v-flex sm6 xs8> | 120 | <v-flex sm6 xs8> |
121 | <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5> | 121 | <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5> |
122 | </v-flex> | 122 | </v-flex> |
123 | </v-layout> | 123 | </v-layout> |
124 | <v-layout> | 124 | <v-layout> |
125 | <v-flex xs5 sm6> | 125 | <v-flex xs5 sm6> |
126 | <h5 class="right my-1"> | 126 | <h5 class="right my-1"> |
127 | <b>Description:</b> | 127 | <b>Description:</b> |
128 | </h5> | 128 | </h5> |
129 | </v-flex> | 129 | </v-flex> |
130 | <v-flex sm6 xs8> | 130 | <v-flex sm6 xs8> |
131 | <h5 class="my-1">{{ editedItem.description }}</h5> | 131 | <h5 class="my-1">{{ editedItem.description }}</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 | 140 | ||
141 | <!-- ****** EVENT TABLE ****** --> | 141 | <!-- ****** EVENT TABLE ****** --> |
142 | 142 | ||
143 | <v-toolbar color="transparent" flat> | 143 | <v-toolbar color="transparent" flat> |
144 | <v-btn | 144 | <v-btn |
145 | fab | 145 | fab |
146 | dark | 146 | dark |
147 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 147 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
148 | small | 148 | small |
149 | @click="addEventDialog = true" | 149 | @click="addEventDialog = true" |
150 | > | 150 | > |
151 | <v-icon dark>add</v-icon> | 151 | <v-icon dark>add</v-icon> |
152 | </v-btn> | 152 | </v-btn> |
153 | <v-btn | 153 | <v-btn |
154 | round | 154 | round |
155 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 155 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
156 | dark | 156 | dark |
157 | @click="addEventDialog = true" | 157 | @click="addEventDialog = true" |
158 | > | 158 | > |
159 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Event | 159 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Event |
160 | </v-btn> | 160 | </v-btn> |
161 | <v-spacer></v-spacer> | 161 | <v-spacer></v-spacer> |
162 | <v-card-title class="body-1" v-show="show"> | 162 | <v-card-title class="body-1" v-show="show"> |
163 | <v-btn icon large flat @click="displaySearch"> | 163 | <v-btn icon large flat @click="displaySearch"> |
164 | <v-avatar size="27"> | 164 | <v-avatar size="27"> |
165 | <img src="/static/icon/search.png" alt="icon" /> | 165 | <img src="/static/icon/search.png" alt="icon" /> |
166 | </v-avatar> | 166 | </v-avatar> |
167 | </v-btn> | 167 | </v-btn> |
168 | </v-card-title> | 168 | </v-card-title> |
169 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 169 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
170 | <v-layout> | 170 | <v-layout> |
171 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 171 | <v-text-field |
172 | autofocus | ||
173 | v-model="search" | ||
174 | label="Search" | ||
175 | prepend-inner-icon="search" | ||
176 | color="primary" | ||
177 | ></v-text-field> | ||
172 | <v-icon @click="closeSearch" color="error">close</v-icon> | 178 | <v-icon @click="closeSearch" color="error">close</v-icon> |
173 | </v-layout> | 179 | </v-layout> |
174 | </v-flex> | 180 | </v-flex> |
175 | </v-toolbar> | 181 | </v-toolbar> |
176 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> | 182 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> |
177 | <template slot="items" slot-scope="props"> | 183 | <template slot="items" slot-scope="props"> |
178 | <tr class="tr"> | 184 | <tr class="tr"> |
179 | <td class="td td-row">{{ props.index + 1}}</td> | 185 | <td class="td td-row">{{ props.index + 1}}</td> |
180 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> | 186 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> |
181 | <td class="td td-row text-xs-center">{{ dates(props.item.dateOfEvent)}}</td> | 187 | <td class="td td-row text-xs-center">{{ dates(props.item.dateOfEvent)}}</td> |
182 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> | 188 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> |
183 | <td class="td td-row text-xs-center"> | 189 | <td class="td td-row text-xs-center"> |
184 | <span> | 190 | <span> |
185 | <v-tooltip top> | 191 | <v-tooltip top> |
186 | <img | 192 | <img |
187 | slot="activator" | 193 | slot="activator" |
188 | style="cursor:pointer; width:25px; height:25px; " | 194 | style="cursor:pointer; width:25px; height:25px; " |
189 | class="mr-3" | 195 | class="mr-3" |
190 | @click="profile(props.item)" | 196 | @click="profile(props.item)" |
191 | src="/static/icon/view.png" | 197 | src="/static/icon/view.png" |
192 | /> | 198 | /> |
193 | <span>View</span> | 199 | <span>View</span> |
194 | </v-tooltip> | 200 | </v-tooltip> |
195 | <v-tooltip top> | 201 | <v-tooltip top> |
196 | <img | 202 | <img |
197 | slot="activator" | 203 | slot="activator" |
198 | style="cursor:pointer; width:20px; height:18px; " | 204 | style="cursor:pointer; width:20px; height:18px; " |
199 | class="mr-3" | 205 | class="mr-3" |
200 | @click="editItem(props.item)" | 206 | @click="editItem(props.item)" |
201 | src="/static/icon/edit.png" | 207 | src="/static/icon/edit.png" |
202 | /> | 208 | /> |
203 | <span>Edit</span> | 209 | <span>Edit</span> |
204 | </v-tooltip> | 210 | </v-tooltip> |
205 | <v-tooltip top> | 211 | <v-tooltip top> |
206 | <img | 212 | <img |
207 | slot="activator" | 213 | slot="activator" |
208 | style="cursor:pointer; width:20px; height:20px; " | 214 | style="cursor:pointer; width:20px; height:20px; " |
209 | class="mr-3" | 215 | class="mr-3" |
210 | @click="deleteItem(props.item)" | 216 | @click="deleteItem(props.item)" |
211 | src="/static/icon/delete.png" | 217 | src="/static/icon/delete.png" |
212 | /> | 218 | /> |
213 | <span>Delete</span> | 219 | <span>Delete</span> |
214 | </v-tooltip> | 220 | </v-tooltip> |
215 | </span> | 221 | </span> |
216 | </td> | 222 | </td> |
217 | </tr> | 223 | </tr> |
218 | </template> | 224 | </template> |
219 | <v-alert | 225 | <v-alert |
220 | slot="no-results" | 226 | slot="no-results" |
221 | :value="true" | 227 | :value="true" |
222 | color="error" | 228 | color="error" |
223 | icon="warning" | 229 | icon="warning" |
224 | >Your search for "{{ search }}" found no results.</v-alert> | 230 | >Your search for "{{ search }}" found no results.</v-alert> |
225 | </v-data-table> | 231 | </v-data-table> |
226 | <!-- ****** ADD MULTIPLE EVENT ****** --> | 232 | <!-- ****** ADD MULTIPLE EVENT ****** --> |
227 | <v-dialog v-model="addEventDialog" max-width="500px"> | 233 | <v-dialog v-model="addEventDialog" max-width="500px" v-if="addEventDialog"> |
228 | <v-card flat class="card-style pa-2" dark> | 234 | <v-card flat class="card-style pa-2" dark> |
229 | <v-layout> | 235 | <v-layout> |
230 | <v-flex xs12> | 236 | <v-flex xs12> |
231 | <label class="title text-xs-center">Add Event</label> | 237 | <label class="title text-xs-center">Add Event</label> |
232 | <v-icon size="24" class="right" @click="addEventDialog = false">cancel</v-icon> | 238 | <v-icon size="24" class="right" @click="closeAddEventModel">cancel</v-icon> |
233 | </v-flex> | 239 | </v-flex> |
234 | </v-layout> | 240 | </v-layout> |
235 | <v-form ref="form" v-model="valid" lazy-validation> | 241 | <v-form ref="form" v-model="valid" lazy-validation> |
236 | <v-container fluid> | 242 | <v-container fluid> |
237 | <v-flex xs12> | 243 | <v-flex xs12> |
238 | <v-layout> | 244 | <v-layout> |
239 | <v-flex xs4 class="pt-4 subheading"> | 245 | <v-flex xs4 class="pt-4 subheading"> |
240 | <label class="right">Title:</label> | 246 | <label class="right">Title:</label> |
241 | </v-flex> | 247 | </v-flex> |
242 | <v-flex xs8 sm8 class="ml-3"> | 248 | <v-flex xs8 sm8 class="ml-3"> |
243 | <v-text-field | 249 | <v-text-field |
244 | v-model="addEvent.title" | 250 | v-model="addEvent.title" |
245 | placeholder="fill your Title" | 251 | placeholder="fill your Title" |
246 | type="text" | 252 | type="text" |
247 | :rules="titleRules" | 253 | :rules="titleRules" |
248 | required | 254 | required |
249 | ></v-text-field> | 255 | ></v-text-field> |
250 | </v-flex> | 256 | </v-flex> |
251 | </v-layout> | 257 | </v-layout> |
252 | </v-flex> | 258 | </v-flex> |
253 | <v-flex xs12> | 259 | <v-flex xs12> |
254 | <v-layout> | 260 | <v-layout> |
255 | <v-flex xs4 class="pt-4 subheading"> | 261 | <v-flex xs4 class="pt-4 subheading"> |
256 | <label class="right">Date:</label> | 262 | <label class="right">Date:</label> |
257 | </v-flex> | 263 | </v-flex> |
258 | <v-flex xs8 sm8 class="ml-3"> | 264 | <v-flex xs8 sm8 class="ml-3"> |
259 | <v-menu | 265 | <v-menu |
260 | ref="menu1" | 266 | ref="menu1" |
261 | :close-on-content-click="false" | 267 | :close-on-content-click="false" |
262 | v-model="menu1" | 268 | v-model="menu1" |
263 | :nudge-right="40" | 269 | :nudge-right="40" |
264 | :return-value.sync="addEvent.dateOfEvent" | 270 | :return-value.sync="addEvent.dateOfEvent" |
265 | app | 271 | app |
266 | lazy | 272 | lazy |
267 | transition="scale-transition" | 273 | transition="scale-transition" |
268 | offset-y | 274 | offset-y |
269 | full-width | 275 | full-width |
270 | min-width="290px" | 276 | min-width="290px" |
271 | > | 277 | > |
272 | <v-text-field | 278 | <v-text-field |
273 | slot="activator" | 279 | slot="activator" |
274 | :rules="dateRules" | 280 | :rules="dateRules" |
275 | v-model="addEvent.dateOfEvent" | 281 | v-model="addEvent.dateOfEvent" |
276 | append-icon="event" | 282 | append-icon="event" |
277 | placeholder="Select date" | 283 | placeholder="Select date" |
278 | ></v-text-field> | 284 | ></v-text-field> |
279 | <v-date-picker | 285 | <v-date-picker |
280 | color="info" | 286 | color="info" |
281 | v-model="addEvent.dateOfEvent" | 287 | v-model="addEvent.dateOfEvent" |
282 | @input="$refs.menu1.save(addEvent.dateOfEvent)" | 288 | @input="$refs.menu1.save(addEvent.dateOfEvent)" |
283 | ></v-date-picker> | 289 | ></v-date-picker> |
284 | </v-menu> | 290 | </v-menu> |
285 | </v-flex> | 291 | </v-flex> |
286 | </v-layout> | 292 | </v-layout> |
287 | </v-flex> | 293 | </v-flex> |
288 | <v-flex xs12> | 294 | <v-flex xs12> |
289 | <v-layout> | 295 | <v-layout> |
290 | <v-flex xs4 class="pt-4 subheading"> | 296 | <v-flex xs4 class="pt-4 subheading"> |
291 | <label class="right">Description:</label> | 297 | <label class="right">Description:</label> |
292 | </v-flex> | 298 | </v-flex> |
293 | <v-flex xs8 sm8 class="ml-3"> | 299 | <v-flex xs8 sm8 class="ml-3"> |
294 | <v-text-field | 300 | <v-text-field |
295 | placeholder="fill your Description" | 301 | placeholder="fill your Description" |
296 | :rules="descriptionRules" | 302 | :rules="descriptionRules" |
297 | v-model="addEvent.description" | 303 | v-model="addEvent.description" |
298 | type="text" | 304 | type="text" |
299 | required | 305 | required |
300 | ></v-text-field> | 306 | ></v-text-field> |
301 | </v-flex> | 307 | </v-flex> |
302 | </v-layout> | 308 | </v-layout> |
303 | </v-flex> | 309 | </v-flex> |
304 | <v-layout> | 310 | <v-layout> |
305 | <v-flex xs12> | 311 | <v-flex xs12> |
306 | <v-layout class="right"> | 312 | <v-layout class="right"> |
307 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 313 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
308 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 314 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
309 | </v-layout> | 315 | </v-layout> |
310 | </v-flex> | 316 | </v-flex> |
311 | </v-layout> | 317 | </v-layout> |
312 | </v-container> | 318 | </v-container> |
313 | </v-form> | 319 | </v-form> |
314 | </v-card> | 320 | </v-card> |
315 | </v-dialog> | 321 | </v-dialog> |
316 | <v-snackbar | 322 | <v-snackbar |
317 | :timeout="timeout" | 323 | :timeout="timeout" |
318 | :top="y === 'top'" | 324 | :top="y === 'top'" |
319 | :right="x === 'right'" | 325 | :right="x === 'right'" |
320 | :vertical="mode === 'vertical'" | 326 | :vertical="mode === 'vertical'" |
321 | v-model="snackbar" | 327 | v-model="snackbar" |
322 | :color="color" | 328 | :color="color" |
323 | >{{ text }}</v-snackbar> | 329 | >{{ text }}</v-snackbar> |
324 | <div class="loader" v-if="showLoader"> | 330 | <div class="loader" v-if="showLoader"> |
325 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 331 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
326 | </div> | 332 | </div> |
327 | </v-container> | 333 | </v-container> |
328 | </template> | 334 | </template> |
329 | 335 | ||
330 | <script> | 336 | <script> |
331 | import http from "@/Services/http.js"; | 337 | import http from "@/Services/http.js"; |
332 | import moment from "moment"; | 338 | import moment from "moment"; |
333 | 339 | ||
334 | export default { | 340 | export default { |
335 | data: () => ({ | 341 | data: () => ({ |
336 | snackbar: false, | 342 | snackbar: false, |
337 | y: "top", | 343 | y: "top", |
338 | x: "right", | 344 | x: "right", |
339 | mode: "", | 345 | mode: "", |
340 | timeout: 5000, | 346 | timeout: 5000, |
341 | text: "", | 347 | text: "", |
342 | color: "", | 348 | color: "", |
343 | loading: false, | 349 | loading: false, |
344 | date: null, | 350 | date: null, |
345 | search: "", | 351 | search: "", |
346 | color: "", | 352 | color: "", |
347 | show: true, | 353 | show: true, |
348 | addEventDialog: false, | 354 | addEventDialog: false, |
349 | showSearch: false, | 355 | showSearch: false, |
350 | showLoader: false, | 356 | showLoader: false, |
351 | editEventdialog: false, | 357 | editEventdialog: false, |
352 | viewEventdialog: false, | 358 | viewEventdialog: false, |
353 | valid: true, | 359 | valid: true, |
354 | pagination: { | 360 | pagination: { |
355 | rowsPerPage: 10 | 361 | rowsPerPage: 10, |
356 | }, | 362 | }, |
357 | date: null, | 363 | date: null, |
358 | menu1: false, | 364 | menu1: false, |
359 | menu: false, | 365 | menu: false, |
360 | titleRules: [v => !!v || " Tilte is required"], | 366 | titleRules: [(v) => !!v || " Tilte is required"], |
361 | descriptionRules: [v => !!v || " Discription is required"], | 367 | descriptionRules: [(v) => !!v || " Discription is required"], |
362 | dateRules: [v => !!v || "Date is required"], | 368 | dateRules: [(v) => !!v || "Date is required"], |
363 | headers: [ | 369 | headers: [ |
364 | { | 370 | { |
365 | text: "No", | 371 | text: "No", |
366 | align: "", | 372 | align: "", |
367 | sortable: false, | 373 | sortable: false, |
368 | value: "No" | 374 | value: "No", |
369 | }, | 375 | }, |
370 | { text: "Title", value: "title", sortable: false, align: "center" }, | 376 | { text: "Title", value: "title", sortable: false, align: "center" }, |
371 | { text: "Date", value: "date", sortable: false, align: "center" }, | 377 | { text: "Date", value: "date", sortable: false, align: "center" }, |
372 | 378 | ||
373 | { | 379 | { |
374 | text: "Description", | 380 | text: "Description", |
375 | value: "description", | 381 | value: "description", |
376 | sortable: false, | 382 | sortable: false, |
377 | align: "center" | 383 | align: "center", |
378 | }, | 384 | }, |
379 | { text: "Action", value: "", sortable: false, align: "center" } | 385 | { text: "Action", value: "", sortable: false, align: "center" }, |
380 | ], | 386 | ], |
381 | events: [], | 387 | events: [], |
382 | editedIndex: -1, | 388 | editedIndex: -1, |
383 | addEvent: {}, | 389 | addEvent: {}, |
384 | editedItem: {} | 390 | editedItem: {}, |
385 | }), | 391 | }), |
392 | watch: { | ||
393 | addEventDialog: function (val) { | ||
394 | if (!val) { | ||
395 | this.addEvent = []; | ||
396 | this.menu1 = false; | ||
397 | } | ||
398 | }, | ||
399 | }, | ||
386 | methods: { | 400 | methods: { |
387 | dates: function(date) { | 401 | dates: function (date) { |
388 | return moment(date).format("MMMM DD, YYYY"); | 402 | return moment(date).format("MMMM DD, YYYY"); |
389 | }, | 403 | }, |
390 | getEvents() { | 404 | getEvents() { |
391 | this.showLoader = true; | 405 | this.showLoader = true; |
392 | var token = this.$store.state.token; | 406 | var token = this.$store.state.token; |
393 | http() | 407 | http() |
394 | .get("/getSchoolEventsList", { | 408 | .get("/getSchoolEventsList", { |
395 | headers: { Authorization: "Bearer " + token } | 409 | headers: { Authorization: "Bearer " + token }, |
396 | }) | 410 | }) |
397 | .then(response => { | 411 | .then((response) => { |
398 | this.events = response.data.data; | 412 | this.events = response.data.data; |
399 | this.showLoader = false; | 413 | this.showLoader = false; |
400 | }) | 414 | }) |
401 | .catch(error => { | 415 | .catch((error) => { |
402 | // console.log("err====>", err); | 416 | // console.log("err====>", err); |
403 | this.showLoader = false; | 417 | this.showLoader = false; |
404 | if (error.response.status === 401) { | 418 | if (error.response.status === 401) { |
405 | this.$router.replace({ path: "/" }); | 419 | this.$router.replace({ path: "/" }); |
406 | this.$store.dispatch("setToken", null); | 420 | this.$store.dispatch("setToken", null); |
407 | this.$store.dispatch("Id", null); | 421 | this.$store.dispatch("Id", null); |
408 | } | 422 | } |
409 | }); | 423 | }); |
410 | }, | 424 | }, |
411 | editItem(item) { | 425 | editItem(item) { |
412 | this.editedIndex = this.events.indexOf(item); | 426 | this.editedIndex = this.events.indexOf(item); |
413 | this.editedItem = Object.assign({}, item); | 427 | this.editedItem = Object.assign({}, item); |
414 | this.editedItem.schoolEventId = item._id; | 428 | this.editedItem.schoolEventId = item._id; |
415 | this.editEventdialog = true; | 429 | this.editEventdialog = true; |
416 | }, | 430 | }, |
417 | profile(item) { | 431 | profile(item) { |
418 | this.editedIndex = this.events.indexOf(item); | 432 | this.editedIndex = this.events.indexOf(item); |
419 | this.editedItem = Object.assign({}, item); | 433 | this.editedItem = Object.assign({}, item); |
420 | this.viewEventdialog = true; | 434 | this.viewEventdialog = true; |
421 | }, | 435 | }, |
422 | 436 | ||
423 | deleteItem(item) { | 437 | deleteItem(item) { |
424 | let deleteEvent = { | 438 | let deleteEvent = { |
425 | schoolEventId: item._id | 439 | schoolEventId: item._id, |
426 | }; | 440 | }; |
427 | http() | 441 | http() |
428 | .delete( | 442 | .delete( |
429 | "/deleteSchoolEvent", | 443 | "/deleteSchoolEvent", |
430 | confirm("Are you sure you want to delete this?") && { | 444 | confirm("Are you sure you want to delete this?") && { |
431 | params: deleteEvent | 445 | params: deleteEvent, |
432 | } | 446 | } |
433 | ) | 447 | ) |
434 | .then(response => { | 448 | .then((response) => { |
435 | this.snackbar = true; | 449 | this.snackbar = true; |
436 | this.text = response.data.message; | 450 | this.text = response.data.message; |
437 | this.getEvents(); | 451 | this.getEvents(); |
438 | this.snackbar = true; | 452 | this.snackbar = true; |
439 | this.color = "green"; | 453 | this.color = "green"; |
440 | this.text = response.data.message; | 454 | this.text = response.data.message; |
441 | }) | 455 | }) |
442 | .catch(error => { | 456 | .catch((error) => { |
443 | this.snackbar = true; | 457 | this.snackbar = true; |
444 | this.text = error.response.data.message; | 458 | this.text = error.response.data.message; |
445 | this.color = "error"; | 459 | this.color = "error"; |
446 | this.loading = false; | 460 | this.loading = false; |
447 | }); | 461 | }); |
448 | }, | 462 | }, |
449 | close() { | 463 | close() { |
450 | this.editEventdialog = false; | 464 | this.editEventdialog = false; |
451 | }, | 465 | }, |
466 | closeAddEventModel() { | ||
467 | this.addEventDialog = false; | ||
468 | this.addEvent = []; | ||
469 | this.menu1 = false; | ||
470 | }, | ||
452 | submit() { | 471 | submit() { |
453 | if (this.$refs.form.validate()) { | 472 | if (this.$refs.form.validate()) { |
454 | this.loading = true; | 473 | this.loading = true; |
455 | http() | 474 | http() |
456 | .post("/createSchoolEvent", this.addEvent) | 475 | .post("/createSchoolEvent", this.addEvent) |
457 | .then(response => { | 476 | .then((response) => { |
458 | this.snackbar = true; | 477 | this.snackbar = true; |
459 | this.text = response.data.message; | 478 | this.text = response.data.message; |
460 | this.color = "green"; | 479 | this.color = "green"; |
461 | this.getEvents(); | 480 | this.getEvents(); |
462 | this.clear(); | 481 | this.clear(); |
463 | this.loading = false; | 482 | this.loading = false; |
464 | this.addEventDialog = false; | 483 | this.addEventDialog = false; |
465 | }) | 484 | }) |
466 | .catch(error => { | 485 | .catch((error) => { |
467 | this.snackbar = true; | 486 | this.snackbar = true; |
468 | this.text = error.response.data.message; | 487 | this.text = error.response.data.message; |
469 | this.color = "error"; | 488 | this.color = "error"; |
470 | this.loading = false; | 489 | this.loading = false; |
471 | }); | 490 | }); |
472 | } | 491 | } |
473 | }, | 492 | }, |
474 | clear() { | 493 | clear() { |
475 | this.$refs.form.reset(); | 494 | this.$refs.form.reset(); |
476 | }, | 495 | }, |
477 | save() { | 496 | save() { |
478 | http() | 497 | http() |
479 | .put("/updateSchoolEvent", this.editedItem) | 498 | .put("/updateSchoolEvent", this.editedItem) |
480 | .then(response => { | 499 | .then((response) => { |
481 | this.snackbar = true; | 500 | this.snackbar = true; |
482 | this.text = response.data.message; | 501 | this.text = response.data.message; |
483 | this.color = "green"; | 502 | this.color = "green"; |
484 | this.getEvents(); | 503 | this.getEvents(); |
485 | this.close(); | 504 | this.close(); |
486 | }) | 505 | }) |
487 | .catch(error => { | 506 | .catch((error) => { |
488 | this.snackbar = true; | 507 | this.snackbar = true; |
489 | this.text = error.response.data.message; | 508 | this.text = error.response.data.message; |
490 | this.color = "error"; | 509 | this.color = "error"; |
491 | }); | 510 | }); |
492 | }, | 511 | }, |
493 | displaySearch() { | 512 | displaySearch() { |
494 | (this.show = false), (this.showSearch = true); | 513 | (this.show = false), (this.showSearch = true); |
495 | }, | 514 | }, |
496 | closeSearch() { | 515 | closeSearch() { |
497 | this.showSearch = false; | 516 | this.showSearch = false; |
498 | this.show = true; | 517 | this.show = true; |
499 | this.search = ""; | 518 | this.search = ""; |
500 | } | 519 | }, |
501 | }, | 520 | }, |
502 | mounted() { | 521 | mounted() { |
503 | this.getEvents(); | 522 | this.getEvents(); |
504 | } | 523 | }, |
505 | }; | 524 | }; |
506 | </script> | 525 | </script> |
src/pages/Exam/exam.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT EXAM ****** --> | 3 | <!-- ****** EDIT EXAM ****** --> |
4 | <v-dialog v-model="editExamDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editExamDialog" max-width="600px" 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</label> | 8 | <label class="title text-xs-center">Edit Exam</label> |
9 | <v-icon size="24" class="right" @click="editExamDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editExamDialog = 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-text-field | 22 | <v-text-field |
23 | placeholder="fill your Serial Number" | 23 | placeholder="fill your Serial Number" |
24 | v-model="editedItem.examName" | 24 | v-model="editedItem.examName" |
25 | type="text" | 25 | type="text" |
26 | ></v-text-field> | 26 | ></v-text-field> |
27 | </v-flex> | 27 | </v-flex> |
28 | </v-layout> | 28 | </v-layout> |
29 | </v-flex> | 29 | </v-flex> |
30 | <v-flex xs12 sm12> | 30 | <v-flex xs12 sm12> |
31 | <v-layout> | 31 | <v-layout> |
32 | <v-flex xs4 class="pt-4 subheading"> | 32 | <v-flex xs4 class="pt-4 subheading"> |
33 | <label class="right">Date:</label> | 33 | <label class="right">Date:</label> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs7 class="ml-3"> | 35 | <v-flex xs7 class="ml-3"> |
36 | <v-menu | 36 | <v-menu |
37 | ref="menu1" | 37 | ref="menu1" |
38 | :close-on-content-click="false" | 38 | :close-on-content-click="false" |
39 | v-model="menu1" | 39 | v-model="menu1" |
40 | :nudge-right="40" | 40 | :nudge-right="40" |
41 | :return-value.sync="menu1" | 41 | :return-value.sync="menu1" |
42 | lazy | 42 | lazy |
43 | transition="scale-transition" | 43 | transition="scale-transition" |
44 | offset-y | 44 | offset-y |
45 | full-width | 45 | full-width |
46 | min-width="290px" | 46 | min-width="290px" |
47 | > | 47 | > |
48 | <v-text-field | 48 | <v-text-field |
49 | slot="activator" | 49 | slot="activator" |
50 | v-model="editedItem.date" | 50 | v-model="editedItem.date" |
51 | label="Select Date" | 51 | label="Select Date" |
52 | append-icon="event" | 52 | append-icon="event" |
53 | readonly | 53 | readonly |
54 | ></v-text-field> | 54 | ></v-text-field> |
55 | <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker> | 55 | <v-date-picker v-model="editedItem.date" @input="menu1 = false"></v-date-picker> |
56 | </v-menu> | 56 | </v-menu> |
57 | </v-flex> | 57 | </v-flex> |
58 | </v-layout> | 58 | </v-layout> |
59 | </v-flex> | 59 | </v-flex> |
60 | <v-flex xs12 sm12> | 60 | <v-flex xs12 sm12> |
61 | <v-layout> | 61 | <v-layout> |
62 | <v-flex xs4 class="pt-4 subheading"> | 62 | <v-flex xs4 class="pt-4 subheading"> |
63 | <label class="right">Note:</label> | 63 | <label class="right">Note:</label> |
64 | </v-flex> | 64 | </v-flex> |
65 | <v-flex xs7 class="ml-3"> | 65 | <v-flex xs7 class="ml-3"> |
66 | <v-text-field | 66 | <v-text-field |
67 | placeholder="fill your Serial Number" | 67 | placeholder="fill your Serial Number" |
68 | v-model="editedItem.note" | 68 | v-model="editedItem.note" |
69 | type="text" | 69 | type="text" |
70 | ></v-text-field> | 70 | ></v-text-field> |
71 | </v-flex> | 71 | </v-flex> |
72 | </v-layout> | 72 | </v-layout> |
73 | </v-flex> | 73 | </v-flex> |
74 | </v-layout> | 74 | </v-layout> |
75 | <v-layout> | 75 | <v-layout> |
76 | <v-flex xs12> | 76 | <v-flex xs12> |
77 | <v-card-actions> | 77 | <v-card-actions> |
78 | <v-spacer></v-spacer> | 78 | <v-spacer></v-spacer> |
79 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 79 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
80 | </v-card-actions> | 80 | </v-card-actions> |
81 | </v-flex> | 81 | </v-flex> |
82 | </v-layout> | 82 | </v-layout> |
83 | </v-container> | 83 | </v-container> |
84 | </v-form> | 84 | </v-form> |
85 | </v-card-text> | 85 | </v-card-text> |
86 | </v-card> | 86 | </v-card> |
87 | </v-dialog> | 87 | </v-dialog> |
88 | 88 | ||
89 | <!-- ****** PROFILE VIEW PARTICULAR EXAM ****** --> | 89 | <!-- ****** PROFILE VIEW PARTICULAR EXAM ****** --> |
90 | 90 | ||
91 | <v-dialog v-model="profileExamDialog" max-width="500px"> | 91 | <v-dialog v-model="profileExamDialog" max-width="500px"> |
92 | <v-card flat class="card-style pa-3" dark> | 92 | <v-card flat class="card-style pa-3" dark> |
93 | <v-layout> | 93 | <v-layout> |
94 | <v-flex xs12> | 94 | <v-flex xs12> |
95 | <label class="title text-xs-center">View Exam</label> | 95 | <label class="title text-xs-center">View Exam</label> |
96 | <v-icon size="24" class="right" @click="profileExamDialog = false">cancel</v-icon> | 96 | <v-icon size="24" class="right" @click="profileExamDialog = false">cancel</v-icon> |
97 | </v-flex> | 97 | </v-flex> |
98 | </v-layout> | 98 | </v-layout> |
99 | <v-card-text> | 99 | <v-card-text> |
100 | <v-container grid-list-md> | 100 | <v-container grid-list-md> |
101 | <v-layout wrap> | 101 | <v-layout wrap> |
102 | <v-flex> | 102 | <v-flex> |
103 | <v-layout> | 103 | <v-layout> |
104 | <v-flex xs6 sm4> | 104 | <v-flex xs6 sm4> |
105 | <h5 class="right my-1"> | 105 | <h5 class="right my-1"> |
106 | <b>Exam Name:</b> | 106 | <b>Exam Name:</b> |
107 | </h5> | 107 | </h5> |
108 | </v-flex> | 108 | </v-flex> |
109 | <v-flex sm8 xs6> | 109 | <v-flex sm8 xs6> |
110 | <h5 class="my-1">{{ editedItem.examName }}</h5> | 110 | <h5 class="my-1">{{ editedItem.examName }}</h5> |
111 | </v-flex> | 111 | </v-flex> |
112 | </v-layout> | 112 | </v-layout> |
113 | <v-layout> | 113 | <v-layout> |
114 | <v-flex xs6 sm4> | 114 | <v-flex xs6 sm4> |
115 | <h5 class="right my-1"> | 115 | <h5 class="right my-1"> |
116 | <b>Date:</b> | 116 | <b>Date:</b> |
117 | </h5> | 117 | </h5> |
118 | </v-flex> | 118 | </v-flex> |
119 | <v-flex sm8 xs6> | 119 | <v-flex sm8 xs6> |
120 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> | 120 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> |
121 | </v-flex> | 121 | </v-flex> |
122 | </v-layout> | 122 | </v-layout> |
123 | <v-layout> | 123 | <v-layout> |
124 | <v-flex xs6 sm4> | 124 | <v-flex xs6 sm4> |
125 | <h5 class="right my-1"> | 125 | <h5 class="right my-1"> |
126 | <b>Note:</b> | 126 | <b>Note:</b> |
127 | </h5> | 127 | </h5> |
128 | </v-flex> | 128 | </v-flex> |
129 | <v-flex sm8 xs6> | 129 | <v-flex sm8 xs6> |
130 | <h5 class="my-1">{{ editedItem.note }}</h5> | 130 | <h5 class="my-1">{{ editedItem.note }}</h5> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | </v-flex> | 133 | </v-flex> |
134 | </v-layout> | 134 | </v-layout> |
135 | </v-container> | 135 | </v-container> |
136 | </v-card-text> | 136 | </v-card-text> |
137 | </v-card> | 137 | </v-card> |
138 | </v-dialog> | 138 | </v-dialog> |
139 | <!-- ****** EXAM TABLE****** --> | 139 | <!-- ****** EXAM TABLE****** --> |
140 | 140 | ||
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="addExamDialog = true" | 147 | @click="addExamDialog = 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="addExamDialog = true" | 155 | @click="addExamDialog = true" |
156 | > | 156 | > |
157 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam | 157 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam |
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 sm8 md3 lg2 v-if="showSearch"> | 167 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
168 | <v-layout> | 168 | <v-layout> |
169 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 169 | <v-text-field |
170 | autofocus | ||
171 | v-model="search" | ||
172 | label="Search" | ||
173 | prepend-inner-icon="search" | ||
174 | color="primary" | ||
175 | ></v-text-field> | ||
170 | <v-icon @click="closeSearch" color="error">close</v-icon> | 176 | <v-icon @click="closeSearch" color="error">close</v-icon> |
171 | </v-layout> | 177 | </v-layout> |
172 | </v-flex> | 178 | </v-flex> |
173 | </v-toolbar> | 179 | </v-toolbar> |
174 | <v-data-table | 180 | <v-data-table |
175 | :headers="headers" | 181 | :headers="headers" |
176 | :items="examData" | 182 | :items="examData" |
177 | :pagination.sync="pagination" | 183 | :pagination.sync="pagination" |
178 | :search="search" | 184 | :search="search" |
179 | > | 185 | > |
180 | <template slot="items" slot-scope="props"> | 186 | <template slot="items" slot-scope="props"> |
181 | <tr class="tr"> | 187 | <tr class="tr"> |
182 | <td class="td td-row">{{ props.index + 1}}</td> | 188 | <td class="td td-row">{{ props.index + 1}}</td> |
183 | <td class="td td-row text-xs-center">{{ props.item.examName}}</td> | 189 | <td class="td td-row text-xs-center">{{ props.item.examName}}</td> |
184 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> | 190 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> |
185 | <td class="td td-row text-xs-center">{{ props.item.note}}</td> | 191 | <td class="td td-row text-xs-center">{{ props.item.note}}</td> |
186 | <td class="td td-row text-xs-center"> | 192 | <td class="td td-row text-xs-center"> |
187 | <span> | 193 | <span> |
188 | <v-tooltip top> | 194 | <v-tooltip top> |
189 | <img | 195 | <img |
190 | slot="activator" | 196 | slot="activator" |
191 | style="cursor:pointer; width:25px; height:25px; " | 197 | style="cursor:pointer; width:25px; height:25px; " |
192 | class="mr-3" | 198 | class="mr-3" |
193 | @click="profile(props.item)" | 199 | @click="profile(props.item)" |
194 | src="/static/icon/view.png" | 200 | src="/static/icon/view.png" |
195 | /> | 201 | /> |
196 | <span>View</span> | 202 | <span>View</span> |
197 | </v-tooltip> | 203 | </v-tooltip> |
198 | <v-tooltip top> | 204 | <v-tooltip top> |
199 | <img | 205 | <img |
200 | slot="activator" | 206 | slot="activator" |
201 | style="cursor:pointer; width:20px; height:18px; " | 207 | style="cursor:pointer; width:20px; height:18px; " |
202 | class="mr-3" | 208 | class="mr-3" |
203 | @click="editItem(props.item)" | 209 | @click="editItem(props.item)" |
204 | src="/static/icon/edit.png" | 210 | src="/static/icon/edit.png" |
205 | /> | 211 | /> |
206 | <span>Edit</span> | 212 | <span>Edit</span> |
207 | </v-tooltip> | 213 | </v-tooltip> |
208 | <v-tooltip top> | 214 | <v-tooltip top> |
209 | <img | 215 | <img |
210 | slot="activator" | 216 | slot="activator" |
211 | style="cursor:pointer; width:20px; height:20px; " | 217 | style="cursor:pointer; width:20px; height:20px; " |
212 | class="mr-3" | 218 | class="mr-3" |
213 | @click="deleteItem(props.item)" | 219 | @click="deleteItem(props.item)" |
214 | src="/static/icon/delete.png" | 220 | src="/static/icon/delete.png" |
215 | /> | 221 | /> |
216 | <span>Delete</span> | 222 | <span>Delete</span> |
217 | </v-tooltip> | 223 | </v-tooltip> |
218 | </span> | 224 | </span> |
219 | </td> | 225 | </td> |
220 | </tr> | 226 | </tr> |
221 | </template> | 227 | </template> |
222 | <v-alert | 228 | <v-alert |
223 | slot="no-results" | 229 | slot="no-results" |
224 | :value="true" | 230 | :value="true" |
225 | color="error" | 231 | color="error" |
226 | icon="warning" | 232 | icon="warning" |
227 | >Your search for "{{ search }}" found no results.</v-alert> | 233 | >Your search for "{{ search }}" found no results.</v-alert> |
228 | </v-data-table> | 234 | </v-data-table> |
229 | 235 | ||
230 | <!-- ****** ADD EXAM ****** --> | 236 | <!-- ****** ADD EXAM ****** --> |
231 | <v-dialog v-model="addExamDialog" max-width="500px"> | 237 | <v-dialog v-model="addExamDialog" max-width="500px" v-if="addExamDialog"> |
232 | <v-card flat class="card-style pa-2" dark> | 238 | <v-card flat class="card-style pa-2" dark> |
233 | <v-layout> | 239 | <v-layout> |
234 | <v-flex xs12> | 240 | <v-flex xs12> |
235 | <label class="title text-xs-center">Add Exam</label> | 241 | <label class="title text-xs-center">Add Exam</label> |
236 | <v-icon size="24" class="right" @click="$refs.form.reset();addExamDialog = false">cancel</v-icon> | 242 | <v-icon size="24" class="right" @click="$refs.form.reset();addExamDialog = false">cancel</v-icon> |
237 | </v-flex> | 243 | </v-flex> |
238 | </v-layout> | 244 | </v-layout> |
239 | <v-form ref="form" v-model="valid" lazy-validation> | 245 | <v-form ref="form" v-model="valid" lazy-validation> |
240 | <v-container fluid> | 246 | <v-container fluid> |
241 | <v-flex xs12> | 247 | <v-flex xs12> |
242 | <v-layout> | 248 | <v-layout> |
243 | <v-flex xs4 class="pt-4 subheading"> | 249 | <v-flex xs4 class="pt-4 subheading"> |
244 | <label class="right hidden-xs-only">Exam Name:</label> | 250 | <label class="right hidden-xs-only">Exam Name:</label> |
245 | <label | 251 | <label |
246 | class="right hidden-sm-only hidden-md-only hidden-lg-only hidden-xl-only" | 252 | class="right hidden-sm-only hidden-md-only hidden-lg-only hidden-xl-only" |
247 | >ExamName:</label> | 253 | >ExamName:</label> |
248 | </v-flex> | 254 | </v-flex> |
249 | <v-flex xs8 sm7 class="ml-3"> | 255 | <v-flex xs8 sm7 class="ml-3"> |
250 | <v-text-field | 256 | <v-text-field |
251 | placeholder="fill your Exam Name" | 257 | placeholder="fill your Exam Name" |
252 | :rules="authorRules" | 258 | :rules="authorRules" |
253 | v-model="addExam.examName" | 259 | v-model="addExam.examName" |
254 | ></v-text-field> | 260 | ></v-text-field> |
255 | </v-flex> | 261 | </v-flex> |
256 | </v-layout> | 262 | </v-layout> |
257 | </v-flex> | 263 | </v-flex> |
258 | <v-flex xs12> | 264 | <v-flex xs12> |
259 | <v-layout> | 265 | <v-layout> |
260 | <v-flex xs4 class="pt-4 subheading"> | 266 | <v-flex xs4 class="pt-4 subheading"> |
261 | <label class="right">Date:</label> | 267 | <label class="right">Date:</label> |
262 | </v-flex> | 268 | </v-flex> |
263 | <v-flex xs8 sm7 class="ml-3"> | 269 | <v-flex xs8 sm7 class="ml-3"> |
264 | <v-menu | 270 | <v-menu |
265 | ref="menu2" | 271 | ref="menu2" |
266 | :close-on-content-click="false" | 272 | :close-on-content-click="false" |
267 | v-model="menu2" | 273 | v-model="menu2" |
268 | :nudge-right="40" | 274 | :nudge-right="40" |
269 | :return-value.sync="addExam.date" | 275 | :return-value.sync="addExam.date" |
270 | lazy | 276 | lazy |
271 | transition="scale-transition" | 277 | transition="scale-transition" |
272 | offset-y | 278 | offset-y |
273 | full-width | 279 | full-width |
274 | min-width="290px" | 280 | min-width="290px" |
275 | > | 281 | > |
276 | <v-text-field | 282 | <v-text-field |
277 | slot="activator" | 283 | slot="activator" |
278 | v-model="addExam.date" | 284 | v-model="addExam.date" |
279 | :rules="examDateRules" | 285 | :rules="examDateRules" |
280 | label="Select Date" | 286 | label="Select Date" |
281 | append-icon="event" | 287 | append-icon="event" |
282 | readonly | 288 | readonly |
283 | ></v-text-field> | 289 | ></v-text-field> |
284 | <v-date-picker v-model="addExam.date" @input="$refs.menu2.save(addExam.date)"></v-date-picker> | 290 | <v-date-picker v-model="addExam.date" @input="$refs.menu2.save(addExam.date)"></v-date-picker> |
285 | </v-menu> | 291 | </v-menu> |
286 | </v-flex> | 292 | </v-flex> |
287 | </v-layout> | 293 | </v-layout> |
288 | </v-flex> | 294 | </v-flex> |
289 | <v-flex xs12> | 295 | <v-flex xs12> |
290 | <v-layout> | 296 | <v-layout> |
291 | <v-flex xs4 class="pt-4 subheading"> | 297 | <v-flex xs4 class="pt-4 subheading"> |
292 | <label class="right">Note:</label> | 298 | <label class="right">Note:</label> |
293 | </v-flex> | 299 | </v-flex> |
294 | <v-flex xs8 sm7 class="ml-3"> | 300 | <v-flex xs8 sm7 class="ml-3"> |
295 | <v-text-field | 301 | <v-text-field placeholder="fill your Note" v-model="addExam.note"></v-text-field> |
296 | placeholder="fill your Note" | ||
297 | v-model="addExam.note" | ||
298 | ></v-text-field> | ||
299 | </v-flex> | 302 | </v-flex> |
300 | </v-layout> | 303 | </v-layout> |
301 | </v-flex> | 304 | </v-flex> |
302 | <v-layout> | 305 | <v-layout> |
303 | <v-flex xs12> | 306 | <v-flex xs12> |
304 | <v-card-actions> | 307 | <v-card-actions> |
305 | <v-spacer class="hidden-xs-only"></v-spacer> | 308 | <v-spacer class="hidden-xs-only"></v-spacer> |
306 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 309 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
307 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 310 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
308 | </v-card-actions> | 311 | </v-card-actions> |
309 | </v-flex> | 312 | </v-flex> |
310 | </v-layout> | 313 | </v-layout> |
311 | </v-container> | 314 | </v-container> |
312 | </v-form> | 315 | </v-form> |
313 | </v-card> | 316 | </v-card> |
314 | </v-dialog> | 317 | </v-dialog> |
315 | <v-snackbar | 318 | <v-snackbar |
316 | :timeout="timeout" | 319 | :timeout="timeout" |
317 | :top="y === 'top'" | 320 | :top="y === 'top'" |
318 | :right="x === 'right'" | 321 | :right="x === 'right'" |
319 | :vertical="mode === 'vertical'" | 322 | :vertical="mode === 'vertical'" |
320 | v-model="snackbar" | 323 | v-model="snackbar" |
321 | :color="color" | 324 | :color="color" |
322 | >{{ text }}</v-snackbar> | 325 | >{{ text }}</v-snackbar> |
323 | <div class="loader" v-if="showLoader"> | 326 | <div class="loader" v-if="showLoader"> |
324 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 327 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
325 | </div> | 328 | </div> |
326 | </v-container> | 329 | </v-container> |
327 | </template> | 330 | </template> |
328 | 331 | ||
329 | <script> | 332 | <script> |
330 | import http from "@/Services/http.js"; | 333 | import http from "@/Services/http.js"; |
331 | import moment from "moment"; | 334 | import moment from "moment"; |
332 | 335 | ||
333 | export default { | 336 | export default { |
334 | data: () => ({ | 337 | data: () => ({ |
335 | snackbar: false, | 338 | snackbar: false, |
336 | date: null, | 339 | date: null, |
337 | menu1: false, | 340 | menu1: false, |
338 | menu2: false, | 341 | menu2: false, |
339 | color: "", | 342 | color: "", |
340 | y: "top", | 343 | y: "top", |
341 | x: "right", | 344 | x: "right", |
342 | mode: "", | 345 | mode: "", |
343 | timeout: 10000, | 346 | timeout: 10000, |
344 | text: "", | 347 | text: "", |
345 | libraryId: "", | 348 | libraryId: "", |
346 | show: true, | 349 | show: true, |
347 | showSearch: false, | 350 | showSearch: false, |
348 | addExamDialog: false, | 351 | addExamDialog: false, |
349 | loading: false, | 352 | loading: false, |
350 | loadingSearch: false, | 353 | loadingSearch: false, |
351 | date: null, | 354 | date: null, |
352 | search: "", | 355 | search: "", |
353 | showLoader: false, | 356 | showLoader: false, |
354 | editExamDialog: false, | 357 | editExamDialog: false, |
355 | profileExamDialog: false, | 358 | profileExamDialog: false, |
356 | valid: true, | 359 | valid: true, |
357 | pagination: { | 360 | pagination: { |
358 | rowsPerPage: 10 | 361 | rowsPerPage: 10, |
359 | }, | 362 | }, |
360 | libraryIDRules: [v => !!v || " Library ID is required"], | 363 | libraryIDRules: [(v) => !!v || " Library ID is required"], |
361 | bookRules: [v => !!v || " book Name is required"], | 364 | bookRules: [(v) => !!v || " book Name is required"], |
362 | authorRules: [v => !!v || "Author Name is required"], | 365 | authorRules: [(v) => !!v || "Author Name is required"], |
363 | subjectCodeRules: [v => !!v || "Subject Code is required"], | 366 | subjectCodeRules: [(v) => !!v || "Subject Code is required"], |
364 | authorRules: [v => !!v || "Author is required"], | 367 | authorRules: [(v) => !!v || "Author is required"], |
365 | examDateRules: [v => !!v || "Date is required"], | 368 | examDateRules: [(v) => !!v || "Date is required"], |
366 | headers: [ | 369 | headers: [ |
367 | { | 370 | { |
368 | align: "", | 371 | align: "", |
369 | text: "No", | 372 | text: "No", |
370 | sortable: false, | 373 | sortable: false, |
371 | value: "No" | 374 | value: "No", |
372 | }, | 375 | }, |
373 | { text: "Exam Name", vaue: "examName", sortable: false, align: "center" }, | 376 | { text: "Exam Name", vaue: "examName", sortable: false, align: "center" }, |
374 | { | 377 | { |
375 | text: "Date", | 378 | text: "Date", |
376 | value: "date", | 379 | value: "date", |
377 | sortable: false, | 380 | sortable: false, |
378 | align: "center" | 381 | align: "center", |
379 | }, | 382 | }, |
380 | { | 383 | { |
381 | text: "Note", | 384 | text: "Note", |
382 | value: "note", | 385 | value: "note", |
383 | sortable: false, | 386 | sortable: false, |
384 | align: "center" | 387 | align: "center", |
385 | }, | 388 | }, |
386 | { text: "Action", value: "", sortable: false, align: "center" } | 389 | { text: "Action", value: "", sortable: false, align: "center" }, |
387 | ], | 390 | ], |
388 | examData: [], | 391 | examData: [], |
389 | addExam: {}, | 392 | addExam: {}, |
390 | editedItem: {}, | 393 | editedItem: {}, |
391 | token: "" | 394 | token: "", |
392 | }), | 395 | }), |
396 | watch: { | ||
397 | addExamDialog: function (val) { | ||
398 | if (!val) { | ||
399 | this.addExam = []; | ||
400 | } | ||
401 | }, | ||
402 | }, | ||
393 | methods: { | 403 | methods: { |
394 | dates: function(date) { | 404 | dates: function (date) { |
395 | return moment(date).format("MMMM DD, YYYY"); | 405 | return moment(date).format("MMMM DD, YYYY"); |
396 | }, | 406 | }, |
397 | pickFile() { | 407 | pickFile() { |
398 | this.$refs.image.click(); | 408 | this.$refs.image.click(); |
399 | }, | 409 | }, |
400 | getExamList() { | 410 | getExamList() { |
401 | this.showLoader = true; | 411 | this.showLoader = true; |
402 | this.loadingSearch = true; | 412 | this.loadingSearch = true; |
403 | http() | 413 | http() |
404 | .get("/getExamsList", { | 414 | .get("/getExamsList", { |
405 | headers: { Authorization: "Bearer " + this.token } | 415 | headers: { Authorization: "Bearer " + this.token }, |
406 | }) | 416 | }) |
407 | .then(response => { | 417 | .then((response) => { |
408 | this.examData = response.data.data; | 418 | this.examData = response.data.data; |
409 | this.showLoader = false; | 419 | this.showLoader = false; |
410 | this.loadingSearch = false; | 420 | this.loadingSearch = false; |
411 | }) | 421 | }) |
412 | .catch(error => { | 422 | .catch((error) => { |
413 | // console.log("err====>", err); | 423 | // console.log("err====>", err); |
414 | this.showLoader = false; | 424 | this.showLoader = false; |
415 | this.loadingSearch = false; | 425 | this.loadingSearch = false; |
416 | this.snackbar = true; | 426 | this.snackbar = true; |
417 | this.text = error.response.data.message; | 427 | this.text = error.response.data.message; |
418 | if (error.response.status === 401) { | 428 | if (error.response.status === 401) { |
419 | this.$router.replace({ path: "/" }); | 429 | this.$router.replace({ path: "/" }); |
420 | this.$store.dispatch("setToken", null); | 430 | this.$store.dispatch("setToken", null); |
421 | this.$store.dispatch("Id", null); | 431 | this.$store.dispatch("Id", null); |
422 | } | 432 | } |
423 | }); | 433 | }); |
424 | }, | 434 | }, |
425 | editItem(item) { | 435 | editItem(item) { |
426 | this.editedIndex = this.examData.indexOf(item); | 436 | this.editedIndex = this.examData.indexOf(item); |
427 | this.editedItem = Object.assign({}, item); | 437 | this.editedItem = Object.assign({}, item); |
428 | this.editedItem.date = | 438 | this.editedItem.date = |
429 | this.editedItem.date != undefined | 439 | this.editedItem.date != undefined |
430 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 440 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
431 | : (this.editedItem.date = ""); | 441 | : (this.editedItem.date = ""); |
432 | this.editExamDialog = true; | 442 | this.editExamDialog = true; |
433 | }, | 443 | }, |
434 | profile(item) { | 444 | profile(item) { |
435 | this.editedIndex = this.examData.indexOf(item); | 445 | this.editedIndex = this.examData.indexOf(item); |
436 | this.editedItem = Object.assign({}, item); | 446 | this.editedItem = Object.assign({}, item); |
437 | this.profileExamDialog = true; | 447 | this.profileExamDialog = true; |
438 | }, | 448 | }, |
439 | deleteItem(item) { | 449 | deleteItem(item) { |
440 | let Exam = { | 450 | let Exam = { |
441 | examId: item._id | 451 | examId: item._id, |
442 | }; | 452 | }; |
443 | http() | 453 | http() |
444 | .delete( | 454 | .delete( |
445 | "/deleteExam", | 455 | "/deleteExam", |
446 | confirm("Are you sure you want to Delete this?") && { | 456 | confirm("Are you sure you want to Delete this?") && { |
447 | params: Exam | 457 | params: Exam, |
448 | } | 458 | } |
449 | ) | 459 | ) |
450 | .then(response => { | 460 | .then((response) => { |
451 | this.snackbar = true; | 461 | this.snackbar = true; |
452 | this.text = "Successfully Delete Exam "; | 462 | this.text = "Successfully Delete Exam "; |
453 | this.text = response.data.message; | 463 | this.text = response.data.message; |
454 | this.color = "green"; | 464 | this.color = "green"; |
455 | this.getExamList(); | 465 | this.getExamList(); |
456 | }) | 466 | }) |
457 | .catch(error => { | 467 | .catch((error) => { |
458 | this.snackbar = true; | 468 | this.snackbar = true; |
459 | this.text = error.response.data.message; | 469 | this.text = error.response.data.message; |
460 | this.color = "red"; | 470 | this.color = "red"; |
461 | }); | 471 | }); |
462 | }, | 472 | }, |
463 | close() { | 473 | close() { |
464 | this.editExamDialog = false; | 474 | this.editExamDialog = false; |
465 | }, | 475 | }, |
466 | submit() { | 476 | submit() { |
467 | if (this.$refs.form.validate()) { | 477 | if (this.$refs.form.validate()) { |
468 | this.loading = true; | 478 | this.loading = true; |
469 | http() | 479 | http() |
470 | .post("/createExam", this.addExam) | 480 | .post("/createExam", this.addExam) |
471 | .then(response => { | 481 | .then((response) => { |
472 | this.snackbar = true; | 482 | this.snackbar = true; |
473 | this.text = response.data.message; | 483 | this.text = response.data.message; |
474 | this.color = "green"; | 484 | this.color = "green"; |
475 | this.addExamDialog = false; | 485 | this.addExamDialog = false; |
476 | this.getExamList(); | 486 | this.getExamList(); |
477 | this.color = "success"; | 487 | this.color = "success"; |
478 | this.loading = false; | 488 | this.loading = false; |
479 | this.clear(); | 489 | this.clear(); |
480 | }) | 490 | }) |
481 | .catch(error => { | 491 | .catch((error) => { |
482 | this.snackbar = true; | 492 | this.snackbar = true; |
483 | this.text = error.response.data.message; | 493 | this.text = error.response.data.message; |
484 | this.color = "red"; | 494 | this.color = "red"; |
485 | this.loading = false; | 495 | this.loading = false; |
486 | }); | 496 | }); |
487 | } | 497 | } |
488 | }, | 498 | }, |
489 | clear() { | 499 | clear() { |
490 | this.$refs.form.reset(); | 500 | this.$refs.form.reset(); |
491 | this.disable = false; | 501 | this.disable = false; |
492 | }, | 502 | }, |
493 | save() { | 503 | save() { |
494 | this.editedItem.examId = this.editedItem._id; | 504 | this.editedItem.examId = this.editedItem._id; |
495 | http() | 505 | http() |
496 | .put("/updateExam", this.editedItem) | 506 | .put("/updateExam", this.editedItem) |
497 | .then(response => { | 507 | .then((response) => { |
498 | this.snackbar = true; | 508 | this.snackbar = true; |
499 | this.text = response.data.message; | 509 | this.text = response.data.message; |
500 | this.color = "green"; | 510 | this.color = "green"; |
501 | this.getExamList(); | 511 | this.getExamList(); |
502 | this.close(); | 512 | this.close(); |
503 | }) | 513 | }) |
504 | .catch(error => { | 514 | .catch((error) => { |
505 | this.snackbar = true; | 515 | this.snackbar = true; |
506 | this.text = error.response.data.message; | 516 | this.text = error.response.data.message; |
507 | this.color = "red"; | 517 | this.color = "red"; |
508 | }); | 518 | }); |
509 | }, | 519 | }, |
510 | displaySearch() { | 520 | displaySearch() { |
511 | (this.show = false), (this.showSearch = true); | 521 | (this.show = false), (this.showSearch = true); |
512 | }, | 522 | }, |
513 | closeSearch() { | 523 | closeSearch() { |
514 | this.showSearch = false; | 524 | this.showSearch = false; |
515 | this.show = true; | 525 | this.show = true; |
516 | this.search = ""; | 526 | this.search = ""; |
517 | } | 527 | }, |
518 | }, | 528 | }, |
519 | mounted() { | 529 | mounted() { |
520 | this.token = this.$store.state.token; | 530 | this.token = this.$store.state.token; |
521 | this.getExamList(); | 531 | this.getExamList(); |
src/pages/Exam/examSchedule.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Exam Schedule****** --> | 3 | <!-- ****** Edit Exam Schedule****** --> |
4 | <v-dialog v-model="editExamScheduleDialog" max-width="800px" scrollable> | 4 | <v-dialog v-model="editExamScheduleDialog" max-width="800px" scrollable> |
5 | <v-card flat class="card-style pa-2" dark> | 5 | <v-card flat class="card-style pa-2" dark> |
6 | <v-layout> | 6 | <v-layout> |
7 | <v-flex xs12> | 7 | <v-flex xs12> |
8 | <label class="title text-xs-center">Edit Exam Schedule</label> | 8 | <label class="title text-xs-center">Edit Exam Schedule</label> |
9 | <v-icon size="24" class="right" @click="editExamScheduleDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editExamScheduleDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-card-text> | 12 | <v-card-text> |
13 | <v-form ref="form"> | 13 | <v-form ref="form"> |
14 | <v-container fluid> | 14 | <v-container fluid> |
15 | <v-layout wrap> | 15 | <v-layout wrap> |
16 | <v-flex xs12 sm12> | 16 | <v-flex xs12 sm12> |
17 | <v-layout> | 17 | <v-layout> |
18 | <v-flex xs4 class="pt-4 subheading"> | 18 | <v-flex xs4 class="pt-4 subheading"> |
19 | <label class="right">Exam Name:</label> | 19 | <label class="right">Exam Name:</label> |
20 | </v-flex> | 20 | </v-flex> |
21 | <v-flex xs7 class="ml-3"> | 21 | <v-flex xs7 class="ml-3"> |
22 | <v-select | 22 | <v-select |
23 | :rules="examRules" | 23 | :rules="examRules" |
24 | :items="examList" | 24 | :items="examList" |
25 | v-model="editedItem.examId" | 25 | v-model="editedItem.examId" |
26 | label="Select your Exam Name" | 26 | label="Select your Exam Name" |
27 | item-text="examName" | 27 | item-text="examName" |
28 | item-value="_id" | 28 | item-value="_id" |
29 | ></v-select> | 29 | ></v-select> |
30 | </v-flex> | 30 | </v-flex> |
31 | </v-layout> | 31 | </v-layout> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs12 sm12> | 33 | <v-flex xs12 sm12> |
34 | <v-layout> | 34 | <v-layout> |
35 | <v-flex xs4 class="pt-4 subheading"> | 35 | <v-flex xs4 class="pt-4 subheading"> |
36 | <label class="right">Class:</label> | 36 | <label class="right">Class:</label> |
37 | </v-flex> | 37 | </v-flex> |
38 | <v-flex xs7 class="ml-3"> | 38 | <v-flex xs7 class="ml-3"> |
39 | <v-select | 39 | <v-select |
40 | v-model="editedItem.classId" | 40 | v-model="editedItem.classId" |
41 | label="Select your Class" | 41 | label="Select your Class" |
42 | type="text" | 42 | type="text" |
43 | :items="classList" | 43 | :items="classList" |
44 | item-text="classNum" | 44 | item-text="classNum" |
45 | item-value="_id" | 45 | item-value="_id" |
46 | @change="getSections(editedItem.classId)" | 46 | @change="getSections(editedItem.classId)" |
47 | required | 47 | required |
48 | ></v-select> | 48 | ></v-select> |
49 | </v-flex> | 49 | </v-flex> |
50 | </v-layout> | 50 | </v-layout> |
51 | </v-flex> | 51 | </v-flex> |
52 | <v-flex xs12 sm12> | 52 | <v-flex xs12 sm12> |
53 | <v-layout> | 53 | <v-layout> |
54 | <v-flex xs4 class="pt-4 subheading"> | 54 | <v-flex xs4 class="pt-4 subheading"> |
55 | <label class="right">Subject Name:</label> | 55 | <label class="right">Subject Name:</label> |
56 | </v-flex> | 56 | </v-flex> |
57 | <v-flex xs7 class="ml-3"> | 57 | <v-flex xs7 class="ml-3"> |
58 | <v-select | 58 | <v-select |
59 | :items="subjects" | 59 | :items="subjects" |
60 | label="Select your Subject" | 60 | label="Select your Subject" |
61 | v-model="editedItem.subjectName" | 61 | v-model="editedItem.subjectName" |
62 | item-text="subjectName" | 62 | item-text="subjectName" |
63 | item-value="subjectName" | 63 | item-value="subjectName" |
64 | name="Select Subject" | 64 | name="Select Subject" |
65 | required | 65 | required |
66 | ></v-select> | 66 | ></v-select> |
67 | </v-flex> | 67 | </v-flex> |
68 | </v-layout> | 68 | </v-layout> |
69 | </v-flex> | 69 | </v-flex> |
70 | <v-flex xs12 sm12> | 70 | <v-flex xs12 sm12> |
71 | <v-layout> | 71 | <v-layout> |
72 | <v-flex xs4 class="pt-4 subheading"> | 72 | <v-flex xs4 class="pt-4 subheading"> |
73 | <label class="right">Date:</label> | 73 | <label class="right">Date:</label> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-flex xs7 class="ml-3"> | 75 | <v-flex xs7 class="ml-3"> |
76 | <v-menu | 76 | <v-menu |
77 | ref="editDate" | 77 | ref="editDate" |
78 | :close-on-content-click="false" | 78 | :close-on-content-click="false" |
79 | v-model="editDate" | 79 | v-model="editDate" |
80 | :nudge-right="40" | 80 | :nudge-right="40" |
81 | :return-value.sync="editDate" | 81 | :return-value.sync="editDate" |
82 | lazy | 82 | lazy |
83 | transition="scale-transition" | 83 | transition="scale-transition" |
84 | offset-y | 84 | offset-y |
85 | full-width | 85 | full-width |
86 | min-width="290px" | 86 | min-width="290px" |
87 | > | 87 | > |
88 | <v-text-field | 88 | <v-text-field |
89 | slot="activator" | 89 | slot="activator" |
90 | v-model="editedItem.date" | 90 | v-model="editedItem.date" |
91 | label="Select Date" | 91 | label="Select Date" |
92 | append-icon="event" | 92 | append-icon="event" |
93 | readonly | 93 | readonly |
94 | ></v-text-field> | 94 | ></v-text-field> |
95 | <v-date-picker v-model="editedItem.date" @input="editDate = false"></v-date-picker> | 95 | <v-date-picker v-model="editedItem.date" @input="editDate = false"></v-date-picker> |
96 | </v-menu> | 96 | </v-menu> |
97 | </v-flex> | 97 | </v-flex> |
98 | </v-layout> | 98 | </v-layout> |
99 | </v-flex> | 99 | </v-flex> |
100 | <v-flex xs12 sm12> | 100 | <v-flex xs12 sm12> |
101 | <v-layout> | 101 | <v-layout> |
102 | <v-flex xs4 class="pt-4 subheading"> | 102 | <v-flex xs4 class="pt-4 subheading"> |
103 | <label class="right">Time From:</label> | 103 | <label class="right">Time From:</label> |
104 | </v-flex> | 104 | </v-flex> |
105 | <v-flex xs7 class="ml-3"> | 105 | <v-flex xs7 class="ml-3"> |
106 | <v-menu | 106 | <v-menu |
107 | ref="menuEdit" | 107 | ref="menuEdit" |
108 | :close-on-content-click="false" | 108 | :close-on-content-click="false" |
109 | v-model="menuEdit" | 109 | v-model="menuEdit" |
110 | :nudge-right="40" | 110 | :nudge-right="40" |
111 | :return-value.sync="editedItem.timeFrom" | 111 | :return-value.sync="editedItem.timeFrom" |
112 | lazy | 112 | lazy |
113 | transition="scale-transition" | 113 | transition="scale-transition" |
114 | offset-y | 114 | offset-y |
115 | full-width | 115 | full-width |
116 | max-width="290px" | 116 | max-width="290px" |
117 | min-width="290px" | 117 | min-width="290px" |
118 | > | 118 | > |
119 | <v-text-field | 119 | <v-text-field |
120 | slot="activator" | 120 | slot="activator" |
121 | v-model="editedItem.timeFrom" | 121 | v-model="editedItem.timeFrom" |
122 | label="Select your time From" | 122 | label="Select your time From" |
123 | append-icon="access_time" | 123 | append-icon="access_time" |
124 | readonly | 124 | readonly |
125 | ></v-text-field> | 125 | ></v-text-field> |
126 | <v-time-picker | 126 | <v-time-picker |
127 | v-model="editedItem.timeIn" | 127 | v-model="editedItem.timeIn" |
128 | @change="$refs.menuEdit.save(editedItem.timeIn)" | 128 | @change="$refs.menuEdit.save(editedItem.timeIn)" |
129 | ></v-time-picker> | 129 | ></v-time-picker> |
130 | </v-menu> | 130 | </v-menu> |
131 | </v-flex> | 131 | </v-flex> |
132 | </v-layout> | 132 | </v-layout> |
133 | </v-flex> | 133 | </v-flex> |
134 | <v-flex xs12 sm12> | 134 | <v-flex xs12 sm12> |
135 | <v-layout> | 135 | <v-layout> |
136 | <v-flex xs4 class="pt-4 subheading"> | 136 | <v-flex xs4 class="pt-4 subheading"> |
137 | <label class="right">Time To:</label> | 137 | <label class="right">Time To:</label> |
138 | </v-flex> | 138 | </v-flex> |
139 | <v-flex xs7 class="ml-3"> | 139 | <v-flex xs7 class="ml-3"> |
140 | <v-menu | 140 | <v-menu |
141 | ref="timeToEdit" | 141 | ref="timeToEdit" |
142 | :close-on-content-click="false" | 142 | :close-on-content-click="false" |
143 | v-model="timeToEdit" | 143 | v-model="timeToEdit" |
144 | :nudge-right="40" | 144 | :nudge-right="40" |
145 | :return-value.sync="editedItem.timeTo" | 145 | :return-value.sync="editedItem.timeTo" |
146 | lazy | 146 | lazy |
147 | transition="scale-transition" | 147 | transition="scale-transition" |
148 | offset-y | 148 | offset-y |
149 | full-width | 149 | full-width |
150 | max-width="290px" | 150 | max-width="290px" |
151 | min-width="290px" | 151 | min-width="290px" |
152 | > | 152 | > |
153 | <v-text-field | 153 | <v-text-field |
154 | slot="activator" | 154 | slot="activator" |
155 | v-model="editedItem.timeTo" | 155 | v-model="editedItem.timeTo" |
156 | label="Select your Time To" | 156 | label="Select your Time To" |
157 | append-icon="access_time" | 157 | append-icon="access_time" |
158 | readonly | 158 | readonly |
159 | ></v-text-field> | 159 | ></v-text-field> |
160 | <v-time-picker | 160 | <v-time-picker |
161 | v-model="editedItem.timeTo" | 161 | v-model="editedItem.timeTo" |
162 | @change="$refs.timeToEdit.save(editedItem.timeTo)" | 162 | @change="$refs.timeToEdit.save(editedItem.timeTo)" |
163 | ></v-time-picker> | 163 | ></v-time-picker> |
164 | </v-menu> | 164 | </v-menu> |
165 | </v-flex> | 165 | </v-flex> |
166 | </v-layout> | 166 | </v-layout> |
167 | </v-flex> | 167 | </v-flex> |
168 | <v-flex xs12 sm12> | 168 | <v-flex xs12 sm12> |
169 | <v-layout> | 169 | <v-layout> |
170 | <v-flex xs4 class="pt-4 subheading"> | 170 | <v-flex xs4 class="pt-4 subheading"> |
171 | <label class="right">Room:</label> | 171 | <label class="right">Room:</label> |
172 | </v-flex> | 172 | </v-flex> |
173 | <v-flex xs7 class="ml-3"> | 173 | <v-flex xs7 class="ml-3"> |
174 | <v-text-field | 174 | <v-text-field |
175 | placeholder="fill your room" | 175 | placeholder="fill your room" |
176 | v-model="editedItem.room" | 176 | v-model="editedItem.room" |
177 | @keyup.enter="save" | 177 | @keyup.enter="save" |
178 | ></v-text-field> | 178 | ></v-text-field> |
179 | </v-flex> | 179 | </v-flex> |
180 | </v-layout> | 180 | </v-layout> |
181 | </v-flex> | 181 | </v-flex> |
182 | </v-layout> | 182 | </v-layout> |
183 | <v-layout> | 183 | <v-layout> |
184 | <v-flex xs12> | 184 | <v-flex xs12> |
185 | <v-card-actions> | 185 | <v-card-actions> |
186 | <v-spacer></v-spacer> | 186 | <v-spacer></v-spacer> |
187 | <v-btn round dark @click="update" class="add-button">Save</v-btn> | 187 | <v-btn round dark @click="update" class="add-button">Save</v-btn> |
188 | </v-card-actions> | 188 | </v-card-actions> |
189 | </v-flex> | 189 | </v-flex> |
190 | </v-layout> | 190 | </v-layout> |
191 | </v-container> | 191 | </v-container> |
192 | </v-form> | 192 | </v-form> |
193 | </v-card-text> | 193 | </v-card-text> |
194 | </v-card> | 194 | </v-card> |
195 | </v-dialog> | 195 | </v-dialog> |
196 | 196 | ||
197 | <!-- ****** PROFILE VIEW Exam Schedule DATA ****** --> | 197 | <!-- ****** PROFILE VIEW Exam Schedule DATA ****** --> |
198 | 198 | ||
199 | <v-dialog v-model="profileExamScheduleDialog" max-width="600px"> | 199 | <v-dialog v-model="profileExamScheduleDialog" max-width="600px"> |
200 | <v-card flat class="card-style pa-3" dark> | 200 | <v-card flat class="card-style pa-3" dark> |
201 | <v-layout> | 201 | <v-layout> |
202 | <v-flex xs12> | 202 | <v-flex xs12> |
203 | <label class="title text-xs-center">View Exam Schedule</label> | 203 | <label class="title text-xs-center">View Exam Schedule</label> |
204 | <v-icon size="24" class="right" @click="profileExamScheduleDialog = false">cancel</v-icon> | 204 | <v-icon size="24" class="right" @click="profileExamScheduleDialog = false">cancel</v-icon> |
205 | </v-flex> | 205 | </v-flex> |
206 | </v-layout> | 206 | </v-layout> |
207 | <v-card-text> | 207 | <v-card-text> |
208 | <v-container grid-list-md> | 208 | <v-container grid-list-md> |
209 | <v-layout wrap> | 209 | <v-layout wrap> |
210 | <v-flex> | 210 | <v-flex> |
211 | <v-layout> | 211 | <v-layout> |
212 | <v-flex xs5 sm6> | 212 | <v-flex xs5 sm6> |
213 | <h5 class="right my-1"> | 213 | <h5 class="right my-1"> |
214 | <b>Exam Name:</b> | 214 | <b>Exam Name:</b> |
215 | </h5> | 215 | </h5> |
216 | </v-flex> | 216 | </v-flex> |
217 | <v-flex sm6 xs8> | 217 | <v-flex sm6 xs8> |
218 | <h5 class="my-1">{{ editedItem.examId}}</h5> | 218 | <h5 class="my-1">{{ editedItem.examId}}</h5> |
219 | </v-flex> | 219 | </v-flex> |
220 | </v-layout> | 220 | </v-layout> |
221 | <v-layout> | 221 | <v-layout> |
222 | <v-flex xs5 sm6> | 222 | <v-flex xs5 sm6> |
223 | <h5 class="right my-1"> | 223 | <h5 class="right my-1"> |
224 | <b>Class:</b> | 224 | <b>Class:</b> |
225 | </h5> | 225 | </h5> |
226 | </v-flex> | 226 | </v-flex> |
227 | <v-flex sm6 xs8> | 227 | <v-flex sm6 xs8> |
228 | <h5 class="my-1">{{ editedItem.classId }}</h5> | 228 | <h5 class="my-1">{{ editedItem.classId }}</h5> |
229 | </v-flex> | 229 | </v-flex> |
230 | </v-layout> | 230 | </v-layout> |
231 | <v-layout> | 231 | <v-layout> |
232 | <v-flex xs5 sm6> | 232 | <v-flex xs5 sm6> |
233 | <h5 class="right my-1"> | 233 | <h5 class="right my-1"> |
234 | <b>Section:</b> | 234 | <b>Section:</b> |
235 | </h5> | 235 | </h5> |
236 | </v-flex> | 236 | </v-flex> |
237 | <v-flex sm6 xs8> | 237 | <v-flex sm6 xs8> |
238 | <h5 class="my-1">{{ editedItem.sectionId }}</h5> | 238 | <h5 class="my-1">{{ editedItem.sectionId }}</h5> |
239 | </v-flex> | 239 | </v-flex> |
240 | </v-layout> | 240 | </v-layout> |
241 | <v-layout> | 241 | <v-layout> |
242 | <v-flex xs5 sm6> | 242 | <v-flex xs5 sm6> |
243 | <h5 class="right my-1"> | 243 | <h5 class="right my-1"> |
244 | <b>Subject Name:</b> | 244 | <b>Subject Name:</b> |
245 | </h5> | 245 | </h5> |
246 | </v-flex> | 246 | </v-flex> |
247 | <v-flex sm6 xs8> | 247 | <v-flex sm6 xs8> |
248 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> | 248 | <h5 class="my-1">{{ editedItem.subjectName }}</h5> |
249 | </v-flex> | 249 | </v-flex> |
250 | </v-layout> | 250 | </v-layout> |
251 | <v-layout> | 251 | <v-layout> |
252 | <v-flex xs5 sm6> | 252 | <v-flex xs5 sm6> |
253 | <h5 class="right my-1"> | 253 | <h5 class="right my-1"> |
254 | <b>Date:</b> | 254 | <b>Date:</b> |
255 | </h5> | 255 | </h5> |
256 | </v-flex> | 256 | </v-flex> |
257 | <v-flex sm6 xs8> | 257 | <v-flex sm6 xs8> |
258 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> | 258 | <h5 class="my-1">{{ dates(editedItem.date) }}</h5> |
259 | </v-flex> | 259 | </v-flex> |
260 | </v-layout> | 260 | </v-layout> |
261 | <v-layout> | 261 | <v-layout> |
262 | <v-flex xs5 sm6> | 262 | <v-flex xs5 sm6> |
263 | <h5 class="right my-1"> | 263 | <h5 class="right my-1"> |
264 | <b>Time From:</b> | 264 | <b>Time From:</b> |
265 | </h5> | 265 | </h5> |
266 | </v-flex> | 266 | </v-flex> |
267 | <v-flex sm6 xs8> | 267 | <v-flex sm6 xs8> |
268 | <h5 class="my-1">{{ editedItem.timeFrom }}</h5> | 268 | <h5 class="my-1">{{ editedItem.timeFrom }}</h5> |
269 | </v-flex> | 269 | </v-flex> |
270 | </v-layout> | 270 | </v-layout> |
271 | <v-layout> | 271 | <v-layout> |
272 | <v-flex xs5 sm6> | 272 | <v-flex xs5 sm6> |
273 | <h5 class="right my-1"> | 273 | <h5 class="right my-1"> |
274 | <b>Time To:</b> | 274 | <b>Time To:</b> |
275 | </h5> | 275 | </h5> |
276 | </v-flex> | 276 | </v-flex> |
277 | <v-flex sm6 xs8> | 277 | <v-flex sm6 xs8> |
278 | <h5 class="my-1">{{ editedItem.timeTo }}</h5> | 278 | <h5 class="my-1">{{ editedItem.timeTo }}</h5> |
279 | </v-flex> | 279 | </v-flex> |
280 | </v-layout> | 280 | </v-layout> |
281 | <v-layout> | 281 | <v-layout> |
282 | <v-flex xs5 sm6> | 282 | <v-flex xs5 sm6> |
283 | <h5 class="right my-1"> | 283 | <h5 class="right my-1"> |
284 | <b>Room:</b> | 284 | <b>Room:</b> |
285 | </h5> | 285 | </h5> |
286 | </v-flex> | 286 | </v-flex> |
287 | <v-flex sm6 xs8> | 287 | <v-flex sm6 xs8> |
288 | <h5 class="my-1">{{ editedItem.room }}</h5> | 288 | <h5 class="my-1">{{ editedItem.room }}</h5> |
289 | </v-flex> | 289 | </v-flex> |
290 | </v-layout> | 290 | </v-layout> |
291 | </v-flex> | 291 | </v-flex> |
292 | </v-layout> | 292 | </v-layout> |
293 | </v-container> | 293 | </v-container> |
294 | </v-card-text> | 294 | </v-card-text> |
295 | </v-card> | 295 | </v-card> |
296 | </v-dialog> | 296 | </v-dialog> |
297 | <!-- ***** Exam Schedule TABLE****** --> | 297 | <!-- ***** Exam Schedule TABLE****** --> |
298 | <v-toolbar color="transparent" flat> | 298 | <v-toolbar color="transparent" flat> |
299 | <v-btn | 299 | <v-btn |
300 | fab | 300 | fab |
301 | dark | 301 | dark |
302 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 302 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
303 | small | 303 | small |
304 | @click="addExamScheduleDialog = true" | 304 | @click="addExamScheduleDialog = true" |
305 | > | 305 | > |
306 | <v-icon dark>add</v-icon> | 306 | <v-icon dark>add</v-icon> |
307 | </v-btn> | 307 | </v-btn> |
308 | <v-btn | 308 | <v-btn |
309 | v-if="role != 'TEACHER' " | 309 | v-if="role != 'TEACHER' " |
310 | round | 310 | round |
311 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 311 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
312 | dark | 312 | dark |
313 | @click="addExamScheduleDialog = true" | 313 | @click="addExamScheduleDialog = true" |
314 | > | 314 | > |
315 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Schedule | 315 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Schedule |
316 | </v-btn> | 316 | </v-btn> |
317 | <v-spacer></v-spacer> | 317 | <v-spacer></v-spacer> |
318 | <v-flex xs8 sm3 md2 class="mr-3"> | 318 | <v-flex xs8 sm3 md2 class="mr-3"> |
319 | <v-select | 319 | <v-select |
320 | v-model="getScheduleData.classId" | 320 | v-model="getScheduleData.classId" |
321 | label="Select your class" | 321 | label="Select your class" |
322 | type="text" | 322 | type="text" |
323 | :items="classList" | 323 | :items="classList" |
324 | item-text="classNum" | 324 | item-text="classNum" |
325 | item-value="_id" | 325 | item-value="_id" |
326 | @change="getSections(getScheduleData.classId)" | 326 | @change="getSections(getScheduleData.classId)" |
327 | required | 327 | required |
328 | ></v-select> | 328 | ></v-select> |
329 | </v-flex> | 329 | </v-flex> |
330 | <v-flex xs8 sm3 md2 class="mr-3"> | 330 | <v-flex xs8 sm3 md2 class="mr-3"> |
331 | <v-select | 331 | <v-select |
332 | v-model="getScheduleData.sectionId" | 332 | v-model="getScheduleData.sectionId" |
333 | label="Select your section" | 333 | label="Select your section" |
334 | type="text" | 334 | type="text" |
335 | :items="addSection" | 335 | :items="addSection" |
336 | item-text="name" | 336 | item-text="name" |
337 | item-value="_id" | 337 | item-value="_id" |
338 | @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)" | 338 | @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)" |
339 | required | 339 | required |
340 | ></v-select> | 340 | ></v-select> |
341 | </v-flex> | 341 | </v-flex> |
342 | <v-card-title class="body-1" v-show="show"> | 342 | <v-card-title class="body-1" v-show="show"> |
343 | <v-btn icon large flat @click="displaySearch"> | 343 | <v-btn icon large flat @click="displaySearch"> |
344 | <v-avatar size="27"> | 344 | <v-avatar size="27"> |
345 | <img src="/static/icon/search.png" alt="icon" /> | 345 | <img src="/static/icon/search.png" alt="icon" /> |
346 | </v-avatar> | 346 | </v-avatar> |
347 | </v-btn> | 347 | </v-btn> |
348 | </v-card-title> | 348 | </v-card-title> |
349 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 349 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
350 | <v-layout> | 350 | <v-layout> |
351 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 351 | <v-text-field |
352 | autofocus | ||
353 | v-model="search" | ||
354 | label="Search" | ||
355 | prepend-inner-icon="search" | ||
356 | color="primary" | ||
357 | ></v-text-field> | ||
352 | <v-icon @click="closeSearch" color="error">close</v-icon> | 358 | <v-icon @click="closeSearch" color="error">close</v-icon> |
353 | </v-layout> | 359 | </v-layout> |
354 | </v-flex> | 360 | </v-flex> |
355 | </v-toolbar> | 361 | </v-toolbar> |
356 | <v-data-table | 362 | <v-data-table |
357 | :headers="headers" | 363 | :headers="headers" |
358 | :items="ScheduleData" | 364 | :items="ScheduleData" |
359 | :pagination.sync="pagination" | 365 | :pagination.sync="pagination" |
360 | :search="search" | 366 | :search="search" |
361 | > | 367 | > |
362 | <template slot="items" slot-scope="props"> | 368 | <template slot="items" slot-scope="props"> |
363 | <tr class="tr"> | 369 | <tr class="tr"> |
364 | <td class="td td-row">{{ props.index + 1}}</td> | 370 | <td class="td td-row">{{ props.index + 1}}</td> |
365 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> | 371 | <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td> |
366 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> | 372 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> |
367 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> | 373 | <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td> |
368 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> | 374 | <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td> |
369 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> | 375 | <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td> |
370 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> | 376 | <td class="td td-row text-xs-center">{{ props.item.room }}</td> |
371 | <td class="td td-row text-xs-center"> | 377 | <td class="td td-row text-xs-center"> |
372 | <span> | 378 | <span> |
373 | <v-tooltip top> | 379 | <v-tooltip top> |
374 | <img | 380 | <img |
375 | slot="activator" | 381 | slot="activator" |
376 | style="cursor:pointer; width:25px; height:25px; " | 382 | style="cursor:pointer; width:25px; height:25px; " |
377 | class="mr-3" | 383 | class="mr-3" |
378 | @click="profile(props.item)" | 384 | @click="profile(props.item)" |
379 | src="/static/icon/view.png" | 385 | src="/static/icon/view.png" |
380 | /> | 386 | /> |
381 | <span>View</span> | 387 | <span>View</span> |
382 | </v-tooltip> | 388 | </v-tooltip> |
383 | <v-tooltip top v-if="role != 'TEACHER' "> | 389 | <v-tooltip top v-if="role != 'TEACHER' "> |
384 | <img | 390 | <img |
385 | slot="activator" | 391 | slot="activator" |
386 | style="cursor:pointer; width:20px; height:18px; " | 392 | style="cursor:pointer; width:20px; height:18px; " |
387 | class="mr-3" | 393 | class="mr-3" |
388 | @click="editItem(props.item)" | 394 | @click="editItem(props.item)" |
389 | src="/static/icon/edit.png" | 395 | src="/static/icon/edit.png" |
390 | /> | 396 | /> |
391 | <span>Edit</span> | 397 | <span>Edit</span> |
392 | </v-tooltip> | 398 | </v-tooltip> |
393 | <v-tooltip top v-if="role != 'TEACHER' "> | 399 | <v-tooltip top v-if="role != 'TEACHER' "> |
394 | <img | 400 | <img |
395 | slot="activator" | 401 | slot="activator" |
396 | style="cursor:pointer; width:20px; height:20px; " | 402 | style="cursor:pointer; width:20px; height:20px; " |
397 | @click="deleteSchedule(props.item)" | 403 | @click="deleteSchedule(props.item)" |
398 | src="/static/icon/delete.png" | 404 | src="/static/icon/delete.png" |
399 | /> | 405 | /> |
400 | <span>Delete</span> | 406 | <span>Delete</span> |
401 | </v-tooltip> | 407 | </v-tooltip> |
402 | </span> | 408 | </span> |
403 | </td> | 409 | </td> |
404 | </tr> | 410 | </tr> |
405 | </template> | 411 | </template> |
406 | <v-alert | 412 | <v-alert |
407 | slot="no-results" | 413 | slot="no-results" |
408 | :value="true" | 414 | :value="true" |
409 | color="error" | 415 | color="error" |
410 | icon="warning" | 416 | icon="warning" |
411 | >Your search for "{{ search }}" found no results.</v-alert> | 417 | >Your search for "{{ search }}" found no results.</v-alert> |
412 | </v-data-table> | 418 | </v-data-table> |
413 | 419 | ||
414 | <!-- ****** ADD Exam Schedule ****** --> | 420 | <!-- ****** ADD Exam Schedule ****** --> |
415 | <v-dialog v-model="addExamScheduleDialog" max-width="600"> | 421 | <v-dialog v-model="addExamScheduleDialog" max-width="600" v-if="addExamScheduleDialog"> |
416 | <v-card flat class="card-style pa-2" dark> | 422 | <v-card flat class="card-style pa-2" dark> |
417 | <v-layout> | 423 | <v-layout> |
418 | <v-flex xs12> | 424 | <v-flex xs12> |
419 | <label class="title text-xs-center">Add Exam Schedule</label> | 425 | <label class="title text-xs-center">Add Exam Schedule</label> |
420 | <v-icon size="24" class="right" @click="$refs.form.reset();addExamScheduleDialog = false">cancel</v-icon> | 426 | <v-icon |
427 | size="24" | ||
428 | class="right" | ||
429 | @click="$refs.form.reset();addExamScheduleDialog = false" | ||
430 | >cancel</v-icon> | ||
421 | </v-flex> | 431 | </v-flex> |
422 | </v-layout> | 432 | </v-layout> |
423 | <v-form ref="form" v-model="valid" lazy-validation> | 433 | <v-form ref="form" v-model="valid" lazy-validation> |
424 | <v-container fluid> | 434 | <v-container fluid> |
425 | <v-flex xs12> | 435 | <v-flex xs12> |
426 | <v-layout> | 436 | <v-layout> |
427 | <v-flex xs5 class="pt-4 subheading"> | 437 | <v-flex xs5 class="pt-4 subheading"> |
428 | <label class="right">Exam Name:</label> | 438 | <label class="right">Exam Name:</label> |
429 | </v-flex> | 439 | </v-flex> |
430 | <v-flex xs7 sm7 md6 class="ml-3"> | 440 | <v-flex xs7 sm7 md6 class="ml-3"> |
431 | <v-select | 441 | <v-select |
432 | label="Select your Exam Name" | 442 | label="Select your Exam Name" |
433 | :rules="examRules" | 443 | :rules="examRules" |
434 | :items="examList" | 444 | :items="examList" |
435 | v-model="addSchedule.examId" | 445 | v-model="addSchedule.examId" |
436 | item-text="examName" | 446 | item-text="examName" |
437 | item-value="_id" | 447 | item-value="_id" |
438 | ></v-select> | 448 | ></v-select> |
439 | </v-flex> | 449 | </v-flex> |
440 | </v-layout> | 450 | </v-layout> |
441 | </v-flex> | 451 | </v-flex> |
442 | <v-flex xs12> | 452 | <v-flex xs12> |
443 | <v-layout> | 453 | <v-layout> |
444 | <v-flex xs5 class="pt-4 subheading"> | 454 | <v-flex xs5 class="pt-4 subheading"> |
445 | <label class="right">Class:</label> | 455 | <label class="right">Class:</label> |
446 | </v-flex> | 456 | </v-flex> |
447 | <v-flex xs7 sm7 md6 class="ml-3"> | 457 | <v-flex xs7 sm7 md6 class="ml-3"> |
448 | <v-select | 458 | <v-select |
449 | v-model="addSchedule.classId" | 459 | v-model="addSchedule.classId" |
450 | label="Select your class" | 460 | label="Select your class" |
451 | type="text" | 461 | type="text" |
452 | :items="classList" | 462 | :items="classList" |
453 | item-text="classNum" | 463 | item-text="classNum" |
454 | item-value="_id" | 464 | item-value="_id" |
455 | :rules="classRules" | 465 | :rules="classRules" |
456 | @change="getSections(addSchedule.classId)" | 466 | @change="getSections(addSchedule.classId)" |
457 | required | 467 | required |
458 | ></v-select> | 468 | ></v-select> |
459 | </v-flex> | 469 | </v-flex> |
460 | </v-layout> | 470 | </v-layout> |
461 | </v-flex> | 471 | </v-flex> |
462 | <v-flex xs12> | 472 | <v-flex xs12> |
463 | <v-layout> | 473 | <v-layout> |
464 | <v-flex xs5 class="pt-4 subheading"> | 474 | <v-flex xs5 class="pt-4 subheading"> |
465 | <label class="right">Section:</label> | 475 | <label class="right">Section:</label> |
466 | </v-flex> | 476 | </v-flex> |
467 | <v-flex xs7 sm7 md6 class="ml-3"> | 477 | <v-flex xs7 sm7 md6 class="ml-3"> |
468 | <v-select | 478 | <v-select |
469 | :items="addSection" | 479 | :items="addSection" |
470 | label="Select Section" | 480 | label="Select Section" |
471 | v-model="addSchedule.sectionId" | 481 | v-model="addSchedule.sectionId" |
472 | item-text="name" | 482 | item-text="name" |
473 | item-value="_id" | 483 | item-value="_id" |
474 | name="Select Section" | 484 | name="Select Section" |
475 | :rules="sectionRules" | 485 | :rules="sectionRules" |
476 | required | 486 | required |
477 | ></v-select> | 487 | ></v-select> |
478 | </v-flex> | 488 | </v-flex> |
479 | </v-layout> | 489 | </v-layout> |
480 | </v-flex> | 490 | </v-flex> |
481 | <v-flex xs12> | 491 | <v-flex xs12> |
482 | <v-layout> | 492 | <v-layout> |
483 | <v-flex xs5 class="pt-4 subheading"> | 493 | <v-flex xs5 class="pt-4 subheading"> |
484 | <label class="right">Subject Name:</label> | 494 | <label class="right">Subject Name:</label> |
485 | </v-flex> | 495 | </v-flex> |
486 | <v-flex xs7 sm7 md6 class="ml-3"> | 496 | <v-flex xs7 sm7 md6 class="ml-3"> |
487 | <v-select | 497 | <v-select |
488 | :items="subjects" | 498 | :items="subjects" |
489 | label="Select Subject" | 499 | label="Select Subject" |
490 | v-model="addSchedule.subjectName" | 500 | v-model="addSchedule.subjectName" |
491 | item-text="subjectName" | 501 | item-text="subjectName" |
492 | item-value="subjectName" | 502 | item-value="subjectName" |
493 | name="Select Section" | 503 | name="Select Section" |
494 | :rules="subjectRules" | 504 | :rules="subjectRules" |
495 | required | 505 | required |
496 | ></v-select> | 506 | ></v-select> |
497 | </v-flex> | 507 | </v-flex> |
498 | </v-layout> | 508 | </v-layout> |
499 | </v-flex> | 509 | </v-flex> |
500 | <v-flex xs12> | 510 | <v-flex xs12> |
501 | <v-layout> | 511 | <v-layout> |
502 | <v-flex xs5 class="pt-4 subheading"> | 512 | <v-flex xs5 class="pt-4 subheading"> |
503 | <label class="right">Date:</label> | 513 | <label class="right">Date:</label> |
504 | </v-flex> | 514 | </v-flex> |
505 | <v-flex xs7 sm7 md6 class="ml-3"> | 515 | <v-flex xs7 sm7 md6 class="ml-3"> |
506 | <v-menu | 516 | <v-menu |
507 | ref="menu2" | 517 | ref="menu2" |
508 | :close-on-content-click="false" | 518 | :close-on-content-click="false" |
509 | v-model="menu2" | 519 | v-model="menu2" |
510 | :nudge-right="40" | 520 | :nudge-right="40" |
511 | :return-value.sync="addSchedule.date" | 521 | :return-value.sync="addSchedule.date" |
512 | lazy | 522 | lazy |
513 | transition="scale-transition" | 523 | transition="scale-transition" |
514 | offset-y | 524 | offset-y |
515 | full-width | 525 | full-width |
516 | min-width="290px" | 526 | min-width="290px" |
517 | > | 527 | > |
518 | <v-text-field | 528 | <v-text-field |
519 | slot="activator" | 529 | slot="activator" |
520 | v-model="addSchedule.date" | 530 | v-model="addSchedule.date" |
521 | :rules="examScheduleDateRules" | 531 | :rules="examScheduleDateRules" |
522 | label="Select Date" | 532 | label="Select Date" |
523 | append-icon="event" | 533 | append-icon="event" |
524 | readonly | 534 | readonly |
525 | ></v-text-field> | 535 | ></v-text-field> |
526 | <v-date-picker | 536 | <v-date-picker |
527 | v-model="addSchedule.date" | 537 | v-model="addSchedule.date" |
528 | @input="$refs.menu2.save(addSchedule.date)" | 538 | @input="$refs.menu2.save(addSchedule.date)" |
529 | ></v-date-picker> | 539 | ></v-date-picker> |
530 | </v-menu> | 540 | </v-menu> |
531 | </v-flex> | 541 | </v-flex> |
532 | </v-layout> | 542 | </v-layout> |
533 | </v-flex> | 543 | </v-flex> |
534 | <v-flex xs12> | 544 | <v-flex xs12> |
535 | <v-layout> | 545 | <v-layout> |
536 | <v-flex xs5 class="pt-4 subheading"> | 546 | <v-flex xs5 class="pt-4 subheading"> |
537 | <label class="right">Time From:</label> | 547 | <label class="right">Time From:</label> |
538 | </v-flex> | 548 | </v-flex> |
539 | <v-flex xs7 sm7 md6 class="ml-3"> | 549 | <v-flex xs7 sm7 md6 class="ml-3"> |
540 | <v-menu | 550 | <v-menu |
541 | ref="menuA" | 551 | ref="menuA" |
542 | :close-on-content-click="false" | 552 | :close-on-content-click="false" |
543 | v-model="menuB" | 553 | v-model="menuB" |
544 | :nudge-right="40" | 554 | :nudge-right="40" |
545 | :return-value.sync="addSchedule.timeFrom" | 555 | :return-value.sync="addSchedule.timeFrom" |
546 | lazy | 556 | lazy |
547 | transition="scale-transition" | 557 | transition="scale-transition" |
548 | offset-y | 558 | offset-y |
549 | full-width | 559 | full-width |
550 | max-width="290px" | 560 | max-width="290px" |
551 | min-width="290px" | 561 | min-width="290px" |
552 | > | 562 | > |
553 | <v-text-field | 563 | <v-text-field |
554 | slot="activator" | 564 | slot="activator" |
555 | v-model="addSchedule.timeIn" | 565 | v-model="addSchedule.timeIn" |
556 | label="Select your time From" | 566 | label="Select your time From" |
557 | append-icon="access_time" | 567 | append-icon="access_time" |
558 | :rules="timeInRules" | 568 | :rules="timeInRules" |
559 | readonly | 569 | readonly |
560 | ></v-text-field> | 570 | ></v-text-field> |
561 | <v-time-picker | 571 | <v-time-picker |
562 | v-model="addSchedule.timeIn" | 572 | v-model="addSchedule.timeIn" |
563 | @change="$refs.menuA.save(addSchedule.timeIn)" | 573 | @change="$refs.menuA.save(addSchedule.timeIn)" |
564 | ></v-time-picker> | 574 | ></v-time-picker> |
565 | </v-menu> | 575 | </v-menu> |
566 | </v-flex> | 576 | </v-flex> |
567 | </v-layout> | 577 | </v-layout> |
568 | </v-flex> | 578 | </v-flex> |
569 | <v-flex xs12> | 579 | <v-flex xs12> |
570 | <v-layout> | 580 | <v-layout> |
571 | <v-flex xs5 class="pt-4 subheading"> | 581 | <v-flex xs5 class="pt-4 subheading"> |
572 | <label class="right">Time To:</label> | 582 | <label class="right">Time To:</label> |
573 | </v-flex> | 583 | </v-flex> |
574 | <v-flex xs7 sm7 md6 class="ml-3"> | 584 | <v-flex xs7 sm7 md6 class="ml-3"> |
575 | <v-menu | 585 | <v-menu |
576 | ref="menu" | 586 | ref="menu" |
577 | :close-on-content-click="false" | 587 | :close-on-content-click="false" |
578 | v-model="menu1" | 588 | v-model="menu1" |
579 | :nudge-right="40" | 589 | :nudge-right="40" |
580 | :return-value.sync="addSchedule.timeTo" | 590 | :return-value.sync="addSchedule.timeTo" |
581 | lazy | 591 | lazy |
582 | transition="scale-transition" | 592 | transition="scale-transition" |
583 | offset-y | 593 | offset-y |
584 | full-width | 594 | full-width |
585 | max-width="290px" | 595 | max-width="290px" |
586 | min-width="290px" | 596 | min-width="290px" |
587 | > | 597 | > |
588 | <v-text-field | 598 | <v-text-field |
589 | slot="activator" | 599 | slot="activator" |
590 | v-model="addSchedule.timeTo" | 600 | v-model="addSchedule.timeTo" |
591 | label="Select your Time To" | 601 | label="Select your Time To" |
592 | append-icon="access_time" | 602 | append-icon="access_time" |
593 | :rules="timeOutRules" | 603 | :rules="timeOutRules" |
594 | readonly | 604 | readonly |
595 | ></v-text-field> | 605 | ></v-text-field> |
596 | <v-time-picker | 606 | <v-time-picker |
597 | v-model="addSchedule.timeTo" | 607 | v-model="addSchedule.timeTo" |
598 | @change="$refs.menu.save(addSchedule.timeTo)" | 608 | @change="$refs.menu.save(addSchedule.timeTo)" |
599 | ></v-time-picker> | 609 | ></v-time-picker> |
600 | </v-menu> | 610 | </v-menu> |
601 | </v-flex> | 611 | </v-flex> |
602 | </v-layout> | 612 | </v-layout> |
603 | </v-flex> | 613 | </v-flex> |
604 | <v-flex xs12> | 614 | <v-flex xs12> |
605 | <v-layout> | 615 | <v-layout> |
606 | <v-flex xs5 class="pt-4 subheading"> | 616 | <v-flex xs5 class="pt-4 subheading"> |
607 | <label class="right">Room:</label> | 617 | <label class="right">Room:</label> |
608 | </v-flex> | 618 | </v-flex> |
609 | <v-flex xs7 sm7 md6 class="ml-3"> | 619 | <v-flex xs7 sm7 md6 class="ml-3"> |
610 | <v-text-field | 620 | <v-text-field |
611 | placeholder="fill your room" | 621 | placeholder="fill your room" |
612 | :rules="roomRules" | 622 | :rules="roomRules" |
613 | v-model="addSchedule.room" | 623 | v-model="addSchedule.room" |
614 | @keyup.enter="submit" | 624 | @keyup.enter="submit" |
615 | ></v-text-field> | 625 | ></v-text-field> |
616 | </v-flex> | 626 | </v-flex> |
617 | </v-layout> | 627 | </v-layout> |
618 | </v-flex> | 628 | </v-flex> |
619 | <v-layout> | 629 | <v-layout> |
620 | <v-flex xs12> | 630 | <v-flex xs12> |
621 | <v-card-actions> | 631 | <v-card-actions> |
622 | <v-spacer class="hidden-xs-only"></v-spacer> | 632 | <v-spacer class="hidden-xs-only"></v-spacer> |
623 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 633 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
624 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 634 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
625 | </v-card-actions> | 635 | </v-card-actions> |
626 | </v-flex> | 636 | </v-flex> |
627 | </v-layout> | 637 | </v-layout> |
628 | </v-container> | 638 | </v-container> |
629 | </v-form> | 639 | </v-form> |
630 | </v-card> | 640 | </v-card> |
631 | </v-dialog> | 641 | </v-dialog> |
632 | <v-snackbar | 642 | <v-snackbar |
633 | :timeout="timeout" | 643 | :timeout="timeout" |
634 | :top="y === 'top'" | 644 | :top="y === 'top'" |
635 | :right="x === 'right'" | 645 | :right="x === 'right'" |
636 | :vertical="mode === 'vertical'" | 646 | :vertical="mode === 'vertical'" |
637 | v-model="snackbar" | 647 | v-model="snackbar" |
638 | :color="color" | 648 | :color="color" |
639 | >{{ text }}</v-snackbar> | 649 | >{{ text }}</v-snackbar> |
640 | <div class="loader" v-if="showLoader"> | 650 | <div class="loader" v-if="showLoader"> |
641 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 651 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
642 | </div> | 652 | </div> |
643 | </v-container> | 653 | </v-container> |
644 | </template> | 654 | </template> |
645 | 655 | ||
646 | <script> | 656 | <script> |
647 | import http from "@/Services/http.js"; | 657 | import http from "@/Services/http.js"; |
648 | import moment from "moment"; | 658 | import moment from "moment"; |
649 | 659 | ||
650 | export default { | 660 | export default { |
651 | data: () => ({ | 661 | data: () => ({ |
652 | snackbar: false, | 662 | snackbar: false, |
653 | date: null, | 663 | date: null, |
654 | editDate: false, | 664 | editDate: false, |
655 | menu1: false, | 665 | menu1: false, |
656 | menuB: false, | 666 | menuB: false, |
657 | menu2: false, | 667 | menu2: false, |
658 | menuEdit: false, | 668 | menuEdit: false, |
659 | timeToEdit: false, | 669 | timeToEdit: false, |
660 | show: true, | 670 | show: true, |
661 | showSearch: false, | 671 | showSearch: false, |
662 | addExamScheduleDialog: false, | 672 | addExamScheduleDialog: false, |
663 | color: "", | 673 | color: "", |
664 | y: "top", | 674 | y: "top", |
665 | x: "right", | 675 | x: "right", |
666 | mode: "", | 676 | mode: "", |
667 | timeout: 10000, | 677 | timeout: 10000, |
668 | text: "", | 678 | text: "", |
669 | loading: false, | 679 | loading: false, |
670 | date: null, | 680 | date: null, |
671 | search: "", | 681 | search: "", |
672 | showLoader: false, | 682 | showLoader: false, |
673 | editExamScheduleDialog: false, | 683 | editExamScheduleDialog: false, |
674 | profileExamScheduleDialog: false, | 684 | profileExamScheduleDialog: false, |
675 | valid: true, | 685 | valid: true, |
676 | role: "", | 686 | role: "", |
677 | pagination: { | 687 | pagination: { |
678 | rowsPerPage: 10 | 688 | rowsPerPage: 10, |
679 | }, | 689 | }, |
680 | examRules: [v => !!v || "Exam Name is required"], | 690 | examRules: [(v) => !!v || "Exam Name is required"], |
681 | classRules: [v => !!v || "Class Name is required"], | 691 | classRules: [(v) => !!v || "Class Name is required"], |
682 | sectionRules: [v => !!v || "section is required"], | 692 | sectionRules: [(v) => !!v || "section is required"], |
683 | subjectRules: [v => !!v || "Subject is required"], | 693 | subjectRules: [(v) => !!v || "Subject is required"], |
684 | timeInRules: [v => !!v || "Time In is required"], | 694 | timeInRules: [(v) => !!v || "Time In is required"], |
685 | timeOutRules: [v => !!v || "time Out s is required"], | 695 | timeOutRules: [(v) => !!v || "time Out s is required"], |
686 | roomRules: [v => !!v || "Room is required"], | 696 | roomRules: [(v) => !!v || "Room is required"], |
687 | examScheduleDateRules: [v => !!v || "Date is required"], | 697 | examScheduleDateRules: [(v) => !!v || "Date is required"], |
688 | headers: [ | 698 | headers: [ |
689 | { | 699 | { |
690 | align: "", | 700 | align: "", |
691 | text: "No", | 701 | text: "No", |
692 | sortable: false, | 702 | sortable: false, |
693 | value: "No" | 703 | value: "No", |
694 | }, | 704 | }, |
695 | { | 705 | { |
696 | text: "Exam Name", | 706 | text: "Exam Name", |
697 | vaue: "examId.examName", | 707 | vaue: "examId.examName", |
698 | sortable: false, | 708 | sortable: false, |
699 | align: "center" | 709 | align: "center", |
700 | }, | 710 | }, |
701 | { | 711 | { |
702 | text: "Class", | 712 | text: "Class", |
703 | value: "classId.classNum", | 713 | value: "classId.classNum", |
704 | sortable: false, | 714 | sortable: false, |
705 | align: "center" | 715 | align: "center", |
706 | }, | 716 | }, |
707 | // { | 717 | // { |
708 | // text: "Section", | 718 | // text: "Section", |
709 | // value: "sectionId.name", | 719 | // value: "sectionId.name", |
710 | // sortable: false, | 720 | // sortable: false, |
711 | // align: "center" | 721 | // align: "center" |
712 | // }, | 722 | // }, |
713 | { | 723 | { |
714 | text: "Subject Name", | 724 | text: "Subject Name", |
715 | value: "subjectName", | 725 | value: "subjectName", |
716 | sortable: false, | 726 | sortable: false, |
717 | align: "center" | 727 | align: "center", |
718 | }, | 728 | }, |
719 | { | 729 | { |
720 | text: "Date", | 730 | text: "Date", |
721 | value: "date", | 731 | value: "date", |
722 | sortable: false, | 732 | sortable: false, |
723 | align: "center" | 733 | align: "center", |
724 | }, | 734 | }, |
725 | { | 735 | { |
726 | text: "Time", | 736 | text: "Time", |
727 | value: "timeFrom", | 737 | value: "timeFrom", |
728 | sortable: false, | 738 | sortable: false, |
729 | align: "center" | 739 | align: "center", |
730 | }, | 740 | }, |
731 | { | 741 | { |
732 | text: "Room", | 742 | text: "Room", |
733 | value: "room", | 743 | value: "room", |
734 | sortable: false, | 744 | sortable: false, |
735 | align: "center" | 745 | align: "center", |
736 | }, | 746 | }, |
737 | { text: "Action", value: "", sortable: false, align: "center" } | 747 | { text: "Action", value: "", sortable: false, align: "center" }, |
738 | ], | 748 | ], |
739 | classList: [], | 749 | classList: [], |
740 | addSection: [], | 750 | addSection: [], |
741 | examList: [], | 751 | examList: [], |
742 | subjects: [], | 752 | subjects: [], |
743 | addSchedule: {}, | 753 | addSchedule: {}, |
744 | editedItem: { | 754 | editedItem: { |
745 | sectionId: { | 755 | sectionId: { |
746 | name: "" | 756 | name: "", |
747 | } | 757 | }, |
748 | }, | 758 | }, |
749 | getScheduleData: {}, | 759 | getScheduleData: {}, |
750 | ScheduleData: [], | 760 | ScheduleData: [], |
751 | token: "" | 761 | token: "", |
752 | }), | 762 | }), |
763 | watch: { | ||
764 | addExamScheduleDialog: function (val) { | ||
765 | if (!val) { | ||
766 | this.addSchedule = []; | ||
767 | } | ||
768 | }, | ||
769 | }, | ||
753 | methods: { | 770 | methods: { |
754 | dates: function(date) { | 771 | dates: function (date) { |
755 | return moment(date).format("MMMM DD, YYYY"); | 772 | return moment(date).format("MMMM DD, YYYY"); |
756 | }, | 773 | }, |
757 | pickFile() { | 774 | pickFile() { |
758 | this.$refs.image.click(); | 775 | this.$refs.image.click(); |
759 | }, | 776 | }, |
760 | getSchedulesList() { | 777 | getSchedulesList() { |
761 | if (this.addSchedule.classId) { | 778 | if (this.addSchedule.classId) { |
762 | this.getScheduleData.classId = this.addSchedule.classId; | 779 | this.getScheduleData.classId = this.addSchedule.classId; |
763 | } | 780 | } |
764 | this.showLoader = true; | 781 | this.showLoader = true; |
765 | http() | 782 | http() |
766 | .get("/getSchedulesList", { | 783 | .get("/getSchedulesList", { |
767 | params: { | 784 | params: { |
768 | classId: this.getScheduleData.classId, | 785 | classId: this.getScheduleData.classId, |
769 | sectionId: this.getScheduleData.sectionId | 786 | sectionId: this.getScheduleData.sectionId, |
770 | }, | 787 | }, |
771 | headers: { Authorization: "Bearer " + this.token } | 788 | headers: { Authorization: "Bearer " + this.token }, |
772 | }) | 789 | }) |
773 | .then(response => { | 790 | .then((response) => { |
774 | this.ScheduleData = response.data.data; | 791 | this.ScheduleData = response.data.data; |
775 | // console.log("this.ScheduleData", this.ScheduleData); | 792 | // console.log("this.ScheduleData", this.ScheduleData); |
776 | this.showLoader = false; | 793 | this.showLoader = false; |
777 | }) | 794 | }) |
778 | .catch(error => { | 795 | .catch((error) => { |
779 | // console.log("err====>", err); | 796 | // console.log("err====>", err); |
780 | this.showLoader = false; | 797 | this.showLoader = false; |
781 | this.loadingSearch = false; | 798 | this.loadingSearch = false; |
782 | this.snackbar = true; | 799 | this.snackbar = true; |
783 | this.color = "error"; | 800 | this.color = "error"; |
784 | this.text = error.response.data.message; | 801 | this.text = error.response.data.message; |
785 | if (error.response.status === 401) { | 802 | if (error.response.status === 401) { |
786 | this.$router.replace({ path: "/" }); | 803 | this.$router.replace({ path: "/" }); |
787 | this.$store.dispatch("setToken", null); | 804 | this.$store.dispatch("setToken", null); |
788 | this.$store.dispatch("Id", null); | 805 | this.$store.dispatch("Id", null); |
789 | } | 806 | } |
790 | }); | 807 | }); |
791 | }, | 808 | }, |
792 | editItem(item) { | 809 | editItem(item) { |
793 | // console.log("item", item); | 810 | // console.log("item", item); |
794 | this.editedIndex = this.ScheduleData.indexOf(item); | 811 | this.editedIndex = this.ScheduleData.indexOf(item); |
795 | this.editedItem = Object.assign({}, item); | 812 | this.editedItem = Object.assign({}, item); |
796 | this.editedItem.examId = this.editedItem.examId._id; | 813 | this.editedItem.examId = this.editedItem.examId._id; |
797 | this.editedItem.classId = this.editedItem.classId._id; | 814 | this.editedItem.classId = this.editedItem.classId._id; |
798 | this.editedItem.sectionId = | 815 | this.editedItem.sectionId = |
799 | this.editedItem.sectionId === null | 816 | this.editedItem.sectionId === null |
800 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | 817 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") |
801 | : this.editedItem.sectionId._id; | 818 | : this.editedItem.sectionId._id; |
802 | this.editedItem.date = | 819 | this.editedItem.date = |
803 | this.editedItem.date != undefined | 820 | this.editedItem.date != undefined |
804 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 821 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
805 | : (this.editedItem.date = ""); | 822 | : (this.editedItem.date = ""); |
806 | this.editExamScheduleDialog = true; | 823 | this.editExamScheduleDialog = true; |
807 | }, | 824 | }, |
808 | profile(item) { | 825 | profile(item) { |
809 | this.editedIndex = this.ScheduleData.indexOf(item); | 826 | this.editedIndex = this.ScheduleData.indexOf(item); |
810 | this.editedItem = Object.assign({}, item); | 827 | this.editedItem = Object.assign({}, item); |
811 | this.editedItem.examId = this.editedItem.examId.examName; | 828 | this.editedItem.examId = this.editedItem.examId.examName; |
812 | this.editedItem.classId = this.editedItem.classId.classNum; | 829 | this.editedItem.classId = this.editedItem.classId.classNum; |
813 | this.editedItem.sectionId = | 830 | this.editedItem.sectionId = |
814 | this.editedItem.sectionId === null | 831 | this.editedItem.sectionId === null |
815 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") | 832 | ? (this.editedItem.sectionId = this.editedItem.sectionId = "") |
816 | : this.editedItem.sectionId.name; | 833 | : this.editedItem.sectionId.name; |
817 | this.profileExamScheduleDialog = true; | 834 | this.profileExamScheduleDialog = true; |
818 | }, | 835 | }, |
819 | deleteSchedule(item) { | 836 | deleteSchedule(item) { |
820 | let deleteSchedule = { | 837 | let deleteSchedule = { |
821 | scheduleId: item._id | 838 | scheduleId: item._id, |
822 | }; | 839 | }; |
823 | http() | 840 | http() |
824 | .delete( | 841 | .delete( |
825 | "/deleteSchedule", | 842 | "/deleteSchedule", |
826 | confirm("Are you sure you want to Delete this?") && { | 843 | confirm("Are you sure you want to Delete this?") && { |
827 | params: deleteSchedule | 844 | params: deleteSchedule, |
828 | } | 845 | } |
829 | ) | 846 | ) |
830 | .then(response => { | 847 | .then((response) => { |
831 | this.snackbar = true; | 848 | this.snackbar = true; |
832 | this.text = response.data.message; | 849 | this.text = response.data.message; |
833 | this.color = "green"; | 850 | this.color = "green"; |
834 | this.getSchedulesList(); | 851 | this.getSchedulesList(); |
835 | }) | 852 | }) |
836 | .catch(error => { | 853 | .catch((error) => { |
837 | this.snackbar = true; | 854 | this.snackbar = true; |
838 | this.color = "error"; | 855 | this.color = "error"; |
839 | this.text = error.response.data.message; | 856 | this.text = error.response.data.message; |
840 | }); | 857 | }); |
841 | }, | 858 | }, |
842 | close() { | 859 | close() { |
843 | this.dialog = false; | 860 | this.dialog = false; |
844 | }, | 861 | }, |
845 | submit() { | 862 | submit() { |
846 | if (this.$refs.form.validate()) { | 863 | if (this.$refs.form.validate()) { |
847 | this.loading = true; | 864 | this.loading = true; |
848 | http() | 865 | http() |
849 | .post("/createSchedule", this.addSchedule) | 866 | .post("/createSchedule", this.addSchedule) |
850 | .then(response => { | 867 | .then((response) => { |
851 | this.loading = false; | 868 | this.loading = false; |
852 | this.snackbar = true; | 869 | this.snackbar = true; |
853 | this.text = response.data.message; | 870 | this.text = response.data.message; |
854 | this.color = "green"; | 871 | this.color = "green"; |
855 | this.addExamScheduleDialog = false; | 872 | this.addExamScheduleDialog = false; |
856 | this.getSchedulesList(); | 873 | this.getSchedulesList(); |
857 | this.clear(); | 874 | this.clear(); |
858 | }) | 875 | }) |
859 | .catch(error => { | 876 | .catch((error) => { |
860 | this.snackbar = true; | 877 | this.snackbar = true; |
861 | this.text = error.response.data.message; | 878 | this.text = error.response.data.message; |
862 | this.color = "red"; | 879 | this.color = "red"; |
863 | this.loading = false; | 880 | this.loading = false; |
864 | }); | 881 | }); |
865 | } | 882 | } |
866 | }, | 883 | }, |
867 | clear() { | 884 | clear() { |
868 | this.$refs.form.reset(); | 885 | this.$refs.form.reset(); |
869 | this.disable = false; | 886 | this.disable = false; |
870 | this.loading = false; | 887 | this.loading = false; |
871 | }, | 888 | }, |
872 | update() { | 889 | update() { |
873 | this.editedItem.scheduleId = this.editedItem._id; | 890 | this.editedItem.scheduleId = this.editedItem._id; |
874 | http() | 891 | http() |
875 | .put("/updateSchedule", this.editedItem) | 892 | .put("/updateSchedule", this.editedItem) |
876 | .then(response => { | 893 | .then((response) => { |
877 | this.snackbar = true; | 894 | this.snackbar = true; |
878 | this.text = "Successfully Edit Exam Schedule"; | 895 | this.text = "Successfully Edit Exam Schedule"; |
879 | this.color = "green"; | 896 | this.color = "green"; |
880 | this.editExamScheduleDialog = false; | 897 | this.editExamScheduleDialog = false; |
881 | this.getSchedulesList(); | 898 | this.getSchedulesList(); |
882 | this.close(); | 899 | this.close(); |
883 | }) | 900 | }) |
884 | .catch(error => { | 901 | .catch((error) => { |
885 | this.snackbar = true; | 902 | this.snackbar = true; |
886 | this.text = error.response.data.messages; | 903 | this.text = error.response.data.messages; |
887 | this.color = "error"; | 904 | this.color = "error"; |
888 | this.loading = false; | 905 | this.loading = false; |
889 | }); | 906 | }); |
890 | }, | 907 | }, |
891 | getClass() { | 908 | getClass() { |
892 | http() | 909 | http() |
893 | .get("/getClassesList", { | 910 | .get("/getClassesList", { |
894 | headers: { Authorization: "Bearer " + this.token } | 911 | headers: { Authorization: "Bearer " + this.token }, |
895 | }) | 912 | }) |
896 | .then(response => { | 913 | .then((response) => { |
897 | this.classList = response.data.data; | 914 | this.classList = response.data.data; |
898 | }) | 915 | }) |
899 | .catch(err => { | 916 | .catch((err) => { |
900 | // console.log("err====>", err); | 917 | // console.log("err====>", err); |
901 | }); | 918 | }); |
902 | }, | 919 | }, |
903 | getSections(_id) { | 920 | getSections(_id) { |
904 | for (let i = 0; i < this.classList.length; i++) { | 921 | for (let i = 0; i < this.classList.length; i++) { |
905 | if (_id == this.classList[i]._id) { | 922 | if (_id == this.classList[i]._id) { |
906 | this.subjects = this.classList[i].subjects; | 923 | this.subjects = this.classList[i].subjects; |
907 | } | 924 | } |
908 | } | 925 | } |
909 | http() | 926 | http() |
910 | .get( | 927 | .get( |
911 | "/getSectionsList", | 928 | "/getSectionsList", |
912 | { params: { classId: _id } }, | 929 | { params: { classId: _id } }, |
913 | { | 930 | { |
914 | headers: { Authorization: "Bearer " + this.token } | 931 | headers: { Authorization: "Bearer " + this.token }, |
915 | } | 932 | } |
916 | ) | 933 | ) |
917 | .then(response => { | 934 | .then((response) => { |
918 | this.addSection = response.data.data; | 935 | this.addSection = response.data.data; |
919 | }) | 936 | }) |
920 | .catch(err => {}); | 937 | .catch((err) => {}); |
921 | }, | 938 | }, |
922 | getExamList() { | 939 | getExamList() { |
923 | this.showLoader = true; | 940 | this.showLoader = true; |
924 | this.loadingSearch = true; | 941 | this.loadingSearch = true; |
925 | http() | 942 | http() |
926 | .get("/getExamsList", { | 943 | .get("/getExamsList", { |
927 | headers: { Authorization: "Bearer " + this.token } | 944 | headers: { Authorization: "Bearer " + this.token }, |
928 | }) | 945 | }) |
929 | .then(response => { | 946 | .then((response) => { |
930 | this.examList = response.data.data; | 947 | this.examList = response.data.data; |
931 | this.showLoader = false; | 948 | this.showLoader = false; |
932 | this.loadingSearch = false; | 949 | this.loadingSearch = false; |
933 | }) | 950 | }) |
934 | .catch(error => { | 951 | .catch((error) => { |
935 | this.showLoader = false; | 952 | this.showLoader = false; |
936 | this.loadingSearch = false; | 953 | this.loadingSearch = false; |
937 | this.snackbar = true; | 954 | this.snackbar = true; |
938 | this.text = error.response.data.message; | 955 | this.text = error.response.data.message; |
939 | if (error.response.status === 401) { | 956 | if (error.response.status === 401) { |
940 | this.$router.replace({ path: "/" }); | 957 | this.$router.replace({ path: "/" }); |
941 | this.$store.dispatch("setToken", null); | 958 | this.$store.dispatch("setToken", null); |
942 | this.$store.dispatch("Id", null); | 959 | this.$store.dispatch("Id", null); |
943 | } | 960 | } |
944 | }); | 961 | }); |
945 | }, | 962 | }, |
946 | displaySearch() { | 963 | displaySearch() { |
947 | (this.show = false), (this.showSearch = true); | 964 | (this.show = false), (this.showSearch = true); |
948 | }, | 965 | }, |
949 | closeSearch() { | 966 | closeSearch() { |
950 | this.showSearch = false; | 967 | this.showSearch = false; |
951 | this.show = true; | 968 | this.show = true; |
952 | this.search = ""; | 969 | this.search = ""; |
953 | } | 970 | }, |
954 | }, | 971 | }, |
955 | mounted() { | 972 | mounted() { |
956 | this.token = this.$store.state.token; | 973 | this.token = this.$store.state.token; |
957 | this.getClass(); | 974 | this.getClass(); |
958 | this.getExamList(); | 975 | this.getExamList(); |
959 | this.role = this.$store.state.role; | 976 | this.role = this.$store.state.role; |
960 | } | 977 | }, |
961 | }; | 978 | }; |
962 | </script> | 979 | </script> |
src/pages/Exam/grade.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT GRADE ****** --> | 3 | <!-- ****** EDIT GRADE ****** --> |
4 | <v-dialog v-model="editGradeDialog" max-width="500px"> | 4 | <v-dialog v-model="editGradeDialog" 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 Grade</label> | 8 | <label class="title text-xs-center">Edit Grade</label> |
9 | <v-icon size="24" class="right" @click="editGradeDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editGradeDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-form ref="formEditGrade" v-model="validEditGrade" lazy-validation> | 12 | <v-form ref="formEditGrade" v-model="validEditGrade" lazy-validation> |
13 | <v-container fluid> | 13 | <v-container fluid> |
14 | <v-layout wrap> | 14 | <v-layout wrap> |
15 | <v-flex xs12 sm12> | 15 | <v-flex xs12 sm12> |
16 | <v-layout> | 16 | <v-layout> |
17 | <v-flex xs4 class="pt-4 subheading"> | 17 | <v-flex xs4 class="pt-4 subheading"> |
18 | <label class="right">Grade Name:</label> | 18 | <label class="right">Grade Name:</label> |
19 | </v-flex> | 19 | </v-flex> |
20 | <v-flex xs7 class="ml-3"> | 20 | <v-flex xs7 class="ml-3"> |
21 | <v-text-field | 21 | <v-text-field |
22 | placeholder="fill your Grade Name" | 22 | placeholder="fill your Grade Name" |
23 | v-model="editedItem.gradeName" | 23 | v-model="editedItem.gradeName" |
24 | type="text" | 24 | type="text" |
25 | :rules="editGradeName" | 25 | :rules="editGradeName" |
26 | ></v-text-field> | 26 | ></v-text-field> |
27 | </v-flex> | 27 | </v-flex> |
28 | </v-layout> | 28 | </v-layout> |
29 | </v-flex> | 29 | </v-flex> |
30 | <v-flex xs12 sm12> | 30 | <v-flex xs12 sm12> |
31 | <v-layout> | 31 | <v-layout> |
32 | <v-flex xs4 class="pt-4 subheading"> | 32 | <v-flex xs4 class="pt-4 subheading"> |
33 | <label class="right">Grade Point:</label> | 33 | <label class="right">Grade Point:</label> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex xs7 class="ml-3"> | 35 | <v-flex xs7 class="ml-3"> |
36 | <v-text-field | 36 | <v-text-field |
37 | placeholder="fill your Grade Point" | 37 | placeholder="fill your Grade Point" |
38 | v-model="editedItem.gradePoint" | 38 | v-model="editedItem.gradePoint" |
39 | :rules="editGradePoint" | 39 | :rules="editGradePoint" |
40 | type="text" | 40 | type="text" |
41 | ></v-text-field> | 41 | ></v-text-field> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | </v-flex> | 44 | </v-flex> |
45 | <v-flex xs12 sm12> | 45 | <v-flex xs12 sm12> |
46 | <v-layout> | 46 | <v-layout> |
47 | <v-flex xs4 class="pt-4 subheading"> | 47 | <v-flex xs4 class="pt-4 subheading"> |
48 | <label class="right">Mark From:</label> | 48 | <label class="right">Mark From:</label> |
49 | </v-flex> | 49 | </v-flex> |
50 | <v-flex xs7 class="ml-3"> | 50 | <v-flex xs7 class="ml-3"> |
51 | <v-text-field | 51 | <v-text-field |
52 | placeholder="fill your Mark From" | 52 | placeholder="fill your Mark From" |
53 | v-model="editedItem.marksFrom" | 53 | v-model="editedItem.marksFrom" |
54 | :rules="editMarksFrom" | 54 | :rules="editMarksFrom" |
55 | type="text" | 55 | type="text" |
56 | ></v-text-field> | 56 | ></v-text-field> |
57 | </v-flex> | 57 | </v-flex> |
58 | </v-layout> | 58 | </v-layout> |
59 | </v-flex> | 59 | </v-flex> |
60 | <v-flex xs12 sm12> | 60 | <v-flex xs12 sm12> |
61 | <v-layout> | 61 | <v-layout> |
62 | <v-flex xs4 class="pt-4 subheading"> | 62 | <v-flex xs4 class="pt-4 subheading"> |
63 | <label class="right">Mark Upto:</label> | 63 | <label class="right">Mark Upto:</label> |
64 | </v-flex> | 64 | </v-flex> |
65 | <v-flex xs7 class="ml-3"> | 65 | <v-flex xs7 class="ml-3"> |
66 | <v-text-field | 66 | <v-text-field |
67 | placeholder="fill your Mark From" | 67 | placeholder="fill your Mark From" |
68 | v-model="editedItem.marksUpTo" | 68 | v-model="editedItem.marksUpTo" |
69 | :rules="editMarksUpTo" | 69 | :rules="editMarksUpTo" |
70 | type="text" | 70 | type="text" |
71 | ></v-text-field> | 71 | ></v-text-field> |
72 | </v-flex> | 72 | </v-flex> |
73 | </v-layout> | 73 | </v-layout> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-flex xs12 sm12> | 75 | <v-flex xs12 sm12> |
76 | <v-layout> | 76 | <v-layout> |
77 | <v-flex xs4 class="pt-4 subheading"> | 77 | <v-flex xs4 class="pt-4 subheading"> |
78 | <label class="right">Note:</label> | 78 | <label class="right">Note:</label> |
79 | </v-flex> | 79 | </v-flex> |
80 | <v-flex xs7 class="ml-3"> | 80 | <v-flex xs7 class="ml-3"> |
81 | <v-text-field | 81 | <v-text-field |
82 | placeholder="fill your Serial Number" | 82 | placeholder="fill your Serial Number" |
83 | v-model="editedItem.note" | 83 | v-model="editedItem.note" |
84 | type="text" | 84 | type="text" |
85 | ></v-text-field> | 85 | ></v-text-field> |
86 | </v-flex> | 86 | </v-flex> |
87 | </v-layout> | 87 | </v-layout> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-layout> | 89 | </v-layout> |
90 | <v-layout> | 90 | <v-layout> |
91 | <v-flex xs12> | 91 | <v-flex xs12> |
92 | <v-card-actions> | 92 | <v-card-actions> |
93 | <v-spacer></v-spacer> | 93 | <v-spacer></v-spacer> |
94 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 94 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
95 | </v-card-actions> | 95 | </v-card-actions> |
96 | </v-flex> | 96 | </v-flex> |
97 | </v-layout> | 97 | </v-layout> |
98 | </v-container> | 98 | </v-container> |
99 | </v-form> | 99 | </v-form> |
100 | </v-card> | 100 | </v-card> |
101 | </v-dialog> | 101 | </v-dialog> |
102 | 102 | ||
103 | <!-- ****** PROFILE VIEW PARTICULAR GRDAE DATA ****** --> | 103 | <!-- ****** PROFILE VIEW PARTICULAR GRDAE DATA ****** --> |
104 | 104 | ||
105 | <v-dialog v-model="viewGradeDialog" max-width="500px"> | 105 | <v-dialog v-model="viewGradeDialog" max-width="500px"> |
106 | <v-card flat class="card-style pa-3" dark> | 106 | <v-card flat class="card-style pa-3" dark> |
107 | <v-layout> | 107 | <v-layout> |
108 | <v-flex xs12> | 108 | <v-flex xs12> |
109 | <label class="title text-xs-center">View Grade</label> | 109 | <label class="title text-xs-center">View Grade</label> |
110 | <v-icon size="24" class="right" @click="viewGradeDialog = false">cancel</v-icon> | 110 | <v-icon size="24" class="right" @click="viewGradeDialog = false">cancel</v-icon> |
111 | </v-flex> | 111 | </v-flex> |
112 | </v-layout> | 112 | </v-layout> |
113 | <v-card-text> | 113 | <v-card-text> |
114 | <v-container grid-list-md> | 114 | <v-container grid-list-md> |
115 | <v-layout wrap> | 115 | <v-layout wrap> |
116 | <v-flex> | 116 | <v-flex> |
117 | <v-layout> | 117 | <v-layout> |
118 | <v-flex xs5 sm6> | 118 | <v-flex xs5 sm6> |
119 | <h5 class="right my-1"> | 119 | <h5 class="right my-1"> |
120 | <b>Grade Name:</b> | 120 | <b>Grade Name:</b> |
121 | </h5> | 121 | </h5> |
122 | </v-flex> | 122 | </v-flex> |
123 | <v-flex sm6 xs8> | 123 | <v-flex sm6 xs8> |
124 | <h5 class="my-1">{{ editedItem.gradeName }}</h5> | 124 | <h5 class="my-1">{{ editedItem.gradeName }}</h5> |
125 | </v-flex> | 125 | </v-flex> |
126 | </v-layout> | 126 | </v-layout> |
127 | <v-layout> | 127 | <v-layout> |
128 | <v-flex xs5 sm6> | 128 | <v-flex xs5 sm6> |
129 | <h5 class="right my-1"> | 129 | <h5 class="right my-1"> |
130 | <b>Grade Point:</b> | 130 | <b>Grade Point:</b> |
131 | </h5> | 131 | </h5> |
132 | </v-flex> | 132 | </v-flex> |
133 | <v-flex sm6 xs8> | 133 | <v-flex sm6 xs8> |
134 | <h5 class="my-1">{{ editedItem.gradePoint }}</h5> | 134 | <h5 class="my-1">{{ editedItem.gradePoint }}</h5> |
135 | </v-flex> | 135 | </v-flex> |
136 | </v-layout> | 136 | </v-layout> |
137 | <v-layout> | 137 | <v-layout> |
138 | <v-flex xs5 sm6> | 138 | <v-flex xs5 sm6> |
139 | <h5 class="right my-1"> | 139 | <h5 class="right my-1"> |
140 | <b>Mark From:</b> | 140 | <b>Mark From:</b> |
141 | </h5> | 141 | </h5> |
142 | </v-flex> | 142 | </v-flex> |
143 | <v-flex sm6 xs8> | 143 | <v-flex sm6 xs8> |
144 | <h5 class="my-1">{{ editedItem.marksFrom }}</h5> | 144 | <h5 class="my-1">{{ editedItem.marksFrom }}</h5> |
145 | </v-flex> | 145 | </v-flex> |
146 | </v-layout> | 146 | </v-layout> |
147 | <v-layout> | 147 | <v-layout> |
148 | <v-flex xs5 sm6> | 148 | <v-flex xs5 sm6> |
149 | <h5 class="right my-1"> | 149 | <h5 class="right my-1"> |
150 | <b>Mark Upto:</b> | 150 | <b>Mark Upto:</b> |
151 | </h5> | 151 | </h5> |
152 | </v-flex> | 152 | </v-flex> |
153 | <v-flex sm6 xs8> | 153 | <v-flex sm6 xs8> |
154 | <h5 class="my-1">{{ editedItem.marksUpTo }}</h5> | 154 | <h5 class="my-1">{{ editedItem.marksUpTo }}</h5> |
155 | </v-flex> | 155 | </v-flex> |
156 | </v-layout> | 156 | </v-layout> |
157 | <v-layout> | 157 | <v-layout> |
158 | <v-flex xs5 sm6> | 158 | <v-flex xs5 sm6> |
159 | <h5 class="right my-1"> | 159 | <h5 class="right my-1"> |
160 | <b>Note:</b> | 160 | <b>Note:</b> |
161 | </h5> | 161 | </h5> |
162 | </v-flex> | 162 | </v-flex> |
163 | <v-flex sm6 xs8> | 163 | <v-flex sm6 xs8> |
164 | <h5 class="my-1">{{ editedItem.note }}</h5> | 164 | <h5 class="my-1">{{ editedItem.note }}</h5> |
165 | </v-flex> | 165 | </v-flex> |
166 | </v-layout> | 166 | </v-layout> |
167 | </v-flex> | 167 | </v-flex> |
168 | </v-layout> | 168 | </v-layout> |
169 | </v-container> | 169 | </v-container> |
170 | </v-card-text> | 170 | </v-card-text> |
171 | </v-card> | 171 | </v-card> |
172 | </v-dialog> | 172 | </v-dialog> |
173 | <!-- ****** EXISTING GRADE TABLE****** --> | 173 | <!-- ****** EXISTING GRADE TABLE****** --> |
174 | 174 | ||
175 | <v-toolbar color="transparent" flat> | 175 | <v-toolbar color="transparent" flat> |
176 | <v-btn | 176 | <v-btn |
177 | fab | 177 | fab |
178 | dark | 178 | dark |
179 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 179 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
180 | small | 180 | small |
181 | @click="addGradeDialog = true" | 181 | @click="addGradeDialog = true" |
182 | > | 182 | > |
183 | <v-icon dark>add</v-icon> | 183 | <v-icon dark>add</v-icon> |
184 | </v-btn> | 184 | </v-btn> |
185 | <v-btn | 185 | <v-btn |
186 | round | 186 | round |
187 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 187 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
188 | dark | 188 | dark |
189 | @click="addGradeDialog = true" | 189 | @click="addGradeDialog = true" |
190 | > | 190 | > |
191 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Grade | 191 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Grade |
192 | </v-btn> | 192 | </v-btn> |
193 | <v-spacer></v-spacer> | 193 | <v-spacer></v-spacer> |
194 | <v-card-title class="body-1" v-show="show"> | 194 | <v-card-title class="body-1" v-show="show"> |
195 | <v-btn icon large flat @click="displaySearch"> | 195 | <v-btn icon large flat @click="displaySearch"> |
196 | <v-avatar size="27"> | 196 | <v-avatar size="27"> |
197 | <img src="/static/icon/search.png" alt="icon" /> | 197 | <img src="/static/icon/search.png" alt="icon" /> |
198 | </v-avatar> | 198 | </v-avatar> |
199 | </v-btn> | 199 | </v-btn> |
200 | </v-card-title> | 200 | </v-card-title> |
201 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 201 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
202 | <v-layout> | 202 | <v-layout> |
203 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 203 | <v-text-field |
204 | autofocus | ||
205 | v-model="search" | ||
206 | label="Search" | ||
207 | prepend-inner-icon="search" | ||
208 | color="primary" | ||
209 | ></v-text-field> | ||
204 | <v-icon @click="closeSearch" color="error">close</v-icon> | 210 | <v-icon @click="closeSearch" color="error">close</v-icon> |
205 | </v-layout> | 211 | </v-layout> |
206 | </v-flex> | 212 | </v-flex> |
207 | </v-toolbar> | 213 | </v-toolbar> |
208 | <v-data-table | 214 | <v-data-table |
209 | :headers="headers" | 215 | :headers="headers" |
210 | :items="gradeData" | 216 | :items="gradeData" |
211 | :pagination.sync="pagination" | 217 | :pagination.sync="pagination" |
212 | :search="search" | 218 | :search="search" |
213 | > | 219 | > |
214 | <template slot="items" slot-scope="props"> | 220 | <template slot="items" slot-scope="props"> |
215 | <tr class="tr"> | 221 | <tr class="tr"> |
216 | <td class="td td-row">{{ props.index + 1}}</td> | 222 | <td class="td td-row">{{ props.index + 1}}</td> |
217 | <td class="td td-row text-xs-center">{{ props.item.gradeName}}</td> | 223 | <td class="td td-row text-xs-center">{{ props.item.gradeName}}</td> |
218 | <td class="td td-row text-xs-center">{{ props.item.gradePoint }}</td> | 224 | <td class="td td-row text-xs-center">{{ props.item.gradePoint }}</td> |
219 | <td class="td td-row text-xs-center">{{ props.item.marksFrom }}</td> | 225 | <td class="td td-row text-xs-center">{{ props.item.marksFrom }}</td> |
220 | <td class="td td-row text-xs-center">{{ props.item.marksUpTo }}</td> | 226 | <td class="td td-row text-xs-center">{{ props.item.marksUpTo }}</td> |
221 | <td class="td td-row text-xs-center">{{ props.item.note }}</td> | 227 | <td class="td td-row text-xs-center">{{ props.item.note }}</td> |
222 | <td class="td td-row text-xs-center"> | 228 | <td class="td td-row text-xs-center"> |
223 | <span> | 229 | <span> |
224 | <v-tooltip top> | 230 | <v-tooltip top> |
225 | <img | 231 | <img |
226 | slot="activator" | 232 | slot="activator" |
227 | style="cursor:pointer; width:25px; height:25px; " | 233 | style="cursor:pointer; width:25px; height:25px; " |
228 | class="mr-3" | 234 | class="mr-3" |
229 | @click="profile(props.item)" | 235 | @click="profile(props.item)" |
230 | src="/static/icon/view.png" | 236 | src="/static/icon/view.png" |
231 | /> | 237 | /> |
232 | <span>View</span> | 238 | <span>View</span> |
233 | </v-tooltip> | 239 | </v-tooltip> |
234 | <v-tooltip top> | 240 | <v-tooltip top> |
235 | <img | 241 | <img |
236 | slot="activator" | 242 | slot="activator" |
237 | style="cursor:pointer; width:20px; height:18px; " | 243 | style="cursor:pointer; width:20px; height:18px; " |
238 | class="mr-3" | 244 | class="mr-3" |
239 | @click="editItem(props.item)" | 245 | @click="editItem(props.item)" |
240 | src="/static/icon/edit.png" | 246 | src="/static/icon/edit.png" |
241 | /> | 247 | /> |
242 | <span>Edit</span> | 248 | <span>Edit</span> |
243 | </v-tooltip> | 249 | </v-tooltip> |
244 | <v-tooltip top> | 250 | <v-tooltip top> |
245 | <img | 251 | <img |
246 | slot="activator" | 252 | slot="activator" |
247 | style="cursor:pointer; width:20px; height:20px; " | 253 | style="cursor:pointer; width:20px; height:20px; " |
248 | @click="deleteGrade(props.item)" | 254 | @click="deleteGrade(props.item)" |
249 | class="mr-3" | 255 | class="mr-3" |
250 | src="/static/icon/delete.png" | 256 | src="/static/icon/delete.png" |
251 | /> | 257 | /> |
252 | <span>Delete</span> | 258 | <span>Delete</span> |
253 | </v-tooltip> | 259 | </v-tooltip> |
254 | </span> | 260 | </span> |
255 | </td> | 261 | </td> |
256 | </tr> | 262 | </tr> |
257 | </template> | 263 | </template> |
258 | <v-alert | 264 | <v-alert |
259 | slot="no-results" | 265 | slot="no-results" |
260 | :value="true" | 266 | :value="true" |
261 | color="error" | 267 | color="error" |
262 | icon="warning" | 268 | icon="warning" |
263 | >Your search for "{{ search }}" found no results.</v-alert> | 269 | >Your search for "{{ search }}" found no results.</v-alert> |
264 | </v-data-table> | 270 | </v-data-table> |
265 | <!-- ****** ADD GRADE ****** --> | 271 | <!-- ****** ADD GRADE ****** --> |
266 | <v-dialog v-model="addGradeDialog" max-width="500px"> | 272 | <v-dialog v-model="addGradeDialog" max-width="500px" v-if="addGradeDialog"> |
267 | <v-card flat class="card-style pa-2" dark> | 273 | <v-card flat class="card-style pa-2" dark> |
268 | <v-layout> | 274 | <v-layout> |
269 | <v-flex xs12> | 275 | <v-flex xs12> |
270 | <label class="title text-xs-center">Add Grade</label> | 276 | <label class="title text-xs-center">Add Grade</label> |
271 | <v-icon size="24" class="right" @click="$refs.form.reset();addGradeDialog = false">cancel</v-icon> | 277 | <v-icon |
278 | size="24" | ||
279 | class="right" | ||
280 | @click="$refs.form.reset();addGradeDialog = false" | ||
281 | >cancel</v-icon> | ||
272 | </v-flex> | 282 | </v-flex> |
273 | </v-layout> | 283 | </v-layout> |
274 | <v-form ref="form" v-model="valid" lazy-validation> | 284 | <v-form ref="form" v-model="valid" lazy-validation> |
275 | <v-container fluid> | 285 | <v-container fluid> |
276 | <v-flex xs12> | 286 | <v-flex xs12> |
277 | <v-layout> | 287 | <v-layout> |
278 | <v-flex xs5 sm4 class="pt-4 subheading"> | 288 | <v-flex xs5 sm4 class="pt-4 subheading"> |
279 | <label class="right">Grade Name:</label> | 289 | <label class="right">Grade Name:</label> |
280 | </v-flex> | 290 | </v-flex> |
281 | <v-flex xs7 class="ml-3"> | 291 | <v-flex xs7 class="ml-3"> |
282 | <v-text-field | 292 | <v-text-field |
283 | placeholder="fill your Grade Name" | 293 | placeholder="fill your Grade Name" |
284 | :rules="gradeNameRules" | 294 | :rules="gradeNameRules" |
285 | v-model="addGrade.gradeName" | 295 | v-model="addGrade.gradeName" |
286 | ></v-text-field> | 296 | ></v-text-field> |
287 | </v-flex> | 297 | </v-flex> |
288 | </v-layout> | 298 | </v-layout> |
289 | </v-flex> | 299 | </v-flex> |
290 | <v-flex xs12> | 300 | <v-flex xs12> |
291 | <v-layout> | 301 | <v-layout> |
292 | <v-flex xs5 sm4 class="pt-4 subheading"> | 302 | <v-flex xs5 sm4 class="pt-4 subheading"> |
293 | <label class="right">Grade Point:</label> | 303 | <label class="right">Grade Point:</label> |
294 | </v-flex> | 304 | </v-flex> |
295 | <v-flex xs7 class="ml-3"> | 305 | <v-flex xs7 class="ml-3"> |
296 | <v-text-field | 306 | <v-text-field |
297 | placeholder="fill your Grade Point" | 307 | placeholder="fill your Grade Point" |
298 | v-model="addGrade.gradePoint" | 308 | v-model="addGrade.gradePoint" |
299 | :rules="gradePointRules" | 309 | :rules="gradePointRules" |
300 | ></v-text-field> | 310 | ></v-text-field> |
301 | </v-flex> | 311 | </v-flex> |
302 | </v-layout> | 312 | </v-layout> |
303 | </v-flex> | 313 | </v-flex> |
304 | <v-flex xs12> | 314 | <v-flex xs12> |
305 | <v-layout> | 315 | <v-layout> |
306 | <v-flex xs5 sm4 class="pt-4 subheading"> | 316 | <v-flex xs5 sm4 class="pt-4 subheading"> |
307 | <label class="right">Mark From:</label> | 317 | <label class="right">Mark From:</label> |
308 | </v-flex> | 318 | </v-flex> |
309 | <v-flex xs7 class="ml-3"> | 319 | <v-flex xs7 class="ml-3"> |
310 | <v-text-field | 320 | <v-text-field |
311 | placeholder="fill your Mark From" | 321 | placeholder="fill your Mark From" |
312 | :rules="markFromRules" | 322 | :rules="markFromRules" |
313 | v-model="addGrade.marksFrom" | 323 | v-model="addGrade.marksFrom" |
314 | type="number" | 324 | type="number" |
315 | ></v-text-field> | 325 | ></v-text-field> |
316 | </v-flex> | 326 | </v-flex> |
317 | </v-layout> | 327 | </v-layout> |
318 | </v-flex> | 328 | </v-flex> |
319 | <v-flex xs12> | 329 | <v-flex xs12> |
320 | <v-layout> | 330 | <v-layout> |
321 | <v-flex xs5 sm4 class="pt-4 subheading"> | 331 | <v-flex xs5 sm4 class="pt-4 subheading"> |
322 | <label class="right">Mark Upto:</label> | 332 | <label class="right">Mark Upto:</label> |
323 | </v-flex> | 333 | </v-flex> |
324 | <v-flex xs7 class="ml-3"> | 334 | <v-flex xs7 class="ml-3"> |
325 | <v-text-field | 335 | <v-text-field |
326 | placeholder="fill your Mark Upto" | 336 | placeholder="fill your Mark Upto" |
327 | :rules="markUptoRules" | 337 | :rules="markUptoRules" |
328 | v-model="addGrade.marksUpTo" | 338 | v-model="addGrade.marksUpTo" |
329 | type="number" | 339 | type="number" |
330 | ></v-text-field> | 340 | ></v-text-field> |
331 | </v-flex> | 341 | </v-flex> |
332 | </v-layout> | 342 | </v-layout> |
333 | </v-flex> | 343 | </v-flex> |
334 | <v-flex xs12> | 344 | <v-flex xs12> |
335 | <v-layout> | 345 | <v-layout> |
336 | <v-flex xs5 sm4 class="pt-4 subheading"> | 346 | <v-flex xs5 sm4 class="pt-4 subheading"> |
337 | <label class="right">Note:</label> | 347 | <label class="right">Note:</label> |
338 | </v-flex> | 348 | </v-flex> |
339 | <v-flex xs7 class="ml-3"> | 349 | <v-flex xs7 class="ml-3"> |
340 | <v-text-field | 350 | <v-text-field |
341 | placeholder="fill your Note" | 351 | placeholder="fill your Note" |
342 | :rules="noteRules" | 352 | :rules="noteRules" |
343 | v-model="addGrade.note" | 353 | v-model="addGrade.note" |
344 | @keyup.enter="submit" | 354 | @keyup.enter="submit" |
345 | ></v-text-field> | 355 | ></v-text-field> |
346 | </v-flex> | 356 | </v-flex> |
347 | </v-layout> | 357 | </v-layout> |
348 | </v-flex> | 358 | </v-flex> |
349 | <v-layout> | 359 | <v-layout> |
350 | <v-flex xs12> | 360 | <v-flex xs12> |
351 | <v-card-actions> | 361 | <v-card-actions> |
352 | <v-spacer class="hidden-xs-only"></v-spacer> | 362 | <v-spacer class="hidden-xs-only"></v-spacer> |
353 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> | 363 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> |
354 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 364 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
355 | </v-card-actions> | 365 | </v-card-actions> |
356 | </v-flex> | 366 | </v-flex> |
357 | </v-layout> | 367 | </v-layout> |
358 | </v-container> | 368 | </v-container> |
359 | </v-form> | 369 | </v-form> |
360 | </v-card> | 370 | </v-card> |
361 | </v-dialog> | 371 | </v-dialog> |
362 | <v-snackbar | 372 | <v-snackbar |
363 | :timeout="timeout" | 373 | :timeout="timeout" |
364 | :top="y === 'top'" | 374 | :top="y === 'top'" |
365 | :right="x === 'right'" | 375 | :right="x === 'right'" |
366 | :vertical="mode === 'vertical'" | 376 | :vertical="mode === 'vertical'" |
367 | v-model="snackbar" | 377 | v-model="snackbar" |
368 | :color="color" | 378 | :color="color" |
369 | >{{ text }}</v-snackbar> | 379 | >{{ text }}</v-snackbar> |
370 | <div class="loader" v-if="showLoader"> | 380 | <div class="loader" v-if="showLoader"> |
371 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 381 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
372 | </div> | 382 | </div> |
373 | </v-container> | 383 | </v-container> |
374 | </template> | 384 | </template> |
375 | 385 | ||
376 | <script> | 386 | <script> |
377 | import http from "@/Services/http.js"; | 387 | import http from "@/Services/http.js"; |
378 | import moment from "moment"; | 388 | import moment from "moment"; |
379 | 389 | ||
380 | export default { | 390 | export default { |
381 | data: () => ({ | 391 | data: () => ({ |
382 | snackbar: false, | 392 | snackbar: false, |
383 | date: null, | 393 | date: null, |
384 | menu1: false, | 394 | menu1: false, |
385 | menu2: false, | 395 | menu2: false, |
386 | addGradeDialog: false, | 396 | addGradeDialog: false, |
387 | color: "", | 397 | color: "", |
388 | y: "top", | 398 | y: "top", |
389 | x: "right", | 399 | x: "right", |
390 | mode: "", | 400 | mode: "", |
391 | timeout: 10000, | 401 | timeout: 10000, |
392 | text: "", | 402 | text: "", |
393 | show: true, | 403 | show: true, |
394 | showSearch: false, | 404 | showSearch: false, |
395 | loading: false, | 405 | loading: false, |
396 | loadingSearch: false, | 406 | loadingSearch: false, |
397 | date: null, | 407 | date: null, |
398 | search: "", | 408 | search: "", |
399 | showLoader: false, | 409 | showLoader: false, |
400 | editGradeDialog: false, | 410 | editGradeDialog: false, |
401 | viewGradeDialog: false, | 411 | viewGradeDialog: false, |
402 | valid: true, | 412 | valid: true, |
403 | validEditGrade: true, | 413 | validEditGrade: true, |
404 | pagination: { | 414 | pagination: { |
405 | rowsPerPage: 10 | 415 | rowsPerPage: 10, |
406 | }, | 416 | }, |
407 | gradeNameRules: [v => !!v || "Grade Name is required"], | 417 | gradeNameRules: [(v) => !!v || "Grade Name is required"], |
408 | gradePointRules: [v => !!v || "Grade Point required"], | 418 | gradePointRules: [(v) => !!v || "Grade Point required"], |
409 | markFromRules: [v => !!v || "Mark From is required"], | 419 | markFromRules: [(v) => !!v || "Mark From is required"], |
410 | markUptoRules: [v => !!v || "Mark Upto is required"], | 420 | markUptoRules: [(v) => !!v || "Mark Upto is required"], |
411 | authorRules: [v => !!v || "Author is required"], | 421 | authorRules: [(v) => !!v || "Author is required"], |
412 | noteRules: [v => !!v || "Note is required"], | 422 | noteRules: [(v) => !!v || "Note is required"], |
413 | editGradeName: [v => !!v || "Grade Name is required"], | 423 | editGradeName: [(v) => !!v || "Grade Name is required"], |
414 | editGradeName: [v => !!v || "Grade Name is required"], | 424 | editGradeName: [(v) => !!v || "Grade Name is required"], |
415 | editGradePoint: [v => !!v || "Grade Point required"], | 425 | editGradePoint: [(v) => !!v || "Grade Point required"], |
416 | editMarksFrom: [v => !!v || "Mark From is required"], | 426 | editMarksFrom: [(v) => !!v || "Mark From is required"], |
417 | editMarksUpTo: [v => !!v || "Mark Upto is required"], | 427 | editMarksUpTo: [(v) => !!v || "Mark Upto is required"], |
418 | headers: [ | 428 | headers: [ |
419 | { | 429 | { |
420 | align: "", | 430 | align: "", |
421 | text: "No", | 431 | text: "No", |
422 | sortable: false, | 432 | sortable: false, |
423 | value: "No" | 433 | value: "No", |
424 | }, | 434 | }, |
425 | { | 435 | { |
426 | text: "Grade Name", | 436 | text: "Grade Name", |
427 | vaue: "gradeName", | 437 | vaue: "gradeName", |
428 | sortable: false, | 438 | sortable: false, |
429 | align: "center" | 439 | align: "center", |
430 | }, | 440 | }, |
431 | { | 441 | { |
432 | text: "Grade Point", | 442 | text: "Grade Point", |
433 | value: "gradePoint", | 443 | value: "gradePoint", |
434 | sortable: false, | 444 | sortable: false, |
435 | align: "center" | 445 | align: "center", |
436 | }, | 446 | }, |
437 | { | 447 | { |
438 | text: "Mark From", | 448 | text: "Mark From", |
439 | value: "marksFrom", | 449 | value: "marksFrom", |
440 | sortable: false, | 450 | sortable: false, |
441 | align: "center" | 451 | align: "center", |
442 | }, | 452 | }, |
443 | { | 453 | { |
444 | text: "Mark Upto", | 454 | text: "Mark Upto", |
445 | value: "marksUpTo", | 455 | value: "marksUpTo", |
446 | sortable: false, | 456 | sortable: false, |
447 | align: "center" | 457 | align: "center", |
448 | }, | 458 | }, |
449 | { | 459 | { |
450 | text: "Note", | 460 | text: "Note", |
451 | value: "note", | 461 | value: "note", |
452 | sortable: false, | 462 | sortable: false, |
453 | align: "center" | 463 | align: "center", |
454 | }, | 464 | }, |
455 | { text: "Action", value: "", sortable: false, align: "center" } | 465 | { text: "Action", value: "", sortable: false, align: "center" }, |
456 | ], | 466 | ], |
457 | gradeData: [], | 467 | gradeData: [], |
458 | addGrade: {}, | 468 | addGrade: {}, |
459 | editedItem: {}, | 469 | editedItem: {}, |
460 | token: "" | 470 | token: "", |
461 | }), | 471 | }), |
472 | watch: { | ||
473 | addGradeDialog: function (val) { | ||
474 | if (!val) { | ||
475 | this.addGrade = []; | ||
476 | } | ||
477 | }, | ||
478 | }, | ||
462 | methods: { | 479 | methods: { |
463 | dates: function(date) { | 480 | dates: function (date) { |
464 | return moment(date).format("MMMM DD, YYYY"); | 481 | return moment(date).format("MMMM DD, YYYY"); |
465 | }, | 482 | }, |
466 | pickFile() { | 483 | pickFile() { |
467 | this.$refs.image.click(); | 484 | this.$refs.image.click(); |
468 | }, | 485 | }, |
469 | getGradeList() { | 486 | getGradeList() { |
470 | this.showLoader = true; | 487 | this.showLoader = true; |
471 | this.loadingSearch = true; | 488 | this.loadingSearch = true; |
472 | http() | 489 | http() |
473 | .get("/getGradesList", { | 490 | .get("/getGradesList", { |
474 | headers: { Authorization: "Bearer " + this.token } | 491 | headers: { Authorization: "Bearer " + this.token }, |
475 | }) | 492 | }) |
476 | .then(response => { | 493 | .then((response) => { |
477 | this.gradeData = response.data.data; | 494 | this.gradeData = response.data.data; |
478 | this.showLoader = false; | 495 | this.showLoader = false; |
479 | this.loadingSearch = false; | 496 | this.loadingSearch = false; |
480 | }) | 497 | }) |
481 | .catch(error => { | 498 | .catch((error) => { |
482 | // console.log("err====>", err); | 499 | // console.log("err====>", err); |
483 | this.showLoader = false; | 500 | this.showLoader = false; |
484 | this.loadingSearch = false; | 501 | this.loadingSearch = false; |
485 | this.snackbar = true; | 502 | this.snackbar = true; |
486 | this.text = error.response.data.message; | 503 | this.text = error.response.data.message; |
487 | if (error.response.status === 401) { | 504 | if (error.response.status === 401) { |
488 | this.$router.replace({ path: "/" }); | 505 | this.$router.replace({ path: "/" }); |
489 | this.$store.dispatch("setToken", null); | 506 | this.$store.dispatch("setToken", null); |
490 | this.$store.dispatch("Id", null); | 507 | this.$store.dispatch("Id", null); |
491 | } | 508 | } |
492 | }); | 509 | }); |
493 | }, | 510 | }, |
494 | editItem(item) { | 511 | editItem(item) { |
495 | console.log("item", item); | 512 | console.log("item", item); |
496 | this.editedIndex = this.gradeData.indexOf(item); | 513 | this.editedIndex = this.gradeData.indexOf(item); |
497 | this.editedItem = Object.assign({}, item); | 514 | this.editedItem = Object.assign({}, item); |
498 | this.editedItem.date = | 515 | this.editedItem.date = |
499 | this.editedItem.date != undefined | 516 | this.editedItem.date != undefined |
500 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 517 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
501 | : (this.editedItem.date = ""); | 518 | : (this.editedItem.date = ""); |
502 | this.editGradeDialog = true; | 519 | this.editGradeDialog = true; |
503 | }, | 520 | }, |
504 | profile(item) { | 521 | profile(item) { |
505 | this.editedIndex = this.gradeData.indexOf(item); | 522 | this.editedIndex = this.gradeData.indexOf(item); |
506 | this.editedItem = Object.assign({}, item); | 523 | this.editedItem = Object.assign({}, item); |
507 | this.viewGradeDialog = true; | 524 | this.viewGradeDialog = true; |
508 | }, | 525 | }, |
509 | deleteGrade(item) { | 526 | deleteGrade(item) { |
510 | let deleteGrade = { | 527 | let deleteGrade = { |
511 | gradeId: item._id | 528 | gradeId: item._id, |
512 | }; | 529 | }; |
513 | http() | 530 | http() |
514 | .delete( | 531 | .delete( |
515 | "/deleteGrade", | 532 | "/deleteGrade", |
516 | confirm("Are you sure you want to Delete this?") && { | 533 | confirm("Are you sure you want to Delete this?") && { |
517 | params: deleteGrade | 534 | params: deleteGrade, |
518 | } | 535 | } |
519 | ) | 536 | ) |
520 | .then(response => { | 537 | .then((response) => { |
521 | this.snackbar = true; | 538 | this.snackbar = true; |
522 | this.text = response.data.message; | 539 | this.text = response.data.message; |
523 | this.color = "green"; | 540 | this.color = "green"; |
524 | this.getGradeList(); | 541 | this.getGradeList(); |
525 | }) | 542 | }) |
526 | .catch(error => { | 543 | .catch((error) => { |
527 | this.loading = false; | 544 | this.loading = false; |
528 | this.snackbar = true; | 545 | this.snackbar = true; |
529 | this.color = "error"; | 546 | this.color = "error"; |
530 | this.text = error.response.data.message; | 547 | this.text = error.response.data.message; |
531 | }); | 548 | }); |
532 | }, | 549 | }, |
533 | close() { | 550 | close() { |
534 | this.editGradeDialog = false; | 551 | this.editGradeDialog = false; |
535 | }, | 552 | }, |
536 | submit() { | 553 | submit() { |
537 | if (this.$refs.form.validate()) { | 554 | if (this.$refs.form.validate()) { |
538 | this.loading = true; | 555 | this.loading = true; |
539 | http() | 556 | http() |
540 | .post("/createGrade", this.addGrade) | 557 | .post("/createGrade", this.addGrade) |
541 | .then(response => { | 558 | .then((response) => { |
542 | this.snackbar = true; | 559 | this.snackbar = true; |
543 | this.text = response.data.message; | 560 | this.text = response.data.message; |
544 | this.color = "green"; | 561 | this.color = "green"; |
545 | this.addGradeDialog = false; | 562 | this.addGradeDialog = false; |
546 | this.loading = false; | 563 | this.loading = false; |
547 | this.clear(); | 564 | this.clear(); |
548 | this.getGradeList(); | 565 | this.getGradeList(); |
549 | }) | 566 | }) |
550 | .catch(error => { | 567 | .catch((error) => { |
551 | this.snackbar = true; | 568 | this.snackbar = true; |
552 | this.text = error.response.data.message; | 569 | this.text = error.response.data.message; |
553 | this.color = "red"; | 570 | this.color = "red"; |
554 | this.loading = false; | 571 | this.loading = false; |
555 | }); | 572 | }); |
556 | } | 573 | } |
557 | }, | 574 | }, |
558 | clear() { | 575 | clear() { |
559 | this.$refs.form.reset(); | 576 | this.$refs.form.reset(); |
560 | this.disable = false; | 577 | this.disable = false; |
561 | this.loading = false; | 578 | this.loading = false; |
562 | }, | 579 | }, |
563 | save() { | 580 | save() { |
564 | if (this.$refs.formEditGrade.validate()) { | 581 | if (this.$refs.formEditGrade.validate()) { |
565 | this.editedItem.gradeId = this.editedItem._id; | 582 | this.editedItem.gradeId = this.editedItem._id; |
566 | http() | 583 | http() |
567 | .put("/updateGrade", this.editedItem) | 584 | .put("/updateGrade", this.editedItem) |
568 | .then(response => { | 585 | .then((response) => { |
569 | this.snackbar = true; | 586 | this.snackbar = true; |
570 | this.text = response.data.message; | 587 | this.text = response.data.message; |
571 | this.color = "green"; | 588 | this.color = "green"; |
572 | this.getGradeList(); | 589 | this.getGradeList(); |
573 | this.close(); | 590 | this.close(); |
574 | }) | 591 | }) |
575 | .catch(error => { | 592 | .catch((error) => { |
576 | this.snackbar = true; | 593 | this.snackbar = true; |
577 | this.text = error.response.data.message; | 594 | this.text = error.response.data.message; |
578 | this.color = "red"; | 595 | this.color = "red"; |
579 | }); | 596 | }); |
580 | } | 597 | } |
581 | }, | 598 | }, |
582 | displaySearch() { | 599 | displaySearch() { |
583 | (this.show = false), (this.showSearch = true); | 600 | (this.show = false), (this.showSearch = true); |
584 | }, | 601 | }, |
585 | closeSearch() { | 602 | closeSearch() { |
586 | this.showSearch = false; | 603 | this.showSearch = false; |
587 | this.show = true; | 604 | this.show = true; |
588 | this.search = ""; | 605 | this.search = ""; |
589 | } | 606 | }, |
590 | }, | 607 | }, |
591 | mounted() { | 608 | mounted() { |
592 | this.token = this.$store.state.token; | 609 | this.token = this.$store.state.token; |
593 | this.getGradeList(); | 610 | this.getGradeList(); |
594 | } | 611 | }, |
595 | }; | 612 | }; |
596 | </script> | 613 | </script> |
src/pages/Gallery/gallery.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS Gallery ****** --> | 3 | <!-- ****** EDITS Gallery ****** --> |
4 | <v-dialog v-model="editGalleryDialog" max-width="1000px" scrollable> | 4 | <v-dialog v-model="editGalleryDialog" max-width="1000px" scrollable> |
5 | <v-card class="card-style pa-2" dark> | 5 | <v-card 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 Gallery</label> | 8 | <label class="title text-xs-center">Edit Gallery</label> |
9 | <v-icon size="24" class="right" @click="editGalleryDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editGalleryDialog = 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-layout row> | 13 | <v-layout row> |
14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
15 | <input | 15 | <input |
16 | type="file" | 16 | type="file" |
17 | style="display: none" | 17 | style="display: none" |
18 | ref="editImage" | 18 | ref="editImage" |
19 | accept="image/*" | 19 | accept="image/*" |
20 | multiple | 20 | multiple |
21 | @change="editFilePicked" | 21 | @change="editFilePicked" |
22 | /> | 22 | /> |
23 | <v-layout justify-center> | 23 | <v-layout justify-center> |
24 | <v-flex | 24 | <v-flex |
25 | xs6 | 25 | xs6 |
26 | sm12 | 26 | sm12 |
27 | md3 | 27 | md3 |
28 | v-for="Image in editedItem.imageUrl" | 28 | v-for="Image in editedItem.imageUrl" |
29 | :key="Image._id" | 29 | :key="Image._id" |
30 | v-if="editedItem.imageUrl" | 30 | v-if="editedItem.imageUrl" |
31 | class="profile-image-wrapper imgNews" | 31 | class="profile-image-wrapper imgNews" |
32 | > | 32 | > |
33 | <img :src="Image.imageLink" height="160" width="160" alt="Gallery" class="pa-2" /> | 33 | <img :src="Image.imageLink" height="160" width="160" alt="Gallery" class="pa-2" /> |
34 | <v-icon | 34 | <v-icon |
35 | class="red edit-profile-icon" | 35 | class="red edit-profile-icon" |
36 | dark | 36 | dark |
37 | @click="deleteImage(Image._id,editedItem._id)" | 37 | @click="deleteImage(Image._id,editedItem._id)" |
38 | >close</v-icon> | 38 | >close</v-icon> |
39 | </v-flex> | 39 | </v-flex> |
40 | <v-flex v-for="(file, index) in editFiles" :key="index"> | 40 | <v-flex v-for="(file, index) in editFiles" :key="index"> |
41 | <img :src="file" height="160" width="160" class="pa-2" /> | 41 | <img :src="file" height="160" width="160" class="pa-2" /> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | <img | 44 | <img |
45 | src="/static/icon/user.png" | 45 | src="/static/icon/user.png" |
46 | v-if="editedItem.imageUrl == '' && editFiles == ''" | 46 | v-if="editedItem.imageUrl == '' && editFiles == ''" |
47 | height="160" | 47 | height="160" |
48 | width="160" | 48 | width="160" |
49 | alt="Gallery" | 49 | alt="Gallery" |
50 | /> | 50 | /> |
51 | </v-flex> | 51 | </v-flex> |
52 | </v-layout> | 52 | </v-layout> |
53 | <v-layout wrap> | 53 | <v-layout wrap> |
54 | <v-flex xs12 sm12> | 54 | <v-flex xs12 sm12> |
55 | <v-layout> | 55 | <v-layout> |
56 | <v-flex xs4 class="pt-4 subheading"> | 56 | <v-flex xs4 class="pt-4 subheading"> |
57 | <label class="right">Title:</label> | 57 | <label class="right">Title:</label> |
58 | </v-flex> | 58 | </v-flex> |
59 | <v-flex xs8 sm6 class="ml-3"> | 59 | <v-flex xs8 sm6 class="ml-3"> |
60 | <v-text-field | 60 | <v-text-field |
61 | v-model="editedItem.title" | 61 | v-model="editedItem.title" |
62 | placeholder="fill your Title" | 62 | placeholder="fill your Title" |
63 | name="name" | 63 | name="name" |
64 | type="text" | 64 | type="text" |
65 | required | 65 | required |
66 | ></v-text-field> | 66 | ></v-text-field> |
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">Description:</label> | 73 | <label class="right">Description:</label> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-flex xs8 sm6 class="ml-3"> | 75 | <v-flex xs8 sm6 class="ml-3"> |
76 | <v-text-field | 76 | <v-text-field |
77 | placeholder="fill your Description" | 77 | placeholder="fill your Description" |
78 | v-model="editedItem.description" | 78 | v-model="editedItem.description" |
79 | type="text" | 79 | type="text" |
80 | name="email" | 80 | name="email" |
81 | required | 81 | required |
82 | ></v-text-field> | 82 | ></v-text-field> |
83 | </v-flex> | 83 | </v-flex> |
84 | </v-layout> | 84 | </v-layout> |
85 | </v-flex> | 85 | </v-flex> |
86 | <v-layout> | 86 | <v-layout> |
87 | <v-flex xs4 class="pt-4 subheading"> | 87 | <v-flex xs4 class="pt-4 subheading"> |
88 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 88 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
89 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 89 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
90 | </v-flex> | 90 | </v-flex> |
91 | <v-flex xs8 sm6 class="ml-3"> | 91 | <v-flex xs8 sm6 class="ml-3"> |
92 | <v-select | 92 | <v-select |
93 | :items="addclass" | 93 | :items="addclass" |
94 | label="Select Class" | 94 | label="Select Class" |
95 | v-model="editedItem.classNum" | 95 | v-model="editedItem.classNum" |
96 | item-text="classNum" | 96 | item-text="classNum" |
97 | item-value="_id" | 97 | item-value="_id" |
98 | name="Select Class" | 98 | name="Select Class" |
99 | required | 99 | required |
100 | ></v-select> | 100 | ></v-select> |
101 | </v-flex> | 101 | </v-flex> |
102 | </v-layout> | 102 | </v-layout> |
103 | <v-flex xs12> | 103 | <v-flex xs12> |
104 | <v-layout> | 104 | <v-layout> |
105 | <v-flex xs4 class="pt-4 subheading"> | 105 | <v-flex xs4 class="pt-4 subheading"> |
106 | <label class="right hidden-xs-only hidden-sm-only">Add New Images:</label> | 106 | <label class="right hidden-xs-only hidden-sm-only">Add New Images:</label> |
107 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> | 107 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Upload:</label> |
108 | </v-flex> | 108 | </v-flex> |
109 | <v-flex xs8 sm6 class="ml-3"> | 109 | <v-flex xs8 sm6 class="ml-3"> |
110 | <v-text-field | 110 | <v-text-field |
111 | label="Select Image" | 111 | label="Select Image" |
112 | @click="editPickFile" | 112 | @click="editPickFile" |
113 | v-model="editImageName" | 113 | v-model="editImageName" |
114 | append-icon="attach_file" | 114 | append-icon="attach_file" |
115 | multiple | 115 | multiple |
116 | ></v-text-field> | 116 | ></v-text-field> |
117 | </v-flex> | 117 | </v-flex> |
118 | </v-layout> | 118 | </v-layout> |
119 | </v-flex> | 119 | </v-flex> |
120 | </v-layout> | 120 | </v-layout> |
121 | <v-flex xs12> | 121 | <v-flex xs12> |
122 | <div | 122 | <div |
123 | v-for="(editImage,index) in editedItem.youTubeLinkUrl" | 123 | v-for="(editImage,index) in editedItem.youTubeLinkUrl" |
124 | :key="index" | 124 | :key="index" |
125 | v-if="editImage.youTubeLink !=[]" | 125 | v-if="editImage.youTubeLink !=[]" |
126 | > | 126 | > |
127 | <v-layout wrap> | 127 | <v-layout wrap> |
128 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> | 128 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> |
129 | <label class="right hidden-xs-only hidden-sm-only">You Tube Link Url:</label> | 129 | <label class="right hidden-xs-only hidden-sm-only">You Tube Link Url:</label> |
130 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">You Tube Link Url:</label> | 130 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">You Tube Link Url:</label> |
131 | </v-flex> | 131 | </v-flex> |
132 | <v-layout> | 132 | <v-layout> |
133 | <v-flex xs10 sm10 sm5 md9 class="ml-3"> | 133 | <v-flex xs10 sm10 sm5 md9 class="ml-3"> |
134 | <v-text-field v-model="editImage.youTubeLink" type="text" name="link" required></v-text-field> | 134 | <v-text-field v-model="editImage.youTubeLink" type="text" name="link" required></v-text-field> |
135 | </v-flex> | 135 | </v-flex> |
136 | <v-flex xs2 class="pt-4"> | 136 | <v-flex xs2 class="pt-4"> |
137 | <v-icon @click="deleteUrl(index,editImage._id,editedItem._id)">cancel</v-icon> | 137 | <v-icon @click="deleteUrl(index,editImage._id,editedItem._id)">cancel</v-icon> |
138 | </v-flex> | 138 | </v-flex> |
139 | </v-layout> | 139 | </v-layout> |
140 | </v-layout> | 140 | </v-layout> |
141 | </div> | 141 | </div> |
142 | </v-flex> | 142 | </v-flex> |
143 | <v-flex xs12> | 143 | <v-flex xs12> |
144 | <div v-for="(updateImage,index) in updates" :key="index"> | 144 | <div v-for="(updateImage,index) in updates" :key="index"> |
145 | <v-layout wrap> | 145 | <v-layout wrap> |
146 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> | 146 | <v-flex xs12 sm12 md4 class="pt-4 subheading"> |
147 | <label class="right hidden-xs-only hidden-sm-only">You Tube Url:</label> | 147 | <label class="right hidden-xs-only hidden-sm-only">You Tube Url:</label> |
148 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">You Tube Url:</label> | 148 | <label class="hidden-md-only hidden-lg-only hidden-xl-only">You Tube Url:</label> |
149 | </v-flex> | 149 | </v-flex> |
150 | <v-layout> | 150 | <v-layout> |
151 | <v-flex xs10 sm12 md9 class="ml-3"> | 151 | <v-flex xs10 sm12 md9 class="ml-3"> |
152 | <v-text-field | 152 | <v-text-field |
153 | v-model="updateImage.youTubeLink" | 153 | v-model="updateImage.youTubeLink" |
154 | label="Upload new you tube link url" | 154 | label="Upload new you tube link url" |
155 | required | 155 | required |
156 | ></v-text-field> | 156 | ></v-text-field> |
157 | </v-flex> | 157 | </v-flex> |
158 | <v-flex xs2 class="pt-4"> | 158 | <v-flex xs2 class="pt-4"> |
159 | <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> | 159 | <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> |
160 | <v-icon @click="update">add_circle</v-icon> | 160 | <v-icon @click="update">add_circle</v-icon> |
161 | </v-flex> | 161 | </v-flex> |
162 | </v-layout> | 162 | </v-layout> |
163 | </v-layout> | 163 | </v-layout> |
164 | </div> | 164 | </div> |
165 | </v-flex> | 165 | </v-flex> |
166 | <v-layout> | 166 | <v-layout> |
167 | <v-flex xs12 sm12 md11 lg11> | 167 | <v-flex xs12 sm12 md11 lg11> |
168 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 168 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
169 | <v-spacer></v-spacer> | 169 | <v-spacer></v-spacer> |
170 | <v-btn | 170 | <v-btn |
171 | round | 171 | round |
172 | dark | 172 | dark |
173 | @click="save" | 173 | @click="save" |
174 | :loading="editGalleryLoading" | 174 | :loading="editGalleryLoading" |
175 | class="add-button mr-4" | 175 | class="add-button mr-4" |
176 | >Save</v-btn> | 176 | >Save</v-btn> |
177 | </v-card-actions> | 177 | </v-card-actions> |
178 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 178 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
179 | <v-spacer></v-spacer> | 179 | <v-spacer></v-spacer> |
180 | <v-btn | 180 | <v-btn |
181 | round | 181 | round |
182 | dark | 182 | dark |
183 | @click="save" | 183 | @click="save" |
184 | :loading="editGalleryLoading" | 184 | :loading="editGalleryLoading" |
185 | class="add-button" | 185 | class="add-button" |
186 | >Save</v-btn> | 186 | >Save</v-btn> |
187 | <v-spacer></v-spacer> | 187 | <v-spacer></v-spacer> |
188 | </v-card-actions> | 188 | </v-card-actions> |
189 | </v-flex> | 189 | </v-flex> |
190 | </v-layout> | 190 | </v-layout> |
191 | </v-card-text> | 191 | </v-card-text> |
192 | </v-card> | 192 | </v-card> |
193 | </v-dialog> | 193 | </v-dialog> |
194 | 194 | ||
195 | <!-- ****** PROFILE Gallery ****** --> | 195 | <!-- ****** PROFILE Gallery ****** --> |
196 | 196 | ||
197 | <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable> | 197 | <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable> |
198 | <v-card flat class="card-style pa-3" dark> | 198 | <v-card flat class="card-style pa-3" dark> |
199 | <v-layout> | 199 | <v-layout> |
200 | <v-flex xs12> | 200 | <v-flex xs12> |
201 | <label class="title text-xs-center">View Gallery</label> | 201 | <label class="title text-xs-center">View Gallery</label> |
202 | <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> | 202 | <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> |
203 | </v-flex> | 203 | </v-flex> |
204 | </v-layout> | 204 | </v-layout> |
205 | <v-card-text> | 205 | <v-card-text> |
206 | <v-layout row wrap> | 206 | <v-layout row wrap> |
207 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 207 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
208 | <v-avatar size="100" v-if="editedItem.imageUrl == ''" class="mt-4 pa-2"> | 208 | <v-avatar size="100" v-if="editedItem.imageUrl == ''" class="mt-4 pa-2"> |
209 | <img src="/static/icon/user.png" width="240" height="180" /> | 209 | <img src="/static/icon/user.png" width="240" height="180" /> |
210 | </v-avatar> | 210 | </v-avatar> |
211 | <span | 211 | <span |
212 | v-for="(image,i) in editedItem.imageUrl" | 212 | v-for="(image,i) in editedItem.imageUrl" |
213 | :key="i" | 213 | :key="i" |
214 | class="mt-4 pa-2" | 214 | class="mt-4 pa-2" |
215 | v-if="editedItem.imageUrl" | 215 | v-if="editedItem.imageUrl" |
216 | > | 216 | > |
217 | <img :src="image.imageLink" alt="Gallery" width="240" height="180" class="imgNews" /> | 217 | <img :src="image.imageLink" alt="Gallery" width="240" height="180" class="imgNews" /> |
218 | </span> | 218 | </span> |
219 | </v-flex> | 219 | </v-flex> |
220 | </v-layout> | 220 | </v-layout> |
221 | <v-container grid-list-md> | 221 | <v-container grid-list-md> |
222 | <v-layout wrap> | 222 | <v-layout wrap> |
223 | <v-flex xs12> | 223 | <v-flex xs12> |
224 | <v-layout> | 224 | <v-layout> |
225 | <v-flex xs5 sm6> | 225 | <v-flex xs5 sm6> |
226 | <h5 class="right my-1"> | 226 | <h5 class="right my-1"> |
227 | <b>Title:</b> | 227 | <b>Title:</b> |
228 | </h5> | 228 | </h5> |
229 | </v-flex> | 229 | </v-flex> |
230 | <v-flex sm6 xs8> | 230 | <v-flex sm6 xs8> |
231 | <h5 class="my-1">{{ editedItem.title }}</h5> | 231 | <h5 class="my-1">{{ editedItem.title }}</h5> |
232 | </v-flex> | 232 | </v-flex> |
233 | </v-layout> | 233 | </v-layout> |
234 | <v-layout> | 234 | <v-layout> |
235 | <v-flex xs5 sm6> | 235 | <v-flex xs5 sm6> |
236 | <h5 class="right my-1"> | 236 | <h5 class="right my-1"> |
237 | <b>Description:</b> | 237 | <b>Description:</b> |
238 | </h5> | 238 | </h5> |
239 | </v-flex> | 239 | </v-flex> |
240 | <v-flex sm6 xs8> | 240 | <v-flex sm6 xs8> |
241 | <h5 class="my-1">{{ editedItem.description }}</h5> | 241 | <h5 class="my-1">{{ editedItem.description }}</h5> |
242 | </v-flex> | 242 | </v-flex> |
243 | </v-layout> | 243 | </v-layout> |
244 | <v-layout> | 244 | <v-layout> |
245 | <v-flex xs5 sm6> | 245 | <v-flex xs5 sm6> |
246 | <h5 class="right my-1"> | 246 | <h5 class="right my-1"> |
247 | <b>You Tube Link Url:</b> | 247 | <b>You Tube Link Url:</b> |
248 | </h5> | 248 | </h5> |
249 | </v-flex> | 249 | </v-flex> |
250 | <v-flex sm6 xs8> | 250 | <v-flex sm6 xs8> |
251 | <h5 class="my-1 ml-3"> | 251 | <h5 class="my-1 ml-3"> |
252 | <ul v-for="youTubeLinkUrl in editedItem.youTubeLinkUrl"> | 252 | <ul v-for="youTubeLinkUrl in editedItem.youTubeLinkUrl"> |
253 | <li>{{ youTubeLinkUrl.youTubeLink }}</li> | 253 | <li>{{ youTubeLinkUrl.youTubeLink }}</li> |
254 | </ul> | 254 | </ul> |
255 | </h5> | 255 | </h5> |
256 | </v-flex> | 256 | </v-flex> |
257 | </v-layout> | 257 | </v-layout> |
258 | </v-flex> | 258 | </v-flex> |
259 | </v-layout> | 259 | </v-layout> |
260 | </v-container> | 260 | </v-container> |
261 | </v-card-text> | 261 | </v-card-text> |
262 | </v-card> | 262 | </v-card> |
263 | </v-dialog> | 263 | </v-dialog> |
264 | 264 | ||
265 | <!-- ****** Gallery TABLE ****** --> | 265 | <!-- ****** Gallery TABLE ****** --> |
266 | 266 | ||
267 | <v-toolbar color="transparent" flat> | 267 | <v-toolbar color="transparent" flat> |
268 | <v-btn | 268 | <v-btn |
269 | fab | 269 | fab |
270 | dark | 270 | dark |
271 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 271 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
272 | small | 272 | small |
273 | @click="addGalleryDialog = true" | 273 | @click="addGalleryDialog = true" |
274 | > | 274 | > |
275 | <v-icon dark>add</v-icon> | 275 | <v-icon dark>add</v-icon> |
276 | </v-btn> | 276 | </v-btn> |
277 | <v-btn | 277 | <v-btn |
278 | round | 278 | round |
279 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 279 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
280 | dark | 280 | dark |
281 | @click="addGalleryDialog = true" | 281 | @click="addGalleryDialog = true" |
282 | > | 282 | > |
283 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Gallery | 283 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Gallery |
284 | </v-btn> | 284 | </v-btn> |
285 | <v-spacer></v-spacer> | 285 | <v-spacer></v-spacer> |
286 | <v-card-title class="body-1" v-show="show"> | 286 | <v-card-title class="body-1" v-show="show"> |
287 | <v-btn icon large flat @click="displaySearch"> | 287 | <v-btn icon large flat @click="displaySearch"> |
288 | <v-avatar size="27"> | 288 | <v-avatar size="27"> |
289 | <img src="/static/icon/search.png" alt="icon" /> | 289 | <img src="/static/icon/search.png" alt="icon" /> |
290 | </v-avatar> | 290 | </v-avatar> |
291 | </v-btn> | 291 | </v-btn> |
292 | </v-card-title> | 292 | </v-card-title> |
293 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 293 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
294 | <v-layout> | 294 | <v-layout> |
295 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 295 | <v-text-field |
296 | autofocus | ||
297 | v-model="search" | ||
298 | label="Search" | ||
299 | prepend-inner-icon="search" | ||
300 | color="primary" | ||
301 | ></v-text-field> | ||
296 | <v-icon @click="closeSearch" color="error">close</v-icon> | 302 | <v-icon @click="closeSearch" color="error">close</v-icon> |
297 | </v-layout> | 303 | </v-layout> |
298 | </v-flex> | 304 | </v-flex> |
299 | </v-toolbar> | 305 | </v-toolbar> |
300 | <v-data-table | 306 | <v-data-table |
301 | :headers="headers" | 307 | :headers="headers" |
302 | :items="desserts" | 308 | :items="desserts" |
303 | :pagination.sync="pagination" | 309 | :pagination.sync="pagination" |
304 | :search="search" | 310 | :search="search" |
305 | > | 311 | > |
306 | <template slot="items" slot-scope="props"> | 312 | <template slot="items" slot-scope="props"> |
307 | <tr class="tr"> | 313 | <tr class="tr"> |
308 | <td class="td td-row">{{ props.index + 1}}</td> | 314 | <td class="td td-row">{{ props.index + 1}}</td> |
309 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> | 315 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> |
310 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> | 316 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> |
311 | <td class="td td-row text-xs-center"> | 317 | <td class="td td-row text-xs-center"> |
312 | <span> | 318 | <span> |
313 | <v-tooltip top> | 319 | <v-tooltip top> |
314 | <img | 320 | <img |
315 | slot="activator" | 321 | slot="activator" |
316 | style="cursor:pointer; width:25px; height:25px; " | 322 | style="cursor:pointer; width:25px; height:25px; " |
317 | class="mr-3" | 323 | class="mr-3" |
318 | @click="profile(props.item)" | 324 | @click="profile(props.item)" |
319 | src="/static/icon/view.png" | 325 | src="/static/icon/view.png" |
320 | /> | 326 | /> |
321 | <span>View</span> | 327 | <span>View</span> |
322 | </v-tooltip> | 328 | </v-tooltip> |
323 | <v-tooltip top> | 329 | <v-tooltip top> |
324 | <img | 330 | <img |
325 | slot="activator" | 331 | slot="activator" |
326 | style="cursor:pointer; width:20px; height:18px; " | 332 | style="cursor:pointer; width:20px; height:18px; " |
327 | class="mr-3" | 333 | class="mr-3" |
328 | @click="editItem(props.item)" | 334 | @click="editItem(props.item)" |
329 | src="/static/icon/edit.png" | 335 | src="/static/icon/edit.png" |
330 | /> | 336 | /> |
331 | <span>Edit</span> | 337 | <span>Edit</span> |
332 | </v-tooltip> | 338 | </v-tooltip> |
333 | <v-tooltip top> | 339 | <v-tooltip top> |
334 | <img | 340 | <img |
335 | slot="activator" | 341 | slot="activator" |
336 | style="cursor:pointer; width:20px; height:20px; " | 342 | style="cursor:pointer; width:20px; height:20px; " |
337 | class="mr-3" | 343 | class="mr-3" |
338 | @click="deleteItem(props.item)" | 344 | @click="deleteItem(props.item)" |
339 | src="/static/icon/delete.png" | 345 | src="/static/icon/delete.png" |
340 | /> | 346 | /> |
341 | <span>Delete</span> | 347 | <span>Delete</span> |
342 | </v-tooltip> | 348 | </v-tooltip> |
343 | </span> | 349 | </span> |
344 | </td> | 350 | </td> |
345 | </tr> | 351 | </tr> |
346 | </template> | 352 | </template> |
347 | <v-alert | 353 | <v-alert |
348 | slot="no-results" | 354 | slot="no-results" |
349 | :value="true" | 355 | :value="true" |
350 | color="error" | 356 | color="error" |
351 | icon="warning" | 357 | icon="warning" |
352 | >Your search for "{{ search }}" found no results.</v-alert> | 358 | >Your search for "{{ search }}" found no results.</v-alert> |
353 | </v-data-table> | 359 | </v-data-table> |
354 | <!-- ****** ADD Gallery ****** --> | 360 | <!-- ****** ADD Gallery ****** --> |
355 | <v-dialog v-model="addGalleryDialog" max-width="600px"> | 361 | <v-dialog v-model="addGalleryDialog" max-width="600px" v-if="addGalleryDialog"> |
356 | <v-card flat class="card-style pa-2" dark> | 362 | <v-card flat class="card-style pa-2" dark> |
357 | <v-layout> | 363 | <v-layout> |
358 | <v-flex xs12> | 364 | <v-flex xs12> |
359 | <label class="title text-xs-center">Add Gallery</label> | 365 | <label class="title text-xs-center">Add Gallery</label> |
360 | <v-icon size="24" class="right" @click="addGalleryDialog = false">cancel</v-icon> | 366 | <v-icon size="24" class="right" @click="closeAddGalleryModel">cancel</v-icon> |
361 | </v-flex> | 367 | </v-flex> |
362 | </v-layout> | 368 | </v-layout> |
363 | <v-form ref="form" v-model="valid" lazy-validation> | 369 | <v-form ref="form" v-model="valid" lazy-validation> |
364 | <v-container fluid> | 370 | <v-container fluid> |
365 | <v-layout> | 371 | <v-layout> |
366 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 372 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
367 | <input | 373 | <input |
368 | type="file" | 374 | type="file" |
369 | style="display: none" | 375 | style="display: none" |
370 | ref="image" | 376 | ref="image" |
371 | accept="image/*" | 377 | accept="image/*" |
372 | multiple | 378 | multiple |
373 | @change="onFilePicked" | 379 | @change="onFilePicked" |
374 | /> | 380 | /> |
375 | <v-layout justify-center> | 381 | <v-layout justify-center> |
376 | <v-flex v-for="(file,index) in files" :key="index" v-if="files"> | 382 | <v-flex v-for="(file,index) in files" :key="index" v-if="files"> |
377 | <img :src="file" height="150" width="150" /> | 383 | <img :src="file" height="150" width="150" /> |
378 | </v-flex> | 384 | </v-flex> |
379 | </v-layout> | 385 | </v-layout> |
380 | <img src="/static/icon/user.png" v-if="files ==''" height="100" width="100;" /> | 386 | <img src="/static/icon/user.png" v-if="files ==''" height="100" width="100;" /> |
381 | </v-flex> | 387 | </v-flex> |
382 | </v-layout> | 388 | </v-layout> |
383 | <v-flex xs12> | 389 | <v-flex xs12> |
384 | <v-layout> | 390 | <v-layout> |
385 | <v-flex xs4 class="pt-4 subheading"> | 391 | <v-flex xs4 class="pt-4 subheading"> |
386 | <label class="right">Title:</label> | 392 | <label class="right">Title:</label> |
387 | </v-flex> | 393 | </v-flex> |
388 | <v-flex xs8 sm8 md7 class="ml-3"> | 394 | <v-flex xs8 sm8 md7 class="ml-3"> |
389 | <v-text-field | 395 | <v-text-field |
390 | v-model="addGallery.title" | 396 | v-model="addGallery.title" |
391 | placeholder="fill your Title" | 397 | placeholder="fill your Title" |
392 | name="name" | 398 | name="name" |
393 | type="text" | 399 | type="text" |
394 | :rules="titleRules" | 400 | :rules="titleRules" |
395 | required | 401 | required |
396 | ></v-text-field> | 402 | ></v-text-field> |
397 | </v-flex> | 403 | </v-flex> |
398 | </v-layout> | 404 | </v-layout> |
399 | </v-flex> | 405 | </v-flex> |
400 | <v-flex xs12> | 406 | <v-flex xs12> |
401 | <v-layout> | 407 | <v-layout> |
402 | <v-flex xs4 class="pt-4 subheading"> | 408 | <v-flex xs4 class="pt-4 subheading"> |
403 | <label class="right">Description:</label> | 409 | <label class="right">Description:</label> |
404 | </v-flex> | 410 | </v-flex> |
405 | <v-flex xs8 sm8 md7 class="ml-3"> | 411 | <v-flex xs8 sm8 md7 class="ml-3"> |
406 | <v-text-field | 412 | <v-text-field |
407 | placeholder="fill your Description" | 413 | placeholder="fill your Description" |
408 | :rules="descriptionRules" | 414 | :rules="descriptionRules" |
409 | v-model="addGallery.description" | 415 | v-model="addGallery.description" |
410 | type="text" | 416 | type="text" |
411 | name="email" | 417 | name="email" |
412 | required | 418 | required |
413 | ></v-text-field> | 419 | ></v-text-field> |
414 | </v-flex> | 420 | </v-flex> |
415 | </v-layout> | 421 | </v-layout> |
416 | </v-flex> | 422 | </v-flex> |
417 | <v-flex xs12> | 423 | <v-flex xs12> |
418 | <v-layout> | 424 | <v-layout> |
419 | <v-flex xs4 class="pt-4 subheading"> | 425 | <v-flex xs4 class="pt-4 subheading"> |
420 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 426 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
421 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 427 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
422 | </v-flex> | 428 | </v-flex> |
423 | <v-flex xs8 sm8 md7 class="ml-3"> | 429 | <v-flex xs8 sm8 md7 class="ml-3"> |
424 | <v-select | 430 | <v-select |
425 | :items="addclass" | 431 | :items="addclass" |
426 | label="Select Class" | 432 | label="Select Class" |
427 | v-model="addGallery.classNum" | 433 | v-model="addGallery.classNum" |
428 | item-text="classNum" | 434 | item-text="classNum" |
429 | item-value="_id" | 435 | item-value="_id" |
430 | name="Select Class" | 436 | name="Select Class" |
431 | required | 437 | required |
432 | ></v-select> | 438 | ></v-select> |
433 | </v-flex> | 439 | </v-flex> |
434 | </v-layout> | 440 | </v-layout> |
435 | </v-flex> | 441 | </v-flex> |
436 | <v-flex xs12> | 442 | <v-flex xs12> |
437 | <v-layout> | 443 | <v-layout> |
438 | <v-flex xs4 class="pt-4 subheading"> | 444 | <v-flex xs4 class="pt-4 subheading"> |
439 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 445 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
440 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> | 446 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> |
441 | </v-flex> | 447 | </v-flex> |
442 | <v-flex xs8 sm8 md7 class="ml-3"> | 448 | <v-flex xs8 sm8 md7 class="ml-3"> |
443 | <v-text-field | 449 | <v-text-field |
444 | label="Select Image" | 450 | label="Select Image" |
445 | @click="pickFile" | 451 | @click="pickFile" |
446 | v-model="imageName" | 452 | v-model="imageName" |
447 | append-icon="attach_file" | 453 | append-icon="attach_file" |
448 | multiple | 454 | multiple |
449 | ></v-text-field> | 455 | ></v-text-field> |
450 | </v-flex> | 456 | </v-flex> |
451 | </v-layout> | 457 | </v-layout> |
452 | </v-flex> | 458 | </v-flex> |
453 | <v-layout> | 459 | <v-layout> |
454 | <v-flex xs12> | 460 | <v-flex xs12> |
455 | <div v-for="(youTubeLink,index) in finds" :key="index"> | 461 | <div v-for="(youTubeLink,index) in finds" :key="index"> |
456 | <v-layout> | 462 | <v-layout> |
457 | <v-flex xs4 class="pt-4 subheading"> | 463 | <v-flex xs4 class="pt-4 subheading"> |
458 | <label class="right">You Tube Url:</label> | 464 | <label class="right">You Tube Url:</label> |
459 | </v-flex> | 465 | </v-flex> |
460 | <v-flex xs8 sm8 md6 class="ml-3"> | 466 | <v-flex xs8 sm8 md6 class="ml-3"> |
461 | <v-text-field | 467 | <v-text-field |
462 | placeholder="fill your youtube link" | 468 | placeholder="fill your youtube link" |
463 | v-model="youTubeLink.value" | 469 | v-model="youTubeLink.value" |
464 | type="text" | 470 | type="text" |
465 | name="link" | 471 | name="link" |
466 | required | 472 | required |
467 | ></v-text-field> | 473 | ></v-text-field> |
468 | </v-flex> | 474 | </v-flex> |
469 | <v-flex xs2 class="pt-4"> | 475 | <v-flex xs2 class="pt-4"> |
470 | <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> | 476 | <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> |
471 | <v-icon @click="addFind">add_circle</v-icon> | 477 | <v-icon @click="addFind">add_circle</v-icon> |
472 | </v-flex> | 478 | </v-flex> |
473 | </v-layout> | 479 | </v-layout> |
474 | </div> | 480 | </div> |
475 | </v-flex> | 481 | </v-flex> |
476 | </v-layout> | 482 | </v-layout> |
477 | <v-layout> | 483 | <v-layout> |
478 | <v-flex xs12 sm12> | 484 | <v-flex xs12 sm12> |
479 | <v-layout class="right"> | 485 | <v-layout class="right"> |
480 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> | 486 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> |
481 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 487 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
482 | </v-layout> | 488 | </v-layout> |
483 | </v-flex> | 489 | </v-flex> |
484 | </v-layout> | 490 | </v-layout> |
485 | </v-container> | 491 | </v-container> |
486 | </v-form> | 492 | </v-form> |
487 | </v-card> | 493 | </v-card> |
488 | </v-dialog> | 494 | </v-dialog> |
489 | <v-snackbar | 495 | <v-snackbar |
490 | :timeout="timeout" | 496 | :timeout="timeout" |
491 | :top="y === 'top'" | 497 | :top="y === 'top'" |
492 | :right="x === 'right'" | 498 | :right="x === 'right'" |
493 | :vertical="mode === 'vertical'" | 499 | :vertical="mode === 'vertical'" |
494 | v-model="snackbar" | 500 | v-model="snackbar" |
495 | :color="color" | 501 | :color="color" |
496 | >{{ text }}</v-snackbar> | 502 | >{{ text }}</v-snackbar> |
497 | <div class="loader" v-if="showLoader"> | 503 | <div class="loader" v-if="showLoader"> |
498 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 504 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
499 | </div> | 505 | </div> |
500 | </v-container> | 506 | </v-container> |
501 | </template> | 507 | </template> |
502 | 508 | ||
503 | <script> | 509 | <script> |
504 | import http from "@/Services/http.js"; | 510 | import http from "@/Services/http.js"; |
505 | 511 | ||
506 | export default { | 512 | export default { |
507 | data: () => ({ | 513 | data: () => ({ |
508 | snackbar: false, | 514 | snackbar: false, |
509 | y: "top", | 515 | y: "top", |
510 | x: "right", | 516 | x: "right", |
511 | mode: "", | 517 | mode: "", |
512 | timeout: 3000, | 518 | timeout: 3000, |
513 | text: "", | 519 | text: "", |
514 | loading: false, | 520 | loading: false, |
515 | color: "", | 521 | color: "", |
516 | date: null, | 522 | date: null, |
517 | search: "", | 523 | search: "", |
518 | show: true, | 524 | show: true, |
519 | addGalleryDialog: false, | 525 | addGalleryDialog: false, |
520 | showSearch: false, | 526 | showSearch: false, |
521 | showLoader: false, | 527 | showLoader: false, |
522 | editGalleryDialog: false, | 528 | editGalleryDialog: false, |
523 | viewProfileGallery: false, | 529 | viewProfileGallery: false, |
524 | valid: true, | 530 | valid: true, |
525 | editGalleryLoading: false, | 531 | editGalleryLoading: false, |
526 | addclass: [], | 532 | addclass: [], |
527 | addSection: [], | 533 | addSection: [], |
528 | finds: [{ value: "" }], | 534 | finds: [{ value: "" }], |
529 | updates: [{ youTubeLink: "" }], | 535 | updates: [{ youTubeLink: "" }], |
530 | youTubeLink: {}, | 536 | youTubeLink: {}, |
531 | addGallery: { | 537 | addGallery: { |
532 | youTubeLinkUrl: [] | 538 | youTubeLinkUrl: [], |
533 | }, | 539 | }, |
534 | pagination: { | 540 | pagination: { |
535 | rowsPerPage: 10 | 541 | rowsPerPage: 10, |
536 | }, | 542 | }, |
537 | imageName: "", | 543 | imageName: "", |
538 | imageUrl: "", | 544 | imageUrl: "", |
539 | imageFile: "", | 545 | imageFile: "", |
540 | image: [], | 546 | image: [], |
541 | upload: "", | 547 | upload: "", |
542 | editImageName: "", | 548 | editImageName: "", |
543 | editFiles: [], | 549 | editFiles: [], |
544 | files: [], | 550 | files: [], |
545 | token: "", | 551 | token: "", |
546 | titleRules: [v => !!v || " Tilte is required"], | 552 | titleRules: [(v) => !!v || " Tilte is required"], |
547 | descriptionRules: [v => !!v || " Description is required"], | 553 | descriptionRules: [(v) => !!v || " Description is required"], |
548 | headers: [ | 554 | headers: [ |
549 | { | 555 | { |
550 | align: "", | 556 | align: "", |
551 | text: "No", | 557 | text: "No", |
552 | sortable: false, | 558 | sortable: false, |
553 | value: "index" | 559 | value: "index", |
554 | }, | 560 | }, |
555 | { text: "Title", value: "title", sortable: false, align: "center" }, | 561 | { text: "Title", value: "title", sortable: false, align: "center" }, |
556 | { | 562 | { |
557 | text: "Description", | 563 | text: "Description", |
558 | value: "description", | 564 | value: "description", |
559 | sortable: false, | 565 | sortable: false, |
560 | align: "center" | 566 | align: "center", |
561 | }, | 567 | }, |
562 | { text: "Action", value: "", sortable: false, align: "center" } | 568 | { text: "Action", value: "", sortable: false, align: "center" }, |
563 | ], | 569 | ], |
564 | desserts: [], | 570 | desserts: [], |
565 | editedIndex: -1, | 571 | editedIndex: -1, |
566 | editedItem: {}, | 572 | editedItem: {}, |
567 | index: "" | 573 | index: "", |
568 | }), | 574 | }), |
575 | watch: { | ||
576 | addGalleryDialog: function (val) { | ||
577 | if (!val) { | ||
578 | this.addGallery = []; | ||
579 | this.imageName = ""; | ||
580 | this.youTubeLinkUrl = []; | ||
581 | this.youTubeLink = {}; | ||
582 | this.index = ""; | ||
583 | this.files = []; | ||
584 | } | ||
585 | }, | ||
586 | }, | ||
569 | methods: { | 587 | methods: { |
570 | pickFile() { | 588 | pickFile() { |
571 | this.$refs.image.click(); | 589 | this.$refs.image.click(); |
572 | }, | 590 | }, |
573 | editPickFile() { | 591 | editPickFile() { |
574 | this.$refs.editImage.click(); | 592 | this.$refs.editImage.click(); |
575 | }, | 593 | }, |
576 | onFilePicked(e) { | 594 | onFilePicked(e) { |
577 | const files = e.target.files; | 595 | const files = e.target.files; |
578 | /** fetch Image Name **/ | 596 | /** fetch Image Name **/ |
579 | if (files[0] !== undefined) { | 597 | if (files[0] !== undefined) { |
580 | this.imageName = files[0].name; | 598 | this.imageName = files[0].name; |
581 | if (this.imageName.lastIndexOf(".") <= 0) { | 599 | if (this.imageName.lastIndexOf(".") <= 0) { |
582 | return; | 600 | return; |
583 | } | 601 | } |
584 | this.files = []; | 602 | this.files = []; |
585 | // console.log("files", this.files); | 603 | // console.log("files", this.files); |
586 | /** Select many image and showing many image add to Gallery card **/ | 604 | /** Select many image and showing many image add to Gallery card **/ |
587 | const test = Array.from(files).forEach((file, idx) => { | 605 | const test = Array.from(files).forEach((file, idx) => { |
588 | const fr = new FileReader(); | 606 | const fr = new FileReader(); |
589 | const getResult = new Promise(resolve => { | 607 | const getResult = new Promise((resolve) => { |
590 | fr.onload = e => { | 608 | fr.onload = (e) => { |
591 | this.files.push( | 609 | this.files.push( |
592 | // id: idx, | 610 | // id: idx, |
593 | e.target.result | 611 | e.target.result |
594 | ); | 612 | ); |
595 | }; | 613 | }; |
596 | console.log("uploadImage=======>", this.files); | 614 | console.log("uploadImage=======>", this.files); |
597 | }); | 615 | }); |
598 | fr.readAsDataURL(file); | 616 | fr.readAsDataURL(file); |
599 | return getResult.then(file => { | 617 | return getResult.then((file) => { |
600 | return file; | 618 | return file; |
601 | }); | 619 | }); |
602 | }); | 620 | }); |
603 | const fr = new FileReader(); | 621 | const fr = new FileReader(); |
604 | fr.readAsDataURL(files[0]); | 622 | fr.readAsDataURL(files[0]); |
605 | fr.addEventListener("load", () => { | 623 | fr.addEventListener("load", () => { |
606 | this.imageFile = files; // this is an image file that can be sent to server... | 624 | this.imageFile = files; // this is an image file that can be sent to server... |
607 | }); | 625 | }); |
608 | } else { | 626 | } else { |
609 | this.imageName = ""; | 627 | this.imageName = ""; |
610 | this.imageFile = ""; | 628 | this.imageFile = ""; |
611 | this.imageUrl = ""; | 629 | this.imageUrl = ""; |
612 | } | 630 | } |
613 | }, | 631 | }, |
614 | editFilePicked(e) { | 632 | editFilePicked(e) { |
615 | const files = e.target.files; | 633 | const files = e.target.files; |
616 | /** fetch Image Name **/ | 634 | /** fetch Image Name **/ |
617 | if (files[0] !== undefined) { | 635 | if (files[0] !== undefined) { |
618 | this.editImageName = files[0].name; | 636 | this.editImageName = files[0].name; |
619 | if (this.editImageName.lastIndexOf(".") <= 0) { | 637 | if (this.editImageName.lastIndexOf(".") <= 0) { |
620 | return; | 638 | return; |
621 | } | 639 | } |
622 | /** Select many image and showing many image add to Gallery card **/ | 640 | /** Select many image and showing many image add to Gallery card **/ |
623 | const test = Array.from(files).forEach((file, idx) => { | 641 | const test = Array.from(files).forEach((file, idx) => { |
624 | const fr = new FileReader(); | 642 | const fr = new FileReader(); |
625 | const getResult = new Promise(resolve => { | 643 | const getResult = new Promise((resolve) => { |
626 | fr.onload = e => { | 644 | fr.onload = (e) => { |
627 | this.editFiles.push( | 645 | this.editFiles.push( |
628 | // id: idx, | 646 | // id: idx, |
629 | e.target.result | 647 | e.target.result |
630 | ); | 648 | ); |
631 | }; | 649 | }; |
632 | console.log("uploadeditFilesImage=======>", this.editFiles); | 650 | console.log("uploadeditFilesImage=======>", this.editFiles); |
633 | }); | 651 | }); |
634 | fr.readAsDataURL(file); | 652 | fr.readAsDataURL(file); |
635 | return getResult.then(file => { | 653 | return getResult.then((file) => { |
636 | return file; | 654 | return file; |
637 | }); | 655 | }); |
638 | }); | 656 | }); |
639 | const fr = new FileReader(); | 657 | const fr = new FileReader(); |
640 | fr.readAsDataURL(files[0]); | 658 | fr.readAsDataURL(files[0]); |
641 | // fr.addEventListener("load", () => { | 659 | // fr.addEventListener("load", () => { |
642 | // this.imageFile = files; // this is an image file that can be sent to server... | 660 | // this.imageFile = files; // this is an image file that can be sent to server... |
643 | // }); | 661 | // }); |
644 | } else { | 662 | } else { |
645 | this.editImageName = ""; | 663 | this.editImageName = ""; |
646 | this.editFiles = []; | 664 | this.editFiles = []; |
647 | } | 665 | } |
648 | }, | 666 | }, |
649 | getGalleryList() { | 667 | getGalleryList() { |
650 | this.showLoader = true; | 668 | this.showLoader = true; |
651 | http() | 669 | http() |
652 | .get("/getGalleryList", { | 670 | .get("/getGalleryList", { |
653 | headers: { Authorization: "Bearer " + this.token } | 671 | headers: { Authorization: "Bearer " + this.token }, |
654 | }) | 672 | }) |
655 | .then(response => { | 673 | .then((response) => { |
656 | this.desserts = response.data.data; | 674 | this.desserts = response.data.data; |
657 | this.showLoader = false; | 675 | this.showLoader = false; |
658 | }) | 676 | }) |
659 | .catch(error => { | 677 | .catch((error) => { |
660 | // console.log("err====>", err); | 678 | // console.log("err====>", err); |
661 | this.showLoader = false; | 679 | this.showLoader = false; |
662 | if (error.response.status === 401) { | 680 | if (error.response.status === 401) { |
663 | this.$router.replace({ path: "/" }); | 681 | this.$router.replace({ path: "/" }); |
664 | this.$store.dispatch("setToken", null); | 682 | this.$store.dispatch("setToken", null); |
665 | this.$store.dispatch("Id", null); | 683 | this.$store.dispatch("Id", null); |
666 | } | 684 | } |
667 | }); | 685 | }); |
668 | }, | 686 | }, |
669 | editItem(item) { | 687 | editItem(item) { |
670 | this.files = []; | 688 | this.files = []; |
671 | this.editedIndex = this.desserts.indexOf(item); | 689 | this.editedIndex = this.desserts.indexOf(item); |
672 | this.editedItem = Object.assign({}, item); | 690 | this.editedItem = Object.assign({}, item); |
673 | this.editGalleryDialog = true; | 691 | this.editGalleryDialog = true; |
674 | }, | 692 | }, |
675 | profile(item) { | 693 | profile(item) { |
676 | this.editedIndex = this.desserts.indexOf(item); | 694 | this.editedIndex = this.desserts.indexOf(item); |
677 | this.editedItem = Object.assign({}, item); | 695 | this.editedItem = Object.assign({}, item); |
678 | this.viewProfileGallery = true; | 696 | this.viewProfileGallery = true; |
679 | }, | 697 | }, |
680 | deleteItem(item) { | 698 | deleteItem(item) { |
681 | let deleteGallery = { | 699 | let deleteGallery = { |
682 | galleryId: item._id | 700 | galleryId: item._id, |
683 | }; | 701 | }; |
684 | http() | 702 | http() |
685 | .delete( | 703 | .delete( |
686 | "/deleteGallery", | 704 | "/deleteGallery", |
687 | confirm("Are you sure you want to delete this?") && { | 705 | confirm("Are you sure you want to delete this?") && { |
688 | params: deleteGallery, | 706 | params: deleteGallery, |
689 | headers: { | 707 | headers: { |
690 | Authorization: "Bearer " + this.token | 708 | Authorization: "Bearer " + this.token, |
691 | } | 709 | }, |
692 | } | 710 | } |
693 | ) | 711 | ) |
694 | .then(response => { | 712 | .then((response) => { |
695 | this.snackbar = true; | 713 | this.snackbar = true; |
696 | this.text = "Successfully delete Existing Gallery"; | 714 | this.text = "Successfully delete Existing Gallery"; |
697 | this.color = "green"; | 715 | this.color = "green"; |
698 | this.getGalleryList(); | 716 | this.getGalleryList(); |
699 | }) | 717 | }) |
700 | .catch(error => { | 718 | .catch((error) => { |
701 | // console.log(error); | 719 | // console.log(error); |
702 | this.snackbar = true; | 720 | this.snackbar = true; |
703 | this.text = error.response.data.message; | 721 | this.text = error.response.data.message; |
704 | this.color = "error"; | 722 | this.color = "error"; |
705 | }); | 723 | }); |
706 | }, | 724 | }, |
707 | deleteImage(imageId, id) { | 725 | deleteImage(imageId, id) { |
708 | let deleteImages = { | 726 | let deleteImages = { |
709 | galleryId: id, | 727 | galleryId: id, |
710 | imageId: imageId | 728 | imageId: imageId, |
711 | }; | 729 | }; |
712 | http() | 730 | http() |
713 | .put("/deleteImage", deleteImages) | 731 | .put("/deleteImage", deleteImages) |
714 | .then(response => { | 732 | .then((response) => { |
715 | this.snackbar = true; | 733 | this.snackbar = true; |
716 | this.text = response.data.message; | 734 | this.text = response.data.message; |
717 | this.color = "green"; | 735 | this.color = "green"; |
718 | this.getGalleryList(); | 736 | this.getGalleryList(); |
719 | this.close(); | 737 | this.close(); |
720 | }) | 738 | }) |
721 | .catch(error => { | 739 | .catch((error) => { |
722 | this.snackbar = true; | 740 | this.snackbar = true; |
723 | this.text = error.response.data.message; | 741 | this.text = error.response.data.message; |
724 | this.color = "error"; | 742 | this.color = "error"; |
725 | }); | 743 | }); |
726 | }, | 744 | }, |
727 | close() { | 745 | close() { |
728 | this.editGalleryDialog = false; | 746 | this.editGalleryDialog = false; |
729 | }, | 747 | }, |
730 | closeProfileGallery() { | 748 | closeProfileGallery() { |
731 | this.viewProfileGallery = false; | 749 | this.viewProfileGallery = false; |
732 | }, | 750 | }, |
751 | closeAddGalleryModel() { | ||
752 | this.addGalleryDialog = false; | ||
753 | this.addGallery = []; | ||
754 | this.imageName = ""; | ||
755 | this.youTubeLinkUrl = []; | ||
756 | this.youTubeLink = {}; | ||
757 | this.index = ""; | ||
758 | this.files = []; | ||
759 | }, | ||
733 | submit() { | 760 | submit() { |
734 | for (let i = 0; i < this.finds.length; i++) { | 761 | for (let i = 0; i < this.finds.length; i++) { |
735 | this.addGallery.youTubeLinkUrl.push(this.finds[i].value); | 762 | this.addGallery.youTubeLinkUrl.push(this.finds[i].value); |
736 | } | 763 | } |
737 | if (this.$refs.form.validate()) { | 764 | if (this.$refs.form.validate()) { |
738 | if (this.files) { | 765 | if (this.files) { |
739 | var ary = []; | 766 | var ary = []; |
740 | var imageData = []; | 767 | var imageData = []; |
741 | ary = this.files; | 768 | ary = this.files; |
742 | for (let i = 0; i < ary.length; i++) { | 769 | for (let i = 0; i < ary.length; i++) { |
743 | const [baseUrl, imageUrl] = ary[i].split(/,/); | 770 | const [baseUrl, imageUrl] = ary[i].split(/,/); |
744 | imageData.push(imageUrl); | 771 | imageData.push(imageUrl); |
745 | this.addGallery.upload = imageData; | 772 | this.addGallery.upload = imageData; |
746 | } | 773 | } |
747 | } | 774 | } |
748 | if (this.addGallery.youTubeLinkUrl == "") { | 775 | if (this.addGallery.youTubeLinkUrl == "") { |
749 | var galleryData = { | 776 | var galleryData = { |
750 | classId: this.addGallery.classNum, | 777 | classId: this.addGallery.classNum, |
751 | title: this.addGallery.title, | 778 | title: this.addGallery.title, |
752 | description: this.addGallery.description, | 779 | description: this.addGallery.description, |
753 | upload: this.addGallery.upload | 780 | upload: this.addGallery.upload, |
754 | }; | 781 | }; |
755 | this.loading = true; | 782 | this.loading = true; |
756 | http() | 783 | http() |
757 | .post("/createGallery", galleryData) | 784 | .post("/createGallery", galleryData) |
758 | .then(response => { | 785 | .then((response) => { |
759 | this.getGalleryList(); | 786 | this.getGalleryList(); |
760 | this.addGalleryDialog = false; | 787 | this.addGalleryDialog = false; |
761 | this.loading = false; | 788 | this.loading = false; |
762 | this.snackbar = true; | 789 | this.snackbar = true; |
763 | this.text = response.data.message; | 790 | this.text = response.data.message; |
764 | this.color = "green"; | 791 | this.color = "green"; |
765 | this.clear(); | 792 | this.clear(); |
766 | this.files = ""; | 793 | this.files = ""; |
767 | }) | 794 | }) |
768 | .catch(error => { | 795 | .catch((error) => { |
769 | this.snackbar = true; | 796 | this.snackbar = true; |
770 | this.text = error.response.data.message; | 797 | this.text = error.response.data.message; |
771 | this.color = "error"; | 798 | this.color = "error"; |
772 | this.loading = false; | 799 | this.loading = false; |
773 | }); | 800 | }); |
774 | } else if (this.addGallery.youTubeLinkUrl) { | 801 | } else if (this.addGallery.youTubeLinkUrl) { |
775 | this.loading = true; | 802 | this.loading = true; |
776 | http() | 803 | http() |
777 | .post("/createGallery", this.addGallery) | 804 | .post("/createGallery", this.addGallery) |
778 | .then(response => { | 805 | .then((response) => { |
779 | this.getGalleryList(); | 806 | this.getGalleryList(); |
780 | this.addGalleryDialog = false; | 807 | this.addGalleryDialog = false; |
781 | this.files = "nmn"; | 808 | this.files = "nmn"; |
782 | this.loading = false; | 809 | this.loading = false; |
783 | this.snackbar = true; | 810 | this.snackbar = true; |
784 | this.color = "green"; | 811 | this.color = "green"; |
785 | this.text = response.data.message; | 812 | this.text = response.data.message; |
786 | this.clear(); | 813 | this.clear(); |
787 | this.removeAddFind(); | 814 | this.removeAddFind(); |
788 | this.files = ""; | 815 | this.files = ""; |
789 | }) | 816 | }) |
790 | .catch(error => { | 817 | .catch((error) => { |
791 | this.snackbar = true; | 818 | this.snackbar = true; |
792 | this.text = error.response.data.message; | 819 | this.text = error.response.data.message; |
793 | this.loading = false; | 820 | this.loading = false; |
794 | this.color = "error"; | 821 | this.color = "error"; |
795 | }); | 822 | }); |
796 | } | 823 | } |
797 | } | 824 | } |
798 | }, | 825 | }, |
799 | clear() { | 826 | clear() { |
800 | this.$refs.form.reset(); | 827 | this.$refs.form.reset(); |
801 | this.files = []; | 828 | this.files = []; |
802 | }, | 829 | }, |
803 | save() { | 830 | save() { |
804 | this.editedItem.gelleryId = this.editedItem._id; | 831 | this.editedItem.gelleryId = this.editedItem._id; |
805 | var linkUrl = []; | 832 | var linkUrl = []; |
806 | for (let i = 0; i < this.updates.length; i++) { | 833 | for (let i = 0; i < this.updates.length; i++) { |
807 | linkUrl.push(this.updates[i].youTubeLink); | 834 | linkUrl.push(this.updates[i].youTubeLink); |
808 | } | 835 | } |
809 | if (this.editFiles) { | 836 | if (this.editFiles) { |
810 | var ary = []; | 837 | var ary = []; |
811 | var imageData = []; | 838 | var imageData = []; |
812 | ary = this.editFiles; | 839 | ary = this.editFiles; |
813 | for (let i = 0; i < ary.length; i++) { | 840 | for (let i = 0; i < ary.length; i++) { |
814 | const [baseUrl, imageUrl] = ary[i].split(/,/); | 841 | const [baseUrl, imageUrl] = ary[i].split(/,/); |
815 | imageData.push(imageUrl); | 842 | imageData.push(imageUrl); |
816 | this.editedItem.editFiles = imageData; | 843 | this.editedItem.editFiles = imageData; |
817 | } | 844 | } |
818 | } | 845 | } |
819 | if (linkUrl != "") { | 846 | if (linkUrl != "") { |
820 | var updateData = { | 847 | var updateData = { |
821 | galleryId: this.editedItem._id, | 848 | galleryId: this.editedItem._id, |
822 | description: this.editedItem.description, | 849 | description: this.editedItem.description, |
823 | classId: this.editedItem.classNum, | 850 | classId: this.editedItem.classNum, |
824 | uploadImage: this.editedItem.editFiles, | 851 | uploadImage: this.editedItem.editFiles, |
825 | title: this.editedItem.title, | 852 | title: this.editedItem.title, |
826 | updateYouTubeLinkUrl: linkUrl | 853 | updateYouTubeLinkUrl: linkUrl, |
827 | }; | 854 | }; |
828 | } else if (linkUrl == "") { | 855 | } else if (linkUrl == "") { |
829 | var updateData = { | 856 | var updateData = { |
830 | galleryId: this.editedItem._id, | 857 | galleryId: this.editedItem._id, |
831 | description: this.editedItem.description, | 858 | description: this.editedItem.description, |
832 | classId: this.editedItem.classNum, | 859 | classId: this.editedItem.classNum, |
833 | uploadImage: this.editedItem.editFiles, | 860 | uploadImage: this.editedItem.editFiles, |
834 | title: this.editedItem.title | 861 | title: this.editedItem.title, |
835 | }; | 862 | }; |
836 | } | 863 | } |
837 | this.editGalleryLoading = true; | 864 | this.editGalleryLoading = true; |
838 | http() | 865 | http() |
839 | .put("/updateGallery", updateData) | 866 | .put("/updateGallery", updateData) |
840 | .then(response => { | 867 | .then((response) => { |
841 | this.getGalleryList(); | 868 | this.getGalleryList(); |
842 | this.close(); | 869 | this.close(); |
843 | this.snackbar = true; | 870 | this.snackbar = true; |
844 | this.text = response.data.message; | 871 | this.text = response.data.message; |
845 | this.color = "green"; | 872 | this.color = "green"; |
846 | this.editGalleryLoading = false; | 873 | this.editGalleryLoading = false; |
847 | this.editImageName = ""; | 874 | this.editImageName = ""; |
848 | this.editFiles = []; | 875 | this.editFiles = []; |
849 | }) | 876 | }) |
850 | .catch(error => { | 877 | .catch((error) => { |
851 | this.editGalleryLoading = false; | 878 | this.editGalleryLoading = false; |
852 | this.snackbar = true; | 879 | this.snackbar = true; |
853 | this.text = error.response.data.message; | 880 | this.text = error.response.data.message; |
854 | this.color = "error"; | 881 | this.color = "error"; |
855 | }); | 882 | }); |
856 | }, | 883 | }, |
857 | getAllClasses() { | 884 | getAllClasses() { |
858 | http() | 885 | http() |
859 | .get("/getClassesList", { | 886 | .get("/getClassesList", { |
860 | headers: { Authorization: "Bearer " + this.token } | 887 | headers: { Authorization: "Bearer " + this.token }, |
861 | }) | 888 | }) |
862 | .then(response => { | 889 | .then((response) => { |
863 | this.addclass = response.data.data; | 890 | this.addclass = response.data.data; |
864 | }) | 891 | }) |
865 | .catch(err => { | 892 | .catch((err) => { |
866 | // console.log("err====>", err); | 893 | // console.log("err====>", err); |
867 | }); | 894 | }); |
868 | }, | 895 | }, |
869 | removeAddFind: function() { | 896 | removeAddFind: function () { |
870 | this.finds = [{ value: "" }]; | 897 | this.finds = [{ value: "" }]; |
871 | }, | 898 | }, |
872 | addFind: function() { | 899 | addFind: function () { |
873 | this.finds.push({ value: "" }); | 900 | this.finds.push({ value: "" }); |
874 | }, | 901 | }, |
875 | update: function() { | 902 | update: function () { |
876 | this.updates.push({ youTubeLink: "" }); | 903 | this.updates.push({ youTubeLink: "" }); |
877 | }, | 904 | }, |
878 | deleteFind: function(index) { | 905 | deleteFind: function (index) { |
879 | this.finds.splice(index, 1); | 906 | this.finds.splice(index, 1); |
880 | if (index === 0) this.addFind(); | 907 | if (index === 0) this.addFind(); |
881 | }, | 908 | }, |
882 | deleteUpdate: function(index) { | 909 | deleteUpdate: function (index) { |
883 | this.updates.splice(index, 1); | 910 | this.updates.splice(index, 1); |
884 | if (index === 0) this.update(); | 911 | if (index === 0) this.update(); |
885 | }, | 912 | }, |
886 | deleteUrl: function(index, youTubelinkId, id) { | 913 | deleteUrl: function (index, youTubelinkId, id) { |
887 | this.editedItem.youTubeLinkUrl.splice(index, 1); | 914 | this.editedItem.youTubeLinkUrl.splice(index, 1); |
888 | if (index === 0) this.update(); | 915 | if (index === 0) this.update(); |
889 | let deleteYouTubeUrl = { | 916 | let deleteYouTubeUrl = { |
890 | galleryId: id, | 917 | galleryId: id, |
891 | youTubeId: youTubelinkId | 918 | youTubeId: youTubelinkId, |
892 | }; | 919 | }; |
893 | http() | 920 | http() |
894 | .put("/deleteYoutubeLink", deleteYouTubeUrl) | 921 | .put("/deleteYoutubeLink", deleteYouTubeUrl) |
895 | .then(response => { | 922 | .then((response) => { |
896 | this.snackbar = true; | 923 | this.snackbar = true; |
897 | this.text = response.data.message; | 924 | this.text = response.data.message; |
898 | this.color = "green"; | 925 | this.color = "green"; |
899 | this.getGalleryList(); | 926 | this.getGalleryList(); |
900 | this.close(); | 927 | this.close(); |
901 | }) | 928 | }) |
902 | .catch(error => { | 929 | .catch((error) => { |
903 | this.snackbar = true; | 930 | this.snackbar = true; |
904 | this.text = error.response.data.message; | 931 | this.text = error.response.data.message; |
905 | this.color = "error"; | 932 | this.color = "error"; |
906 | }); | 933 | }); |
907 | }, | 934 | }, |
908 | displaySearch() { | 935 | displaySearch() { |
909 | this.show = false; | 936 | this.show = false; |
910 | this.showSearch = true; | 937 | this.showSearch = true; |
911 | }, | 938 | }, |
912 | closeSearch() { | 939 | closeSearch() { |
913 | this.showSearch = false; | 940 | this.showSearch = false; |
914 | this.show = true; | 941 | this.show = true; |
915 | this.search = ""; | 942 | this.search = ""; |
916 | } | 943 | }, |
917 | }, | 944 | }, |
918 | mounted() { | 945 | mounted() { |
919 | this.token = this.$store.state.token; | 946 | this.token = this.$store.state.token; |
920 | this.getAllClasses(); | 947 | this.getAllClasses(); |
921 | this.getGalleryList(); | 948 | this.getGalleryList(); |
922 | } | 949 | }, |
923 | }; | 950 | }; |
924 | </script> | 951 | </script> |
src/pages/Holiday/holiday.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT HOLIDAY ****** --> | 3 | <!-- ****** EDIT HOLIDAY ****** --> |
4 | <v-dialog v-model="editHolidayDialog" max-width="500px"> | 4 | <v-dialog v-model="editHolidayDialog" 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 Holiday</label> | 8 | <label class="title text-xs-center">Edit Holiday</label> |
9 | <v-icon size="24" class="right" @click="editHolidayDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editHolidayDialog = 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">Occasion:</label> | 16 | <label class="right">Occasion:</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 | 19 | <v-text-field |
20 | v-model="editedItem.occasion" | 20 | v-model="editedItem.occasion" |
21 | placeholder="fill your Occasion" | 21 | placeholder="fill your Occasion" |
22 | name="name" | 22 | name="name" |
23 | type="text" | 23 | type="text" |
24 | ></v-text-field> | 24 | ></v-text-field> |
25 | </v-flex> | 25 | </v-flex> |
26 | </v-layout> | 26 | </v-layout> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs12 sm12> | 28 | <v-flex xs12 sm12> |
29 | <v-layout> | 29 | <v-layout> |
30 | <v-flex xs4 class="pt-4 subheading"> | 30 | <v-flex xs4 class="pt-4 subheading"> |
31 | <label class="right">Date:</label> | 31 | <label class="right">Date:</label> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs8 class="ml-3"> | 33 | <v-flex xs8 class="ml-3"> |
34 | <v-menu | 34 | <v-menu |
35 | ref="menu" | 35 | ref="menu" |
36 | :close-on-content-click="false" | 36 | :close-on-content-click="false" |
37 | :return-value.sync="editedItem.dateOfHoliday" | 37 | :return-value.sync="editedItem.dateOfHoliday" |
38 | v-model="menu" | 38 | v-model="menu" |
39 | :nudge-right="40" | 39 | :nudge-right="40" |
40 | lazy | 40 | lazy |
41 | transition="scale-transition" | 41 | transition="scale-transition" |
42 | offset-y | 42 | offset-y |
43 | full-width | 43 | full-width |
44 | min-width="290px" | 44 | min-width="290px" |
45 | > | 45 | > |
46 | <v-text-field | 46 | <v-text-field |
47 | slot="activator" | 47 | slot="activator" |
48 | :rules="dateRules" | 48 | :rules="dateRules" |
49 | v-model="editedItem.dateOfHoliday" | 49 | v-model="editedItem.dateOfHoliday" |
50 | append-icon="event" | 50 | append-icon="event" |
51 | placeholder="Select date" | 51 | placeholder="Select date" |
52 | ></v-text-field> | 52 | ></v-text-field> |
53 | <v-date-picker | 53 | <v-date-picker |
54 | ref="picker" | 54 | ref="picker" |
55 | color="info" | 55 | color="info" |
56 | v-model="editedItem.dateOfHoliday" | 56 | v-model="editedItem.dateOfHoliday" |
57 | @input="$refs.menu.save(editedItem.dateOfHoliday)" | 57 | @input="$refs.menu.save(editedItem.dateOfHoliday)" |
58 | ></v-date-picker> | 58 | ></v-date-picker> |
59 | </v-menu> | 59 | </v-menu> |
60 | </v-flex> | 60 | </v-flex> |
61 | </v-layout> | 61 | </v-layout> |
62 | </v-flex> | 62 | </v-flex> |
63 | <v-layout> | 63 | <v-layout> |
64 | <v-flex xs12 sm12> | 64 | <v-flex xs12 sm12> |
65 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 65 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
66 | <v-spacer></v-spacer> | 66 | <v-spacer></v-spacer> |
67 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 67 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
68 | </v-card-actions> | 68 | </v-card-actions> |
69 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 69 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
70 | <v-spacer></v-spacer> | 70 | <v-spacer></v-spacer> |
71 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 71 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
72 | <v-spacer></v-spacer> | 72 | <v-spacer></v-spacer> |
73 | </v-card-actions> | 73 | </v-card-actions> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | </v-container> | 76 | </v-container> |
77 | </v-card> | 77 | </v-card> |
78 | </v-dialog> | 78 | </v-dialog> |
79 | 79 | ||
80 | <!-- ****** PROFILE VIEW Holiday DEATILS ****** --> | 80 | <!-- ****** PROFILE VIEW Holiday DEATILS ****** --> |
81 | 81 | ||
82 | <v-dialog v-model="viewHolidayDialog" max-width="500px"> | 82 | <v-dialog v-model="viewHolidayDialog" max-width="500px"> |
83 | <v-card flat class="card-style pa-3" dark> | 83 | <v-card flat class="card-style pa-3" dark> |
84 | <v-layout> | 84 | <v-layout> |
85 | <v-flex xs12> | 85 | <v-flex xs12> |
86 | <label class="title text-xs-center">View Holiday</label> | 86 | <label class="title text-xs-center">View Holiday</label> |
87 | <v-icon size="24" class="right" @click="viewHolidayDialog = false">cancel</v-icon> | 87 | <v-icon size="24" class="right" @click="viewHolidayDialog = false">cancel</v-icon> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-layout> | 89 | </v-layout> |
90 | <v-card-text> | 90 | <v-card-text> |
91 | <v-container grid-list-md> | 91 | <v-container grid-list-md> |
92 | <v-layout wrap> | 92 | <v-layout wrap> |
93 | <v-flex> | 93 | <v-flex> |
94 | <v-layout> | 94 | <v-layout> |
95 | <v-flex xs4 sm6> | 95 | <v-flex xs4 sm6> |
96 | <h5 class="right my-1"> | 96 | <h5 class="right my-1"> |
97 | <b>Occasion:</b> | 97 | <b>Occasion:</b> |
98 | </h5> | 98 | </h5> |
99 | </v-flex> | 99 | </v-flex> |
100 | <v-flex sm6 xs8> | 100 | <v-flex sm6 xs8> |
101 | <h5 class="my-1">{{ editedItem.occasion }}</h5> | 101 | <h5 class="my-1">{{ editedItem.occasion }}</h5> |
102 | </v-flex> | 102 | </v-flex> |
103 | </v-layout> | 103 | </v-layout> |
104 | <v-layout> | 104 | <v-layout> |
105 | <v-flex xs4 sm6> | 105 | <v-flex xs4 sm6> |
106 | <h5 class="right my-1"> | 106 | <h5 class="right my-1"> |
107 | <b>Date:</b> | 107 | <b>Date:</b> |
108 | </h5> | 108 | </h5> |
109 | </v-flex> | 109 | </v-flex> |
110 | <v-flex sm6 xs8> | 110 | <v-flex sm6 xs8> |
111 | <h5 class="my-1">{{ editedItem.dateOfHoliday }}</h5> | 111 | <h5 class="my-1">{{ editedItem.dateOfHoliday }}</h5> |
112 | </v-flex> | 112 | </v-flex> |
113 | </v-layout> | 113 | </v-layout> |
114 | </v-flex> | 114 | </v-flex> |
115 | </v-layout> | 115 | </v-layout> |
116 | </v-container> | 116 | </v-container> |
117 | </v-card-text> | 117 | </v-card-text> |
118 | </v-card> | 118 | </v-card> |
119 | </v-dialog> | 119 | </v-dialog> |
120 | <!-- ****** Holiday TABLE ****** --> | 120 | <!-- ****** Holiday TABLE ****** --> |
121 | <v-toolbar color="transparent" flat> | 121 | <v-toolbar color="transparent" flat> |
122 | <v-btn | 122 | <v-btn |
123 | fab | 123 | fab |
124 | dark | 124 | dark |
125 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 125 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
126 | small | 126 | small |
127 | @click="addHolidayDialog = true" | 127 | @click="addHolidayDialog = true" |
128 | > | 128 | > |
129 | <v-icon dark>add</v-icon> | 129 | <v-icon dark>add</v-icon> |
130 | </v-btn> | 130 | </v-btn> |
131 | <v-btn | 131 | <v-btn |
132 | round | 132 | round |
133 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 133 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
134 | dark | 134 | dark |
135 | @click="addHolidayDialog = true" | 135 | @click="addHolidayDialog = true" |
136 | > | 136 | > |
137 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Holiday | 137 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Holiday |
138 | </v-btn> | 138 | </v-btn> |
139 | <v-spacer></v-spacer> | 139 | <v-spacer></v-spacer> |
140 | <v-card-title class="body-1" v-show="show"> | 140 | <v-card-title class="body-1" v-show="show"> |
141 | <v-btn icon large flat @click="displaySearch"> | 141 | <v-btn icon large flat @click="displaySearch"> |
142 | <v-avatar size="27"> | 142 | <v-avatar size="27"> |
143 | <img src="/static/icon/search.png" alt="icon" /> | 143 | <img src="/static/icon/search.png" alt="icon" /> |
144 | </v-avatar> | 144 | </v-avatar> |
145 | </v-btn> | 145 | </v-btn> |
146 | </v-card-title> | 146 | </v-card-title> |
147 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 147 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
148 | <v-layout> | 148 | <v-layout> |
149 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 149 | <v-text-field |
150 | autofocus | ||
151 | v-model="search" | ||
152 | label="Search" | ||
153 | prepend-inner-icon="search" | ||
154 | color="primary" | ||
155 | ></v-text-field> | ||
150 | <v-icon @click="closeSearch" color="error">close</v-icon> | 156 | <v-icon @click="closeSearch" color="error">close</v-icon> |
151 | </v-layout> | 157 | </v-layout> |
152 | </v-flex> | 158 | </v-flex> |
153 | </v-toolbar> | 159 | </v-toolbar> |
154 | <v-data-table | 160 | <v-data-table |
155 | :headers="headers" | 161 | :headers="headers" |
156 | :items="holidays" | 162 | :items="holidays" |
157 | :pagination.sync="pagination" | 163 | :pagination.sync="pagination" |
158 | :search="search" | 164 | :search="search" |
159 | > | 165 | > |
160 | <template slot="items" slot-scope="props"> | 166 | <template slot="items" slot-scope="props"> |
161 | <tr class="tr"> | 167 | <tr class="tr"> |
162 | <td class="td td-row">{{ props.index + 1}}</td> | 168 | <td class="td td-row">{{ props.index + 1}}</td> |
163 | <td class="text-xs-center td td-row">{{ props.item.occasion}}</td> | 169 | <td class="text-xs-center td td-row">{{ props.item.occasion}}</td> |
164 | <td class="text-xs-center td td-row">{{ dates(props.item.dateOfHoliday) }}</td> | 170 | <td class="text-xs-center td td-row">{{ dates(props.item.dateOfHoliday) }}</td> |
165 | <td class="text-xs-center td td-row"> | 171 | <td class="text-xs-center td td-row"> |
166 | <span> | 172 | <span> |
167 | <v-tooltip top> | 173 | <v-tooltip top> |
168 | <img | 174 | <img |
169 | slot="activator" | 175 | slot="activator" |
170 | style="cursor:pointer; width:25px; height:25px; " | 176 | style="cursor:pointer; width:25px; height:25px; " |
171 | class="mr-3" | 177 | class="mr-3" |
172 | @click="profile(props.item)" | 178 | @click="profile(props.item)" |
173 | src="/static/icon/view.png" | 179 | src="/static/icon/view.png" |
174 | /> | 180 | /> |
175 | <span>View</span> | 181 | <span>View</span> |
176 | </v-tooltip> | 182 | </v-tooltip> |
177 | <v-tooltip top> | 183 | <v-tooltip top> |
178 | <img | 184 | <img |
179 | slot="activator" | 185 | slot="activator" |
180 | style="cursor:pointer; width:20px; height:18px; " | 186 | style="cursor:pointer; width:20px; height:18px; " |
181 | class="mr-3" | 187 | class="mr-3" |
182 | @click="editItem(props.item)" | 188 | @click="editItem(props.item)" |
183 | src="/static/icon/edit.png" | 189 | src="/static/icon/edit.png" |
184 | /> | 190 | /> |
185 | <span>Edit</span> | 191 | <span>Edit</span> |
186 | </v-tooltip> | 192 | </v-tooltip> |
187 | <v-tooltip top> | 193 | <v-tooltip top> |
188 | <img | 194 | <img |
189 | slot="activator" | 195 | slot="activator" |
190 | style="cursor:pointer; width:20px; height:20px; " | 196 | style="cursor:pointer; width:20px; height:20px; " |
191 | class="mr-3" | 197 | class="mr-3" |
192 | @click="deleteItem(props.item)" | 198 | @click="deleteItem(props.item)" |
193 | src="/static/icon/delete.png" | 199 | src="/static/icon/delete.png" |
194 | /> | 200 | /> |
195 | <span>Delete</span> | 201 | <span>Delete</span> |
196 | </v-tooltip> | 202 | </v-tooltip> |
197 | </span> | 203 | </span> |
198 | </td> | 204 | </td> |
199 | </tr> | 205 | </tr> |
200 | </template> | 206 | </template> |
201 | <v-alert | 207 | <v-alert |
202 | slot="no-results" | 208 | slot="no-results" |
203 | :value="true" | 209 | :value="true" |
204 | color="error" | 210 | color="error" |
205 | icon="warning" | 211 | icon="warning" |
206 | >Your search for "{{ search }}" found no results.</v-alert> | 212 | >Your search for "{{ search }}" found no results.</v-alert> |
207 | </v-data-table> | 213 | </v-data-table> |
208 | <!-- ****** ADD MULTIPLE Holiday ****** --> | 214 | <!-- ****** ADD MULTIPLE Holiday ****** --> |
209 | <v-dialog v-model="addHolidayDialog" max-width="400px"> | 215 | <v-dialog v-model="addHolidayDialog" max-width="400px" v-if="addHolidayDialog"> |
210 | <v-card flat class="card-style pa-3" dark> | 216 | <v-card flat class="card-style pa-3" dark> |
211 | <v-layout> | 217 | <v-layout> |
212 | <v-flex xs12> | 218 | <v-flex xs12> |
213 | <label class="title text-xs-center">Add Holiday</label> | 219 | <label class="title text-xs-center">Add Holiday</label> |
214 | <v-icon size="24" class="right" @click="addHolidayDialog = false">cancel</v-icon> | 220 | <v-icon size="24" class="right" @click="closeaddHolidayDialog">cancel</v-icon> |
215 | </v-flex> | 221 | </v-flex> |
216 | </v-layout> | 222 | </v-layout> |
217 | <v-form ref="form" v-model="valid" lazy-validation> | 223 | <v-form ref="form" v-model="valid" lazy-validation> |
218 | <v-container fluid> | 224 | <v-container fluid> |
219 | <v-flex xs12> | 225 | <v-flex xs12> |
220 | <v-layout> | 226 | <v-layout> |
221 | <v-flex xs4 class="pt-4 subheading"> | 227 | <v-flex xs4 class="pt-4 subheading"> |
222 | <label class="right">Occasion:</label> | 228 | <label class="right">Occasion:</label> |
223 | </v-flex> | 229 | </v-flex> |
224 | <v-flex xs8 sm8 class="ml-3"> | 230 | <v-flex xs8 sm8 class="ml-3"> |
225 | <v-text-field | 231 | <v-text-field |
226 | v-model="addHoliday.occasion" | 232 | v-model="addHoliday.occasion" |
227 | placeholder="fill your Occasion" | 233 | placeholder="fill your Occasion" |
228 | type="text" | 234 | type="text" |
229 | :rules="occasionRules" | 235 | :rules="occasionRules" |
230 | required | 236 | required |
231 | ></v-text-field> | 237 | ></v-text-field> |
232 | </v-flex> | 238 | </v-flex> |
233 | </v-layout> | 239 | </v-layout> |
234 | </v-flex> | 240 | </v-flex> |
235 | <v-flex xs12> | 241 | <v-flex xs12> |
236 | <v-layout> | 242 | <v-layout> |
237 | <v-flex xs4 class="pt-4 subheading"> | 243 | <v-flex xs4 class="pt-4 subheading"> |
238 | <label class="right">Date:</label> | 244 | <label class="right">Date:</label> |
239 | </v-flex> | 245 | </v-flex> |
240 | <v-flex xs8 sm8 class="ml-3"> | 246 | <v-flex xs8 sm8 class="ml-3"> |
241 | <v-menu | 247 | <v-menu |
242 | ref="menu1" | 248 | ref="menu1" |
243 | :close-on-content-click="false" | 249 | :close-on-content-click="false" |
244 | v-model="menu1" | 250 | v-model="menu1" |
245 | :nudge-right="40" | 251 | :nudge-right="40" |
246 | :return-value.sync="addHoliday.dateOfHoliday" | 252 | :return-value.sync="addHoliday.dateOfHoliday" |
247 | lazy | 253 | lazy |
248 | transition="scale-transition" | 254 | transition="scale-transition" |
249 | offset-y | 255 | offset-y |
250 | full-width | 256 | full-width |
251 | min-width="290px" | 257 | min-width="290px" |
252 | > | 258 | > |
253 | <v-text-field | 259 | <v-text-field |
254 | slot="activator" | 260 | slot="activator" |
255 | :rules="dateRules" | 261 | :rules="dateRules" |
256 | v-model="addHoliday.dateOfHoliday" | 262 | v-model="addHoliday.dateOfHoliday" |
257 | append-icon="event" | 263 | append-icon="event" |
258 | label="Select date" | 264 | label="Select date" |
259 | ></v-text-field> | 265 | ></v-text-field> |
260 | <v-date-picker | 266 | <v-date-picker |
261 | ref="picker" | 267 | ref="picker" |
262 | color="info" | 268 | color="info" |
263 | v-model="addHoliday.dateOfHoliday" | 269 | v-model="addHoliday.dateOfHoliday" |
264 | @input="$refs.menu1.save(addHoliday.dateOfHoliday)" | 270 | @input="$refs.menu1.save(addHoliday.dateOfHoliday)" |
265 | ></v-date-picker> | 271 | ></v-date-picker> |
266 | </v-menu> | 272 | </v-menu> |
267 | </v-flex> | 273 | </v-flex> |
268 | </v-layout> | 274 | </v-layout> |
269 | </v-flex> | 275 | </v-flex> |
270 | <v-layout> | 276 | <v-layout> |
271 | <v-flex xs12> | 277 | <v-flex xs12> |
272 | <v-layout class="right"> | 278 | <v-layout class="right"> |
273 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 279 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
274 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 280 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
275 | </v-layout> | 281 | </v-layout> |
276 | </v-flex> | 282 | </v-flex> |
277 | </v-layout> | 283 | </v-layout> |
278 | </v-container> | 284 | </v-container> |
279 | </v-form> | 285 | </v-form> |
280 | </v-card> | 286 | </v-card> |
281 | </v-dialog> | 287 | </v-dialog> |
282 | <v-snackbar | 288 | <v-snackbar |
283 | :timeout="timeout" | 289 | :timeout="timeout" |
284 | :top="y === 'top'" | 290 | :top="y === 'top'" |
285 | :right="x === 'right'" | 291 | :right="x === 'right'" |
286 | :vertical="mode === 'vertical'" | 292 | :vertical="mode === 'vertical'" |
287 | v-model="snackbar" | 293 | v-model="snackbar" |
288 | :color="color" | 294 | :color="color" |
289 | >{{ text }}</v-snackbar> | 295 | >{{ text }}</v-snackbar> |
290 | <div class="loader" v-if="showLoader"> | 296 | <div class="loader" v-if="showLoader"> |
291 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 297 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
292 | </div> | 298 | </div> |
293 | </v-container> | 299 | </v-container> |
294 | </template> | 300 | </template> |
295 | 301 | ||
296 | <script> | 302 | <script> |
297 | import http from "@/Services/http.js"; | 303 | import http from "@/Services/http.js"; |
298 | import moment from "moment"; | 304 | import moment from "moment"; |
299 | 305 | ||
300 | export default { | 306 | export default { |
301 | data: () => ({ | 307 | data: () => ({ |
302 | snackbar: false, | 308 | snackbar: false, |
303 | y: "top", | 309 | y: "top", |
304 | x: "right", | 310 | x: "right", |
305 | mode: "", | 311 | mode: "", |
306 | timeout: 3000, | 312 | timeout: 3000, |
307 | text: "", | 313 | text: "", |
308 | loading: false, | 314 | loading: false, |
309 | date: null, | 315 | date: null, |
310 | search: "", | 316 | search: "", |
311 | color: "", | 317 | color: "", |
312 | show: true, | 318 | show: true, |
313 | addHolidayDialog: false, | 319 | addHolidayDialog: false, |
314 | showSearch: false, | 320 | showSearch: false, |
315 | showLoader: false, | 321 | showLoader: false, |
316 | editHolidayDialog: false, | 322 | editHolidayDialog: false, |
317 | viewHolidayDialog: false, | 323 | viewHolidayDialog: false, |
318 | valid: true, | 324 | valid: true, |
319 | pagination: { | 325 | pagination: { |
320 | rowsPerPage: 10 | 326 | rowsPerPage: 10, |
321 | }, | 327 | }, |
322 | date: null, | 328 | date: null, |
323 | menu1: false, | 329 | menu1: false, |
324 | menu: false, | 330 | menu: false, |
325 | occasionRules: [v => !!v || "Occasion is required"], | 331 | occasionRules: [(v) => !!v || "Occasion is required"], |
326 | dateRules: [v => !!v || "Date is required"], | 332 | dateRules: [(v) => !!v || "Date is required"], |
327 | headers: [ | 333 | headers: [ |
328 | { | 334 | { |
329 | text: "No", | 335 | text: "No", |
330 | align: "", | 336 | align: "", |
331 | sortable: false, | 337 | sortable: false, |
332 | value: "No" | 338 | value: "No", |
333 | }, | 339 | }, |
334 | { text: "Occasion", value: "occasion", sortable: false, align: "center" }, | 340 | { text: "Occasion", value: "occasion", sortable: false, align: "center" }, |
335 | { | 341 | { |
336 | text: "Date Of Holiday", | 342 | text: "Date Of Holiday", |
337 | value: "dateOfHoliday", | 343 | value: "dateOfHoliday", |
338 | sortable: false, | 344 | sortable: false, |
339 | align: "center" | 345 | align: "center", |
340 | }, | 346 | }, |
341 | { text: "Action", value: "", sortable: false, align: "center" } | 347 | { text: "Action", value: "", sortable: false, align: "center" }, |
342 | ], | 348 | ], |
343 | holidays: [], | 349 | holidays: [], |
344 | editedIndex: -1, | 350 | editedIndex: -1, |
345 | addHoliday: {}, | 351 | addHoliday: {}, |
346 | editedItem: {} | 352 | editedItem: {}, |
347 | }), | 353 | }), |
354 | watch: { | ||
355 | addHolidayDialog: function (val) { | ||
356 | if (!val) { | ||
357 | this.addHoliday = []; | ||
358 | this.menu1 = false; | ||
359 | } | ||
360 | }, | ||
361 | }, | ||
348 | methods: { | 362 | methods: { |
349 | dates: function(date) { | 363 | dates: function (date) { |
350 | return moment(date).format("MMMM DD, YYYY"); | 364 | return moment(date).format("MMMM DD, YYYY"); |
351 | }, | 365 | }, |
352 | getHolidays() { | 366 | getHolidays() { |
353 | this.showLoader = true; | 367 | this.showLoader = true; |
354 | var token = this.$store.state.token; | 368 | var token = this.$store.state.token; |
355 | http() | 369 | http() |
356 | .get("/getHolidaysList", { | 370 | .get("/getHolidaysList", { |
357 | headers: { Authorization: "Bearer " + token } | 371 | headers: { Authorization: "Bearer " + token }, |
358 | }) | 372 | }) |
359 | .then(response => { | 373 | .then((response) => { |
360 | this.holidays = response.data.data; | 374 | this.holidays = response.data.data; |
361 | this.showLoader = false; | 375 | this.showLoader = false; |
362 | }) | 376 | }) |
363 | .catch(err => { | 377 | .catch((err) => { |
364 | this.showLoader = false; | 378 | this.showLoader = false; |
365 | if (error.response.status === 401) { | 379 | if (error.response.status === 401) { |
366 | this.$router.replace({ path: "/" }); | 380 | this.$router.replace({ path: "/" }); |
367 | this.$store.dispatch("setToken", null); | 381 | this.$store.dispatch("setToken", null); |
368 | this.$store.dispatch("Id", null); | 382 | this.$store.dispatch("Id", null); |
369 | } | 383 | } |
370 | }); | 384 | }); |
371 | }, | 385 | }, |
372 | editItem(item) { | 386 | editItem(item) { |
373 | this.editedIndex = this.holidays.indexOf(item); | 387 | this.editedIndex = this.holidays.indexOf(item); |
374 | this.editedItem = Object.assign({}, item); | 388 | this.editedItem = Object.assign({}, item); |
375 | this.editedItem.holidayId = item._id; | 389 | this.editedItem.holidayId = item._id; |
376 | this.editHolidayDialog = true; | 390 | this.editHolidayDialog = true; |
377 | }, | 391 | }, |
378 | profile(item) { | 392 | profile(item) { |
379 | this.editedIndex = this.holidays.indexOf(item); | 393 | this.editedIndex = this.holidays.indexOf(item); |
380 | this.editedItem = Object.assign({}, item); | 394 | this.editedItem = Object.assign({}, item); |
381 | this.viewHolidayDialog = true; | 395 | this.viewHolidayDialog = true; |
382 | }, | 396 | }, |
383 | 397 | ||
384 | deleteItem(item) { | 398 | deleteItem(item) { |
385 | let deleteHoliday = { | 399 | let deleteHoliday = { |
386 | holidayId: item._id | 400 | holidayId: item._id, |
387 | }; | 401 | }; |
388 | http() | 402 | http() |
389 | .delete( | 403 | .delete( |
390 | "/deleteHoliday", | 404 | "/deleteHoliday", |
391 | confirm("Are you sure you want to delete this?") && { | 405 | confirm("Are you sure you want to delete this?") && { |
392 | params: deleteHoliday | 406 | params: deleteHoliday, |
393 | } | 407 | } |
394 | ) | 408 | ) |
395 | .then(response => { | 409 | .then((response) => { |
396 | this.snackbar = true; | 410 | this.snackbar = true; |
397 | this.text = response.data.message; | 411 | this.text = response.data.message; |
398 | this.color = "green"; | 412 | this.color = "green"; |
399 | this.getHolidays(); | 413 | this.getHolidays(); |
400 | }) | 414 | }) |
401 | .catch(error => { | 415 | .catch((error) => { |
402 | this.snackbar = true; | 416 | this.snackbar = true; |
403 | this.text = error.response.data.message; | 417 | this.text = error.response.data.message; |
404 | this.color = "error"; | 418 | this.color = "error"; |
405 | }); | 419 | }); |
406 | }, | 420 | }, |
407 | close() { | 421 | close() { |
408 | this.editHolidayDialog = false; | 422 | this.editHolidayDialog = false; |
409 | }, | 423 | }, |
424 | closeaddHolidayDialog() { | ||
425 | this.addHolidayDialog = false; | ||
426 | this.addHoliday = []; | ||
427 | this.menu1 = false; | ||
428 | }, | ||
410 | submit() { | 429 | submit() { |
411 | if (this.$refs.form.validate()) { | 430 | if (this.$refs.form.validate()) { |
412 | this.loading = true; | 431 | this.loading = true; |
413 | http() | 432 | http() |
414 | .post("/createHoliday", this.addHoliday) | 433 | .post("/createHoliday", this.addHoliday) |
415 | .then(response => { | 434 | .then((response) => { |
416 | this.snackbar = true; | 435 | this.snackbar = true; |
417 | this.text = response.data.message; | 436 | this.text = response.data.message; |
418 | this.color = "green"; | 437 | this.color = "green"; |
419 | this.getHolidays(); | 438 | this.getHolidays(); |
420 | this.addHolidayDialog = false; | 439 | this.addHolidayDialog = false; |
421 | this.clear(); | 440 | this.clear(); |
422 | this.loading = false; | 441 | this.loading = false; |
423 | }) | 442 | }) |
424 | .catch(error => { | 443 | .catch((error) => { |
425 | this.snackbar = true; | 444 | this.snackbar = true; |
426 | this.text = error.response.data.message; | 445 | this.text = error.response.data.message; |
427 | this.loading = false; | 446 | this.loading = false; |
428 | this.color = "error"; | 447 | this.color = "error"; |
429 | }); | 448 | }); |
430 | } | 449 | } |
431 | }, | 450 | }, |
432 | clear() { | 451 | clear() { |
433 | this.$refs.form.reset(); | 452 | this.$refs.form.reset(); |
434 | }, | 453 | }, |
435 | save() { | 454 | save() { |
436 | http() | 455 | http() |
437 | .put("/updateHoliday", this.editedItem) | 456 | .put("/updateHoliday", this.editedItem) |
438 | .then(response => { | 457 | .then((response) => { |
439 | this.snackbar = true; | 458 | this.snackbar = true; |
440 | this.text = response.data.message; | 459 | this.text = response.data.message; |
441 | this.getHolidays(); | 460 | this.getHolidays(); |
442 | this.color = "green"; | 461 | this.color = "green"; |
443 | this.close(); | 462 | this.close(); |
444 | }) | 463 | }) |
445 | .catch(error => { | 464 | .catch((error) => { |
446 | this.snackbar = true; | 465 | this.snackbar = true; |
447 | this.text = error.response.data.message; | 466 | this.text = error.response.data.message; |
448 | this.loading = false; | 467 | this.loading = false; |
449 | this.color = "error"; | 468 | this.color = "error"; |
450 | }); | 469 | }); |
451 | }, | 470 | }, |
452 | displaySearch() { | 471 | displaySearch() { |
453 | (this.show = false), (this.showSearch = true); | 472 | (this.show = false), (this.showSearch = true); |
454 | }, | 473 | }, |
455 | closeSearch() { | 474 | closeSearch() { |
456 | this.showSearch = false; | 475 | this.showSearch = false; |
457 | this.show = true; | 476 | this.show = true; |
458 | this.search = ""; | 477 | this.search = ""; |
459 | } | 478 | }, |
460 | }, | 479 | }, |
461 | mounted() { | 480 | mounted() { |
462 | this.getHolidays(); | 481 | this.getHolidays(); |
463 | } | 482 | }, |
464 | }; | 483 | }; |
465 | </script> | 484 | </script> |
src/pages/Library/books.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Member ****** --> | 3 | <!-- ****** Edit Member ****** --> |
4 | <v-dialog v-model="editBookDialog" max-width="500px"> | 4 | <v-dialog v-model="editBookDialog" 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 Book</label> | 8 | <label class="title text-xs-center">Edit Book</label> |
9 | <v-icon size="24" class="right" @click="editBookDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editBookDialog = 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-container> | 13 | <v-container> |
14 | <v-layout wrap justify-center> | 14 | <v-layout wrap justify-center> |
15 | <v-flex xs12> | 15 | <v-flex xs12> |
16 | <v-form> | 16 | <v-form> |
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 pr-3">Name:</label> | 19 | <label class="right pr-3">Name:</label> |
20 | </v-flex> | 20 | </v-flex> |
21 | <v-flex xs8> | 21 | <v-flex xs8> |
22 | <v-text-field v-model="editedItem.name" placeholder="fill your Name"></v-text-field> | 22 | <v-text-field v-model="editedItem.name" placeholder="fill your Name"></v-text-field> |
23 | </v-flex> | 23 | </v-flex> |
24 | </v-layout> | 24 | </v-layout> |
25 | <v-layout> | 25 | <v-layout> |
26 | <v-flex xs4 class="pt-4 subheading"> | 26 | <v-flex xs4 class="pt-4 subheading"> |
27 | <label class="right pr-3">Author:</label> | 27 | <label class="right pr-3">Author:</label> |
28 | </v-flex> | 28 | </v-flex> |
29 | <v-flex xs8> | 29 | <v-flex xs8> |
30 | <v-text-field v-model="editedItem.author" placeholder="fill your Author Name"></v-text-field> | 30 | <v-text-field v-model="editedItem.author" placeholder="fill your Author Name"></v-text-field> |
31 | </v-flex> | 31 | </v-flex> |
32 | </v-layout> | 32 | </v-layout> |
33 | <v-layout> | 33 | <v-layout> |
34 | <v-flex xs4 class="pt-4 subheading"> | 34 | <v-flex xs4 class="pt-4 subheading"> |
35 | <label class="right pr-3">Subject Code:</label> | 35 | <label class="right pr-3">Subject Code:</label> |
36 | </v-flex> | 36 | </v-flex> |
37 | <v-flex xs8> | 37 | <v-flex xs8> |
38 | <v-text-field | 38 | <v-text-field |
39 | v-model="editedItem.subjectCode" | 39 | v-model="editedItem.subjectCode" |
40 | placeholder="fill your Subject Code" | 40 | placeholder="fill your Subject Code" |
41 | ></v-text-field> | 41 | ></v-text-field> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs4 class="pt-4 subheading"> | 45 | <v-flex xs4 class="pt-4 subheading"> |
46 | <label class="right pr-3">Price:</label> | 46 | <label class="right pr-3">Price:</label> |
47 | </v-flex> | 47 | </v-flex> |
48 | <v-flex xs8> | 48 | <v-flex xs8> |
49 | <v-text-field | 49 | <v-text-field |
50 | v-model="editedItem.price" | 50 | v-model="editedItem.price" |
51 | placeholder="fill your Subject Code" | 51 | placeholder="fill your Subject Code" |
52 | ></v-text-field> | 52 | ></v-text-field> |
53 | </v-flex> | 53 | </v-flex> |
54 | </v-layout> | 54 | </v-layout> |
55 | <v-layout> | 55 | <v-layout> |
56 | <v-flex xs4 class="pt-4 subheading"> | 56 | <v-flex xs4 class="pt-4 subheading"> |
57 | <label class="right pr-3">Quantity:</label> | 57 | <label class="right pr-3">Quantity:</label> |
58 | </v-flex> | 58 | </v-flex> |
59 | <v-flex xs8> | 59 | <v-flex xs8> |
60 | <v-text-field | 60 | <v-text-field |
61 | v-model="editedItem.quantity" | 61 | v-model="editedItem.quantity" |
62 | type="number" | 62 | type="number" |
63 | placeholder="fill your Quantity" | 63 | placeholder="fill your Quantity" |
64 | ></v-text-field> | 64 | ></v-text-field> |
65 | </v-flex> | 65 | </v-flex> |
66 | </v-layout> | 66 | </v-layout> |
67 | <v-layout> | 67 | <v-layout> |
68 | <v-flex xs4 class="pt-4 subheading"> | 68 | <v-flex xs4 class="pt-4 subheading"> |
69 | <label class="right pr-3">Rack No:</label> | 69 | <label class="right pr-3">Rack No:</label> |
70 | </v-flex> | 70 | </v-flex> |
71 | <v-flex xs8> | 71 | <v-flex xs8> |
72 | <v-text-field v-model="editedItem.rackNo" placeholder="fill your Rack No"></v-text-field> | 72 | <v-text-field v-model="editedItem.rackNo" placeholder="fill your Rack No"></v-text-field> |
73 | </v-flex> | 73 | </v-flex> |
74 | </v-layout> | 74 | </v-layout> |
75 | <v-card-actions> | 75 | <v-card-actions> |
76 | <v-spacer></v-spacer> | 76 | <v-spacer></v-spacer> |
77 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 77 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
78 | <v-spacer></v-spacer> | 78 | <v-spacer></v-spacer> |
79 | </v-card-actions> | 79 | </v-card-actions> |
80 | </v-form> | 80 | </v-form> |
81 | </v-flex> | 81 | </v-flex> |
82 | </v-layout> | 82 | </v-layout> |
83 | </v-container> | 83 | </v-container> |
84 | </v-card-text> | 84 | </v-card-text> |
85 | </v-card> | 85 | </v-card> |
86 | </v-dialog> | 86 | </v-dialog> |
87 | 87 | ||
88 | <!-- ****** PROFILE VIEW BOOKS DATA ****** --> | 88 | <!-- ****** PROFILE VIEW BOOKS DATA ****** --> |
89 | 89 | ||
90 | <v-dialog v-model="viewBookDialog" max-width="500px"> | 90 | <v-dialog v-model="viewBookDialog" max-width="500px"> |
91 | <v-card flat class="card-style pa-3" dark> | 91 | <v-card flat class="card-style pa-3" dark> |
92 | <v-layout> | 92 | <v-layout> |
93 | <v-flex xs12> | 93 | <v-flex xs12> |
94 | <label class="title text-xs-center">View Book</label> | 94 | <label class="title text-xs-center">View Book</label> |
95 | <v-icon size="24" class="right" @click="viewBookDialog = false">cancel</v-icon> | 95 | <v-icon size="24" class="right" @click="viewBookDialog = false">cancel</v-icon> |
96 | </v-flex> | 96 | </v-flex> |
97 | </v-layout> | 97 | </v-layout> |
98 | <v-card-text> | 98 | <v-card-text> |
99 | <v-container grid-list-md> | 99 | <v-container grid-list-md> |
100 | <v-layout wrap> | 100 | <v-layout wrap> |
101 | <v-flex> | 101 | <v-flex> |
102 | <v-layout> | 102 | <v-layout> |
103 | <v-flex xs5 sm6> | 103 | <v-flex xs5 sm6> |
104 | <h5 class="right my-1"> | 104 | <h5 class="right my-1"> |
105 | <b>Name :</b> | 105 | <b>Name :</b> |
106 | </h5> | 106 | </h5> |
107 | </v-flex> | 107 | </v-flex> |
108 | <v-flex sm6 xs8> | 108 | <v-flex sm6 xs8> |
109 | <h5 class="my-1">{{ editedItem.name }}</h5> | 109 | <h5 class="my-1">{{ editedItem.name }}</h5> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | <v-layout> | 112 | <v-layout> |
113 | <v-flex xs5 sm6> | 113 | <v-flex xs5 sm6> |
114 | <h5 class="right my-1"> | 114 | <h5 class="right my-1"> |
115 | <b>Author :</b> | 115 | <b>Author :</b> |
116 | </h5> | 116 | </h5> |
117 | </v-flex> | 117 | </v-flex> |
118 | <v-flex sm6 xs8> | 118 | <v-flex sm6 xs8> |
119 | <h5 class="my-1">{{ editedItem.author }}</h5> | 119 | <h5 class="my-1">{{ editedItem.author }}</h5> |
120 | </v-flex> | 120 | </v-flex> |
121 | </v-layout> | 121 | </v-layout> |
122 | <v-layout> | 122 | <v-layout> |
123 | <v-flex xs5 sm6> | 123 | <v-flex xs5 sm6> |
124 | <h5 class="right my-1"> | 124 | <h5 class="right my-1"> |
125 | <b>Subject Code :</b> | 125 | <b>Subject Code :</b> |
126 | </h5> | 126 | </h5> |
127 | </v-flex> | 127 | </v-flex> |
128 | <v-flex sm6 xs8> | 128 | <v-flex sm6 xs8> |
129 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> | 129 | <h5 class="my-1">{{ editedItem.subjectCode }}</h5> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | <v-layout> | 132 | <v-layout> |
133 | <v-flex xs5 sm6> | 133 | <v-flex xs5 sm6> |
134 | <h5 class="right my-1"> | 134 | <h5 class="right my-1"> |
135 | <b>Price :</b> | 135 | <b>Price :</b> |
136 | </h5> | 136 | </h5> |
137 | </v-flex> | 137 | </v-flex> |
138 | <v-flex sm6 xs8> | 138 | <v-flex sm6 xs8> |
139 | <h5 class="my-1">{{ editedItem.price }}</h5> | 139 | <h5 class="my-1">{{ editedItem.price }}</h5> |
140 | </v-flex> | 140 | </v-flex> |
141 | </v-layout> | 141 | </v-layout> |
142 | <v-layout> | 142 | <v-layout> |
143 | <v-flex xs5 sm6> | 143 | <v-flex xs5 sm6> |
144 | <h5 class="right my-1"> | 144 | <h5 class="right my-1"> |
145 | <b>Quantity :</b> | 145 | <b>Quantity :</b> |
146 | </h5> | 146 | </h5> |
147 | </v-flex> | 147 | </v-flex> |
148 | <v-flex sm6 xs8> | 148 | <v-flex sm6 xs8> |
149 | <h5 class="my-1">{{ editedItem.quantity}}</h5> | 149 | <h5 class="my-1">{{ editedItem.quantity}}</h5> |
150 | </v-flex> | 150 | </v-flex> |
151 | </v-layout> | 151 | </v-layout> |
152 | <v-layout> | 152 | <v-layout> |
153 | <v-flex xs5 sm6> | 153 | <v-flex xs5 sm6> |
154 | <h5 class="right my-1"> | 154 | <h5 class="right my-1"> |
155 | <b>Rack No :</b> | 155 | <b>Rack No :</b> |
156 | </h5> | 156 | </h5> |
157 | </v-flex> | 157 | </v-flex> |
158 | <v-flex sm6 xs8> | 158 | <v-flex sm6 xs8> |
159 | <h5 class="my-1">{{ editedItem.rackNo}}</h5> | 159 | <h5 class="my-1">{{ editedItem.rackNo}}</h5> |
160 | </v-flex> | 160 | </v-flex> |
161 | </v-layout> | 161 | </v-layout> |
162 | </v-flex> | 162 | </v-flex> |
163 | </v-layout> | 163 | </v-layout> |
164 | </v-container> | 164 | </v-container> |
165 | </v-card-text> | 165 | </v-card-text> |
166 | </v-card> | 166 | </v-card> |
167 | </v-dialog> | 167 | </v-dialog> |
168 | <!-- ****** BOOKS TABLE ****** --> | 168 | <!-- ****** BOOKS TABLE ****** --> |
169 | 169 | ||
170 | <v-toolbar color="transparent" flat> | 170 | <v-toolbar color="transparent" flat> |
171 | <v-btn | 171 | <v-btn |
172 | fab | 172 | fab |
173 | dark | 173 | dark |
174 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 174 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
175 | small | 175 | small |
176 | @click="addBookDialog = true" | 176 | @click="addBookDialog = true" |
177 | > | 177 | > |
178 | <v-icon dark>add</v-icon> | 178 | <v-icon dark>add</v-icon> |
179 | </v-btn> | 179 | </v-btn> |
180 | <v-btn | 180 | <v-btn |
181 | round | 181 | round |
182 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 182 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
183 | dark | 183 | dark |
184 | @click="addBookDialog = true" | 184 | @click="addBookDialog = true" |
185 | > | 185 | > |
186 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Book | 186 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Book |
187 | </v-btn> | 187 | </v-btn> |
188 | <v-spacer></v-spacer> | 188 | <v-spacer></v-spacer> |
189 | <v-card-title class="body-1" v-show="show"> | 189 | <v-card-title class="body-1" v-show="show"> |
190 | <v-btn icon large flat @click="displaySearch"> | 190 | <v-btn icon large flat @click="displaySearch"> |
191 | <v-avatar size="27"> | 191 | <v-avatar size="27"> |
192 | <img src="/static/icon/search.png" alt="icon" /> | 192 | <img src="/static/icon/search.png" alt="icon" /> |
193 | </v-avatar> | 193 | </v-avatar> |
194 | </v-btn> | 194 | </v-btn> |
195 | </v-card-title> | 195 | </v-card-title> |
196 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 196 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
197 | <v-layout> | 197 | <v-layout> |
198 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 198 | <v-text-field |
199 | autofocus | ||
200 | v-model="search" | ||
201 | label="Search" | ||
202 | prepend-inner-icon="search" | ||
203 | color="primary" | ||
204 | ></v-text-field> | ||
199 | <v-icon @click="closeSearch" color="error">close</v-icon> | 205 | <v-icon @click="closeSearch" color="error">close</v-icon> |
200 | </v-layout> | 206 | </v-layout> |
201 | </v-flex> | 207 | </v-flex> |
202 | </v-toolbar> | 208 | </v-toolbar> |
203 | <v-data-table | 209 | <v-data-table |
204 | :headers="headers" | 210 | :headers="headers" |
205 | :items="bookData" | 211 | :items="bookData" |
206 | :pagination.sync="pagination" | 212 | :pagination.sync="pagination" |
207 | :search="search" | 213 | :search="search" |
208 | > | 214 | > |
209 | <template slot="items" slot-scope="props"> | 215 | <template slot="items" slot-scope="props"> |
210 | <td class="td td-row text-xs-center">{{ props.index + 1}}</td> | 216 | <td class="td td-row text-xs-center">{{ props.index + 1}}</td> |
211 | <td class="td td-row text-xs-center">{{ props.item.name }}</td> | 217 | <td class="td td-row text-xs-center">{{ props.item.name }}</td> |
212 | <td class="td td-row text-xs-center">{{ props.item.author }}</td> | 218 | <td class="td td-row text-xs-center">{{ props.item.author }}</td> |
213 | <td class="td td-row text-xs-center">{{ props.item.subjectCode }}</td> | 219 | <td class="td td-row text-xs-center">{{ props.item.subjectCode }}</td> |
214 | <td class="td td-row text-xs-center">{{ props.item.price }}</td> | 220 | <td class="td td-row text-xs-center">{{ props.item.price }}</td> |
215 | <td class="td td-row text-xs-center">{{ props.item.quantity }}</td> | 221 | <td class="td td-row text-xs-center">{{ props.item.quantity }}</td> |
216 | <td class="td td-row text-xs-center">{{ props.item.rackNo }}</td> | 222 | <td class="td td-row text-xs-center">{{ props.item.rackNo }}</td> |
217 | <td class="td td-row text-xs-center"> | 223 | <td class="td td-row text-xs-center"> |
218 | <span | 224 | <span |
219 | v-if="props.item.status === 'AVAILABLE'" | 225 | v-if="props.item.status === 'AVAILABLE'" |
220 | class="green lighten-1 pa-1 px-2 white--text paymentStatus" | 226 | class="green lighten-1 pa-1 px-2 white--text paymentStatus" |
221 | >{{ props.item.status}}</span> | 227 | >{{ props.item.status}}</span> |
222 | <span | 228 | <span |
223 | v-if="props.item.status === 'UNAVAILABLE'" | 229 | v-if="props.item.status === 'UNAVAILABLE'" |
224 | class="red lighten-1 pa-1 px-2 white--text paymentStatus" | 230 | class="red lighten-1 pa-1 px-2 white--text paymentStatus" |
225 | >{{ props.item.status}}</span> | 231 | >{{ props.item.status}}</span> |
226 | </td> | 232 | </td> |
227 | <td class="text-xs-center td td-row"> | 233 | <td class="text-xs-center td td-row"> |
228 | <span> | 234 | <span> |
229 | <!-- <v-tooltip top> | 235 | <!-- <v-tooltip top> |
230 | <img | 236 | <img |
231 | slot="activator" | 237 | slot="activator" |
232 | style="cursor:pointer; width:25px; height:25px; " | 238 | style="cursor:pointer; width:25px; height:25px; " |
233 | class="mr-3" | 239 | class="mr-3" |
234 | @click="profile(props.item)" | 240 | @click="profile(props.item)" |
235 | src="/static/icon/view.png" | 241 | src="/static/icon/view.png" |
236 | /> | 242 | /> |
237 | <span>View</span> | 243 | <span>View</span> |
238 | </v-tooltip>--> | 244 | </v-tooltip>--> |
239 | <v-tooltip top> | 245 | <v-tooltip top> |
240 | <img | 246 | <img |
241 | slot="activator" | 247 | slot="activator" |
242 | style="cursor:pointer; width:20px; height:18px; " | 248 | style="cursor:pointer; width:20px; height:18px; " |
243 | class="mr-3" | 249 | class="mr-3" |
244 | @click="editItem(props.item)" | 250 | @click="editItem(props.item)" |
245 | src="/static/icon/edit.png" | 251 | src="/static/icon/edit.png" |
246 | /> | 252 | /> |
247 | <span>Edit</span> | 253 | <span>Edit</span> |
248 | </v-tooltip> | 254 | </v-tooltip> |
249 | <v-tooltip top v-if="role != 'TEACHER' "> | 255 | <v-tooltip top v-if="role != 'TEACHER' "> |
250 | <img | 256 | <img |
251 | slot="activator" | 257 | slot="activator" |
252 | style="cursor:pointer; width:20px; height:20px; " | 258 | style="cursor:pointer; width:20px; height:20px; " |
253 | @click="deleteItem(props.item)" | 259 | @click="deleteItem(props.item)" |
254 | src="/static/icon/delete.png" | 260 | src="/static/icon/delete.png" |
255 | /> | 261 | /> |
256 | <span>Delete</span> | 262 | <span>Delete</span> |
257 | </v-tooltip> | 263 | </v-tooltip> |
258 | </span> | 264 | </span> |
259 | </td> | 265 | </td> |
260 | </template> | 266 | </template> |
261 | <v-alert | 267 | <v-alert |
262 | slot="no-results" | 268 | slot="no-results" |
263 | :value="true" | 269 | :value="true" |
264 | color="error" | 270 | color="error" |
265 | icon="warning" | 271 | icon="warning" |
266 | >Your search for "{{ search }}" found no results.</v-alert> | 272 | >Your search for "{{ search }}" found no results.</v-alert> |
267 | </v-data-table> | 273 | </v-data-table> |
268 | <!-- ****** ADD BOOK ****** --> | 274 | <!-- ****** ADD BOOK ****** --> |
269 | <v-dialog v-model="addBookDialog" max-width="600px"> | 275 | <v-dialog v-model="addBookDialog" max-width="600px" v-if="addBookDialog"> |
270 | <v-card flat class="card-style pa-2" dark> | 276 | <v-card flat class="card-style pa-2" dark> |
271 | <v-layout> | 277 | <v-layout> |
272 | <v-flex xs12> | 278 | <v-flex xs12> |
273 | <label class="title text-xs-center">Add Book</label> | 279 | <label class="title text-xs-center">Add Book</label> |
274 | <v-icon size="24" class="right" @click="$refs.form.reset();addBookDialog = false">cancel</v-icon> | 280 | <v-icon size="24" class="right" @click="$refs.form.reset();addBookDialog = false">cancel</v-icon> |
275 | </v-flex> | 281 | </v-flex> |
276 | </v-layout> | 282 | </v-layout> |
277 | <v-container fluid fill-height> | 283 | <v-container fluid fill-height> |
278 | <v-layout align-center> | 284 | <v-layout align-center> |
279 | <v-flex xs12 class="mt-4"> | 285 | <v-flex xs12 class="mt-4"> |
280 | <v-form ref="form" v-model="valid" lazy-validation> | 286 | <v-form ref="form" v-model="valid" lazy-validation> |
281 | <v-layout> | 287 | <v-layout> |
282 | <v-flex xs4 class="pt-4 subheading"> | 288 | <v-flex xs4 class="pt-4 subheading"> |
283 | <label class="right">Name:</label> | 289 | <label class="right">Name:</label> |
284 | </v-flex> | 290 | </v-flex> |
285 | <v-flex xs7 class="ml-3"> | 291 | <v-flex xs7 class="ml-3"> |
286 | <v-text-field | 292 | <v-text-field |
287 | v-model="BooksData.name" | 293 | v-model="BooksData.name" |
288 | placeholder="fill your Name" | 294 | placeholder="fill your Name" |
289 | type="text" | 295 | type="text" |
290 | :rules="nameRules" | 296 | :rules="nameRules" |
291 | required | 297 | required |
292 | ></v-text-field> | 298 | ></v-text-field> |
293 | </v-flex> | 299 | </v-flex> |
294 | </v-layout> | 300 | </v-layout> |
295 | <v-layout> | 301 | <v-layout> |
296 | <v-flex xs4 class="pt-4 subheading"> | 302 | <v-flex xs4 class="pt-4 subheading"> |
297 | <label class="right">Author:</label> | 303 | <label class="right">Author:</label> |
298 | </v-flex> | 304 | </v-flex> |
299 | <v-flex xs7 class="ml-3"> | 305 | <v-flex xs7 class="ml-3"> |
300 | <v-text-field | 306 | <v-text-field |
301 | v-model="BooksData.author" | 307 | v-model="BooksData.author" |
302 | placeholder="fill your Author Name" | 308 | placeholder="fill your Author Name" |
303 | type="text" | 309 | type="text" |
304 | :rules="authorRules" | 310 | :rules="authorRules" |
305 | required | 311 | required |
306 | ></v-text-field> | 312 | ></v-text-field> |
307 | </v-flex> | 313 | </v-flex> |
308 | </v-layout> | 314 | </v-layout> |
309 | <v-layout> | 315 | <v-layout> |
310 | <v-flex xs4 class="pt-4 subheading"> | 316 | <v-flex xs4 class="pt-4 subheading"> |
311 | <label class="right">Subject Code:</label> | 317 | <label class="right">Subject Code:</label> |
312 | </v-flex> | 318 | </v-flex> |
313 | <v-flex xs7 class="ml-3"> | 319 | <v-flex xs7 class="ml-3"> |
314 | <v-text-field | 320 | <v-text-field |
315 | v-model="BooksData.subjectCode" | 321 | v-model="BooksData.subjectCode" |
316 | placeholder="fill your Subject Code" | 322 | placeholder="fill your Subject Code" |
317 | type="text" | 323 | type="text" |
318 | :rules="subjectRules" | 324 | :rules="subjectRules" |
319 | required | 325 | required |
320 | ></v-text-field> | 326 | ></v-text-field> |
321 | </v-flex> | 327 | </v-flex> |
322 | </v-layout> | 328 | </v-layout> |
323 | <v-layout> | 329 | <v-layout> |
324 | <v-flex xs4 class="pt-4 subheading"> | 330 | <v-flex xs4 class="pt-4 subheading"> |
325 | <label class="right">Price:</label> | 331 | <label class="right">Price:</label> |
326 | </v-flex> | 332 | </v-flex> |
327 | <v-flex xs7 class="ml-3"> | 333 | <v-flex xs7 class="ml-3"> |
328 | <v-text-field | 334 | <v-text-field |
329 | v-model="BooksData.price" | 335 | v-model="BooksData.price" |
330 | placeholder="fill your Price" | 336 | placeholder="fill your Price" |
331 | :rules="priceRules" | 337 | :rules="priceRules" |
332 | required | 338 | required |
333 | ></v-text-field> | 339 | ></v-text-field> |
334 | </v-flex> | 340 | </v-flex> |
335 | </v-layout> | 341 | </v-layout> |
336 | <v-layout> | 342 | <v-layout> |
337 | <v-flex xs4 class="pt-4 subheading"> | 343 | <v-flex xs4 class="pt-4 subheading"> |
338 | <label class="right">Quantity:</label> | 344 | <label class="right">Quantity:</label> |
339 | </v-flex> | 345 | </v-flex> |
340 | <v-flex xs7 class="ml-3"> | 346 | <v-flex xs7 class="ml-3"> |
341 | <v-text-field | 347 | <v-text-field |
342 | v-model="BooksData.quantity" | 348 | v-model="BooksData.quantity" |
343 | placeholder="fill your Quantity" | 349 | placeholder="fill your Quantity" |
344 | :rules="quantityRules" | 350 | :rules="quantityRules" |
345 | required | 351 | required |
346 | ></v-text-field> | 352 | ></v-text-field> |
347 | </v-flex> | 353 | </v-flex> |
348 | </v-layout> | 354 | </v-layout> |
349 | <v-layout> | 355 | <v-layout> |
350 | <v-flex xs4 class="pt-4 subheading"> | 356 | <v-flex xs4 class="pt-4 subheading"> |
351 | <label class="right">Rack No:</label> | 357 | <label class="right">Rack No:</label> |
352 | </v-flex> | 358 | </v-flex> |
353 | <v-flex xs7 class="ml-3"> | 359 | <v-flex xs7 class="ml-3"> |
354 | <v-text-field | 360 | <v-text-field |
355 | v-model="BooksData.rackNo" | 361 | v-model="BooksData.rackNo" |
356 | placeholder="fill your Rack No" | 362 | placeholder="fill your Rack No" |
357 | :rules="rackNoRules" | 363 | :rules="rackNoRules" |
358 | required | 364 | required |
359 | ></v-text-field> | 365 | ></v-text-field> |
360 | </v-flex> | 366 | </v-flex> |
361 | </v-layout> | 367 | </v-layout> |
362 | <v-layout> | 368 | <v-layout> |
363 | <v-flex xs12> | 369 | <v-flex xs12> |
364 | <v-card-actions> | 370 | <v-card-actions> |
365 | <v-spacer></v-spacer> | 371 | <v-spacer></v-spacer> |
366 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 372 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
367 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 373 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
368 | </v-card-actions> | 374 | </v-card-actions> |
369 | </v-flex> | 375 | </v-flex> |
370 | </v-layout> | 376 | </v-layout> |
371 | </v-form> | 377 | </v-form> |
372 | </v-flex> | 378 | </v-flex> |
373 | </v-layout> | 379 | </v-layout> |
374 | </v-container> | 380 | </v-container> |
375 | </v-card> | 381 | </v-card> |
376 | </v-dialog> | 382 | </v-dialog> |
377 | <v-snackbar | 383 | <v-snackbar |
378 | :timeout="timeout" | 384 | :timeout="timeout" |
379 | :top="y === 'top'" | 385 | :top="y === 'top'" |
380 | :right="x === 'right'" | 386 | :right="x === 'right'" |
381 | :vertical="mode === 'vertical'" | 387 | :vertical="mode === 'vertical'" |
382 | v-model="snackbar" | 388 | v-model="snackbar" |
383 | :color="color" | 389 | :color="color" |
384 | >{{ text }}</v-snackbar> | 390 | >{{ text }}</v-snackbar> |
385 | <div class="loader" v-if="showLoader"> | 391 | <div class="loader" v-if="showLoader"> |
386 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 392 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
387 | </div> | 393 | </div> |
388 | </v-container> | 394 | </v-container> |
389 | </template> | 395 | </template> |
390 | 396 | ||
391 | <script> | 397 | <script> |
392 | import http from "@/Services/http.js"; | 398 | import http from "@/Services/http.js"; |
393 | import Util from "@/util"; | 399 | import Util from "@/util"; |
394 | 400 | ||
395 | export default { | 401 | export default { |
396 | data: () => ({ | 402 | data: () => ({ |
397 | snackbar: false, | 403 | snackbar: false, |
398 | y: "top", | 404 | y: "top", |
399 | x: "right", | 405 | x: "right", |
400 | mode: "", | 406 | mode: "", |
401 | timeout: 5000, | 407 | timeout: 5000, |
402 | text: "", | 408 | text: "", |
403 | color: "", | 409 | color: "", |
404 | show: true, | 410 | show: true, |
405 | showSearch: false, | 411 | showSearch: false, |
406 | showLoader: false, | 412 | showLoader: false, |
407 | loading: false, | 413 | loading: false, |
408 | date: null, | 414 | date: null, |
409 | search: "", | 415 | search: "", |
410 | editBookDialog: false, | 416 | editBookDialog: false, |
411 | viewBookDialog: false, | 417 | viewBookDialog: false, |
412 | valid: true, | 418 | valid: true, |
413 | validEdit: true, | 419 | validEdit: true, |
414 | addBookDialog: false, | 420 | addBookDialog: false, |
415 | pagination: { | 421 | pagination: { |
416 | rowsPerPage: 10, | 422 | rowsPerPage: 10, |
417 | }, | 423 | }, |
418 | nameRules: [(v) => !!v || " Name is required"], | 424 | nameRules: [(v) => !!v || " Name is required"], |
419 | authorRules: [(v) => !!v || "Author Name Monthly"], | 425 | authorRules: [(v) => !!v || "Author Name Monthly"], |
420 | subjectRules: [(v) => !!v || "Subject Code is required"], | 426 | subjectRules: [(v) => !!v || "Subject Code is required"], |
421 | priceRules: [(v) => !!v || "Price is required"], | 427 | priceRules: [(v) => !!v || "Price is required"], |
422 | quantityRules: [(v) => !!v || "Quantity is required"], | 428 | quantityRules: [(v) => !!v || "Quantity is required"], |
423 | rackNoRules: [(v) => !!v || "Rack No. is required"], | 429 | rackNoRules: [(v) => !!v || "Rack No. is required"], |
424 | 430 | ||
425 | headers: [ | 431 | headers: [ |
426 | { | 432 | { |
427 | text: "No", | 433 | text: "No", |
428 | align: "", | 434 | align: "", |
429 | sortable: false, | 435 | sortable: false, |
430 | value: "No", | 436 | value: "No", |
431 | }, | 437 | }, |
432 | { | 438 | { |
433 | text: "Name", | 439 | text: "Name", |
434 | value: "name", | 440 | value: "name", |
435 | sortable: false, | 441 | sortable: false, |
436 | align: "center", | 442 | align: "center", |
437 | }, | 443 | }, |
438 | { text: "Authour", value: "author", sortable: false, align: "center" }, | 444 | { text: "Authour", value: "author", sortable: false, align: "center" }, |
439 | { | 445 | { |
440 | text: "Subject Code", | 446 | text: "Subject Code", |
441 | value: "subjectCode", | 447 | value: "subjectCode", |
442 | sortable: false, | 448 | sortable: false, |
443 | align: "center", | 449 | align: "center", |
444 | }, | 450 | }, |
445 | { text: "Price", value: "price", sortable: false, align: "center" }, | 451 | { text: "Price", value: "price", sortable: false, align: "center" }, |
446 | { text: "Quantity", value: "quantity", sortable: false, align: "center" }, | 452 | { text: "Quantity", value: "quantity", sortable: false, align: "center" }, |
447 | { text: "Rack No", value: "rackNo", sortable: false, align: "center" }, | 453 | { text: "Rack No", value: "rackNo", sortable: false, align: "center" }, |
448 | { text: "Status", value: "status", sortable: false, align: "center" }, | 454 | { text: "Status", value: "status", sortable: false, align: "center" }, |
449 | 455 | ||
450 | { text: "Action", value: "", sortable: false, align: "center" }, | 456 | { text: "Action", value: "", sortable: false, align: "center" }, |
451 | ], | 457 | ], |
452 | bookData: [], | 458 | bookData: [], |
453 | select: "", | 459 | select: "", |
454 | token: "", | 460 | token: "", |
455 | editedItem: {}, | 461 | editedItem: {}, |
456 | BooksData: {}, | 462 | BooksData: {}, |
457 | }), | 463 | }), |
464 | watch: { | ||
465 | addBookDialog: function (val) { | ||
466 | if (!val) { | ||
467 | this.BooksData = []; | ||
468 | } | ||
469 | }, | ||
470 | }, | ||
458 | methods: { | 471 | methods: { |
459 | getBookData() { | 472 | getBookData() { |
460 | this.showLoader = true; | 473 | this.showLoader = true; |
461 | http() | 474 | http() |
462 | .get("/getBooksList", { | 475 | .get("/getBooksList", { |
463 | params: { | 476 | params: { |
464 | schoolId: this.$store.state.schoolId, | 477 | schoolId: this.$store.state.schoolId, |
465 | }, | 478 | }, |
466 | headers: { Authorization: "Bearer " + this.token }, | 479 | headers: { Authorization: "Bearer " + this.token }, |
467 | }) | 480 | }) |
468 | .then((response) => { | 481 | .then((response) => { |
469 | this.bookData = response.data.data; | 482 | this.bookData = response.data.data; |
470 | this.showLoader = false; | 483 | this.showLoader = false; |
471 | }) | 484 | }) |
472 | .catch((error) => { | 485 | .catch((error) => { |
473 | this.showLoader = false; | 486 | this.showLoader = false; |
474 | if (error.response.status === 401) { | 487 | if (error.response.status === 401) { |
475 | this.$router.replace({ path: "/" }); | 488 | this.$router.replace({ path: "/" }); |
476 | this.$store.dispatch("setToken", null); | 489 | this.$store.dispatch("setToken", null); |
477 | this.$store.dispatch("Id", null); | 490 | this.$store.dispatch("Id", null); |
478 | } | 491 | } |
479 | }); | 492 | }); |
480 | }, | 493 | }, |
481 | editItem(item) { | 494 | editItem(item) { |
482 | this.editedIndex = this.bookData.indexOf(item); | 495 | this.editedIndex = this.bookData.indexOf(item); |
483 | this.editedItem = Object.assign({}, item); | 496 | this.editedItem = Object.assign({}, item); |
484 | console.log(this.editedItem); | 497 | console.log(this.editedItem); |
485 | this.editBookDialog = true; | 498 | this.editBookDialog = true; |
486 | }, | 499 | }, |
487 | profile(item) { | 500 | profile(item) { |
488 | this.editedIndex = this.bookData.indexOf(item); | 501 | this.editedIndex = this.bookData.indexOf(item); |
489 | this.editedItem = Object.assign({}, item); | 502 | this.editedItem = Object.assign({}, item); |
490 | this.viewBookDialog = true; | 503 | this.viewBookDialog = true; |
491 | }, | 504 | }, |
492 | deleteItem(item) { | 505 | deleteItem(item) { |
493 | let deleteStudent = { | 506 | let deleteStudent = { |
494 | bookId: item._id, | 507 | bookId: item._id, |
495 | }; | 508 | }; |
496 | http() | 509 | http() |
497 | .delete( | 510 | .delete( |
498 | "/deleteBook", | 511 | "/deleteBook", |
499 | confirm("Are you sure you want to delete this?") && { | 512 | confirm("Are you sure you want to delete this?") && { |
500 | params: deleteStudent, | 513 | params: deleteStudent, |
501 | } | 514 | } |
502 | ) | 515 | ) |
503 | .then((response) => { | 516 | .then((response) => { |
504 | this.snackbar = true; | 517 | this.snackbar = true; |
505 | this.text = response.data.message; | 518 | this.text = response.data.message; |
506 | this.color = "green"; | 519 | this.color = "green"; |
507 | this.getBookData(); | 520 | this.getBookData(); |
508 | }) | 521 | }) |
509 | .catch((error) => { | 522 | .catch((error) => { |
510 | this.snackbar = true; | 523 | this.snackbar = true; |
511 | this.text = error.response.data.message; | 524 | this.text = error.response.data.message; |
512 | this.color = "error"; | 525 | this.color = "error"; |
513 | }); | 526 | }); |
514 | }, | 527 | }, |
515 | closeEditProfile() { | 528 | closeEditProfile() { |
516 | this.editBookDialog = false; | 529 | this.editBookDialog = false; |
517 | }, | 530 | }, |
518 | close2() { | 531 | close2() { |
519 | this.dialog2 = false; | 532 | this.dialog2 = false; |
520 | }, | 533 | }, |
521 | submit() { | 534 | submit() { |
522 | this.BooksData.quantity = Number(this.BooksData.quantity); | 535 | this.BooksData.quantity = Number(this.BooksData.quantity); |
523 | this.BooksData.schoolId = this.$store.state.schoolId; | 536 | this.BooksData.schoolId = this.$store.state.schoolId; |
524 | if (this.$refs.form.validate()) { | 537 | if (this.$refs.form.validate()) { |
525 | this.loading = true; | 538 | this.loading = true; |
526 | http() | 539 | http() |
527 | .post("/createBook", this.BooksData) | 540 | .post("/createBook", this.BooksData) |
528 | .then((response) => { | 541 | .then((response) => { |
529 | this.getBookData(); | 542 | this.getBookData(); |
530 | this.snackbar = true; | 543 | this.snackbar = true; |
531 | this.text = response.data.message; | 544 | this.text = response.data.message; |
532 | this.color = "green"; | 545 | this.color = "green"; |
533 | this.addBookDialog = false; | 546 | this.addBookDialog = false; |
534 | this.clear(); | 547 | this.clear(); |
535 | this.loading = false; | 548 | this.loading = false; |
536 | }) | 549 | }) |
537 | .catch((error) => { | 550 | .catch((error) => { |
538 | this.snackbar = true; | 551 | this.snackbar = true; |
539 | this.text = error.response.data.message; | 552 | this.text = error.response.data.message; |
540 | this.color = "error"; | 553 | this.color = "error"; |
541 | this.loading = false; | 554 | this.loading = false; |
542 | }); | 555 | }); |
543 | } | 556 | } |
544 | }, | 557 | }, |
545 | clear() { | 558 | clear() { |
546 | this.$refs.form.reset(); | 559 | this.$refs.form.reset(); |
547 | }, | 560 | }, |
548 | save() { | 561 | save() { |
549 | this.editedItem.bookId = this.editedItem._id; | 562 | this.editedItem.bookId = this.editedItem._id; |
550 | http() | 563 | http() |
551 | .put("/updateBook", this.editedItem) | 564 | .put("/updateBook", this.editedItem) |
552 | .then((response) => { | 565 | .then((response) => { |
553 | this.snackbar = true; | 566 | this.snackbar = true; |
554 | this.text = response.data.message; | 567 | this.text = response.data.message; |
555 | this.color = "green"; | 568 | this.color = "green"; |
556 | this.getBookData(); | 569 | this.getBookData(); |
557 | this.closeEditProfile(); | 570 | this.closeEditProfile(); |
558 | }) | 571 | }) |
559 | .catch((error) => { | 572 | .catch((error) => { |
560 | this.snackbar = true; | 573 | this.snackbar = true; |
561 | this.text = error.response.data.message; | 574 | this.text = error.response.data.message; |
562 | this.color = "error"; | 575 | this.color = "error"; |
563 | // console.log(error); | 576 | // console.log(error); |
564 | }); | 577 | }); |
565 | }, | 578 | }, |
566 | displaySearch() { | 579 | displaySearch() { |
567 | (this.show = false), (this.showSearch = true); | 580 | (this.show = false), (this.showSearch = true); |
568 | }, | 581 | }, |
569 | closeSearch() { | 582 | closeSearch() { |
570 | this.showSearch = false; | 583 | this.showSearch = false; |
571 | this.show = true; | 584 | this.show = true; |
572 | this.search = ""; | 585 | this.search = ""; |
573 | }, | 586 | }, |
574 | }, | 587 | }, |
575 | mounted() { | 588 | mounted() { |
576 | this.token = this.$store.state.token; | 589 | this.token = this.$store.state.token; |
577 | this.getBookData(); | 590 | this.getBookData(); |
578 | this.role = this.$store.state.role; | 591 | this.role = this.$store.state.role; |
579 | }, | 592 | }, |
580 | }; | 593 | }; |
581 | </script> | 594 | </script> |
582 | 595 |
src/pages/Library/eBook.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS EBOOK DETAILS ****** --> | 3 | <!-- ****** EDITS EBOOK DETAILS ****** --> |
4 | <v-dialog v-model="editEbookDialog" max-width="600px"> | 4 | <v-dialog v-model="editEbookDialog" 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 E-Book</label> | 8 | <label class="title text-xs-center">Edit E-Book</label> |
9 | <v-icon size="24" class="right" @click="editEbookDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editEbookDialog = 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-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 13 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
14 | <input | 14 | <input |
15 | type="file" | 15 | type="file" |
16 | style="display: none" | 16 | style="display: none" |
17 | ref="editImage" | 17 | ref="editImage" |
18 | accept="image/*" | 18 | accept="image/*" |
19 | @change="onEditImagePicked" | 19 | @change="onEditImagePicked" |
20 | /> | 20 | /> |
21 | <img | 21 | <img |
22 | v-if="editedItem.coverPhotoUrl" | 22 | v-if="editedItem.coverPhotoUrl" |
23 | :src="editedItem.coverPhotoUrl" | 23 | :src="editedItem.coverPhotoUrl" |
24 | height="160" | 24 | height="160" |
25 | width="160" | 25 | width="160" |
26 | alt="eBooks" | 26 | alt="eBooks" |
27 | class="pa-2" | 27 | class="pa-2" |
28 | /> | 28 | /> |
29 | <img | 29 | <img |
30 | src="/static/icon/user.png" | 30 | src="/static/icon/user.png" |
31 | v-if="editedItem.coverPhotoUrl == ''" | 31 | v-if="editedItem.coverPhotoUrl == ''" |
32 | height="160" | 32 | height="160" |
33 | width="160" | 33 | width="160" |
34 | alt="Books" | 34 | alt="Books" |
35 | /> | 35 | /> |
36 | </v-flex> | 36 | </v-flex> |
37 | <v-container grid-list-md> | 37 | <v-container grid-list-md> |
38 | <v-flex xs12 sm12> | 38 | <v-flex xs12 sm12> |
39 | <v-layout> | 39 | <v-layout> |
40 | <v-flex xs4 class="pt-4 subheading"> | 40 | <v-flex xs4 class="pt-4 subheading"> |
41 | <label class="right hidden-xs-only hidden-sm-only">Name :</label> | 41 | <label class="right hidden-xs-only hidden-sm-only">Name :</label> |
42 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name :</label> | 42 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name :</label> |
43 | </v-flex> | 43 | </v-flex> |
44 | <v-flex xs8 class="ml-3"> | 44 | <v-flex xs8 class="ml-3"> |
45 | <v-text-field | 45 | <v-text-field |
46 | v-model="editedItem.name" | 46 | v-model="editedItem.name" |
47 | placeholder="fill your full Name" | 47 | placeholder="fill your full Name" |
48 | name="name" | 48 | name="name" |
49 | type="text" | 49 | type="text" |
50 | required | 50 | required |
51 | ></v-text-field> | 51 | ></v-text-field> |
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 hidden-xs-only hidden-sm-only">Author :</label> | 58 | <label class="right hidden-xs-only hidden-sm-only">Author :</label> |
59 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Author :</label> | 59 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Author :</label> |
60 | </v-flex> | 60 | </v-flex> |
61 | <v-flex xs8 class="ml-3"> | 61 | <v-flex xs8 class="ml-3"> |
62 | <v-text-field | 62 | <v-text-field |
63 | v-model="editedItem.author" | 63 | v-model="editedItem.author" |
64 | placeholder="fill your full author" | 64 | placeholder="fill your full author" |
65 | name="name" | 65 | name="name" |
66 | type="text" | 66 | type="text" |
67 | required | 67 | required |
68 | ></v-text-field> | 68 | ></v-text-field> |
69 | </v-flex> | 69 | </v-flex> |
70 | </v-layout> | 70 | </v-layout> |
71 | </v-flex> | 71 | </v-flex> |
72 | <v-flex xs12 sm12> | 72 | <v-flex xs12 sm12> |
73 | <v-layout> | 73 | <v-layout> |
74 | <v-flex xs4 class="pt-4 subheading"> | 74 | <v-flex xs4 class="pt-4 subheading"> |
75 | <label class="right hidden-xs-only hidden-sm-only">Class :</label> | 75 | <label class="right hidden-xs-only hidden-sm-only">Class :</label> |
76 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class :</label> | 76 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class :</label> |
77 | </v-flex> | 77 | </v-flex> |
78 | <v-flex xs8 class="ml-3"> | 78 | <v-flex xs8 class="ml-3"> |
79 | <v-select | 79 | <v-select |
80 | v-model="editedItem.classId" | 80 | v-model="editedItem.classId" |
81 | :items="addClass" | 81 | :items="addClass" |
82 | label="Select Class" | 82 | label="Select Class" |
83 | item-text="classNum" | 83 | item-text="classNum" |
84 | item-value="_id" | 84 | item-value="_id" |
85 | type="_id" | 85 | type="_id" |
86 | required | 86 | required |
87 | ></v-select> | 87 | ></v-select> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-layout> | 89 | </v-layout> |
90 | </v-flex> | 90 | </v-flex> |
91 | <v-flex xs12 sm12> | 91 | <v-flex xs12 sm12> |
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 hidden-xs-only hidden-sm-only">Upload Image :</label> | 94 | <label class="right hidden-xs-only hidden-sm-only">Upload Image :</label> |
95 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">UploadImage :</label> | 95 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">UploadImage :</label> |
96 | </v-flex> | 96 | </v-flex> |
97 | <v-flex xs8 class="ml-3"> | 97 | <v-flex xs8 class="ml-3"> |
98 | <v-text-field | 98 | <v-text-field |
99 | label="Select Image" | 99 | label="Select Image" |
100 | @click="editPickImage" | 100 | @click="editPickImage" |
101 | v-model="editImageName" | 101 | v-model="editImageName" |
102 | append-icon="attach_file" | 102 | append-icon="attach_file" |
103 | ></v-text-field> | 103 | ></v-text-field> |
104 | </v-flex> | 104 | </v-flex> |
105 | </v-layout> | 105 | </v-layout> |
106 | </v-flex> | 106 | </v-flex> |
107 | <v-flex xs12> | 107 | <v-flex xs12> |
108 | <v-layout> | 108 | <v-layout> |
109 | <v-flex xs4 class="pt-4 subheading"> | 109 | <v-flex xs4 class="pt-4 subheading"> |
110 | <label class="right">Upload File:</label> | 110 | <label class="right">Upload File:</label> |
111 | </v-flex> | 111 | </v-flex> |
112 | <v-flex xs8 class="ml-3"> | 112 | <v-flex xs8 class="ml-3"> |
113 | <input | 113 | <input |
114 | type="file" | 114 | type="file" |
115 | style="display: none" | 115 | style="display: none" |
116 | ref="editFile" | 116 | ref="editFile" |
117 | @change="onEditFilePicked" | 117 | @change="onEditFilePicked" |
118 | /> | 118 | /> |
119 | <v-text-field | 119 | <v-text-field |
120 | label="Select File" | 120 | label="Select File" |
121 | @click="editPickFile" | 121 | @click="editPickFile" |
122 | v-model="editFileName" | 122 | v-model="editFileName" |
123 | append-icon="attach_file" | 123 | append-icon="attach_file" |
124 | ></v-text-field> | 124 | ></v-text-field> |
125 | </v-flex> | 125 | </v-flex> |
126 | </v-layout> | 126 | </v-layout> |
127 | </v-flex> | 127 | </v-flex> |
128 | <v-card-actions> | 128 | <v-card-actions> |
129 | <v-spacer></v-spacer> | 129 | <v-spacer></v-spacer> |
130 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 130 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
131 | <v-spacer></v-spacer> | 131 | <v-spacer></v-spacer> |
132 | </v-card-actions> | 132 | </v-card-actions> |
133 | </v-container> | 133 | </v-container> |
134 | </v-card-text> | 134 | </v-card-text> |
135 | </v-card> | 135 | </v-card> |
136 | </v-dialog> | 136 | </v-dialog> |
137 | 137 | ||
138 | <!-- ****** PROFILE VIEW ALL NEWS DEATILS ****** --> | 138 | <!-- ****** PROFILE VIEW ALL NEWS DEATILS ****** --> |
139 | 139 | ||
140 | <v-dialog v-model="viewEbookDialog" max-width="600px" scrollable> | 140 | <v-dialog v-model="viewEbookDialog" max-width="600px" scrollable> |
141 | <v-card flat class="card-style pa-3" dark> | 141 | <v-card flat class="card-style pa-3" dark> |
142 | <v-layout> | 142 | <v-layout> |
143 | <v-flex xs12> | 143 | <v-flex xs12> |
144 | <label class="title text-xs-center">View E-book</label> | 144 | <label class="title text-xs-center">View E-book</label> |
145 | <v-icon size="24" class="right" @click="viewEbookDialog = false">cancel</v-icon> | 145 | <v-icon size="24" class="right" @click="viewEbookDialog = false">cancel</v-icon> |
146 | </v-flex> | 146 | </v-flex> |
147 | </v-layout> | 147 | </v-layout> |
148 | <v-layout> | 148 | <v-layout> |
149 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 149 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
150 | <v-avatar size="100px"> | 150 | <v-avatar size="100px"> |
151 | <img src="/static/icon/user.png" v-if="!editedItem.coverPhotoUrl" /> | 151 | <img src="/static/icon/user.png" v-if="!editedItem.coverPhotoUrl" /> |
152 | <img :src="editedItem.coverPhotoUrl" v-else-if="editedItem.coverPhotoUrl" /> | 152 | <img :src="editedItem.coverPhotoUrl" v-else-if="editedItem.coverPhotoUrl" /> |
153 | </v-avatar> | 153 | </v-avatar> |
154 | </v-flex> | 154 | </v-flex> |
155 | </v-layout> | 155 | </v-layout> |
156 | <v-container grid-list-md> | 156 | <v-container grid-list-md> |
157 | <v-layout wrap> | 157 | <v-layout wrap> |
158 | <v-flex xs12 sm12> | 158 | <v-flex xs12 sm12> |
159 | <v-layout> | 159 | <v-layout> |
160 | <v-flex xs6 sm6> | 160 | <v-flex xs6 sm6> |
161 | <h5 class="right my-1"> | 161 | <h5 class="right my-1"> |
162 | <b>Name:</b> | 162 | <b>Name:</b> |
163 | </h5> | 163 | </h5> |
164 | </v-flex> | 164 | </v-flex> |
165 | <v-flex sm6 xs6> | 165 | <v-flex sm6 xs6> |
166 | <h5 class="my-1 left">{{ editedItem.name }}</h5> | 166 | <h5 class="my-1 left">{{ editedItem.name }}</h5> |
167 | </v-flex> | 167 | </v-flex> |
168 | </v-layout> | 168 | </v-layout> |
169 | </v-flex> | 169 | </v-flex> |
170 | <v-flex xs12 sm12> | 170 | <v-flex xs12 sm12> |
171 | <v-layout> | 171 | <v-layout> |
172 | <v-flex xs6 sm6> | 172 | <v-flex xs6 sm6> |
173 | <h5 class="right my-1"> | 173 | <h5 class="right my-1"> |
174 | <b>Author:</b> | 174 | <b>Author:</b> |
175 | </h5> | 175 | </h5> |
176 | </v-flex> | 176 | </v-flex> |
177 | <v-flex sm6 xs6> | 177 | <v-flex sm6 xs6> |
178 | <h5 class="my-1 left">{{ editedItem.author }}</h5> | 178 | <h5 class="my-1 left">{{ editedItem.author }}</h5> |
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-flex xs12 sm12> | 183 | <v-flex xs12 sm12> |
184 | <v-layout> | 184 | <v-layout> |
185 | <v-flex xs6 sm6> | 185 | <v-flex xs6 sm6> |
186 | <h5 class="right my-1"> | 186 | <h5 class="right my-1"> |
187 | <b>Class:</b> | 187 | <b>Class:</b> |
188 | </h5> | 188 | </h5> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex sm6 xs6> | 190 | <v-flex sm6 xs6> |
191 | <h5 class="my-1 left">{{ editedItem.classId .classNum}}</h5> | 191 | <h5 class="my-1 left">{{ editedItem.classId .classNum}}</h5> |
192 | </v-flex> | 192 | </v-flex> |
193 | </v-layout> | 193 | </v-layout> |
194 | </v-flex> | 194 | </v-flex> |
195 | </v-container> | 195 | </v-container> |
196 | </v-card> | 196 | </v-card> |
197 | </v-dialog> | 197 | </v-dialog> |
198 | <!-- ****** EXISTING-USERS NEWS TABLE ****** --> | 198 | <!-- ****** EXISTING-USERS NEWS TABLE ****** --> |
199 | 199 | ||
200 | <v-toolbar color="transparent" flat> | 200 | <v-toolbar color="transparent" flat> |
201 | <v-btn | 201 | <v-btn |
202 | fab | 202 | fab |
203 | dark | 203 | dark |
204 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 204 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
205 | small | 205 | small |
206 | @click="addEBookDialog = true" | 206 | @click="addEBookDialog = true" |
207 | > | 207 | > |
208 | <v-icon dark>add</v-icon> | 208 | <v-icon dark>add</v-icon> |
209 | </v-btn> | 209 | </v-btn> |
210 | <v-btn | 210 | <v-btn |
211 | round | 211 | round |
212 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 212 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
213 | dark | 213 | dark |
214 | @click="addEBookDialog = true" | 214 | @click="addEBookDialog = true" |
215 | > | 215 | > |
216 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add E-Book | 216 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add E-Book |
217 | </v-btn> | 217 | </v-btn> |
218 | <v-spacer></v-spacer> | 218 | <v-spacer></v-spacer> |
219 | <v-card-title class="body-1" v-show="show"> | 219 | <v-card-title class="body-1" v-show="show"> |
220 | <v-btn icon large flat @click="displaySearch"> | 220 | <v-btn icon large flat @click="displaySearch"> |
221 | <v-avatar size="27"> | 221 | <v-avatar size="27"> |
222 | <img src="/static/icon/search.png" alt="icon" /> | 222 | <img src="/static/icon/search.png" alt="icon" /> |
223 | </v-avatar> | 223 | </v-avatar> |
224 | </v-btn> | 224 | </v-btn> |
225 | </v-card-title> | 225 | </v-card-title> |
226 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 226 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
227 | <v-layout> | 227 | <v-layout> |
228 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 228 | <v-text-field |
229 | autofocus | ||
230 | v-model="search" | ||
231 | label="Search" | ||
232 | prepend-inner-icon="search" | ||
233 | color="primary" | ||
234 | ></v-text-field> | ||
229 | <v-icon @click="closeSearch" color="error">close</v-icon> | 235 | <v-icon @click="closeSearch" color="error">close</v-icon> |
230 | </v-layout> | 236 | </v-layout> |
231 | </v-flex> | 237 | </v-flex> |
232 | </v-toolbar> | 238 | </v-toolbar> |
233 | <v-data-table | 239 | <v-data-table |
234 | :headers="headers" | 240 | :headers="headers" |
235 | :items="eBookData" | 241 | :items="eBookData" |
236 | :pagination.sync="pagination" | 242 | :pagination.sync="pagination" |
237 | :search="search" | 243 | :search="search" |
238 | > | 244 | > |
239 | <template slot="items" slot-scope="props"> | 245 | <template slot="items" slot-scope="props"> |
240 | <tr class="tr"> | 246 | <tr class="tr"> |
241 | <td class="td td-row">{{ props.index + 1}}</td> | 247 | <td class="td td-row">{{ props.index + 1}}</td> |
242 | <td class="td td-row text-xs-center"> | 248 | <td class="td td-row text-xs-center"> |
243 | <v-avatar size="40"> | 249 | <v-avatar size="40"> |
244 | <img :src="props.item.coverPhotoUrl" v-if="props.item.coverPhotoUrl" alt="ebooks" /> | 250 | <img :src="props.item.coverPhotoUrl" v-if="props.item.coverPhotoUrl" alt="ebooks" /> |
245 | <img src="/static/icon/user.png" v-if="!props.item.coverPhotoUrl" /> | 251 | <img src="/static/icon/user.png" v-if="!props.item.coverPhotoUrl" /> |
246 | </v-avatar> | 252 | </v-avatar> |
247 | </td> | 253 | </td> |
248 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 254 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
249 | <td class="td td-row text-xs-center">{{ props.item.author}}</td> | 255 | <td class="td td-row text-xs-center">{{ props.item.author}}</td> |
250 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> | 256 | <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td> |
251 | <td class="td td-row text-xs-center"> | 257 | <td class="td td-row text-xs-center"> |
252 | <span> | 258 | <span> |
253 | <v-tooltip top> | 259 | <v-tooltip top> |
254 | <img | 260 | <img |
255 | slot="activator" | 261 | slot="activator" |
256 | style="cursor:pointer; width:25px; height:25px; " | 262 | style="cursor:pointer; width:25px; height:25px; " |
257 | class="mr-3" | 263 | class="mr-3" |
258 | @click="profile(props.item)" | 264 | @click="profile(props.item)" |
259 | src="/static/icon/view.png" | 265 | src="/static/icon/view.png" |
260 | /> | 266 | /> |
261 | <span>View</span> | 267 | <span>View</span> |
262 | </v-tooltip> | 268 | </v-tooltip> |
263 | <v-tooltip top> | 269 | <v-tooltip top> |
264 | <img | 270 | <img |
265 | slot="activator" | 271 | slot="activator" |
266 | style="cursor:pointer; width:20px; height:18px; " | 272 | style="cursor:pointer; width:20px; height:18px; " |
267 | class="mr-3" | 273 | class="mr-3" |
268 | @click="editItem(props.item)" | 274 | @click="editItem(props.item)" |
269 | src="/static/icon/edit.png" | 275 | src="/static/icon/edit.png" |
270 | /> | 276 | /> |
271 | <span>Edit</span> | 277 | <span>Edit</span> |
272 | </v-tooltip> | 278 | </v-tooltip> |
273 | <v-tooltip top v-if="role != 'TEACHER' "> | 279 | <v-tooltip top v-if="role != 'TEACHER' "> |
274 | <img | 280 | <img |
275 | slot="activator" | 281 | slot="activator" |
276 | style="cursor:pointer; width:20px; height:20px; " | 282 | style="cursor:pointer; width:20px; height:20px; " |
277 | @click="deleteItem(props.item)" | 283 | @click="deleteItem(props.item)" |
278 | src="/static/icon/delete.png" | 284 | src="/static/icon/delete.png" |
279 | /> | 285 | /> |
280 | <span>Delete</span> | 286 | <span>Delete</span> |
281 | </v-tooltip> | 287 | </v-tooltip> |
282 | </span> | 288 | </span> |
283 | </td> | 289 | </td> |
284 | </tr> | 290 | </tr> |
285 | </template> | 291 | </template> |
286 | <v-alert | 292 | <v-alert |
287 | slot="no-results" | 293 | slot="no-results" |
288 | :value="true" | 294 | :value="true" |
289 | color="error" | 295 | color="error" |
290 | icon="warning" | 296 | icon="warning" |
291 | >Your search for "{{ search }}" found no results.</v-alert> | 297 | >Your search for "{{ search }}" found no results.</v-alert> |
292 | </v-data-table> | 298 | </v-data-table> |
293 | <!-- ****** ADD MULTIPLE E-BOOK ****** --> | 299 | <!-- ****** ADD MULTIPLE E-BOOK ****** --> |
294 | <v-dialog v-model="addEBookDialog" max-width="600px"> | 300 | <v-dialog v-model="addEBookDialog" max-width="600px" v-if="addEBookDialog"> |
295 | <v-card flat class="card-style pa-2" dark> | 301 | <v-card flat class="card-style pa-2" dark> |
296 | <v-layout> | 302 | <v-layout> |
297 | <v-flex xs12> | 303 | <v-flex xs12> |
298 | <label class="title text-xs-center">Add E-Book</label> | 304 | <label class="title text-xs-center">Add E-Book</label> |
299 | <v-icon size="24" class="right" @click="addEBookDialog = false">cancel</v-icon> | 305 | <v-icon size="24" class="right" @click="closeAddEBookModel">cancel</v-icon> |
300 | </v-flex> | 306 | </v-flex> |
301 | </v-layout> | 307 | </v-layout> |
302 | <v-form ref="form" v-model="valid" lazy-validation> | 308 | <v-form ref="form" v-model="valid" lazy-validation> |
303 | <v-container fluid> | 309 | <v-container fluid> |
304 | <v-layout> | 310 | <v-layout> |
305 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 311 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
306 | <input | 312 | <input |
307 | type="file" | 313 | type="file" |
308 | style="display: none" | 314 | style="display: none" |
309 | ref="image" | 315 | ref="image" |
310 | accept="image/*" | 316 | accept="image/*" |
311 | @change="onImagePicked" | 317 | @change="onImagePicked" |
312 | /> | 318 | /> |
313 | <v-layout justify-center> | 319 | <v-layout justify-center> |
314 | <v-flex v-if="files != ''"> | 320 | <v-flex v-if="files != ''"> |
315 | <img :src="files" height="150" width="150" /> | 321 | <img :src="files" height="150" width="150" /> |
316 | </v-flex> | 322 | </v-flex> |
317 | </v-layout> | 323 | </v-layout> |
318 | <img src="/static/icon/user.png" v-if="files ==''" height="80" width="80px;" /> | 324 | <img src="/static/icon/user.png" v-if="files ==''" height="80" width="80px;" /> |
319 | </v-flex> | 325 | </v-flex> |
320 | </v-layout> | 326 | </v-layout> |
321 | <v-flex xs12> | 327 | <v-flex xs12> |
322 | <v-layout> | 328 | <v-layout> |
323 | <v-flex xs4 class="pt-4 subheading"> | 329 | <v-flex xs4 class="pt-4 subheading"> |
324 | <label class="right">Name:</label> | 330 | <label class="right">Name:</label> |
325 | </v-flex> | 331 | </v-flex> |
326 | <v-flex xs7 class="ml-3"> | 332 | <v-flex xs7 class="ml-3"> |
327 | <v-text-field | 333 | <v-text-field |
328 | v-model="addEBooks.name" | 334 | v-model="addEBooks.name" |
329 | placeholder="fill name" | 335 | placeholder="fill name" |
330 | name="name" | 336 | name="name" |
331 | type="text" | 337 | type="text" |
332 | :rules="titleRules" | 338 | :rules="titleRules" |
333 | required | 339 | required |
334 | ></v-text-field> | 340 | ></v-text-field> |
335 | </v-flex> | 341 | </v-flex> |
336 | </v-layout> | 342 | </v-layout> |
337 | </v-flex> | 343 | </v-flex> |
338 | <v-flex xs12> | 344 | <v-flex xs12> |
339 | <v-layout> | 345 | <v-layout> |
340 | <v-flex xs4 class="pt-4 subheading"> | 346 | <v-flex xs4 class="pt-4 subheading"> |
341 | <label class="right">Author:</label> | 347 | <label class="right">Author:</label> |
342 | </v-flex> | 348 | </v-flex> |
343 | <v-flex xs7 class="ml-3"> | 349 | <v-flex xs7 class="ml-3"> |
344 | <v-text-field | 350 | <v-text-field |
345 | v-model="addEBooks.author" | 351 | v-model="addEBooks.author" |
346 | placeholder="fill your Author Name" | 352 | placeholder="fill your Author Name" |
347 | name="name" | 353 | name="name" |
348 | type="text" | 354 | type="text" |
349 | :rules="titleRules" | 355 | :rules="titleRules" |
350 | required | 356 | required |
351 | ></v-text-field> | 357 | ></v-text-field> |
352 | </v-flex> | 358 | </v-flex> |
353 | </v-layout> | 359 | </v-layout> |
354 | </v-flex> | 360 | </v-flex> |
355 | <v-flex xs12> | 361 | <v-flex xs12> |
356 | <v-layout> | 362 | <v-layout> |
357 | <v-flex xs4 class="pt-4 subheading"> | 363 | <v-flex xs4 class="pt-4 subheading"> |
358 | <label class="right">Class:</label> | 364 | <label class="right">Class:</label> |
359 | </v-flex> | 365 | </v-flex> |
360 | <v-flex xs7 class="ml-3"> | 366 | <v-flex xs7 class="ml-3"> |
361 | <v-select | 367 | <v-select |
362 | v-model="addEBooks.classId" | 368 | v-model="addEBooks.classId" |
363 | :items="addClass" | 369 | :items="addClass" |
364 | label="Select Class" | 370 | label="Select Class" |
365 | item-text="classNum" | 371 | item-text="classNum" |
366 | item-value="_id" | 372 | item-value="_id" |
367 | :rules="titleRules" | 373 | :rules="titleRules" |
368 | required | 374 | required |
369 | ></v-select> | 375 | ></v-select> |
370 | </v-flex> | 376 | </v-flex> |
371 | </v-layout> | 377 | </v-layout> |
372 | </v-flex> | 378 | </v-flex> |
373 | <v-flex xs12> | 379 | <v-flex xs12> |
374 | <v-layout> | 380 | <v-layout> |
375 | <v-flex xs4 class="pt-4 subheading"> | 381 | <v-flex xs4 class="pt-4 subheading"> |
376 | <label class="right">Upload Image:</label> | 382 | <label class="right">Upload Image:</label> |
377 | </v-flex> | 383 | </v-flex> |
378 | <v-flex xs7 class="ml-3"> | 384 | <v-flex xs7 class="ml-3"> |
379 | <v-text-field | 385 | <v-text-field |
380 | label="Select Image" | 386 | label="Select Image" |
381 | @click="pickImage" | 387 | @click="pickImage" |
382 | v-model="imageName" | 388 | v-model="imageName" |
383 | :rules="uploadImageRule" | 389 | :rules="uploadImageRule" |
384 | append-icon="attach_file" | 390 | append-icon="attach_file" |
385 | ></v-text-field> | 391 | ></v-text-field> |
386 | </v-flex> | 392 | </v-flex> |
387 | </v-layout> | 393 | </v-layout> |
388 | </v-flex> | 394 | </v-flex> |
389 | <v-flex xs12> | 395 | <v-flex xs12> |
390 | <v-layout> | 396 | <v-layout> |
391 | <v-flex xs4 class="pt-4 subheading"> | 397 | <v-flex xs4 class="pt-4 subheading"> |
392 | <label class="right">Upload File:</label> | 398 | <label class="right">Upload File:</label> |
393 | </v-flex> | 399 | </v-flex> |
394 | <v-flex xs8 class="ml-3"> | 400 | <v-flex xs8 class="ml-3"> |
395 | <input type="file" style="display: none" ref="file" @change="onFilePicked" /> | 401 | <input type="file" style="display: none" ref="file" @change="onFilePicked" /> |
396 | <v-text-field | 402 | <v-text-field |
397 | label="Select File" | 403 | label="Select File" |
398 | @click="pickFile" | 404 | @click="pickFile" |
399 | v-model="fileName" | 405 | v-model="fileName" |
400 | :rules="uploadFileRule" | 406 | :rules="uploadFileRule" |
401 | append-icon="attach_file" | 407 | append-icon="attach_file" |
402 | ></v-text-field> | 408 | ></v-text-field> |
403 | </v-flex> | 409 | </v-flex> |
404 | </v-layout> | 410 | </v-layout> |
405 | </v-flex> | 411 | </v-flex> |
406 | <v-flex xs12> | 412 | <v-flex xs12> |
407 | <v-layout> | 413 | <v-layout> |
408 | <v-flex xs4 class="pt-3 subheading"> | 414 | <v-flex xs4 class="pt-3 subheading"> |
409 | <label class="right">Private:</label> | 415 | <label class="right">Private:</label> |
410 | </v-flex> | 416 | </v-flex> |
411 | <v-flex xs7 class="ml-3"> | 417 | <v-flex xs7 class="ml-3"> |
412 | <v-checkbox v-model="addEBooks.private" :rules="uploadPrivateRule"></v-checkbox> | 418 | <v-checkbox v-model="addEBooks.private" :rules="uploadPrivateRule"></v-checkbox> |
413 | </v-flex> | 419 | </v-flex> |
414 | </v-layout> | 420 | </v-layout> |
415 | </v-flex> | 421 | </v-flex> |
416 | <v-layout> | 422 | <v-layout> |
417 | <v-flex xs12> | 423 | <v-flex xs12> |
418 | <v-card-actions> | 424 | <v-card-actions> |
419 | <v-spacer></v-spacer> | 425 | <v-spacer></v-spacer> |
420 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 426 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
421 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 427 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
422 | </v-card-actions> | 428 | </v-card-actions> |
423 | </v-flex> | 429 | </v-flex> |
424 | </v-layout> | 430 | </v-layout> |
425 | </v-container> | 431 | </v-container> |
426 | </v-form> | 432 | </v-form> |
427 | </v-card> | 433 | </v-card> |
428 | </v-dialog> | 434 | </v-dialog> |
429 | <div class="loader" v-if="showLoader"> | 435 | <div class="loader" v-if="showLoader"> |
430 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 436 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
431 | </div> | 437 | </div> |
432 | </v-container> | 438 | </v-container> |
433 | </template> | 439 | </template> |
434 | 440 | ||
435 | <script> | 441 | <script> |
436 | import http from "@/Services/http.js"; | 442 | import http from "@/Services/http.js"; |
437 | import Util from "@/util"; | 443 | import Util from "@/util"; |
438 | 444 | ||
439 | export default { | 445 | export default { |
440 | data: () => ({ | 446 | data: () => ({ |
441 | snackbar: false, | 447 | snackbar: false, |
442 | y: "top", | 448 | y: "top", |
443 | x: "right", | 449 | x: "right", |
444 | mode: "", | 450 | mode: "", |
445 | timeout: 3000, | 451 | timeout: 3000, |
446 | text: "", | 452 | text: "", |
447 | show: true, | 453 | show: true, |
448 | showSearch: false, | 454 | showSearch: false, |
449 | loading: false, | 455 | loading: false, |
450 | loadingUpadte: false, | 456 | loadingUpadte: false, |
451 | date: null, | 457 | date: null, |
452 | search: "", | 458 | search: "", |
453 | showLoader: false, | 459 | showLoader: false, |
454 | editEbookDialog: false, | 460 | editEbookDialog: false, |
455 | viewEbookDialog: false, | 461 | viewEbookDialog: false, |
456 | valid: true, | 462 | valid: true, |
457 | addEBookDialog: false, | 463 | addEBookDialog: false, |
458 | editLoading: false, | 464 | editLoading: false, |
459 | addClass: [], | 465 | addClass: [], |
460 | addSection: [], | 466 | addSection: [], |
461 | pagination: { | 467 | pagination: { |
462 | rowsPerPage: 10, | 468 | rowsPerPage: 10, |
463 | }, | 469 | }, |
464 | imageName: "", | 470 | imageName: "", |
465 | fileName: "", | 471 | fileName: "", |
466 | imageUrl: "", | 472 | imageUrl: "", |
467 | imageFile: "", | 473 | imageFile: "", |
468 | image: [], | 474 | image: [], |
469 | upload: "", | 475 | upload: "", |
470 | files: "", | 476 | files: "", |
471 | anyFile: "", | 477 | anyFile: "", |
472 | titleRules: [(v) => !!v || " Tilte is required"], | 478 | titleRules: [(v) => !!v || " Tilte is required"], |
473 | descriptionRules: [(v) => !!v || " Description is required"], | 479 | descriptionRules: [(v) => !!v || " Description is required"], |
474 | uploadImageRule: [(v) => !!v || " field is required"], | 480 | uploadImageRule: [(v) => !!v || " field is required"], |
475 | uploadFileRule: [(v) => !!v || " fied is required"], | 481 | uploadFileRule: [(v) => !!v || " fied is required"], |
476 | uploadPrivateRule: [(v) => !!v || " fied is required"], | 482 | uploadPrivateRule: [(v) => !!v || " fied is required"], |
477 | 483 | ||
478 | headers: [ | 484 | headers: [ |
479 | { | 485 | { |
480 | align: "left", | 486 | align: "left", |
481 | text: "No", | 487 | text: "No", |
482 | sortable: false, | 488 | sortable: false, |
483 | value: "No", | 489 | value: "No", |
484 | }, | 490 | }, |
485 | { text: "Photo", vaue: "fileUrl", sortable: false, align: "center" }, | 491 | { text: "Photo", vaue: "fileUrl", sortable: false, align: "center" }, |
486 | { text: "Name", vaue: "name", sortable: false, align: "center" }, | 492 | { text: "Name", vaue: "name", sortable: false, align: "center" }, |
487 | { text: "Author", value: "author", sortable: false, align: "center" }, | 493 | { text: "Author", value: "author", sortable: false, align: "center" }, |
488 | { | 494 | { |
489 | text: "Class", | 495 | text: "Class", |
490 | value: "classId", | 496 | value: "classId", |
491 | sortable: false, | 497 | sortable: false, |
492 | align: "center", | 498 | align: "center", |
493 | }, | 499 | }, |
494 | { text: "Action", value: "", sortable: false, align: "center" }, | 500 | { text: "Action", value: "", sortable: false, align: "center" }, |
495 | ], | 501 | ], |
496 | eBookData: [], | 502 | eBookData: [], |
497 | editedIndex: -1, | 503 | editedIndex: -1, |
498 | addEBooks: { | 504 | addEBooks: { |
499 | private: false, | 505 | private: false, |
500 | }, | 506 | }, |
501 | editedItem: {}, | 507 | editedItem: {}, |
502 | editedItem: { | 508 | editedItem: { |
503 | classId: { | 509 | classId: { |
504 | classNum: "", | 510 | classNum: "", |
505 | }, | 511 | }, |
506 | }, | 512 | }, |
507 | token: "", | 513 | token: "", |
508 | uploadCover: {}, | 514 | uploadCover: {}, |
509 | editImageName: "", | 515 | editImageName: "", |
510 | editFiles: "", | 516 | editFiles: "", |
511 | editAnyFile: "", | 517 | editAnyFile: "", |
512 | editFileName: "", | 518 | editFileName: "", |
513 | }), | 519 | }), |
520 | watch: { | ||
521 | addEBookDialog: function (val) { | ||
522 | if (!val) { | ||
523 | this.addEBooks = []; | ||
524 | this.imageName = ""; | ||
525 | this.fileName = ""; | ||
526 | this.files = ""; | ||
527 | } | ||
528 | }, | ||
529 | }, | ||
514 | methods: { | 530 | methods: { |
515 | editPickImage() { | 531 | editPickImage() { |
516 | this.$refs.editImage.click(); | 532 | this.$refs.editImage.click(); |
517 | }, | 533 | }, |
518 | pickImage() { | 534 | pickImage() { |
519 | this.$refs.image.click(); | 535 | this.$refs.image.click(); |
520 | }, | 536 | }, |
521 | pickFile() { | 537 | pickFile() { |
522 | this.$refs.file.click(); | 538 | this.$refs.file.click(); |
523 | }, | 539 | }, |
524 | editPickFile() { | 540 | editPickFile() { |
525 | this.$refs.editFile.click(); | 541 | this.$refs.editFile.click(); |
526 | }, | 542 | }, |
527 | onImagePicked(e) { | 543 | onImagePicked(e) { |
528 | // console.log(e) | 544 | // console.log(e) |
529 | const files = e.target.files; | 545 | const files = e.target.files; |
530 | /** fetch Image Name **/ | 546 | /** fetch Image Name **/ |
531 | if (files[0] !== undefined) { | 547 | if (files[0] !== undefined) { |
532 | this.imageName = files[0].name; | 548 | this.imageName = files[0].name; |
533 | if (this.imageName.lastIndexOf(".") <= 0) { | 549 | if (this.imageName.lastIndexOf(".") <= 0) { |
534 | return; | 550 | return; |
535 | } | 551 | } |
536 | /** Select many image and showing many image add to news card **/ | 552 | /** Select many image and showing many image add to news card **/ |
537 | const fr = new FileReader(); | 553 | const fr = new FileReader(); |
538 | fr.readAsDataURL(files[0]); | 554 | fr.readAsDataURL(files[0]); |
539 | fr.addEventListener("load", () => { | 555 | fr.addEventListener("load", () => { |
540 | this.files = fr.result; | 556 | this.files = fr.result; |
541 | }); | 557 | }); |
542 | } else { | 558 | } else { |
543 | this.imageName = ""; | 559 | this.imageName = ""; |
544 | this.imageFile = ""; | 560 | this.imageFile = ""; |
545 | this.files = ""; | 561 | this.files = ""; |
546 | this.imageUrl = ""; | 562 | this.imageUrl = ""; |
547 | } | 563 | } |
548 | }, | 564 | }, |
549 | onEditImagePicked(e) { | 565 | onEditImagePicked(e) { |
550 | // console.log(e) | 566 | // console.log(e) |
551 | const files = e.target.files; | 567 | const files = e.target.files; |
552 | /** fetch Image Name **/ | 568 | /** fetch Image Name **/ |
553 | if (files[0] !== undefined) { | 569 | if (files[0] !== undefined) { |
554 | this.editImageName = files[0].name; | 570 | this.editImageName = files[0].name; |
555 | if (this.editImageName.lastIndexOf(".") <= 0) { | 571 | if (this.editImageName.lastIndexOf(".") <= 0) { |
556 | return; | 572 | return; |
557 | } | 573 | } |
558 | /** Select many image and showing many image add to news card **/ | 574 | /** Select many image and showing many image add to news card **/ |
559 | const fr = new FileReader(); | 575 | const fr = new FileReader(); |
560 | fr.readAsDataURL(files[0]); | 576 | fr.readAsDataURL(files[0]); |
561 | fr.addEventListener("load", () => { | 577 | fr.addEventListener("load", () => { |
562 | this.editFiles = fr.result; | 578 | this.editFiles = fr.result; |
563 | }); | 579 | }); |
564 | } else { | 580 | } else { |
565 | this.editImageName = ""; | 581 | this.editImageName = ""; |
566 | this.editFiles = ""; | 582 | this.editFiles = ""; |
567 | } | 583 | } |
568 | }, | 584 | }, |
569 | getEBooksList() { | 585 | getEBooksList() { |
570 | this.showLoader = true; | 586 | this.showLoader = true; |
571 | http() | 587 | http() |
572 | .get("/getEBooksList", { | 588 | .get("/getEBooksList", { |
573 | params: { schoolId: this.$store.state.schoolId }, | 589 | params: { schoolId: this.$store.state.schoolId }, |
574 | headers: { Authorization: "Bearer " + this.token }, | 590 | headers: { Authorization: "Bearer " + this.token }, |
575 | }) | 591 | }) |
576 | .then((response) => { | 592 | .then((response) => { |
577 | this.eBookData = response.data.data; | 593 | this.eBookData = response.data.data; |
578 | this.showLoader = false; | 594 | this.showLoader = false; |
579 | }) | 595 | }) |
580 | .catch((error) => { | 596 | .catch((error) => { |
581 | // console.log("err====>", err); | 597 | // console.log("err====>", err); |
582 | this.showLoader = false; | 598 | this.showLoader = false; |
583 | if (error.response.status === 401) { | 599 | if (error.response.status === 401) { |
584 | this.$router.replace({ path: "/" }); | 600 | this.$router.replace({ path: "/" }); |
585 | this.$store.dispatch("setToken", null); | 601 | this.$store.dispatch("setToken", null); |
586 | this.$store.dispatch("Id", null); | 602 | this.$store.dispatch("Id", null); |
587 | } | 603 | } |
588 | }); | 604 | }); |
589 | }, | 605 | }, |
590 | onFilePicked(e) { | 606 | onFilePicked(e) { |
591 | // console.log(e) | 607 | // console.log(e) |
592 | const files = e.target.files; | 608 | const files = e.target.files; |
593 | /** fetch Image Name **/ | 609 | /** fetch Image Name **/ |
594 | if (files[0] !== undefined) { | 610 | if (files[0] !== undefined) { |
595 | this.fileName = files[0].name; | 611 | this.fileName = files[0].name; |
596 | if (this.fileName.lastIndexOf(".") <= 0) { | 612 | if (this.fileName.lastIndexOf(".") <= 0) { |
597 | return; | 613 | return; |
598 | } | 614 | } |
599 | const fr = new FileReader(); | 615 | const fr = new FileReader(); |
600 | fr.readAsDataURL(files[0]); | 616 | fr.readAsDataURL(files[0]); |
601 | fr.addEventListener("load", () => { | 617 | fr.addEventListener("load", () => { |
602 | this.anyFile = fr.result; | 618 | this.anyFile = fr.result; |
603 | // console.log(" this.anyFile Url", this.anyFile ) | 619 | // console.log(" this.anyFile Url", this.anyFile ) |
604 | }); | 620 | }); |
605 | } else { | 621 | } else { |
606 | this.anyFile = ""; | 622 | this.anyFile = ""; |
607 | this.fileName = ""; | 623 | this.fileName = ""; |
608 | } | 624 | } |
609 | }, | 625 | }, |
610 | onEditFilePicked(e) { | 626 | onEditFilePicked(e) { |
611 | // console.log(e) | 627 | // console.log(e) |
612 | const files = e.target.files; | 628 | const files = e.target.files; |
613 | /** fetch Image Name **/ | 629 | /** fetch Image Name **/ |
614 | if (files[0] !== undefined) { | 630 | if (files[0] !== undefined) { |
615 | this.editFileName = files[0].name; | 631 | this.editFileName = files[0].name; |
616 | if (this.editFileName.lastIndexOf(".") <= 0) { | 632 | if (this.editFileName.lastIndexOf(".") <= 0) { |
617 | return; | 633 | return; |
618 | } | 634 | } |
619 | const fr = new FileReader(); | 635 | const fr = new FileReader(); |
620 | fr.readAsDataURL(files[0]); | 636 | fr.readAsDataURL(files[0]); |
621 | fr.addEventListener("load", () => { | 637 | fr.addEventListener("load", () => { |
622 | this.editAnyFile = fr.result; | 638 | this.editAnyFile = fr.result; |
623 | // console.log(" this.anyFile Url", this.anyFile ) | 639 | // console.log(" this.anyFile Url", this.anyFile ) |
624 | }); | 640 | }); |
625 | } else { | 641 | } else { |
626 | this.editAnyFile = ""; | 642 | this.editAnyFile = ""; |
627 | this.editFileName = ""; | 643 | this.editFileName = ""; |
628 | } | 644 | } |
629 | }, | 645 | }, |
630 | editItem(item) { | 646 | editItem(item) { |
631 | this.files = []; | 647 | this.files = []; |
632 | this.editedIndex = this.eBookData.indexOf(item); | 648 | this.editedIndex = this.eBookData.indexOf(item); |
633 | this.editedItem = Object.assign({}, item); | 649 | this.editedItem = Object.assign({}, item); |
634 | this.editedItem.className = item.classId.classNum; | 650 | this.editedItem.className = item.classId.classNum; |
635 | this.editEbookDialog = true; | 651 | this.editEbookDialog = true; |
636 | }, | 652 | }, |
637 | profile(item) { | 653 | profile(item) { |
638 | this.editedIndex = this.eBookData.indexOf(item); | 654 | this.editedIndex = this.eBookData.indexOf(item); |
639 | this.editedItem = Object.assign({}, item); | 655 | this.editedItem = Object.assign({}, item); |
640 | this.viewEbookDialog = true; | 656 | this.viewEbookDialog = true; |
641 | }, | 657 | }, |
642 | deleteItem(item) { | 658 | deleteItem(item) { |
643 | let deleteEBooks = { | 659 | let deleteEBooks = { |
644 | ebookId: item._id, | 660 | ebookId: item._id, |
645 | }; | 661 | }; |
646 | http() | 662 | http() |
647 | .delete( | 663 | .delete( |
648 | "/deleteEBook", | 664 | "/deleteEBook", |
649 | confirm("Are you sure you want to delete this?") && { | 665 | confirm("Are you sure you want to delete this?") && { |
650 | params: deleteEBooks, | 666 | params: deleteEBooks, |
651 | } | 667 | } |
652 | ) | 668 | ) |
653 | .then((response) => { | 669 | .then((response) => { |
654 | this.snackbar = true; | 670 | this.snackbar = true; |
655 | this.text = "Successfully delete Existing News"; | 671 | this.text = "Successfully delete Existing News"; |
656 | this.getEBooksList(); | 672 | this.getEBooksList(); |
657 | }) | 673 | }) |
658 | .catch((error) => { | 674 | .catch((error) => { |
659 | this.snackbar = true; | 675 | this.snackbar = true; |
660 | this.text = error.response.data.message; | 676 | this.text = error.response.data.message; |
661 | }); | 677 | }); |
662 | }, | 678 | }, |
663 | close() { | 679 | close() { |
664 | this.editEbookDialog = false; | 680 | this.editEbookDialog = false; |
665 | }, | 681 | }, |
666 | close1() { | 682 | close1() { |
667 | this.viewEbookDialog = false; | 683 | this.viewEbookDialog = false; |
668 | }, | 684 | }, |
685 | closeAddEBookModel() { | ||
686 | this.addEBookDialog = false; | ||
687 | this.eBookData = []; | ||
688 | this.addEBooks = []; | ||
689 | this.imageName = ""; | ||
690 | this.fileName = ""; | ||
691 | this.files = ""; | ||
692 | }, | ||
669 | submit() { | 693 | submit() { |
670 | if (this.$refs.form.validate()) { | 694 | if (this.$refs.form.validate()) { |
671 | this.loading = true; | 695 | this.loading = true; |
672 | var uploadCover = ""; | 696 | var uploadCover = ""; |
673 | var uploadFile = ""; | 697 | var uploadFile = ""; |
674 | if (this.files) { | 698 | if (this.files) { |
675 | const [baseUrl, imageUrl] = this.files.split(/,/); | 699 | const [baseUrl, imageUrl] = this.files.split(/,/); |
676 | uploadCover = imageUrl; | 700 | uploadCover = imageUrl; |
677 | console.log("anyFile.split(/,/)", uploadCover); | 701 | console.log("anyFile.split(/,/)", uploadCover); |
678 | } | 702 | } |
679 | if (this.anyFile) { | 703 | if (this.anyFile) { |
680 | const [baseUrl, fileUrl] = this.anyFile.split(/,/); | 704 | const [baseUrl, fileUrl] = this.anyFile.split(/,/); |
681 | uploadFile = fileUrl; | 705 | uploadFile = fileUrl; |
682 | console.log("anyFile.split(/,/)", uploadFile); | 706 | console.log("anyFile.split(/,/)", uploadFile); |
683 | } | 707 | } |
684 | let data = { | 708 | let data = { |
685 | classId: this.addEBooks.classId, | 709 | classId: this.addEBooks.classId, |
686 | name: this.addEBooks.name, | 710 | name: this.addEBooks.name, |
687 | author: this.addEBooks.author, | 711 | author: this.addEBooks.author, |
688 | private: this.addEBooks.private, | 712 | private: this.addEBooks.private, |
689 | uploadCover: uploadCover, | 713 | uploadCover: uploadCover, |
690 | uploadFile: uploadFile, | 714 | uploadFile: uploadFile, |
691 | }; | 715 | }; |
692 | http() | 716 | http() |
693 | .post("/createEBook", data) | 717 | .post("/createEBook", data) |
694 | .then((response) => { | 718 | .then((response) => { |
695 | this.getEBooksList(); | 719 | this.getEBooksList(); |
696 | // this.getEBooksList = []; | 720 | // this.getEBooksList = []; |
697 | this.addEBookDialog = false; | 721 | this.addEBookDialog = false; |
698 | this.snackbar = true; | 722 | this.snackbar = true; |
699 | this.text = response.data.message; | 723 | this.text = response.data.message; |
700 | this.color = "green"; | 724 | this.color = "green"; |
701 | this.loading = false; | 725 | this.loading = false; |
702 | (this.imageName = ""), (this.fileName = ""); | 726 | (this.imageName = ""), (this.fileName = ""); |
703 | }) | 727 | }) |
704 | .catch((error) => { | 728 | .catch((error) => { |
705 | this.snackbar = true; | 729 | this.snackbar = true; |
706 | this.text = error.response.data.message; | 730 | this.text = error.response.data.message; |
707 | this.color = "red"; | 731 | this.color = "red"; |
708 | }); | 732 | }); |
709 | } | 733 | } |
710 | }, | 734 | }, |
711 | clear() { | 735 | clear() { |
712 | this.$refs.form.reset(); | 736 | this.$refs.form.reset(); |
713 | this.addEBooks.uploadCover = ""; | 737 | this.addEBooks.uploadCover = ""; |
714 | this.files = ""; | 738 | this.files = ""; |
715 | }, | 739 | }, |
716 | save() { | 740 | save() { |
717 | this.editLoading = true; | 741 | this.editLoading = true; |
718 | this.loadingUpadte = true; | 742 | this.loadingUpadte = true; |
719 | if (this.editFiles) { | 743 | if (this.editFiles) { |
720 | const [baseUrl, imageUrl] = this.editFiles.split(/,/); | 744 | const [baseUrl, imageUrl] = this.editFiles.split(/,/); |
721 | this.editedItem.uploadCover = imageUrl; | 745 | this.editedItem.uploadCover = imageUrl; |
722 | // console.log("anyFile.split(/,/)", this.addEBooks.uploadCover); | 746 | // console.log("anyFile.split(/,/)", this.addEBooks.uploadCover); |
723 | } | 747 | } |
724 | if (this.editAnyFile) { | 748 | if (this.editAnyFile) { |
725 | const [baseUrl, fileUrl] = this.editAnyFile.split(/,/); | 749 | const [baseUrl, fileUrl] = this.editAnyFile.split(/,/); |
726 | this.editedItem.uploadFile = fileUrl; | 750 | this.editedItem.uploadFile = fileUrl; |
727 | // console.log("anyFile.split(/,/)", this.addEBooks.uploadFile); | 751 | // console.log("anyFile.split(/,/)", this.addEBooks.uploadFile); |
728 | } | 752 | } |
729 | if (this.editedItem.classId._id) { | 753 | if (this.editedItem.classId._id) { |
730 | this.editedItem.classId = this.editedItem.classId._id; | 754 | this.editedItem.classId = this.editedItem.classId._id; |
731 | } | 755 | } |
732 | this.editedItem.ebookId = this.editedItem._id; | 756 | this.editedItem.ebookId = this.editedItem._id; |
733 | console.log("this.editedItem", this.editedItem); | 757 | console.log("this.editedItem", this.editedItem); |
734 | http() | 758 | http() |
735 | .put("/updateEBook", this.editedItem) | 759 | .put("/updateEBook", this.editedItem) |
736 | .then((response) => { | 760 | .then((response) => { |
737 | this.loadingUpadte = false; | 761 | this.loadingUpadte = false; |
738 | this.snackbar = true; | 762 | this.snackbar = true; |
739 | this.text = "Successfully Edit Existing E-Book"; | 763 | this.text = "Successfully Edit Existing E-Book"; |
740 | this.getEBooksList(); | 764 | this.getEBooksList(); |
741 | this.editLoading = false; | 765 | this.editLoading = false; |
742 | this.editedItem.uploadFile = ""; | 766 | this.editedItem.uploadFile = ""; |
743 | this.editedItem.uploadCover = ""; | 767 | this.editedItem.uploadCover = ""; |
744 | this.anyFile = ""; | 768 | this.anyFile = ""; |
745 | this.files = ""; | 769 | this.files = ""; |
746 | this.close(); | 770 | this.close(); |
747 | }) | 771 | }) |
748 | .catch((error) => { | 772 | .catch((error) => { |
749 | this.editLoading = false; | 773 | this.editLoading = false; |
750 | this.loadingUpadte = false; | 774 | this.loadingUpadte = false; |
751 | this.snackbar = true; | 775 | this.snackbar = true; |
752 | this.text = error.response.data.message; | 776 | this.text = error.response.data.message; |
753 | // console.log(error); | 777 | // console.log(error); |
754 | }); | 778 | }); |
755 | }, | 779 | }, |
756 | getAllClass() { | 780 | getAllClass() { |
757 | http() | 781 | http() |
758 | .get("/getClassesList", { | 782 | .get("/getClassesList", { |
759 | headers: { Authorization: "Bearer " + this.token }, | 783 | headers: { Authorization: "Bearer " + this.token }, |
760 | }) | 784 | }) |
761 | .then((response) => { | 785 | .then((response) => { |
762 | this.addClass = response.data.data; | 786 | this.addClass = response.data.data; |
763 | }) | 787 | }) |
764 | .catch((err) => { | 788 | .catch((err) => { |
765 | // console.log("err====>", err); | 789 | // console.log("err====>", err); |
766 | // this.$router.replace({ path: "/" }); | 790 | // this.$router.replace({ path: "/" }); |
767 | }); | 791 | }); |
768 | }, | 792 | }, |
769 | displaySearch() { | 793 | displaySearch() { |
770 | (this.show = false), (this.showSearch = true); | 794 | (this.show = false), (this.showSearch = true); |
771 | }, | 795 | }, |
772 | closeSearch() { | 796 | closeSearch() { |
773 | this.showSearch = false; | 797 | this.showSearch = false; |
774 | this.show = true; | 798 | this.show = true; |
775 | this.search = ""; | 799 | this.search = ""; |
776 | }, | 800 | }, |
777 | }, | 801 | }, |
778 | mounted() { | 802 | mounted() { |
779 | this.token = this.$store.state.token; | 803 | this.token = this.$store.state.token; |
780 | this.getEBooksList(); | 804 | this.getEBooksList(); |
781 | this.getAllClass(); | 805 | this.getAllClass(); |
782 | this.role = this.$store.state.role; | 806 | this.role = this.$store.state.role; |
783 | // this.getBookData(); | 807 | // this.getBookData(); |
784 | // this.editItem; | 808 | // this.editItem; |
785 | }, | 809 | }, |
786 | }; | 810 | }; |
787 | </script> | 811 | </script> |
src/pages/Library/issue.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT ISSUE ****** --> | 3 | <!-- ****** EDIT ISSUE ****** --> |
4 | <v-dialog v-model="editIssueDialog" max-width="600px" scrollable> | 4 | <v-dialog v-model="editIssueDialog" max-width="600px" 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 Issue</label> | 8 | <label class="title text-xs-center">Edit Issue</label> |
9 | <v-icon size="24" class="right" @click="editIssueDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editIssueDialog = 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">Library Id:</label> | 19 | <label class="right">Library Id:</label> |
20 | </v-flex> | 20 | </v-flex> |
21 | <v-flex xs7 class="ml-3"> | 21 | <v-flex xs7 class="ml-3"> |
22 | <v-text-field | 22 | <v-text-field |
23 | v-model="editedItem.libraryId" | 23 | v-model="editedItem.libraryId" |
24 | placeholder="fill your Library Id" | 24 | placeholder="fill your Library Id" |
25 | name="name" | 25 | name="name" |
26 | type="text" | 26 | type="text" |
27 | disabled | 27 | disabled |
28 | ></v-text-field> | 28 | ></v-text-field> |
29 | </v-flex> | 29 | </v-flex> |
30 | </v-layout> | 30 | </v-layout> |
31 | </v-flex> | 31 | </v-flex> |
32 | <v-flex xs12 sm12> | 32 | <v-flex xs12 sm12> |
33 | <v-layout> | 33 | <v-layout> |
34 | <v-flex xs4 class="pt-4 subheading"> | 34 | <v-flex xs4 class="pt-4 subheading"> |
35 | <label class="right">Book:</label> | 35 | <label class="right">Book:</label> |
36 | </v-flex> | 36 | </v-flex> |
37 | <v-flex xs7 class="ml-3"> | 37 | <v-flex xs7 class="ml-3"> |
38 | <v-select | 38 | <v-select |
39 | v-model="editedItem.bookId" | 39 | v-model="editedItem.bookId" |
40 | label="Select Book Name" | 40 | label="Select Book Name" |
41 | :rules="bookRules" | 41 | :rules="bookRules" |
42 | :items="books" | 42 | :items="books" |
43 | item-text="name" | 43 | item-text="name" |
44 | item-value="_id" | 44 | item-value="_id" |
45 | ></v-select> | 45 | ></v-select> |
46 | </v-flex> | 46 | </v-flex> |
47 | </v-layout> | 47 | </v-layout> |
48 | </v-flex> | 48 | </v-flex> |
49 | <v-flex xs12 sm12> | 49 | <v-flex xs12 sm12> |
50 | <v-layout> | 50 | <v-layout> |
51 | <v-flex xs4 class="pt-4 subheading"> | 51 | <v-flex xs4 class="pt-4 subheading"> |
52 | <label class="right">Author:</label> | 52 | <label class="right">Author:</label> |
53 | </v-flex> | 53 | </v-flex> |
54 | <v-flex xs7 class="ml-3"> | 54 | <v-flex xs7 class="ml-3"> |
55 | <v-text-field | 55 | <v-text-field |
56 | placeholder="fill your Author Name" | 56 | placeholder="fill your Author Name" |
57 | v-model="editedItem.author" | 57 | v-model="editedItem.author" |
58 | type="text" | 58 | type="text" |
59 | ></v-text-field> | 59 | ></v-text-field> |
60 | </v-flex> | 60 | </v-flex> |
61 | </v-layout> | 61 | </v-layout> |
62 | </v-flex> | 62 | </v-flex> |
63 | <v-flex xs12 sm12> | 63 | <v-flex xs12 sm12> |
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">Subject Code:</label> | 66 | <label class="right">Subject Code:</label> |
67 | </v-flex> | 67 | </v-flex> |
68 | <v-flex xs7 class="ml-3"> | 68 | <v-flex xs7 class="ml-3"> |
69 | <v-text-field | 69 | <v-text-field |
70 | placeholder="fill your Subject Codes" | 70 | placeholder="fill your Subject Codes" |
71 | v-model="editedItem.subjectCode" | 71 | v-model="editedItem.subjectCode" |
72 | type="text" | 72 | type="text" |
73 | ></v-text-field> | 73 | ></v-text-field> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | </v-flex> | 76 | </v-flex> |
77 | <v-flex xs12 sm12> | 77 | <v-flex xs12 sm12> |
78 | <v-layout> | 78 | <v-layout> |
79 | <v-flex xs4 class="pt-4 subheading"> | 79 | <v-flex xs4 class="pt-4 subheading"> |
80 | <label class="right">Serial Number:</label> | 80 | <label class="right">Serial Number:</label> |
81 | </v-flex> | 81 | </v-flex> |
82 | <v-flex xs7 class="ml-3"> | 82 | <v-flex xs7 class="ml-3"> |
83 | <v-text-field | 83 | <v-text-field |
84 | placeholder="fill your Serial Number" | 84 | placeholder="fill your Serial Number" |
85 | v-model="editedItem.serialNumber" | 85 | v-model="editedItem.serialNumber" |
86 | type="text" | 86 | type="text" |
87 | ></v-text-field> | 87 | ></v-text-field> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-layout> | 89 | </v-layout> |
90 | </v-flex> | 90 | </v-flex> |
91 | <v-flex xs12 sm12> | 91 | <v-flex xs12 sm12> |
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">due Date:</label> | 94 | <label class="right">due Date:</label> |
95 | </v-flex> | 95 | </v-flex> |
96 | <v-flex xs7 class="ml-3"> | 96 | <v-flex xs7 class="ml-3"> |
97 | <v-menu | 97 | <v-menu |
98 | ref="menu1" | 98 | ref="menu1" |
99 | :close-on-content-click="false" | 99 | :close-on-content-click="false" |
100 | v-model="menu1" | 100 | v-model="menu1" |
101 | :nudge-right="40" | 101 | :nudge-right="40" |
102 | :return-value.sync="menu1" | 102 | :return-value.sync="menu1" |
103 | lazy | 103 | lazy |
104 | transition="scale-transition" | 104 | transition="scale-transition" |
105 | offset-y | 105 | offset-y |
106 | full-width | 106 | full-width |
107 | min-width="290px" | 107 | min-width="290px" |
108 | > | 108 | > |
109 | <v-text-field | 109 | <v-text-field |
110 | slot="activator" | 110 | slot="activator" |
111 | v-model="editedItem.dueDate" | 111 | v-model="editedItem.dueDate" |
112 | label="Select Due Date" | 112 | label="Select Due Date" |
113 | append-icon="event" | 113 | append-icon="event" |
114 | readonly | 114 | readonly |
115 | ></v-text-field> | 115 | ></v-text-field> |
116 | <v-date-picker v-model="editedItem.dueDate" @input="menu1 = false"></v-date-picker> | 116 | <v-date-picker v-model="editedItem.dueDate" @input="menu1 = false"></v-date-picker> |
117 | </v-menu> | 117 | </v-menu> |
118 | </v-flex> | 118 | </v-flex> |
119 | </v-layout> | 119 | </v-layout> |
120 | </v-flex> | 120 | </v-flex> |
121 | <v-flex xs12 sm12> | 121 | <v-flex xs12 sm12> |
122 | <v-layout> | 122 | <v-layout> |
123 | <v-flex xs4 class="pt-4 subheading"> | 123 | <v-flex xs4 class="pt-4 subheading"> |
124 | <label class="right">Note:</label> | 124 | <label class="right">Note:</label> |
125 | </v-flex> | 125 | </v-flex> |
126 | <v-flex xs7 class="ml-3"> | 126 | <v-flex xs7 class="ml-3"> |
127 | <v-text-field | 127 | <v-text-field |
128 | placeholder="fill your Serial Number" | 128 | placeholder="fill your Serial Number" |
129 | v-model="editedItem.note" | 129 | v-model="editedItem.note" |
130 | type="text" | 130 | type="text" |
131 | ></v-text-field> | 131 | ></v-text-field> |
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-layout> | 136 | <v-layout> |
137 | <v-flex xs12> | 137 | <v-flex xs12> |
138 | <v-card-actions> | 138 | <v-card-actions> |
139 | <v-spacer></v-spacer> | 139 | <v-spacer></v-spacer> |
140 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 140 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
141 | </v-card-actions> | 141 | </v-card-actions> |
142 | </v-flex> | 142 | </v-flex> |
143 | </v-layout> | 143 | </v-layout> |
144 | </v-container> | 144 | </v-container> |
145 | </v-form> | 145 | </v-form> |
146 | </v-card-text> | 146 | </v-card-text> |
147 | </v-card> | 147 | </v-card> |
148 | </v-dialog> | 148 | </v-dialog> |
149 | 149 | ||
150 | <!-- ****** PROFILE VIEW PARTICULAR ISSUE DATA ****** --> | 150 | <!-- ****** PROFILE VIEW PARTICULAR ISSUE DATA ****** --> |
151 | 151 | ||
152 | <v-dialog v-model="viewIssueDialog" max-width="500px"> | 152 | <v-dialog v-model="viewIssueDialog" max-width="500px"> |
153 | <v-card flat class="card-style pa-3" dark> | 153 | <v-card flat class="card-style pa-3" dark> |
154 | <v-layout> | 154 | <v-layout> |
155 | <v-flex xs12> | 155 | <v-flex xs12> |
156 | <label class="title text-xs-center">View Issue</label> | 156 | <label class="title text-xs-center">View Issue</label> |
157 | <v-icon size="24" class="right" @click="viewIssueDialog = false">cancel</v-icon> | 157 | <v-icon size="24" class="right" @click="viewIssueDialog = false">cancel</v-icon> |
158 | </v-flex> | 158 | </v-flex> |
159 | </v-layout> | 159 | </v-layout> |
160 | <v-card-text> | 160 | <v-card-text> |
161 | <v-container grid-list-md> | 161 | <v-container grid-list-md> |
162 | <v-layout wrap> | 162 | <v-layout wrap> |
163 | <v-flex> | 163 | <v-flex> |
164 | <v-layout> | 164 | <v-layout> |
165 | <v-flex xs5 sm6> | 165 | <v-flex xs5 sm6> |
166 | <h5 class="right my-1"> | 166 | <h5 class="right my-1"> |
167 | <b>Book:</b> | 167 | <b>Book:</b> |
168 | </h5> | 168 | </h5> |
169 | </v-flex> | 169 | </v-flex> |
170 | <v-flex sm6 xs8> | 170 | <v-flex sm6 xs8> |
171 | <h5 class="my-1">{{ editedItem.name }}</h5> | 171 | <h5 class="my-1">{{ editedItem.name }}</h5> |
172 | </v-flex> | 172 | </v-flex> |
173 | </v-layout> | 173 | </v-layout> |
174 | <v-layout> | 174 | <v-layout> |
175 | <v-flex xs5 sm6> | 175 | <v-flex xs5 sm6> |
176 | <h5 class="right my-1"> | 176 | <h5 class="right my-1"> |
177 | <b>Serial Number:</b> | 177 | <b>Serial Number:</b> |
178 | </h5> | 178 | </h5> |
179 | </v-flex> | 179 | </v-flex> |
180 | <v-flex sm6 xs8> | 180 | <v-flex sm6 xs8> |
181 | <h5 class="my-1">{{ editedItem.serialNumber }}</h5> | 181 | <h5 class="my-1">{{ editedItem.serialNumber }}</h5> |
182 | </v-flex> | 182 | </v-flex> |
183 | </v-layout> | 183 | </v-layout> |
184 | <v-layout> | 184 | <v-layout> |
185 | <v-flex xs5 sm6> | 185 | <v-flex xs5 sm6> |
186 | <h5 class="right my-1"> | 186 | <h5 class="right my-1"> |
187 | <b>Issue date:</b> | 187 | <b>Issue date:</b> |
188 | </h5> | 188 | </h5> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex sm6 xs8> | 190 | <v-flex sm6 xs8> |
191 | <h5 class="my-1">{{ dates(editedItem.creted) }}</h5> | 191 | <h5 class="my-1">{{ dates(editedItem.creted) }}</h5> |
192 | </v-flex> | 192 | </v-flex> |
193 | </v-layout> | 193 | </v-layout> |
194 | <v-layout> | 194 | <v-layout> |
195 | <v-flex xs5 sm6> | 195 | <v-flex xs5 sm6> |
196 | <h5 class="right my-1"> | 196 | <h5 class="right my-1"> |
197 | <b>Due date:</b> | 197 | <b>Due date:</b> |
198 | </h5> | 198 | </h5> |
199 | </v-flex> | 199 | </v-flex> |
200 | <v-flex sm6 xs8> | 200 | <v-flex sm6 xs8> |
201 | <h5 class="my-1">{{ dates(editedItem.dueDate) }}</h5> | 201 | <h5 class="my-1">{{ dates(editedItem.dueDate) }}</h5> |
202 | </v-flex> | 202 | </v-flex> |
203 | </v-layout> | 203 | </v-layout> |
204 | <v-layout> | 204 | <v-layout> |
205 | <v-flex xs5 sm6> | 205 | <v-flex xs5 sm6> |
206 | <h5 class="right my-1"> | 206 | <h5 class="right my-1"> |
207 | <b>Status:</b> | 207 | <b>Status:</b> |
208 | </h5> | 208 | </h5> |
209 | </v-flex> | 209 | </v-flex> |
210 | <v-flex sm6 xs8> | 210 | <v-flex sm6 xs8> |
211 | <h5 class="my-1">{{ editedItem.status }}</h5> | 211 | <h5 class="my-1">{{ editedItem.status }}</h5> |
212 | </v-flex> | 212 | </v-flex> |
213 | </v-layout> | 213 | </v-layout> |
214 | </v-flex> | 214 | </v-flex> |
215 | </v-layout> | 215 | </v-layout> |
216 | </v-container> | 216 | </v-container> |
217 | </v-card-text> | 217 | </v-card-text> |
218 | </v-card> | 218 | </v-card> |
219 | </v-dialog> | 219 | </v-dialog> |
220 | <!-- ****** EXISTING ISSUE TABLE****** --> | 220 | <!-- ****** EXISTING ISSUE TABLE****** --> |
221 | <!-- <v-card> | 221 | <!-- <v-card> |
222 | <v-layout> | 222 | <v-layout> |
223 | <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only"> | 223 | <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only"> |
224 | <label class="right pt-4">Library ID:</label> | 224 | <label class="right pt-4">Library ID:</label> |
225 | </v-flex> | 225 | </v-flex> |
226 | <v-flex lg2 md3 xs7> | 226 | <v-flex lg2 md3 xs7> |
227 | <v-text-field | 227 | <v-text-field |
228 | class="pl-3" | 228 | class="pl-3" |
229 | @keyup.enter="getIssueList" | 229 | @keyup.enter="getIssueList" |
230 | v-model="libraryId" | 230 | v-model="libraryId" |
231 | placeholder="fill your library Id" | 231 | placeholder="fill your library Id" |
232 | ></v-text-field> | 232 | ></v-text-field> |
233 | </v-flex> | 233 | </v-flex> |
234 | <v-flex lg9 md3 xs5> | 234 | <v-flex lg9 md3 xs5> |
235 | <v-btn | 235 | <v-btn |
236 | round | 236 | round |
237 | class="black mt-1 right hidden-xs-only" | 237 | class="black mt-1 right hidden-xs-only" |
238 | @click="getIssueList" | 238 | @click="getIssueList" |
239 | :loading="loadingSearch" | 239 | :loading="loadingSearch" |
240 | dark | 240 | dark |
241 | >Search</v-btn> | 241 | >Search</v-btn> |
242 | <v-btn | 242 | <v-btn |
243 | round | 243 | round |
244 | class="black mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" | 244 | class="black mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" |
245 | :loading="loadingSearch" | 245 | :loading="loadingSearch" |
246 | @click="getIssueList" | 246 | @click="getIssueList" |
247 | small | 247 | small |
248 | dark | 248 | dark |
249 | >Search</v-btn> | 249 | >Search</v-btn> |
250 | </v-flex> | 250 | </v-flex> |
251 | </v-layout> | 251 | </v-layout> |
252 | </v-card>--> | 252 | </v-card>--> |
253 | 253 | ||
254 | <v-toolbar color="transparent" flat> | 254 | <v-toolbar color="transparent" flat> |
255 | <v-btn | 255 | <v-btn |
256 | fab | 256 | fab |
257 | dark | 257 | dark |
258 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 258 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
259 | small | 259 | small |
260 | @click="addIssueDialog = true" | 260 | @click="addIssueDialog = true" |
261 | > | 261 | > |
262 | <v-icon dark>add</v-icon> | 262 | <v-icon dark>add</v-icon> |
263 | </v-btn> | 263 | </v-btn> |
264 | <v-btn | 264 | <v-btn |
265 | round | 265 | round |
266 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 266 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
267 | dark | 267 | dark |
268 | @click="addIssueDialog = true" | 268 | @click="addIssueDialog = true" |
269 | > | 269 | > |
270 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Issue | 270 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Issue |
271 | </v-btn> | 271 | </v-btn> |
272 | <v-flex lg2 md3 xs7> | 272 | <v-flex lg2 md3 xs7> |
273 | <v-text-field | 273 | <v-text-field |
274 | class="pl-3" | 274 | class="pl-3" |
275 | @keyup.enter="getIssueList" | 275 | @keyup.enter="getIssueList" |
276 | v-model="libraryId" | 276 | v-model="libraryId" |
277 | placeholder="fill your library Id" | 277 | placeholder="fill your library Id" |
278 | ></v-text-field> | 278 | ></v-text-field> |
279 | </v-flex> | 279 | </v-flex> |
280 | <v-spacer></v-spacer> | 280 | <v-spacer></v-spacer> |
281 | <v-btn | 281 | <v-btn |
282 | round | 282 | round |
283 | class="add-button mt-1 right hidden-xs-only" | 283 | class="add-button mt-1 right hidden-xs-only" |
284 | @click="getIssueList" | 284 | @click="getIssueList" |
285 | :loading="loadingSearch" | 285 | :loading="loadingSearch" |
286 | dark | 286 | dark |
287 | >Search</v-btn> | 287 | >Search</v-btn> |
288 | <v-btn | 288 | <v-btn |
289 | round | 289 | round |
290 | class="add-button mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" | 290 | class="add-button mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" |
291 | :loading="loadingSearch" | 291 | :loading="loadingSearch" |
292 | @click="getIssueList" | 292 | @click="getIssueList" |
293 | small | 293 | small |
294 | dark | 294 | dark |
295 | >Search</v-btn> | 295 | >Search</v-btn> |
296 | <v-card-title class="body-1" v-show="show"> | 296 | <v-card-title class="body-1" v-show="show"> |
297 | <v-btn icon large flat @click="displaySearch"> | 297 | <v-btn icon large flat @click="displaySearch"> |
298 | <v-avatar size="27"> | 298 | <v-avatar size="27"> |
299 | <img src="/static/icon/search.png" alt="icon" /> | 299 | <img src="/static/icon/search.png" alt="icon" /> |
300 | </v-avatar> | 300 | </v-avatar> |
301 | </v-btn> | 301 | </v-btn> |
302 | </v-card-title> | 302 | </v-card-title> |
303 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 303 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
304 | <v-layout> | 304 | <v-layout> |
305 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 305 | <v-text-field |
306 | autofocus | ||
307 | v-model="search" | ||
308 | label="Search" | ||
309 | prepend-inner-icon="search" | ||
310 | color="primary" | ||
311 | ></v-text-field> | ||
306 | <v-icon @click="closeSearch" color="error">close</v-icon> | 312 | <v-icon @click="closeSearch" color="error">close</v-icon> |
307 | </v-layout> | 313 | </v-layout> |
308 | </v-flex> | 314 | </v-flex> |
309 | </v-toolbar> | 315 | </v-toolbar> |
310 | <v-data-table | 316 | <v-data-table |
311 | :headers="headers" | 317 | :headers="headers" |
312 | :items="desserts" | 318 | :items="desserts" |
313 | :pagination.sync="pagination" | 319 | :pagination.sync="pagination" |
314 | :search="search" | 320 | :search="search" |
315 | > | 321 | > |
316 | <template slot="items" slot-scope="props" v-if="props.item.isReturn != true"> | 322 | <template slot="items" slot-scope="props" v-if="props.item.isReturn != true"> |
317 | <tr class="tr"> | 323 | <tr class="tr"> |
318 | <td class="td td-row">{{ props.index + 1}}</td> | 324 | <td class="td td-row">{{ props.index + 1}}</td> |
319 | <td class="text-xs-center td td-row">{{ props.item.bookId.name}}</td> | 325 | <td class="text-xs-center td td-row">{{ props.item.bookId.name}}</td> |
320 | <td class="text-xs-center td td-row">{{ props.item.serialNumber}}</td> | 326 | <td class="text-xs-center td td-row">{{ props.item.serialNumber}}</td> |
321 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> | 327 | <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> |
322 | <td class="text-xs-center td td-row">{{ dates(props.item.dueDate) }}</td> | 328 | <td class="text-xs-center td td-row">{{ dates(props.item.dueDate) }}</td> |
323 | <td class="text-xs-center td td-row"> | 329 | <td class="text-xs-center td td-row"> |
324 | <span | 330 | <span |
325 | v-if="props.item.bookId.status === 'AVAILABLE'" | 331 | v-if="props.item.bookId.status === 'AVAILABLE'" |
326 | class="green lighten-1 pa-1 px-2 white--text paymentStatus" | 332 | class="green lighten-1 pa-1 px-2 white--text paymentStatus" |
327 | >{{ props.item.bookId.status}}</span> | 333 | >{{ props.item.bookId.status}}</span> |
328 | <span | 334 | <span |
329 | v-if="props.item.bookId.status === 'UNAVAILABLE'" | 335 | v-if="props.item.bookId.status === 'UNAVAILABLE'" |
330 | class="red lighten-1 pa-1 px-2 white--text paymentStatus" | 336 | class="red lighten-1 pa-1 px-2 white--text paymentStatus" |
331 | >{{ props.item.bookId.status}}</span> | 337 | >{{ props.item.bookId.status}}</span> |
332 | </td> | 338 | </td> |
333 | <td class="text-xs-center td td-row"> | 339 | <td class="text-xs-center td td-row"> |
334 | <span> | 340 | <span> |
335 | <v-tooltip top> | 341 | <v-tooltip top> |
336 | <img | 342 | <img |
337 | slot="activator" | 343 | slot="activator" |
338 | style="cursor:pointer; width:25px; height:25px; " | 344 | style="cursor:pointer; width:25px; height:25px; " |
339 | class="mr-3" | 345 | class="mr-3" |
340 | @click="profile(props.item)" | 346 | @click="profile(props.item)" |
341 | src="/static/icon/view.png" | 347 | src="/static/icon/view.png" |
342 | /> | 348 | /> |
343 | <span>View</span> | 349 | <span>View</span> |
344 | </v-tooltip> | 350 | </v-tooltip> |
345 | <v-tooltip top> | 351 | <v-tooltip top> |
346 | <img | 352 | <img |
347 | slot="activator" | 353 | slot="activator" |
348 | style="cursor:pointer; width:20px; height:18px; " | 354 | style="cursor:pointer; width:20px; height:18px; " |
349 | class="mr-3" | 355 | class="mr-3" |
350 | @click="editItem(props.item)" | 356 | @click="editItem(props.item)" |
351 | src="/static/icon/edit.png" | 357 | src="/static/icon/edit.png" |
352 | /> | 358 | /> |
353 | <span>Edit</span> | 359 | <span>Edit</span> |
354 | </v-tooltip> | 360 | </v-tooltip> |
355 | <v-tooltip top> | 361 | <v-tooltip top> |
356 | <img | 362 | <img |
357 | slot="activator" | 363 | slot="activator" |
358 | style="cursor:pointer; width:20px; height:20px; " | 364 | style="cursor:pointer; width:20px; height:20px; " |
359 | @click="deleteItem(props.item)" | 365 | @click="deleteItem(props.item)" |
360 | src="/static/icon/delete.png" | 366 | src="/static/icon/delete.png" |
361 | /> | 367 | /> |
362 | <span>Delete</span> | 368 | <span>Delete</span> |
363 | </v-tooltip> | 369 | </v-tooltip> |
364 | </span> | 370 | </span> |
365 | </td> | 371 | </td> |
366 | </tr> | 372 | </tr> |
367 | </template> | 373 | </template> |
368 | <v-alert | 374 | <v-alert |
369 | slot="no-results" | 375 | slot="no-results" |
370 | :value="true" | 376 | :value="true" |
371 | color="error" | 377 | color="error" |
372 | icon="warning" | 378 | icon="warning" |
373 | >Your search for "{{ search }}" found no results.</v-alert> | 379 | >Your search for "{{ search }}" found no results.</v-alert> |
374 | </v-data-table> | 380 | </v-data-table> |
375 | 381 | ||
376 | <!-- ****** ADD Issue ****** --> | 382 | <!-- ****** ADD Issue ****** --> |
377 | <v-dialog v-model="addIssueDialog" max-width="600px"> | 383 | <v-dialog v-model="addIssueDialog" max-width="600px" v-if="addIssueDialog"> |
378 | <v-card flat class="card-style pa-2" dark> | 384 | <v-card flat class="card-style pa-2" dark> |
379 | <v-layout> | 385 | <v-layout> |
380 | <v-flex xs12> | 386 | <v-flex xs12> |
381 | <label class="title text-xs-center">Add Issue</label> | 387 | <label class="title text-xs-center">Add Issue</label> |
382 | <v-icon size="24" class="right" @click="addIssueDialog = false">cancel</v-icon> | 388 | <v-icon size="24" class="right" @click="closeAddIssueModel">cancel</v-icon> |
383 | </v-flex> | 389 | </v-flex> |
384 | </v-layout> | 390 | </v-layout> |
385 | <v-form ref="form" v-model="valid" lazy-validation> | 391 | <v-form ref="form" v-model="valid" lazy-validation> |
386 | <v-container fluid> | 392 | <v-container fluid> |
387 | <v-flex xs12> | 393 | <v-flex xs12> |
388 | <v-layout> | 394 | <v-layout> |
389 | <v-flex xs4 class="pt-4 subheading"> | 395 | <v-flex xs4 class="pt-4 subheading"> |
390 | <label class="right">Library ID:</label> | 396 | <label class="right">Library ID:</label> |
391 | </v-flex> | 397 | </v-flex> |
392 | <v-flex xs7 class="ml-3"> | 398 | <v-flex xs7 class="ml-3"> |
393 | <v-text-field | 399 | <v-text-field |
394 | v-model="libraryID" | 400 | v-model="libraryID" |
395 | placeholder="fill your Library ID" | 401 | placeholder="fill your Library ID" |
396 | :rules="libraryIDRules" | 402 | :rules="libraryIDRules" |
397 | required | 403 | required |
398 | ></v-text-field> | 404 | ></v-text-field> |
399 | </v-flex> | 405 | </v-flex> |
400 | </v-layout> | 406 | </v-layout> |
401 | </v-flex> | 407 | </v-flex> |
402 | <v-flex xs12> | 408 | <v-flex xs12> |
403 | <v-layout> | 409 | <v-layout> |
404 | <v-flex xs4 class="pt-4 subheading"> | 410 | <v-flex xs4 class="pt-4 subheading"> |
405 | <label class="right">Book:</label> | 411 | <label class="right">Book:</label> |
406 | </v-flex> | 412 | </v-flex> |
407 | <v-flex xs7 class="ml-3"> | 413 | <v-flex xs7 class="ml-3"> |
408 | <v-select | 414 | <v-select |
409 | label="Select Book Name" | 415 | label="Select Book Name" |
410 | :rules="bookRules" | 416 | :rules="bookRules" |
411 | :items="books" | 417 | :items="books" |
412 | item-text="name" | 418 | item-text="name" |
413 | item-value="_id" | 419 | item-value="_id" |
414 | v-model="bookId" | 420 | v-model="bookId" |
415 | @change="getParticularBookData(bookId)" | 421 | @change="getParticularBookData(bookId)" |
416 | required | 422 | required |
417 | ></v-select> | 423 | ></v-select> |
418 | </v-flex> | 424 | </v-flex> |
419 | </v-layout> | 425 | </v-layout> |
420 | </v-flex> | 426 | </v-flex> |
421 | <v-flex xs12> | 427 | <v-flex xs12> |
422 | <v-layout> | 428 | <v-layout> |
423 | <v-flex xs4 class="pt-4 subheading"> | 429 | <v-flex xs4 class="pt-4 subheading"> |
424 | <label class="right">Author:</label> | 430 | <label class="right">Author:</label> |
425 | </v-flex> | 431 | </v-flex> |
426 | <v-flex xs7 class="ml-3"> | 432 | <v-flex xs7 class="ml-3"> |
427 | <v-text-field | 433 | <v-text-field |
428 | placeholder="fill your Author" | 434 | placeholder="fill your Author" |
429 | :rules="authorRules" | 435 | :rules="authorRules" |
430 | v-model="addIssue.author" | 436 | v-model="addIssue.author" |
431 | ></v-text-field> | 437 | ></v-text-field> |
432 | </v-flex> | 438 | </v-flex> |
433 | </v-layout> | 439 | </v-layout> |
434 | </v-flex> | 440 | </v-flex> |
435 | <v-flex xs12> | 441 | <v-flex xs12> |
436 | <v-layout> | 442 | <v-layout> |
437 | <v-flex xs4 class="pt-4 subheading"> | 443 | <v-flex xs4 class="pt-4 subheading"> |
438 | <label class="right">Subject Code:</label> | 444 | <label class="right">Subject Code:</label> |
439 | </v-flex> | 445 | </v-flex> |
440 | <v-flex xs7 class="ml-3"> | 446 | <v-flex xs7 class="ml-3"> |
441 | <v-text-field | 447 | <v-text-field |
442 | placeholder="fill your Subject Code" | 448 | placeholder="fill your Subject Code" |
443 | :rules="subjectCodeRules" | 449 | :rules="subjectCodeRules" |
444 | v-model="addIssue.subjectCode" | 450 | v-model="addIssue.subjectCode" |
445 | ></v-text-field> | 451 | ></v-text-field> |
446 | </v-flex> | 452 | </v-flex> |
447 | </v-layout> | 453 | </v-layout> |
448 | </v-flex> | 454 | </v-flex> |
449 | <v-flex xs12> | 455 | <v-flex xs12> |
450 | <v-layout> | 456 | <v-layout> |
451 | <v-flex xs4 class="pt-4 subheading"> | 457 | <v-flex xs4 class="pt-4 subheading"> |
452 | <label class="right">Serial No:</label> | 458 | <label class="right">Serial No:</label> |
453 | </v-flex> | 459 | </v-flex> |
454 | <v-flex xs7 class="ml-3"> | 460 | <v-flex xs7 class="ml-3"> |
455 | <v-text-field | 461 | <v-text-field |
456 | placeholder="fill your Serial No" | 462 | placeholder="fill your Serial No" |
457 | :rules="authorRules" | 463 | :rules="authorRules" |
458 | v-model="serialNo" | 464 | v-model="serialNo" |
459 | ></v-text-field> | 465 | ></v-text-field> |
460 | </v-flex> | 466 | </v-flex> |
461 | </v-layout> | 467 | </v-layout> |
462 | </v-flex> | 468 | </v-flex> |
463 | <v-flex xs12> | 469 | <v-flex xs12> |
464 | <v-layout> | 470 | <v-layout> |
465 | <v-flex xs4 class="pt-4 subheading"> | 471 | <v-flex xs4 class="pt-4 subheading"> |
466 | <label class="right">Due Date:</label> | 472 | <label class="right">Due Date:</label> |
467 | </v-flex> | 473 | </v-flex> |
468 | <v-flex xs7 class="ml-3"> | 474 | <v-flex xs7 class="ml-3"> |
469 | <v-menu | 475 | <v-menu |
470 | ref="menu2" | 476 | ref="menu2" |
471 | :close-on-content-click="false" | 477 | :close-on-content-click="false" |
472 | v-model="menu2" | 478 | v-model="menu2" |
473 | :nudge-right="40" | 479 | :nudge-right="40" |
474 | :return-value.sync="date" | 480 | :return-value.sync="date" |
475 | lazy | 481 | lazy |
476 | transition="scale-transition" | 482 | transition="scale-transition" |
477 | offset-y | 483 | offset-y |
478 | full-width | 484 | full-width |
479 | min-width="290px" | 485 | min-width="290px" |
480 | > | 486 | > |
481 | <v-text-field | 487 | <v-text-field |
482 | slot="activator" | 488 | slot="activator" |
483 | v-model="date" | 489 | v-model="date" |
484 | label="Select Due Date" | 490 | label="Select Due Date" |
485 | append-icon="event" | 491 | append-icon="event" |
486 | :rules="dueDateRule" | 492 | :rules="dueDateRule" |
487 | readonly | 493 | readonly |
488 | ></v-text-field> | 494 | ></v-text-field> |
489 | <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker> | 495 | <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker> |
490 | </v-menu> | 496 | </v-menu> |
491 | </v-flex> | 497 | </v-flex> |
492 | </v-layout> | 498 | </v-layout> |
493 | </v-flex> | 499 | </v-flex> |
494 | <v-flex xs12> | 500 | <v-flex xs12> |
495 | <v-layout> | 501 | <v-layout> |
496 | <v-flex xs4 class="pt-4 subheading"> | 502 | <v-flex xs4 class="pt-4 subheading"> |
497 | <label class="right">Note:</label> | 503 | <label class="right">Note:</label> |
498 | </v-flex> | 504 | </v-flex> |
499 | <v-flex xs7 class="ml-3"> | 505 | <v-flex xs7 class="ml-3"> |
500 | <v-text-field placeholder="fill your Note" :rules="noteRules" v-model="note"></v-text-field> | 506 | <v-text-field placeholder="fill your Note" :rules="noteRules" v-model="note"></v-text-field> |
501 | </v-flex> | 507 | </v-flex> |
502 | </v-layout> | 508 | </v-layout> |
503 | </v-flex> | 509 | </v-flex> |
504 | <v-layout> | 510 | <v-layout> |
505 | <v-flex xs12> | 511 | <v-flex xs12> |
506 | <v-card-actions> | 512 | <v-card-actions> |
507 | <v-spacer></v-spacer> | 513 | <v-spacer></v-spacer> |
508 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 514 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
509 | <v-btn | 515 | <v-btn |
510 | @click="submit" | 516 | @click="submit" |
511 | round | 517 | round |
512 | dark | 518 | dark |
513 | :loading="loading" | 519 | :loading="loading" |
514 | class="add-button" | 520 | class="add-button" |
515 | :disabled="disable" | 521 | :disabled="disable" |
516 | >Add</v-btn> | 522 | >Add</v-btn> |
517 | </v-card-actions> | 523 | </v-card-actions> |
518 | </v-flex> | 524 | </v-flex> |
519 | </v-layout> | 525 | </v-layout> |
520 | </v-container> | 526 | </v-container> |
521 | </v-form> | 527 | </v-form> |
522 | </v-card> | 528 | </v-card> |
523 | </v-dialog> | 529 | </v-dialog> |
524 | <div class="loader" v-if="showLoader"> | 530 | <div class="loader" v-if="showLoader"> |
525 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 531 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
526 | </div> | 532 | </div> |
527 | <v-snackbar | 533 | <v-snackbar |
528 | :timeout="timeout" | 534 | :timeout="timeout" |
529 | :top="y === 'top'" | 535 | :top="y === 'top'" |
530 | :right="x === 'right'" | 536 | :right="x === 'right'" |
531 | :vertical="mode === 'vertical'" | 537 | :vertical="mode === 'vertical'" |
532 | v-model="snackbar" | 538 | v-model="snackbar" |
533 | :color="color" | 539 | :color="color" |
534 | >{{ text }}</v-snackbar> | 540 | >{{ text }}</v-snackbar> |
535 | </v-container> | 541 | </v-container> |
536 | </template> | 542 | </template> |
537 | 543 | ||
538 | <script> | 544 | <script> |
539 | import http from "@/Services/http.js"; | 545 | import http from "@/Services/http.js"; |
540 | import moment from "moment"; | 546 | import moment from "moment"; |
541 | 547 | ||
542 | export default { | 548 | export default { |
543 | data: () => ({ | 549 | data: () => ({ |
544 | snackbar: false, | 550 | snackbar: false, |
545 | date: null, | 551 | date: null, |
546 | menu1: false, | 552 | menu1: false, |
547 | menu2: false, | 553 | menu2: false, |
548 | color: "", | 554 | color: "", |
549 | show: true, | 555 | show: true, |
550 | showSearch: false, | 556 | showSearch: false, |
551 | dueDate: null, | 557 | dueDate: null, |
552 | y: "top", | 558 | y: "top", |
553 | x: "right", | 559 | x: "right", |
554 | mode: "", | 560 | mode: "", |
555 | timeout: 10000, | 561 | timeout: 10000, |
556 | text: "", | 562 | text: "", |
557 | libraryId: "", | 563 | libraryId: "", |
558 | loading: false, | 564 | loading: false, |
559 | loadingSearch: false, | 565 | loadingSearch: false, |
560 | date: null, | 566 | date: null, |
561 | search: "", | 567 | search: "", |
562 | addIssueDialog: false, | 568 | addIssueDialog: false, |
563 | viewIssueDialog: false, | 569 | viewIssueDialog: false, |
564 | showLoader: false, | 570 | showLoader: false, |
565 | editIssueDialog: false, | 571 | editIssueDialog: false, |
566 | dialog1: false, | 572 | dialog1: false, |
567 | valid: true, | 573 | valid: true, |
568 | isActive: true, | 574 | isActive: true, |
569 | newActive: false, | 575 | newActive: false, |
570 | addclass: [], | 576 | addclass: [], |
571 | addSection: [], | 577 | addSection: [], |
572 | pagination: { | 578 | pagination: { |
573 | rowsPerPage: 10 | 579 | rowsPerPage: 10, |
574 | }, | 580 | }, |
575 | libraryIDRules: [v => !!v || " Library ID is required"], | 581 | libraryIDRules: [(v) => !!v || " Library ID is required"], |
576 | bookRules: [v => !!v || " book Name is required"], | 582 | bookRules: [(v) => !!v || " book Name is required"], |
577 | authorRules: [v => !!v || "Author Name is required"], | 583 | authorRules: [(v) => !!v || "Author Name is required"], |
578 | subjectCodeRules: [v => !!v || "Subject Code is required"], | 584 | subjectCodeRules: [(v) => !!v || "Subject Code is required"], |
579 | authorRules: [v => !!v || "Author is required"], | 585 | authorRules: [(v) => !!v || "Author is required"], |
580 | noteRules: [v => !!v || "Note is required"], | 586 | noteRules: [(v) => !!v || "Note is required"], |
581 | dueDateRule: [v => !!v || "Due Date is required"], | 587 | dueDateRule: [(v) => !!v || "Due Date is required"], |
582 | headers: [ | 588 | headers: [ |
583 | { | 589 | { |
584 | align: "justify-center", | 590 | align: "justify-center", |
585 | text: "No", | 591 | text: "No", |
586 | sortable: false, | 592 | sortable: false, |
587 | value: "No" | 593 | value: "No", |
588 | }, | 594 | }, |
589 | { text: "Book", vaue: "name", sortable: false, align: "center" }, | 595 | { text: "Book", vaue: "name", sortable: false, align: "center" }, |
590 | { | 596 | { |
591 | text: "Serial Number", | 597 | text: "Serial Number", |
592 | value: "serialNumber", | 598 | value: "serialNumber", |
593 | sortable: false, | 599 | sortable: false, |
594 | align: "center" | 600 | align: "center", |
595 | }, | 601 | }, |
596 | { | 602 | { |
597 | text: "Issue Date", | 603 | text: "Issue Date", |
598 | value: "created", | 604 | value: "created", |
599 | sortable: false, | 605 | sortable: false, |
600 | align: "center" | 606 | align: "center", |
601 | }, | 607 | }, |
602 | { | 608 | { |
603 | text: "Due Date", | 609 | text: "Due Date", |
604 | value: "dueDate", | 610 | value: "dueDate", |
605 | sortable: false, | 611 | sortable: false, |
606 | align: "center" | 612 | align: "center", |
607 | }, | 613 | }, |
608 | { | 614 | { |
609 | text: "Status", | 615 | text: "Status", |
610 | value: "status", | 616 | value: "status", |
611 | sortable: false, | 617 | sortable: false, |
612 | align: "center" | 618 | align: "center", |
613 | }, | 619 | }, |
614 | { text: "Action", value: "", sortable: false, align: "center" } | 620 | { text: "Action", value: "", sortable: false, align: "center" }, |
615 | ], | 621 | ], |
616 | desserts: [], | 622 | desserts: [], |
617 | addIssue: {}, | 623 | addIssue: {}, |
618 | bookId: "", | 624 | bookId: "", |
619 | libraryID: "", | 625 | libraryID: "", |
620 | serialNo: "", | 626 | serialNo: "", |
621 | note: "", | 627 | note: "", |
622 | editedItem: {}, | 628 | editedItem: {}, |
623 | books: [], | 629 | books: [], |
624 | token: "", | 630 | token: "", |
625 | disable: false | 631 | disable: false, |
626 | }), | 632 | }), |
633 | watch: { | ||
634 | addIssueDialog: function (val) { | ||
635 | if (!val) { | ||
636 | this.addIssue = []; | ||
637 | this.libraryID = ""; | ||
638 | this.bookId = ""; | ||
639 | this.serialNo = ""; | ||
640 | this.menu2 = false; | ||
641 | this.date = null; | ||
642 | this.note = ""; | ||
643 | } | ||
644 | }, | ||
645 | }, | ||
627 | methods: { | 646 | methods: { |
628 | dates: function(date) { | 647 | dates: function (date) { |
629 | return moment(date).format("MMMM DD, YYYY"); | 648 | return moment(date).format("MMMM DD, YYYY"); |
630 | }, | 649 | }, |
631 | pickFile() { | 650 | pickFile() { |
632 | this.$refs.image.click(); | 651 | this.$refs.image.click(); |
633 | }, | 652 | }, |
634 | getIssueList() { | 653 | getIssueList() { |
635 | this.showLoader = true; | 654 | this.showLoader = true; |
636 | this.loadingSearch = true; | 655 | this.loadingSearch = true; |
637 | if (this.libraryID) { | 656 | if (this.libraryID) { |
638 | this.libraryId = this.libraryID; | 657 | this.libraryId = this.libraryID; |
639 | } | 658 | } |
640 | http() | 659 | http() |
641 | .get( | 660 | .get( |
642 | "/getBooksIssueList", | 661 | "/getBooksIssueList", |
643 | { | 662 | { |
644 | params: { | 663 | params: { |
645 | libraryId: this.libraryId, | 664 | libraryId: this.libraryId, |
646 | schoolId: this.$store.state.schoolId | 665 | schoolId: this.$store.state.schoolId, |
647 | } | 666 | }, |
648 | }, | 667 | }, |
649 | { | 668 | { |
650 | headers: { Authorization: "Bearer " + this.token } | 669 | headers: { Authorization: "Bearer " + this.token }, |
651 | } | 670 | } |
652 | ) | 671 | ) |
653 | .then(response => { | 672 | .then((response) => { |
654 | this.desserts = response.data.data; | 673 | this.desserts = response.data.data; |
655 | this.showLoader = false; | 674 | this.showLoader = false; |
656 | this.loadingSearch = false; | 675 | this.loadingSearch = false; |
657 | }) | 676 | }) |
658 | .catch(error => { | 677 | .catch((error) => { |
659 | this.showLoader = false; | 678 | this.showLoader = false; |
660 | this.loadingSearch = false; | 679 | this.loadingSearch = false; |
661 | this.snackbar = true; | 680 | this.snackbar = true; |
662 | this.text = error.response.data.message; | 681 | this.text = error.response.data.message; |
663 | if (error.response.status === 401) { | 682 | if (error.response.status === 401) { |
664 | this.$router.replace({ path: "/" }); | 683 | this.$router.replace({ path: "/" }); |
665 | this.$store.dispatch("setToken", null); | 684 | this.$store.dispatch("setToken", null); |
666 | this.$store.dispatch("Id", null); | 685 | this.$store.dispatch("Id", null); |
667 | this.$store.dispatch("Role", null); | 686 | this.$store.dispatch("Role", null); |
668 | } | 687 | } |
669 | }); | 688 | }); |
670 | }, | 689 | }, |
671 | editItem(item) { | 690 | editItem(item) { |
672 | this.editedIndex = this.desserts.indexOf(item); | 691 | this.editedIndex = this.desserts.indexOf(item); |
673 | this.editedItem = Object.assign({}, item); | 692 | this.editedItem = Object.assign({}, item); |
674 | this.editedItem.name = item.bookId.name; | 693 | this.editedItem.name = item.bookId.name; |
675 | this.editedItem.status = item.bookId.status; | 694 | this.editedItem.status = item.bookId.status; |
676 | this.editedItem.dueDate = | 695 | this.editedItem.dueDate = |
677 | this.editedItem.dueDate != undefined | 696 | this.editedItem.dueDate != undefined |
678 | ? (this.editedItem.dueDate = this.editedItem.dueDate.substring(0, 10)) | 697 | ? (this.editedItem.dueDate = this.editedItem.dueDate.substring(0, 10)) |
679 | : (this.editedItem.dueDate = ""); | 698 | : (this.editedItem.dueDate = ""); |
680 | this.editIssueDialog = true; | 699 | this.editIssueDialog = true; |
681 | }, | 700 | }, |
682 | profile(item) { | 701 | profile(item) { |
683 | this.editedIndex = this.desserts.indexOf(item); | 702 | this.editedIndex = this.desserts.indexOf(item); |
684 | this.editedItem = Object.assign({}, item); | 703 | this.editedItem = Object.assign({}, item); |
685 | this.editedItem.name = item.bookId.name; | 704 | this.editedItem.name = item.bookId.name; |
686 | this.editedItem.status = item.bookId.status; | 705 | this.editedItem.status = item.bookId.status; |
687 | 706 | ||
688 | this.viewIssueDialog = true; | 707 | this.viewIssueDialog = true; |
689 | }, | 708 | }, |
690 | deleteItem(item) { | 709 | deleteItem(item) { |
691 | let deleteParticularIssue = { | 710 | let deleteParticularIssue = { |
692 | bookIssueId: item._id | 711 | bookIssueId: item._id, |
693 | }; | 712 | }; |
694 | http() | 713 | http() |
695 | .delete( | 714 | .delete( |
696 | "/deleteBookIssue", | 715 | "/deleteBookIssue", |
697 | confirm("Are you sure you want to delete this?") && { | 716 | confirm("Are you sure you want to delete this?") && { |
698 | params: deleteParticularIssue | 717 | params: deleteParticularIssue, |
699 | } | 718 | } |
700 | ) | 719 | ) |
701 | .then(response => { | 720 | .then((response) => { |
702 | this.snackbar = true; | 721 | this.snackbar = true; |
703 | this.text = "Delete Successfully"; | 722 | this.text = "Delete Successfully"; |
704 | this.getIssueList(); | 723 | this.getIssueList(); |
705 | if (this.libraryID) { | 724 | if (this.libraryID) { |
706 | this.libraryId = this.libraryID; | 725 | this.libraryId = this.libraryID; |
707 | } | 726 | } |
708 | if (this.libraryId) { | 727 | if (this.libraryId) { |
709 | this.libraryId = this.libraryId; | 728 | this.libraryId = this.libraryId; |
710 | } | 729 | } |
711 | this.snackbar = true; | 730 | this.snackbar = true; |
712 | this.text = response.data.message; | 731 | this.text = response.data.message; |
713 | this.color = "green"; | 732 | this.color = "green"; |
714 | this.loading = false; | 733 | this.loading = false; |
715 | }) | 734 | }) |
716 | .catch(error => { | 735 | .catch((error) => { |
717 | // console.log(error); | 736 | // console.log(error); |
718 | this.snackbar = true; | 737 | this.snackbar = true; |
719 | this.text = error.response.data.message; | 738 | this.text = error.response.data.message; |
720 | this.color = "red"; | 739 | this.color = "red"; |
721 | }); | 740 | }); |
722 | }, | 741 | }, |
723 | returnBook(item) { | 742 | returnBook(item) { |
724 | let returnBook = { | 743 | let returnBook = { |
725 | bookIssueId: item._id | 744 | bookIssueId: item._id, |
726 | }; | 745 | }; |
727 | http() | 746 | http() |
728 | .put( | 747 | .put( |
729 | "/returnBook", | 748 | "/returnBook", |
730 | confirm("Are you sure you want to return this?") && returnBook | 749 | confirm("Are you sure you want to return this?") && returnBook |
731 | ) | 750 | ) |
732 | .then(response => { | 751 | .then((response) => { |
733 | this.snackbar = true; | 752 | this.snackbar = true; |
734 | this.text = "Successfully return Issue a Book "; | 753 | this.text = "Successfully return Issue a Book "; |
735 | this.getIssueList(); | 754 | this.getIssueList(); |
736 | }) | 755 | }) |
737 | .catch(error => {}); | 756 | .catch((error) => {}); |
738 | }, | 757 | }, |
739 | close() { | 758 | close() { |
740 | this.editIssueDialog = false; | 759 | this.editIssueDialog = false; |
741 | }, | 760 | }, |
742 | close1() { | 761 | close1() { |
743 | this.viewIssueDialog = false; | 762 | this.viewIssueDialog = false; |
744 | }, | 763 | }, |
764 | closeAddIssueModel() { | ||
765 | this.addIssueDialog = false; | ||
766 | this.desserts = []; | ||
767 | this.addIssue = []; | ||
768 | this.libraryID = ""; | ||
769 | this.bookId = ""; | ||
770 | this.serialNo = ""; | ||
771 | this.menu2 = false; | ||
772 | this.date = null; | ||
773 | this.note = ""; | ||
774 | }, | ||
745 | submit() { | 775 | submit() { |
746 | if (this.$refs.form.validate()) { | 776 | if (this.$refs.form.validate()) { |
747 | let createBook = { | 777 | let createBook = { |
748 | bookId: this.bookId, | 778 | bookId: this.bookId, |
749 | author: this.addIssue.author, | 779 | author: this.addIssue.author, |
750 | subjectCode: this.addIssue.subjectCode, | 780 | subjectCode: this.addIssue.subjectCode, |
751 | libraryId: this.libraryID, | 781 | libraryId: this.libraryID, |
752 | serialNumber: this.serialNo, | 782 | serialNumber: this.serialNo, |
753 | note: this.note, | 783 | note: this.note, |
754 | dueDate: this.date, | 784 | dueDate: this.date, |
755 | schoolId: this.$store.state.schoolId | 785 | schoolId: this.$store.state.schoolId, |
756 | }; | 786 | }; |
757 | this.loading = true; | 787 | this.loading = true; |
758 | http() | 788 | http() |
759 | .post("/createBookIssue", createBook) | 789 | .post("/createBookIssue", createBook) |
760 | .then(response => { | 790 | .then((response) => { |
761 | this.getIssueList(); | 791 | this.getIssueList(); |
762 | this.snackbar = true; | 792 | this.snackbar = true; |
763 | this.text = response.data.message; | 793 | this.text = response.data.message; |
764 | this.addIssueDialog = false; | 794 | this.addIssueDialog = false; |
765 | this.color = "green"; | 795 | this.color = "green"; |
766 | this.loading = false; | 796 | this.loading = false; |
767 | this.clear(); | 797 | this.clear(); |
768 | }) | 798 | }) |
769 | .catch(error => { | 799 | .catch((error) => { |
770 | this.snackbar = true; | 800 | this.snackbar = true; |
771 | this.text = error.response.data.message; | 801 | this.text = error.response.data.message; |
772 | this.color = "red"; | 802 | this.color = "red"; |
773 | this.loading = false; | 803 | this.loading = false; |
774 | }); | 804 | }); |
775 | } | 805 | } |
776 | }, | 806 | }, |
777 | clear() { | 807 | clear() { |
778 | this.$refs.form.reset(); | 808 | this.$refs.form.reset(); |
779 | this.disable = false; | 809 | this.disable = false; |
780 | }, | 810 | }, |
781 | save() { | 811 | save() { |
782 | this.editedItem.bookIssueId = this.editedItem._id; | 812 | this.editedItem.bookIssueId = this.editedItem._id; |
783 | this.editedItem.bookId = this.editedItem.bookId; | 813 | this.editedItem.bookId = this.editedItem.bookId; |
784 | http() | 814 | http() |
785 | .put("/updateBookIssue", this.editedItem) | 815 | .put("/updateBookIssue", this.editedItem) |
786 | .then(response => { | 816 | .then((response) => { |
787 | this.editIssueDialog = false; | 817 | this.editIssueDialog = false; |
788 | this.snackbar = true; | 818 | this.snackbar = true; |
789 | this.text = "Successfully Edit Issue a Book"; | 819 | this.text = "Successfully Edit Issue a Book"; |
790 | this.color = "green"; | 820 | this.color = "green"; |
791 | this.getIssueList(); | 821 | this.getIssueList(); |
792 | this.close(); | 822 | this.close(); |
793 | }) | 823 | }) |
794 | .catch(error => { | 824 | .catch((error) => { |
795 | this.snackbar = true; | 825 | this.snackbar = true; |
796 | this.text = error.response.data.message; | 826 | this.text = error.response.data.message; |
797 | this.color = "red"; | 827 | this.color = "red"; |
798 | }); | 828 | }); |
799 | }, | 829 | }, |
800 | getBookData() { | 830 | getBookData() { |
801 | this.showLoader = true; | 831 | this.showLoader = true; |
802 | http() | 832 | http() |
803 | .get("/getBooksList", { | 833 | .get("/getBooksList", { |
804 | params: { | 834 | params: { |
805 | schoolId: this.$store.state.schoolId | 835 | schoolId: this.$store.state.schoolId, |
806 | }, | 836 | }, |
807 | headers: { Authorization: "Bearer " + this.token } | 837 | headers: { Authorization: "Bearer " + this.token }, |
808 | }) | 838 | }) |
809 | .then(response => { | 839 | .then((response) => { |
810 | this.books = response.data.data; | 840 | this.books = response.data.data; |
811 | this.showLoader = false; | 841 | this.showLoader = false; |
812 | }) | 842 | }) |
813 | .catch(error => { | 843 | .catch((error) => { |
814 | this.showLoader = false; | 844 | this.showLoader = false; |
815 | if (error.response.status === 401) { | 845 | if (error.response.status === 401) { |
816 | this.$router.replace({ path: "/" }); | 846 | this.$router.replace({ path: "/" }); |
817 | this.$store.dispatch("setToken", null); | 847 | this.$store.dispatch("setToken", null); |
818 | this.$store.dispatch("Id", null); | 848 | this.$store.dispatch("Id", null); |
819 | } | 849 | } |
820 | }); | 850 | }); |
821 | }, | 851 | }, |
822 | getParticularBookData(books) { | 852 | getParticularBookData(books) { |
823 | for (let i = 0; i < this.books.length; i++) { | 853 | for (let i = 0; i < this.books.length; i++) { |
824 | if (books == this.books[i]._id) { | 854 | if (books == this.books[i]._id) { |
825 | if (this.books[i].remaining <= 0) { | 855 | if (this.books[i].remaining <= 0) { |
826 | this.snackbar = true; | 856 | this.snackbar = true; |
827 | this.text = "Book is unavailable"; | 857 | this.text = "Book is unavailable"; |
828 | this.color = "red"; | 858 | this.color = "red"; |
829 | this.disable = true; | 859 | this.disable = true; |
830 | } else if (this.books[i].remaining > 0) { | 860 | } else if (this.books[i].remaining > 0) { |
831 | this.disable = false; | 861 | this.disable = false; |
832 | } | 862 | } |
833 | this.addIssue = { | 863 | this.addIssue = { |
834 | author: this.books[i].author, | 864 | author: this.books[i].author, |
835 | subjectCode: this.books[i].subjectCode | 865 | subjectCode: this.books[i].subjectCode, |
836 | }; | 866 | }; |
837 | } | 867 | } |
838 | } | 868 | } |
839 | this.addIssue.boojk = books; | 869 | this.addIssue.boojk = books; |
840 | }, | 870 | }, |
841 | displaySearch() { | 871 | displaySearch() { |
842 | (this.show = false), (this.showSearch = true); | 872 | (this.show = false), (this.showSearch = true); |
843 | }, | 873 | }, |
844 | closeSearch() { | 874 | closeSearch() { |
845 | this.showSearch = false; | 875 | this.showSearch = false; |
846 | this.show = true; | 876 | this.show = true; |
847 | this.search = ""; | 877 | this.search = ""; |
848 | } | 878 | }, |
849 | }, | 879 | }, |
850 | mounted() { | 880 | mounted() { |
851 | this.token = this.$store.state.token; | 881 | this.token = this.$store.state.token; |
852 | this.getBookData(); | 882 | this.getBookData(); |
853 | } | 883 | }, |
854 | }; | 884 | }; |
855 | </script> | 885 | </script> |
856 | <style scoped> | 886 | <style scoped> |
857 | .active { | 887 | .active { |
858 | background-color: gray; | 888 | background-color: gray; |
859 | color: white !important; | 889 | color: white !important; |
860 | } | 890 | } |
861 | .activebtn { | 891 | .activebtn { |
862 | color: black !important; | 892 | color: black !important; |
863 | } | 893 | } |
864 | </style> | 894 | </style> |
src/pages/Library/member.vue
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | <v-snackbar | 3 | <v-snackbar |
4 | :timeout="timeout" | 4 | :timeout="timeout" |
5 | :top="y === 'top'" | 5 | :top="y === 'top'" |
6 | :right="x === 'right'" | 6 | :right="x === 'right'" |
7 | :vertical="mode === 'vertical'" | 7 | :vertical="mode === 'vertical'" |
8 | v-model="snackbar" | 8 | v-model="snackbar" |
9 | color="success" | 9 | color="success" |
10 | >{{ text }}</v-snackbar> | 10 | >{{ text }}</v-snackbar> |
11 | 11 | ||
12 | <!-- ****** PROFILE VIEW STUDENTS LIBRARY MEMBER DEATILS ****** --> | 12 | <!-- ****** PROFILE VIEW STUDENTS LIBRARY MEMBER DEATILS ****** --> |
13 | 13 | ||
14 | <v-dialog v-model="dialogStudents" max-width="1100px" scrollable> | 14 | <v-dialog v-model="dialogStudents" max-width="1100px" scrollable> |
15 | <v-card> | 15 | <v-card> |
16 | <v-toolbar dark class="card-styles" flat> | 16 | <v-toolbar dark class="card-styles" flat> |
17 | <v-spacer></v-spacer> | 17 | <v-spacer></v-spacer> |
18 | <v-toolbar-title>Student Profile</v-toolbar-title> | 18 | <v-toolbar-title>Student Profile</v-toolbar-title> |
19 | <v-spacer></v-spacer> | 19 | <v-spacer></v-spacer> |
20 | <v-icon @click="closeViewStudent">close</v-icon> | 20 | <v-icon @click="closeViewStudent">close</v-icon> |
21 | </v-toolbar> | 21 | </v-toolbar> |
22 | <v-card-text style="height: 700px;"> | 22 | <v-card-text style="height: 700px;"> |
23 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 23 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
24 | <v-avatar size="160px"> | 24 | <v-avatar size="160px"> |
25 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 25 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
26 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> | 26 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> |
27 | </v-avatar> | 27 | </v-avatar> |
28 | </v-flex> | 28 | </v-flex> |
29 | <v-container grid-list-md> | 29 | <v-container grid-list-md> |
30 | <v-layout wrap> | 30 | <v-layout wrap> |
31 | <v-flex xs12> | 31 | <v-flex xs12> |
32 | <v-layout wrap> | 32 | <v-layout wrap> |
33 | <v-flex xs12 sm6> | 33 | <v-flex xs12 sm6> |
34 | <v-layout> | 34 | <v-layout> |
35 | <v-flex xs6 sm5> | 35 | <v-flex xs6 sm5> |
36 | <h5 class="right my-1"> | 36 | <h5 class="right my-1"> |
37 | <b>Full Name:</b> | 37 | <b>Full Name:</b> |
38 | </h5> | 38 | </h5> |
39 | </v-flex> | 39 | </v-flex> |
40 | <v-flex sm7 xs6> | 40 | <v-flex sm7 xs6> |
41 | <h5 class="my-1 left">{{ editedItem.name }}</h5> | 41 | <h5 class="my-1 left">{{ editedItem.name }}</h5> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | </v-flex> | 44 | </v-flex> |
45 | <v-flex xs12 sm6> | 45 | <v-flex xs12 sm6> |
46 | <v-layout> | 46 | <v-layout> |
47 | <v-flex xs6 sm4> | 47 | <v-flex xs6 sm4> |
48 | <h5 class="right my-1"> | 48 | <h5 class="right my-1"> |
49 | <b>Email:</b> | 49 | <b>Email:</b> |
50 | </h5> | 50 | </h5> |
51 | </v-flex> | 51 | </v-flex> |
52 | <v-flex sm8 xs6> | 52 | <v-flex sm8 xs6> |
53 | <h5 class="my-1 left">{{ editedItem.email }}</h5> | 53 | <h5 class="my-1 left">{{ editedItem.email }}</h5> |
54 | </v-flex> | 54 | </v-flex> |
55 | </v-layout> | 55 | </v-layout> |
56 | </v-flex> | 56 | </v-flex> |
57 | </v-layout> | 57 | </v-layout> |
58 | <v-layout wrap> | 58 | <v-layout wrap> |
59 | <v-flex xs12 sm6> | 59 | <v-flex xs12 sm6> |
60 | <v-layout> | 60 | <v-layout> |
61 | <v-flex xs6 sm5> | 61 | <v-flex xs6 sm5> |
62 | <b> | 62 | <b> |
63 | <h5 class="right my-1"> | 63 | <h5 class="right my-1"> |
64 | <b>Gender:</b> | 64 | <b>Gender:</b> |
65 | </h5> | 65 | </h5> |
66 | </b> | 66 | </b> |
67 | </v-flex> | 67 | </v-flex> |
68 | <v-flex sm7 xs6> | 68 | <v-flex sm7 xs6> |
69 | <h5 class="my-1 left">{{ editedItem.gender }}</h5> | 69 | <h5 class="my-1 left">{{ editedItem.gender }}</h5> |
70 | </v-flex> | 70 | </v-flex> |
71 | </v-layout> | 71 | </v-layout> |
72 | </v-flex> | 72 | </v-flex> |
73 | <v-flex xs12 sm6> | 73 | <v-flex xs12 sm6> |
74 | <v-layout> | 74 | <v-layout> |
75 | <v-flex xs6 sm4> | 75 | <v-flex xs6 sm4> |
76 | <b> | 76 | <b> |
77 | <h5 class="right my-1"> | 77 | <h5 class="right my-1"> |
78 | <b>D.O.B:</b> | 78 | <b>D.O.B:</b> |
79 | </h5> | 79 | </h5> |
80 | </b> | 80 | </b> |
81 | </v-flex> | 81 | </v-flex> |
82 | <v-flex sm7 xs6> | 82 | <v-flex sm7 xs6> |
83 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> | 83 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> |
84 | </v-flex> | 84 | </v-flex> |
85 | </v-layout> | 85 | </v-layout> |
86 | </v-flex> | 86 | </v-flex> |
87 | </v-layout> | 87 | </v-layout> |
88 | <v-layout wrap> | 88 | <v-layout wrap> |
89 | <v-flex xs12 sm6> | 89 | <v-flex xs12 sm6> |
90 | <v-layout> | 90 | <v-layout> |
91 | <v-flex xs6 sm5> | 91 | <v-flex xs6 sm5> |
92 | <b> | 92 | <b> |
93 | <h5 class="right my-1"> | 93 | <h5 class="right my-1"> |
94 | <b>Blood Group:</b> | 94 | <b>Blood Group:</b> |
95 | </h5> | 95 | </h5> |
96 | </b> | 96 | </b> |
97 | </v-flex> | 97 | </v-flex> |
98 | <v-flex sm7 xs6> | 98 | <v-flex sm7 xs6> |
99 | <h5 class="my-1 left">{{ editedItem.bloodGroup }}</h5> | 99 | <h5 class="my-1 left">{{ editedItem.bloodGroup }}</h5> |
100 | </v-flex> | 100 | </v-flex> |
101 | </v-layout> | 101 | </v-layout> |
102 | </v-flex> | 102 | </v-flex> |
103 | <v-flex xs12 sm6> | 103 | <v-flex xs12 sm6> |
104 | <v-layout> | 104 | <v-layout> |
105 | <v-flex xs6 sm4> | 105 | <v-flex xs6 sm4> |
106 | <b> | 106 | <b> |
107 | <h5 class="right my-1"> | 107 | <h5 class="right my-1"> |
108 | <b>Allergies:</b> | 108 | <b>Allergies:</b> |
109 | </h5> | 109 | </h5> |
110 | </b> | 110 | </b> |
111 | </v-flex> | 111 | </v-flex> |
112 | <v-flex sm8 xs6> | 112 | <v-flex sm8 xs6> |
113 | <h5 class="my-1">{{ editedItem.allergies }}</h5> | 113 | <h5 class="my-1">{{ editedItem.allergies }}</h5> |
114 | </v-flex> | 114 | </v-flex> |
115 | </v-layout> | 115 | </v-layout> |
116 | </v-flex> | 116 | </v-flex> |
117 | </v-layout> | 117 | </v-layout> |
118 | <v-layout wrap> | 118 | <v-layout wrap> |
119 | <v-flex xs12 sm6> | 119 | <v-flex xs12 sm6> |
120 | <v-layout> | 120 | <v-layout> |
121 | <v-flex xs6 sm5> | 121 | <v-flex xs6 sm5> |
122 | <b> | 122 | <b> |
123 | <h5 class="right my-1"> | 123 | <h5 class="right my-1"> |
124 | <b>Height:</b> | 124 | <b>Height:</b> |
125 | </h5> | 125 | </h5> |
126 | </b> | 126 | </b> |
127 | </v-flex> | 127 | </v-flex> |
128 | <v-flex sm7 xs6> | 128 | <v-flex sm7 xs6> |
129 | <h5 class="my-1 left">{{ editedItem.height }}</h5> | 129 | <h5 class="my-1 left">{{ editedItem.height }}</h5> |
130 | </v-flex> | 130 | </v-flex> |
131 | </v-layout> | 131 | </v-layout> |
132 | </v-flex> | 132 | </v-flex> |
133 | <v-flex xs12 sm6> | 133 | <v-flex xs12 sm6> |
134 | <v-layout> | 134 | <v-layout> |
135 | <v-flex xs6 sm4> | 135 | <v-flex xs6 sm4> |
136 | <b> | 136 | <b> |
137 | <h5 class="right my-1"> | 137 | <h5 class="right my-1"> |
138 | <b>Weight:</b> | 138 | <b>Weight:</b> |
139 | </h5> | 139 | </h5> |
140 | </b> | 140 | </b> |
141 | </v-flex> | 141 | </v-flex> |
142 | <v-flex sm8 xs6> | 142 | <v-flex sm8 xs6> |
143 | <h5 class="my-1">{{ editedItem.weight }}</h5> | 143 | <h5 class="my-1">{{ editedItem.weight }}</h5> |
144 | </v-flex> | 144 | </v-flex> |
145 | </v-layout> | 145 | </v-layout> |
146 | </v-flex> | 146 | </v-flex> |
147 | </v-layout> | 147 | </v-layout> |
148 | <v-layout wrap> | 148 | <v-layout wrap> |
149 | <v-flex xs12 sm6> | 149 | <v-flex xs12 sm6> |
150 | <v-layout> | 150 | <v-layout> |
151 | <v-flex xs6 sm5> | 151 | <v-flex xs6 sm5> |
152 | <b> | 152 | <b> |
153 | <h5 class="right my-1"> | 153 | <h5 class="right my-1"> |
154 | <b>City:</b> | 154 | <b>City:</b> |
155 | </h5> | 155 | </h5> |
156 | </b> | 156 | </b> |
157 | </v-flex> | 157 | </v-flex> |
158 | <v-flex sm7 xs6> | 158 | <v-flex sm7 xs6> |
159 | <h5 class="my-1 left">{{ editedItem.city }}</h5> | 159 | <h5 class="my-1 left">{{ editedItem.city }}</h5> |
160 | </v-flex> | 160 | </v-flex> |
161 | </v-layout> | 161 | </v-layout> |
162 | </v-flex> | 162 | </v-flex> |
163 | <v-flex xs12 sm6> | 163 | <v-flex xs12 sm6> |
164 | <v-layout> | 164 | <v-layout> |
165 | <v-flex xs6 sm4> | 165 | <v-flex xs6 sm4> |
166 | <b> | 166 | <b> |
167 | <h5 class="right my-1"> | 167 | <h5 class="right my-1"> |
168 | <b>State:</b> | 168 | <b>State:</b> |
169 | </h5> | 169 | </h5> |
170 | </b> | 170 | </b> |
171 | </v-flex> | 171 | </v-flex> |
172 | <v-flex sm8 xs6> | 172 | <v-flex sm8 xs6> |
173 | <h5 class="my-1">{{ editedItem.state }}</h5> | 173 | <h5 class="my-1">{{ editedItem.state }}</h5> |
174 | </v-flex> | 174 | </v-flex> |
175 | </v-layout> | 175 | </v-layout> |
176 | </v-flex> | 176 | </v-flex> |
177 | </v-layout> | 177 | </v-layout> |
178 | <v-layout wrap> | 178 | <v-layout wrap> |
179 | <v-flex xs12 sm6> | 179 | <v-flex xs12 sm6> |
180 | <v-layout> | 180 | <v-layout> |
181 | <v-flex xs6 sm5> | 181 | <v-flex xs6 sm5> |
182 | <b> | 182 | <b> |
183 | <h5 class="right my-1"> | 183 | <h5 class="right my-1"> |
184 | <b>Pincode:</b> | 184 | <b>Pincode:</b> |
185 | </h5> | 185 | </h5> |
186 | </b> | 186 | </b> |
187 | </v-flex> | 187 | </v-flex> |
188 | <v-flex sm7 xs6> | 188 | <v-flex sm7 xs6> |
189 | <h5 class="my-1">{{ editedItem.pincode }}</h5> | 189 | <h5 class="my-1">{{ editedItem.pincode }}</h5> |
190 | </v-flex> | 190 | </v-flex> |
191 | </v-layout> | 191 | </v-layout> |
192 | </v-flex> | 192 | </v-flex> |
193 | <v-flex xs12 sm5> | 193 | <v-flex xs12 sm5> |
194 | <v-layout> | 194 | <v-layout> |
195 | <v-flex xs6 sm5> | 195 | <v-flex xs6 sm5> |
196 | <b> | 196 | <b> |
197 | <h5 class="right my-1"> | 197 | <h5 class="right my-1"> |
198 | <b>Country:</b> | 198 | <b>Country:</b> |
199 | </h5> | 199 | </h5> |
200 | </b> | 200 | </b> |
201 | </v-flex> | 201 | </v-flex> |
202 | <v-flex sm7 xs6> | 202 | <v-flex sm7 xs6> |
203 | <h5 class="my-1">{{ editedItem.country }}</h5> | 203 | <h5 class="my-1">{{ editedItem.country }}</h5> |
204 | </v-flex> | 204 | </v-flex> |
205 | </v-layout> | 205 | </v-layout> |
206 | </v-flex> | 206 | </v-flex> |
207 | </v-layout> | 207 | </v-layout> |
208 | <v-layout wrap> | 208 | <v-layout wrap> |
209 | <v-flex xs12 sm6> | 209 | <v-flex xs12 sm6> |
210 | <v-layout> | 210 | <v-layout> |
211 | <v-flex sm5 xs6> | 211 | <v-flex sm5 xs6> |
212 | <b> | 212 | <b> |
213 | <h5 class="right my-1"> | 213 | <h5 class="right my-1"> |
214 | <b>Mobile No:</b> | 214 | <b>Mobile No:</b> |
215 | </h5> | 215 | </h5> |
216 | </b> | 216 | </b> |
217 | </v-flex> | 217 | </v-flex> |
218 | <v-flex sm6 xs6> | 218 | <v-flex sm6 xs6> |
219 | <h5 class="my-1">{{ editedItem.mobile }}</h5> | 219 | <h5 class="my-1">{{ editedItem.mobile }}</h5> |
220 | </v-flex> | 220 | </v-flex> |
221 | </v-layout> | 221 | </v-layout> |
222 | </v-flex> | 222 | </v-flex> |
223 | <v-flex xs12 sm6> | 223 | <v-flex xs12 sm6> |
224 | <v-layout> | 224 | <v-layout> |
225 | <v-flex xs6 sm4> | 225 | <v-flex xs6 sm4> |
226 | <b> | 226 | <b> |
227 | <h5 class="right my-1"> | 227 | <h5 class="right my-1"> |
228 | <b>Library ID :</b> | 228 | <b>Library ID :</b> |
229 | </h5> | 229 | </h5> |
230 | </b> | 230 | </b> |
231 | </v-flex> | 231 | </v-flex> |
232 | <v-flex sm8 xs6> | 232 | <v-flex sm8 xs6> |
233 | <h5 class="my-1">{{ editedItem.libraryId }}</h5> | 233 | <h5 class="my-1">{{ editedItem.libraryId }}</h5> |
234 | </v-flex> | 234 | </v-flex> |
235 | </v-layout> | 235 | </v-layout> |
236 | </v-flex> | 236 | </v-flex> |
237 | </v-layout> | 237 | </v-layout> |
238 | <v-layout wrap> | 238 | <v-layout wrap> |
239 | <v-flex xs12 sm5> | 239 | <v-flex xs12 sm5> |
240 | <v-layout> | 240 | <v-layout> |
241 | <v-flex xs6 sm6> | 241 | <v-flex xs6 sm6> |
242 | <b> | 242 | <b> |
243 | <h5 class="right my-1"> | 243 | <h5 class="right my-1"> |
244 | <b>Library Fee:</b> | 244 | <b>Library Fee:</b> |
245 | </h5> | 245 | </h5> |
246 | </b> | 246 | </b> |
247 | </v-flex> | 247 | </v-flex> |
248 | <v-flex sm6 xs6> | 248 | <v-flex sm6 xs6> |
249 | <h5 class="my-1">{{ editedItem.libraryFee }}</h5> | 249 | <h5 class="my-1">{{ editedItem.libraryFee }}</h5> |
250 | </v-flex> | 250 | </v-flex> |
251 | </v-layout> | 251 | </v-layout> |
252 | </v-flex> | 252 | </v-flex> |
253 | <v-flex xs12 sm6> | 253 | <v-flex xs12 sm6> |
254 | <v-layout> | 254 | <v-layout> |
255 | <v-flex xs6 sm6> | 255 | <v-flex xs6 sm6> |
256 | <b> | 256 | <b> |
257 | <h5 class="my-1 right"> | 257 | <h5 class="my-1 right"> |
258 | <b>Academic Year:</b> | 258 | <b>Academic Year:</b> |
259 | </h5> | 259 | </h5> |
260 | </b> | 260 | </b> |
261 | </v-flex> | 261 | </v-flex> |
262 | <v-flex sm5 xs6> | 262 | <v-flex sm5 xs6> |
263 | <h5 class="my-1">{{ editedItem.establishmentYear }}</h5> | 263 | <h5 class="my-1">{{ editedItem.establishmentYear }}</h5> |
264 | </v-flex> | 264 | </v-flex> |
265 | </v-layout> | 265 | </v-layout> |
266 | </v-flex> | 266 | </v-flex> |
267 | </v-layout> | 267 | </v-layout> |
268 | <v-layout wrap> | 268 | <v-layout wrap> |
269 | <v-flex xs12 sm5> | 269 | <v-flex xs12 sm5> |
270 | <v-layout> | 270 | <v-layout> |
271 | <v-flex xs6 sm6> | 271 | <v-flex xs6 sm6> |
272 | <b> | 272 | <b> |
273 | <h5 class="my-1 right"> | 273 | <h5 class="my-1 right"> |
274 | <b>Medical Notes:</b> | 274 | <b>Medical Notes:</b> |
275 | </h5> | 275 | </h5> |
276 | </b> | 276 | </b> |
277 | </v-flex> | 277 | </v-flex> |
278 | <v-flex sm5 xs6> | 278 | <v-flex sm5 xs6> |
279 | <h5 class="my-1">{{ editedItem.medicalNotes }}</h5> | 279 | <h5 class="my-1">{{ editedItem.medicalNotes }}</h5> |
280 | </v-flex> | 280 | </v-flex> |
281 | </v-layout> | 281 | </v-layout> |
282 | </v-flex> | 282 | </v-flex> |
283 | <v-flex xs12 sm6> | 283 | <v-flex xs12 sm6> |
284 | <v-layout> | 284 | <v-layout> |
285 | <v-flex xs6 sm6> | 285 | <v-flex xs6 sm6> |
286 | <b> | 286 | <b> |
287 | <h5 class="right my-1"> | 287 | <h5 class="right my-1"> |
288 | <b>Roll No. :</b> | 288 | <b>Roll No. :</b> |
289 | </h5> | 289 | </h5> |
290 | </b> | 290 | </b> |
291 | </v-flex> | 291 | </v-flex> |
292 | <v-flex sm6 xs8> | 292 | <v-flex sm6 xs8> |
293 | <h5 class="my-1">{{ editedItem.rollNo }}</h5> | 293 | <h5 class="my-1">{{ editedItem.rollNo }}</h5> |
294 | </v-flex> | 294 | </v-flex> |
295 | </v-layout> | 295 | </v-layout> |
296 | </v-flex> | 296 | </v-flex> |
297 | </v-layout> | 297 | </v-layout> |
298 | <v-layout wrap> | 298 | <v-layout wrap> |
299 | <v-flex xs12 sm5> | 299 | <v-flex xs12 sm5> |
300 | <v-layout> | 300 | <v-layout> |
301 | <v-flex xs6 sm6> | 301 | <v-flex xs6 sm6> |
302 | <b> | 302 | <b> |
303 | <h5 class="my-1 right"> | 303 | <h5 class="my-1 right"> |
304 | <b>present Address:</b> | 304 | <b>present Address:</b> |
305 | </h5> | 305 | </h5> |
306 | </b> | 306 | </b> |
307 | </v-flex> | 307 | </v-flex> |
308 | <v-flex sm5 xs6> | 308 | <v-flex sm5 xs6> |
309 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> | 309 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> |
310 | </v-flex> | 310 | </v-flex> |
311 | </v-layout> | 311 | </v-layout> |
312 | </v-flex> | 312 | </v-flex> |
313 | <v-flex xs12 sm6> | 313 | <v-flex xs12 sm6> |
314 | <v-layout> | 314 | <v-layout> |
315 | <v-flex xs6 sm6> | 315 | <v-flex xs6 sm6> |
316 | <b> | 316 | <b> |
317 | <h5 class="right my-1"> | 317 | <h5 class="right my-1"> |
318 | <b>present Address:</b> | 318 | <b>present Address:</b> |
319 | </h5> | 319 | </h5> |
320 | </b> | 320 | </b> |
321 | </v-flex> | 321 | </v-flex> |
322 | <v-flex sm6 xs8> | 322 | <v-flex sm6 xs8> |
323 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> | 323 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> |
324 | </v-flex> | 324 | </v-flex> |
325 | </v-layout> | 325 | </v-layout> |
326 | </v-flex> | 326 | </v-flex> |
327 | </v-layout> | 327 | </v-layout> |
328 | </v-flex> | 328 | </v-flex> |
329 | </v-layout> | 329 | </v-layout> |
330 | </v-container> | 330 | </v-container> |
331 | </v-card-text> | 331 | </v-card-text> |
332 | </v-card> | 332 | </v-card> |
333 | </v-dialog> | 333 | </v-dialog> |
334 | 334 | ||
335 | <!-- Edit Student Library Member Dialog --> | 335 | <!-- Edit Student Library Member Dialog --> |
336 | 336 | ||
337 | <v-dialog v-model="editStudentdialog" max-width="600px" scrollable> | 337 | <v-dialog v-model="editStudentdialog" max-width="600px" scrollable> |
338 | <v-card flat> | 338 | <v-card flat> |
339 | <v-toolbar dark class="card-styles" flat> | 339 | <v-toolbar dark class="card-styles" flat> |
340 | <v-spacer></v-spacer> | 340 | <v-spacer></v-spacer> |
341 | <v-toolbar-title> | 341 | <v-toolbar-title> |
342 | <h3>Edit Student Profile</h3> | 342 | <h3>Edit Student Profile</h3> |
343 | </v-toolbar-title> | 343 | </v-toolbar-title> |
344 | <v-spacer></v-spacer> | 344 | <v-spacer></v-spacer> |
345 | </v-toolbar> | 345 | </v-toolbar> |
346 | <v-card-text style="height: 426px;"> | 346 | <v-card-text style="height: 426px;"> |
347 | <v-form ref="form"> | 347 | <v-form ref="form"> |
348 | <v-container fluid> | 348 | <v-container fluid> |
349 | <v-layout> | 349 | <v-layout> |
350 | <v-flex | 350 | <v-flex |
351 | xs12 | 351 | xs12 |
352 | class="text-xs-center text-sm-center text-md-center text-lg-center mr-4" | 352 | class="text-xs-center text-sm-center text-md-center text-lg-center mr-4" |
353 | > | 353 | > |
354 | <v-avatar size="160px"> | 354 | <v-avatar size="160px"> |
355 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl && !imageUrl" /> | 355 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl && !imageUrl" /> |
356 | <img | 356 | <img |
357 | :src="editedItem.profilePicUrl" | 357 | :src="editedItem.profilePicUrl" |
358 | v-else-if="editedItem.profilePicUrl && !imageUrl" | 358 | v-else-if="editedItem.profilePicUrl && !imageUrl" |
359 | /> | 359 | /> |
360 | <img | 360 | <img |
361 | v-if="imageUrl" | 361 | v-if="imageUrl" |
362 | :src="imageUrl" | 362 | :src="imageUrl" |
363 | height="150" | 363 | height="150" |
364 | style="border-radius:50%; width:200px" | 364 | style="border-radius:50%; width:200px" |
365 | /> | 365 | /> |
366 | </v-avatar> | 366 | </v-avatar> |
367 | </v-flex> | 367 | </v-flex> |
368 | </v-layout> | 368 | </v-layout> |
369 | <v-layout wrap> | 369 | <v-layout wrap> |
370 | <v-flex xs12 sm12 md10> | 370 | <v-flex xs12 sm12 md10> |
371 | <v-layout> | 371 | <v-layout> |
372 | <v-flex xs4 class="pt-4 subheading"> | 372 | <v-flex xs4 class="pt-4 subheading"> |
373 | <label class="right hidden-xs-only hidden-sm-only">Library ID:</label> | 373 | <label class="right hidden-xs-only hidden-sm-only">Library ID:</label> |
374 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library ID:</label> | 374 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library ID:</label> |
375 | </v-flex> | 375 | </v-flex> |
376 | <v-flex xs8 class="ml-3"> | 376 | <v-flex xs8 class="ml-3"> |
377 | <v-text-field | 377 | <v-text-field |
378 | v-model="editedItem.libraryId" | 378 | v-model="editedItem.libraryId" |
379 | placeholder="fill your Library ID" | 379 | placeholder="fill your Library ID" |
380 | ></v-text-field> | 380 | ></v-text-field> |
381 | </v-flex> | 381 | </v-flex> |
382 | </v-layout> | 382 | </v-layout> |
383 | </v-flex> | 383 | </v-flex> |
384 | <v-flex xs12 sm12 md10> | 384 | <v-flex xs12 sm12 md10> |
385 | <v-layout> | 385 | <v-layout> |
386 | <v-flex xs4 class="pt-4 subheading"> | 386 | <v-flex xs4 class="pt-4 subheading"> |
387 | <label class="right hidden-xs-only hidden-sm-only">Library Fee:</label> | 387 | <label class="right hidden-xs-only hidden-sm-only">Library Fee:</label> |
388 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library Fee:</label> | 388 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library Fee:</label> |
389 | </v-flex> | 389 | </v-flex> |
390 | <v-flex xs8 class="ml-3"> | 390 | <v-flex xs8 class="ml-3"> |
391 | <v-text-field | 391 | <v-text-field |
392 | v-model="editedItem.libraryFee" | 392 | v-model="editedItem.libraryFee" |
393 | placeholder="fill your Library Fee" | 393 | placeholder="fill your Library Fee" |
394 | ></v-text-field> | 394 | ></v-text-field> |
395 | </v-flex> | 395 | </v-flex> |
396 | </v-layout> | 396 | </v-layout> |
397 | </v-flex> | 397 | </v-flex> |
398 | </v-layout> | 398 | </v-layout> |
399 | <v-layout> | 399 | <v-layout> |
400 | <v-flex xs12 sm12> | 400 | <v-flex xs12 sm12> |
401 | <v-layout> | 401 | <v-layout class="right"> |
402 | <v-flex xs6> | 402 | <v-flex xs6> |
403 | <v-btn round dark @click.native="closeEditStudentDialog">Cancel</v-btn> | 403 | <v-btn |
404 | round | ||
405 | dark | ||
406 | class="clear-button" | ||
407 | @click.native="closeEditStudentDialog" | ||
408 | >Cancel</v-btn> | ||
404 | </v-flex> | 409 | </v-flex> |
405 | <v-flex xs6> | 410 | <v-flex xs6> |
406 | <v-btn @click="save" round dark :loading="loading" class="right">Save</v-btn> | 411 | <v-btn @click="save" round dark :loading="loading" class="add-button">Save</v-btn> |
407 | </v-flex> | 412 | </v-flex> |
408 | </v-layout> | 413 | </v-layout> |
409 | </v-flex> | 414 | </v-flex> |
410 | </v-layout> | 415 | </v-layout> |
411 | </v-container> | 416 | </v-container> |
412 | </v-form> | 417 | </v-form> |
413 | </v-card-text> | 418 | </v-card-text> |
414 | </v-card> | 419 | </v-card> |
415 | </v-dialog> | 420 | </v-dialog> |
416 | <!-- Add Student Library Member Dialog --> | 421 | <!-- Add Student Library Member Dialog --> |
417 | 422 | ||
418 | <v-dialog v-model="addLibrary" max-width="600px"> | 423 | <v-dialog v-model="addLibrary" max-width="600px" v-if="addLibrary"> |
419 | <v-toolbar dark class="card-styles" flat> | 424 | <v-card flat class="card-style pa-2" dark> |
420 | <v-spacer></v-spacer> | 425 | <v-layout> |
421 | <v-toolbar-title> | 426 | <v-flex xs12> |
422 | <h3>Library Member</h3> | 427 | <label class="title text-xs-center">Library Member</label> |
423 | </v-toolbar-title> | 428 | <v-icon size="24" class="right" @click="closeAddLibraryModel">cancel</v-icon> |
424 | <v-spacer></v-spacer> | 429 | </v-flex> |
425 | </v-toolbar> | 430 | </v-layout> |
426 | <v-card> | ||
427 | <v-card-text> | 431 | <v-card-text> |
428 | <v-layout wrap justify-center> | 432 | <v-layout wrap justify-center> |
429 | <v-flex xs12 sm12 md10> | 433 | <v-flex xs12 sm12 md10> |
430 | <v-form ref="form" v-model="valid" lazy-validation> | 434 | <v-form ref="form" v-model="valid" lazy-validation> |
431 | <v-layout> | 435 | <v-layout> |
432 | <v-flex xs4 class="pt-4 subheading"> | 436 | <v-flex xs4 class="pt-4 subheading"> |
433 | <label class="right pr-3">Library Id:</label> | 437 | <label class="right pr-3">Library Id:</label> |
434 | </v-flex> | 438 | </v-flex> |
435 | <v-flex xs8> | 439 | <v-flex xs8> |
436 | <v-text-field | 440 | <v-text-field |
437 | v-model="addBook.libraryId" | 441 | v-model="addBook.libraryId" |
438 | :rules="libraryIdRules" | 442 | :rules="libraryIdRules" |
439 | type="number" | 443 | type="number" |
440 | placeholder="fill your Library ID" | 444 | placeholder="fill your Library ID" |
441 | ></v-text-field> | 445 | ></v-text-field> |
442 | </v-flex> | 446 | </v-flex> |
443 | </v-layout> | 447 | </v-layout> |
444 | <v-layout> | 448 | <v-layout> |
445 | <v-flex xs4 class="pt-4 subheading"> | 449 | <v-flex xs4 class="pt-4 subheading"> |
446 | <label class="right pr-3">Library Fee:</label> | 450 | <label class="right pr-3">Library Fee:</label> |
447 | </v-flex> | 451 | </v-flex> |
448 | <v-flex xs8> | 452 | <v-flex xs8> |
449 | <v-text-field | 453 | <v-text-field |
450 | v-model="addBook.libraryFee" | 454 | v-model="addBook.libraryFee" |
451 | type="number" | 455 | type="number" |
452 | :rules="libraryFeeRules" | 456 | :rules="libraryFeeRules" |
453 | placeholder="fill your Library Fee" | 457 | placeholder="fill your Library Fee" |
454 | ></v-text-field> | 458 | ></v-text-field> |
455 | </v-flex> | 459 | </v-flex> |
456 | </v-layout> | 460 | </v-layout> |
457 | <v-card-actions> | 461 | <v-layout> |
458 | <v-btn round dark @click.native="addLibrary = false">Cancel</v-btn> | 462 | <v-flex xs12 sm12> |
459 | <v-spacer></v-spacer> | 463 | <v-layout class="right"> |
460 | <v-btn round dark @click="submit" :loading="loading">Add Member</v-btn> | 464 | <v-btn |
461 | </v-card-actions> | 465 | round |
466 | dark | ||
467 | class="clear-button" | ||
468 | @click.native="addLibrary = false" | ||
469 | >Cancel</v-btn> | ||
470 | <v-btn round dark :loading="loading" class="add-button" @click="submit">Add</v-btn> | ||
471 | </v-layout> | ||
472 | </v-flex> | ||
473 | </v-layout> | ||
462 | </v-form> | 474 | </v-form> |
463 | </v-flex> | 475 | </v-flex> |
464 | </v-layout> | 476 | </v-layout> |
465 | </v-card-text> | 477 | </v-card-text> |
466 | </v-card> | 478 | </v-card> |
467 | </v-dialog> | 479 | </v-dialog> |
468 | <!-- ****** EXISTING MEMBER TABLE ****** --> | 480 | <!-- ****** EXISTING MEMBER TABLE ****** --> |
469 | <v-card flat> | 481 | <v-card flat> |
470 | <!-- <h4 | 482 | <!-- <h4 |
471 | class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only" | 483 | class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only" |
472 | >Library Member</h4>--> | 484 | >Library Member</h4>--> |
473 | <v-card-actions> | 485 | <v-card-actions> |
474 | <!-- <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Library Member</h3> --> | 486 | <!-- <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Library Member</h3> --> |
475 | <v-spacer></v-spacer> | 487 | <v-spacer></v-spacer> |
476 | <v-flex xs12 sm4 md2> | 488 | <v-flex xs12 sm4 md2> |
477 | <v-select | 489 | <v-select |
478 | outline | 490 | outline |
479 | small | 491 | small |
480 | :items="addclass" | 492 | :items="addclass" |
481 | label="Select Class" | 493 | label="Select Class" |
482 | v-model="selectStudents" | 494 | v-model="selectStudents" |
483 | item-text="classNum" | 495 | item-text="classNum" |
484 | item-value="_id" | 496 | item-value="_id" |
485 | name="Select Class" | 497 | name="Select Class" |
486 | @change="getAllStudents(selectStudents)" | 498 | @change="getAllStudents(selectStudents)" |
487 | class="px-2" | 499 | class="px-2" |
488 | required | 500 | required |
489 | ></v-select> | 501 | ></v-select> |
490 | </v-flex> | 502 | </v-flex> |
491 | </v-card-actions> | 503 | </v-card-actions> |
492 | </v-card> | 504 | </v-card> |
493 | <v-card class="transparent"> | 505 | <v-card class="transparent"> |
494 | <v-data-table | 506 | <v-data-table |
495 | :headers="headers" | 507 | :headers="headers" |
496 | :items="studentData" | 508 | :items="studentData" |
497 | :pagination.sync="pagination" | 509 | :pagination.sync="pagination" |
498 | :search="search" | 510 | :search="search" |
499 | > | 511 | > |
500 | <template slot="items" slot-scope="props"> | 512 | <template slot="items" slot-scope="props"> |
501 | <tr class="tr"> | 513 | <tr class="tr"> |
502 | <td class="td td-row text-xs-center">{{ props.index + 1 }}</td> | 514 | <td class="td td-row text-xs-center">{{ props.index + 1 }}</td> |
503 | <td class="td td-row text-xs-center"> | 515 | <td class="td td-row text-xs-center"> |
504 | <v-avatar> | 516 | <v-avatar> |
505 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 517 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
506 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 518 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
507 | </v-avatar> | 519 | </v-avatar> |
508 | </td> | 520 | </td> |
509 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 521 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
510 | <td class="td td-row text-xs-center">{{ props.item.rollNo }}</td> | 522 | <td class="td td-row text-xs-center">{{ props.item.rollNo }}</td> |
511 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> | 523 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
512 | <td class="td td-row text-xs-center"> | 524 | <td class="td td-row text-xs-center"> |
513 | <v-tooltip top> | 525 | <v-tooltip top> |
514 | <img | 526 | <img |
515 | slot="activator" | 527 | slot="activator" |
516 | v-if="!props.item.libraryId" | 528 | v-if="!props.item.libraryId" |
517 | style="cursor:pointer; width:25px; height:18px; " | 529 | style="cursor:pointer; width:25px; height:18px; " |
518 | @click="addLibraryData(props.item)" | 530 | @click="addLibraryData(props.item)" |
519 | src="/static/icon/add.png" | 531 | src="/static/icon/add.png" |
520 | /> | 532 | /> |
521 | <span>Add</span> | 533 | <span>Add</span> |
522 | </v-tooltip> | 534 | </v-tooltip> |
523 | <span v-if="props.item.libraryId"> | 535 | <span v-if="props.item.libraryId"> |
524 | <v-tooltip top> | 536 | <v-tooltip top> |
525 | <img | 537 | <img |
526 | slot="activator" | 538 | slot="activator" |
527 | style="cursor:pointer; width:25px; height:18px; " | 539 | style="cursor:pointer; width:25px; height:18px; " |
528 | class="mr5" | 540 | class="mr5" |
529 | @click="profile(props.item)" | 541 | @click="profile(props.item)" |
530 | src="/static/icon/eye1.png" | 542 | src="/static/icon/eye1.png" |
531 | /> | 543 | /> |
532 | <span>View</span> | 544 | <span>View</span> |
533 | </v-tooltip> | 545 | </v-tooltip> |
534 | <v-tooltip top> | 546 | <v-tooltip top> |
535 | <img | 547 | <img |
536 | slot="activator" | 548 | slot="activator" |
537 | style="cursor:pointer; width:20px; height:18px; " | 549 | style="cursor:pointer; width:20px; height:18px; " |
538 | class="mr5" | 550 | class="mr5" |
539 | @click="editItem(props.item)" | 551 | @click="editItem(props.item)" |
540 | src="/static/icon/edit1.png" | 552 | src="/static/icon/edit1.png" |
541 | /> | 553 | /> |
542 | <span>Edit</span> | 554 | <span>Edit</span> |
543 | </v-tooltip> | 555 | </v-tooltip> |
544 | <v-tooltip top> | 556 | <v-tooltip top> |
545 | <img | 557 | <img |
546 | slot="activator" | 558 | slot="activator" |
547 | style="cursor:pointer; width:20px; height:20px; " | 559 | style="cursor:pointer; width:20px; height:20px; " |
548 | class="mr5" | 560 | class="mr5" |
549 | @click="deleteItem(props.item)" | 561 | @click="deleteItem(props.item)" |
550 | src="/static/icon/delete1.png" | 562 | src="/static/icon/delete1.png" |
551 | /> | 563 | /> |
552 | <span>Delete</span> | 564 | <span>Delete</span> |
553 | </v-tooltip> | 565 | </v-tooltip> |
554 | </span> | 566 | </span> |
555 | </td> | 567 | </td> |
556 | </tr> | 568 | </tr> |
557 | </template> | 569 | </template> |
558 | <v-alert | 570 | <v-alert |
559 | slot="no-results" | 571 | slot="no-results" |
560 | :value="true" | 572 | :value="true" |
561 | color="error" | 573 | color="error" |
562 | icon="warning" | 574 | icon="warning" |
563 | >Your search for "{{ search }}" found no results.</v-alert> | 575 | >Your search for "{{ search }}" found no results.</v-alert> |
564 | </v-data-table> | 576 | </v-data-table> |
565 | </v-card> | 577 | </v-card> |
566 | <div class="loader" v-if="showLoader"> | 578 | <div class="loader" v-if="showLoader"> |
567 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 579 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
568 | </div> | 580 | </div> |
569 | </div> | 581 | </div> |
570 | </template> | 582 | </template> |
571 | 583 | ||
572 | <script> | 584 | <script> |
573 | import http from "@/Services/http.js"; | 585 | import http from "@/Services/http.js"; |
574 | import Util from "@/util"; | 586 | import Util from "@/util"; |
575 | import moment from "moment"; | 587 | import moment from "moment"; |
576 | 588 | ||
577 | export default { | 589 | export default { |
578 | data: () => ({ | 590 | data: () => ({ |
579 | snackbar: false, | 591 | snackbar: false, |
580 | y: "top", | 592 | y: "top", |
581 | x: "right", | 593 | x: "right", |
582 | mode: "", | 594 | mode: "", |
583 | timeout: 3000, | 595 | timeout: 3000, |
584 | text: "", | 596 | text: "", |
585 | showLoader: false, | 597 | showLoader: false, |
586 | loading: false, | 598 | loading: false, |
587 | addLibrary: false, | 599 | addLibrary: false, |
588 | dialogStudents: false, | 600 | dialogStudents: false, |
589 | editStudentdialog: false, | 601 | editStudentdialog: false, |
590 | valid: true, | 602 | valid: true, |
591 | libraryIdRules: [(v) => !!v || "Library Id Fee is required"], | 603 | libraryIdRules: [(v) => !!v || "Library Id Fee is required"], |
592 | libraryFeeRules: [(v) => !!v || "Library Fee is required"], | 604 | libraryFeeRules: [(v) => !!v || "Library Fee is required"], |
593 | date: null, | 605 | date: null, |
594 | search: "", | 606 | search: "", |
595 | addclass: [], | 607 | addclass: [], |
596 | pagination: { | 608 | pagination: { |
597 | rowsPerPage: 15, | 609 | rowsPerPage: 15, |
598 | }, | 610 | }, |
599 | addBook: {}, | 611 | addBook: {}, |
600 | imageName: "", | 612 | imageName: "", |
601 | imageUrl: "", | 613 | imageUrl: "", |
602 | imageFile: "", | 614 | imageFile: "", |
603 | headers: [ | 615 | headers: [ |
604 | { | 616 | { |
605 | text: "No", | 617 | text: "No", |
606 | align: "center", | 618 | align: "center", |
607 | sortable: false, | 619 | sortable: false, |
608 | value: "index", | 620 | value: "index", |
609 | }, | 621 | }, |
610 | { | 622 | { |
611 | text: "Photo", | 623 | text: "Photo", |
612 | value: "uploadCover", | 624 | value: "uploadCover", |
613 | sortable: false, | 625 | sortable: false, |
614 | align: "center", | 626 | align: "center", |
615 | }, | 627 | }, |
616 | { text: "Name", value: "name", sortable: false, align: "center" }, | 628 | { text: "Name", value: "name", sortable: false, align: "center" }, |
617 | { text: "Roll No.", value: "rollNo", sortable: false, align: "center" }, | 629 | { text: "Roll No.", value: "rollNo", sortable: false, align: "center" }, |
618 | { text: "Email", value: "email", sortable: false, align: "center" }, | 630 | { text: "Email", value: "email", sortable: false, align: "center" }, |
619 | { text: "Action", value: "", sortable: false, align: "center" }, | 631 | { text: "Action", value: "", sortable: false, align: "center" }, |
620 | ], | 632 | ], |
621 | studentData: [], | 633 | studentData: [], |
622 | editedItem: {}, | 634 | editedItem: {}, |
623 | parentId: "", | 635 | parentId: "", |
624 | token: "", | 636 | token: "", |
625 | selectStudents: {}, | 637 | selectStudents: {}, |
626 | editedIndex: -1, | 638 | editedIndex: -1, |
627 | }), | 639 | }), |
640 | watch: { | ||
641 | addLibrary: function (val) { | ||
642 | if (!val) { | ||
643 | this.addBook = []; | ||
644 | } | ||
645 | }, | ||
646 | }, | ||
628 | methods: { | 647 | methods: { |
629 | getAllStudents() { | 648 | getAllStudents() { |
630 | this.showLoader = true; | 649 | this.showLoader = true; |
631 | http() | 650 | http() |
632 | .get("/getStudentsList", { | 651 | .get("/getStudentsList", { |
633 | params: { | 652 | params: { |
634 | classId: this.selectStudents, | 653 | classId: this.selectStudents, |
635 | schoolId: this.$store.state.schoolId, | 654 | schoolId: this.$store.state.schoolId, |
636 | }, | 655 | }, |
637 | headers: { Authorization: "Bearer " + this.token }, | 656 | headers: { Authorization: "Bearer " + this.token }, |
638 | }) | 657 | }) |
639 | .then((response) => { | 658 | .then((response) => { |
640 | this.studentData = response.data.data; | 659 | this.studentData = response.data.data; |
641 | this.showLoader = false; | 660 | this.showLoader = false; |
642 | }) | 661 | }) |
643 | .catch((error) => { | 662 | .catch((error) => { |
644 | // console.log("err====>", err); | 663 | // console.log("err====>", err); |
645 | if (error.response.status === 401) { | 664 | if (error.response.status === 401) { |
646 | this.$router.replace({ path: "/" }); | 665 | this.$router.replace({ path: "/" }); |
647 | this.$store.dispatch("setToken", null); | 666 | this.$store.dispatch("setToken", null); |
648 | this.$store.dispatch("Id", null); | 667 | this.$store.dispatch("Id", null); |
649 | this.$store.dispatch("Role", null); | 668 | this.$store.dispatch("Role", null); |
650 | } | 669 | } |
651 | }); | 670 | }); |
652 | }, | 671 | }, |
653 | addLibraryData(item) { | 672 | addLibraryData(item) { |
654 | this.addBook.studentId = item._id; | 673 | this.addBook.studentId = item._id; |
655 | this.addLibrary = true; | 674 | this.addLibrary = true; |
656 | }, | 675 | }, |
657 | editItem(item) { | 676 | editItem(item) { |
658 | this.editedIndex = this.studentData.indexOf(item); | 677 | this.editedIndex = this.studentData.indexOf(item); |
659 | this.editedItem = Object.assign({}, item); | 678 | this.editedItem = Object.assign({}, item); |
660 | this.editStudentdialog = true; | 679 | this.editStudentdialog = true; |
661 | }, | 680 | }, |
662 | dates: function (date) { | 681 | dates: function (date) { |
663 | return moment(date).format("MMMM DD, YYYY"); | 682 | return moment(date).format("MMMM DD, YYYY"); |
664 | }, | 683 | }, |
665 | profile(item) { | 684 | profile(item) { |
666 | console.log("item", item); | 685 | console.log("item", item); |
667 | this.editedIndex = this.studentData.indexOf(item); | 686 | this.editedIndex = this.studentData.indexOf(item); |
668 | this.editedItem = Object.assign({}, item); | 687 | this.editedItem = Object.assign({}, item); |
669 | this.dialogStudents = true; | 688 | this.dialogStudents = true; |
670 | }, | 689 | }, |
671 | deleteItem(item) { | 690 | deleteItem(item) { |
672 | let deleteStudentLibraryData = { | 691 | let deleteStudentLibraryData = { |
673 | studentId: item._id, | 692 | studentId: item._id, |
674 | libraryId: item.libraryId, | 693 | libraryId: item.libraryId, |
675 | }; | 694 | }; |
676 | http() | 695 | http() |
677 | .put( | 696 | .put( |
678 | "/deleteLibrary", | 697 | "/deleteLibrary", |
679 | confirm("Are you sure you want to delete this?") && | 698 | confirm("Are you sure you want to delete this?") && |
680 | deleteStudentLibraryData | 699 | deleteStudentLibraryData |
681 | ) | 700 | ) |
682 | .then((response) => { | 701 | .then((response) => { |
683 | this.snackbar = true; | 702 | this.snackbar = true; |
684 | this.text = "Delete Successfully"; | 703 | this.text = "Delete Successfully"; |
685 | this.getAllStudents(); | 704 | this.getAllStudents(); |
686 | }) | 705 | }) |
687 | .catch((error) => { | 706 | .catch((error) => { |
688 | // console.log(error); | 707 | // console.log(error); |
689 | }); | 708 | }); |
690 | }, | 709 | }, |
691 | close() { | 710 | close() { |
692 | this.dialog = false; | 711 | this.dialog = false; |
693 | }, | 712 | }, |
694 | closeEditStudentDialog() { | 713 | closeEditStudentDialog() { |
695 | this.editStudentdialog = false; | 714 | this.editStudentdialog = false; |
696 | }, | 715 | }, |
697 | closeViewStudent() { | 716 | closeViewStudent() { |
698 | this.dialogStudents = false; | 717 | this.dialogStudents = false; |
699 | }, | 718 | }, |
719 | closeAddLibraryModel() { | ||
720 | this.addLibrary = false; | ||
721 | this.addclass = []; | ||
722 | this.addBook = []; | ||
723 | }, | ||
700 | submit() { | 724 | submit() { |
701 | if (this.$refs.form.validate()) { | 725 | if (this.$refs.form.validate()) { |
702 | this.loading = true; | 726 | this.loading = true; |
703 | this.addBook.schoolId = this.$store.state.schoolId; | 727 | this.addBook.schoolId = this.$store.state.schoolId; |
704 | http() | 728 | http() |
705 | .put("/addLibrary", this.addBook) | 729 | .put("/addLibrary", this.addBook) |
706 | .then((response) => { | 730 | .then((response) => { |
707 | this.snackbar = true; | 731 | this.snackbar = true; |
708 | this.text = "New Library Member added successfully"; | 732 | this.text = "New Library Member added successfully"; |
709 | this.getAllStudents(); | 733 | this.getAllStudents(); |
710 | this.clear(); | 734 | this.clear(); |
711 | this.addLibrary = false; | 735 | this.addLibrary = false; |
712 | this.loading = false; | 736 | this.loading = false; |
713 | }) | 737 | }) |
714 | .catch((error) => { | 738 | .catch((error) => { |
715 | // console.log(error); | 739 | // console.log(error); |
716 | this.snackbar = true; | 740 | this.snackbar = true; |
717 | this.text = error.response.data.message; | 741 | this.text = error.response.data.message; |
718 | this.loading = false; | 742 | this.loading = false; |
719 | }); | 743 | }); |
720 | } | 744 | } |
721 | }, | 745 | }, |
722 | clear() { | 746 | clear() { |
723 | this.$refs.form.reset(); | 747 | this.$refs.form.reset(); |
724 | }, | 748 | }, |
725 | save() { | 749 | save() { |
726 | this.editedItem.studentId = this.editedItem._id; | 750 | this.editedItem.studentId = this.editedItem._id; |
727 | http() | 751 | http() |
728 | .put("/updateLibrary", this.editedItem) | 752 | .put("/updateLibrary", this.editedItem) |
729 | .then((response) => { | 753 | .then((response) => { |
730 | this.snackbar = true; | 754 | this.snackbar = true; |
731 | this.text = "Edit Library Member Successfully"; | 755 | this.text = "Edit Library Member Successfully"; |
732 | this.getAllStudents(); | 756 | this.getAllStudents(); |
733 | this.closeEditStudentDialog(); | 757 | this.closeEditStudentDialog(); |
734 | }) | 758 | }) |
735 | .catch((error) => { | 759 | .catch((error) => { |
736 | this.snackbar = true; | 760 | this.snackbar = true; |
737 | this.text = error.response.data.statusText; | 761 | this.text = error.response.data.statusText; |
738 | }); | 762 | }); |
739 | }, | 763 | }, |
740 | getAllClass() { | 764 | getAllClass() { |
741 | http() | 765 | http() |
742 | .get("/getClassesList", { | 766 | .get("/getClassesList", { |
743 | params: { | 767 | params: { |
744 | schoolId: this.$store.state.schoolId, | 768 | schoolId: this.$store.state.schoolId, |
745 | }, | 769 | }, |
746 | headers: { Authorization: "Bearer " + this.token }, | 770 | headers: { Authorization: "Bearer " + this.token }, |
747 | }) | 771 | }) |
748 | .then((response) => { | 772 | .then((response) => { |
749 | this.addclass = response.data.data; | 773 | this.addclass = response.data.data; |
750 | }) | 774 | }) |
751 | .catch((err) => { | 775 | .catch((err) => { |
752 | // console.log("err====>", err); | 776 | // console.log("err====>", err); |
753 | this.$router.replace({ path: "/" }); | 777 | this.$router.replace({ path: "/" }); |
754 | }); | 778 | }); |
755 | }, | 779 | }, |
756 | }, | 780 | }, |
757 | mounted() { | 781 | mounted() { |
758 | // this.getStudentList(); | 782 | // this.getStudentList(); |
759 | this.token = this.$store.state.token; | 783 | this.token = this.$store.state.token; |
760 | this.getAllClass(); | 784 | this.getAllClass(); |
761 | }, | 785 | }, |
762 | created() { | 786 | created() { |
763 | this.$root.$on("app:search", (search) => { | 787 | this.$root.$on("app:search", (search) => { |
764 | this.search = search; | 788 | this.search = search; |
765 | }); | 789 | }); |
766 | }, | 790 | }, |
767 | beforeDestroy() { | 791 | beforeDestroy() { |
768 | // dont forget to remove the listener | 792 | // dont forget to remove the listener |
769 | this.$root.$off("app:search"); | 793 | this.$root.$off("app:search"); |
770 | }, | 794 | }, |
771 | }; | 795 | }; |
772 | </script> | 796 | </script> |
773 | <style scoped> | 797 | <style scoped> |
774 | .active { | 798 | .active { |
775 | background-color: gray; | 799 | background-color: gray; |
776 | color: white !important; | 800 | color: white !important; |
777 | } | 801 | } |
778 | .activebtn { | 802 | .activebtn { |
779 | color: black !important; | 803 | color: black !important; |
780 | } | 804 | } |
src/pages/Mark/mark.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EXISTING MARK TABLE ****** --> | 3 | <!-- ****** EXISTING MARK 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="addMarkDialog = true" | 10 | @click="addMarkDialog = 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="addMarkDialog = true" | 18 | @click="addMarkDialog = true" |
19 | > | 19 | > |
20 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Mark | 20 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Mark |
21 | </v-btn> | 21 | </v-btn> |
22 | <v-layout class="hidden-sm-only hidden-xs-only"> | 22 | <v-layout class="hidden-sm-only hidden-xs-only"> |
23 | <v-flex md3 lg2 class="ml-2"> | 23 | <v-flex md3 lg2 class="ml-2"> |
24 | <v-select | 24 | <v-select |
25 | v-model="getMark.classId" | 25 | v-model="getMark.classId" |
26 | label="Select your class" | 26 | label="Select your class" |
27 | type="text" | 27 | type="text" |
28 | :items="classList" | 28 | :items="classList" |
29 | item-text="classNum" | 29 | item-text="classNum" |
30 | item-value="_id" | 30 | item-value="_id" |
31 | @change="getSections(getMark.classId)" | 31 | @change="getSections(getMark.classId)" |
32 | required | 32 | required |
33 | ></v-select> | 33 | ></v-select> |
34 | </v-flex> | 34 | </v-flex> |
35 | <v-flex md3 lg2 class="ml-2"> | 35 | <v-flex md3 lg2 class="ml-2"> |
36 | <v-select | 36 | <v-select |
37 | :items="addSection" | 37 | :items="addSection" |
38 | label="Select your Section" | 38 | label="Select your Section" |
39 | v-model="getMark.sectionId" | 39 | v-model="getMark.sectionId" |
40 | item-text="name" | 40 | item-text="name" |
41 | item-value="_id" | 41 | item-value="_id" |
42 | name="Select Section" | 42 | name="Select Section" |
43 | required | 43 | required |
44 | ></v-select> | 44 | ></v-select> |
45 | </v-flex> | 45 | </v-flex> |
46 | <v-spacer></v-spacer> | 46 | <v-spacer></v-spacer> |
47 | <v-btn | 47 | <v-btn |
48 | @click="getStudents" | 48 | @click="getStudents" |
49 | round | 49 | round |
50 | dark | 50 | dark |
51 | :loading="loading" | 51 | :loading="loading" |
52 | class="right open-dialog-button mt-2" | 52 | class="right open-dialog-button mt-2" |
53 | >Mark</v-btn> | 53 | >Mark</v-btn> |
54 | </v-layout> | 54 | </v-layout> |
55 | <v-spacer class="hidden-lg-only hidden-xl-only hidden-md-only"></v-spacer> | 55 | <v-spacer class="hidden-lg-only hidden-xl-only hidden-md-only"></v-spacer> |
56 | <v-card-title class="body-1" v-show="show"> | 56 | <v-card-title class="body-1" v-show="show"> |
57 | <v-btn icon large flat @click="displaySearch"> | 57 | <v-btn icon large flat @click="displaySearch"> |
58 | <v-avatar size="27"> | 58 | <v-avatar size="27"> |
59 | <img src="/static/icon/search.png" alt="icon" /> | 59 | <img src="/static/icon/search.png" alt="icon" /> |
60 | </v-avatar> | 60 | </v-avatar> |
61 | </v-btn> | 61 | </v-btn> |
62 | </v-card-title> | 62 | </v-card-title> |
63 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 63 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
64 | <v-layout> | 64 | <v-layout> |
65 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 65 | <v-text-field |
66 | autofocus | ||
67 | v-model="search" | ||
68 | label="Search" | ||
69 | prepend-inner-icon="search" | ||
70 | color="primary" | ||
71 | ></v-text-field> | ||
66 | <v-icon @click="closeSearch" color="error">close</v-icon> | 72 | <v-icon @click="closeSearch" color="error">close</v-icon> |
67 | </v-layout> | 73 | </v-layout> |
68 | </v-flex> | 74 | </v-flex> |
69 | </v-toolbar> | 75 | </v-toolbar> |
70 | <v-card flat class="elevation-0 transparent hidden-lg-only hidden-xl-only hidden-md-only"> | 76 | <v-card flat class="elevation-0 transparent hidden-lg-only hidden-xl-only hidden-md-only"> |
71 | <v-flex xs12 sm12 lg12> | 77 | <v-flex xs12 sm12 lg12> |
72 | <v-layout wrap> | 78 | <v-layout wrap> |
73 | <v-flex xs12 sm12 lg3> | 79 | <v-flex xs12 sm12 lg3> |
74 | <v-layout> | 80 | <v-layout> |
75 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 81 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
76 | <label class="right">Class:</label> | 82 | <label class="right">Class:</label> |
77 | </v-flex> | 83 | </v-flex> |
78 | <v-flex xs12 sm12 lg8 class="ml-2"> | 84 | <v-flex xs12 sm12 lg8 class="ml-2"> |
79 | <v-select | 85 | <v-select |
80 | v-model="getMark.classId" | 86 | v-model="getMark.classId" |
81 | label="Select your class" | 87 | label="Select your class" |
82 | type="text" | 88 | type="text" |
83 | :items="classList" | 89 | :items="classList" |
84 | item-text="classNum" | 90 | item-text="classNum" |
85 | item-value="_id" | 91 | item-value="_id" |
86 | @change="getSections(getMark.classId)" | 92 | @change="getSections(getMark.classId)" |
87 | required | 93 | required |
88 | ></v-select> | 94 | ></v-select> |
89 | </v-flex> | 95 | </v-flex> |
90 | </v-layout> | 96 | </v-layout> |
91 | </v-flex> | 97 | </v-flex> |
92 | <v-flex xs12 sm12 lg3> | 98 | <v-flex xs12 sm12 lg3> |
93 | <v-layout> | 99 | <v-layout> |
94 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 100 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
95 | <label class="right">Section:</label> | 101 | <label class="right">Section:</label> |
96 | </v-flex> | 102 | </v-flex> |
97 | <v-flex xs12 sm12 lg8 class="ml-2"> | 103 | <v-flex xs12 sm12 lg8 class="ml-2"> |
98 | <v-select | 104 | <v-select |
99 | :items="addSection" | 105 | :items="addSection" |
100 | label="Select your Section" | 106 | label="Select your Section" |
101 | v-model="getMark.sectionId" | 107 | v-model="getMark.sectionId" |
102 | item-text="name" | 108 | item-text="name" |
103 | item-value="_id" | 109 | item-value="_id" |
104 | name="Select Section" | 110 | name="Select Section" |
105 | required | 111 | required |
106 | ></v-select> | 112 | ></v-select> |
107 | </v-flex> | 113 | </v-flex> |
108 | </v-layout> | 114 | </v-layout> |
109 | </v-flex> | 115 | </v-flex> |
110 | <v-flex xs12 sm12 lg6> | 116 | <v-flex xs12 sm12 lg6> |
111 | <v-btn | 117 | <v-btn |
112 | @click="getStudents" | 118 | @click="getStudents" |
113 | round | 119 | round |
114 | dark | 120 | dark |
115 | :loading="loading" | 121 | :loading="loading" |
116 | class="right mt-3 open-dialog-button" | 122 | class="right mt-3 open-dialog-button" |
117 | >Mark</v-btn> | 123 | >Mark</v-btn> |
118 | </v-flex> | 124 | </v-flex> |
119 | </v-layout> | 125 | </v-layout> |
120 | </v-flex> | 126 | </v-flex> |
121 | </v-card> | 127 | </v-card> |
122 | <v-data-table | 128 | <v-data-table |
123 | :headers="headers" | 129 | :headers="headers" |
124 | :items="getStudentsList" | 130 | :items="getStudentsList" |
125 | :pagination.sync="pagination" | 131 | :pagination.sync="pagination" |
126 | :search="search" | 132 | :search="search" |
127 | > | 133 | > |
128 | <template slot="items" slot-scope="props"> | 134 | <template slot="items" slot-scope="props"> |
129 | <tr class="tr"> | 135 | <tr class="tr"> |
130 | <td class="td td-row">{{ props.index + 1}}</td> | 136 | <td class="td td-row">{{ props.index + 1}}</td> |
131 | <td class="td td-row text-xs-center"> | 137 | <td class="td td-row text-xs-center"> |
132 | <v-avatar size="40"> | 138 | <v-avatar size="40"> |
133 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 139 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
134 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 140 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
135 | </v-avatar> | 141 | </v-avatar> |
136 | </td> | 142 | </td> |
137 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 143 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
138 | <td class="td td-row text-xs-center">{{ props.item.rollNo }}</td> | 144 | <td class="td td-row text-xs-center">{{ props.item.rollNo }}</td> |
139 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> | 145 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
140 | <td class="td td-row text-xs-center"> | 146 | <td class="td td-row text-xs-center"> |
141 | <span> | 147 | <span> |
142 | <router-link :to="{ name:'view Mark',params: { markId:props.item._id } }"> | 148 | <router-link :to="{ name:'view Mark',params: { markId:props.item._id } }"> |
143 | <v-tooltip top> | 149 | <v-tooltip top> |
144 | <img | 150 | <img |
145 | slot="activator" | 151 | slot="activator" |
146 | style="cursor:pointer; width:25px; height:25px; " | 152 | style="cursor:pointer; width:25px; height:25px; " |
147 | src="/static/icon/view.png" | 153 | src="/static/icon/view.png" |
148 | /> | 154 | /> |
149 | <span>View</span> | 155 | <span>View</span> |
150 | </v-tooltip> | 156 | </v-tooltip> |
151 | </router-link> | 157 | </router-link> |
152 | </span> | 158 | </span> |
153 | </td> | 159 | </td> |
154 | </tr> | 160 | </tr> |
155 | </template> | 161 | </template> |
156 | <v-alert | 162 | <v-alert |
157 | slot="no-results" | 163 | slot="no-results" |
158 | :value="true" | 164 | :value="true" |
159 | color="error" | 165 | color="error" |
160 | icon="warning" | 166 | icon="warning" |
161 | >Your search for "{{ search }}" found no results.</v-alert> | 167 | >Your search for "{{ search }}" found no results.</v-alert> |
162 | </v-data-table> | 168 | </v-data-table> |
163 | <!-- ****** ADD Mark Schedule ****** --> | 169 | <!-- ****** ADD Mark Schedule ****** --> |
164 | <v-dialog v-model="addMarkDialog" max-width> | 170 | <v-dialog v-model="addMarkDialog" max-width v-if="addMarkDialog"> |
165 | <v-card flat class> | 171 | <v-card flat class> |
166 | <v-layout class="pa-3 card-style white--text"> | 172 | <v-layout class="pa-3 card-style white--text"> |
167 | <v-flex xs12> | 173 | <v-flex xs12> |
168 | <label class="title text-xs-center">Add Mark</label> | 174 | <label class="title text-xs-center">Add Mark</label> |
169 | <v-icon size="24" class="right white--text" @click="$refs.form.reset();addMarkDialog = false">cancel</v-icon> | 175 | <v-icon |
176 | size="24" | ||
177 | class="right white--text" | ||
178 | @click="$refs.form.reset();addMarkDialog = false" | ||
179 | >cancel</v-icon> | ||
170 | </v-flex> | 180 | </v-flex> |
171 | </v-layout> | 181 | </v-layout> |
172 | <v-form ref="form" v-model="valid" lazy-validation> | 182 | <v-form ref="form" v-model="valid" lazy-validation> |
173 | <v-container fluid> | 183 | <v-container fluid> |
174 | <v-flex xs12 sm12 lg12> | 184 | <v-flex xs12 sm12 lg12> |
175 | <v-layout wrap> | 185 | <v-layout wrap> |
176 | <v-flex xs12 sm12 lg10> | 186 | <v-flex xs12 sm12 lg10> |
177 | <v-layout wrap> | 187 | <v-layout wrap> |
178 | <v-flex xs12 sm12 lg3> | 188 | <v-flex xs12 sm12 lg3> |
179 | <v-flex xs3 sm2 lg2 class="subheading"> | 189 | <v-flex xs3 sm2 lg2 class="subheading"> |
180 | <label>Exam:</label> | 190 | <label>Exam:</label> |
181 | </v-flex> | 191 | </v-flex> |
182 | <v-flex xs12 sm12 lg10> | 192 | <v-flex xs12 sm12 lg10> |
183 | <v-select | 193 | <v-select |
184 | label="Select your Exam Name" | 194 | label="Select your Exam Name" |
185 | :items="examList" | 195 | :items="examList" |
186 | v-model="addMark.examId" | 196 | v-model="addMark.examId" |
187 | :rules="examRules" | 197 | :rules="examRules" |
188 | item-text="examName" | 198 | item-text="examName" |
189 | item-value="_id" | 199 | item-value="_id" |
190 | ></v-select> | 200 | ></v-select> |
191 | </v-flex> | 201 | </v-flex> |
192 | </v-flex> | 202 | </v-flex> |
193 | <v-flex xs12 sm12 lg3> | 203 | <v-flex xs12 sm12 lg3> |
194 | <v-flex xs3 sm6 lg2 class="subheading"> | 204 | <v-flex xs3 sm6 lg2 class="subheading"> |
195 | <label>Class:</label> | 205 | <label>Class:</label> |
196 | </v-flex> | 206 | </v-flex> |
197 | <v-flex xs12 sm12 lg10 class> | 207 | <v-flex xs12 sm12 lg10 class> |
198 | <v-select | 208 | <v-select |
199 | v-model="addMark.classId" | 209 | v-model="addMark.classId" |
200 | label="Select your class" | 210 | label="Select your class" |
201 | type="text" | 211 | type="text" |
202 | :items="classList" | 212 | :items="classList" |
203 | item-text="classNum" | 213 | item-text="classNum" |
204 | item-value="_id" | 214 | item-value="_id" |
205 | :rules="classRules" | 215 | :rules="classRules" |
206 | @change="getSections(addMark.classId)" | 216 | @change="getSections(addMark.classId)" |
207 | required | 217 | required |
208 | ></v-select> | 218 | ></v-select> |
209 | </v-flex> | 219 | </v-flex> |
210 | </v-flex> | 220 | </v-flex> |
211 | <v-flex xs12 sm12 lg3> | 221 | <v-flex xs12 sm12 lg3> |
212 | <v-flex xs3 sm6 lg2 class="subheading"> | 222 | <v-flex xs3 sm6 lg2 class="subheading"> |
213 | <label>Section:</label> | 223 | <label>Section:</label> |
214 | </v-flex> | 224 | </v-flex> |
215 | <v-flex xs12 sm12 lg10 class> | 225 | <v-flex xs12 sm12 lg10 class> |
216 | <v-select | 226 | <v-select |
217 | :items="addSection" | 227 | :items="addSection" |
218 | label="Select your Section" | 228 | label="Select your Section" |
219 | v-model="addMark.sectionId" | 229 | v-model="addMark.sectionId" |
220 | item-text="name" | 230 | item-text="name" |
221 | item-value="_id" | 231 | item-value="_id" |
222 | name="Select Section" | 232 | name="Select Section" |
223 | :rules="sectionRules" | 233 | :rules="sectionRules" |
224 | required | 234 | required |
225 | ></v-select> | 235 | ></v-select> |
226 | </v-flex> | 236 | </v-flex> |
227 | </v-flex> | 237 | </v-flex> |
228 | <v-flex xs12 sm12 lg3> | 238 | <v-flex xs12 sm12 lg3> |
229 | <v-flex xs3 sm6 lg2 class="subheading"> | 239 | <v-flex xs3 sm6 lg2 class="subheading"> |
230 | <label>Subject:</label> | 240 | <label>Subject:</label> |
231 | </v-flex> | 241 | </v-flex> |
232 | <v-flex xs12 sm12 lg10 class> | 242 | <v-flex xs12 sm12 lg10 class> |
233 | <v-select | 243 | <v-select |
234 | :items="subjects" | 244 | :items="subjects" |
235 | label="Select your Subject" | 245 | label="Select your Subject" |
236 | v-model="addMark.subjectId" | 246 | v-model="addMark.subjectId" |
237 | item-text="subjectName" | 247 | item-text="subjectName" |
238 | item-value="_id" | 248 | item-value="_id" |
239 | name="Select Section" | 249 | name="Select Section" |
240 | :rules="subjectRules" | 250 | :rules="subjectRules" |
241 | required | 251 | required |
242 | ></v-select> | 252 | ></v-select> |
243 | </v-flex> | 253 | </v-flex> |
244 | </v-flex> | 254 | </v-flex> |
245 | </v-layout> | 255 | </v-layout> |
246 | </v-flex> | 256 | </v-flex> |
247 | <v-flex xs12 sm12 lg2> | 257 | <v-flex xs12 sm12 lg2> |
248 | <v-flex xs12 sm12 lg12> | 258 | <v-flex xs12 sm12 lg12> |
249 | <v-btn | 259 | <v-btn |
250 | @click="findStudents" | 260 | @click="findStudents" |
251 | round | 261 | round |
252 | dark | 262 | dark |
253 | :loading="loading" | 263 | :loading="loading" |
254 | class="right mt-4 open-dialog-button" | 264 | class="right mt-4 open-dialog-button" |
255 | >Mark</v-btn> | 265 | >Mark</v-btn> |
256 | </v-flex> | 266 | </v-flex> |
257 | </v-flex> | 267 | </v-flex> |
258 | </v-layout> | 268 | </v-layout> |
259 | </v-flex> | 269 | </v-flex> |
260 | <!-- ****** ADD MARK TABLE DATA ****** --> | 270 | <!-- ****** ADD MARK TABLE DATA ****** --> |
261 | <v-card class="mt-4 elevation-0 body-color"> | 271 | <v-card class="mt-4 elevation-0 body-color"> |
262 | <v-data-table | 272 | <v-data-table |
263 | :headers="headerOfMark" | 273 | :headers="headerOfMark" |
264 | :items="getStudentData" | 274 | :items="getStudentData" |
265 | :pagination.sync="pagination" | 275 | :pagination.sync="pagination" |
266 | :search="search" | 276 | :search="search" |
267 | class="body-color" | 277 | class="body-color" |
268 | > | 278 | > |
269 | <template slot="items" slot-scope="props"> | 279 | <template slot="items" slot-scope="props"> |
270 | <tr class="tr"> | 280 | <tr class="tr"> |
271 | <td class="td td-row">{{ props.index + 1}}</td> | 281 | <td class="td td-row">{{ props.index + 1}}</td> |
272 | <td class="text-xs-center td td-row"> | 282 | <td class="text-xs-center td td-row"> |
273 | <v-avatar size="40"> | 283 | <v-avatar size="40"> |
274 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 284 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
275 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 285 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
276 | </v-avatar> | 286 | </v-avatar> |
277 | </td> | 287 | </td> |
278 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 288 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
279 | <td class="text-xs-center td td-row">{{ props.item.rollNo }}</td> | 289 | <td class="text-xs-center td td-row">{{ props.item.rollNo }}</td> |
280 | <td | 290 | <td |
281 | class="text-xs-center markTable td td-row" | 291 | class="text-xs-center markTable td td-row" |
282 | v-for="(marks, index) in props.item.marksObtained" | 292 | v-for="(marks, index) in props.item.marksObtained" |
283 | :key="'A'+ index" | 293 | :key="'A'+ index" |
284 | > | 294 | > |
285 | <v-text-field v-model="marks.marksScored"></v-text-field> | 295 | <v-text-field v-model="marks.marksScored"></v-text-field> |
286 | </td> | 296 | </td> |
287 | </tr> | 297 | </tr> |
288 | </template> | 298 | </template> |
289 | <v-alert | 299 | <v-alert |
290 | slot="no-results" | 300 | slot="no-results" |
291 | :value="true" | 301 | :value="true" |
292 | color="error" | 302 | color="error" |
293 | icon="warning" | 303 | icon="warning" |
294 | >Your search for "{{ search }}" found no results.</v-alert> | 304 | >Your search for "{{ search }}" found no results.</v-alert> |
295 | </v-data-table> | 305 | </v-data-table> |
296 | </v-card> | 306 | </v-card> |
297 | <v-layout class="mt-2"> | 307 | <v-layout class="mt-2"> |
298 | <v-flex xs12 sm12> | 308 | <v-flex xs12 sm12> |
299 | <v-layout> | 309 | <v-layout> |
300 | <v-flex xs12> | 310 | <v-flex xs12> |
301 | <v-btn | 311 | <v-btn |
302 | @click="submit" | 312 | @click="submit" |
303 | round | 313 | round |
304 | dark | 314 | dark |
305 | :loading="loading" | 315 | :loading="loading" |
306 | class="right add-button" | 316 | class="right add-button" |
307 | >Add Mark</v-btn> | 317 | >Add Mark</v-btn> |
308 | </v-flex> | 318 | </v-flex> |
309 | </v-layout> | 319 | </v-layout> |
310 | </v-flex> | 320 | </v-flex> |
311 | </v-layout> | 321 | </v-layout> |
312 | </v-container> | 322 | </v-container> |
313 | </v-form> | 323 | </v-form> |
314 | </v-card> | 324 | </v-card> |
315 | </v-dialog> | 325 | </v-dialog> |
316 | <div class="loader" v-if="showLoader"> | 326 | <div class="loader" v-if="showLoader"> |
317 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 327 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
318 | </div> | 328 | </div> |
319 | <v-snackbar | 329 | <v-snackbar |
320 | :timeout="timeout" | 330 | :timeout="timeout" |
321 | :top="y === 'top'" | 331 | :top="y === 'top'" |
322 | :right="x === 'right'" | 332 | :right="x === 'right'" |
323 | :vertical="mode === 'vertical'" | 333 | :vertical="mode === 'vertical'" |
324 | v-model="snackbar" | 334 | v-model="snackbar" |
325 | :color="color" | 335 | :color="color" |
326 | >{{ text }}</v-snackbar> | 336 | >{{ text }}</v-snackbar> |
327 | </v-container> | 337 | </v-container> |
328 | </template> | 338 | </template> |
329 | 339 | ||
330 | <script> | 340 | <script> |
331 | import http from "@/Services/http.js"; | 341 | import http from "@/Services/http.js"; |
332 | import moment from "moment"; | 342 | import moment from "moment"; |
333 | 343 | ||
334 | export default { | 344 | export default { |
335 | data: () => ({ | 345 | data: () => ({ |
336 | show: true, | 346 | show: true, |
337 | showSearch: false, | 347 | showSearch: false, |
338 | snackbar: false, | 348 | snackbar: false, |
339 | date: null, | 349 | date: null, |
340 | color: "", | 350 | color: "", |
341 | y: "top", | 351 | y: "top", |
342 | x: "right", | 352 | x: "right", |
343 | mode: "", | 353 | mode: "", |
344 | timeout: 10000, | 354 | timeout: 10000, |
345 | text: "", | 355 | text: "", |
346 | loading: false, | 356 | loading: false, |
347 | search: "", | 357 | search: "", |
348 | show: true, | 358 | show: true, |
349 | showSearch: false, | 359 | showSearch: false, |
350 | showLoader: false, | 360 | showLoader: false, |
351 | dialog: false, | 361 | dialog: false, |
352 | dialog1: false, | 362 | dialog1: false, |
353 | valid: true, | 363 | valid: true, |
354 | 364 | ||
355 | addMarkDialog: false, | 365 | addMarkDialog: false, |
356 | addSection: [], | 366 | addSection: [], |
357 | pagination: { | 367 | pagination: { |
358 | rowsPerPage: 10 | 368 | rowsPerPage: 10, |
359 | }, | 369 | }, |
360 | classRules: [v => !!v || "Class is required"], | 370 | classRules: [(v) => !!v || "Class is required"], |
361 | sectionRules: [v => !!v || "section is required"], | 371 | sectionRules: [(v) => !!v || "section is required"], |
362 | subjectRules: [v => !!v || "Subject is required"], | 372 | subjectRules: [(v) => !!v || "Subject is required"], |
363 | examRules: [v => !!v || "Exam is required"], | 373 | examRules: [(v) => !!v || "Exam is required"], |
364 | 374 | ||
365 | headerOfMark: [ | 375 | headerOfMark: [ |
366 | { | 376 | { |
367 | align: "", | 377 | align: "", |
368 | text: "No", | 378 | text: "No", |
369 | sortable: false, | 379 | sortable: false, |
370 | value: "No" | 380 | value: "No", |
371 | }, | 381 | }, |
372 | { | 382 | { |
373 | text: "Profile Pic", | 383 | text: "Profile Pic", |
374 | vaue: "profilePicUrl", | 384 | vaue: "profilePicUrl", |
375 | sortable: false, | 385 | sortable: false, |
376 | align: "center" | 386 | align: "center", |
377 | }, | 387 | }, |
378 | { | 388 | { |
379 | text: "Name", | 389 | text: "Name", |
380 | vaue: "name", | 390 | vaue: "name", |
381 | sortable: false, | 391 | sortable: false, |
382 | align: "center" | 392 | align: "center", |
383 | }, | 393 | }, |
384 | { | 394 | { |
385 | text: "Roll No.", | 395 | text: "Roll No.", |
386 | value: "rollNo", | 396 | value: "rollNo", |
387 | sortable: false, | 397 | sortable: false, |
388 | align: "center" | 398 | align: "center", |
389 | } | 399 | }, |
390 | ], | 400 | ], |
391 | headers: [ | 401 | headers: [ |
392 | { | 402 | { |
393 | align: "", | 403 | align: "", |
394 | text: "No", | 404 | text: "No", |
395 | sortable: false, | 405 | sortable: false, |
396 | value: "No" | 406 | value: "No", |
397 | }, | 407 | }, |
398 | { | 408 | { |
399 | text: "Profile Pic", | 409 | text: "Profile Pic", |
400 | vaue: "profilePicUrl", | 410 | vaue: "profilePicUrl", |
401 | sortable: false, | 411 | sortable: false, |
402 | align: "center" | 412 | align: "center", |
403 | }, | 413 | }, |
404 | { | 414 | { |
405 | text: "Name", | 415 | text: "Name", |
406 | vaue: "name", | 416 | vaue: "name", |
407 | sortable: false, | 417 | sortable: false, |
408 | align: "center" | 418 | align: "center", |
409 | }, | 419 | }, |
410 | { | 420 | { |
411 | text: "Roll No.", | 421 | text: "Roll No.", |
412 | value: "rollNo", | 422 | value: "rollNo", |
413 | sortable: false, | 423 | sortable: false, |
414 | align: "center" | 424 | align: "center", |
415 | }, | 425 | }, |
416 | { | 426 | { |
417 | text: "Email", | 427 | text: "Email", |
418 | value: "email", | 428 | value: "email", |
419 | sortable: false, | 429 | sortable: false, |
420 | align: "center" | 430 | align: "center", |
421 | }, | 431 | }, |
422 | { text: "Action", value: "", sortable: false, align: "center" } | 432 | { text: "Action", value: "", sortable: false, align: "center" }, |
423 | ], | 433 | ], |
424 | classList: [], | 434 | classList: [], |
425 | examList: [], | 435 | examList: [], |
426 | subjects: [], | 436 | subjects: [], |
427 | addMark: {}, | 437 | addMark: {}, |
428 | getMark: {}, | 438 | getMark: {}, |
429 | getScheduleData: {}, | 439 | getScheduleData: {}, |
430 | markData: [], | 440 | markData: [], |
431 | getStudentData: [], | 441 | getStudentData: [], |
432 | getStudentsList: [], | 442 | getStudentsList: [], |
433 | token: "" | 443 | token: "", |
434 | }), | 444 | }), |
445 | watch: { | ||
446 | addMarkDialog: function (val) { | ||
447 | if (!val) { | ||
448 | this.addMark = []; | ||
449 | this.getStudentData = []; | ||
450 | } | ||
451 | }, | ||
452 | }, | ||
435 | methods: { | 453 | methods: { |
436 | getClass() { | 454 | getClass() { |
437 | this.showLoader = true; | 455 | this.showLoader = true; |
438 | http() | 456 | http() |
439 | .get("/getClassesList", { | 457 | .get("/getClassesList", { |
440 | headers: { Authorization: "Bearer " + this.token } | 458 | headers: { Authorization: "Bearer " + this.token }, |
441 | }) | 459 | }) |
442 | .then(response => { | 460 | .then((response) => { |
443 | this.classList = response.data.data; | 461 | this.classList = response.data.data; |
444 | this.showLoader = false; | 462 | this.showLoader = false; |
445 | }) | 463 | }) |
446 | .catch(err => { | 464 | .catch((err) => { |
447 | // console.log("err====>", err); | 465 | // console.log("err====>", err); |
448 | this.showLoader = false; | 466 | this.showLoader = false; |
449 | }); | 467 | }); |
450 | }, | 468 | }, |
451 | getSections(_id) { | 469 | getSections(_id) { |
452 | this.showLoader = true; | 470 | this.showLoader = true; |
453 | for (let i = 0; i < this.classList.length; i++) { | 471 | for (let i = 0; i < this.classList.length; i++) { |
454 | if (_id == this.classList[i]._id) { | 472 | if (_id == this.classList[i]._id) { |
455 | this.subjects = this.classList[i].subjects; | 473 | this.subjects = this.classList[i].subjects; |
456 | } | 474 | } |
457 | } | 475 | } |
458 | http() | 476 | http() |
459 | .get( | 477 | .get( |
460 | "/getSectionsList", | 478 | "/getSectionsList", |
461 | { params: { classId: _id } }, | 479 | { params: { classId: _id } }, |
462 | { | 480 | { |
463 | headers: { Authorization: "Bearer " + this.token } | 481 | headers: { Authorization: "Bearer " + this.token }, |
464 | } | 482 | } |
465 | ) | 483 | ) |
466 | .then(response => { | 484 | .then((response) => { |
467 | this.addSection = response.data.data; | 485 | this.addSection = response.data.data; |
468 | this.showLoader = false; | 486 | this.showLoader = false; |
469 | }) | 487 | }) |
470 | .catch(err => { | 488 | .catch((err) => { |
471 | this.showLoader = false; | 489 | this.showLoader = false; |
472 | // console.log("err====>", err); | 490 | // console.log("err====>", err); |
473 | }); | 491 | }); |
474 | }, | 492 | }, |
475 | getExamList() { | 493 | getExamList() { |
476 | this.showLoader = true; | 494 | this.showLoader = true; |
477 | this.loadingSearch = true; | 495 | this.loadingSearch = true; |
478 | http() | 496 | http() |
479 | .get("/getExamsList", { | 497 | .get("/getExamsList", { |
480 | headers: { Authorization: "Bearer " + this.token } | 498 | headers: { Authorization: "Bearer " + this.token }, |
481 | }) | 499 | }) |
482 | .then(response => { | 500 | .then((response) => { |
483 | this.examList = response.data.data; | 501 | this.examList = response.data.data; |
484 | this.showLoader = false; | 502 | this.showLoader = false; |
485 | this.loadingSearch = false; | 503 | this.loadingSearch = false; |
486 | }) | 504 | }) |
487 | .catch(error => { | 505 | .catch((error) => { |
488 | // console.log("err====>", err); | 506 | // console.log("err====>", err); |
489 | this.showLoader = false; | 507 | this.showLoader = false; |
490 | this.loadingSearch = false; | 508 | this.loadingSearch = false; |
491 | this.snackbar = true; | 509 | this.snackbar = true; |
492 | this.text = error.response.data.message; | 510 | this.text = error.response.data.message; |
493 | if (error.response.status === 401) { | 511 | if (error.response.status === 401) { |
494 | this.$router.replace({ path: "/" }); | 512 | this.$router.replace({ path: "/" }); |
495 | this.$store.dispatch("setToken", null); | 513 | this.$store.dispatch("setToken", null); |
496 | this.$store.dispatch("Id", null); | 514 | this.$store.dispatch("Id", null); |
497 | this.$store.dispatch("Role", null); | 515 | this.$store.dispatch("Role", null); |
498 | } | 516 | } |
499 | }); | 517 | }); |
500 | }, | 518 | }, |
501 | findStudents() { | 519 | findStudents() { |
502 | this.getStudentData = []; | 520 | this.getStudentData = []; |
503 | if (this.$refs.form.validate()) { | 521 | if (this.$refs.form.validate()) { |
504 | this.showLoader = true; | 522 | this.showLoader = true; |
505 | http() | 523 | http() |
506 | .get("/getStudentWithClass", { | 524 | .get("/getStudentWithClass", { |
507 | params: { | 525 | params: { |
508 | classId: this.addMark.classId, | 526 | classId: this.addMark.classId, |
509 | sectionId: this.addMark.sectionId | 527 | sectionId: this.addMark.sectionId, |
510 | } | 528 | }, |
511 | }) | 529 | }) |
512 | .then(response => { | 530 | .then((response) => { |
513 | this.getStudentData = response.data.data; | 531 | this.getStudentData = response.data.data; |
514 | // this.showLoader = false; | 532 | // this.showLoader = false; |
515 | this.showLoader = true; | 533 | this.showLoader = true; |
516 | http() | 534 | http() |
517 | .get("/getMarkDistributionsList", { | 535 | .get("/getMarkDistributionsList", { |
518 | params: this.addMark | 536 | params: this.addMark, |
519 | }) | 537 | }) |
520 | .then(response => { | 538 | .then((response) => { |
521 | this.showLoader = false; | 539 | this.showLoader = false; |
522 | this.headerOfMark.length = 4; | 540 | this.headerOfMark.length = 4; |
523 | for (var i = 0; i < response.data.data.length; i++) { | 541 | for (var i = 0; i < response.data.data.length; i++) { |
524 | this.headerOfMark.push({ | 542 | this.headerOfMark.push({ |
525 | text: | 543 | text: |
526 | response.data.data[i].distributionType + | 544 | response.data.data[i].distributionType + |
527 | " (" + | 545 | " (" + |
528 | response.data.data[i].markValue + | 546 | response.data.data[i].markValue + |
529 | ")", | 547 | ")", |
530 | sortable: false, | 548 | sortable: false, |
531 | align: "center" | 549 | align: "center", |
532 | }); | 550 | }); |
533 | } | 551 | } |
534 | for (var n = 0; n < this.getStudentData.length; n++) { | 552 | for (var n = 0; n < this.getStudentData.length; n++) { |
535 | this.getStudentData[n].marksObtained = []; | 553 | this.getStudentData[n].marksObtained = []; |
536 | for (var j = 0; j < response.data.data.length; j++) { | 554 | for (var j = 0; j < response.data.data.length; j++) { |
537 | this.getStudentData[n].marksObtained.push({ | 555 | this.getStudentData[n].marksObtained.push({ |
538 | markDistributionId: response.data.data[j]._id, | 556 | markDistributionId: response.data.data[j]._id, |
539 | marksScored: 0, | 557 | marksScored: 0, |
540 | markValue: response.data.data[j].markValue, | 558 | markValue: response.data.data[j].markValue, |
541 | distributionType: response.data.data[j].distributionType | 559 | distributionType: response.data.data[j].distributionType, |
542 | }); | 560 | }); |
543 | } | 561 | } |
544 | // if (marks.marksScored > marks.marksObtained) { | 562 | // if (marks.marksScored > marks.marksObtained) { |
545 | // this.getStudentData[n].marksScored = this.getStudentData[n].marksObtained; | 563 | // this.getStudentData[n].marksScored = this.getStudentData[n].marksObtained; |
546 | // this.marks.marksScored = marks.marksObtained; | 564 | // this.marks.marksScored = marks.marksObtained; |
547 | // } | 565 | // } |
548 | } | 566 | } |
549 | }) | 567 | }) |
550 | .catch(error => { | 568 | .catch((error) => { |
551 | this.showLoader = false; | 569 | this.showLoader = false; |
552 | }); | 570 | }); |
553 | }) | 571 | }) |
554 | .catch(error => { | 572 | .catch((error) => { |
555 | this.showLoader = false; | 573 | this.showLoader = false; |
556 | }); | 574 | }); |
557 | } | 575 | } |
558 | }, | 576 | }, |
559 | async submit() { | 577 | async submit() { |
560 | for (let [j, item] of this.getStudentData.entries()) { | 578 | for (let [j, item] of this.getStudentData.entries()) { |
561 | for (var k = 0; k < item.marksObtained.length; k++) { | 579 | for (var k = 0; k < item.marksObtained.length; k++) { |
562 | if ( | 580 | if ( |
563 | item.marksObtained[k].marksScored > item.marksObtained[k].markValue | 581 | item.marksObtained[k].marksScored > item.marksObtained[k].markValue |
564 | ) { | 582 | ) { |
565 | this.snackbar = true; | 583 | this.snackbar = true; |
566 | this.text = `Student (${item.name}) marks (${item.marksObtained[k].marksScored}) in | 584 | this.text = `Student (${item.name}) marks (${item.marksObtained[k].marksScored}) in |
567 | "${item.marksObtained[k].distributionType}" should not be greater than Total Marks (${item.marksObtained[k].markValue})`; | 585 | "${item.marksObtained[k].distributionType}" should not be greater than Total Marks (${item.marksObtained[k].markValue})`; |
568 | this.color = "error"; | 586 | this.color = "error"; |
569 | return; | 587 | return; |
570 | } | 588 | } |
571 | } | 589 | } |
572 | let data = { | 590 | let data = { |
573 | examId: this.addMark.examId, | 591 | examId: this.addMark.examId, |
574 | classId: this.addMark.classId, | 592 | classId: this.addMark.classId, |
575 | sectionId: this.addMark.sectionId, | 593 | sectionId: this.addMark.sectionId, |
576 | subjectId: this.addMark.subjectId, | 594 | subjectId: this.addMark.subjectId, |
577 | studentId: item._id, | 595 | studentId: item._id, |
578 | studentsMarks: item.marksObtained | 596 | studentsMarks: item.marksObtained, |
579 | }; | 597 | }; |
580 | try { | 598 | try { |
581 | let response = await http().post("/createMark", data); | 599 | let response = await http().post("/createMark", data); |
582 | if (j + 1 === this.getStudentData.length) { | 600 | if (j + 1 === this.getStudentData.length) { |
583 | this.getStudentData = []; | 601 | this.getStudentData = []; |
584 | this.snackbar = true; | 602 | this.snackbar = true; |
585 | this.addMarkDialog = false; | 603 | this.addMarkDialog = false; |
586 | this.text = response.data.message; | 604 | this.text = response.data.message; |
587 | this.color = "green"; | 605 | this.color = "green"; |
588 | this.$refs.form.reset() | 606 | this.$refs.form.reset(); |
589 | } | 607 | } |
590 | } catch (error) { | 608 | } catch (error) { |
591 | this.snackbar = true; | 609 | this.snackbar = true; |
592 | this.text = error.response.data.message; | 610 | this.text = error.response.data.message; |
593 | this.color = "red"; | 611 | this.color = "red"; |
594 | } | 612 | } |
595 | } | 613 | } |
596 | }, | 614 | }, |
597 | getStudents() { | 615 | getStudents() { |
598 | this.showLoader = true; | 616 | this.showLoader = true; |
599 | http() | 617 | http() |
600 | .get("/getStudentWithClass", { | 618 | .get("/getStudentWithClass", { |
601 | params: { | 619 | params: { |
602 | classId: this.getMark.classId, | 620 | classId: this.getMark.classId, |
603 | sectionId: this.getMark.sectionId | 621 | sectionId: this.getMark.sectionId, |
604 | } | 622 | }, |
605 | }) | 623 | }) |
606 | .then(response => { | 624 | .then((response) => { |
607 | this.getStudentsList = response.data.data; | 625 | this.getStudentsList = response.data.data; |
608 | this.showLoader = false; | 626 | this.showLoader = false; |
609 | }) | 627 | }) |
610 | .catch(error => { | 628 | .catch((error) => { |
611 | console.log("err====>", error); | 629 | console.log("err====>", error); |
612 | this.showLoader = false; | 630 | this.showLoader = false; |
613 | }); | 631 | }); |
614 | }, | 632 | }, |
615 | displaySearch() { | 633 | displaySearch() { |
616 | (this.show = false), (this.showSearch = true); | 634 | (this.show = false), (this.showSearch = true); |
617 | }, | 635 | }, |
618 | closeSearch() { | 636 | closeSearch() { |
619 | this.showSearch = false; | 637 | this.showSearch = false; |
620 | this.show = true; | 638 | this.show = true; |
621 | this.search = ""; | 639 | this.search = ""; |
622 | } | 640 | }, |
623 | }, | 641 | }, |
624 | mounted() { | 642 | mounted() { |
625 | this.token = this.$store.state.token; | 643 | this.token = this.$store.state.token; |
626 | this.getClass(); | 644 | this.getClass(); |
627 | this.getExamList(); | 645 | this.getExamList(); |
628 | } | 646 | }, |
629 | }; | 647 | }; |
630 | </script> | 648 | </script> |
631 | <style scoped> | 649 | <style scoped> |
632 | .markTable { | 650 | .markTable { |
633 | max-width: 80px !important; | 651 | max-width: 80px !important; |
634 | } | 652 | } |
635 | </style> | 653 | </style> |
636 | 654 | ||
637 | 655 | ||
638 | 656 | ||
639 | 657 | ||
640 | 658 | ||
641 | 659 | ||
642 | 660 | ||
643 | 661 | ||
644 | 662 | ||
645 | 663 | ||
646 | 664 | ||
647 | 665 | ||
648 | 666 | ||
649 | 667 | ||
650 | 668 | ||
651 | 669 | ||
652 | 670 | ||
653 | 671 | ||
654 | 672 | ||
655 | 673 | ||
656 | 674 | ||
657 | 675 |
src/pages/News/news.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT NEWS ****** --> | 3 | <!-- ****** EDIT NEWS ****** --> |
4 | <v-dialog v-model="editNewsDialog" max-width="600px"> | 4 | <v-dialog v-model="editNewsDialog" 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 News</label> | 8 | <label class="title text-xs-center">Edit News</label> |
9 | <v-icon size="24" class="right" @click="editNewsDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editNewsDialog = 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-layout row> | 13 | <v-layout row> |
14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
15 | <input | 15 | <input |
16 | type="file" | 16 | type="file" |
17 | style="display: none" | 17 | style="display: none" |
18 | ref="image" | 18 | ref="image" |
19 | accept="image/*" | 19 | accept="image/*" |
20 | multiple | 20 | multiple |
21 | @change="onFilePicked" | 21 | @change="onFilePicked" |
22 | /> | 22 | /> |
23 | <v-layout justify-center> | 23 | <v-layout justify-center> |
24 | <v-flex | 24 | <v-flex |
25 | xs12 | 25 | xs12 |
26 | sm12 | 26 | sm12 |
27 | md3 | 27 | md3 |
28 | v-for="Image in editedItem.newsImageUrl" | 28 | v-for="Image in editedItem.newsImageUrl" |
29 | :key="Image._id" | 29 | :key="Image._id" |
30 | v-if="editedItem.newsImageUrl" | 30 | v-if="editedItem.newsImageUrl" |
31 | class="profile-image-wrapper" | 31 | class="profile-image-wrapper" |
32 | > | 32 | > |
33 | <img | 33 | <img |
34 | :src="Image.imageUrl" | 34 | :src="Image.imageUrl" |
35 | height="100" | 35 | height="100" |
36 | width="100" | 36 | width="100" |
37 | alt="News" | 37 | alt="News" |
38 | class="pa-2 imgNews" | 38 | class="pa-2 imgNews" |
39 | /> | 39 | /> |
40 | <v-icon | 40 | <v-icon |
41 | class="red edit-profile-icon" | 41 | class="red edit-profile-icon" |
42 | dark | 42 | dark |
43 | @click="deleteImage(Image._id,editedItem._id)" | 43 | @click="deleteImage(Image._id,editedItem._id)" |
44 | >close</v-icon> | 44 | >close</v-icon> |
45 | </v-flex> | 45 | </v-flex> |
46 | <v-flex v-for="(file, index) in files" :key="index"> | 46 | <v-flex v-for="(file, index) in files" :key="index"> |
47 | <img :src="file" height="100" width="100" class="pa-2" /> | 47 | <img :src="file" height="100" width="100" class="pa-2" /> |
48 | </v-flex> | 48 | </v-flex> |
49 | <img | 49 | <img |
50 | src="/static/icon/user.png" | 50 | src="/static/icon/user.png" |
51 | v-if="files == '' && editedItem.newsImageUrl == ''" | 51 | v-if="files == '' && editedItem.newsImageUrl == ''" |
52 | height="100" | 52 | height="100" |
53 | width="100" | 53 | width="100" |
54 | alt="News" | 54 | alt="News" |
55 | /> | 55 | /> |
56 | </v-layout> | 56 | </v-layout> |
57 | </v-flex> | 57 | </v-flex> |
58 | </v-layout> | 58 | </v-layout> |
59 | <!-- </v-layout> --> | 59 | <!-- </v-layout> --> |
60 | <v-layout wrap> | 60 | <v-layout wrap> |
61 | <v-flex xs12 sm12> | 61 | <v-flex xs12 sm12> |
62 | <v-layout> | 62 | <v-layout> |
63 | <v-flex xs4 class="pt-4 subheading"> | 63 | <v-flex xs4 class="pt-4 subheading"> |
64 | <label class="right">Title:</label> | 64 | <label class="right">Title:</label> |
65 | </v-flex> | 65 | </v-flex> |
66 | <v-flex sm6 xs8 class="ml-3"> | 66 | <v-flex sm6 xs8 class="ml-3"> |
67 | <v-text-field | 67 | <v-text-field |
68 | v-model="editedItem.title" | 68 | v-model="editedItem.title" |
69 | placeholder="fill your Title" | 69 | placeholder="fill your Title" |
70 | name="name" | 70 | name="name" |
71 | type="text" | 71 | type="text" |
72 | required | 72 | required |
73 | ></v-text-field> | 73 | ></v-text-field> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | </v-flex> | 76 | </v-flex> |
77 | <v-flex xs12 sm12> | 77 | <v-flex xs12 sm12> |
78 | <v-layout> | 78 | <v-layout> |
79 | <v-flex xs4 class="pt-4 subheading"> | 79 | <v-flex xs4 class="pt-4 subheading"> |
80 | <label class="right">Description:</label> | 80 | <label class="right">Description:</label> |
81 | </v-flex> | 81 | </v-flex> |
82 | <v-flex sm6 xs8 class="ml-3"> | 82 | <v-flex sm6 xs8 class="ml-3"> |
83 | <v-text-field | 83 | <v-text-field |
84 | placeholder="fill your Description" | 84 | placeholder="fill your Description" |
85 | v-model="editedItem.description" | 85 | v-model="editedItem.description" |
86 | type="text" | 86 | type="text" |
87 | name="email" | 87 | name="email" |
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-flex> | 92 | </v-flex> |
93 | <v-flex xs12> | 93 | <v-flex xs12> |
94 | <v-layout> | 94 | <v-layout> |
95 | <v-flex xs4 class="pt-4 subheading"> | 95 | <v-flex xs4 class="pt-4 subheading"> |
96 | <label class="right hidden-xs-only hidden-sm-only">Add New Images:</label> | 96 | <label class="right hidden-xs-only hidden-sm-only">Add New Images:</label> |
97 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> | 97 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> |
98 | </v-flex> | 98 | </v-flex> |
99 | <v-flex sm6 xs8 class="ml-3"> | 99 | <v-flex sm6 xs8 class="ml-3"> |
100 | <v-text-field | 100 | <v-text-field |
101 | label="Select Image" | 101 | label="Select Image" |
102 | @click="pickFile" | 102 | @click="pickFile" |
103 | v-model="imageName" | 103 | v-model="imageName" |
104 | append-icon="attach_file" | 104 | append-icon="attach_file" |
105 | multiple | 105 | multiple |
106 | ></v-text-field> | 106 | ></v-text-field> |
107 | </v-flex> | 107 | </v-flex> |
108 | </v-layout> | 108 | </v-layout> |
109 | </v-flex> | 109 | </v-flex> |
110 | </v-layout> | 110 | </v-layout> |
111 | <v-layout> | 111 | <v-layout> |
112 | <v-flex xs12 sm9 offset-sm2 class="hidden-xs-only hidden-sm-only"> | 112 | <v-flex xs12 sm9 offset-sm2 class="hidden-xs-only hidden-sm-only"> |
113 | <v-card-actions> | 113 | <v-card-actions> |
114 | <v-spacer></v-spacer> | 114 | <v-spacer></v-spacer> |
115 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 115 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
116 | </v-card-actions> | 116 | </v-card-actions> |
117 | </v-flex> | 117 | </v-flex> |
118 | <v-flex xs12 class="hidden-lg-only hidden-md-only hidden-xl-only"> | 118 | <v-flex xs12 class="hidden-lg-only hidden-md-only hidden-xl-only"> |
119 | <v-card-actions> | 119 | <v-card-actions> |
120 | <v-spacer></v-spacer> | 120 | <v-spacer></v-spacer> |
121 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 121 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
122 | <v-spacer></v-spacer> | 122 | <v-spacer></v-spacer> |
123 | </v-card-actions> | 123 | </v-card-actions> |
124 | </v-flex> | 124 | </v-flex> |
125 | </v-layout> | 125 | </v-layout> |
126 | </v-card-text> | 126 | </v-card-text> |
127 | </v-card> | 127 | </v-card> |
128 | </v-dialog> | 128 | </v-dialog> |
129 | <!-- ****** PROFILE NEWS ****** --> | 129 | <!-- ****** PROFILE NEWS ****** --> |
130 | <v-dialog v-model="dialog1" max-width="500px"> | 130 | <v-dialog v-model="dialog1" max-width="500px"> |
131 | <v-card flat class="card-style pa-3" dark> | 131 | <v-card flat class="card-style pa-3" dark> |
132 | <v-layout> | 132 | <v-layout> |
133 | <v-flex xs12> | 133 | <v-flex xs12> |
134 | <label class="title text-xs-center">View News</label> | 134 | <label class="title text-xs-center">View News</label> |
135 | <v-icon size="24" class="right" @click="dialog1 = false">cancel</v-icon> | 135 | <v-icon size="24" class="right" @click="dialog1 = false">cancel</v-icon> |
136 | </v-flex> | 136 | </v-flex> |
137 | </v-layout> | 137 | </v-layout> |
138 | <v-card-text> | 138 | <v-card-text> |
139 | <v-flex align-center justify-center layout text-xs-center> | 139 | <v-flex align-center justify-center layout text-xs-center> |
140 | <span v-for="(image,i) in editedItem.newsImageUrl" :key="i" class="pa-2"> | 140 | <span v-for="(image,i) in editedItem.newsImageUrl" :key="i" class="pa-2"> |
141 | <img :src="image.imageUrl" alt="News" width="100" height="100" class="imgNews" /> | 141 | <img :src="image.imageUrl" alt="News" width="100" height="100" class="imgNews" /> |
142 | </span> | 142 | </span> |
143 | <img | 143 | <img |
144 | src="/static/icon/user.png" | 144 | src="/static/icon/user.png" |
145 | v-if="editedItem.newsImageUrl == ''" | 145 | v-if="editedItem.newsImageUrl == ''" |
146 | height="80" | 146 | height="80" |
147 | width="80" | 147 | width="80" |
148 | alt="News" | 148 | alt="News" |
149 | /> | 149 | /> |
150 | </v-flex> | 150 | </v-flex> |
151 | <v-container grid-list-md> | 151 | <v-container grid-list-md> |
152 | <v-layout wrap> | 152 | <v-layout wrap> |
153 | <v-flex> | 153 | <v-flex> |
154 | <v-layout> | 154 | <v-layout> |
155 | <v-flex xs5 sm6> | 155 | <v-flex xs5 sm6> |
156 | <h5 class="right my-1"> | 156 | <h5 class="right my-1"> |
157 | <b>Title:</b> | 157 | <b>Title:</b> |
158 | </h5> | 158 | </h5> |
159 | </v-flex> | 159 | </v-flex> |
160 | <v-flex sm6 xs8> | 160 | <v-flex sm6 xs8> |
161 | <h5 class="my-1">{{ editedItem.title }}</h5> | 161 | <h5 class="my-1">{{ editedItem.title }}</h5> |
162 | </v-flex> | 162 | </v-flex> |
163 | </v-layout> | 163 | </v-layout> |
164 | <v-layout> | 164 | <v-layout> |
165 | <v-flex xs5 sm6> | 165 | <v-flex xs5 sm6> |
166 | <h5 class="right my-1"> | 166 | <h5 class="right my-1"> |
167 | <b>Description:</b> | 167 | <b>Description:</b> |
168 | </h5> | 168 | </h5> |
169 | </v-flex> | 169 | </v-flex> |
170 | <v-flex sm6 xs8> | 170 | <v-flex sm6 xs8> |
171 | <h5 class="my-1">{{ editedItem.description }}</h5> | 171 | <h5 class="my-1">{{ editedItem.description }}</h5> |
172 | </v-flex> | 172 | </v-flex> |
173 | </v-layout> | 173 | </v-layout> |
174 | </v-flex> | 174 | </v-flex> |
175 | </v-layout> | 175 | </v-layout> |
176 | </v-container> | 176 | </v-container> |
177 | </v-card-text> | 177 | </v-card-text> |
178 | </v-card> | 178 | </v-card> |
179 | </v-dialog> | 179 | </v-dialog> |
180 | <!-- ****** EXISTING-USERS NEWS TABLE ****** --> | 180 | <!-- ****** EXISTING-USERS NEWS TABLE ****** --> |
181 | <v-toolbar color="transparent" flat> | 181 | <v-toolbar color="transparent" flat> |
182 | <v-btn | 182 | <v-btn |
183 | fab | 183 | fab |
184 | dark | 184 | dark |
185 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 185 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
186 | small | 186 | small |
187 | @click="addNewsDialog = true" | 187 | @click="addNewsDialog = true" |
188 | > | 188 | > |
189 | <v-icon dark>add</v-icon> | 189 | <v-icon dark>add</v-icon> |
190 | </v-btn> | 190 | </v-btn> |
191 | <v-btn | 191 | <v-btn |
192 | round | 192 | round |
193 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 193 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
194 | dark | 194 | dark |
195 | @click="addNewsDialog = true" | 195 | @click="addNewsDialog = true" |
196 | > | 196 | > |
197 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add News | 197 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add News |
198 | </v-btn> | 198 | </v-btn> |
199 | <v-spacer></v-spacer> | 199 | <v-spacer></v-spacer> |
200 | <v-card-title class="body-1" v-show="show"> | 200 | <v-card-title class="body-1" v-show="show"> |
201 | <v-btn icon large flat @click="displaySearch"> | 201 | <v-btn icon large flat @click="displaySearch"> |
202 | <v-avatar size="27"> | 202 | <v-avatar size="27"> |
203 | <img src="/static/icon/search.png" alt="icon" /> | 203 | <img src="/static/icon/search.png" alt="icon" /> |
204 | </v-avatar> | 204 | </v-avatar> |
205 | </v-btn> | 205 | </v-btn> |
206 | </v-card-title> | 206 | </v-card-title> |
207 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 207 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
208 | <v-layout> | 208 | <v-layout> |
209 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 209 | <v-text-field |
210 | autofocus | ||
211 | v-model="search" | ||
212 | label="Search" | ||
213 | prepend-inner-icon="search" | ||
214 | color="primary" | ||
215 | ></v-text-field> | ||
210 | <v-icon @click="closeSearch" color="error">close</v-icon> | 216 | <v-icon @click="closeSearch" color="error">close</v-icon> |
211 | </v-layout> | 217 | </v-layout> |
212 | </v-flex> | 218 | </v-flex> |
213 | </v-toolbar> | 219 | </v-toolbar> |
214 | <v-data-table | 220 | <v-data-table |
215 | :headers="headers" | 221 | :headers="headers" |
216 | :items="desserts" | 222 | :items="desserts" |
217 | :pagination.sync="pagination" | 223 | :pagination.sync="pagination" |
218 | :search="search" | 224 | :search="search" |
219 | > | 225 | > |
220 | <template slot="items" slot-scope="props"> | 226 | <template slot="items" slot-scope="props"> |
221 | <tr class="tr"> | 227 | <tr class="tr"> |
222 | <td class="td td-row">{{ props.index + 1}}</td> | 228 | <td class="td td-row">{{ props.index + 1}}</td> |
223 | <td class="td td-row text-xs-center"> | 229 | <td class="td td-row text-xs-center"> |
224 | <span v-for="(image,_id) in props.item.newsImageUrl" class="pa-2"> | 230 | <span v-for="(image,_id) in props.item.newsImageUrl" class="pa-2"> |
225 | <img :src="image.imageUrl" alt="newsImage" width="40" height="40" /> | 231 | <img :src="image.imageUrl" alt="newsImage" width="40" height="40" /> |
226 | </span> | 232 | </span> |
227 | <img | 233 | <img |
228 | src="/static/icon/user.png" | 234 | src="/static/icon/user.png" |
229 | v-if="props.item.newsImageUrl == ''" | 235 | v-if="props.item.newsImageUrl == ''" |
230 | width="40" | 236 | width="40" |
231 | alt="News" | 237 | alt="News" |
232 | /> | 238 | /> |
233 | </td> | 239 | </td> |
234 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> | 240 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> |
235 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> | 241 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> |
236 | 242 | ||
237 | <td class="td td-row text-xs-center"> | 243 | <td class="td td-row text-xs-center"> |
238 | <span> | 244 | <span> |
239 | <v-tooltip top> | 245 | <v-tooltip top> |
240 | <img | 246 | <img |
241 | slot="activator" | 247 | slot="activator" |
242 | style="cursor:pointer; width:25px; height:25px; " | 248 | style="cursor:pointer; width:25px; height:25px; " |
243 | class="mr-3" | 249 | class="mr-3" |
244 | @click="profile(props.item)" | 250 | @click="profile(props.item)" |
245 | src="/static/icon/view.png" | 251 | src="/static/icon/view.png" |
246 | /> | 252 | /> |
247 | <span>View</span> | 253 | <span>View</span> |
248 | </v-tooltip> | 254 | </v-tooltip> |
249 | <v-tooltip top> | 255 | <v-tooltip top> |
250 | <img | 256 | <img |
251 | slot="activator" | 257 | slot="activator" |
252 | style="cursor:pointer; width:20px; height:18px; " | 258 | style="cursor:pointer; width:20px; height:18px; " |
253 | class="mr-3" | 259 | class="mr-3" |
254 | @click="editItem(props.item)" | 260 | @click="editItem(props.item)" |
255 | src="/static/icon/edit.png" | 261 | src="/static/icon/edit.png" |
256 | /> | 262 | /> |
257 | <span>Edit</span> | 263 | <span>Edit</span> |
258 | </v-tooltip> | 264 | </v-tooltip> |
259 | <v-tooltip top> | 265 | <v-tooltip top> |
260 | <img | 266 | <img |
261 | slot="activator" | 267 | slot="activator" |
262 | style="cursor:pointer; width:20px; height:20px; " | 268 | style="cursor:pointer; width:20px; height:20px; " |
263 | @click="deleteItem(props.item)" | 269 | @click="deleteItem(props.item)" |
264 | src="/static/icon/delete.png" | 270 | src="/static/icon/delete.png" |
265 | /> | 271 | /> |
266 | <span>Delete</span> | 272 | <span>Delete</span> |
267 | </v-tooltip> | 273 | </v-tooltip> |
268 | </span> | 274 | </span> |
269 | </td> | 275 | </td> |
270 | </tr> | 276 | </tr> |
271 | </template> | 277 | </template> |
272 | <v-alert | 278 | <v-alert |
273 | slot="no-results" | 279 | slot="no-results" |
274 | :value="true" | 280 | :value="true" |
275 | color="error" | 281 | color="error" |
276 | icon="warning" | 282 | icon="warning" |
277 | >Your search for "{{ search }}" found no results.</v-alert> | 283 | >Your search for "{{ search }}" found no results.</v-alert> |
278 | </v-data-table> | 284 | </v-data-table> |
279 | <!-- ****** ADD NEWS ****** --> | 285 | <!-- ****** ADD NEWS ****** --> |
280 | <v-dialog v-model="addNewsDialog" max-width="600px"> | 286 | <v-dialog v-model="addNewsDialog" max-width="600px" v-if="addNewsDialog"> |
281 | <v-card flat class="card-style pa-2" dark> | 287 | <v-card flat class="card-style pa-2" dark> |
282 | <v-layout> | 288 | <v-layout> |
283 | <v-flex xs12> | 289 | <v-flex xs12> |
284 | <label class="title text-xs-center">Add News</label> | 290 | <label class="title text-xs-center">Add News</label> |
285 | <v-icon size="24" class="right" @click="addNewsDialog = false">cancel</v-icon> | 291 | <v-icon size="24" class="right" @click="closeAddNewsModel">cancel</v-icon> |
286 | </v-flex> | 292 | </v-flex> |
287 | </v-layout> | 293 | </v-layout> |
288 | <v-form ref="form" v-model="valid" lazy-validation> | 294 | <v-form ref="form" v-model="valid" lazy-validation> |
289 | <v-container fluid> | 295 | <v-container fluid> |
290 | <v-layout> | 296 | <v-layout> |
291 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 297 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
292 | <input | 298 | <input |
293 | type="file" | 299 | type="file" |
294 | style="display: none" | 300 | style="display: none" |
295 | ref="image" | 301 | ref="image" |
296 | accept="image/*" | 302 | accept="image/*" |
297 | multiple | 303 | multiple |
298 | @change="onFilePicked" | 304 | @change="onFilePicked" |
299 | /> | 305 | /> |
300 | <v-layout justify-center> | 306 | <v-layout justify-center> |
301 | <v-flex v-for="(file,index) in files" :key="index" v-if="files"> | 307 | <v-flex v-for="(file,index) in files" :key="index" v-if="files"> |
302 | <img :src="file" height="100" width="100;" class="imgNews" /> | 308 | <img :src="file" height="100" width="100;" class="imgNews" /> |
303 | </v-flex> | 309 | </v-flex> |
304 | </v-layout> | 310 | </v-layout> |
305 | <img src="/static/icon/user.png" v-if="files ==''" height="80" width="80" /> | 311 | <img src="/static/icon/user.png" v-if="files ==''" height="80" width="80" /> |
306 | </v-flex> | 312 | </v-flex> |
307 | </v-layout> | 313 | </v-layout> |
308 | <v-flex xs12> | 314 | <v-flex xs12> |
309 | <v-layout> | 315 | <v-layout> |
310 | <v-flex xs4 sm4 class="pt-4 subheading"> | 316 | <v-flex xs4 sm4 class="pt-4 subheading"> |
311 | <label class="right">Title:</label> | 317 | <label class="right">Title:</label> |
312 | </v-flex> | 318 | </v-flex> |
313 | <v-flex sm6 xs8 class="ml-3"> | 319 | <v-flex sm6 xs8 class="ml-3"> |
314 | <v-text-field | 320 | <v-text-field |
315 | v-model="addNews.title" | 321 | v-model="addNews.title" |
316 | placeholder="fill your Title" | 322 | placeholder="fill your Title" |
317 | name="name" | 323 | name="name" |
318 | type="text" | 324 | type="text" |
319 | :rules="titleRules" | 325 | :rules="titleRules" |
320 | required | 326 | required |
321 | ></v-text-field> | 327 | ></v-text-field> |
322 | </v-flex> | 328 | </v-flex> |
323 | </v-layout> | 329 | </v-layout> |
324 | </v-flex> | 330 | </v-flex> |
325 | <v-flex xs12> | 331 | <v-flex xs12> |
326 | <v-layout> | 332 | <v-layout> |
327 | <v-flex xs4 class="pt-4 subheading"> | 333 | <v-flex xs4 class="pt-4 subheading"> |
328 | <label class="right">Description:</label> | 334 | <label class="right">Description:</label> |
329 | </v-flex> | 335 | </v-flex> |
330 | <v-flex sm6 xs8 class="ml-3"> | 336 | <v-flex sm6 xs8 class="ml-3"> |
331 | <v-text-field | 337 | <v-text-field |
332 | placeholder="fill your Description" | 338 | placeholder="fill your Description" |
333 | :rules="descriptionRules" | 339 | :rules="descriptionRules" |
334 | v-model="addNews.description" | 340 | v-model="addNews.description" |
335 | type="text" | 341 | type="text" |
336 | name="email" | 342 | name="email" |
337 | required | 343 | required |
338 | ></v-text-field> | 344 | ></v-text-field> |
339 | </v-flex> | 345 | </v-flex> |
340 | </v-layout> | 346 | </v-layout> |
341 | </v-flex> | 347 | </v-flex> |
342 | <v-flex xs12> | 348 | <v-flex xs12> |
343 | <v-layout> | 349 | <v-layout> |
344 | <v-flex xs4 class="pt-4 subheading"> | 350 | <v-flex xs4 class="pt-4 subheading"> |
345 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 351 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
346 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> | 352 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> |
347 | </v-flex> | 353 | </v-flex> |
348 | <v-flex xs8 sm6 class="ml-3"> | 354 | <v-flex xs8 sm6 class="ml-3"> |
349 | <v-text-field | 355 | <v-text-field |
350 | label="Select Image" | 356 | label="Select Image" |
351 | @click="pickFile" | 357 | @click="pickFile" |
352 | v-model="imageName" | 358 | v-model="imageName" |
353 | append-icon="attach_file" | 359 | append-icon="attach_file" |
354 | multiple | 360 | multiple |
355 | ></v-text-field> | 361 | ></v-text-field> |
356 | </v-flex> | 362 | </v-flex> |
357 | </v-layout> | 363 | </v-layout> |
358 | </v-flex> | 364 | </v-flex> |
359 | <v-layout> | 365 | <v-layout> |
360 | <v-flex xs11> | 366 | <v-flex xs11> |
361 | <v-layout> | 367 | <v-layout> |
362 | <v-spacer></v-spacer> | 368 | <v-spacer></v-spacer> |
363 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 369 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
364 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 370 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
365 | </v-layout> | 371 | </v-layout> |
366 | </v-flex> | 372 | </v-flex> |
367 | </v-layout> | 373 | </v-layout> |
368 | </v-container> | 374 | </v-container> |
369 | </v-form> | 375 | </v-form> |
370 | </v-card> | 376 | </v-card> |
371 | </v-dialog> | 377 | </v-dialog> |
372 | <div class="loader" v-if="showLoader"> | 378 | <div class="loader" v-if="showLoader"> |
373 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 379 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
374 | </div> | 380 | </div> |
375 | </v-container> | 381 | </v-container> |
376 | </template> | 382 | </template> |
377 | 383 | ||
378 | <script> | 384 | <script> |
379 | import http from "@/Services/http.js"; | 385 | import http from "@/Services/http.js"; |
380 | 386 | ||
381 | export default { | 387 | export default { |
382 | data: () => ({ | 388 | data: () => ({ |
383 | snackbar: false, | 389 | snackbar: false, |
384 | y: "top", | 390 | y: "top", |
385 | x: "right", | 391 | x: "right", |
386 | mode: "", | 392 | mode: "", |
387 | timeout: 5000, | 393 | timeout: 5000, |
388 | color: "", | 394 | color: "", |
389 | text: "", | 395 | text: "", |
390 | loading: false, | 396 | loading: false, |
391 | date: null, | 397 | date: null, |
392 | search: "", | 398 | search: "", |
393 | show: true, | 399 | show: true, |
394 | showSearch: false, | 400 | showSearch: false, |
395 | showLoader: false, | 401 | showLoader: false, |
396 | editNewsDialog: false, | 402 | editNewsDialog: false, |
397 | addNewsDialog: false, | 403 | addNewsDialog: false, |
398 | dialog1: false, | 404 | dialog1: false, |
399 | valid: true, | 405 | valid: true, |
400 | addclass: [], | 406 | addclass: [], |
401 | addSection: [], | 407 | addSection: [], |
402 | pagination: { | 408 | pagination: { |
403 | rowsPerPage: 10 | 409 | rowsPerPage: 10, |
404 | }, | 410 | }, |
405 | imageName: "", | 411 | imageName: "", |
406 | imageUrl: "", | 412 | imageUrl: "", |
407 | imageFile: "", | 413 | imageFile: "", |
408 | image: [], | 414 | image: [], |
409 | upload: "", | 415 | upload: "", |
410 | files: [], | 416 | files: [], |
411 | titleRules: [v => !!v || " Tilte is required"], | 417 | titleRules: [(v) => !!v || " Tilte is required"], |
412 | descriptionRules: [v => !!v || " Description is required"], | 418 | descriptionRules: [(v) => !!v || " Description is required"], |
413 | headers: [ | 419 | headers: [ |
414 | { | 420 | { |
415 | align: "justify-center", | 421 | align: "justify-center", |
416 | text: "No", | 422 | text: "No", |
417 | sortable: false, | 423 | sortable: false, |
418 | value: "No" | 424 | value: "No", |
419 | }, | 425 | }, |
420 | { text: "Image", vaue: "image", sortable: false, align: "center" }, | 426 | { text: "Image", vaue: "image", sortable: false, align: "center" }, |
421 | { text: "Title", value: "title", sortable: false, align: "center" }, | 427 | { text: "Title", value: "title", sortable: false, align: "center" }, |
422 | { | 428 | { |
423 | text: "Description", | 429 | text: "Description", |
424 | value: "description", | 430 | value: "description", |
425 | sortable: false, | 431 | sortable: false, |
426 | align: "center" | 432 | align: "center", |
427 | }, | 433 | }, |
428 | { text: "Action", value: "", sortable: false, align: "center" } | 434 | { text: "Action", value: "", sortable: false, align: "center" }, |
429 | ], | 435 | ], |
430 | desserts: [], | 436 | desserts: [], |
431 | editedIndex: -1, | 437 | editedIndex: -1, |
432 | addNews: { | 438 | addNews: { |
433 | title: "", | 439 | title: "", |
434 | description: "" | 440 | description: "", |
435 | }, | 441 | }, |
436 | editedItem: { | 442 | editedItem: { |
437 | title: "", | 443 | title: "", |
438 | description: "" | 444 | description: "", |
439 | }, | 445 | }, |
440 | defaultItem: { | 446 | defaultItem: { |
441 | title: "", | 447 | title: "", |
442 | description: "" | 448 | description: "", |
443 | } | 449 | }, |
444 | }), | 450 | }), |
451 | watch: { | ||
452 | addNewsDialog: function (val) { | ||
453 | if (!val) { | ||
454 | this.addNews = []; | ||
455 | this.imageName = ""; | ||
456 | this.imageFile = ""; | ||
457 | this.imageUrl = ""; | ||
458 | this.files = []; | ||
459 | } | ||
460 | }, | ||
461 | }, | ||
445 | methods: { | 462 | methods: { |
446 | getSections(_id) { | 463 | getSections(_id) { |
447 | var token = this.$store.state.token; | 464 | var token = this.$store.state.token; |
448 | http() | 465 | http() |
449 | .get( | 466 | .get( |
450 | "/getSectionsList", | 467 | "/getSectionsList", |
451 | { params: { classId: _id } }, | 468 | { params: { classId: _id } }, |
452 | { | 469 | { |
453 | headers: { Authorization: "Bearer " + token } | 470 | headers: { Authorization: "Bearer " + token }, |
454 | } | 471 | } |
455 | ) | 472 | ) |
456 | .then(response => { | 473 | .then((response) => { |
457 | this.addSection = response.data.data; | 474 | this.addSection = response.data.data; |
458 | }) | 475 | }) |
459 | .catch(err => { | 476 | .catch((err) => { |
460 | console.log("err====>", err); | 477 | console.log("err====>", err); |
461 | }); | 478 | }); |
462 | }, | 479 | }, |
463 | pickFile() { | 480 | pickFile() { |
464 | this.$refs.image.click(); | 481 | this.$refs.image.click(); |
465 | }, | 482 | }, |
466 | onFilePicked(e) { | 483 | onFilePicked(e) { |
467 | // console.log(e) | 484 | // console.log(e) |
468 | const files = e.target.files; | 485 | const files = e.target.files; |
469 | /** fetch Image Name **/ | 486 | /** fetch Image Name **/ |
470 | if (files[0] !== undefined) { | 487 | if (files[0] !== undefined) { |
471 | this.imageName = files[0].name; | 488 | this.imageName = files[0].name; |
472 | if (this.imageName.lastIndexOf(".") <= 0) { | 489 | if (this.imageName.lastIndexOf(".") <= 0) { |
473 | return; | 490 | return; |
474 | } | 491 | } |
475 | this.files = []; | 492 | this.files = []; |
476 | // console.log("files", this.files); | 493 | // console.log("files", this.files); |
477 | /** Select many image and showing many image add to news card **/ | 494 | /** Select many image and showing many image add to news card **/ |
478 | const test = Array.from(files).forEach((file, idx) => { | 495 | const test = Array.from(files).forEach((file, idx) => { |
479 | const fr = new FileReader(); | 496 | const fr = new FileReader(); |
480 | const getResult = new Promise(resolve => { | 497 | const getResult = new Promise((resolve) => { |
481 | fr.onload = e => { | 498 | fr.onload = (e) => { |
482 | this.files.push( | 499 | this.files.push( |
483 | // id: idx, | 500 | // id: idx, |
484 | e.target.result | 501 | e.target.result |
485 | ); | 502 | ); |
486 | }; | 503 | }; |
487 | }); | 504 | }); |
488 | fr.readAsDataURL(file); | 505 | fr.readAsDataURL(file); |
489 | return getResult.then(file => { | 506 | return getResult.then((file) => { |
490 | return file; | 507 | return file; |
491 | }); | 508 | }); |
492 | }); | 509 | }); |
493 | const fr = new FileReader(); | 510 | const fr = new FileReader(); |
494 | fr.readAsDataURL(files[0]); | 511 | fr.readAsDataURL(files[0]); |
495 | fr.addEventListener("load", () => { | 512 | fr.addEventListener("load", () => { |
496 | this.imageFile = files; // this is an image file that can be sent to server... | 513 | this.imageFile = files; // this is an image file that can be sent to server... |
497 | // console.log("uploadImage=======>", this.imageFile ); | 514 | // console.log("uploadImage=======>", this.imageFile ); |
498 | }); | 515 | }); |
499 | } else { | 516 | } else { |
500 | this.imageName = ""; | 517 | this.imageName = ""; |
501 | this.imageFile = ""; | 518 | this.imageFile = ""; |
502 | this.imageUrl = ""; | 519 | this.imageUrl = ""; |
503 | } | 520 | } |
504 | }, | 521 | }, |
505 | getNewsList() { | 522 | getNewsList() { |
506 | this.showLoader = true; | 523 | this.showLoader = true; |
507 | var token = this.$store.state.token; | 524 | var token = this.$store.state.token; |
508 | http() | 525 | http() |
509 | .get("/getNewsList", { | 526 | .get("/getNewsList", { |
510 | headers: { Authorization: "Bearer " + token } | 527 | headers: { Authorization: "Bearer " + token }, |
511 | }) | 528 | }) |
512 | .then(response => { | 529 | .then((response) => { |
513 | this.desserts = response.data.data; | 530 | this.desserts = response.data.data; |
514 | this.showLoader = false; | 531 | this.showLoader = false; |
515 | }) | 532 | }) |
516 | .catch(error => { | 533 | .catch((error) => { |
517 | this.showLoader = false; | 534 | this.showLoader = false; |
518 | if (error.response.status === 401) { | 535 | if (error.response.status === 401) { |
519 | this.$router.replace({ path: "/" }); | 536 | this.$router.replace({ path: "/" }); |
520 | this.$store.dispatch("setToken", null); | 537 | this.$store.dispatch("setToken", null); |
521 | this.$store.dispatch("Id", null); | 538 | this.$store.dispatch("Id", null); |
522 | } | 539 | } |
523 | }); | 540 | }); |
524 | }, | 541 | }, |
525 | editItem(item) { | 542 | editItem(item) { |
526 | this.files = []; | 543 | this.files = []; |
527 | this.editedIndex = this.desserts.indexOf(item); | 544 | this.editedIndex = this.desserts.indexOf(item); |
528 | this.editedItem = Object.assign({}, item); | 545 | this.editedItem = Object.assign({}, item); |
529 | this.editNewsDialog = true; | 546 | this.editNewsDialog = true; |
530 | }, | 547 | }, |
531 | profile(item) { | 548 | profile(item) { |
532 | this.editedIndex = this.desserts.indexOf(item); | 549 | this.editedIndex = this.desserts.indexOf(item); |
533 | this.editedItem = Object.assign({}, item); | 550 | this.editedItem = Object.assign({}, item); |
534 | this.dialog1 = true; | 551 | this.dialog1 = true; |
535 | }, | 552 | }, |
536 | deleteItem(item) { | 553 | deleteItem(item) { |
537 | let deleteNews = { | 554 | let deleteNews = { |
538 | newsId: item._id | 555 | newsId: item._id, |
539 | }; | 556 | }; |
540 | http() | 557 | http() |
541 | .delete( | 558 | .delete( |
542 | "/deleteNews", | 559 | "/deleteNews", |
543 | confirm("Are you sure you want to delete this?") && { | 560 | confirm("Are you sure you want to delete this?") && { |
544 | params: deleteNews | 561 | params: deleteNews, |
545 | } | 562 | } |
546 | ) | 563 | ) |
547 | .then(response => { | 564 | .then((response) => { |
548 | this.snackbar = true; | 565 | this.snackbar = true; |
549 | this.text = response.data.message; | 566 | this.text = response.data.message; |
550 | this.color = "green"; | 567 | this.color = "green"; |
551 | this.getNewsList(); | 568 | this.getNewsList(); |
552 | }) | 569 | }) |
553 | .catch(error => { | 570 | .catch((error) => { |
554 | this.snackbar = true; | 571 | this.snackbar = true; |
555 | this.color = "error"; | 572 | this.color = "error"; |
556 | this.text = error.response.data.message; | 573 | this.text = error.response.data.message; |
557 | }); | 574 | }); |
558 | }, | 575 | }, |
559 | deleteImage(imageId, newsId) { | 576 | deleteImage(imageId, newsId) { |
560 | let deleteImages = { | 577 | let deleteImages = { |
561 | newsId: newsId, | 578 | newsId: newsId, |
562 | imageId: imageId | 579 | imageId: imageId, |
563 | }; | 580 | }; |
564 | http() | 581 | http() |
565 | .put("/deleteImages", deleteImages) | 582 | .put("/deleteImages", deleteImages) |
566 | .then(response => { | 583 | .then((response) => { |
567 | this.snackbar = true; | 584 | this.snackbar = true; |
568 | this.text = response.data.message; | 585 | this.text = response.data.message; |
569 | this.color = "green"; | 586 | this.color = "green"; |
570 | this.close(); | 587 | this.close(); |
571 | }) | 588 | }) |
572 | .catch(error => { | 589 | .catch((error) => { |
573 | this.snackbar = true; | 590 | this.snackbar = true; |
574 | this.color = "error"; | 591 | this.color = "error"; |
575 | this.text = error.response.data.message; | 592 | this.text = error.response.data.message; |
576 | }); | 593 | }); |
577 | }, | 594 | }, |
578 | close() { | 595 | close() { |
579 | this.dialog = false; | 596 | this.dialog = false; |
580 | }, | 597 | }, |
581 | close1() { | 598 | close1() { |
582 | this.dialog1 = false; | 599 | this.dialog1 = false; |
583 | }, | 600 | }, |
601 | closeAddNewsModel() { | ||
602 | this.addNewsDialog = false; | ||
603 | this.addNews = []; | ||
604 | this.imageName = ""; | ||
605 | this.imageFile = ""; | ||
606 | this.imageUrl = ""; | ||
607 | this.files = []; | ||
608 | }, | ||
584 | submit() { | 609 | submit() { |
585 | if (this.$refs.form.validate()) { | 610 | if (this.$refs.form.validate()) { |
586 | let newsData = { | 611 | let newsData = { |
587 | title: this.addNews.title, | 612 | title: this.addNews.title, |
588 | description: this.addNews.description | 613 | description: this.addNews.description, |
589 | }; | 614 | }; |
590 | if (this.files) { | 615 | if (this.files) { |
591 | var ary = []; | 616 | var ary = []; |
592 | var imageData = []; | 617 | var imageData = []; |
593 | ary = this.files; | 618 | ary = this.files; |
594 | for (let i = 0; i < ary.length; i++) { | 619 | for (let i = 0; i < ary.length; i++) { |
595 | const [baseUrl, imageUrl] = ary[i].split(/,/); | 620 | const [baseUrl, imageUrl] = ary[i].split(/,/); |
596 | imageData.push(imageUrl); | 621 | imageData.push(imageUrl); |
597 | newsData.upload = imageData; | 622 | newsData.upload = imageData; |
598 | } | 623 | } |
599 | } | 624 | } |
600 | this.loading = true; | 625 | this.loading = true; |
601 | http() | 626 | http() |
602 | .post("/createNews", newsData) | 627 | .post("/createNews", newsData) |
603 | .then(response => { | 628 | .then((response) => { |
604 | this.files = []; | 629 | this.files = []; |
605 | this.snackbar = true; | 630 | this.snackbar = true; |
606 | this.text = response.data.message; | 631 | this.text = response.data.message; |
607 | this.getNewsList(); | 632 | this.getNewsList(); |
608 | this.color = "green"; | 633 | this.color = "green"; |
609 | this.addNewsDialog = false; | 634 | this.addNewsDialog = false; |
610 | this.loading = false; | 635 | this.loading = false; |
611 | this.clear(); | 636 | this.clear(); |
612 | }) | 637 | }) |
613 | .catch(error => { | 638 | .catch((error) => { |
614 | this.snackbar = true; | 639 | this.snackbar = true; |
615 | this.text = error.response.data.message; | 640 | this.text = error.response.data.message; |
616 | this.color = "error"; | 641 | this.color = "error"; |
617 | }); | 642 | }); |
618 | } | 643 | } |
619 | }, | 644 | }, |
620 | clear() { | 645 | clear() { |
621 | this.$refs.form.reset(); | 646 | this.$refs.form.reset(); |
622 | this.files = []; | 647 | this.files = []; |
623 | }, | 648 | }, |
624 | save() { | 649 | save() { |
625 | let editNews = { | 650 | let editNews = { |
626 | title: this.editedItem.title, | 651 | title: this.editedItem.title, |
627 | description: this.editedItem.description, | 652 | description: this.editedItem.description, |
628 | newsId: this.editedItem._id | 653 | newsId: this.editedItem._id, |
629 | }; | 654 | }; |
630 | if (this.files) { | 655 | if (this.files) { |
631 | var ary = []; | 656 | var ary = []; |
632 | var imageData = []; | 657 | var imageData = []; |
633 | ary = this.files; | 658 | ary = this.files; |
634 | for (let i = 0; i < ary.length; i++) { | 659 | for (let i = 0; i < ary.length; i++) { |
635 | const [baseUrl, imageUrl] = ary[i].split(/,/); | 660 | const [baseUrl, imageUrl] = ary[i].split(/,/); |
636 | imageData.push(imageUrl); | 661 | imageData.push(imageUrl); |
637 | editNews.upload = imageData; | 662 | editNews.upload = imageData; |
638 | } | 663 | } |
639 | } | 664 | } |
640 | http() | 665 | http() |
641 | .put("/updateNews", editNews) | 666 | .put("/updateNews", editNews) |
642 | .then(response => { | 667 | .then((response) => { |
643 | this.snackbar = true; | 668 | this.snackbar = true; |
644 | this.text = "Successfully updated News"; | 669 | this.text = "Successfully updated News"; |
645 | this.color = "green"; | 670 | this.color = "green"; |
646 | this.editNewsDialog = false; | 671 | this.editNewsDialog = false; |
647 | this.getNewsList(); | 672 | this.getNewsList(); |
648 | this.close(); | 673 | this.close(); |
649 | }) | 674 | }) |
650 | .catch(error => { | 675 | .catch((error) => { |
651 | this.snackbar = true; | 676 | this.snackbar = true; |
652 | this.color = "error"; | 677 | this.color = "error"; |
653 | this.text = error.response.data.message; | 678 | this.text = error.response.data.message; |
654 | }); | 679 | }); |
655 | }, | 680 | }, |
656 | displaySearch() { | 681 | displaySearch() { |
657 | (this.show = false), (this.showSearch = true); | 682 | (this.show = false), (this.showSearch = true); |
658 | }, | 683 | }, |
659 | closeSearch() { | 684 | closeSearch() { |
660 | this.showSearch = false; | 685 | this.showSearch = false; |
661 | this.show = true; | 686 | this.show = true; |
662 | this.search = ""; | 687 | this.search = ""; |
663 | } | 688 | }, |
664 | }, | 689 | }, |
665 | mounted() { | 690 | mounted() { |
666 | this.getNewsList(); | 691 | this.getNewsList(); |
667 | this.editItem; | 692 | this.editItem; |
668 | } | 693 | }, |
669 | }; | 694 | }; |
670 | </script> | 695 | </script> |
src/pages/NoticeBoard/noticeBoard.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Notice Board ****** --> | 3 | <!-- ****** Edit Notice Board ****** --> |
4 | <v-dialog v-model="editNoticeBoardDialog" max-width="500px" scrollable> | 4 | <v-dialog v-model="editNoticeBoardDialog" max-width="500px" 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 Notice Board</label> | 8 | <label class="title text-xs-center">Edit Notice Board</label> |
9 | <v-icon size="24" class="right" @click="editNoticeBoardDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editNoticeBoardDialog = 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-layout> | 13 | <v-layout> |
14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
15 | <img | 15 | <img |
16 | src="/static/icon/user.png" | 16 | src="/static/icon/user.png" |
17 | v-if="!editedItem.eventImageUrl && !imageUrl" | 17 | v-if="!editedItem.eventImageUrl && !imageUrl" |
18 | width="100px" | 18 | width="100px" |
19 | /> | 19 | /> |
20 | <img | 20 | <img |
21 | :src="editedItem.eventImageUrl" | 21 | :src="editedItem.eventImageUrl" |
22 | height="150" | 22 | height="150" |
23 | v-else-if="editedItem.eventImageUrl && !imageUrl" | 23 | v-else-if="editedItem.eventImageUrl && !imageUrl" |
24 | width="150px" | 24 | width="150px" |
25 | /> | 25 | /> |
26 | <img | 26 | <img |
27 | v-if="imageUrl" | 27 | v-if="imageUrl" |
28 | :src="imageUrl" | 28 | :src="imageUrl" |
29 | height="150" | 29 | height="150" |
30 | style="border-radius:50%; width:150px" | 30 | style="border-radius:50%; width:150px" |
31 | /> | 31 | /> |
32 | <input | 32 | <input |
33 | type="file" | 33 | type="file" |
34 | style="display: none" | 34 | style="display: none" |
35 | ref="image" | 35 | ref="image" |
36 | accept="image/*" | 36 | accept="image/*" |
37 | @change="onFilePicked" | 37 | @change="onFilePicked" |
38 | /> | 38 | /> |
39 | </v-flex> | 39 | </v-flex> |
40 | </v-layout> | 40 | </v-layout> |
41 | <v-layout wrap> | 41 | <v-layout wrap> |
42 | <v-flex xs12> | 42 | <v-flex xs12> |
43 | <v-layout> | 43 | <v-layout> |
44 | <v-flex xs4 class="pt-4 subheading"> | 44 | <v-flex xs4 class="pt-4 subheading"> |
45 | <label class="right">Title:</label> | 45 | <label class="right">Title:</label> |
46 | </v-flex> | 46 | </v-flex> |
47 | <v-flex xs8 class="ml-3"> | 47 | <v-flex xs8 class="ml-3"> |
48 | <v-text-field | 48 | <v-text-field |
49 | v-model="editedItem.title" | 49 | v-model="editedItem.title" |
50 | placeholder="fill your Title" | 50 | placeholder="fill your Title" |
51 | name="name" | 51 | name="name" |
52 | type="text" | 52 | type="text" |
53 | required | 53 | required |
54 | ></v-text-field> | 54 | ></v-text-field> |
55 | </v-flex> | 55 | </v-flex> |
56 | </v-layout> | 56 | </v-layout> |
57 | </v-flex> | 57 | </v-flex> |
58 | <v-flex xs12> | 58 | <v-flex xs12> |
59 | <v-layout> | 59 | <v-layout> |
60 | <v-flex xs4 class="pt-4 subheading"> | 60 | <v-flex xs4 class="pt-4 subheading"> |
61 | <label class="right">Description:</label> | 61 | <label class="right">Description:</label> |
62 | </v-flex> | 62 | </v-flex> |
63 | <v-flex xs7 class="ml-3"> | 63 | <v-flex xs7 class="ml-3"> |
64 | <v-text-field | 64 | <v-text-field |
65 | placeholder="fill your Description" | 65 | placeholder="fill your Description" |
66 | v-model="editedItem.description" | 66 | v-model="editedItem.description" |
67 | type="text" | 67 | type="text" |
68 | name="email" | 68 | name="email" |
69 | required | 69 | required |
70 | ></v-text-field> | 70 | ></v-text-field> |
71 | </v-flex> | 71 | </v-flex> |
72 | </v-layout> | 72 | </v-layout> |
73 | </v-flex> | 73 | </v-flex> |
74 | <v-flex xs12> | 74 | <v-flex xs12> |
75 | <v-layout> | 75 | <v-layout> |
76 | <v-flex xs4 class="pt-4 subheading"> | 76 | <v-flex xs4 class="pt-4 subheading"> |
77 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 77 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
78 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> | 78 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> |
79 | </v-flex> | 79 | </v-flex> |
80 | <v-flex xs7 class="ml-3"> | 80 | <v-flex xs7 class="ml-3"> |
81 | <v-text-field | 81 | <v-text-field |
82 | label="Select Image" | 82 | label="Select Image" |
83 | @click="pickFile" | 83 | @click="pickFile" |
84 | v-model="imageName" | 84 | v-model="imageName" |
85 | append-icon="attach_file" | 85 | append-icon="attach_file" |
86 | ></v-text-field> | 86 | ></v-text-field> |
87 | </v-flex> | 87 | </v-flex> |
88 | </v-layout> | 88 | </v-layout> |
89 | </v-flex> | 89 | </v-flex> |
90 | <v-flex xs12> | 90 | <v-flex xs12> |
91 | <v-card-actions> | 91 | <v-card-actions> |
92 | <v-spacer></v-spacer> | 92 | <v-spacer></v-spacer> |
93 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 93 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
94 | </v-card-actions> | 94 | </v-card-actions> |
95 | </v-flex> | 95 | </v-flex> |
96 | </v-layout> | 96 | </v-layout> |
97 | </v-card-text> | 97 | </v-card-text> |
98 | </v-card> | 98 | </v-card> |
99 | </v-dialog> | 99 | </v-dialog> |
100 | 100 | ||
101 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> | 101 | <!-- ****** VIEW PROFIL NOTICE BOARD ****** --> |
102 | 102 | ||
103 | <v-dialog v-model="viewNoticeBoardDialog" max-width="600px" scrollable> | 103 | <v-dialog v-model="viewNoticeBoardDialog" max-width="600px" scrollable> |
104 | <v-card flat class="card-style pa-3" dark> | 104 | <v-card flat class="card-style pa-3" dark> |
105 | <v-layout> | 105 | <v-layout> |
106 | <v-flex xs12> | 106 | <v-flex xs12> |
107 | <label class="title text-xs-center">View Notice Board</label> | 107 | <label class="title text-xs-center">View Notice Board</label> |
108 | <v-icon size="24" class="right" @click="viewNoticeBoardDialog = false">cancel</v-icon> | 108 | <v-icon size="24" class="right" @click="viewNoticeBoardDialog = false">cancel</v-icon> |
109 | </v-flex> | 109 | </v-flex> |
110 | </v-layout> | 110 | </v-layout> |
111 | <v-card-text> | 111 | <v-card-text> |
112 | <v-layout> | 112 | <v-layout> |
113 | <v-flex align-center justify-center layout text-xs-center> | 113 | <v-flex align-center justify-center layout text-xs-center> |
114 | <img src="/static/icon/user.png" v-if="!editedItem.eventImageUrl" width="80" /> | 114 | <img src="/static/icon/user.png" v-if="!editedItem.eventImageUrl" width="80" /> |
115 | <img | 115 | <img |
116 | :src="editedItem.eventImageUrl" | 116 | :src="editedItem.eventImageUrl" |
117 | v-else-if="editedItem.eventImageUrl" | 117 | v-else-if="editedItem.eventImageUrl" |
118 | class="img" | 118 | class="img" |
119 | width="200" | 119 | width="200" |
120 | /> | 120 | /> |
121 | </v-flex> | 121 | </v-flex> |
122 | </v-layout> | 122 | </v-layout> |
123 | <v-container grid-list-md> | 123 | <v-container grid-list-md> |
124 | <v-layout wrap> | 124 | <v-layout wrap> |
125 | <v-flex> | 125 | <v-flex> |
126 | <v-layout> | 126 | <v-layout> |
127 | <v-flex xs5 sm6> | 127 | <v-flex xs5 sm6> |
128 | <h5 class="right my-1"> | 128 | <h5 class="right my-1"> |
129 | <b>Title:</b> | 129 | <b>Title:</b> |
130 | </h5> | 130 | </h5> |
131 | </v-flex> | 131 | </v-flex> |
132 | <v-flex sm6 xs8> | 132 | <v-flex sm6 xs8> |
133 | <h5 class="my-1">{{ editedItem.title }}</h5> | 133 | <h5 class="my-1">{{ editedItem.title }}</h5> |
134 | </v-flex> | 134 | </v-flex> |
135 | </v-layout> | 135 | </v-layout> |
136 | <v-layout> | 136 | <v-layout> |
137 | <v-flex xs5 sm6> | 137 | <v-flex xs5 sm6> |
138 | <h5 class="right my-1"> | 138 | <h5 class="right my-1"> |
139 | <b>Description:</b> | 139 | <b>Description:</b> |
140 | </h5> | 140 | </h5> |
141 | </v-flex> | 141 | </v-flex> |
142 | <v-flex sm6 xs8> | 142 | <v-flex sm6 xs8> |
143 | <h5 class="my-1">{{ editedItem.description }}</h5> | 143 | <h5 class="my-1">{{ editedItem.description }}</h5> |
144 | </v-flex> | 144 | </v-flex> |
145 | </v-layout> | 145 | </v-layout> |
146 | </v-flex> | 146 | </v-flex> |
147 | </v-layout> | 147 | </v-layout> |
148 | </v-container> | 148 | </v-container> |
149 | </v-card-text> | 149 | </v-card-text> |
150 | </v-card> | 150 | </v-card> |
151 | </v-dialog> | 151 | </v-dialog> |
152 | <!-- ****** EXISTING Notice Board TABLE ****** --> | 152 | <!-- ****** EXISTING Notice Board TABLE ****** --> |
153 | <v-toolbar color="transparent" flat> | 153 | <v-toolbar color="transparent" flat> |
154 | <v-btn | 154 | <v-btn |
155 | fab | 155 | fab |
156 | dark | 156 | dark |
157 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 157 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
158 | small | 158 | small |
159 | @click="addNoticeBoardDialog = true" | 159 | @click="addNoticeBoardDialog = true" |
160 | > | 160 | > |
161 | <v-icon dark>add</v-icon> | 161 | <v-icon dark>add</v-icon> |
162 | </v-btn> | 162 | </v-btn> |
163 | <v-btn | 163 | <v-btn |
164 | round | 164 | round |
165 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 165 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
166 | dark | 166 | dark |
167 | @click="addNoticeBoardDialog = true" | 167 | @click="addNoticeBoardDialog = true" |
168 | > | 168 | > |
169 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Notice Board | 169 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Notice Board |
170 | </v-btn> | 170 | </v-btn> |
171 | <v-spacer></v-spacer> | 171 | <v-spacer></v-spacer> |
172 | <v-card-title class="body-1" v-show="show"> | 172 | <v-card-title class="body-1" v-show="show"> |
173 | <v-btn icon large flat @click="displaySearch"> | 173 | <v-btn icon large flat @click="displaySearch"> |
174 | <v-avatar size="27"> | 174 | <v-avatar size="27"> |
175 | <img src="/static/icon/search.png" alt="icon" /> | 175 | <img src="/static/icon/search.png" alt="icon" /> |
176 | </v-avatar> | 176 | </v-avatar> |
177 | </v-btn> | 177 | </v-btn> |
178 | </v-card-title> | 178 | </v-card-title> |
179 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 179 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
180 | <v-layout> | 180 | <v-layout> |
181 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 181 | <v-text-field |
182 | autofocus | ||
183 | v-model="search" | ||
184 | label="Search" | ||
185 | prepend-inner-icon="search" | ||
186 | color="primary" | ||
187 | ></v-text-field> | ||
182 | <v-icon @click="closeSearch" color="error">close</v-icon> | 188 | <v-icon @click="closeSearch" color="error">close</v-icon> |
183 | </v-layout> | 189 | </v-layout> |
184 | </v-flex> | 190 | </v-flex> |
185 | </v-toolbar> | 191 | </v-toolbar> |
186 | <v-data-table | 192 | <v-data-table |
187 | :headers="headers" | 193 | :headers="headers" |
188 | :items="notices" | 194 | :items="notices" |
189 | :pagination.sync="pagination" | 195 | :pagination.sync="pagination" |
190 | :search="search" | 196 | :search="search" |
191 | > | 197 | > |
192 | <template slot="items" slot-scope="props"> | 198 | <template slot="items" slot-scope="props"> |
193 | <tr class="tr"> | 199 | <tr class="tr"> |
194 | <td class="td td-row">{{ props.index + 1}}</td> | 200 | <td class="td td-row">{{ props.index + 1}}</td> |
195 | <td class="td td-row text-xs-center"> | 201 | <td class="td td-row text-xs-center"> |
196 | <v-avatar size="40"> | 202 | <v-avatar size="40"> |
197 | <img :src="props.item.eventImageUrl" v-if="props.item.eventImageUrl" /> | 203 | <img :src="props.item.eventImageUrl" v-if="props.item.eventImageUrl" /> |
198 | <img src="/static/icon/user.png" v-else-if="!props.item.eventImageUrl" /> | 204 | <img src="/static/icon/user.png" v-else-if="!props.item.eventImageUrl" /> |
199 | </v-avatar> | 205 | </v-avatar> |
200 | </td> | 206 | </td> |
201 | <td class="text-xs-center td td-row">{{ props.item.title}}</td> | 207 | <td class="text-xs-center td td-row">{{ props.item.title}}</td> |
202 | <td class="text-xs-center td td-row"> | 208 | <td class="text-xs-center td td-row"> |
203 | <v-btn | 209 | <v-btn |
204 | class="add-button" | 210 | class="add-button" |
205 | @click="generatePDF2Canvas(props.item)" | 211 | @click="generatePDF2Canvas(props.item)" |
206 | :loading="loadingPdf" | 212 | :loading="loadingPdf" |
207 | dark | 213 | dark |
208 | >{{ props.item.fileType }}</v-btn> | 214 | >{{ props.item.fileType }}</v-btn> |
209 | </td> | 215 | </td> |
210 | <td class="text-xs-center td td-row"> | 216 | <td class="text-xs-center td td-row"> |
211 | <span> | 217 | <span> |
212 | <v-tooltip top> | 218 | <v-tooltip top> |
213 | <img | 219 | <img |
214 | slot="activator" | 220 | slot="activator" |
215 | style="cursor:pointer; width:25px; height:25px; " | 221 | style="cursor:pointer; width:25px; height:25px; " |
216 | class="mr-3" | 222 | class="mr-3" |
217 | @click="profile(props.item)" | 223 | @click="profile(props.item)" |
218 | src="/static/icon/view.png" | 224 | src="/static/icon/view.png" |
219 | /> | 225 | /> |
220 | <span>View</span> | 226 | <span>View</span> |
221 | </v-tooltip> | 227 | </v-tooltip> |
222 | <v-tooltip top> | 228 | <v-tooltip top> |
223 | <img | 229 | <img |
224 | slot="activator" | 230 | slot="activator" |
225 | style="cursor:pointer; width:20px; height:18px; " | 231 | style="cursor:pointer; width:20px; height:18px; " |
226 | class="mr-3" | 232 | class="mr-3" |
227 | @click="editItem(props.item)" | 233 | @click="editItem(props.item)" |
228 | src="/static/icon/edit.png" | 234 | src="/static/icon/edit.png" |
229 | /> | 235 | /> |
230 | <span>Edit</span> | 236 | <span>Edit</span> |
231 | </v-tooltip> | 237 | </v-tooltip> |
232 | <v-tooltip top> | 238 | <v-tooltip top> |
233 | <img | 239 | <img |
234 | slot="activator" | 240 | slot="activator" |
235 | style="cursor:pointer; width:20px; height:20px; " | 241 | style="cursor:pointer; width:20px; height:20px; " |
236 | @click="deleteItem(props.item)" | 242 | @click="deleteItem(props.item)" |
237 | src="/static/icon/delete.png" | 243 | src="/static/icon/delete.png" |
238 | /> | 244 | /> |
239 | <span>Delete</span> | 245 | <span>Delete</span> |
240 | </v-tooltip> | 246 | </v-tooltip> |
241 | </span> | 247 | </span> |
242 | </td> | 248 | </td> |
243 | </tr> | 249 | </tr> |
244 | </template> | 250 | </template> |
245 | <v-alert | 251 | <v-alert |
246 | slot="no-results" | 252 | slot="no-results" |
247 | :value="true" | 253 | :value="true" |
248 | color="error" | 254 | color="error" |
249 | icon="warning" | 255 | icon="warning" |
250 | >Your search for "{{ search }}" found no results.</v-alert> | 256 | >Your search for "{{ search }}" found no results.</v-alert> |
251 | </v-data-table> | 257 | </v-data-table> |
252 | <!-- ****** ADD Notice Board ****** --> | 258 | <!-- ****** ADD Notice Board ****** --> |
253 | <v-dialog v-model="addNoticeBoardDialog" max-width="600px"> | 259 | <v-dialog v-model="addNoticeBoardDialog" max-width="600px" v-if="addNoticeBoardDialog"> |
254 | <v-card flat class="card-style pa-2" dark> | 260 | <v-card flat class="card-style pa-2" dark> |
255 | <v-layout> | 261 | <v-layout> |
256 | <v-flex xs12> | 262 | <v-flex xs12> |
257 | <label class="title text-xs-center">Add Notice Board</label> | 263 | <label class="title text-xs-center">Add Notice Board</label> |
258 | <v-icon size="24" class="right" @click="addNoticeBoardDialog = false">cancel</v-icon> | 264 | <v-icon size="24" class="right" @click="closeNoticeBoardModel">cancel</v-icon> |
259 | </v-flex> | 265 | </v-flex> |
260 | </v-layout> | 266 | </v-layout> |
261 | <v-container fluid fill-height> | 267 | <v-container fluid fill-height> |
262 | <v-layout align-center> | 268 | <v-layout align-center> |
263 | <v-flex xs12> | 269 | <v-flex xs12> |
264 | <v-form ref="form" v-model="valid" lazy-validation> | 270 | <v-form ref="form" v-model="valid" lazy-validation> |
265 | <v-layout> | 271 | <v-layout> |
266 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 272 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
267 | <v-avatar size="80px" v-if="!imageUrl"> | 273 | <v-avatar size="80px" v-if="!imageUrl"> |
268 | <img src="/static/icon/user.png" /> | 274 | <img src="/static/icon/user.png" /> |
269 | </v-avatar> | 275 | </v-avatar> |
270 | <input | 276 | <input |
271 | type="file" | 277 | type="file" |
272 | style="display: none" | 278 | style="display: none" |
273 | ref="image" | 279 | ref="image" |
274 | accept="image/*" | 280 | accept="image/*" |
275 | @change="onFilePicked" | 281 | @change="onFilePicked" |
276 | /> | 282 | /> |
277 | 283 | ||
278 | <v-avatar size="150px" v-if="imageUrl"> | 284 | <v-avatar size="150px" v-if="imageUrl"> |
279 | <img :src="imageUrl" height="150" /> | 285 | <img :src="imageUrl" height="150" /> |
280 | </v-avatar> | 286 | </v-avatar> |
281 | </v-flex> | 287 | </v-flex> |
282 | </v-layout> | 288 | </v-layout> |
283 | <v-layout> | 289 | <v-layout> |
284 | <v-flex xs4 class="pt-4 subheading"> | 290 | <v-flex xs4 class="pt-4 subheading"> |
285 | <label class="right">Title:</label> | 291 | <label class="right">Title:</label> |
286 | </v-flex> | 292 | </v-flex> |
287 | <v-flex xs7 class="ml-3"> | 293 | <v-flex xs7 class="ml-3"> |
288 | <v-text-field | 294 | <v-text-field |
289 | v-model="addNoticeBoard.title" | 295 | v-model="addNoticeBoard.title" |
290 | placeholder="fill your Title" | 296 | placeholder="fill your Title" |
291 | name="name" | 297 | name="name" |
292 | type="text" | 298 | type="text" |
293 | :rules="titleRules" | 299 | :rules="titleRules" |
294 | required | 300 | required |
295 | ></v-text-field> | 301 | ></v-text-field> |
296 | </v-flex> | 302 | </v-flex> |
297 | </v-layout> | 303 | </v-layout> |
298 | <v-layout> | 304 | <v-layout> |
299 | <v-flex xs4 class="pt-4 subheading"> | 305 | <v-flex xs4 class="pt-4 subheading"> |
300 | <label class="right">Description:</label> | 306 | <label class="right">Description:</label> |
301 | </v-flex> | 307 | </v-flex> |
302 | <v-flex xs7 class="ml-3"> | 308 | <v-flex xs7 class="ml-3"> |
303 | <v-text-field | 309 | <v-text-field |
304 | v-model="addNoticeBoard.description" | 310 | v-model="addNoticeBoard.description" |
305 | placeholder="fill your Description" | 311 | placeholder="fill your Description" |
306 | name="name" | 312 | name="name" |
307 | type="text" | 313 | type="text" |
308 | :rules="descriptionRules" | 314 | :rules="descriptionRules" |
309 | required | 315 | required |
310 | ></v-text-field> | 316 | ></v-text-field> |
311 | </v-flex> | 317 | </v-flex> |
312 | </v-layout> | 318 | </v-layout> |
313 | <v-layout> | 319 | <v-layout> |
314 | <v-flex xs4 class="pt-4 subheading"> | 320 | <v-flex xs4 class="pt-4 subheading"> |
315 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 321 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
316 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> | 322 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> |
317 | </v-flex> | 323 | </v-flex> |
318 | <v-flex xs7 class="ml-3"> | 324 | <v-flex xs7 class="ml-3"> |
319 | <v-text-field | 325 | <v-text-field |
320 | label="Select Image" | 326 | label="Select Image" |
321 | @click="pickFile" | 327 | @click="pickFile" |
322 | v-model="imageName" | 328 | v-model="imageName" |
323 | append-icon="attach_file" | 329 | append-icon="attach_file" |
324 | ></v-text-field> | 330 | ></v-text-field> |
325 | <input | 331 | <input |
326 | type="file" | 332 | type="file" |
327 | style="display:none" | 333 | style="display:none" |
328 | ref="image" | 334 | ref="image" |
329 | accept="image/*" | 335 | accept="image/*" |
330 | @change="onFilePicked" | 336 | @change="onFilePicked" |
331 | /> | 337 | /> |
332 | </v-flex> | 338 | </v-flex> |
333 | </v-layout> | 339 | </v-layout> |
334 | <v-layout> | 340 | <v-layout> |
335 | <v-flex xs12> | 341 | <v-flex xs12> |
336 | <v-card-actions> | 342 | <v-card-actions> |
337 | <v-spacer></v-spacer> | 343 | <v-spacer></v-spacer> |
338 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> | 344 | <v-btn @click="clear" round dark class="clear-button">clear</v-btn> |
339 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 345 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
340 | </v-card-actions> | 346 | </v-card-actions> |
341 | </v-flex> | 347 | </v-flex> |
342 | </v-layout> | 348 | </v-layout> |
343 | </v-form> | 349 | </v-form> |
344 | </v-flex> | 350 | </v-flex> |
345 | </v-layout> | 351 | </v-layout> |
346 | </v-container> | 352 | </v-container> |
347 | </v-card> | 353 | </v-card> |
348 | </v-dialog> | 354 | </v-dialog> |
349 | <v-snackbar | 355 | <v-snackbar |
350 | :timeout="timeout" | 356 | :timeout="timeout" |
351 | :top="y === 'top'" | 357 | :top="y === 'top'" |
352 | :right="x === 'right'" | 358 | :right="x === 'right'" |
353 | :vertical="mode === 'vertical'" | 359 | :vertical="mode === 'vertical'" |
354 | v-model="snackbar" | 360 | v-model="snackbar" |
355 | :color="color" | 361 | :color="color" |
356 | >{{ text }}</v-snackbar> | 362 | >{{ text }}</v-snackbar> |
357 | <div class="loader" v-if="showLoader"> | 363 | <div class="loader" v-if="showLoader"> |
358 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 364 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
359 | </div> | 365 | </div> |
360 | </v-container> | 366 | </v-container> |
361 | </template> | 367 | </template> |
362 | 368 | ||
363 | <script> | 369 | <script> |
364 | import http from "@/Services/http.js"; | 370 | import http from "@/Services/http.js"; |
365 | 371 | ||
366 | export default { | 372 | export default { |
367 | data: () => ({ | 373 | data: () => ({ |
368 | snackbar: false, | 374 | snackbar: false, |
369 | y: "top", | 375 | y: "top", |
370 | x: "right", | 376 | x: "right", |
371 | mode: "", | 377 | mode: "", |
372 | timeout: 3000, | 378 | timeout: 3000, |
373 | text: "", | 379 | text: "", |
374 | color: "", | 380 | color: "", |
375 | show: true, | 381 | show: true, |
376 | showSearch: false, | 382 | showSearch: false, |
377 | showLoader: false, | 383 | showLoader: false, |
378 | loading: false, | 384 | loading: false, |
379 | date: null, | 385 | date: null, |
380 | search: "", | 386 | search: "", |
381 | addNoticeBoardDialog: false, | 387 | addNoticeBoardDialog: false, |
382 | editNoticeBoardDialog: false, | 388 | editNoticeBoardDialog: false, |
383 | viewNoticeBoardDialog: false, | 389 | viewNoticeBoardDialog: false, |
384 | valid: true, | 390 | valid: true, |
385 | addclass: [], | 391 | addclass: [], |
386 | addSection: [], | 392 | addSection: [], |
387 | gender: ["Male", "Female"], | 393 | gender: ["Male", "Female"], |
388 | pagination: { | 394 | pagination: { |
389 | rowsPerPage: 10 | 395 | rowsPerPage: 10, |
390 | }, | 396 | }, |
391 | imageName: "", | 397 | imageName: "", |
392 | imageUrl: "", | 398 | imageUrl: "", |
393 | imageFile: "", | 399 | imageFile: "", |
394 | upload: "", | 400 | upload: "", |
395 | loadingPdf: false, | 401 | loadingPdf: false, |
396 | 402 | ||
397 | titleRules: [v => !!v || " Title is required"], | 403 | titleRules: [(v) => !!v || " Title is required"], |
398 | descriptionRules: [v => !!v || " Description is required"], | 404 | descriptionRules: [(v) => !!v || " Description is required"], |
399 | headers: [ | 405 | headers: [ |
400 | { | 406 | { |
401 | text: "No", | 407 | text: "No", |
402 | align: "", | 408 | align: "", |
403 | sortable: false, | 409 | sortable: false, |
404 | value: "No" | 410 | value: "No", |
405 | }, | 411 | }, |
406 | { | 412 | { |
407 | text: "Event Image", | 413 | text: "Event Image", |
408 | align: "center", | 414 | align: "center", |
409 | sortable: false, | 415 | sortable: false, |
410 | value: "eventImageUrl" | 416 | value: "eventImageUrl", |
411 | }, | 417 | }, |
412 | { text: "Title", value: "title", sortable: false, align: "center" }, | 418 | { text: "Title", value: "title", sortable: false, align: "center" }, |
413 | { | 419 | { |
414 | text: "File", | 420 | text: "File", |
415 | value: "eventImageUrl", | 421 | value: "eventImageUrl", |
416 | sortable: false, | 422 | sortable: false, |
417 | align: "center" | 423 | align: "center", |
418 | }, | 424 | }, |
419 | { text: "Action", value: "", sortable: false, align: "center" } | 425 | { text: "Action", value: "", sortable: false, align: "center" }, |
420 | ], | 426 | ], |
421 | notices: [], | 427 | notices: [], |
422 | editedIndex: -1, | 428 | editedIndex: -1, |
423 | addNoticeBoard: {}, | 429 | addNoticeBoard: {}, |
424 | editedItem: { | 430 | editedItem: { |
425 | title: "", | 431 | title: "", |
426 | description: "" | 432 | description: "", |
427 | } | 433 | }, |
428 | }), | 434 | }), |
435 | watch: { | ||
436 | addNoticeBoardDialog: function (val) { | ||
437 | if (!val) { | ||
438 | this.addNoticeBoard = []; | ||
439 | this.imageName = ""; | ||
440 | this.imageFile = ""; | ||
441 | this.imageUrl = ""; | ||
442 | } | ||
443 | }, | ||
444 | }, | ||
429 | methods: { | 445 | methods: { |
430 | pickFile() { | 446 | pickFile() { |
431 | this.$refs.image.click(); | 447 | this.$refs.image.click(); |
432 | }, | 448 | }, |
433 | getNoticeDataList() { | 449 | getNoticeDataList() { |
434 | this.showLoader = true; | 450 | this.showLoader = true; |
435 | var token = this.$store.state.token; | 451 | var token = this.$store.state.token; |
436 | http() | 452 | http() |
437 | .get("/getEventsList", { | 453 | .get("/getEventsList", { |
438 | headers: { Authorization: "Bearer " + token } | 454 | headers: { Authorization: "Bearer " + token }, |
439 | }) | 455 | }) |
440 | .then(response => { | 456 | .then((response) => { |
441 | this.notices = response.data.data; | 457 | this.notices = response.data.data; |
442 | this.showLoader = false; | 458 | this.showLoader = false; |
443 | }) | 459 | }) |
444 | .catch(error => { | 460 | .catch((error) => { |
445 | this.showLoader = false; | 461 | this.showLoader = false; |
446 | if (error.response.status === 401) { | 462 | if (error.response.status === 401) { |
447 | this.$router.replace({ path: "/" }); | 463 | this.$router.replace({ path: "/" }); |
448 | this.$store.dispatch("setToken", null); | 464 | this.$store.dispatch("setToken", null); |
449 | this.$store.dispatch("Id", null); | 465 | this.$store.dispatch("Id", null); |
450 | } | 466 | } |
451 | }); | 467 | }); |
452 | }, | 468 | }, |
453 | editItem(item) { | 469 | editItem(item) { |
454 | this.editedIndex = this.notices.indexOf(item); | 470 | this.editedIndex = this.notices.indexOf(item); |
455 | this.editedItem = Object.assign({}, item); | 471 | this.editedItem = Object.assign({}, item); |
456 | this.editNoticeBoardDialog = true; | 472 | this.editNoticeBoardDialog = true; |
457 | }, | 473 | }, |
458 | profile(item) { | 474 | profile(item) { |
459 | this.editedIndex = this.notices.indexOf(item); | 475 | this.editedIndex = this.notices.indexOf(item); |
460 | this.editedItem = Object.assign({}, item); | 476 | this.editedItem = Object.assign({}, item); |
461 | this.viewNoticeBoardDialog = true; | 477 | this.viewNoticeBoardDialog = true; |
462 | }, | 478 | }, |
463 | deleteItem(item) { | 479 | deleteItem(item) { |
464 | let deleteEvent = { | 480 | let deleteEvent = { |
465 | eventId: item._id | 481 | eventId: item._id, |
466 | }; | 482 | }; |
467 | http() | 483 | http() |
468 | .delete( | 484 | .delete( |
469 | "/deleteEvent", | 485 | "/deleteEvent", |
470 | confirm("Are you sure you want to delete this?") && { | 486 | confirm("Are you sure you want to delete this?") && { |
471 | params: deleteEvent | 487 | params: deleteEvent, |
472 | } | 488 | } |
473 | ) | 489 | ) |
474 | .then(response => { | 490 | .then((response) => { |
475 | // console.log("deleteUers",deleteEvent) | 491 | // console.log("deleteUers",deleteEvent) |
476 | if ((this.snackbar = true)) { | 492 | if ((this.snackbar = true)) { |
477 | this.text = "Successfully delete Existing Notice Data"; | 493 | this.text = "Successfully delete Existing Notice Data"; |
478 | } | 494 | } |
479 | this.snackbar = true; | 495 | this.snackbar = true; |
480 | this.color = "green"; | 496 | this.color = "green"; |
481 | this.getNoticeDataList(); | 497 | this.getNoticeDataList(); |
482 | }) | 498 | }) |
483 | .catch(error => { | 499 | .catch((error) => { |
484 | // console.log(error); | 500 | // console.log(error); |
485 | this.snackbar = true; | 501 | this.snackbar = true; |
486 | this.text = error.response.data.message; | 502 | this.text = error.response.data.message; |
487 | this.color = "error"; | 503 | this.color = "error"; |
488 | }); | 504 | }); |
489 | }, | 505 | }, |
490 | close() { | 506 | close() { |
491 | this.editNoticeBoardDialog = false; | 507 | this.editNoticeBoardDialog = false; |
492 | }, | 508 | }, |
509 | closeNoticeBoardModel() { | ||
510 | this.addNoticeBoardDialog = false; | ||
511 | this.addNoticeBoard = []; | ||
512 | this.imageName = ""; | ||
513 | this.imageFile = ""; | ||
514 | this.imageUrl = ""; | ||
515 | }, | ||
493 | submit() { | 516 | submit() { |
494 | var signatures = { | 517 | var signatures = { |
495 | JVBERi0: "other", | 518 | JVBERi0: "other", |
496 | iVBORw0KGgo: "image", | 519 | iVBORw0KGgo: "image", |
497 | UEsDBBQ: "other", | 520 | UEsDBBQ: "other", |
498 | "/": "image", | 521 | "/": "image", |
499 | AAABAA: "image", | 522 | AAABAA: "image", |
500 | IywiV2hhdC: "other", | 523 | IywiV2hhdC: "other", |
501 | bmFtZSxl: "other" | 524 | bmFtZSxl: "other", |
502 | }; | 525 | }; |
503 | function detectMimeType(b64) { | 526 | function detectMimeType(b64) { |
504 | for (var s in signatures) { | 527 | for (var s in signatures) { |
505 | if (b64.indexOf(s) === 0) { | 528 | if (b64.indexOf(s) === 0) { |
506 | return signatures[s]; | 529 | return signatures[s]; |
507 | } | 530 | } |
508 | } | 531 | } |
509 | } | 532 | } |
510 | if (this.$refs.form.validate()) { | 533 | if (this.$refs.form.validate()) { |
511 | if (this.imageUrl) { | 534 | if (this.imageUrl) { |
512 | var str = this.imageUrl; | 535 | var str = this.imageUrl; |
513 | const [baseUrl, imageUrl] = str.split(/,/); | 536 | const [baseUrl, imageUrl] = str.split(/,/); |
514 | this.addNoticeBoard.upload = imageUrl; | 537 | this.addNoticeBoard.upload = imageUrl; |
515 | this.addNoticeBoard.fileType = detectMimeType(imageUrl); | 538 | this.addNoticeBoard.fileType = detectMimeType(imageUrl); |
516 | this.addNoticeBoard.fileName = this.imageName | 539 | this.addNoticeBoard.fileName = this.imageName; |
517 | } | 540 | } |
518 | http() | 541 | http() |
519 | .post("/createEvent", this.addNoticeBoard) | 542 | .post("/createEvent", this.addNoticeBoard) |
520 | .then(response => { | 543 | .then((response) => { |
521 | this.imageUrl = ""; | 544 | this.imageUrl = ""; |
522 | this.snackbar = true; | 545 | this.snackbar = true; |
523 | this.color = "green"; | 546 | this.color = "green"; |
524 | this.text = response.data.message; | 547 | this.text = response.data.message; |
525 | this.getNoticeDataList(); | 548 | this.getNoticeDataList(); |
526 | this.addNoticeBoardDialog = false; | 549 | this.addNoticeBoardDialog = false; |
527 | this.clear(); | 550 | this.clear(); |
528 | }) | 551 | }) |
529 | .catch(error => { | 552 | .catch((error) => { |
530 | this.snackbar = true; | 553 | this.snackbar = true; |
531 | this.text = error.response.data.message; | 554 | this.text = error.response.data.message; |
532 | this.color = "error"; | 555 | this.color = "error"; |
533 | }); | 556 | }); |
534 | } | 557 | } |
535 | }, | 558 | }, |
536 | onFilePicked(e) { | 559 | onFilePicked(e) { |
537 | const files = e.target.files; | 560 | const files = e.target.files; |
538 | this.upload = e.target.files[0]; | 561 | this.upload = e.target.files[0]; |
539 | if (files[0] !== undefined) { | 562 | if (files[0] !== undefined) { |
540 | this.imageName = files[0].name; | 563 | this.imageName = files[0].name; |
541 | if (this.imageName.lastIndexOf(".") <= 0) { | 564 | if (this.imageName.lastIndexOf(".") <= 0) { |
542 | return; | 565 | return; |
543 | } | 566 | } |
544 | const fr = new FileReader(); | 567 | const fr = new FileReader(); |
545 | fr.readAsDataURL(files[0]); | 568 | fr.readAsDataURL(files[0]); |
546 | fr.addEventListener("load", () => { | 569 | fr.addEventListener("load", () => { |
547 | this.imageUrl = fr.result; | 570 | this.imageUrl = fr.result; |
548 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 571 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
549 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 572 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
550 | }); | 573 | }); |
551 | } else { | 574 | } else { |
552 | this.imageName = ""; | 575 | this.imageName = ""; |
553 | this.imageFile = ""; | 576 | this.imageFile = ""; |
554 | this.imageUrl = ""; | 577 | this.imageUrl = ""; |
555 | } | 578 | } |
556 | }, | 579 | }, |
557 | clear() { | 580 | clear() { |
558 | this.$refs.form.reset(); | 581 | this.$refs.form.reset(); |
559 | this.imageUrl = ""; | 582 | this.imageUrl = ""; |
560 | }, | 583 | }, |
561 | save() { | 584 | save() { |
562 | let editNoticeBoard = { | 585 | let editNoticeBoard = { |
563 | eventId: this.editedItem._id, | 586 | eventId: this.editedItem._id, |
564 | title: this.editedItem.title, | 587 | title: this.editedItem.title, |
565 | description: this.editedItem.description, | 588 | description: this.editedItem.description, |
566 | fileName: this.imageName | 589 | fileName: this.imageName, |
567 | }; | 590 | }; |
568 | var signatures = { | 591 | var signatures = { |
569 | JVBERi0: "other", | 592 | JVBERi0: "other", |
570 | iVBORw0KGgo: "image", | 593 | iVBORw0KGgo: "image", |
571 | UEsDBBQ: "other", | 594 | UEsDBBQ: "other", |
572 | "/": "image", | 595 | "/": "image", |
573 | AAABAA: "image", | 596 | AAABAA: "image", |
574 | IywiV2hhdC: "other" | 597 | IywiV2hhdC: "other", |
575 | }; | 598 | }; |
576 | function detectMimeType(b64) { | 599 | function detectMimeType(b64) { |
577 | for (var s in signatures) { | 600 | for (var s in signatures) { |
578 | if (b64.indexOf(s) === 0) { | 601 | if (b64.indexOf(s) === 0) { |
579 | return signatures[s]; | 602 | return signatures[s]; |
580 | } | 603 | } |
581 | } | 604 | } |
582 | } | 605 | } |
583 | if (this.imageUrl) { | 606 | if (this.imageUrl) { |
584 | var str = this.imageUrl; | 607 | var str = this.imageUrl; |
585 | const [baseUrl, imageUrl] = str.split(/,/); | 608 | const [baseUrl, imageUrl] = str.split(/,/); |
586 | editNoticeBoard.upload = imageUrl; | 609 | editNoticeBoard.upload = imageUrl; |
587 | editNoticeBoard.fileType = detectMimeType(imageUrl); | 610 | editNoticeBoard.fileType = detectMimeType(imageUrl); |
588 | } | 611 | } |
589 | http() | 612 | http() |
590 | .put("/updateEvent", editNoticeBoard) | 613 | .put("/updateEvent", editNoticeBoard) |
591 | .then(response => { | 614 | .then((response) => { |
592 | if ((this.snackbar = true)) { | 615 | if ((this.snackbar = true)) { |
593 | this.text = "Successfully Edit Existing Notice Data"; | 616 | this.text = "Successfully Edit Existing Notice Data"; |
594 | } | 617 | } |
595 | this.color = "green"; | 618 | this.color = "green"; |
596 | this.snackbar = true; | 619 | this.snackbar = true; |
597 | this.getNoticeDataList(); | 620 | this.getNoticeDataList(); |
598 | this.close(); | 621 | this.close(); |
599 | }) | 622 | }) |
600 | .catch(error => { | 623 | .catch((error) => { |
601 | // console.log(error); | 624 | // console.log(error); |
602 | this.snackbar = true; | 625 | this.snackbar = true; |
603 | this.text = error.response.data.message; | 626 | this.text = error.response.data.message; |
604 | this.color = "red"; | 627 | this.color = "red"; |
605 | }); | 628 | }); |
606 | }, | 629 | }, |
607 | displaySearch() { | 630 | displaySearch() { |
608 | (this.show = false), (this.showSearch = true); | 631 | (this.show = false), (this.showSearch = true); |
609 | }, | 632 | }, |
610 | closeSearch() { | 633 | closeSearch() { |
611 | this.showSearch = false; | 634 | this.showSearch = false; |
612 | this.show = true; | 635 | this.show = true; |
613 | this.search = ""; | 636 | this.search = ""; |
614 | }, | 637 | }, |
615 | async generatePDF2Canvas(item) { | 638 | async generatePDF2Canvas(item) { |
616 | var dataType = ""; | 639 | var dataType = ""; |
617 | var type = ""; | 640 | var type = ""; |
618 | if (item.fileType == "image") { | 641 | if (item.fileType == "image") { |
619 | dataType = "file.jpg"; | 642 | dataType = "file.jpg"; |
620 | } else if (item.fileType == "other") { | 643 | } else if (item.fileType == "other") { |
621 | dataType = "file.pdf"; | 644 | dataType = "file.pdf"; |
622 | type = "application/pdf"; | 645 | type = "application/pdf"; |
623 | } | 646 | } |
624 | var FileSaver = require("file-saver"); | 647 | var FileSaver = require("file-saver"); |
625 | FileSaver.saveAs(item.eventImageUrl, "image.jpg"); | 648 | FileSaver.saveAs(item.eventImageUrl, "image.jpg"); |
626 | } | 649 | }, |
627 | }, | 650 | }, |
628 | mounted() { | 651 | mounted() { |
629 | this.getNoticeDataList(); | 652 | this.getNoticeDataList(); |
630 | } | 653 | }, |
631 | }; | 654 | }; |
632 | </script> | 655 | </script> |
src/pages/Notification/notification.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS NOTIFICATION DETAILS ****** --> | 3 | <!-- ****** EDITS NOTIFICATION DETAILS ****** --> |
4 | <v-dialog v-model="editNotificationDialog" max-width="500px"> | 4 | <v-dialog v-model="editNotificationDialog" max-width="500px"> |
5 | <v-flex xs12 sm12> | 5 | <v-flex xs12 sm12> |
6 | <v-card flat class="card-style pa-3" dark> | 6 | <v-card flat class="card-style pa-3" dark> |
7 | <v-layout> | 7 | <v-layout> |
8 | <v-flex xs12> | 8 | <v-flex xs12> |
9 | <label class="title text-xs-center">Edit Notification</label> | 9 | <label class="title text-xs-center">Edit Notification</label> |
10 | <v-icon size="24" class="right" @click="editNotificationDialog = false">cancel</v-icon> | 10 | <v-icon size="24" class="right" @click="editNotificationDialog = false">cancel</v-icon> |
11 | </v-flex> | 11 | </v-flex> |
12 | </v-layout> | 12 | </v-layout> |
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 xs8 sm8 class="ml-3"> | 18 | <v-flex xs8 sm8 class="ml-3"> |
19 | <v-text-field | 19 | <v-text-field |
20 | v-model="editedItem.title" | 20 | v-model="editedItem.title" |
21 | placeholder="fill your Title" | 21 | placeholder="fill your Title" |
22 | name="name" | 22 | name="name" |
23 | type="text" | 23 | type="text" |
24 | ></v-text-field> | 24 | ></v-text-field> |
25 | </v-flex> | 25 | </v-flex> |
26 | </v-layout> | 26 | </v-layout> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs12 sm12> | 28 | <v-flex xs12 sm12> |
29 | <v-layout> | 29 | <v-layout> |
30 | <v-flex xs4 class="pt-4 subheading"> | 30 | <v-flex xs4 class="pt-4 subheading"> |
31 | <label class="right">Description:</label> | 31 | <label class="right">Description:</label> |
32 | </v-flex> | 32 | </v-flex> |
33 | <v-flex xs8 sm8 class="ml-3"> | 33 | <v-flex xs8 sm8 class="ml-3"> |
34 | <v-text-field | 34 | <v-text-field |
35 | placeholder="fill your Description" | 35 | placeholder="fill your Description" |
36 | v-model="editedItem.description" | 36 | v-model="editedItem.description" |
37 | type="text" | 37 | type="text" |
38 | ></v-text-field> | 38 | ></v-text-field> |
39 | </v-flex> | 39 | </v-flex> |
40 | </v-layout> | 40 | </v-layout> |
41 | </v-flex> | 41 | </v-flex> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-flex xs12> | 43 | <v-flex xs12> |
44 | <v-card-actions> | 44 | <v-card-actions> |
45 | <v-spacer></v-spacer> | 45 | <v-spacer></v-spacer> |
46 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> | 46 | <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> |
47 | <v-spacer></v-spacer> | 47 | <v-spacer></v-spacer> |
48 | </v-card-actions> | 48 | </v-card-actions> |
49 | </v-flex> | 49 | </v-flex> |
50 | </v-layout> | 50 | </v-layout> |
51 | </v-card> | 51 | </v-card> |
52 | </v-flex> | 52 | </v-flex> |
53 | </v-dialog> | 53 | </v-dialog> |
54 | 54 | ||
55 | <!-- ****** PROFILE VIEW NOTIFICATION DEATILS ****** --> | 55 | <!-- ****** PROFILE VIEW NOTIFICATION DEATILS ****** --> |
56 | 56 | ||
57 | <v-dialog v-model="profileNotificationDialog" max-width="400px"> | 57 | <v-dialog v-model="profileNotificationDialog" max-width="400px"> |
58 | <v-card flat class="card-style pa-3" dark> | 58 | <v-card flat class="card-style pa-3" dark> |
59 | <v-layout> | 59 | <v-layout> |
60 | <v-flex xs12> | 60 | <v-flex xs12> |
61 | <label class="title text-xs-center">View Notification</label> | 61 | <label class="title text-xs-center">View Notification</label> |
62 | <v-icon size="24" class="right" @click="profileNotificationDialog = false">cancel</v-icon> | 62 | <v-icon size="24" class="right" @click="profileNotificationDialog = false">cancel</v-icon> |
63 | </v-flex> | 63 | </v-flex> |
64 | </v-layout> | 64 | </v-layout> |
65 | <v-card-text> | 65 | <v-card-text> |
66 | <v-container grid-list-md> | 66 | <v-container grid-list-md> |
67 | <v-layout wrap> | 67 | <v-layout wrap> |
68 | <v-flex xs12> | 68 | <v-flex xs12> |
69 | <v-layout> | 69 | <v-layout> |
70 | <v-flex xs4 sm6> | 70 | <v-flex xs4 sm6> |
71 | <h5 class="right my-1"> | 71 | <h5 class="right my-1"> |
72 | <b>Title:</b> | 72 | <b>Title:</b> |
73 | </h5> | 73 | </h5> |
74 | </v-flex> | 74 | </v-flex> |
75 | <v-flex sm6 xs8> | 75 | <v-flex sm6 xs8> |
76 | <h5 class="my-1">{{ editedItem.title }}</h5> | 76 | <h5 class="my-1">{{ editedItem.title }}</h5> |
77 | </v-flex> | 77 | </v-flex> |
78 | </v-layout> | 78 | </v-layout> |
79 | </v-flex> | 79 | </v-flex> |
80 | <v-layout> | 80 | <v-layout> |
81 | <v-flex xs4 sm6> | 81 | <v-flex xs4 sm6> |
82 | <h5 class="right my-1"> | 82 | <h5 class="right my-1"> |
83 | <b>Description:</b> | 83 | <b>Description:</b> |
84 | </h5> | 84 | </h5> |
85 | </v-flex> | 85 | </v-flex> |
86 | <v-flex sm6 xs8> | 86 | <v-flex sm6 xs8> |
87 | <h5 class="my-1">{{ editedItem.description }}</h5> | 87 | <h5 class="my-1">{{ editedItem.description }}</h5> |
88 | </v-flex> | 88 | </v-flex> |
89 | </v-layout> | 89 | </v-layout> |
90 | </v-layout> | 90 | </v-layout> |
91 | </v-container> | 91 | </v-container> |
92 | </v-card-text> | 92 | </v-card-text> |
93 | </v-card> | 93 | </v-card> |
94 | </v-dialog> | 94 | </v-dialog> |
95 | <!-- ****** NOTIFICATION TABLE ****** --> | 95 | <!-- ****** NOTIFICATION TABLE ****** --> |
96 | <v-toolbar color="transparent" flat> | 96 | <v-toolbar color="transparent" flat> |
97 | <v-btn | 97 | <v-btn |
98 | fab | 98 | fab |
99 | dark | 99 | dark |
100 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 100 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
101 | small | 101 | small |
102 | @click="addNotificationDialog = true" | 102 | @click="addNotificationDialog = true" |
103 | > | 103 | > |
104 | <v-icon dark>add</v-icon> | 104 | <v-icon dark>add</v-icon> |
105 | </v-btn> | 105 | </v-btn> |
106 | <v-btn | 106 | <v-btn |
107 | round | 107 | round |
108 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 108 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
109 | dark | 109 | dark |
110 | @click="addNotificationDialog = true" | 110 | @click="addNotificationDialog = true" |
111 | > | 111 | > |
112 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Notification | 112 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Notification |
113 | </v-btn> | 113 | </v-btn> |
114 | <v-spacer></v-spacer> | 114 | <v-spacer></v-spacer> |
115 | <v-card-title class="body-1" v-show="show"> | 115 | <v-card-title class="body-1" v-show="show"> |
116 | <v-btn icon large flat @click="displaySearch"> | 116 | <v-btn icon large flat @click="displaySearch"> |
117 | <v-avatar size="27"> | 117 | <v-avatar size="27"> |
118 | <img src="/static/icon/search.png" alt="icon" /> | 118 | <img src="/static/icon/search.png" alt="icon" /> |
119 | </v-avatar> | 119 | </v-avatar> |
120 | </v-btn> | 120 | </v-btn> |
121 | </v-card-title> | 121 | </v-card-title> |
122 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 122 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
123 | <v-layout> | 123 | <v-layout> |
124 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 124 | <v-text-field |
125 | autofocus | ||
126 | v-model="search" | ||
127 | label="Search" | ||
128 | prepend-inner-icon="search" | ||
129 | color="primary" | ||
130 | ></v-text-field> | ||
125 | <v-icon @click="closeSearch" color="error">close</v-icon> | 131 | <v-icon @click="closeSearch" color="error">close</v-icon> |
126 | </v-layout> | 132 | </v-layout> |
127 | </v-flex> | 133 | </v-flex> |
128 | </v-toolbar> | 134 | </v-toolbar> |
129 | <v-data-table | 135 | <v-data-table |
130 | :headers="headers" | 136 | :headers="headers" |
131 | :items="notifications" | 137 | :items="notifications" |
132 | :pagination.sync="pagination" | 138 | :pagination.sync="pagination" |
133 | :search="search" | 139 | :search="search" |
134 | > | 140 | > |
135 | <template slot="items" slot-scope="props"> | 141 | <template slot="items" slot-scope="props"> |
136 | <tr class="tr"> | 142 | <tr class="tr"> |
137 | <td class="td td-row">{{ props.index + 1}}</td> | 143 | <td class="td td-row">{{ props.index + 1}}</td> |
138 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> | 144 | <td class="td td-row text-xs-center">{{ props.item.title}}</td> |
139 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> | 145 | <td class="td td-row text-xs-center">{{ props.item.description}}</td> |
140 | <td class="td td-row text-xs-center"> | 146 | <td class="td td-row text-xs-center"> |
141 | <span> | 147 | <span> |
142 | <v-tooltip top> | 148 | <v-tooltip top> |
143 | <img | 149 | <img |
144 | slot="activator" | 150 | slot="activator" |
145 | style="cursor:pointer; width:25px; height:25px; " | 151 | style="cursor:pointer; width:25px; height:25px; " |
146 | class="mr-3" | 152 | class="mr-3" |
147 | @click="profile(props.item)" | 153 | @click="profile(props.item)" |
148 | src="/static/icon/view.png" | 154 | src="/static/icon/view.png" |
149 | /> | 155 | /> |
150 | <span>View</span> | 156 | <span>View</span> |
151 | </v-tooltip> | 157 | </v-tooltip> |
152 | <v-tooltip top> | 158 | <v-tooltip top> |
153 | <img | 159 | <img |
154 | slot="activator" | 160 | slot="activator" |
155 | style="cursor:pointer; width:20px; height:18px; " | 161 | style="cursor:pointer; width:20px; height:18px; " |
156 | class="mr-3" | 162 | class="mr-3" |
157 | @click="editItem(props.item)" | 163 | @click="editItem(props.item)" |
158 | src="/static/icon/edit.png" | 164 | src="/static/icon/edit.png" |
159 | /> | 165 | /> |
160 | <span>Edit</span> | 166 | <span>Edit</span> |
161 | </v-tooltip> | 167 | </v-tooltip> |
162 | <v-tooltip top> | 168 | <v-tooltip top> |
163 | <img | 169 | <img |
164 | slot="activator" | 170 | slot="activator" |
165 | style="cursor:pointer; width:20px; height:20px; " | 171 | style="cursor:pointer; width:20px; height:20px; " |
166 | class="mr-3" | 172 | class="mr-3" |
167 | @click="deleteItem(props.item)" | 173 | @click="deleteItem(props.item)" |
168 | src="/static/icon/delete.png" | 174 | src="/static/icon/delete.png" |
169 | /> | 175 | /> |
170 | <span>Delete</span> | 176 | <span>Delete</span> |
171 | </v-tooltip> | 177 | </v-tooltip> |
172 | </span> | 178 | </span> |
173 | </td> | 179 | </td> |
174 | </tr> | 180 | </tr> |
175 | </template> | 181 | </template> |
176 | <v-alert | 182 | <v-alert |
177 | slot="no-results" | 183 | slot="no-results" |
178 | :value="true" | 184 | :value="true" |
179 | color="error" | 185 | color="error" |
180 | icon="warning" | 186 | icon="warning" |
181 | >Your search for "{{ search }}" found no results.</v-alert> | 187 | >Your search for "{{ search }}" found no results.</v-alert> |
182 | </v-data-table> | 188 | </v-data-table> |
183 | 189 | ||
184 | <!-- ****** ADD MULTIPLE NOTIFICATION ****** --> | 190 | <!-- ****** ADD MULTIPLE NOTIFICATION ****** --> |
185 | <v-dialog v-model="addNotificationDialog" max-width="480px"> | 191 | <v-dialog v-model="addNotificationDialog" max-width="480px" v-if="addNotificationDialog"> |
186 | <v-card flat class="card-style pa-2" dark> | 192 | <v-card flat class="card-style pa-2" dark> |
187 | <v-layout> | 193 | <v-layout> |
188 | <v-flex xs12> | 194 | <v-flex xs12> |
189 | <label class="title text-xs-center">Add Notification</label> | 195 | <label class="title text-xs-center">Add Notification</label> |
190 | <v-icon size="24" class="right" @click="addNotificationDialog = false">cancel</v-icon> | 196 | <v-icon size="24" class="right" @click="closeAddNotificationModel">cancel</v-icon> |
191 | </v-flex> | 197 | </v-flex> |
192 | </v-layout> | 198 | </v-layout> |
193 | <v-form ref="form" v-model="valid" lazy-validation> | 199 | <v-form ref="form" v-model="valid" lazy-validation> |
194 | <v-container fluid fill-height> | 200 | <v-container fluid fill-height> |
195 | <v-layout align-center wrap> | 201 | <v-layout align-center wrap> |
196 | <v-flex xs12> | 202 | <v-flex xs12> |
197 | <v-layout> | 203 | <v-layout> |
198 | <v-flex xs4 class="pt-4 subheading"> | 204 | <v-flex xs4 class="pt-4 subheading"> |
199 | <label class="right">Title:</label> | 205 | <label class="right">Title:</label> |
200 | </v-flex> | 206 | </v-flex> |
201 | <v-flex xs8 sm8 class="ml-3"> | 207 | <v-flex xs8 sm8 class="ml-3"> |
202 | <v-text-field | 208 | <v-text-field |
203 | v-model="addNotification.title" | 209 | v-model="addNotification.title" |
204 | placeholder="fill your Title" | 210 | placeholder="fill your Title" |
205 | type="text" | 211 | type="text" |
206 | :rules="titleRules" | 212 | :rules="titleRules" |
207 | required | 213 | required |
208 | ></v-text-field> | 214 | ></v-text-field> |
209 | </v-flex> | 215 | </v-flex> |
210 | </v-layout> | 216 | </v-layout> |
211 | </v-flex> | 217 | </v-flex> |
212 | <v-flex xs12> | 218 | <v-flex xs12> |
213 | <v-layout> | 219 | <v-layout> |
214 | <v-flex xs4 class="pt-4 subheading"> | 220 | <v-flex xs4 class="pt-4 subheading"> |
215 | <label class="right">Description:</label> | 221 | <label class="right">Description:</label> |
216 | </v-flex> | 222 | </v-flex> |
217 | <v-flex xs8 sm8 class="ml-3"> | 223 | <v-flex xs8 sm8 class="ml-3"> |
218 | <v-text-field | 224 | <v-text-field |
219 | placeholder="fill your Description" | 225 | placeholder="fill your Description" |
220 | :rules="descriptionRules" | 226 | :rules="descriptionRules" |
221 | v-model="addNotification.description" | 227 | v-model="addNotification.description" |
222 | type="text" | 228 | type="text" |
223 | required | 229 | required |
224 | ></v-text-field> | 230 | ></v-text-field> |
225 | </v-flex> | 231 | </v-flex> |
226 | </v-layout> | 232 | </v-layout> |
227 | </v-flex> | 233 | </v-flex> |
228 | <v-layout> | 234 | <v-layout> |
229 | <v-flex xs12 sm12> | 235 | <v-flex xs12 sm12> |
230 | <v-layout class="hidden-xs-only hidden-sm-only right"> | 236 | <v-layout class="hidden-xs-only hidden-sm-only right"> |
231 | <v-btn @click="clear" round class="clear-button" dark>Clear</v-btn> | 237 | <v-btn @click="clear" round class="clear-button" dark>Clear</v-btn> |
232 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 238 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
233 | </v-layout> | 239 | </v-layout> |
234 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> | 240 | <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> |
235 | <v-spacer></v-spacer> | 241 | <v-spacer></v-spacer> |
236 | <v-btn @click="clear" round class="clear-button" dark>Clear</v-btn> | 242 | <v-btn @click="clear" round class="clear-button" dark>Clear</v-btn> |
237 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 243 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
238 | <v-spacer></v-spacer> | 244 | <v-spacer></v-spacer> |
239 | </v-card-actions> | 245 | </v-card-actions> |
240 | </v-flex> | 246 | </v-flex> |
241 | </v-layout> | 247 | </v-layout> |
242 | </v-layout> | 248 | </v-layout> |
243 | </v-container> | 249 | </v-container> |
244 | </v-form> | 250 | </v-form> |
245 | </v-card> | 251 | </v-card> |
246 | </v-dialog> | 252 | </v-dialog> |
247 | <v-snackbar | 253 | <v-snackbar |
248 | :timeout="timeout" | 254 | :timeout="timeout" |
249 | :top="y === 'top'" | 255 | :top="y === 'top'" |
250 | :right="x === 'right'" | 256 | :right="x === 'right'" |
251 | :vertical="mode === 'vertical'" | 257 | :vertical="mode === 'vertical'" |
252 | v-model="snackbar" | 258 | v-model="snackbar" |
253 | :color="color" | 259 | :color="color" |
254 | >{{ text }}</v-snackbar> | 260 | >{{ text }}</v-snackbar> |
255 | <div class="loader" v-if="showLoader"> | 261 | <div class="loader" v-if="showLoader"> |
256 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 262 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
257 | </div> | 263 | </div> |
258 | </v-container> | 264 | </v-container> |
259 | </template> | 265 | </template> |
260 | 266 | ||
261 | <script> | 267 | <script> |
262 | import http from "@/Services/http.js"; | 268 | import http from "@/Services/http.js"; |
263 | import Util from "@/util"; | 269 | import Util from "@/util"; |
264 | 270 | ||
265 | export default { | 271 | export default { |
266 | data: () => ({ | 272 | data: () => ({ |
267 | snackbar: false, | 273 | snackbar: false, |
268 | y: "top", | 274 | y: "top", |
269 | x: "right", | 275 | x: "right", |
270 | mode: "", | 276 | mode: "", |
271 | timeout: 3000, | 277 | timeout: 3000, |
272 | text: "", | 278 | text: "", |
273 | loading: false, | 279 | loading: false, |
274 | editLoading: false, | 280 | editLoading: false, |
275 | date: null, | 281 | date: null, |
276 | search: "", | 282 | search: "", |
277 | color: "", | 283 | color: "", |
278 | show: true, | 284 | show: true, |
279 | showSearch: false, | 285 | showSearch: false, |
280 | showLoader: false, | 286 | showLoader: false, |
281 | profileNotificationDialog: false, | 287 | profileNotificationDialog: false, |
282 | editNotificationDialog: false, | 288 | editNotificationDialog: false, |
283 | valid: true, | 289 | valid: true, |
284 | addNotificationDialog: false, | 290 | addNotificationDialog: false, |
285 | pagination: { | 291 | pagination: { |
286 | rowsPerPage: 10 | 292 | rowsPerPage: 10, |
287 | }, | 293 | }, |
288 | imageData: {}, | 294 | imageData: {}, |
289 | imageName: "", | 295 | imageName: "", |
290 | imageUrl: "", | 296 | imageUrl: "", |
291 | imageFile: "", | 297 | imageFile: "", |
292 | titleRules: [v => !!v || " Tilte is required"], | 298 | titleRules: [(v) => !!v || " Tilte is required"], |
293 | descriptionRules: [v => !!v || " Description is required"], | 299 | descriptionRules: [(v) => !!v || " Description is required"], |
294 | headers: [ | 300 | headers: [ |
295 | { | 301 | { |
296 | text: "No", | 302 | text: "No", |
297 | align: "", | 303 | align: "", |
298 | sortable: false, | 304 | sortable: false, |
299 | value: "No" | 305 | value: "No", |
300 | }, | 306 | }, |
301 | { text: "Title", value: "title", sortable: false, align: "center" }, | 307 | { text: "Title", value: "title", sortable: false, align: "center" }, |
302 | { | 308 | { |
303 | text: "Description", | 309 | text: "Description", |
304 | value: "description", | 310 | value: "description", |
305 | sortable: false, | 311 | sortable: false, |
306 | align: "center" | 312 | align: "center", |
307 | }, | 313 | }, |
308 | { text: "Action", value: "", sortable: false, align: "center" } | 314 | { text: "Action", value: "", sortable: false, align: "center" }, |
309 | ], | 315 | ], |
310 | notifications: [], | 316 | notifications: [], |
311 | editedIndex: -1, | 317 | editedIndex: -1, |
312 | addNotification: { | 318 | addNotification: { |
313 | title: "", | 319 | title: "", |
314 | description: "" | 320 | description: "", |
315 | }, | 321 | }, |
316 | editedItem: { | 322 | editedItem: { |
317 | title: "", | 323 | title: "", |
318 | description: "" | 324 | description: "", |
319 | } | 325 | }, |
320 | }), | 326 | }), |
327 | watch: { | ||
328 | addNotificationDialog: function (val) { | ||
329 | if (!val) { | ||
330 | this.addNotification = []; | ||
331 | } | ||
332 | }, | ||
333 | }, | ||
321 | methods: { | 334 | methods: { |
322 | pickFile() { | 335 | pickFile() { |
323 | this.$refs.image.click(); | 336 | this.$refs.image.click(); |
324 | }, | 337 | }, |
325 | 338 | ||
326 | onFilePicked(e) { | 339 | onFilePicked(e) { |
327 | const files = e.target.files; | 340 | const files = e.target.files; |
328 | this.imageData.upload = e.target.files[0]; | 341 | this.imageData.upload = e.target.files[0]; |
329 | if (files[0] !== undefined) { | 342 | if (files[0] !== undefined) { |
330 | this.imageName = files[0].name; | 343 | this.imageName = files[0].name; |
331 | if (this.imageName.lastIndexOf(".") <= 0) { | 344 | if (this.imageName.lastIndexOf(".") <= 0) { |
332 | return; | 345 | return; |
333 | } | 346 | } |
334 | const fr = new FileReader(); | 347 | const fr = new FileReader(); |
335 | fr.readAsDataURL(files[0]); | 348 | fr.readAsDataURL(files[0]); |
336 | fr.addEventListener("load", () => { | 349 | fr.addEventListener("load", () => { |
337 | this.imageUrl = fr.result; | 350 | this.imageUrl = fr.result; |
338 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 351 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
339 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 352 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
340 | }); | 353 | }); |
341 | } else { | 354 | } else { |
342 | this.imageName = ""; | 355 | this.imageName = ""; |
343 | this.imageFile = ""; | 356 | this.imageFile = ""; |
344 | this.imageUrl = ""; | 357 | this.imageUrl = ""; |
345 | } | 358 | } |
346 | }, | 359 | }, |
347 | getNotifications() { | 360 | getNotifications() { |
348 | this.showLoader = true; | 361 | this.showLoader = true; |
349 | var token = this.$store.state.token; | 362 | var token = this.$store.state.token; |
350 | http() | 363 | http() |
351 | .get("/getNotificationsList", { | 364 | .get("/getNotificationsList", { |
352 | headers: { Authorization: "Bearer " + token } | 365 | headers: { Authorization: "Bearer " + token }, |
353 | }) | 366 | }) |
354 | .then(response => { | 367 | .then((response) => { |
355 | this.notifications = response.data.data; | 368 | this.notifications = response.data.data; |
356 | this.showLoader = false; | 369 | this.showLoader = false; |
357 | }) | 370 | }) |
358 | .catch(error => { | 371 | .catch((error) => { |
359 | this.showLoader = false; | 372 | this.showLoader = false; |
360 | if (error.response.status === 401) { | 373 | if (error.response.status === 401) { |
361 | this.$router.replace({ path: "/" }); | 374 | this.$router.replace({ path: "/" }); |
362 | this.$store.dispatch("setToken", null); | 375 | this.$store.dispatch("setToken", null); |
363 | this.$store.dispatch("Id", null); | 376 | this.$store.dispatch("Id", null); |
364 | } | 377 | } |
365 | }); | 378 | }); |
366 | }, | 379 | }, |
367 | editItem(item) { | 380 | editItem(item) { |
368 | this.editedIndex = this.notifications.indexOf(item); | 381 | this.editedIndex = this.notifications.indexOf(item); |
369 | this.editedItem = Object.assign({}, item); | 382 | this.editedItem = Object.assign({}, item); |
370 | this.editNotificationDialog = true; | 383 | this.editNotificationDialog = true; |
371 | }, | 384 | }, |
372 | profile(item) { | 385 | profile(item) { |
373 | this.editedIndex = this.notifications.indexOf(item); | 386 | this.editedIndex = this.notifications.indexOf(item); |
374 | this.editedItem = Object.assign({}, item); | 387 | this.editedItem = Object.assign({}, item); |
375 | this.profileNotificationDialog = true; | 388 | this.profileNotificationDialog = true; |
376 | }, | 389 | }, |
377 | 390 | ||
378 | deleteItem(item) { | 391 | deleteItem(item) { |
379 | let deleteNotification = { | 392 | let deleteNotification = { |
380 | notificationId: item._id | 393 | notificationId: item._id, |
381 | }; | 394 | }; |
382 | http() | 395 | http() |
383 | .delete( | 396 | .delete( |
384 | "/deleteNotification", | 397 | "/deleteNotification", |
385 | confirm("Are you sure you want to delete this?") && { | 398 | confirm("Are you sure you want to delete this?") && { |
386 | params: deleteNotification | 399 | params: deleteNotification, |
387 | } | 400 | } |
388 | ) | 401 | ) |
389 | .then(response => { | 402 | .then((response) => { |
390 | this.snackbar = true; | 403 | this.snackbar = true; |
391 | this.text = response.data.message; | 404 | this.text = response.data.message; |
392 | this.color = "green"; | 405 | this.color = "green"; |
393 | this.getNotifications(); | 406 | this.getNotifications(); |
394 | }) | 407 | }) |
395 | .catch(error => { | 408 | .catch((error) => { |
396 | this.snackbar = true; | 409 | this.snackbar = true; |
397 | this.text = error.response.data.message; | 410 | this.text = error.response.data.message; |
398 | this.color = "error"; | 411 | this.color = "error"; |
399 | }); | 412 | }); |
400 | }, | 413 | }, |
401 | close() { | 414 | close() { |
402 | this.editNotificationDialog = false; | 415 | this.editNotificationDialog = false; |
403 | }, | 416 | }, |
404 | closeNotificationDialog() { | 417 | closeNotificationDialog() { |
405 | this.profileNotificationDialog = false; | 418 | this.profileNotificationDialog = false; |
406 | }, | 419 | }, |
420 | closeAddNotificationModel() { | ||
421 | this.addNotificationDialog = false; | ||
422 | this.addNotification = []; | ||
423 | }, | ||
407 | submit() { | 424 | submit() { |
408 | if (this.$refs.form.validate()) { | 425 | if (this.$refs.form.validate()) { |
409 | let imageData = new FormData(); | 426 | let imageData = new FormData(); |
410 | imageData.append("upload", this.imageFile); | 427 | imageData.append("upload", this.imageFile); |
411 | let create = { | 428 | let create = { |
412 | title: this.addNotification.title, | 429 | title: this.addNotification.title, |
413 | description: this.addNotification.description | 430 | description: this.addNotification.description, |
414 | }; | 431 | }; |
415 | this.loading = true; | 432 | this.loading = true; |
416 | http() | 433 | http() |
417 | .post("/createNotification", create) | 434 | .post("/createNotification", create) |
418 | .then(response => { | 435 | .then((response) => { |
419 | this.snackbar = true; | 436 | this.snackbar = true; |
420 | this.text = response.data.message; | 437 | this.text = response.data.message; |
421 | this.color = "green"; | 438 | this.color = "green"; |
422 | this.getNotifications(); | 439 | this.getNotifications(); |
423 | this.addNotificationDialog = false; | 440 | this.addNotificationDialog = false; |
424 | this.clear(); | 441 | this.clear(); |
425 | this.loading = false; | 442 | this.loading = false; |
426 | }) | 443 | }) |
427 | .catch(error => { | 444 | .catch((error) => { |
428 | this.snackbar = true; | 445 | this.snackbar = true; |
429 | this.text = error.response.data.message; | 446 | this.text = error.response.data.message; |
430 | this.color = "error"; | 447 | this.color = "error"; |
431 | this.loading = false; | 448 | this.loading = false; |
432 | }); | 449 | }); |
433 | } | 450 | } |
434 | }, | 451 | }, |
435 | clear() { | 452 | clear() { |
436 | this.$refs.form.reset(); | 453 | this.$refs.form.reset(); |
437 | }, | 454 | }, |
438 | save() { | 455 | save() { |
439 | let imageData = new FormData(); | 456 | let imageData = new FormData(); |
440 | imageData.append("upload", this.imageFile); | 457 | imageData.append("upload", this.imageFile); |
441 | let editNotification = { | 458 | let editNotification = { |
442 | notificationId: this.editedItem._id, | 459 | notificationId: this.editedItem._id, |
443 | title: this.editedItem.title, | 460 | title: this.editedItem.title, |
444 | description: this.editedItem.description | 461 | description: this.editedItem.description, |
445 | }; | 462 | }; |
446 | this.editLoading = true; | 463 | this.editLoading = true; |
447 | http() | 464 | http() |
448 | .put("/updateNotification", editNotification) | 465 | .put("/updateNotification", editNotification) |
449 | .then(response => { | 466 | .then((response) => { |
450 | this.snackbar = true; | 467 | this.snackbar = true; |
451 | this.text = response.data.message; | 468 | this.text = response.data.message; |
452 | this.color = "green"; | 469 | this.color = "green"; |
453 | this.getNotifications(); | 470 | this.getNotifications(); |
454 | this.close(); | 471 | this.close(); |
455 | this.editLoading = false; | 472 | this.editLoading = false; |
456 | }) | 473 | }) |
457 | .catch(error => { | 474 | .catch((error) => { |
458 | this.editLoading = false; | 475 | this.editLoading = false; |
459 | this.snackbar = true; | 476 | this.snackbar = true; |
460 | this.color = "error"; | 477 | this.color = "error"; |
461 | this.text = error.response.data.message; | 478 | this.text = error.response.data.message; |
462 | }); | 479 | }); |
463 | }, | 480 | }, |
464 | displaySearch() { | 481 | displaySearch() { |
465 | (this.show = false), (this.showSearch = true); | 482 | (this.show = false), (this.showSearch = true); |
466 | }, | 483 | }, |
467 | closeSearch() { | 484 | closeSearch() { |
468 | this.showSearch = false; | 485 | this.showSearch = false; |
469 | this.show = true; | 486 | this.show = true; |
470 | this.search = ""; | 487 | this.search = ""; |
471 | } | 488 | }, |
472 | }, | 489 | }, |
473 | mounted() { | 490 | mounted() { |
474 | this.getNotifications(); | 491 | this.getNotifications(); |
475 | } | 492 | }, |
476 | }; | 493 | }; |
477 | </script> | 494 | </script> |
src/pages/Parent/parents.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <v-dialog v-model="editParentDilaog" max-width="600px" scrollable> | 3 | <v-dialog v-model="editParentDilaog" max-width="600px" scrollable> |
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 Parents Details</label> | 7 | <label class="title text-xs-center">Edit Parents Details</label> |
8 | <v-icon size="24" class="right" @click="editParentDilaog = false">cancel</v-icon> | 8 | <v-icon size="24" class="right" @click="editParentDilaog = false">cancel</v-icon> |
9 | </v-flex> | 9 | </v-flex> |
10 | </v-layout> | 10 | </v-layout> |
11 | <v-card-text class="hidden-xs-only hidden-sm-only"> | 11 | <v-card-text class="hidden-xs-only hidden-sm-only"> |
12 | <v-form ref="editParentForm" v-model="validEditParent" lazy-validation> | 12 | <v-form ref="editParentForm" v-model="validEditParent" lazy-validation> |
13 | <v-flex xs12> | 13 | <v-flex xs12> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs3 sm4 class="pt-4 subheading"> | 15 | <v-flex xs3 sm4 class="pt-4 subheading"> |
16 | <label class="right">Email ID:</label> | 16 | <label class="right">Email ID:</label> |
17 | </v-flex> | 17 | </v-flex> |
18 | <v-flex xs8 sm6 class="ml-3"> | 18 | <v-flex xs8 sm6 class="ml-3"> |
19 | <v-text-field | 19 | <v-text-field |
20 | placeholder="fill your email" | 20 | placeholder="fill your email" |
21 | v-model="editedItem.email" | 21 | v-model="editedItem.email" |
22 | type="text" | 22 | type="text" |
23 | name="email" | 23 | name="email" |
24 | required | 24 | required |
25 | ></v-text-field> | 25 | ></v-text-field> |
26 | </v-flex> | 26 | </v-flex> |
27 | </v-layout> | 27 | </v-layout> |
28 | </v-flex> | 28 | </v-flex> |
29 | <v-flex xs12> | 29 | <v-flex xs12> |
30 | <v-layout> | 30 | <v-layout> |
31 | <v-flex xs3 sm4 class="pt-4 subheading"> | 31 | <v-flex xs3 sm4 class="pt-4 subheading"> |
32 | <label class="right">Father Name:</label> | 32 | <label class="right">Father Name:</label> |
33 | </v-flex> | 33 | </v-flex> |
34 | <v-flex xs8 sm6 class="ml-3"> | 34 | <v-flex xs8 sm6 class="ml-3"> |
35 | <v-text-field | 35 | <v-text-field |
36 | v-model="editedItem.fatherName" | 36 | v-model="editedItem.fatherName" |
37 | placeholder="fill your father Name" | 37 | placeholder="fill your father Name" |
38 | required | 38 | required |
39 | ></v-text-field> | 39 | ></v-text-field> |
40 | </v-flex> | 40 | </v-flex> |
41 | </v-layout> | 41 | </v-layout> |
42 | </v-flex> | 42 | </v-flex> |
43 | <v-flex xs12> | 43 | <v-flex xs12> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs3 sm4 class="pt-4 subheading"> | 45 | <v-flex xs3 sm4 class="pt-4 subheading"> |
46 | <label class="right">Father Cell No:</label> | 46 | <label class="right">Father Cell No:</label> |
47 | </v-flex> | 47 | </v-flex> |
48 | <v-flex xs8 sm6 class="ml-3"> | 48 | <v-flex xs8 sm6 class="ml-3"> |
49 | <v-text-field | 49 | <v-text-field |
50 | v-model="editedItem.fatherCellNo" | 50 | v-model="editedItem.fatherCellNo" |
51 | placeholder="fill your father Cell Number" | 51 | placeholder="fill your father Cell Number" |
52 | :rules="editFatherNoRule" | 52 | :rules="editFatherNoRule" |
53 | type="number" | 53 | type="number" |
54 | required | 54 | required |
55 | ></v-text-field> | 55 | ></v-text-field> |
56 | </v-flex> | 56 | </v-flex> |
57 | </v-layout> | 57 | </v-layout> |
58 | </v-flex> | 58 | </v-flex> |
59 | <v-flex xs12> | 59 | <v-flex xs12> |
60 | <v-layout> | 60 | <v-layout> |
61 | <v-flex xs3 sm4 class="pt-4 subheading"> | 61 | <v-flex xs3 sm4 class="pt-4 subheading"> |
62 | <label class="right">Father Profession:</label> | 62 | <label class="right">Father Profession:</label> |
63 | </v-flex> | 63 | </v-flex> |
64 | <v-flex xs8 sm6 class="ml-3"> | 64 | <v-flex xs8 sm6 class="ml-3"> |
65 | <v-text-field | 65 | <v-text-field |
66 | v-model="editedItem.fatherProfession" | 66 | v-model="editedItem.fatherProfession" |
67 | placeholder="fill your father Profession" | 67 | placeholder="fill your father Profession" |
68 | required | 68 | required |
69 | ></v-text-field> | 69 | ></v-text-field> |
70 | </v-flex> | 70 | </v-flex> |
71 | </v-layout> | 71 | </v-layout> |
72 | </v-flex> | 72 | </v-flex> |
73 | <v-flex xs12> | 73 | <v-flex xs12> |
74 | <v-layout> | 74 | <v-layout> |
75 | <v-flex xs3 sm4 class="pt-4 subheading"> | 75 | <v-flex xs3 sm4 class="pt-4 subheading"> |
76 | <label class="right">Mother Name:</label> | 76 | <label class="right">Mother Name:</label> |
77 | </v-flex> | 77 | </v-flex> |
78 | <v-flex xs8 sm6 class="ml-3"> | 78 | <v-flex xs8 sm6 class="ml-3"> |
79 | <v-text-field | 79 | <v-text-field |
80 | v-model="editedItem.motherName" | 80 | v-model="editedItem.motherName" |
81 | placeholder="fill your Mother Name" | 81 | placeholder="fill your Mother Name" |
82 | type="text" | 82 | type="text" |
83 | required | 83 | required |
84 | ></v-text-field> | 84 | ></v-text-field> |
85 | </v-flex> | 85 | </v-flex> |
86 | </v-layout> | 86 | </v-layout> |
87 | </v-flex> | 87 | </v-flex> |
88 | <v-flex xs12> | 88 | <v-flex xs12> |
89 | <v-layout> | 89 | <v-layout> |
90 | <v-flex xs3 sm4 class="pt-4 subheading"> | 90 | <v-flex xs3 sm4 class="pt-4 subheading"> |
91 | <label class="right">Mother Cell No:</label> | 91 | <label class="right">Mother Cell No:</label> |
92 | </v-flex> | 92 | </v-flex> |
93 | <v-flex xs8 sm6 class="ml-3"> | 93 | <v-flex xs8 sm6 class="ml-3"> |
94 | <v-text-field | 94 | <v-text-field |
95 | v-model="editedItem.motherCellNo" | 95 | v-model="editedItem.motherCellNo" |
96 | placeholder="fill your Mother Cell Number" | 96 | placeholder="fill your Mother Cell Number" |
97 | type="number" | 97 | type="number" |
98 | required | 98 | required |
99 | ></v-text-field> | 99 | ></v-text-field> |
100 | </v-flex> | 100 | </v-flex> |
101 | </v-layout> | 101 | </v-layout> |
102 | </v-flex> | 102 | </v-flex> |
103 | <v-flex xs12> | 103 | <v-flex xs12> |
104 | <v-layout> | 104 | <v-layout> |
105 | <v-flex xs3 sm4 class="pt-4 subheading"> | 105 | <v-flex xs3 sm4 class="pt-4 subheading"> |
106 | <label class="right">Mother Profession:</label> | 106 | <label class="right">Mother Profession:</label> |
107 | </v-flex> | 107 | </v-flex> |
108 | <v-flex xs8 sm6 class="ml-3"> | 108 | <v-flex xs8 sm6 class="ml-3"> |
109 | <v-text-field | 109 | <v-text-field |
110 | v-model="editedItem.motherProfession" | 110 | v-model="editedItem.motherProfession" |
111 | placeholder="fill your Mother Profession" | 111 | placeholder="fill your Mother Profession" |
112 | type="text" | 112 | type="text" |
113 | required | 113 | required |
114 | ></v-text-field> | 114 | ></v-text-field> |
115 | </v-flex> | 115 | </v-flex> |
116 | </v-layout> | 116 | </v-layout> |
117 | <v-layout> | 117 | <v-layout> |
118 | <v-flex xs4 class="pt-4 subheading"> | 118 | <v-flex xs4 class="pt-4 subheading"> |
119 | <label class="right">Password:</label> | 119 | <label class="right">Password:</label> |
120 | </v-flex> | 120 | </v-flex> |
121 | <v-flex xs8 class="ml-3"> | 121 | <v-flex xs8 class="ml-3"> |
122 | <v-text-field | 122 | <v-text-field |
123 | v-model="editedItem.password" | 123 | v-model="editedItem.password" |
124 | placeholder="Enter Password" | 124 | placeholder="Enter Password" |
125 | type="text" | 125 | type="text" |
126 | required | 126 | required |
127 | ></v-text-field> | 127 | ></v-text-field> |
128 | </v-flex> | 128 | </v-flex> |
129 | </v-layout> | 129 | </v-layout> |
130 | </v-flex> | 130 | </v-flex> |
131 | <v-layout> | 131 | <v-layout> |
132 | <v-flex xs12 sm12> | 132 | <v-flex xs12 sm12> |
133 | <v-card-actions> | 133 | <v-card-actions> |
134 | <v-spacer></v-spacer> | 134 | <v-spacer></v-spacer> |
135 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 135 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
136 | <v-spacer></v-spacer> | 136 | <v-spacer></v-spacer> |
137 | </v-card-actions> | 137 | </v-card-actions> |
138 | </v-flex> | 138 | </v-flex> |
139 | </v-layout> | 139 | </v-layout> |
140 | </v-form> | 140 | </v-form> |
141 | </v-card-text> | 141 | </v-card-text> |
142 | <v-card-text style="height: 600px;" class="hidden-lg-only hidden-xl-only hidden-md-only"> | 142 | <v-card-text style="height: 600px;" class="hidden-lg-only hidden-xl-only hidden-md-only"> |
143 | <v-flex xs12> | 143 | <v-flex xs12> |
144 | <v-layout wrap> | 144 | <v-layout wrap> |
145 | <v-flex xs12 class="pt-4 subheading"> | 145 | <v-flex xs12 class="pt-4 subheading"> |
146 | <label>Email ID:</label> | 146 | <label>Email ID:</label> |
147 | </v-flex> | 147 | </v-flex> |
148 | <v-flex xs12> | 148 | <v-flex xs12> |
149 | <v-text-field | 149 | <v-text-field |
150 | placeholder="fill your email" | 150 | placeholder="fill your email" |
151 | v-model="editedItem.email" | 151 | v-model="editedItem.email" |
152 | type="text" | 152 | type="text" |
153 | name="email" | 153 | name="email" |
154 | required | 154 | required |
155 | ></v-text-field> | 155 | ></v-text-field> |
156 | </v-flex> | 156 | </v-flex> |
157 | </v-layout> | 157 | </v-layout> |
158 | </v-flex> | 158 | </v-flex> |
159 | <v-flex xs12> | 159 | <v-flex xs12> |
160 | <v-layout wrap> | 160 | <v-layout wrap> |
161 | <v-flex xs12 class="pt-4 subheading"> | 161 | <v-flex xs12 class="pt-4 subheading"> |
162 | <label>Father Name:</label> | 162 | <label>Father Name:</label> |
163 | </v-flex> | 163 | </v-flex> |
164 | <v-flex xs12> | 164 | <v-flex xs12> |
165 | <v-text-field | 165 | <v-text-field |
166 | v-model="editedItem.fatherName" | 166 | v-model="editedItem.fatherName" |
167 | placeholder="fill your father Name" | 167 | placeholder="fill your father Name" |
168 | required | 168 | required |
169 | ></v-text-field> | 169 | ></v-text-field> |
170 | </v-flex> | 170 | </v-flex> |
171 | </v-layout> | 171 | </v-layout> |
172 | </v-flex> | 172 | </v-flex> |
173 | <v-flex xs12> | 173 | <v-flex xs12> |
174 | <v-layout wrap> | 174 | <v-layout wrap> |
175 | <v-flex xs12 class="pt-4 subheading"> | 175 | <v-flex xs12 class="pt-4 subheading"> |
176 | <label>Father Cell No:</label> | 176 | <label>Father Cell No:</label> |
177 | </v-flex> | 177 | </v-flex> |
178 | <v-flex xs12> | 178 | <v-flex xs12> |
179 | <v-text-field | 179 | <v-text-field |
180 | v-model="editedItem.fatherCellNo" | 180 | v-model="editedItem.fatherCellNo" |
181 | placeholder="fill your father Cell Number" | 181 | placeholder="fill your father Cell Number" |
182 | type="number" | 182 | type="number" |
183 | required | 183 | required |
184 | ></v-text-field> | 184 | ></v-text-field> |
185 | </v-flex> | 185 | </v-flex> |
186 | </v-layout> | 186 | </v-layout> |
187 | </v-flex> | 187 | </v-flex> |
188 | <v-flex xs12> | 188 | <v-flex xs12> |
189 | <v-layout wrap> | 189 | <v-layout wrap> |
190 | <v-flex xs12 class="pt-4 subheading"> | 190 | <v-flex xs12 class="pt-4 subheading"> |
191 | <label>Father Profession:</label> | 191 | <label>Father Profession:</label> |
192 | </v-flex> | 192 | </v-flex> |
193 | <v-flex xs12> | 193 | <v-flex xs12> |
194 | <v-text-field | 194 | <v-text-field |
195 | v-model="editedItem.fatherProfession" | 195 | v-model="editedItem.fatherProfession" |
196 | placeholder="fill your father Profession" | 196 | placeholder="fill your father Profession" |
197 | required | 197 | required |
198 | ></v-text-field> | 198 | ></v-text-field> |
199 | </v-flex> | 199 | </v-flex> |
200 | </v-layout> | 200 | </v-layout> |
201 | </v-flex> | 201 | </v-flex> |
202 | <v-flex xs12> | 202 | <v-flex xs12> |
203 | <v-layout wrap> | 203 | <v-layout wrap> |
204 | <v-flex xs12 class="pt-4 subheading"> | 204 | <v-flex xs12 class="pt-4 subheading"> |
205 | <label>Mother Name:</label> | 205 | <label>Mother Name:</label> |
206 | </v-flex> | 206 | </v-flex> |
207 | <v-flex xs12> | 207 | <v-flex xs12> |
208 | <v-text-field | 208 | <v-text-field |
209 | v-model="editedItem.motherName" | 209 | v-model="editedItem.motherName" |
210 | placeholder="fill your Mother Name" | 210 | placeholder="fill your Mother Name" |
211 | type="text" | 211 | type="text" |
212 | required | 212 | required |
213 | ></v-text-field> | 213 | ></v-text-field> |
214 | </v-flex> | 214 | </v-flex> |
215 | </v-layout> | 215 | </v-layout> |
216 | </v-flex> | 216 | </v-flex> |
217 | <v-flex xs12> | 217 | <v-flex xs12> |
218 | <v-layout wrap> | 218 | <v-layout wrap> |
219 | <v-flex xs12 class="pt-4 subheading"> | 219 | <v-flex xs12 class="pt-4 subheading"> |
220 | <label>Mother Cell No:</label> | 220 | <label>Mother Cell No:</label> |
221 | </v-flex> | 221 | </v-flex> |
222 | <v-flex xs12> | 222 | <v-flex xs12> |
223 | <v-text-field | 223 | <v-text-field |
224 | v-model="editedItem.motherCellNo" | 224 | v-model="editedItem.motherCellNo" |
225 | placeholder="fill your Mother Cell Number" | 225 | placeholder="fill your Mother Cell Number" |
226 | type="number" | 226 | type="number" |
227 | required | 227 | required |
228 | ></v-text-field> | 228 | ></v-text-field> |
229 | </v-flex> | 229 | </v-flex> |
230 | </v-layout> | 230 | </v-layout> |
231 | </v-flex> | 231 | </v-flex> |
232 | <v-flex xs12> | 232 | <v-flex xs12> |
233 | <v-layout wrap> | 233 | <v-layout wrap> |
234 | <v-flex xs12 class="pt-4 subheading"> | 234 | <v-flex xs12 class="pt-4 subheading"> |
235 | <label>Mother Profession:</label> | 235 | <label>Mother Profession:</label> |
236 | </v-flex> | 236 | </v-flex> |
237 | <v-flex xs12> | 237 | <v-flex xs12> |
238 | <v-text-field | 238 | <v-text-field |
239 | v-model="editedItem.motherProfession" | 239 | v-model="editedItem.motherProfession" |
240 | placeholder="fill your Mother Profession" | 240 | placeholder="fill your Mother Profession" |
241 | type="text" | 241 | type="text" |
242 | required | 242 | required |
243 | ></v-text-field> | 243 | ></v-text-field> |
244 | </v-flex> | 244 | </v-flex> |
245 | <v-flex xs12 class="pt-4 subheading"> | 245 | <v-flex xs12 class="pt-4 subheading"> |
246 | <label>Password:</label> | 246 | <label>Password:</label> |
247 | </v-flex> | 247 | </v-flex> |
248 | <v-flex xs12> | 248 | <v-flex xs12> |
249 | <v-text-field | 249 | <v-text-field |
250 | v-model="editedItem.password" | 250 | v-model="editedItem.password" |
251 | placeholder="Enter Password" | 251 | placeholder="Enter Password" |
252 | type="text" | 252 | type="text" |
253 | required | 253 | required |
254 | ></v-text-field> | 254 | ></v-text-field> |
255 | </v-flex> | 255 | </v-flex> |
256 | </v-layout> | 256 | </v-layout> |
257 | </v-flex> | 257 | </v-flex> |
258 | <v-layout> | 258 | <v-layout> |
259 | <v-flex xs12 sm12> | 259 | <v-flex xs12 sm12> |
260 | <v-card-actions> | 260 | <v-card-actions> |
261 | <v-spacer></v-spacer> | 261 | <v-spacer></v-spacer> |
262 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 262 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
263 | <v-spacer></v-spacer> | 263 | <v-spacer></v-spacer> |
264 | </v-card-actions> | 264 | </v-card-actions> |
265 | </v-flex> | 265 | </v-flex> |
266 | </v-layout> | 266 | </v-layout> |
267 | </v-card-text> | 267 | </v-card-text> |
268 | </v-card> | 268 | </v-card> |
269 | </v-dialog> | 269 | </v-dialog> |
270 | 270 | ||
271 | <!-- ****** RESET Parents MPIN ****** --> | 271 | <!-- ****** RESET Parents MPIN ****** --> |
272 | <v-dialog v-model="resetParentMpin" max-width="500px" scrollable> | 272 | <v-dialog v-model="resetParentMpin" max-width="500px" scrollable> |
273 | <v-card class="card-style pa-2" dark> | 273 | <v-card class="card-style pa-2" dark> |
274 | <v-layout> | 274 | <v-layout> |
275 | <v-flex xs12> | 275 | <v-flex xs12> |
276 | <label class="title text-xs-center">Reset Mpin</label> | 276 | <label class="title text-xs-center">Reset Mpin</label> |
277 | <v-icon size="24" class="right" @click="resetParentMpin = false">cancel</v-icon> | 277 | <v-icon size="24" class="right" @click="resetParentMpin = false">cancel</v-icon> |
278 | </v-flex> | 278 | </v-flex> |
279 | </v-layout> | 279 | </v-layout> |
280 | <v-card-text class="hidden-xs-only hidden-sm-only"> | 280 | <v-card-text class="hidden-xs-only hidden-sm-only"> |
281 | <v-form ref="resetParentMpinForm" v-model="validParentMpin" lazy-validation> | 281 | <v-form ref="resetParentMpinForm" v-model="validParentMpin" lazy-validation> |
282 | <v-flex xs12> | 282 | <v-flex xs12> |
283 | <v-layout> | 283 | <v-layout> |
284 | <v-flex xs3 sm4 class="pt-4 subheading"> | 284 | <v-flex xs3 sm4 class="pt-4 subheading"> |
285 | <label class="right">Change Mpin:</label> | 285 | <label class="right">Change Mpin:</label> |
286 | </v-flex> | 286 | </v-flex> |
287 | <v-flex xs8 sm6 class="ml-3"> | 287 | <v-flex xs8 sm6 class="ml-3"> |
288 | <v-text-field | 288 | <v-text-field |
289 | placeholder="change mpin" | 289 | placeholder="change mpin" |
290 | :rules="mPinRules" | 290 | :rules="mPinRules" |
291 | v-model="editMpin.mPin" | 291 | v-model="editMpin.mPin" |
292 | type="number" | 292 | type="number" |
293 | counter="4" | 293 | counter="4" |
294 | required | 294 | required |
295 | ></v-text-field> | 295 | ></v-text-field> |
296 | </v-flex> | 296 | </v-flex> |
297 | </v-layout> | 297 | </v-layout> |
298 | </v-flex> | 298 | </v-flex> |
299 | </v-form> | 299 | </v-form> |
300 | <v-layout> | 300 | <v-layout> |
301 | <v-flex xs12 sm12> | 301 | <v-flex xs12 sm12> |
302 | <v-card-actions> | 302 | <v-card-actions> |
303 | <v-spacer></v-spacer> | 303 | <v-spacer></v-spacer> |
304 | <v-btn round dark @click="resetMpin" class="add-button">Reset</v-btn> | 304 | <v-btn round dark @click="resetMpin" class="add-button">Reset</v-btn> |
305 | <v-spacer></v-spacer> | 305 | <v-spacer></v-spacer> |
306 | </v-card-actions> | 306 | </v-card-actions> |
307 | </v-flex> | 307 | </v-flex> |
308 | </v-layout> | 308 | </v-layout> |
309 | </v-card-text> | 309 | </v-card-text> |
310 | </v-card> | 310 | </v-card> |
311 | </v-dialog> | 311 | </v-dialog> |
312 | 312 | ||
313 | <!-- ****** PROFILE VIEW Parents DEATILS ****** --> | 313 | <!-- ****** PROFILE VIEW Parents DEATILS ****** --> |
314 | 314 | ||
315 | <v-dialog v-model="profileParentDialog" max-width="500px" scrollable> | 315 | <v-dialog v-model="profileParentDialog" max-width="500px" scrollable> |
316 | <v-card class="card-style pa-2" dark> | 316 | <v-card class="card-style pa-2" dark> |
317 | <v-layout> | 317 | <v-layout> |
318 | <v-flex xs12> | 318 | <v-flex xs12> |
319 | <label class="title text-xs-center">View Parent Details</label> | 319 | <label class="title text-xs-center">View Parent Details</label> |
320 | <v-icon size="24" class="right" @click="profileParentDialog = false">cancel</v-icon> | 320 | <v-icon size="24" class="right" @click="profileParentDialog = false">cancel</v-icon> |
321 | </v-flex> | 321 | </v-flex> |
322 | </v-layout> | 322 | </v-layout> |
323 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 323 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
324 | <v-avatar size="100px"> | 324 | <v-avatar size="100px"> |
325 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 325 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
326 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> | 326 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> |
327 | </v-avatar> | 327 | </v-avatar> |
328 | </v-flex> | 328 | </v-flex> |
329 | <v-container grid-list-md> | 329 | <v-container grid-list-md> |
330 | <v-layout wrap> | 330 | <v-layout wrap> |
331 | <v-flex xs12> | 331 | <v-flex xs12> |
332 | <v-layout> | 332 | <v-layout> |
333 | <v-flex xs12 sm12> | 333 | <v-flex xs12 sm12> |
334 | <v-layout> | 334 | <v-layout> |
335 | <v-flex xs6> | 335 | <v-flex xs6> |
336 | <h5 class="right my-1"> | 336 | <h5 class="right my-1"> |
337 | <b>Email:</b> | 337 | <b>Email:</b> |
338 | </h5> | 338 | </h5> |
339 | </v-flex> | 339 | </v-flex> |
340 | <v-flex xs6> | 340 | <v-flex xs6> |
341 | <h5 class="my-1">{{ editedItem.email }}</h5> | 341 | <h5 class="my-1">{{ editedItem.email }}</h5> |
342 | </v-flex> | 342 | </v-flex> |
343 | </v-layout> | 343 | </v-layout> |
344 | </v-flex> | 344 | </v-flex> |
345 | </v-layout> | 345 | </v-layout> |
346 | <v-layout> | 346 | <v-layout> |
347 | <v-flex xs12> | 347 | <v-flex xs12> |
348 | <v-layout> | 348 | <v-layout> |
349 | <v-flex xs6> | 349 | <v-flex xs6> |
350 | <b> | 350 | <b> |
351 | <h5 class="right my-1"> | 351 | <h5 class="right my-1"> |
352 | <b>Fahter Name:</b> | 352 | <b>Fahter Name:</b> |
353 | </h5> | 353 | </h5> |
354 | </b> | 354 | </b> |
355 | </v-flex> | 355 | </v-flex> |
356 | <v-flex xs6> | 356 | <v-flex xs6> |
357 | <h5 class="my-1">{{ editedItem.fatherName }}</h5> | 357 | <h5 class="my-1">{{ editedItem.fatherName }}</h5> |
358 | </v-flex> | 358 | </v-flex> |
359 | </v-layout> | 359 | </v-layout> |
360 | </v-flex> | 360 | </v-flex> |
361 | </v-layout> | 361 | </v-layout> |
362 | <v-layout> | 362 | <v-layout> |
363 | <v-flex xs12> | 363 | <v-flex xs12> |
364 | <v-layout> | 364 | <v-layout> |
365 | <v-flex xs6> | 365 | <v-flex xs6> |
366 | <b> | 366 | <b> |
367 | <h5 class="right my-1"> | 367 | <h5 class="right my-1"> |
368 | <b>Mother Name:</b> | 368 | <b>Mother Name:</b> |
369 | </h5> | 369 | </h5> |
370 | </b> | 370 | </b> |
371 | </v-flex> | 371 | </v-flex> |
372 | <v-flex xs6> | 372 | <v-flex xs6> |
373 | <h5 class="my-1">{{ editedItem.motherName }}</h5> | 373 | <h5 class="my-1">{{ editedItem.motherName }}</h5> |
374 | </v-flex> | 374 | </v-flex> |
375 | </v-layout> | 375 | </v-layout> |
376 | </v-flex> | 376 | </v-flex> |
377 | </v-layout> | 377 | </v-layout> |
378 | <v-layout> | 378 | <v-layout> |
379 | <v-flex xs12> | 379 | <v-flex xs12> |
380 | <v-layout> | 380 | <v-layout> |
381 | <v-flex sm6 xs6> | 381 | <v-flex sm6 xs6> |
382 | <b> | 382 | <b> |
383 | <h5 class="right my-1"> | 383 | <h5 class="right my-1"> |
384 | <b>Father Cell No:</b> | 384 | <b>Father Cell No:</b> |
385 | </h5> | 385 | </h5> |
386 | </b> | 386 | </b> |
387 | </v-flex> | 387 | </v-flex> |
388 | <v-flex sm6 xs6> | 388 | <v-flex sm6 xs6> |
389 | <h5 class="my-1">{{ editedItem.fatherCellNo }}</h5> | 389 | <h5 class="my-1">{{ editedItem.fatherCellNo }}</h5> |
390 | </v-flex> | 390 | </v-flex> |
391 | </v-layout> | 391 | </v-layout> |
392 | </v-flex> | 392 | </v-flex> |
393 | </v-layout> | 393 | </v-layout> |
394 | <v-layout> | 394 | <v-layout> |
395 | <v-flex xs12> | 395 | <v-flex xs12> |
396 | <v-layout> | 396 | <v-layout> |
397 | <v-flex xs6> | 397 | <v-flex xs6> |
398 | <b> | 398 | <b> |
399 | <h5 class="right my-1"> | 399 | <h5 class="right my-1"> |
400 | <b>Mother Cell No:</b> | 400 | <b>Mother Cell No:</b> |
401 | </h5> | 401 | </h5> |
402 | </b> | 402 | </b> |
403 | </v-flex> | 403 | </v-flex> |
404 | <v-flex xs6> | 404 | <v-flex xs6> |
405 | <h5 class="my-1">{{ editedItem.motherCellNo }}</h5> | 405 | <h5 class="my-1">{{ editedItem.motherCellNo }}</h5> |
406 | </v-flex> | 406 | </v-flex> |
407 | </v-layout> | 407 | </v-layout> |
408 | </v-flex> | 408 | </v-flex> |
409 | </v-layout> | 409 | </v-layout> |
410 | <v-layout> | 410 | <v-layout> |
411 | <v-flex xs12> | 411 | <v-flex xs12> |
412 | <v-layout> | 412 | <v-layout> |
413 | <v-flex xs6> | 413 | <v-flex xs6> |
414 | <b> | 414 | <b> |
415 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> | 415 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> |
416 | <b>FatherProfession:</b> | 416 | <b>FatherProfession:</b> |
417 | </h5> | 417 | </h5> |
418 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> | 418 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> |
419 | <b>Father Profession:</b> | 419 | <b>Father Profession:</b> |
420 | </h5> | 420 | </h5> |
421 | </b> | 421 | </b> |
422 | </v-flex> | 422 | </v-flex> |
423 | <v-flex xs6> | 423 | <v-flex xs6> |
424 | <h5 class="my-1">{{ editedItem.fatherProfession }}</h5> | 424 | <h5 class="my-1">{{ editedItem.fatherProfession }}</h5> |
425 | </v-flex> | 425 | </v-flex> |
426 | </v-layout> | 426 | </v-layout> |
427 | </v-flex> | 427 | </v-flex> |
428 | </v-layout> | 428 | </v-layout> |
429 | <v-layout> | 429 | <v-layout> |
430 | <v-flex xs12> | 430 | <v-flex xs12> |
431 | <v-layout> | 431 | <v-layout> |
432 | <v-flex xs6> | 432 | <v-flex xs6> |
433 | <b> | 433 | <b> |
434 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> | 434 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> |
435 | <b>MotherProfession:</b> | 435 | <b>MotherProfession:</b> |
436 | </h5> | 436 | </h5> |
437 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> | 437 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> |
438 | <b>Mother Profession:</b> | 438 | <b>Mother Profession:</b> |
439 | </h5> | 439 | </h5> |
440 | </b> | 440 | </b> |
441 | </v-flex> | 441 | </v-flex> |
442 | <v-flex xs6> | 442 | <v-flex xs6> |
443 | <h5 class="my-1">{{ editedItem.motherProfession }}</h5> | 443 | <h5 class="my-1">{{ editedItem.motherProfession }}</h5> |
444 | </v-flex> | 444 | </v-flex> |
445 | </v-layout> | 445 | </v-layout> |
446 | <!-- <v-layout> | 446 | <!-- <v-layout> |
447 | <v-flex xs6> | 447 | <v-flex xs6> |
448 | <b> | 448 | <b> |
449 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> | 449 | <h5 class="right my-1 hidden-lg-only hidden-xl-only hidden-md-only"> |
450 | <b>Password:</b> | 450 | <b>Password:</b> |
451 | </h5> | 451 | </h5> |
452 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> | 452 | <h5 class="right my-1 hidden-sm-only hidden-xs-only"> |
453 | <b>Password:</b> | 453 | <b>Password:</b> |
454 | </h5> | 454 | </h5> |
455 | </b> | 455 | </b> |
456 | </v-flex> | 456 | </v-flex> |
457 | <v-flex xs6> | 457 | <v-flex xs6> |
458 | <h5 class="my-1">{{ editedItem.password }}</h5> | 458 | <h5 class="my-1">{{ editedItem.password }}</h5> |
459 | </v-flex> | 459 | </v-flex> |
460 | </v-layout>--> | 460 | </v-layout>--> |
461 | </v-flex> | 461 | </v-flex> |
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-card> | 466 | </v-card> |
467 | </v-dialog> | 467 | </v-dialog> |
468 | <!-- ****** EXISTING-USERS Parents TABLE ****** --> | 468 | <!-- ****** EXISTING-USERS Parents TABLE ****** --> |
469 | <v-toolbar color="transparent" flat> | 469 | <v-toolbar color="transparent" flat> |
470 | <v-btn | 470 | <v-btn |
471 | fab | 471 | fab |
472 | dark | 472 | dark |
473 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 473 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
474 | small | 474 | small |
475 | @click="addParentDialog = true" | 475 | @click="addParentDialog = true" |
476 | > | 476 | > |
477 | <v-icon dark>add</v-icon> | 477 | <v-icon dark>add</v-icon> |
478 | </v-btn> | 478 | </v-btn> |
479 | <v-btn | 479 | <v-btn |
480 | v-if="role != 'TEACHER' " | 480 | v-if="role != 'TEACHER' " |
481 | round | 481 | round |
482 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 482 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
483 | dark | 483 | dark |
484 | @click="addParentDialog = true" | 484 | @click="addParentDialog = true" |
485 | > | 485 | > |
486 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Parent | 486 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Parent |
487 | </v-btn> | 487 | </v-btn> |
488 | <v-spacer></v-spacer> | 488 | <v-spacer></v-spacer> |
489 | <v-card-title class="body-1" v-show="show"> | 489 | <v-card-title class="body-1" v-show="show"> |
490 | <v-btn icon large flat @click="displaySearch"> | 490 | <v-btn icon large flat @click="displaySearch"> |
491 | <v-avatar size="27"> | 491 | <v-avatar size="27"> |
492 | <img src="/static/icon/search.png" alt="icon" /> | 492 | <img src="/static/icon/search.png" alt="icon" /> |
493 | </v-avatar> | 493 | </v-avatar> |
494 | </v-btn> | 494 | </v-btn> |
495 | </v-card-title> | 495 | </v-card-title> |
496 | <v-flex xs8 sm8 md2 lg2 v-if="showSearch"> | 496 | <v-flex xs8 sm8 md2 lg2 v-if="showSearch"> |
497 | <v-layout> | 497 | <v-layout> |
498 | <v-text-field | 498 | <v-text-field |
499 | v-model="search" | 499 | v-model="search" |
500 | label="Search" | 500 | label="Search" |
501 | prepend-inner-icon="search" | 501 | prepend-inner-icon="search" |
502 | color="primary" | 502 | color="primary" |
503 | ref="searchField" | 503 | ref="searchField" |
504 | autofocus | 504 | autofocus |
505 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 505 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
506 | ></v-text-field> | 506 | ></v-text-field> |
507 | <v-icon @click="closeSearch" color="error">close</v-icon> | 507 | <v-icon @click="closeSearch" color="error">close</v-icon> |
508 | </v-layout> | 508 | </v-layout> |
509 | </v-flex> | 509 | </v-flex> |
510 | </v-toolbar> | 510 | </v-toolbar> |
511 | <v-data-table | 511 | <v-data-table |
512 | :headers="headers" | 512 | :headers="headers" |
513 | :items="parentsList" | 513 | :items="parentsList" |
514 | :pagination.sync="pagination" | 514 | :pagination.sync="pagination" |
515 | :search="search" | 515 | :search="search" |
516 | > | 516 | > |
517 | <template slot="items" slot-scope="props"> | 517 | <template slot="items" slot-scope="props"> |
518 | <tr class="tr"> | 518 | <tr class="tr"> |
519 | <td class="text-xs-center td td-row">{{ props.index + 1}}</td> | 519 | <td class="text-xs-center td td-row">{{ props.index + 1}}</td> |
520 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> | 520 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> |
521 | <td class="text-xs-center td td-row">{{ props.item.fatherName }}</td> | 521 | <td class="text-xs-center td td-row">{{ props.item.fatherName }}</td> |
522 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo }}</td> | 522 | <td class="text-xs-center td td-row">{{ props.item.fatherCellNo }}</td> |
523 | <td class="text-xs-center td td-row">{{ props.item.motherName }}</td> | 523 | <td class="text-xs-center td td-row">{{ props.item.motherName }}</td> |
524 | <td class="text-xs-center td td-row">{{ props.item.motherCellNo }}</td> | 524 | <td class="text-xs-center td td-row">{{ props.item.motherCellNo }}</td> |
525 | <td class="text-xs-center td td-row"> | 525 | <td class="text-xs-center td td-row"> |
526 | <span> | 526 | <span> |
527 | <v-tooltip top> | 527 | <v-tooltip top> |
528 | <img | 528 | <img |
529 | slot="activator" | 529 | slot="activator" |
530 | style="cursor:pointer; width:25px; height:25px; " | 530 | style="cursor:pointer; width:25px; height:25px; " |
531 | class="mr-3" | 531 | class="mr-3" |
532 | @click="profile(props.item)" | 532 | @click="profile(props.item)" |
533 | src="/static/icon/view.png" | 533 | src="/static/icon/view.png" |
534 | /> | 534 | /> |
535 | <span>View</span> | 535 | <span>View</span> |
536 | </v-tooltip> | 536 | </v-tooltip> |
537 | <v-tooltip top v-if="role != 'TEACHER' "> | 537 | <v-tooltip top v-if="role != 'TEACHER' "> |
538 | <img | 538 | <img |
539 | slot="activator" | 539 | slot="activator" |
540 | style="cursor:pointer; width:20px; height:18px; " | 540 | style="cursor:pointer; width:20px; height:18px; " |
541 | @click="editItem(props.item)" | 541 | @click="editItem(props.item)" |
542 | src="/static/icon/edit.png" | 542 | src="/static/icon/edit.png" |
543 | class="mr-3" | 543 | class="mr-3" |
544 | /> | 544 | /> |
545 | <span>Edit</span> | 545 | <span>Edit</span> |
546 | </v-tooltip> | 546 | </v-tooltip> |
547 | <span v-if="role === 'ADMIN' "> | 547 | <span v-if="role === 'ADMIN' "> |
548 | <i | 548 | <i |
549 | class="material-icons md-18" | 549 | class="material-icons md-18" |
550 | style="cursor:pointer; width:20px; height:18px;" | 550 | style="cursor:pointer; width:20px; height:18px;" |
551 | @click="resetParentMPIN(props.item)" | 551 | @click="resetParentMPIN(props.item)" |
552 | >vpn_key</i> | 552 | >vpn_key</i> |
553 | </span> | 553 | </span> |
554 | </span> | 554 | </span> |
555 | </td> | 555 | </td> |
556 | </tr> | 556 | </tr> |
557 | </template> | 557 | </template> |
558 | <v-alert | 558 | <v-alert |
559 | slot="no-results" | 559 | slot="no-results" |
560 | :value="true" | 560 | :value="true" |
561 | color="error" | 561 | color="error" |
562 | icon="warning" | 562 | icon="warning" |
563 | >Your search for "{{ search }}" found no results.</v-alert> | 563 | >Your search for "{{ search }}" found no results.</v-alert> |
564 | </v-data-table> | 564 | </v-data-table> |
565 | 565 | ||
566 | <!-- ******DIALOG BOX - ADD PARENTS DETAILS****** --> | 566 | <!-- ******DIALOG BOX - ADD PARENTS DETAILS****** --> |
567 | <v-dialog v-model="addParentDialog" max-width="1100px"> | 567 | <v-dialog v-model="addParentDialog" max-width="1100px" v-if="addParentDialog"> |
568 | <v-card flat class="card-style pa-2" dark> | 568 | <v-card flat class="card-style pa-2" dark> |
569 | <v-layout> | 569 | <v-layout> |
570 | <v-flex xs12> | 570 | <v-flex xs12> |
571 | <label class="title text-xs-center">Add Parent</label> | 571 | <label class="title text-xs-center">Add Parent</label> |
572 | <v-icon size="24" class="right" @click="$refs.parentForm.reset();addParentDialog = false">cancel</v-icon> | 572 | <v-icon |
573 | size="24" | ||
574 | class="right" | ||
575 | @click="$refs.parentForm.reset();addParentDialog = false" | ||
576 | >cancel</v-icon> | ||
573 | </v-flex> | 577 | </v-flex> |
574 | </v-layout> | 578 | </v-layout> |
575 | <v-container fluid fill-height> | 579 | <v-container fluid fill-height> |
576 | <v-layout align-center> | 580 | <v-layout align-center> |
577 | <v-flex xs12 sm12> | 581 | <v-flex xs12 sm12> |
578 | <v-form ref="parentForm" v-model="valid" lazy-validation> | 582 | <v-form ref="parentForm" v-model="valid" lazy-validation> |
579 | <v-container fluid class="hidden-xs-only hidden-sm-only"> | 583 | <v-container fluid class="hidden-xs-only hidden-sm-only"> |
580 | <v-layout> | 584 | <v-layout> |
581 | <v-flex xs12 sm6> | 585 | <v-flex xs12 sm6> |
582 | <v-layout> | 586 | <v-layout> |
583 | <v-flex xs4 class="pt-4 subheading"> | 587 | <v-flex xs4 class="pt-4 subheading"> |
584 | <label class="right">Father Cell No:</label> | 588 | <label class="right">Father Cell No:</label> |
585 | </v-flex> | 589 | </v-flex> |
586 | <v-flex xs8 class="ml-3"> | 590 | <v-flex xs8 class="ml-3"> |
587 | <v-text-field | 591 | <v-text-field |
588 | v-model="parentData.fatherCellNo" | 592 | v-model="parentData.fatherCellNo" |
589 | placeholder="fill your father Cell Number" | 593 | placeholder="fill your father Cell Number" |
590 | type="number" | 594 | type="number" |
591 | :rules="fatheCellNoRules" | 595 | :rules="fatheCellNoRules" |
592 | counter="10" | 596 | counter="10" |
593 | required | 597 | required |
594 | ></v-text-field> | 598 | ></v-text-field> |
595 | </v-flex> | 599 | </v-flex> |
596 | </v-layout> | 600 | </v-layout> |
597 | </v-flex> | 601 | </v-flex> |
598 | <v-flex xs12 sm6> | 602 | <v-flex xs12 sm6> |
599 | <v-layout> | 603 | <v-layout> |
600 | <v-flex xs4 class="pt-4 subheading"> | 604 | <v-flex xs4 class="pt-4 subheading"> |
601 | <label class="right">Parent Email Id:</label> | 605 | <label class="right">Parent Email Id:</label> |
602 | </v-flex> | 606 | </v-flex> |
603 | <v-flex xs8 class="ml-3"> | 607 | <v-flex xs8 class="ml-3"> |
604 | <v-text-field | 608 | <v-text-field |
605 | placeholder="fill Parent email" | 609 | placeholder="fill Parent email" |
606 | v-model="parentData.email" | 610 | v-model="parentData.email" |
607 | type="text" | 611 | type="text" |
608 | required | 612 | required |
609 | ></v-text-field> | 613 | ></v-text-field> |
610 | </v-flex> | 614 | </v-flex> |
611 | </v-layout> | 615 | </v-layout> |
612 | </v-flex> | 616 | </v-flex> |
613 | </v-layout> | 617 | </v-layout> |
614 | <v-layout> | 618 | <v-layout> |
615 | <v-flex xs12 sm6> | 619 | <v-flex xs12 sm6> |
616 | <v-layout> | 620 | <v-layout> |
617 | <v-flex xs4 class="pt-4 subheading"> | 621 | <v-flex xs4 class="pt-4 subheading"> |
618 | <label class="right">Father Name:</label> | 622 | <label class="right">Father Name:</label> |
619 | </v-flex> | 623 | </v-flex> |
620 | <v-flex xs8 class="ml-3"> | 624 | <v-flex xs8 class="ml-3"> |
621 | <v-text-field | 625 | <v-text-field |
622 | v-model="parentData.fatherName" | 626 | v-model="parentData.fatherName" |
623 | placeholder="Fill your father Name" | 627 | placeholder="Fill your father Name" |
624 | required | 628 | required |
625 | ></v-text-field> | 629 | ></v-text-field> |
626 | </v-flex> | 630 | </v-flex> |
627 | </v-layout> | 631 | </v-layout> |
628 | </v-flex> | 632 | </v-flex> |
629 | <v-flex xs12 sm6> | 633 | <v-flex xs12 sm6> |
630 | <v-layout> | 634 | <v-layout> |
631 | <v-flex xs4 class="pt-4 subheading"> | 635 | <v-flex xs4 class="pt-4 subheading"> |
632 | <label class="right">Father Profession:</label> | 636 | <label class="right">Father Profession:</label> |
633 | </v-flex> | 637 | </v-flex> |
634 | <v-flex xs8 class="ml-3"> | 638 | <v-flex xs8 class="ml-3"> |
635 | <v-text-field | 639 | <v-text-field |
636 | v-model="parentData.fatherProfession" | 640 | v-model="parentData.fatherProfession" |
637 | placeholder="fill your father Profession" | 641 | placeholder="fill your father Profession" |
638 | required | 642 | required |
639 | ></v-text-field> | 643 | ></v-text-field> |
640 | </v-flex> | 644 | </v-flex> |
641 | </v-layout> | 645 | </v-layout> |
642 | </v-flex> | 646 | </v-flex> |
643 | </v-layout> | 647 | </v-layout> |
644 | <v-layout> | 648 | <v-layout> |
645 | <v-flex xs12 sm6> | 649 | <v-flex xs12 sm6> |
646 | <v-layout> | 650 | <v-layout> |
647 | <v-flex xs4 class="pt-4 subheading"> | 651 | <v-flex xs4 class="pt-4 subheading"> |
648 | <label class="right">Mother Name:</label> | 652 | <label class="right">Mother Name:</label> |
649 | </v-flex> | 653 | </v-flex> |
650 | <v-flex xs8 class="ml-3"> | 654 | <v-flex xs8 class="ml-3"> |
651 | <v-text-field | 655 | <v-text-field |
652 | v-model="parentData.motherName" | 656 | v-model="parentData.motherName" |
653 | placeholder="fill your Mother Name" | 657 | placeholder="fill your Mother Name" |
654 | type="text" | 658 | type="text" |
655 | required | 659 | required |
656 | ></v-text-field> | 660 | ></v-text-field> |
657 | </v-flex> | 661 | </v-flex> |
658 | </v-layout> | 662 | </v-layout> |
659 | </v-flex> | 663 | </v-flex> |
660 | <v-flex xs12 sm6> | 664 | <v-flex xs12 sm6> |
661 | <v-layout> | 665 | <v-layout> |
662 | <v-flex xs4 class="pt-4 subheading"> | 666 | <v-flex xs4 class="pt-4 subheading"> |
663 | <label class="right">Mother Cell No:</label> | 667 | <label class="right">Mother Cell No:</label> |
664 | </v-flex> | 668 | </v-flex> |
665 | <v-flex xs8 class="ml-3"> | 669 | <v-flex xs8 class="ml-3"> |
666 | <v-text-field | 670 | <v-text-field |
667 | v-model="parentData.motherCellNo" | 671 | v-model="parentData.motherCellNo" |
668 | placeholder="fill your Mother Cell Number" | 672 | placeholder="fill your Mother Cell Number" |
669 | counter="10" | 673 | counter="10" |
670 | type="number" | 674 | type="number" |
671 | required | 675 | required |
672 | ></v-text-field> | 676 | ></v-text-field> |
673 | </v-flex> | 677 | </v-flex> |
674 | </v-layout> | 678 | </v-layout> |
675 | </v-flex> | 679 | </v-flex> |
676 | </v-layout> | 680 | </v-layout> |
677 | <v-layout> | 681 | <v-layout> |
678 | <v-flex xs12 sm6> | 682 | <v-flex xs12 sm6> |
679 | <v-layout> | 683 | <v-layout> |
680 | <v-flex xs4 class="pt-4 subheading"> | 684 | <v-flex xs4 class="pt-4 subheading"> |
681 | <label class="right">Mother Profession:</label> | 685 | <label class="right">Mother Profession:</label> |
682 | </v-flex> | 686 | </v-flex> |
683 | <v-flex xs8 class="ml-3"> | 687 | <v-flex xs8 class="ml-3"> |
684 | <v-text-field | 688 | <v-text-field |
685 | v-model="parentData.motherProfession" | 689 | v-model="parentData.motherProfession" |
686 | placeholder="fill your Mother Profession" | 690 | placeholder="fill your Mother Profession" |
687 | type="text" | 691 | type="text" |
688 | required | 692 | required |
689 | ></v-text-field> | 693 | ></v-text-field> |
690 | </v-flex> | 694 | </v-flex> |
691 | </v-layout> | 695 | </v-layout> |
692 | </v-flex> | 696 | </v-flex> |
693 | <v-flex xs12 sm6> | 697 | <v-flex xs12 sm6> |
694 | <v-layout> | 698 | <v-layout> |
695 | <v-flex xs4 class="pt-4 subheading"> | 699 | <v-flex xs4 class="pt-4 subheading"> |
696 | <label class="right">Password:</label> | 700 | <label class="right">Password:</label> |
697 | </v-flex> | 701 | </v-flex> |
698 | <v-flex xs8 class="ml-3"> | 702 | <v-flex xs8 class="ml-3"> |
699 | <v-text-field | 703 | <v-text-field |
700 | v-model="parentData.password" | 704 | v-model="parentData.password" |
701 | :append-icon="e1 ? 'visibility_off' : 'visibility'" | 705 | :append-icon="e1 ? 'visibility_off' : 'visibility'" |
702 | :append-icon-cb="() => (e1 = !e1)" | 706 | :append-icon-cb="() => (e1 = !e1)" |
703 | :type="e1 ? 'password' : 'text'" | 707 | :type="e1 ? 'password' : 'text'" |
704 | :rules="password" | 708 | :rules="password" |
705 | placeholder="Enter Your Password" | 709 | placeholder="Enter Your Password" |
706 | :disabled="isFatherCellExists" | 710 | :disabled="isFatherCellExists" |
707 | required | 711 | required |
708 | ></v-text-field> | 712 | ></v-text-field> |
709 | </v-flex> | 713 | </v-flex> |
710 | </v-layout> | 714 | </v-layout> |
711 | </v-flex> | 715 | </v-flex> |
712 | </v-layout> | 716 | </v-layout> |
713 | <v-flex xs12 sm12> | 717 | <v-flex xs12 sm12> |
714 | <v-layout> | 718 | <v-layout> |
715 | <v-flex xs12 sm12> | 719 | <v-flex xs12 sm12> |
716 | <v-btn | 720 | <v-btn |
717 | class="right add-button" | 721 | class="right add-button" |
718 | @click="submitParentDetails" | 722 | @click="submitParentDetails" |
719 | round | 723 | round |
720 | dark | 724 | dark |
721 | :loading="loading" | 725 | :loading="loading" |
722 | v-show="showParent" | 726 | v-show="showParent" |
723 | >Add</v-btn> | 727 | >Add</v-btn> |
724 | <v-btn @click="clear" round dark class="clear-button right">Clear</v-btn> | 728 | <v-btn @click="clear" round dark class="clear-button right">Clear</v-btn> |
725 | </v-flex> | 729 | </v-flex> |
726 | </v-layout> | 730 | </v-layout> |
727 | </v-flex> | 731 | </v-flex> |
728 | </v-container> | 732 | </v-container> |
729 | <v-container fluid class="hidden-lg-only hidden-xl-only hidden-md-only"> | 733 | <v-container fluid class="hidden-lg-only hidden-xl-only hidden-md-only"> |
730 | <v-layout wrap> | 734 | <v-layout wrap> |
731 | <v-flex xs12 sm6> | 735 | <v-flex xs12 sm6> |
732 | <v-layout wrap> | 736 | <v-layout wrap> |
733 | <v-flex xs12 class="pt-4 subheading"> | 737 | <v-flex xs12 class="pt-4 subheading"> |
734 | <label>Father Cell No:</label> | 738 | <label>Father Cell No:</label> |
735 | </v-flex> | 739 | </v-flex> |
736 | <v-flex xs12> | 740 | <v-flex xs12> |
737 | <v-text-field | 741 | <v-text-field |
738 | v-model="parentData.fatherCellNo" | 742 | v-model="parentData.fatherCellNo" |
739 | :rules="fatheCellNoRules" | 743 | :rules="fatheCellNoRules" |
740 | counter="10" | 744 | counter="10" |
741 | placeholder="fill your father Cell Number" | 745 | placeholder="fill your father Cell Number" |
742 | type="number" | 746 | type="number" |
743 | required | 747 | required |
744 | ></v-text-field> | 748 | ></v-text-field> |
745 | </v-flex> | 749 | </v-flex> |
746 | </v-layout> | 750 | </v-layout> |
747 | </v-flex> | 751 | </v-flex> |
748 | <v-flex xs12 sm6> | 752 | <v-flex xs12 sm6> |
749 | <v-layout wrap> | 753 | <v-layout wrap> |
750 | <v-flex xs12 class="pt-4 subheading"> | 754 | <v-flex xs12 class="pt-4 subheading"> |
751 | <label>Parent Email Id:</label> | 755 | <label>Parent Email Id:</label> |
752 | </v-flex> | 756 | </v-flex> |
753 | <v-flex xs12> | 757 | <v-flex xs12> |
754 | <v-text-field | 758 | <v-text-field |
755 | placeholder="fill Parent email" | 759 | placeholder="fill Parent email" |
756 | v-model="parentData.email" | 760 | v-model="parentData.email" |
757 | type="text" | 761 | type="text" |
758 | required | 762 | required |
759 | ></v-text-field> | 763 | ></v-text-field> |
760 | </v-flex> | 764 | </v-flex> |
761 | </v-layout> | 765 | </v-layout> |
762 | </v-flex> | 766 | </v-flex> |
763 | </v-layout> | 767 | </v-layout> |
764 | <v-layout wrap> | 768 | <v-layout wrap> |
765 | <v-flex xs12 sm6> | 769 | <v-flex xs12 sm6> |
766 | <v-layout wrap> | 770 | <v-layout wrap> |
767 | <v-flex xs12 class="pt-4 subheading"> | 771 | <v-flex xs12 class="pt-4 subheading"> |
768 | <label>Father Name:</label> | 772 | <label>Father Name:</label> |
769 | </v-flex> | 773 | </v-flex> |
770 | <v-flex xs12> | 774 | <v-flex xs12> |
771 | <v-text-field | 775 | <v-text-field |
772 | v-model="parentData.fatherName" | 776 | v-model="parentData.fatherName" |
773 | placeholder="Fill your father Name" | 777 | placeholder="Fill your father Name" |
774 | required | 778 | required |
775 | ></v-text-field> | 779 | ></v-text-field> |
776 | </v-flex> | 780 | </v-flex> |
777 | </v-layout> | 781 | </v-layout> |
778 | </v-flex> | 782 | </v-flex> |
779 | <v-flex xs12 sm6> | 783 | <v-flex xs12 sm6> |
780 | <v-layout wrap> | 784 | <v-layout wrap> |
781 | <v-flex xs12 class="pt-4 subheading"> | 785 | <v-flex xs12 class="pt-4 subheading"> |
782 | <label>Father Profession:</label> | 786 | <label>Father Profession:</label> |
783 | </v-flex> | 787 | </v-flex> |
784 | <v-flex xs12> | 788 | <v-flex xs12> |
785 | <v-text-field | 789 | <v-text-field |
786 | v-model="parentData.fatherProfession" | 790 | v-model="parentData.fatherProfession" |
787 | placeholder="fill your father Profession" | 791 | placeholder="fill your father Profession" |
788 | required | 792 | required |
789 | ></v-text-field> | 793 | ></v-text-field> |
790 | </v-flex> | 794 | </v-flex> |
791 | </v-layout> | 795 | </v-layout> |
792 | </v-flex> | 796 | </v-flex> |
793 | </v-layout> | 797 | </v-layout> |
794 | <v-layout wrap> | 798 | <v-layout wrap> |
795 | <v-flex xs12 sm6> | 799 | <v-flex xs12 sm6> |
796 | <v-layout wrap> | 800 | <v-layout wrap> |
797 | <v-flex xs12 class="pt-4 subheading"> | 801 | <v-flex xs12 class="pt-4 subheading"> |
798 | <label>Mother Name:</label> | 802 | <label>Mother Name:</label> |
799 | </v-flex> | 803 | </v-flex> |
800 | <v-flex xs12> | 804 | <v-flex xs12> |
801 | <v-text-field | 805 | <v-text-field |
802 | v-model="parentData.motherName" | 806 | v-model="parentData.motherName" |
803 | placeholder="fill your Mother Name" | 807 | placeholder="fill your Mother Name" |
804 | type="text" | 808 | type="text" |
805 | required | 809 | required |
806 | ></v-text-field> | 810 | ></v-text-field> |
807 | </v-flex> | 811 | </v-flex> |
808 | </v-layout> | 812 | </v-layout> |
809 | </v-flex> | 813 | </v-flex> |
810 | <v-flex xs12 sm6> | 814 | <v-flex xs12 sm6> |
811 | <v-layout wrap> | 815 | <v-layout wrap> |
812 | <v-flex xs42 class="pt-4 subheading"> | 816 | <v-flex xs42 class="pt-4 subheading"> |
813 | <label>Mother Cell No:</label> | 817 | <label>Mother Cell No:</label> |
814 | </v-flex> | 818 | </v-flex> |
815 | <v-flex xs12> | 819 | <v-flex xs12> |
816 | <v-text-field | 820 | <v-text-field |
817 | v-model="parentData.motherCellNo" | 821 | v-model="parentData.motherCellNo" |
818 | placeholder="fill your Mother Cell Number" | 822 | placeholder="fill your Mother Cell Number" |
819 | type="number" | 823 | type="number" |
820 | required | 824 | required |
821 | ></v-text-field> | 825 | ></v-text-field> |
822 | </v-flex> | 826 | </v-flex> |
823 | </v-layout> | 827 | </v-layout> |
824 | </v-flex> | 828 | </v-flex> |
825 | </v-layout> | 829 | </v-layout> |
826 | <v-layout wrap> | 830 | <v-layout wrap> |
827 | <v-flex xs12 sm6> | 831 | <v-flex xs12 sm6> |
828 | <v-layout wrap> | 832 | <v-layout wrap> |
829 | <v-flex xs12 class="pt-4 subheading"> | 833 | <v-flex xs12 class="pt-4 subheading"> |
830 | <label>Mother Profession:</label> | 834 | <label>Mother Profession:</label> |
831 | </v-flex> | 835 | </v-flex> |
832 | <v-flex xs12> | 836 | <v-flex xs12> |
833 | <v-text-field | 837 | <v-text-field |
834 | v-model="parentData.motherProfession" | 838 | v-model="parentData.motherProfession" |
835 | placeholder="fill your Mother Profession" | 839 | placeholder="fill your Mother Profession" |
836 | type="text" | 840 | type="text" |
837 | required | 841 | required |
838 | ></v-text-field> | 842 | ></v-text-field> |
839 | </v-flex> | 843 | </v-flex> |
840 | </v-layout> | 844 | </v-layout> |
841 | </v-flex> | 845 | </v-flex> |
842 | </v-layout> | 846 | </v-layout> |
843 | <v-flex xs12 sm12> | 847 | <v-flex xs12 sm12> |
844 | <v-layout> | 848 | <v-layout> |
845 | <v-flex xs6 sm6 offset-sm1> | 849 | <v-flex xs6 sm6 offset-sm1> |
846 | <v-btn @click="clear" class="clear-button" round dark>clear</v-btn> | 850 | <v-btn @click="clear" class="clear-button" round dark>clear</v-btn> |
847 | </v-flex> | 851 | </v-flex> |
848 | <v-flex xs6 sm6> | 852 | <v-flex xs6 sm6> |
849 | <v-btn | 853 | <v-btn |
850 | class="add-button" | 854 | class="add-button" |
851 | @click="submitParentDetails" | 855 | @click="submitParentDetails" |
852 | round | 856 | round |
853 | dark | 857 | dark |
854 | :loading="loading" | 858 | :loading="loading" |
855 | v-show="showParent" | 859 | v-show="showParent" |
856 | >Add</v-btn> | 860 | >Add</v-btn> |
857 | </v-flex> | 861 | </v-flex> |
858 | </v-layout> | 862 | </v-layout> |
859 | </v-flex> | 863 | </v-flex> |
860 | </v-container> | 864 | </v-container> |
861 | </v-form> | 865 | </v-form> |
862 | </v-flex> | 866 | </v-flex> |
863 | </v-layout> | 867 | </v-layout> |
864 | </v-container> | 868 | </v-container> |
865 | </v-card> | 869 | </v-card> |
866 | </v-dialog> | 870 | </v-dialog> |
867 | <div class="loader" v-if="showLoader"> | 871 | <div class="loader" v-if="showLoader"> |
868 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 872 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
869 | </div> | 873 | </div> |
870 | <v-snackbar | 874 | <v-snackbar |
871 | :timeout="timeout" | 875 | :timeout="timeout" |
872 | :top="y === 'top'" | 876 | :top="y === 'top'" |
873 | :right="x === 'right'" | 877 | :right="x === 'right'" |
874 | :vertical="mode === 'vertical'" | 878 | :vertical="mode === 'vertical'" |
875 | v-model="snackbar" | 879 | v-model="snackbar" |
876 | color="success" | 880 | color="success" |
877 | >{{ text }}</v-snackbar> | 881 | >{{ text }}</v-snackbar> |
878 | </v-container> | 882 | </v-container> |
879 | </template> | 883 | </template> |
880 | 884 | ||
881 | <script> | 885 | <script> |
882 | import http from "@/Services/http.js"; | 886 | import http from "@/Services/http.js"; |
883 | import Util from "@/util"; | 887 | import Util from "@/util"; |
884 | import moment from "moment"; | 888 | import moment from "moment"; |
885 | 889 | ||
886 | export default { | 890 | export default { |
887 | data: () => ({ | 891 | data: () => ({ |
888 | e1: true, | 892 | e1: true, |
889 | showParent: true, | 893 | showParent: true, |
890 | snackbar: false, | 894 | snackbar: false, |
891 | role: "", | 895 | role: "", |
892 | // TEACHER: "", | 896 | // TEACHER: "", |
893 | y: "top", | 897 | y: "top", |
894 | x: "right", | 898 | x: "right", |
895 | color: "", | 899 | color: "", |
896 | mode: "", | 900 | mode: "", |
897 | timeout: 3000, | 901 | timeout: 3000, |
898 | text: "", | 902 | text: "", |
899 | show: true, | 903 | show: true, |
900 | showSearch: false, | 904 | showSearch: false, |
901 | showLoader: false, | 905 | showLoader: false, |
902 | loading: false, | 906 | loading: false, |
903 | date: null, | 907 | date: null, |
904 | search: "", | 908 | search: "", |
905 | password: "", | 909 | password: "", |
906 | addParentDialog: false, | 910 | addParentDialog: false, |
907 | menu: false, | 911 | menu: false, |
908 | menu1: false, | 912 | menu1: false, |
909 | editParentDilaog: false, | 913 | editParentDilaog: false, |
910 | profileParentDialog: false, | 914 | profileParentDialog: false, |
911 | resetParentMpin: false, | 915 | resetParentMpin: false, |
912 | viewProfileParentDialog: false, | 916 | viewProfileParentDialog: false, |
913 | valid: true, | 917 | valid: true, |
914 | validEditParent: true, | 918 | validEditParent: true, |
915 | validParentMpin: true, | 919 | validParentMpin: true, |
916 | pagination: { | 920 | pagination: { |
917 | rowsPerPage: 10, | 921 | rowsPerPage: 10, |
918 | }, | 922 | }, |
919 | fatherNameRules: [(v) => !!v || " Father Name is required"], | 923 | fatherNameRules: [(v) => !!v || " Father Name is required"], |
920 | fatheCellNoRules: [ | 924 | fatheCellNoRules: [ |
921 | (v) => !!v || " father Cell Number is required", | 925 | (v) => !!v || " father Cell Number is required", |
922 | (v) => v <= 10000000000 || "Max 10 characters is required", | 926 | (v) => v <= 10000000000 || "Max 10 characters is required", |
923 | ], | 927 | ], |
924 | password: [ | 928 | password: [ |
925 | (v) => !!v || "Password field is Required.", | 929 | (v) => !!v || "Password field is Required.", |
926 | // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters lower case symbol required' | 930 | // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters lower case symbol required' |
927 | ], | 931 | ], |
928 | editFatherNoRule: [ | 932 | editFatherNoRule: [ |
929 | (v) => !!v || " father Cell Number is required", | 933 | (v) => !!v || " father Cell Number is required", |
930 | (v) => v <= 10000000000 || "Max 10 characters is required", | 934 | (v) => v <= 10000000000 || "Max 10 characters is required", |
931 | ], | 935 | ], |
932 | 936 | ||
933 | editfatherCellNo: [(v) => !!v || " Father Name is required"], | 937 | editfatherCellNo: [(v) => !!v || " Father Name is required"], |
934 | errorMessages: "", | 938 | errorMessages: "", |
935 | emailRules: [ | 939 | emailRules: [ |
936 | (v) => !!v || "E-mail is required", | 940 | (v) => !!v || "E-mail is required", |
937 | (v) => | 941 | (v) => |
938 | /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || | 942 | /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || |
939 | "E-mail must be valid", | 943 | "E-mail must be valid", |
940 | ], | 944 | ], |
941 | mPinRules: [ | 945 | mPinRules: [ |
942 | (v) => !!v || "MPIN is required", | 946 | (v) => !!v || "MPIN is required", |
943 | (v) => v <= 10000 || "Max 4 numbers are required", | 947 | (v) => v <= 10000 || "Max 4 numbers are required", |
944 | ], | 948 | ], |
945 | headers: [ | 949 | headers: [ |
946 | { | 950 | { |
947 | text: "No", | 951 | text: "No", |
948 | align: "center", | 952 | align: "center", |
949 | sortable: false, | 953 | sortable: false, |
950 | value: "No", | 954 | value: "No", |
951 | }, | 955 | }, |
952 | { text: "Email", value: "email", sortable: false, align: "center" }, | 956 | { text: "Email", value: "email", sortable: false, align: "center" }, |
953 | { | 957 | { |
954 | text: "Father Name", | 958 | text: "Father Name", |
955 | value: "fatherName", | 959 | value: "fatherName", |
956 | sortable: false, | 960 | sortable: false, |
957 | align: "center", | 961 | align: "center", |
958 | }, | 962 | }, |
959 | { | 963 | { |
960 | text: "Father Cell No", | 964 | text: "Father Cell No", |
961 | value: "fatherName", | 965 | value: "fatherName", |
962 | sortable: false, | 966 | sortable: false, |
963 | align: "center", | 967 | align: "center", |
964 | }, | 968 | }, |
965 | { | 969 | { |
966 | text: "Mother Name", | 970 | text: "Mother Name", |
967 | value: "motherName", | 971 | value: "motherName", |
968 | sortable: false, | 972 | sortable: false, |
969 | align: "center", | 973 | align: "center", |
970 | }, | 974 | }, |
971 | { | 975 | { |
972 | text: "Mother Cell No", | 976 | text: "Mother Cell No", |
973 | value: "motherCellNo", | 977 | value: "motherCellNo", |
974 | sortable: false, | 978 | sortable: false, |
975 | align: "center", | 979 | align: "center", |
976 | }, | 980 | }, |
977 | { text: "Action", value: "", sortable: false, align: "center" }, | 981 | { text: "Action", value: "", sortable: false, align: "center" }, |
978 | ], | 982 | ], |
979 | parentsList: [], | 983 | parentsList: [], |
980 | editedIndex: -1, | 984 | editedIndex: -1, |
981 | parentData: {}, | 985 | parentData: {}, |
982 | max: 10, | 986 | max: 10, |
983 | editedItem: { | 987 | editedItem: { |
984 | fatherName: "", | 988 | fatherName: "", |
985 | fatherCellNo: "", | 989 | fatherCellNo: "", |
986 | motherName: "", | 990 | motherName: "", |
987 | motherCellNo: "", | 991 | motherCellNo: "", |
988 | email: "", | 992 | email: "", |
989 | password: "", | 993 | password: "", |
990 | }, | 994 | }, |
991 | editMpin: { | 995 | editMpin: { |
992 | mPin: "", | 996 | mPin: "", |
993 | }, | 997 | }, |
994 | isFatherCellExists: false, | 998 | isFatherCellExists: false, |
995 | }), | 999 | }), |
996 | watch: { | 1000 | watch: { |
997 | menu(val) { | 1001 | menu(val) { |
998 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 1002 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
999 | }, | 1003 | }, |
1000 | menu1(val) { | 1004 | menu1(val) { |
1001 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 1005 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
1002 | }, | 1006 | }, |
1007 | addParentDialog: function (val) { | ||
1008 | if (!val) { | ||
1009 | this.parentData = []; | ||
1010 | } | ||
1011 | }, | ||
1003 | }, | 1012 | }, |
1004 | methods: { | 1013 | methods: { |
1005 | editItem(item) { | 1014 | editItem(item) { |
1006 | this.editedIndex = this.parentsList.indexOf(item); | 1015 | this.editedIndex = this.parentsList.indexOf(item); |
1007 | this.editedItem = Object.assign({}, item); | 1016 | this.editedItem = Object.assign({}, item); |
1008 | this.editParentDilaog = true; | 1017 | this.editParentDilaog = true; |
1009 | }, | 1018 | }, |
1010 | profile(item) { | 1019 | profile(item) { |
1011 | this.editedIndex = this.parentsList.indexOf(item); | 1020 | this.editedIndex = this.parentsList.indexOf(item); |
1012 | this.editedItem = Object.assign({}, item); | 1021 | this.editedItem = Object.assign({}, item); |
1013 | this.profileParentDialog = true; | 1022 | this.profileParentDialog = true; |
1014 | }, | 1023 | }, |
1015 | resetParentMPIN(item) { | 1024 | resetParentMPIN(item) { |
1016 | this.editMpin = Object.assign({}, item); | 1025 | this.editMpin = Object.assign({}, item); |
1017 | this.resetParentMpin = true; | 1026 | this.resetParentMpin = true; |
1018 | }, | 1027 | }, |
1019 | close() { | 1028 | close() { |
1020 | this.editParentDilaog = false; | 1029 | this.editParentDilaog = false; |
1021 | }, | 1030 | }, |
1022 | closeProfile() { | 1031 | closeProfile() { |
1023 | this.profileParentDialog = false; | 1032 | this.profileParentDialog = false; |
1024 | }, | 1033 | }, |
1025 | closeReset() { | 1034 | closeReset() { |
1026 | this.resetParentMpin = false; | 1035 | this.resetParentMpin = false; |
1027 | }, | 1036 | }, |
1028 | clear() { | 1037 | clear() { |
1029 | this.$refs.parentForm.reset(); | 1038 | this.$refs.parentForm.reset(); |
1030 | }, | 1039 | }, |
1031 | save() { | 1040 | save() { |
1032 | if (this.$refs.editParentForm.validate()) { | 1041 | if (this.$refs.editParentForm.validate()) { |
1033 | this.editedItem.parentId = this.editedItem._id; | 1042 | this.editedItem.parentId = this.editedItem._id; |
1034 | http() | 1043 | http() |
1035 | .put("/updateParent", this.editedItem) | 1044 | .put("/updateParent", this.editedItem) |
1036 | .then((response) => { | 1045 | .then((response) => { |
1037 | this.snackbar = true; | 1046 | this.snackbar = true; |
1038 | this.color = "green"; | 1047 | this.color = "green"; |
1039 | this.text = response.data.message; | 1048 | this.text = response.data.message; |
1040 | this.getParentDetails(); | 1049 | this.getParentDetails(); |
1041 | this.close(); | 1050 | this.close(); |
1042 | }) | 1051 | }) |
1043 | .catch((error) => { | 1052 | .catch((error) => { |
1044 | this.snackbar = true; | 1053 | this.snackbar = true; |
1045 | this.color = "error"; | 1054 | this.color = "error"; |
1046 | this.text = error.response.data.message; | 1055 | this.text = error.response.data.message; |
1047 | if (error.response.data.statusText) { | 1056 | if (error.response.data.statusText) { |
1048 | this.text = error.response.data.statusText; | 1057 | this.text = error.response.data.statusText; |
1049 | } | 1058 | } |
1050 | }); | 1059 | }); |
1051 | } | 1060 | } |
1052 | }, | 1061 | }, |
1053 | resetMpin() { | 1062 | resetMpin() { |
1054 | if (this.$refs.resetParentMpinForm.validate()) { | 1063 | if (this.$refs.resetParentMpinForm.validate()) { |
1055 | var changeMpin = { | 1064 | var changeMpin = { |
1056 | parentId: this.editMpin._id, | 1065 | parentId: this.editMpin._id, |
1057 | mPin: this.editMpin.mPin, | 1066 | mPin: this.editMpin.mPin, |
1058 | }; | 1067 | }; |
1059 | http() | 1068 | http() |
1060 | .put("/resetMPin", changeMpin) | 1069 | .put("/resetMPin", changeMpin) |
1061 | .then((response) => { | 1070 | .then((response) => { |
1062 | this.snackbar = true; | 1071 | this.snackbar = true; |
1063 | this.color = "green"; | 1072 | this.color = "green"; |
1064 | this.text = response.data.message; | 1073 | this.text = response.data.message; |
1065 | this.getParentDetails(); | 1074 | this.getParentDetails(); |
1066 | this.resetParentMpin = false; | 1075 | this.resetParentMpin = false; |
1067 | this.closeReset(); | 1076 | this.closeReset(); |
1068 | }) | 1077 | }) |
1069 | .catch((error) => { | 1078 | .catch((error) => { |
1070 | this.snackbar = true; | 1079 | this.snackbar = true; |
1071 | this.color = "error"; | 1080 | this.color = "error"; |
1072 | this.text = error.response.data.message; | 1081 | this.text = error.response.data.message; |
1073 | if (error.response.data.statusText) { | 1082 | if (error.response.data.statusText) { |
1074 | this.text = error.response.data.statusText; | 1083 | this.text = error.response.data.statusText; |
1075 | } | 1084 | } |
1076 | }); | 1085 | }); |
1077 | } | 1086 | } |
1078 | }, | 1087 | }, |
1079 | async submitParentDetails() { | 1088 | async submitParentDetails() { |
1080 | if (this.$refs.parentForm.validate()) { | 1089 | if (this.$refs.parentForm.validate()) { |
1081 | this.parentData.role = "PARENT"; | 1090 | this.parentData.role = "PARENT"; |
1082 | this.loading = true; | 1091 | this.loading = true; |
1083 | await http() | 1092 | await http() |
1084 | .post("/createParent", this.parentData) | 1093 | .post("/createParent", this.parentData) |
1085 | .then((response) => { | 1094 | .then((response) => { |
1086 | this.parentId = response.data.data.id; | 1095 | this.parentId = response.data.data.id; |
1087 | this.snackbar = true; | 1096 | this.snackbar = true; |
1088 | this.color = "green"; | 1097 | this.color = "green"; |
1089 | this.text = response.data.message; | 1098 | this.text = response.data.message; |
1090 | this.getParentDetails(); | 1099 | this.getParentDetails(); |
1091 | this.clear(); | 1100 | this.clear(); |
1092 | this.loading = false; | 1101 | this.loading = false; |
1093 | this.isFatherCellExists = true; | 1102 | this.isFatherCellExists = true; |
1094 | this.addParentDialog = false; | 1103 | this.addParentDialog = false; |
1095 | }) | 1104 | }) |
1096 | .catch((error) => { | 1105 | .catch((error) => { |
1097 | this.snackbar = true; | 1106 | this.snackbar = true; |
1098 | this.color = "error"; | 1107 | this.color = "error"; |
1099 | this.text = error.response.data.message; | 1108 | this.text = error.response.data.message; |
1100 | if (error.response.data.statusText) { | 1109 | if (error.response.data.statusText) { |
1101 | this.text = error.response.data.statusText; | 1110 | this.text = error.response.data.statusText; |
1102 | } | 1111 | } |
1103 | this.loading = false; | 1112 | this.loading = false; |
1104 | }); | 1113 | }); |
1105 | } | 1114 | } |
1106 | }, | 1115 | }, |
1107 | getParentDetails() { | 1116 | getParentDetails() { |
1108 | http() | 1117 | http() |
1109 | .get("getParentsList", { | 1118 | .get("getParentsList", { |
1110 | headers: { | 1119 | headers: { |
1111 | Authorization: "Bearer " + this.$store.state.token, | 1120 | Authorization: "Bearer " + this.$store.state.token, |
1112 | }, | 1121 | }, |
1113 | }) | 1122 | }) |
1114 | .then((response) => { | 1123 | .then((response) => { |
1115 | this.parentsList = response.data.data; | 1124 | this.parentsList = response.data.data; |
1116 | }) | 1125 | }) |
1117 | .catch((error) => { | 1126 | .catch((error) => { |
1118 | // console.log("err====>", error.response.data.message); | 1127 | // console.log("err====>", error.response.data.message); |
1119 | this.showLoader = false; | 1128 | this.showLoader = false; |
1120 | if (error.response.status === 401) { | 1129 | if (error.response.status === 401) { |
1121 | this.$router.replace({ path: "/" }); | 1130 | this.$router.replace({ path: "/" }); |
1122 | this.$store.dispatch("setToken", null); | 1131 | this.$store.dispatch("setToken", null); |
1123 | this.$store.dispatch("Id", null); | 1132 | this.$store.dispatch("Id", null); |
1124 | this.$store.dispatch("Role", null); | 1133 | this.$store.dispatch("Role", null); |
1125 | } | 1134 | } |
1126 | }); | 1135 | }); |
1127 | }, | 1136 | }, |
1128 | displaySearch() { | 1137 | displaySearch() { |
1129 | this.show = false | 1138 | this.show = false; |
1130 | this.showSearch = true; | 1139 | this.showSearch = true; |
1131 | // this.$refs.searchField.focus() | 1140 | // this.$refs.searchField.focus() |
1132 | }, | 1141 | }, |
1133 | closeSearch() { | 1142 | closeSearch() { |
1134 | this.showSearch = false; | 1143 | this.showSearch = false; |
1135 | this.show = true; | 1144 | this.show = true; |
1136 | this.search = ""; | 1145 | this.search = ""; |
1137 | }, | 1146 | }, |
1138 | }, | 1147 | }, |
1139 | mounted() { | 1148 | mounted() { |
1140 | this.getParentDetails(); | 1149 | this.getParentDetails(); |
1141 | // console.log("role", this.$store.state.role); | 1150 | // console.log("role", this.$store.state.role); |
1142 | this.role = this.$store.state.role; | 1151 | this.role = this.$store.state.role; |
1143 | }, | 1152 | }, |
1144 | }; | 1153 | }; |
1145 | </script> | 1154 | </script> |
src/pages/Payroll/hourlyTemplate.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** Edit Hourly Template ****** --> | 3 | <!-- ****** Edit Hourly Template ****** --> |
4 | <v-dialog v-model="editHourDialog" max-width="400px"> | 4 | <v-dialog v-model="editHourDialog" 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 Hourly Template</label> | 8 | <label class="title text-xs-center">Edit Hourly Template</label> |
9 | <v-icon size="24" class="right" @click="editHourDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editHourDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-form ref="form"> | 12 | <v-form ref="form"> |
13 | <v-container fluid> | 13 | <v-container fluid> |
14 | <v-flex xs12 sm12> | 14 | <v-flex xs12 sm12> |
15 | <v-layout> | 15 | <v-layout> |
16 | <v-flex xs3 class="pt-4 subheading"> | 16 | <v-flex xs3 class="pt-4 subheading"> |
17 | <label class="right">Hourly Grades:</label> | 17 | <label class="right">Hourly Grades:</label> |
18 | </v-flex> | 18 | </v-flex> |
19 | <v-flex xs8 sm7 class="ml-3"> | 19 | <v-flex xs8 sm7 class="ml-3"> |
20 | <v-text-field | 20 | <v-text-field |
21 | v-model="editedItem.hourlyGrades" | 21 | v-model="editedItem.hourlyGrades" |
22 | placeholder="please fill this field" | 22 | placeholder="please fill this field" |
23 | ></v-text-field> | 23 | ></v-text-field> |
24 | </v-flex> | 24 | </v-flex> |
25 | </v-layout> | 25 | </v-layout> |
26 | </v-flex> | 26 | </v-flex> |
27 | <v-flex xs12 sm12> | 27 | <v-flex xs12 sm12> |
28 | <v-layout> | 28 | <v-layout> |
29 | <v-flex xs3 class="pt-4 subheading"> | 29 | <v-flex xs3 class="pt-4 subheading"> |
30 | <label class="right">Hourly Reates:</label> | 30 | <label class="right">Hourly Reates:</label> |
31 | </v-flex> | 31 | </v-flex> |
32 | <v-flex xs8 sm7 class="ml-3"> | 32 | <v-flex xs8 sm7 class="ml-3"> |
33 | <v-text-field | 33 | <v-text-field |
34 | v-model="editedItem.hourlyRate" | 34 | v-model="editedItem.hourlyRate" |
35 | placeholder="please fill this field" | 35 | placeholder="please fill this field" |
36 | ></v-text-field> | 36 | ></v-text-field> |
37 | </v-flex> | 37 | </v-flex> |
38 | </v-layout> | 38 | </v-layout> |
39 | </v-flex> | 39 | </v-flex> |
40 | <v-layout> | 40 | <v-layout> |
41 | <v-flex xs12> | 41 | <v-flex xs12> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-spacer></v-spacer> | 43 | <v-spacer></v-spacer> |
44 | <v-btn round dark @click="save" class="add-button">Update Hourly Template</v-btn> | 44 | <v-btn round dark @click="save" class="add-button">Update Hourly Template</v-btn> |
45 | <v-spacer></v-spacer> | 45 | <v-spacer></v-spacer> |
46 | </v-layout> | 46 | </v-layout> |
47 | </v-flex> | 47 | </v-flex> |
48 | </v-layout> | 48 | </v-layout> |
49 | </v-container> | 49 | </v-container> |
50 | </v-form> | 50 | </v-form> |
51 | </v-card> | 51 | </v-card> |
52 | </v-dialog> | 52 | </v-dialog> |
53 | 53 | ||
54 | <!-- **** HOURLY TEMPLATE **** --> | 54 | <!-- **** HOURLY TEMPLATE **** --> |
55 | <v-toolbar color="transparent" flat> | 55 | <v-toolbar color="transparent" flat> |
56 | <v-btn | 56 | <v-btn |
57 | fab | 57 | fab |
58 | dark | 58 | dark |
59 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 59 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
60 | small | 60 | small |
61 | @click="addHourDialog = true" | 61 | @click="addHourDialog = true" |
62 | > | 62 | > |
63 | <v-icon dark>add</v-icon> | 63 | <v-icon dark>add</v-icon> |
64 | </v-btn> | 64 | </v-btn> |
65 | <v-btn | 65 | <v-btn |
66 | round | 66 | round |
67 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 67 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
68 | dark | 68 | dark |
69 | @click="addHourDialog = true" | 69 | @click="addHourDialog = true" |
70 | > | 70 | > |
71 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Hourly Template | 71 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Hourly Template |
72 | </v-btn> | 72 | </v-btn> |
73 | <v-spacer></v-spacer> | 73 | <v-spacer></v-spacer> |
74 | <v-card-title class="body-1" v-show="show"> | 74 | <v-card-title class="body-1" v-show="show"> |
75 | <v-btn icon large flat @click="displaySearch"> | 75 | <v-btn icon large flat @click="displaySearch"> |
76 | <v-avatar size="27"> | 76 | <v-avatar size="27"> |
77 | <img src="/static/icon/search.png" alt="icon" /> | 77 | <img src="/static/icon/search.png" alt="icon" /> |
78 | </v-avatar> | 78 | </v-avatar> |
79 | </v-btn> | 79 | </v-btn> |
80 | </v-card-title> | 80 | </v-card-title> |
81 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 81 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
82 | <v-layout> | 82 | <v-layout> |
83 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 83 | <v-text-field |
84 | autofocus | ||
85 | v-model="search" | ||
86 | label="Search" | ||
87 | prepend-inner-icon="search" | ||
88 | color="primary" | ||
89 | ></v-text-field> | ||
84 | <v-icon @click="closeSearch" color="error">close</v-icon> | 90 | <v-icon @click="closeSearch" color="error">close</v-icon> |
85 | </v-layout> | 91 | </v-layout> |
86 | </v-flex> | 92 | </v-flex> |
87 | </v-toolbar> | 93 | </v-toolbar> |
88 | 94 | ||
89 | <v-data-table | 95 | <v-data-table |
90 | :headers="headers" | 96 | :headers="headers" |
91 | :items="hourlyData" | 97 | :items="hourlyData" |
92 | :pagination.sync="pagination" | 98 | :pagination.sync="pagination" |
93 | :search="search" | 99 | :search="search" |
94 | > | 100 | > |
95 | <template slot="items" slot-scope="props"> | 101 | <template slot="items" slot-scope="props"> |
96 | <tr class="tr"> | 102 | <tr class="tr"> |
97 | <td class="td td-row">{{ props.index + 1}}</td> | 103 | <td class="td td-row">{{ props.index + 1}}</td> |
98 | <td class="td td-row text-xs-center">{{ props.item.hourlyGrades}}</td> | 104 | <td class="td td-row text-xs-center">{{ props.item.hourlyGrades}}</td> |
99 | <td class="td td-row text-xs-center">{{ props.item.hourlyRate}}</td> | 105 | <td class="td td-row text-xs-center">{{ props.item.hourlyRate}}</td> |
100 | <!-- <td class="td td-row text-xs-center">{{ props.item.overtimeRate}}</td> --> | 106 | <!-- <td class="td td-row text-xs-center">{{ props.item.overtimeRate}}</td> --> |
101 | <td class="td td-row text-xs-center"> | 107 | <td class="td td-row text-xs-center"> |
102 | <span> | 108 | <span> |
103 | <v-tooltip top> | 109 | <v-tooltip top> |
104 | <img | 110 | <img |
105 | slot="activator" | 111 | slot="activator" |
106 | style="cursor:pointer; width:20px; height:18px; " | 112 | style="cursor:pointer; width:20px; height:18px; " |
107 | class="mr-3" | 113 | class="mr-3" |
108 | @click="editItem(props.item)" | 114 | @click="editItem(props.item)" |
109 | src="/static/icon/edit.png" | 115 | src="/static/icon/edit.png" |
110 | /> | 116 | /> |
111 | <span>Edit</span> | 117 | <span>Edit</span> |
112 | </v-tooltip> | 118 | </v-tooltip> |
113 | <v-tooltip top> | 119 | <v-tooltip top> |
114 | <img | 120 | <img |
115 | slot="activator" | 121 | slot="activator" |
116 | style="cursor:pointer; width:20px; height:20px; " | 122 | style="cursor:pointer; width:20px; height:20px; " |
117 | class="mr-3" | 123 | class="mr-3" |
118 | @click="deleteItem(props.item)" | 124 | @click="deleteItem(props.item)" |
119 | src="/static/icon/delete.png" | 125 | src="/static/icon/delete.png" |
120 | /> | 126 | /> |
121 | <span>Delete</span> | 127 | <span>Delete</span> |
122 | </v-tooltip> | 128 | </v-tooltip> |
123 | </span> | 129 | </span> |
124 | </td> | 130 | </td> |
125 | </tr> | 131 | </tr> |
126 | </template> | 132 | </template> |
127 | <v-alert | 133 | <v-alert |
128 | slot="no-results" | 134 | slot="no-results" |
129 | :value="true" | 135 | :value="true" |
130 | color="error" | 136 | color="error" |
131 | icon="warning" | 137 | icon="warning" |
132 | >Your search for "{{ search }}" found no results.</v-alert> | 138 | >Your search for "{{ search }}" found no results.</v-alert> |
133 | </v-data-table> | 139 | </v-data-table> |
134 | 140 | ||
135 | <!-- **** Add Hourly Template **** --> | 141 | <!-- **** Add Hourly Template **** --> |
136 | <v-dialog v-model="addHourDialog" max-width="400px"> | 142 | <v-dialog v-model="addHourDialog" max-width="400px" v-if="addHourDialog"> |
137 | <v-card flat class="card-style pa-2" dark> | 143 | <v-card flat class="card-style pa-2" dark> |
138 | <v-layout> | 144 | <v-layout> |
139 | <v-flex xs12> | 145 | <v-flex xs12> |
140 | <label class="title text-xs-center">Add Hourly Template</label> | 146 | <label class="title text-xs-center">Add Hourly Template</label> |
141 | <v-icon size="24" class="right" @click="addHourDialog = false">cancel</v-icon> | 147 | <v-icon size="24" class="right" @click="closeAddHourModel">cancel</v-icon> |
142 | </v-flex> | 148 | </v-flex> |
143 | </v-layout> | 149 | </v-layout> |
144 | <v-form ref="form" v-model="valid" lazy-validation> | 150 | <v-form ref="form" v-model="valid" lazy-validation> |
145 | <v-container fluid> | 151 | <v-container fluid> |
146 | <v-flex xs12> | 152 | <v-flex xs12> |
147 | <v-layout> | 153 | <v-layout> |
148 | <v-flex xs4 class="pt-4 subheading"> | 154 | <v-flex xs4 class="pt-4 subheading"> |
149 | <label class="right">Hourly Grades:</label> | 155 | <label class="right">Hourly Grades:</label> |
150 | </v-flex> | 156 | </v-flex> |
151 | <v-flex xs8 sm7 class="ml-3"> | 157 | <v-flex xs8 sm7 class="ml-3"> |
152 | <v-text-field | 158 | <v-text-field |
153 | placeholder="Please fill this field" | 159 | placeholder="Please fill this field" |
154 | :rules="hourRules" | 160 | :rules="hourRules" |
155 | v-model="hourlyTypes.hourlyGrades" | 161 | v-model="hourlyTypes.hourlyGrades" |
156 | ></v-text-field> | 162 | ></v-text-field> |
157 | </v-flex> | 163 | </v-flex> |
158 | </v-layout> | 164 | </v-layout> |
159 | </v-flex> | 165 | </v-flex> |
160 | <v-flex xs12> | 166 | <v-flex xs12> |
161 | <v-layout> | 167 | <v-layout> |
162 | <v-flex xs4 class="pt-4 subheading"> | 168 | <v-flex xs4 class="pt-4 subheading"> |
163 | <label class="right">Hourly Rate:</label> | 169 | <label class="right">Hourly Rate:</label> |
164 | </v-flex> | 170 | </v-flex> |
165 | <v-flex xs8 sm7 class="ml-3"> | 171 | <v-flex xs8 sm7 class="ml-3"> |
166 | <v-text-field | 172 | <v-text-field |
167 | placeholder="Please fill this field" | 173 | placeholder="Please fill this field" |
168 | :rules="hourRules" | 174 | :rules="hourRules" |
169 | v-model="hourlyTypes.hourlyRate" | 175 | v-model="hourlyTypes.hourlyRate" |
170 | ></v-text-field> | 176 | ></v-text-field> |
171 | </v-flex> | 177 | </v-flex> |
172 | </v-layout> | 178 | </v-layout> |
173 | </v-flex> | 179 | </v-flex> |
174 | <v-layout> | 180 | <v-layout> |
175 | <v-flex xs12 sm12> | 181 | <v-flex xs12 sm12> |
176 | <v-layout> | 182 | <v-layout> |
177 | <v-spacer></v-spacer> | 183 | <v-spacer></v-spacer> |
178 | <!-- <v-btn @click="clear" round class="add-button" dark>clear</v-btn> --> | 184 | <!-- <v-btn @click="clear" round class="add-button" dark>clear</v-btn> --> |
179 | <v-btn | 185 | <v-btn |
180 | @click="submit" | 186 | @click="submit" |
181 | round | 187 | round |
182 | dark | 188 | dark |
183 | :loading="loading" | 189 | :loading="loading" |
184 | class="add-button" | 190 | class="add-button" |
185 | >Add Hourly Template</v-btn> | 191 | >Add Hourly Template</v-btn> |
186 | <v-spacer></v-spacer> | 192 | <v-spacer></v-spacer> |
187 | </v-layout> | 193 | </v-layout> |
188 | </v-flex> | 194 | </v-flex> |
189 | </v-layout> | 195 | </v-layout> |
190 | </v-container> | 196 | </v-container> |
191 | </v-form> | 197 | </v-form> |
192 | </v-card> | 198 | </v-card> |
193 | </v-dialog> | 199 | </v-dialog> |
194 | 200 | ||
195 | <v-snackbar | 201 | <v-snackbar |
196 | :timeout="timeout" | 202 | :timeout="timeout" |
197 | :top="y === 'top'" | 203 | :top="y === 'top'" |
198 | :right="x === 'right'" | 204 | :right="x === 'right'" |
199 | :vertical="mode === 'vertical'" | 205 | :vertical="mode === 'vertical'" |
200 | v-model="snackbar" | 206 | v-model="snackbar" |
201 | :color="color" | 207 | :color="color" |
202 | >{{ text }}</v-snackbar> | 208 | >{{ text }}</v-snackbar> |
203 | <div class="loader" v-if="showLoader"> | 209 | <div class="loader" v-if="showLoader"> |
204 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 210 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
205 | </div> | 211 | </div> |
206 | </v-container> | 212 | </v-container> |
207 | </template> | 213 | </template> |
208 | 214 | ||
209 | <script> | 215 | <script> |
210 | import http from "@/Services/http.js"; | 216 | import http from "@/Services/http.js"; |
211 | import moment from "moment"; | 217 | import moment from "moment"; |
212 | 218 | ||
213 | export default { | 219 | export default { |
214 | data: () => ({ | 220 | data: () => ({ |
215 | snackbar: false, | 221 | snackbar: false, |
216 | date: null, | 222 | date: null, |
217 | color: "", | 223 | color: "", |
218 | y: "top", | 224 | y: "top", |
219 | x: "right", | 225 | x: "right", |
220 | mode: "", | 226 | mode: "", |
221 | timeout: 10000, | 227 | timeout: 10000, |
222 | text: "", | 228 | text: "", |
223 | show: true, | 229 | show: true, |
224 | showSearch: false, | 230 | showSearch: false, |
225 | addHourDialog: false, | 231 | addHourDialog: false, |
226 | loading: false, | 232 | loading: false, |
227 | loadingSearch: false, | 233 | loadingSearch: false, |
228 | search: "", | 234 | search: "", |
229 | showLoader: false, | 235 | showLoader: false, |
230 | editHourDialog: false, | 236 | editHourDialog: false, |
231 | valid: true, | 237 | valid: true, |
232 | disabled: true, | 238 | disabled: true, |
233 | pagination: { | 239 | pagination: { |
234 | rowsPerPage: 10 | 240 | rowsPerPage: 10, |
235 | }, | 241 | }, |
236 | hourRules: [v => !!v || "Field is required"], | 242 | hourRules: [(v) => !!v || "Field is required"], |
237 | 243 | ||
238 | headers: [ | 244 | headers: [ |
239 | { | 245 | { |
240 | align: "", | 246 | align: "", |
241 | text: "No", | 247 | text: "No", |
242 | sortable: false, | 248 | sortable: false, |
243 | value: "No" | 249 | value: "No", |
244 | }, | 250 | }, |
245 | { | 251 | { |
246 | text: "Hourly Grades", | 252 | text: "Hourly Grades", |
247 | value: "hourlyGrades", | 253 | value: "hourlyGrades", |
248 | sortable: false, | 254 | sortable: false, |
249 | align: "center" | 255 | align: "center", |
250 | }, | 256 | }, |
251 | { | 257 | { |
252 | text: "Hourly Rate", | 258 | text: "Hourly Rate", |
253 | value: "hourlyRate", | 259 | value: "hourlyRate", |
254 | sortable: false, | 260 | sortable: false, |
255 | align: "center" | 261 | align: "center", |
256 | }, | 262 | }, |
257 | { text: "Action", value: "", sortable: false, align: "center" } | 263 | { text: "Action", value: "", sortable: false, align: "center" }, |
258 | ], | 264 | ], |
259 | hourlyTypes: [], | 265 | hourlyTypes: [], |
260 | hourlyData: [], | 266 | hourlyData: [], |
261 | editedItem: {} | 267 | editedItem: {}, |
262 | }), | 268 | }), |
269 | watch: { | ||
270 | addHourDialog: function (val) { | ||
271 | if (!val) { | ||
272 | this.hourlyTypes = []; | ||
273 | } | ||
274 | }, | ||
275 | }, | ||
263 | methods: { | 276 | methods: { |
264 | close() { | 277 | close() { |
265 | this.editHourDialog = false; | 278 | this.editHourDialog = false; |
266 | }, | 279 | }, |
280 | closeAddHourModel() { | ||
281 | this.addHourDialog = false; | ||
282 | this.hourlyData = []; | ||
283 | this.hourlyTypes = []; | ||
284 | }, | ||
267 | submit() { | 285 | submit() { |
268 | var Hour = { | 286 | var Hour = { |
269 | hourlyGrades: this.hourlyTypes.hourlyGrades, | 287 | hourlyGrades: this.hourlyTypes.hourlyGrades, |
270 | hourlyRate: this.hourlyTypes.hourlyRate | 288 | hourlyRate: this.hourlyTypes.hourlyRate, |
271 | }; | 289 | }; |
272 | if (this.$refs.form.validate()) { | 290 | if (this.$refs.form.validate()) { |
273 | this.loading = true; | 291 | this.loading = true; |
274 | http() | 292 | http() |
275 | .post("/createHourly", Hour, { | 293 | .post("/createHourly", Hour, { |
276 | headers: { Authorization: "Bearer " + this.token } | 294 | headers: { Authorization: "Bearer " + this.token }, |
277 | }) | 295 | }) |
278 | .then(response => { | 296 | .then((response) => { |
279 | this.snackbar = true; | 297 | this.snackbar = true; |
280 | this.text = response.data.message; | 298 | this.text = response.data.message; |
281 | this.getHourlyList(); | 299 | this.getHourlyList(); |
282 | this.color = "green"; | 300 | this.color = "green"; |
283 | this.addHourDialog = false; | 301 | this.addHourDialog = false; |
284 | // this.color = "success"; | 302 | // this.color = "success"; |
285 | this.clear(); | 303 | this.clear(); |
286 | this.loading = false; | 304 | this.loading = false; |
287 | }) | 305 | }) |
288 | .catch(error => { | 306 | .catch((error) => { |
289 | console.log("error", error); | 307 | console.log("error", error); |
290 | this.snackbar = true; | 308 | this.snackbar = true; |
291 | this.color = "red"; | 309 | this.color = "red"; |
292 | // this.text = error.response.data.message; | 310 | // this.text = error.response.data.message; |
293 | this.loading = false; | 311 | this.loading = false; |
294 | }); | 312 | }); |
295 | } | 313 | } |
296 | }, | 314 | }, |
297 | getHourlyList() { | 315 | getHourlyList() { |
298 | this.showLoader = true; | 316 | this.showLoader = true; |
299 | this.loadingSearch = true; | 317 | this.loadingSearch = true; |
300 | http() | 318 | http() |
301 | .get("/getHourlyList", { | 319 | .get("/getHourlyList", { |
302 | headers: { Authorization: "Bearer " + this.token } | 320 | headers: { Authorization: "Bearer " + this.token }, |
303 | }) | 321 | }) |
304 | .then(response => { | 322 | .then((response) => { |
305 | this.hourlyData = response.data.data; | 323 | this.hourlyData = response.data.data; |
306 | this.showLoader = false; | 324 | this.showLoader = false; |
307 | this.loadingSearch = false; | 325 | this.loadingSearch = false; |
308 | }) | 326 | }) |
309 | .catch(error => { | 327 | .catch((error) => { |
310 | // console.log("err====>", err); | 328 | // console.log("err====>", err); |
311 | this.showLoader = false; | 329 | this.showLoader = false; |
312 | this.loadingSearch = false; | 330 | this.loadingSearch = false; |
313 | this.snackbar = true; | 331 | this.snackbar = true; |
314 | this.text = error.response.data.message; | 332 | this.text = error.response.data.message; |
315 | if (error.response.status === 401) { | 333 | if (error.response.status === 401) { |
316 | this.$router.replace({ path: "/" }); | 334 | this.$router.replace({ path: "/" }); |
317 | this.$store.dispatch("setToken", null); | 335 | this.$store.dispatch("setToken", null); |
318 | this.$store.dispatch("Id", null); | 336 | this.$store.dispatch("Id", null); |
319 | } | 337 | } |
320 | }); | 338 | }); |
321 | }, | 339 | }, |
322 | 340 | ||
323 | editItem(item) { | 341 | editItem(item) { |
324 | this.editedIndex = this.hourlyData.indexOf(item); | 342 | this.editedIndex = this.hourlyData.indexOf(item); |
325 | this.editedItem = Object.assign({}, item); | 343 | this.editedItem = Object.assign({}, item); |
326 | this.editHourDialog = true; | 344 | this.editHourDialog = true; |
327 | }, | 345 | }, |
328 | deleteItem(item) { | 346 | deleteItem(item) { |
329 | let deleteGrade = { | 347 | let deleteGrade = { |
330 | hourlyId: item._id | 348 | hourlyId: item._id, |
331 | }; | 349 | }; |
332 | http() | 350 | http() |
333 | .delete( | 351 | .delete( |
334 | "/deleteHourly", | 352 | "/deleteHourly", |
335 | confirm("Are you sure you want to delete this?") && { | 353 | confirm("Are you sure you want to delete this?") && { |
336 | params: deleteGrade | 354 | params: deleteGrade, |
337 | }, | 355 | }, |
338 | { | 356 | { |
339 | headers: { | 357 | headers: { |
340 | Authorization: "Bearer " + this.token | 358 | Authorization: "Bearer " + this.token, |
341 | } | 359 | }, |
342 | } | 360 | } |
343 | ) | 361 | ) |
344 | .then(response => { | 362 | .then((response) => { |
345 | this.snackbar = true; | 363 | this.snackbar = true; |
346 | // this.text = "Successfully Delete Salary "; | 364 | // this.text = "Successfully Delete Salary "; |
347 | this.text = response.data.message; | 365 | this.text = response.data.message; |
348 | this.color = "green"; | 366 | this.color = "green"; |
349 | this.getHourlyList(); | 367 | this.getHourlyList(); |
350 | }) | 368 | }) |
351 | .catch(error => { | 369 | .catch((error) => { |
352 | console.log("error", error); | 370 | console.log("error", error); |
353 | this.snackbar = true; | 371 | this.snackbar = true; |
354 | this.text = error.response.data.message; | 372 | this.text = error.response.data.message; |
355 | this.color = "red"; | 373 | this.color = "red"; |
356 | }); | 374 | }); |
357 | }, | 375 | }, |
358 | 376 | ||
359 | save() { | 377 | save() { |
360 | var updateHourly = { | 378 | var updateHourly = { |
361 | hourlyId: this.editedItem._id, | 379 | hourlyId: this.editedItem._id, |
362 | hourlyGrades: this.editedItem.hourlyGrades, | 380 | hourlyGrades: this.editedItem.hourlyGrades, |
363 | hourlyRate: this.editedItem.hourlyRate, | 381 | hourlyRate: this.editedItem.hourlyRate, |
364 | }; | 382 | }; |
365 | http() | 383 | http() |
366 | .put("/updateHourly", updateHourly, { | 384 | .put("/updateHourly", updateHourly, { |
367 | headers: { | 385 | headers: { |
368 | Authorization: "Bearer " + this.token | 386 | Authorization: "Bearer " + this.token, |
369 | } | 387 | }, |
370 | }) | 388 | }) |
371 | .then(response => { | 389 | .then((response) => { |
372 | // this.text = "Successfully Edit Notification"; | 390 | // this.text = "Successfully Edit Notification"; |
373 | this.getHourlyList(); | 391 | this.getHourlyList(); |
374 | this.close(); | 392 | this.close(); |
375 | this.snackbar = true; | 393 | this.snackbar = true; |
376 | this.text = response.data.message; | 394 | this.text = response.data.message; |
377 | this.color = "green"; | 395 | this.color = "green"; |
378 | this.editHourDialog = false; | 396 | this.editHourDialog = false; |
379 | }) | 397 | }) |
380 | .catch(error => { | 398 | .catch((error) => { |
381 | console.log("error", error); | 399 | console.log("error", error); |
382 | this.snackbar = true; | 400 | this.snackbar = true; |
383 | // this.text = error.response.data.message; | 401 | // this.text = error.response.data.message; |
384 | this.color = "red"; | 402 | this.color = "red"; |
385 | }); | 403 | }); |
386 | }, | 404 | }, |
387 | 405 | ||
388 | displaySearch() { | 406 | displaySearch() { |
389 | (this.show = false), (this.showSearch = true); | 407 | (this.show = false), (this.showSearch = true); |
390 | }, | 408 | }, |
391 | closeSearch() { | 409 | closeSearch() { |
392 | this.showSearch = false; | 410 | this.showSearch = false; |
393 | this.show = true; | 411 | this.show = true; |
394 | this.search = ""; | 412 | this.search = ""; |
395 | }, | 413 | }, |
396 | clear() { | 414 | clear() { |
397 | this.$refs.form.reset(); | 415 | this.$refs.form.reset(); |
398 | } | 416 | }, |
399 | }, | 417 | }, |
400 | mounted() { | 418 | mounted() { |
401 | this.token = this.$store.state.token; | 419 | this.token = this.$store.state.token; |
402 | this.getHourlyList(); | 420 | this.getHourlyList(); |
403 | } | 421 | }, |
404 | }; | 422 | }; |
405 | </script> | 423 | </script> |
406 | 424 | ||
407 | <style scoped> | 425 | <style scoped> |
408 | </style> | 426 | </style> |
src/pages/Payroll/salaryTemplate.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color" style="box-sizing: border-box;"> | 2 | <v-container fluid class="body-color" style="box-sizing: border-box;"> |
3 | <!-- ****** EDIT SALARY ****** --> | 3 | <!-- ****** EDIT SALARY ****** --> |
4 | <v-dialog v-model="editSalaryDialog"> | 4 | <v-dialog v-model="editSalaryDialog"> |
5 | <v-card flat class="text-xs-center white--text"> | 5 | <v-card flat class="text-xs-center white--text"> |
6 | <v-layout> | 6 | <v-layout> |
7 | <v-flex xs12 class="card-style pa-2"> | 7 | <v-flex xs12 class="card-style pa-2"> |
8 | <label class="title text-xs-center">Edit Salary</label> | 8 | <label class="title text-xs-center">Edit Salary</label> |
9 | <v-icon size="24" color="white" class="right" @click="editSalaryDialog = false">cancel</v-icon> | 9 | <v-icon size="24" color="white" class="right" @click="editSalaryDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | 12 | ||
13 | <v-flex xs12 sm12> | 13 | <v-flex xs12 sm12> |
14 | <v-container fluid grid-list-md> | 14 | <v-container fluid grid-list-md> |
15 | <v-layout wrap> | 15 | <v-layout wrap> |
16 | <v-flex xs12 sm12 md6> | 16 | <v-flex xs12 sm12 md6> |
17 | <v-card flat> | 17 | <v-card flat> |
18 | <v-toolbar dark class="card-styles" flat> | 18 | <v-toolbar dark class="card-styles" flat> |
19 | <v-spacer></v-spacer> | 19 | <v-spacer></v-spacer> |
20 | <h3>Salary Template</h3> | 20 | <h3>Salary Template</h3> |
21 | <v-spacer></v-spacer> | 21 | <v-spacer></v-spacer> |
22 | </v-toolbar> | 22 | </v-toolbar> |
23 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> | 23 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> |
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 hidden-xs-only">Salary Grades :</label> | 26 | <label class="right hidden-xs-only">Salary Grades :</label> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-flex xs8 sm7 class="ml-3"> | 28 | <v-flex xs8 sm7 class="ml-3"> |
29 | <v-flex xs8 sm7 class="ml-3"> | 29 | <v-flex xs8 sm7 class="ml-3"> |
30 | <v-text-field :rules="salaryRules" v-model="editedItem.salaryGrades"></v-text-field> | 30 | <v-text-field :rules="salaryRules" v-model="editedItem.salaryGrades"></v-text-field> |
31 | </v-flex> | 31 | </v-flex> |
32 | </v-flex> | 32 | </v-flex> |
33 | </v-layout> | 33 | </v-layout> |
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">Basic Salary :</label> | 36 | <label class="right">Basic Salary :</label> |
37 | </v-flex> | 37 | </v-flex> |
38 | <v-flex xs8 sm7 class="ml-3"> | 38 | <v-flex xs8 sm7 class="ml-3"> |
39 | <v-flex xs8 sm7 class="ml-3"> | 39 | <v-flex xs8 sm7 class="ml-3"> |
40 | <v-text-field :rules="basicRules" v-model="editedItem.basicSalary"></v-text-field> | 40 | <v-text-field :rules="basicRules" v-model="editedItem.basicSalary"></v-text-field> |
41 | </v-flex> | 41 | </v-flex> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs4 class="pt-4 subheading"> | 45 | <v-flex xs4 class="pt-4 subheading"> |
46 | <label class="right">Overtime Rate (Per Hour) :</label> | 46 | <label class="right">Overtime Rate (Per Hour) :</label> |
47 | </v-flex> | 47 | </v-flex> |
48 | <v-flex xs8 sm7 class="ml-3"> | 48 | <v-flex xs8 sm7 class="ml-3"> |
49 | <v-flex xs8 sm7 class="ml-3"> | 49 | <v-flex xs8 sm7 class="ml-3"> |
50 | <v-text-field :rules="overtimeRules" v-model="editedItem.overtimeRate"></v-text-field> | 50 | <v-text-field :rules="overtimeRules" v-model="editedItem.overtimeRate"></v-text-field> |
51 | </v-flex> | 51 | </v-flex> |
52 | </v-flex> | 52 | </v-flex> |
53 | </v-layout> | 53 | </v-layout> |
54 | </v-form> | 54 | </v-form> |
55 | </v-card> | 55 | </v-card> |
56 | </v-flex> | 56 | </v-flex> |
57 | <!-- <v-flex xs12 sm12 md5></v-flex> --> | 57 | <!-- <v-flex xs12 sm12 md5></v-flex> --> |
58 | <v-flex xs12 sm12 md6> | 58 | <v-flex xs12 sm12 md6> |
59 | <v-card flat> | 59 | <v-card flat> |
60 | <v-toolbar dark class="card-styles" flat> | 60 | <v-toolbar dark class="card-styles" flat> |
61 | <v-spacer></v-spacer> | 61 | <v-spacer></v-spacer> |
62 | <h3>Allowances</h3> | 62 | <h3>Allowances</h3> |
63 | <v-spacer></v-spacer> | 63 | <v-spacer></v-spacer> |
64 | </v-toolbar> | 64 | </v-toolbar> |
65 | <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index"> | 65 | <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index"> |
66 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 66 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
67 | <v-text-field | 67 | <v-text-field |
68 | solo | 68 | solo |
69 | label="Enter Allowances Label" | 69 | label="Enter Allowances Label" |
70 | v-model="editedItem.allowancesName" | 70 | v-model="editedItem.allowancesName" |
71 | ></v-text-field> | 71 | ></v-text-field> |
72 | </v-flex> | 72 | </v-flex> |
73 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 73 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
74 | <v-text-field | 74 | <v-text-field |
75 | solo | 75 | solo |
76 | v-model="editedItem.allowancesValue" | 76 | v-model="editedItem.allowancesValue" |
77 | label="Enter Allowances Value" | 77 | label="Enter Allowances Value" |
78 | v-on:keyup="addAllowancesValue" | 78 | v-on:keyup="addAllowancesValue" |
79 | ></v-text-field> | 79 | ></v-text-field> |
80 | </v-flex> | 80 | </v-flex> |
81 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 81 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
82 | <v-btn | 82 | <v-btn |
83 | color="white" | 83 | color="white" |
84 | round | 84 | round |
85 | class="right mt-3" | 85 | class="right mt-3" |
86 | @click="deleteallowancesAdd(index)" | 86 | @click="deleteallowancesAdd(index)" |
87 | v-if="index != 0" | 87 | v-if="index != 0" |
88 | > | 88 | > |
89 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 89 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
90 | </v-btn> | 90 | </v-btn> |
91 | <v-btn color="white" round class="right mt-3" @click="allowancesAdd"> | 91 | <v-btn color="white" round class="right mt-3" @click="allowancesAdd"> |
92 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 92 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
93 | </v-btn> | 93 | </v-btn> |
94 | </v-flex> | 94 | </v-flex> |
95 | </v-layout> | 95 | </v-layout> |
96 | <!-- <v-flex xs12 sm12 md6> --> | 96 | <!-- <v-flex xs12 sm12 md6> --> |
97 | <v-card flat> | 97 | <v-card flat> |
98 | <v-toolbar dark class="card-styles" flat> | 98 | <v-toolbar dark class="card-styles" flat> |
99 | <v-spacer></v-spacer> | 99 | <v-spacer></v-spacer> |
100 | <h3>Deduction</h3> | 100 | <h3>Deduction</h3> |
101 | <v-spacer></v-spacer> | 101 | <v-spacer></v-spacer> |
102 | </v-toolbar> | 102 | </v-toolbar> |
103 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> | 103 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> |
104 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 104 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
105 | <v-text-field | 105 | <v-text-field |
106 | solo | 106 | solo |
107 | label="Enter Deduction Label" | 107 | label="Enter Deduction Label" |
108 | v-model="editedItem.deductionName" | 108 | v-model="editedItem.deductionName" |
109 | ></v-text-field> | 109 | ></v-text-field> |
110 | </v-flex> | 110 | </v-flex> |
111 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 111 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
112 | <v-text-field | 112 | <v-text-field |
113 | solo | 113 | solo |
114 | label="Enter Deduction Value" | 114 | label="Enter Deduction Value" |
115 | v-model="editedItem.deductionValue" | 115 | v-model="editedItem.deductionValue" |
116 | v-on:keyup="addDeductionValue" | 116 | v-on:keyup="addDeductionValue" |
117 | ></v-text-field> | 117 | ></v-text-field> |
118 | </v-flex> | 118 | </v-flex> |
119 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 119 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
120 | <v-btn | 120 | <v-btn |
121 | color="white" | 121 | color="white" |
122 | round | 122 | round |
123 | class="right mt-3" | 123 | class="right mt-3" |
124 | @click="deletedeductionAdd(index)" | 124 | @click="deletedeductionAdd(index)" |
125 | v-if="index != 0" | 125 | v-if="index != 0" |
126 | > | 126 | > |
127 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 127 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
128 | </v-btn> | 128 | </v-btn> |
129 | <v-btn color="white" round class="right mt-3" @click="deductionAdd"> | 129 | <v-btn color="white" round class="right mt-3" @click="deductionAdd"> |
130 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 130 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
131 | </v-btn> | 131 | </v-btn> |
132 | </v-flex> | 132 | </v-flex> |
133 | </v-layout> | 133 | </v-layout> |
134 | </v-card> | 134 | </v-card> |
135 | <!-- </v-flex> --> | 135 | <!-- </v-flex> --> |
136 | </v-card> | 136 | </v-card> |
137 | </v-flex> | 137 | </v-flex> |
138 | <!-- <v-flex xs12 sm12 md6> | 138 | <!-- <v-flex xs12 sm12 md6> |
139 | <v-card flat> | 139 | <v-card flat> |
140 | <v-toolbar dark class="card-styles" flat> | 140 | <v-toolbar dark class="card-styles" flat> |
141 | <v-spacer></v-spacer> | 141 | <v-spacer></v-spacer> |
142 | <h3>Deduction</h3> | 142 | <h3>Deduction</h3> |
143 | <v-spacer></v-spacer> | 143 | <v-spacer></v-spacer> |
144 | </v-toolbar> | 144 | </v-toolbar> |
145 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> | 145 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> |
146 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 146 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
147 | <v-text-field | 147 | <v-text-field |
148 | solo | 148 | solo |
149 | label="Enter Deduction Label" | 149 | label="Enter Deduction Label" |
150 | v-model="editedItem.deductionName" | 150 | v-model="editedItem.deductionName" |
151 | ></v-text-field> | 151 | ></v-text-field> |
152 | </v-flex> | 152 | </v-flex> |
153 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 153 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
154 | <v-text-field | 154 | <v-text-field |
155 | solo | 155 | solo |
156 | label="Enter Deduction Value" | 156 | label="Enter Deduction Value" |
157 | v-model="editedItem.deductionValue" | 157 | v-model="editedItem.deductionValue" |
158 | v-on:keyup="addDeductionValue" | 158 | v-on:keyup="addDeductionValue" |
159 | ></v-text-field> | 159 | ></v-text-field> |
160 | </v-flex> | 160 | </v-flex> |
161 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 161 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
162 | <v-btn | 162 | <v-btn |
163 | color="white" | 163 | color="white" |
164 | round | 164 | round |
165 | class="right mt-3" | 165 | class="right mt-3" |
166 | @click="deletedeductionAdd(index)" | 166 | @click="deletedeductionAdd(index)" |
167 | v-if="index != 0" | 167 | v-if="index != 0" |
168 | > | 168 | > |
169 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 169 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
170 | </v-btn> | 170 | </v-btn> |
171 | <v-btn color="white" round class="right mt-3" @click="deductionAdd"> | 171 | <v-btn color="white" round class="right mt-3" @click="deductionAdd"> |
172 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 172 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
173 | </v-btn> | 173 | </v-btn> |
174 | </v-flex> | 174 | </v-flex> |
175 | </v-layout> | 175 | </v-layout> |
176 | </v-card> | 176 | </v-card> |
177 | </v-flex>--> | 177 | </v-flex>--> |
178 | <!-- <v-flex xs12 sm12 md4></v-flex> --> | 178 | <!-- <v-flex xs12 sm12 md4></v-flex> --> |
179 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> | 179 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> |
180 | <v-card flat> | 180 | <v-card flat> |
181 | <v-toolbar dark class="card-styles" flat> | 181 | <v-toolbar dark class="card-styles" flat> |
182 | <v-spacer></v-spacer> | 182 | <v-spacer></v-spacer> |
183 | <h3>Total Salary Details</h3> | 183 | <h3>Total Salary Details</h3> |
184 | <v-spacer></v-spacer> | 184 | <v-spacer></v-spacer> |
185 | </v-toolbar> | 185 | </v-toolbar> |
186 | <v-layout> | 186 | <v-layout> |
187 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 187 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
188 | <v-text-field solo value="Gross Salary"></v-text-field> | 188 | <v-text-field solo value="Gross Salary"></v-text-field> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 190 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
191 | <v-flex xs8 sm7 class="ml-3"> | 191 | <v-flex xs8 sm7 class="ml-3"> |
192 | <v-text-field v-model="editedItem.grossSalary" box readonly></v-text-field> | 192 | <v-text-field v-model="editedItem.grossSalary" box readonly></v-text-field> |
193 | </v-flex> | 193 | </v-flex> |
194 | </v-flex> | 194 | </v-flex> |
195 | </v-layout> | 195 | </v-layout> |
196 | <v-layout> | 196 | <v-layout> |
197 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 197 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
198 | <v-text-field solo value="Total Deduction"></v-text-field> | 198 | <v-text-field solo value="Total Deduction"></v-text-field> |
199 | </v-flex> | 199 | </v-flex> |
200 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 200 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
201 | <v-flex xs8 sm7 class="ml-3"> | 201 | <v-flex xs8 sm7 class="ml-3"> |
202 | <v-text-field v-model="editedItem.totalDeduction" box readonly></v-text-field> | 202 | <v-text-field v-model="editedItem.totalDeduction" box readonly></v-text-field> |
203 | </v-flex> | 203 | </v-flex> |
204 | </v-flex> | 204 | </v-flex> |
205 | </v-layout> | 205 | </v-layout> |
206 | <v-layout> | 206 | <v-layout> |
207 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 207 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
208 | <v-text-field solo value="Net Salary"></v-text-field> | 208 | <v-text-field solo value="Net Salary"></v-text-field> |
209 | </v-flex> | 209 | </v-flex> |
210 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 210 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
211 | <v-flex xs8 sm7 class="ml-3"> | 211 | <v-flex xs8 sm7 class="ml-3"> |
212 | <v-text-field v-model="editedItem.netSalary" box readonly></v-text-field> | 212 | <v-text-field v-model="editedItem.netSalary" box readonly></v-text-field> |
213 | </v-flex> | 213 | </v-flex> |
214 | </v-flex> | 214 | </v-flex> |
215 | </v-layout> | 215 | </v-layout> |
216 | </v-card> | 216 | </v-card> |
217 | <v-layout> | 217 | <v-layout> |
218 | <v-flex xs12> | 218 | <v-flex xs12> |
219 | <v-card-actions> | 219 | <v-card-actions> |
220 | <v-spacer class="hidden-xs-only"></v-spacer> | 220 | <v-spacer class="hidden-xs-only"></v-spacer> |
221 | <v-btn | 221 | <v-btn |
222 | color="open-dialog-button" | 222 | color="open-dialog-button" |
223 | dark | 223 | dark |
224 | class="right mt-3" | 224 | class="right mt-3" |
225 | @click="save" | 225 | @click="save" |
226 | >Update Salary Template</v-btn> | 226 | >Update Salary Template</v-btn> |
227 | </v-card-actions> | 227 | </v-card-actions> |
228 | </v-flex> | 228 | </v-flex> |
229 | </v-layout> | 229 | </v-layout> |
230 | </v-flex> | 230 | </v-flex> |
231 | </v-layout> | 231 | </v-layout> |
232 | </v-container> | 232 | </v-container> |
233 | </v-flex> | 233 | </v-flex> |
234 | </v-card> | 234 | </v-card> |
235 | </v-dialog> | 235 | </v-dialog> |
236 | 236 | ||
237 | <!-- ****** PROFILE VIEW ****** --> | 237 | <!-- ****** PROFILE VIEW ****** --> |
238 | 238 | ||
239 | <v-dialog v-model="profileSalaryDialog"> | 239 | <v-dialog v-model="profileSalaryDialog"> |
240 | <v-card flat class="text-xs-center white--text"> | 240 | <v-card flat class="text-xs-center white--text"> |
241 | <v-layout> | 241 | <v-layout> |
242 | <v-flex xs12 class="card-style pa-2"> | 242 | <v-flex xs12 class="card-style pa-2"> |
243 | <label class="title text-xs-center">View Salary</label> | 243 | <label class="title text-xs-center">View Salary</label> |
244 | <v-icon | 244 | <v-icon |
245 | size="24" | 245 | size="24" |
246 | color="white" | 246 | color="white" |
247 | class="right" | 247 | class="right" |
248 | @click="profileSalaryDialog = false" | 248 | @click="profileSalaryDialog = false" |
249 | >cancel</v-icon> | 249 | >cancel</v-icon> |
250 | </v-flex> | 250 | </v-flex> |
251 | </v-layout> | 251 | </v-layout> |
252 | 252 | ||
253 | <v-flex xs12 sm12> | 253 | <v-flex xs12 sm12> |
254 | <v-container fluid grid-list-md> | 254 | <v-container fluid grid-list-md> |
255 | <v-layout wrap> | 255 | <v-layout wrap> |
256 | <v-flex xs12 sm12 md6> | 256 | <v-flex xs12 sm12 md6> |
257 | <v-card flat> | 257 | <v-card flat> |
258 | <v-toolbar dark class="card-styles" flat> | 258 | <v-toolbar dark class="card-styles" flat> |
259 | <v-spacer></v-spacer> | 259 | <v-spacer></v-spacer> |
260 | <h3>Salary Template</h3> | 260 | <h3>Salary Template</h3> |
261 | <v-spacer></v-spacer> | 261 | <v-spacer></v-spacer> |
262 | </v-toolbar> | 262 | </v-toolbar> |
263 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> | 263 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> |
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 hidden-xs-only">Salary Grades :</label> | 266 | <label class="right hidden-xs-only">Salary Grades :</label> |
267 | </v-flex> | 267 | </v-flex> |
268 | <v-flex xs8 sm7 class="ml-3"> | 268 | <v-flex xs8 sm7 class="ml-3"> |
269 | <v-flex xs8 sm7 class="ml-3"> | 269 | <v-flex xs8 sm7 class="ml-3"> |
270 | <v-text-field | 270 | <v-text-field |
271 | :rules="salaryRules" | 271 | :rules="salaryRules" |
272 | v-model="editedItem.salaryGrades" | 272 | v-model="editedItem.salaryGrades" |
273 | readonly | 273 | readonly |
274 | ></v-text-field> | 274 | ></v-text-field> |
275 | </v-flex> | 275 | </v-flex> |
276 | </v-flex> | 276 | </v-flex> |
277 | </v-layout> | 277 | </v-layout> |
278 | <v-layout> | 278 | <v-layout> |
279 | <v-flex xs4 class="pt-4 subheading"> | 279 | <v-flex xs4 class="pt-4 subheading"> |
280 | <label class="right">Basic Salary :</label> | 280 | <label class="right">Basic Salary :</label> |
281 | </v-flex> | 281 | </v-flex> |
282 | <v-flex xs8 sm7 class="ml-3"> | 282 | <v-flex xs8 sm7 class="ml-3"> |
283 | <v-flex xs8 sm7 class="ml-3"> | 283 | <v-flex xs8 sm7 class="ml-3"> |
284 | <v-text-field | 284 | <v-text-field |
285 | :rules="basicRules" | 285 | :rules="basicRules" |
286 | v-model="editedItem.basicSalary" | 286 | v-model="editedItem.basicSalary" |
287 | readonly | 287 | readonly |
288 | ></v-text-field> | 288 | ></v-text-field> |
289 | </v-flex> | 289 | </v-flex> |
290 | </v-flex> | 290 | </v-flex> |
291 | </v-layout> | 291 | </v-layout> |
292 | <v-layout> | 292 | <v-layout> |
293 | <v-flex xs4 class="pt-4 subheading"> | 293 | <v-flex xs4 class="pt-4 subheading"> |
294 | <label class="right">Overtime Rate (Per Hour) :</label> | 294 | <label class="right">Overtime Rate (Per Hour) :</label> |
295 | </v-flex> | 295 | </v-flex> |
296 | <v-flex xs8 sm7 class="ml-3"> | 296 | <v-flex xs8 sm7 class="ml-3"> |
297 | <v-flex xs8 sm7 class="ml-3"> | 297 | <v-flex xs8 sm7 class="ml-3"> |
298 | <v-text-field | 298 | <v-text-field |
299 | :rules="overtimeRules" | 299 | :rules="overtimeRules" |
300 | v-model="editedItem.overtimeRate" | 300 | v-model="editedItem.overtimeRate" |
301 | readonly | 301 | readonly |
302 | ></v-text-field> | 302 | ></v-text-field> |
303 | </v-flex> | 303 | </v-flex> |
304 | </v-flex> | 304 | </v-flex> |
305 | </v-layout> | 305 | </v-layout> |
306 | </v-form> | 306 | </v-form> |
307 | </v-card> | 307 | </v-card> |
308 | </v-flex> | 308 | </v-flex> |
309 | <!-- <v-flex xs12 sm12 md5></v-flex> --> | 309 | <!-- <v-flex xs12 sm12 md5></v-flex> --> |
310 | <v-flex xs12 sm12 md6> | 310 | <v-flex xs12 sm12 md6> |
311 | <v-card flat> | 311 | <v-card flat> |
312 | <v-toolbar dark class="card-styles" flat> | 312 | <v-toolbar dark class="card-styles" flat> |
313 | <v-spacer></v-spacer> | 313 | <v-spacer></v-spacer> |
314 | <h3>Allowances</h3> | 314 | <h3>Allowances</h3> |
315 | <v-spacer></v-spacer> | 315 | <v-spacer></v-spacer> |
316 | </v-toolbar> | 316 | </v-toolbar> |
317 | <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index"> | 317 | <v-layout v-for="(editedItem,index) in editedItem.allowances" :key="index"> |
318 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 318 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
319 | <v-text-field | 319 | <v-text-field |
320 | solo | 320 | solo |
321 | readonly | 321 | readonly |
322 | label="Enter Allowances Label" | 322 | label="Enter Allowances Label" |
323 | v-model="editedItem.allowancesName" | 323 | v-model="editedItem.allowancesName" |
324 | ></v-text-field> | 324 | ></v-text-field> |
325 | </v-flex> | 325 | </v-flex> |
326 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 326 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
327 | <v-text-field | 327 | <v-text-field |
328 | solo | 328 | solo |
329 | readonly | 329 | readonly |
330 | v-model="editedItem.allowancesValue" | 330 | v-model="editedItem.allowancesValue" |
331 | label="Enter Allowances Value" | 331 | label="Enter Allowances Value" |
332 | ></v-text-field> | 332 | ></v-text-field> |
333 | </v-flex> | 333 | </v-flex> |
334 | </v-layout> | 334 | </v-layout> |
335 | <!-- <v-flex xs12 sm12 md6> --> | 335 | <!-- <v-flex xs12 sm12 md6> --> |
336 | <v-card flat> | 336 | <v-card flat> |
337 | <v-toolbar dark class="card-styles" flat> | 337 | <v-toolbar dark class="card-styles" flat> |
338 | <v-spacer></v-spacer> | 338 | <v-spacer></v-spacer> |
339 | <h3>Deduction</h3> | 339 | <h3>Deduction</h3> |
340 | <v-spacer></v-spacer> | 340 | <v-spacer></v-spacer> |
341 | </v-toolbar> | 341 | </v-toolbar> |
342 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> | 342 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> |
343 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 343 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
344 | <v-text-field | 344 | <v-text-field |
345 | solo | 345 | solo |
346 | readonly | 346 | readonly |
347 | label="Enter Deduction Label" | 347 | label="Enter Deduction Label" |
348 | v-model="editedItem.deductionName" | 348 | v-model="editedItem.deductionName" |
349 | ></v-text-field> | 349 | ></v-text-field> |
350 | </v-flex> | 350 | </v-flex> |
351 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 351 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
352 | <v-text-field | 352 | <v-text-field |
353 | solo | 353 | solo |
354 | readonly | 354 | readonly |
355 | label="Enter Deduction Value" | 355 | label="Enter Deduction Value" |
356 | v-model="editedItem.deductionValue" | 356 | v-model="editedItem.deductionValue" |
357 | ></v-text-field> | 357 | ></v-text-field> |
358 | </v-flex> | 358 | </v-flex> |
359 | </v-layout> | 359 | </v-layout> |
360 | </v-card> | 360 | </v-card> |
361 | <!-- </v-flex> --> | 361 | <!-- </v-flex> --> |
362 | </v-card> | 362 | </v-card> |
363 | </v-flex> | 363 | </v-flex> |
364 | <!-- <v-flex xs12 sm12 md6> | 364 | <!-- <v-flex xs12 sm12 md6> |
365 | <v-card flat> | 365 | <v-card flat> |
366 | <v-toolbar dark class="card-styles" flat> | 366 | <v-toolbar dark class="card-styles" flat> |
367 | <v-spacer></v-spacer> | 367 | <v-spacer></v-spacer> |
368 | <h3>Deduction</h3> | 368 | <h3>Deduction</h3> |
369 | <v-spacer></v-spacer> | 369 | <v-spacer></v-spacer> |
370 | </v-toolbar> | 370 | </v-toolbar> |
371 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> | 371 | <v-layout v-for="(editedItem,index) in editedItem.deduction" :key="index"> |
372 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 372 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
373 | <v-text-field | 373 | <v-text-field |
374 | solo | 374 | solo |
375 | label="Enter Deduction Label" | 375 | label="Enter Deduction Label" |
376 | v-model="editedItem.deductionName" | 376 | v-model="editedItem.deductionName" |
377 | ></v-text-field> | 377 | ></v-text-field> |
378 | </v-flex> | 378 | </v-flex> |
379 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 379 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
380 | <v-text-field | 380 | <v-text-field |
381 | solo | 381 | solo |
382 | label="Enter Deduction Value" | 382 | label="Enter Deduction Value" |
383 | v-model="editedItem.deductionValue" | 383 | v-model="editedItem.deductionValue" |
384 | ></v-text-field> | 384 | ></v-text-field> |
385 | </v-flex> | 385 | </v-flex> |
386 | </v-layout> | 386 | </v-layout> |
387 | </v-card> | 387 | </v-card> |
388 | </v-flex>--> | 388 | </v-flex>--> |
389 | <v-flex xs12 sm12 md4></v-flex> | 389 | <v-flex xs12 sm12 md4></v-flex> |
390 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> | 390 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> |
391 | <v-card flat> | 391 | <v-card flat> |
392 | <v-toolbar dark class="card-styles" flat> | 392 | <v-toolbar dark class="card-styles" flat> |
393 | <v-spacer></v-spacer> | 393 | <v-spacer></v-spacer> |
394 | <h3>Total Salary Details</h3> | 394 | <h3>Total Salary Details</h3> |
395 | <v-spacer></v-spacer> | 395 | <v-spacer></v-spacer> |
396 | </v-toolbar> | 396 | </v-toolbar> |
397 | <v-layout> | 397 | <v-layout> |
398 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 398 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
399 | <v-text-field solo value="Gross Salary"></v-text-field> | 399 | <v-text-field solo value="Gross Salary"></v-text-field> |
400 | </v-flex> | 400 | </v-flex> |
401 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 401 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
402 | <v-flex xs8 sm7 class="ml-3"> | 402 | <v-flex xs8 sm7 class="ml-3"> |
403 | <v-text-field v-model="editedItem.grossSalary" solo readonly></v-text-field> | 403 | <v-text-field v-model="editedItem.grossSalary" solo readonly></v-text-field> |
404 | </v-flex> | 404 | </v-flex> |
405 | </v-flex> | 405 | </v-flex> |
406 | </v-layout> | 406 | </v-layout> |
407 | <v-layout> | 407 | <v-layout> |
408 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 408 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
409 | <v-text-field solo value="Total Deduction"></v-text-field> | 409 | <v-text-field solo value="Total Deduction"></v-text-field> |
410 | </v-flex> | 410 | </v-flex> |
411 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 411 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
412 | <v-flex xs8 sm7 class="ml-3"> | 412 | <v-flex xs8 sm7 class="ml-3"> |
413 | <v-text-field v-model="editedItem.totalDeduction" solo readonly></v-text-field> | 413 | <v-text-field v-model="editedItem.totalDeduction" solo readonly></v-text-field> |
414 | </v-flex> | 414 | </v-flex> |
415 | </v-flex> | 415 | </v-flex> |
416 | </v-layout> | 416 | </v-layout> |
417 | <v-layout> | 417 | <v-layout> |
418 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 418 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
419 | <v-text-field solo value="Net Salary"></v-text-field> | 419 | <v-text-field solo value="Net Salary"></v-text-field> |
420 | </v-flex> | 420 | </v-flex> |
421 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> | 421 | <v-flex xs8 sm7 class="mt-4 hidden-xs-only hidden-sm-only"> |
422 | <v-flex xs8 sm7 class="ml-3"> | 422 | <v-flex xs8 sm7 class="ml-3"> |
423 | <b> <v-text-field v-model="editedItem.netSalary" solo readonly></v-text-field></b> | 423 | <b> |
424 | <v-text-field v-model="editedItem.netSalary" solo readonly></v-text-field> | ||
425 | </b> | ||
424 | </v-flex> | 426 | </v-flex> |
425 | </v-flex> | 427 | </v-flex> |
426 | </v-layout> | 428 | </v-layout> |
427 | </v-card> | 429 | </v-card> |
428 | </v-flex> | 430 | </v-flex> |
429 | </v-layout> | 431 | </v-layout> |
430 | </v-container> | 432 | </v-container> |
431 | </v-flex> | 433 | </v-flex> |
432 | </v-card> | 434 | </v-card> |
433 | </v-dialog> | 435 | </v-dialog> |
434 | <!-- ****** EXAM TABLE****** --> | 436 | <!-- ****** EXAM TABLE****** --> |
435 | 437 | ||
436 | <v-toolbar color="transparent" flat> | 438 | <v-toolbar color="transparent" flat> |
437 | <v-btn | 439 | <v-btn |
438 | fab | 440 | fab |
439 | dark | 441 | dark |
440 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 442 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
441 | small | 443 | small |
442 | @click="addSalaryDialog = true" | 444 | @click="addSalaryDialog = true" |
443 | > | 445 | > |
444 | <v-icon dark>add</v-icon> | 446 | <v-icon dark>add</v-icon> |
445 | </v-btn> | 447 | </v-btn> |
446 | <v-btn | 448 | <v-btn |
447 | round | 449 | round |
448 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 450 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
449 | dark | 451 | dark |
450 | @click="addSalaryDialog = true" | 452 | @click="addSalaryDialog = true" |
451 | > | 453 | > |
452 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Salary | 454 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Salary |
453 | </v-btn> | 455 | </v-btn> |
454 | <v-spacer></v-spacer> | 456 | <v-spacer></v-spacer> |
455 | <v-card-title class="body-1" v-show="show"> | 457 | <v-card-title class="body-1" v-show="show"> |
456 | <v-btn icon large flat @click="displaySearch"> | 458 | <v-btn icon large flat @click="displaySearch"> |
457 | <v-avatar size="27"> | 459 | <v-avatar size="27"> |
458 | <img src="/static/icon/search.png" alt="icon" /> | 460 | <img src="/static/icon/search.png" alt="icon" /> |
459 | </v-avatar> | 461 | </v-avatar> |
460 | </v-btn> | 462 | </v-btn> |
461 | </v-card-title> | 463 | </v-card-title> |
462 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 464 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
463 | <v-layout> | 465 | <v-layout> |
464 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 466 | <v-text-field |
467 | autofocus | ||
468 | v-model="search" | ||
469 | label="Search" | ||
470 | prepend-inner-icon="search" | ||
471 | color="primary" | ||
472 | ></v-text-field> | ||
465 | <v-icon @click="closeSearch" color="error">close</v-icon> | 473 | <v-icon @click="closeSearch" color="error">close</v-icon> |
466 | </v-layout> | 474 | </v-layout> |
467 | </v-flex> | 475 | </v-flex> |
468 | </v-toolbar> | 476 | </v-toolbar> |
469 | <v-data-table | 477 | <v-data-table |
470 | :headers="headers" | 478 | :headers="headers" |
471 | :items="salaryData" | 479 | :items="salaryData" |
472 | :pagination.sync="pagination" | 480 | :pagination.sync="pagination" |
473 | :search="search" | 481 | :search="search" |
474 | > | 482 | > |
475 | <template slot="items" slot-scope="props"> | 483 | <template slot="items" slot-scope="props"> |
476 | <tr class="tr"> | 484 | <tr class="tr"> |
477 | <td class="td td-row">{{ props.index + 1}}</td> | 485 | <td class="td td-row">{{ props.index + 1}}</td> |
478 | <td class="td td-row text-xs-center">{{ props.item.salaryGrades}}</td> | 486 | <td class="td td-row text-xs-center">{{ props.item.salaryGrades}}</td> |
479 | <td class="td td-row text-xs-center">{{ props.item.basicSalary}}</td> | 487 | <td class="td td-row text-xs-center">{{ props.item.basicSalary}}</td> |
480 | <td class="td td-row text-xs-center">{{ props.item.overtimeRate}}</td> | 488 | <td class="td td-row text-xs-center">{{ props.item.overtimeRate}}</td> |
481 | <td class="td td-row text-xs-center"> | 489 | <td class="td td-row text-xs-center"> |
482 | <span> | 490 | <span> |
483 | <v-tooltip top> | 491 | <v-tooltip top> |
484 | <img | 492 | <img |
485 | slot="activator" | 493 | slot="activator" |
486 | style="cursor:pointer; width:25px; height:25px; " | 494 | style="cursor:pointer; width:25px; height:25px; " |
487 | class="mr-3" | 495 | class="mr-3" |
488 | @click="profile(props.item)" | 496 | @click="profile(props.item)" |
489 | src="/static/icon/view.png" | 497 | src="/static/icon/view.png" |
490 | /> | 498 | /> |
491 | <span>View</span> | 499 | <span>View</span> |
492 | </v-tooltip> | 500 | </v-tooltip> |
493 | <v-tooltip top> | 501 | <v-tooltip top> |
494 | <img | 502 | <img |
495 | slot="activator" | 503 | slot="activator" |
496 | style="cursor:pointer; width:20px; height:18px; " | 504 | style="cursor:pointer; width:20px; height:18px; " |
497 | class="mr-3" | 505 | class="mr-3" |
498 | @click="editItem(props.item)" | 506 | @click="editItem(props.item)" |
499 | src="/static/icon/edit.png" | 507 | src="/static/icon/edit.png" |
500 | /> | 508 | /> |
501 | <span>Edit</span> | 509 | <span>Edit</span> |
502 | </v-tooltip> | 510 | </v-tooltip> |
503 | <v-tooltip top> | 511 | <v-tooltip top> |
504 | <img | 512 | <img |
505 | slot="activator" | 513 | slot="activator" |
506 | style="cursor:pointer; width:20px; height:20px; " | 514 | style="cursor:pointer; width:20px; height:20px; " |
507 | class="mr-3" | 515 | class="mr-3" |
508 | @click="deleteItem(props.item)" | 516 | @click="deleteItem(props.item)" |
509 | src="/static/icon/delete.png" | 517 | src="/static/icon/delete.png" |
510 | /> | 518 | /> |
511 | <span>Delete</span> | 519 | <span>Delete</span> |
512 | </v-tooltip> | 520 | </v-tooltip> |
513 | </span> | 521 | </span> |
514 | </td> | 522 | </td> |
515 | </tr> | 523 | </tr> |
516 | </template> | 524 | </template> |
517 | <v-alert | 525 | <v-alert |
518 | slot="no-results" | 526 | slot="no-results" |
519 | :value="true" | 527 | :value="true" |
520 | color="error" | 528 | color="error" |
521 | icon="warning" | 529 | icon="warning" |
522 | >Your search for "{{ search }}" found no results.</v-alert> | 530 | >Your search for "{{ search }}" found no results.</v-alert> |
523 | </v-data-table> | 531 | </v-data-table> |
524 | 532 | ||
525 | <!-- ****** ADD SALARY ****** --> | 533 | <!-- ****** ADD SALARY ****** --> |
526 | <v-dialog v-model="addSalaryDialog"> | 534 | <v-dialog v-model="addSalaryDialog" v-if="addSalaryDialog"> |
527 | <v-card flat class="text-xs-center white--text"> | 535 | <v-card flat class="text-xs-center white--text"> |
528 | <v-layout> | 536 | <v-layout> |
529 | <v-flex xs12 class="card-style pa-2"> | 537 | <v-flex xs12 class="card-style pa-2"> |
530 | <label class="title text-xs-center">Add Salary</label> | 538 | <label class="title text-xs-center">Add Salary</label> |
531 | <v-icon size="24" color="white" class="right" @click="addSalaryDialog = false">cancel</v-icon> | 539 | <v-icon size="24" color="white" class="right" @click="closeAddSalaryModel">cancel</v-icon> |
532 | </v-flex> | 540 | </v-flex> |
533 | </v-layout> | 541 | </v-layout> |
534 | 542 | ||
535 | <v-flex xs12 sm12> | 543 | <v-flex xs12 sm12> |
536 | <v-container fluid grid-list-md> | 544 | <v-container fluid grid-list-md> |
537 | <v-layout wrap> | 545 | <v-layout wrap> |
538 | <v-flex xs12 sm12 md6> | 546 | <v-flex xs12 sm12 md6> |
539 | <v-card flat> | 547 | <v-card flat> |
540 | <v-toolbar dark class="card-styles" flat> | 548 | <v-toolbar dark class="card-styles" flat> |
541 | <v-spacer></v-spacer> | 549 | <v-spacer></v-spacer> |
542 | <h3>Salary Template</h3> | 550 | <h3>Salary Template</h3> |
543 | <v-spacer></v-spacer> | 551 | <v-spacer></v-spacer> |
544 | </v-toolbar> | 552 | </v-toolbar> |
545 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> | 553 | <v-form ref="form" v-model="valid" lazy-validation class="py-4"> |
546 | <v-layout> | 554 | <v-layout> |
547 | <v-flex xs4 class="pt-4 subheading"> | 555 | <v-flex xs4 class="pt-4 subheading"> |
548 | <label class="right hidden-xs-only">Salary Grades :</label> | 556 | <label class="right hidden-xs-only">Salary Grades :</label> |
549 | </v-flex> | 557 | </v-flex> |
550 | <v-flex xs8 sm7 class="ml-3"> | 558 | <v-flex xs8 sm7 class="ml-3"> |
551 | <v-flex xs8 sm7 class="ml-3"> | 559 | <v-flex xs8 sm7 class="ml-3"> |
552 | <v-text-field :rules="salaryRules" v-model="salaryType.salaryGrades"></v-text-field> | 560 | <v-text-field :rules="salaryRules" v-model="salaryType.salaryGrades"></v-text-field> |
553 | </v-flex> | 561 | </v-flex> |
554 | </v-flex> | 562 | </v-flex> |
555 | </v-layout> | 563 | </v-layout> |
556 | <v-layout> | 564 | <v-layout> |
557 | <v-flex xs4 class="pt-4 subheading"> | 565 | <v-flex xs4 class="pt-4 subheading"> |
558 | <label class="right">Basic Salary :</label> | 566 | <label class="right">Basic Salary :</label> |
559 | </v-flex> | 567 | </v-flex> |
560 | <v-flex xs8 sm7 class="ml-3"> | 568 | <v-flex xs8 sm7 class="ml-3"> |
561 | <v-flex xs8 sm7 class="ml-3"> | 569 | <v-flex xs8 sm7 class="ml-3"> |
562 | <v-text-field | 570 | <v-text-field |
563 | :rules="basicRules" | 571 | :rules="basicRules" |
564 | v-on:keyup="addSalary" | 572 | v-on:keyup="addSalary" |
565 | v-model="salaryType.basicSalary" | 573 | v-model="salaryType.basicSalary" |
566 | ></v-text-field> | 574 | ></v-text-field> |
567 | </v-flex> | 575 | </v-flex> |
568 | </v-flex> | 576 | </v-flex> |
569 | </v-layout> | 577 | </v-layout> |
570 | <v-layout> | 578 | <v-layout> |
571 | <v-flex xs4 class="pt-4 subheading"> | 579 | <v-flex xs4 class="pt-4 subheading"> |
572 | <label class="right">Overtime Rate (Per Hour) :</label> | 580 | <label class="right">Overtime Rate (Per Hour) :</label> |
573 | </v-flex> | 581 | </v-flex> |
574 | <v-flex xs8 sm7 class="ml-3"> | 582 | <v-flex xs8 sm7 class="ml-3"> |
575 | <v-flex xs8 sm7 class="ml-3"> | 583 | <v-flex xs8 sm7 class="ml-3"> |
576 | <v-text-field :rules="overtimeRules" v-model="salaryType.overtimeRate"></v-text-field> | 584 | <v-text-field :rules="overtimeRules" v-model="salaryType.overtimeRate"></v-text-field> |
577 | </v-flex> | 585 | </v-flex> |
578 | </v-flex> | 586 | </v-flex> |
579 | </v-layout> | 587 | </v-layout> |
580 | </v-form> | 588 | </v-form> |
581 | </v-card> | 589 | </v-card> |
582 | </v-flex> | 590 | </v-flex> |
583 | <!-- <v-flex xs12 sm12 md5></v-flex> --> | 591 | <!-- <v-flex xs12 sm12 md5></v-flex> --> |
584 | <v-flex xs12 sm12 md6> | 592 | <v-flex xs12 sm12 md6> |
585 | <v-card flat> | 593 | <v-card flat> |
586 | <v-toolbar dark class="card-styles" flat> | 594 | <v-toolbar dark class="card-styles" flat> |
587 | <v-spacer></v-spacer> | 595 | <v-spacer></v-spacer> |
588 | <h3>Allowances</h3> | 596 | <h3>Allowances</h3> |
589 | <v-spacer></v-spacer> | 597 | <v-spacer></v-spacer> |
590 | </v-toolbar> | 598 | </v-toolbar> |
591 | <v-layout v-for="(salaryType,index) in salaryTypeData" :key="index"> | 599 | <v-layout v-for="(salaryType,index) in salaryTypeData" :key="index"> |
592 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 600 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
593 | <v-text-field | 601 | <v-text-field |
594 | solo | 602 | solo |
595 | label="Enter Allowances Label" | 603 | label="Enter Allowances Label" |
596 | v-model="salaryType.allowancesName" | 604 | v-model="salaryType.allowancesName" |
597 | ></v-text-field> | 605 | ></v-text-field> |
598 | </v-flex> | 606 | </v-flex> |
599 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 607 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
600 | <v-text-field | 608 | <v-text-field |
601 | solo | 609 | solo |
602 | v-model="salaryType.allowancesValue" | 610 | v-model="salaryType.allowancesValue" |
603 | label="Enter Allowances Value" | 611 | label="Enter Allowances Value" |
604 | v-on:keyup="addAllowances" | 612 | v-on:keyup="addAllowances" |
605 | ></v-text-field> | 613 | ></v-text-field> |
606 | </v-flex> | 614 | </v-flex> |
607 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 615 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
608 | <v-btn | 616 | <v-btn |
609 | color="white" | 617 | color="white" |
610 | round | 618 | round |
611 | class="right mt-3" | 619 | class="right mt-3" |
612 | @click="deleteSelectAllowances(index)" | 620 | @click="deleteSelectAllowances(index)" |
613 | v-if="index != 0" | 621 | v-if="index != 0" |
614 | > | 622 | > |
615 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 623 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
616 | </v-btn> | 624 | </v-btn> |
617 | <v-btn color="white" round class="right mt-3" @click="selectAllowances"> | 625 | <v-btn color="white" round class="right mt-3" @click="selectAllowances"> |
618 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 626 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
619 | </v-btn> | 627 | </v-btn> |
620 | </v-flex> | 628 | </v-flex> |
621 | </v-layout> | 629 | </v-layout> |
622 | <!-- <v-flex xs12 sm12 md6> --> | 630 | <!-- <v-flex xs12 sm12 md6> --> |
623 | <v-card flat> | 631 | <v-card flat> |
624 | <v-toolbar dark class="card-styles" flat> | 632 | <v-toolbar dark class="card-styles" flat> |
625 | <v-spacer></v-spacer> | 633 | <v-spacer></v-spacer> |
626 | <h3>Deduction</h3> | 634 | <h3>Deduction</h3> |
627 | <v-spacer></v-spacer> | 635 | <v-spacer></v-spacer> |
628 | </v-toolbar> | 636 | </v-toolbar> |
629 | <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index"> | 637 | <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index"> |
630 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 638 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
631 | <v-text-field | 639 | <v-text-field |
632 | solo | 640 | solo |
633 | label="Enter Deduction Label" | 641 | label="Enter Deduction Label" |
634 | v-model="salaryType.deductionName" | 642 | v-model="salaryType.deductionName" |
635 | ></v-text-field> | 643 | ></v-text-field> |
636 | </v-flex> | 644 | </v-flex> |
637 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 645 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
638 | <v-text-field | 646 | <v-text-field |
639 | solo | 647 | solo |
640 | label="Enter Deduction Value" | 648 | label="Enter Deduction Value" |
641 | v-model="salaryType.deductionValue" | 649 | v-model="salaryType.deductionValue" |
642 | v-on:keyup="addDeduction" | 650 | v-on:keyup="addDeduction" |
643 | ></v-text-field> | 651 | ></v-text-field> |
644 | </v-flex> | 652 | </v-flex> |
645 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 653 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
646 | <v-btn | 654 | <v-btn |
647 | color="white" | 655 | color="white" |
648 | round | 656 | round |
649 | class="right mt-3" | 657 | class="right mt-3" |
650 | @click="deleteSelectDeduction(index)" | 658 | @click="deleteSelectDeduction(index)" |
651 | v-if="index != 0" | 659 | v-if="index != 0" |
652 | > | 660 | > |
653 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 661 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
654 | </v-btn> | 662 | </v-btn> |
655 | <v-btn color="white" round class="right mt-3" @click="selectDeduction"> | 663 | <v-btn color="white" round class="right mt-3" @click="selectDeduction"> |
656 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 664 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
657 | </v-btn> | 665 | </v-btn> |
658 | </v-flex> | 666 | </v-flex> |
659 | </v-layout> | 667 | </v-layout> |
660 | </v-card> | 668 | </v-card> |
661 | <!-- </v-flex> --> | 669 | <!-- </v-flex> --> |
662 | </v-card> | 670 | </v-card> |
663 | </v-flex> | 671 | </v-flex> |
664 | <!-- <v-flex xs12 sm12 md6> | 672 | <!-- <v-flex xs12 sm12 md6> |
665 | <v-card flat> | 673 | <v-card flat> |
666 | <v-toolbar dark class="card-styles" flat> | 674 | <v-toolbar dark class="card-styles" flat> |
667 | <v-spacer></v-spacer> | 675 | <v-spacer></v-spacer> |
668 | <h3>Deduction</h3> | 676 | <h3>Deduction</h3> |
669 | <v-spacer></v-spacer> | 677 | <v-spacer></v-spacer> |
670 | </v-toolbar> | 678 | </v-toolbar> |
671 | <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index"> | 679 | <v-layout v-for="(salaryType,index) in salaryTypeDeductionData" :key="index"> |
672 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> | 680 | <v-flex xs4 class="mt-4 hidden-xs-only hidden-sm-only"> |
673 | <v-text-field | 681 | <v-text-field |
674 | solo | 682 | solo |
675 | label="Enter Deduction Label" | 683 | label="Enter Deduction Label" |
676 | v-model="salaryType.deductionName" | 684 | v-model="salaryType.deductionName" |
677 | ></v-text-field> | 685 | ></v-text-field> |
678 | </v-flex> | 686 | </v-flex> |
679 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> | 687 | <v-flex xs8 sm4 class="mt-4 hidden-xs-only hidden-sm-only"> |
680 | <v-text-field | 688 | <v-text-field |
681 | solo | 689 | solo |
682 | label="Enter Deduction Value" | 690 | label="Enter Deduction Value" |
683 | v-model="salaryType.deductionValue" | 691 | v-model="salaryType.deductionValue" |
684 | v-on:keyup="addDeduction" | 692 | v-on:keyup="addDeduction" |
685 | ></v-text-field> | 693 | ></v-text-field> |
686 | </v-flex> | 694 | </v-flex> |
687 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> | 695 | <v-flex xs4 sm6 class="mt-4 hidden-xs-only hidden-sm-only"> |
688 | <v-btn | 696 | <v-btn |
689 | color="white" | 697 | color="white" |
690 | round | 698 | round |
691 | class="right mt-3" | 699 | class="right mt-3" |
692 | @click="deleteSelectDeduction(index)" | 700 | @click="deleteSelectDeduction(index)" |
693 | v-if="index != 0" | 701 | v-if="index != 0" |
694 | > | 702 | > |
695 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> | 703 | <img src="/static/icon/delete1.png" style="width: 30px; height: 30px;" /> |
696 | </v-btn> | 704 | </v-btn> |
697 | <v-btn color="white" round class="right mt-3" @click="selectDeduction"> | 705 | <v-btn color="white" round class="right mt-3" @click="selectDeduction"> |
698 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> | 706 | <img src="/static/icon/add1.png" style="width: 30px; height: 30px;" /> |
699 | </v-btn> | 707 | </v-btn> |
700 | </v-flex> | 708 | </v-flex> |
701 | </v-layout> | 709 | </v-layout> |
702 | </v-card> | 710 | </v-card> |
703 | </v-flex>--> | 711 | </v-flex>--> |
704 | <!-- <v-flex xs12 sm12 md4></v-flex> --> | 712 | <!-- <v-flex xs12 sm12 md4></v-flex> --> |
705 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> | 713 | <v-flex xs12 sm12 md12 style="padding-top: 1%;"> |
706 | <v-card flat> | 714 | <v-card flat> |
707 | <v-toolbar dark class="card-styles" flat> | 715 | <v-toolbar dark class="card-styles" flat> |
708 | <v-spacer></v-spacer> | 716 | <v-spacer></v-spacer> |
709 | <h3>Total Salary Details</h3> | 717 | <h3>Total Salary Details</h3> |
710 | <v-spacer></v-spacer> | 718 | <v-spacer></v-spacer> |
711 | </v-toolbar> | 719 | </v-toolbar> |
712 | <v-layout> | 720 | <v-layout> |
713 | <v-flex xs4 class="pt-4 subheading"> | 721 | <v-flex xs4 class="pt-4 subheading"> |
714 | <v-text-field solo value="Gross Salary"></v-text-field> | 722 | <v-text-field solo value="Gross Salary"></v-text-field> |
715 | </v-flex> | 723 | </v-flex> |
716 | <v-flex xs8 sm7 class="ml-3"> | 724 | <v-flex xs8 sm7 class="ml-3"> |
717 | <v-flex xs8 sm7 class="ml-3"> | 725 | <v-flex xs8 sm7 class="ml-3"> |
718 | <v-text-field v-model="grossSalary" box readonly></v-text-field> | 726 | <v-text-field v-model="grossSalary" box readonly></v-text-field> |
719 | </v-flex> | 727 | </v-flex> |
720 | </v-flex> | 728 | </v-flex> |
721 | </v-layout> | 729 | </v-layout> |
722 | <v-layout> | 730 | <v-layout> |
723 | <v-flex xs4 class="pt-4 subheading"> | 731 | <v-flex xs4 class="pt-4 subheading"> |
724 | <v-text-field solo value="Total Deduction"></v-text-field> | 732 | <v-text-field solo value="Total Deduction"></v-text-field> |
725 | </v-flex> | 733 | </v-flex> |
726 | <v-flex xs8 sm7 class="ml-3"> | 734 | <v-flex xs8 sm7 class="ml-3"> |
727 | <v-flex xs8 sm7 class="ml-3"> | 735 | <v-flex xs8 sm7 class="ml-3"> |
728 | <v-text-field v-model="totalDeduction" box readonly></v-text-field> | 736 | <v-text-field v-model="totalDeduction" box readonly></v-text-field> |
729 | </v-flex> | 737 | </v-flex> |
730 | </v-flex> | 738 | </v-flex> |
731 | </v-layout> | 739 | </v-layout> |
732 | <v-layout> | 740 | <v-layout> |
733 | <v-flex xs4 class="pt-4 subheading"> | 741 | <v-flex xs4 class="pt-4 subheading"> |
734 | <v-text-field solo value="Net Salary"></v-text-field> | 742 | <v-text-field solo value="Net Salary"></v-text-field> |
735 | </v-flex> | 743 | </v-flex> |
736 | <v-flex xs8 sm7 class="ml-3"> | 744 | <v-flex xs8 sm7 class="ml-3"> |
737 | <v-flex xs8 sm7 class="ml-3"> | 745 | <v-flex xs8 sm7 class="ml-3"> |
738 | <v-text-field v-model="salaryType.netSalary" box readonly></v-text-field> | 746 | <v-text-field v-model="salaryType.netSalary" box readonly></v-text-field> |
739 | </v-flex> | 747 | </v-flex> |
740 | </v-flex> | 748 | </v-flex> |
741 | </v-layout> | 749 | </v-layout> |
742 | </v-card> | 750 | </v-card> |
743 | <v-layout> | 751 | <v-layout> |
744 | <v-flex xs12> | 752 | <v-flex xs12> |
745 | <v-card-actions> | 753 | <v-card-actions> |
746 | <v-spacer class="hidden-xs-only"></v-spacer> | 754 | <v-spacer class="hidden-xs-only"></v-spacer> |
747 | <v-btn | 755 | <v-btn |
748 | color="open-dialog-button" | 756 | color="open-dialog-button" |
749 | dark | 757 | dark |
750 | class="right mt-3" | 758 | class="right mt-3" |
751 | @click="submit" | 759 | @click="submit" |
752 | >Add Salary Template</v-btn> | 760 | >Add Salary Template</v-btn> |
753 | </v-card-actions> | 761 | </v-card-actions> |
754 | </v-flex> | 762 | </v-flex> |
755 | </v-layout> | 763 | </v-layout> |
756 | </v-flex> | 764 | </v-flex> |
757 | </v-layout> | 765 | </v-layout> |
758 | </v-container> | 766 | </v-container> |
759 | </v-flex> | 767 | </v-flex> |
760 | </v-card> | 768 | </v-card> |
761 | </v-dialog> | 769 | </v-dialog> |
762 | <v-snackbar | 770 | <v-snackbar |
763 | :timeout="timeout" | 771 | :timeout="timeout" |
764 | :top="y === 'top'" | 772 | :top="y === 'top'" |
765 | :right="x === 'right'" | 773 | :right="x === 'right'" |
766 | :vertical="mode === 'vertical'" | 774 | :vertical="mode === 'vertical'" |
767 | v-model="snackbar" | 775 | v-model="snackbar" |
768 | :color="color" | 776 | :color="color" |
769 | >{{ text }}</v-snackbar> | 777 | >{{ text }}</v-snackbar> |
770 | <div class="loader" v-if="showLoader"> | 778 | <div class="loader" v-if="showLoader"> |
771 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 779 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
772 | </div> | 780 | </div> |
773 | </v-container> | 781 | </v-container> |
774 | </template> | 782 | </template> |
775 | 783 | ||
776 | <script> | 784 | <script> |
777 | import http from "@/Services/http.js"; | 785 | import http from "@/Services/http.js"; |
778 | import moment from "moment"; | 786 | import moment from "moment"; |
779 | 787 | ||
780 | export default { | 788 | export default { |
781 | data: () => ({ | 789 | data: () => ({ |
782 | snackbar: false, | 790 | snackbar: false, |
783 | date: null, | 791 | date: null, |
784 | color: "", | 792 | color: "", |
785 | y: "top", | 793 | y: "top", |
786 | x: "right", | 794 | x: "right", |
787 | mode: "", | 795 | mode: "", |
788 | timeout: 10000, | 796 | timeout: 10000, |
789 | text: "", | 797 | text: "", |
790 | show: true, | 798 | show: true, |
791 | showSearch: false, | 799 | showSearch: false, |
792 | addSalaryDialog: false, | 800 | addSalaryDialog: false, |
793 | loading: false, | 801 | loading: false, |
794 | loadingSearch: false, | 802 | loadingSearch: false, |
795 | search: "", | 803 | search: "", |
796 | showLoader: false, | 804 | showLoader: false, |
797 | editSalaryDialog: false, | 805 | editSalaryDialog: false, |
798 | profileSalaryDialog: false, | 806 | profileSalaryDialog: false, |
799 | valid: true, | 807 | valid: true, |
800 | disabled: true, | 808 | disabled: true, |
801 | showAllowances: false, | 809 | showAllowances: false, |
802 | showDeduction: false, | 810 | showDeduction: false, |
803 | pagination: { | 811 | pagination: { |
804 | rowsPerPage: 10 | 812 | rowsPerPage: 10, |
805 | }, | 813 | }, |
806 | salaryTypes: [], | 814 | salaryTypes: [], |
807 | salaryTypeData: [ | 815 | salaryTypeData: [ |
808 | { | 816 | { |
809 | allowancesValue: "", | 817 | allowancesValue: "", |
810 | allowancesName: "House Rent", | 818 | allowancesName: "House Rent", |
811 | totalAllowances: 0 | 819 | totalAllowances: 0, |
812 | } | 820 | }, |
813 | ], | 821 | ], |
814 | salaryTypeDeductionData: [ | 822 | salaryTypeDeductionData: [ |
815 | { | 823 | { |
816 | deductionValue: "", | 824 | deductionValue: "", |
817 | deductionName: "Provident fund", | 825 | deductionName: "Provident fund", |
818 | totalDeductions: 0 | 826 | totalDeductions: 0, |
819 | } | 827 | }, |
820 | ], | 828 | ], |
821 | grossSalary: 0, | 829 | grossSalary: 0, |
822 | totalDeduction: 0, | 830 | totalDeduction: 0, |
823 | salaryType: { | 831 | salaryType: { |
824 | netSalary: 0, | 832 | netSalary: 0, |
825 | salaryGrades: "", | 833 | salaryGrades: "", |
826 | allowancesValue: "", | 834 | allowancesValue: "", |
827 | deductionValue: "", | 835 | deductionValue: "", |
828 | overtimeRate: "" | 836 | overtimeRate: "", |
829 | }, | 837 | }, |
830 | 838 | ||
831 | basicRules: [v => !!v || " Basic Salary is required"], | 839 | basicRules: [(v) => !!v || " Basic Salary is required"], |
832 | salaryRules: [v => !!v || "Salary Grades is required"], | 840 | salaryRules: [(v) => !!v || "Salary Grades is required"], |
833 | overtimeRules: [v => !!v || "Overtime Rate is required"], | 841 | overtimeRules: [(v) => !!v || "Overtime Rate is required"], |
834 | 842 | ||
835 | headers: [ | 843 | headers: [ |
836 | { | 844 | { |
837 | align: "", | 845 | align: "", |
838 | text: "No", | 846 | text: "No", |
839 | sortable: false, | 847 | sortable: false, |
840 | value: "No" | 848 | value: "No", |
841 | }, | 849 | }, |
842 | { | 850 | { |
843 | text: "Salary Grades", | 851 | text: "Salary Grades", |
844 | value: "salaryGrades", | 852 | value: "salaryGrades", |
845 | sortable: false, | 853 | sortable: false, |
846 | align: "center" | 854 | align: "center", |
847 | }, | 855 | }, |
848 | { | 856 | { |
849 | text: "Basic Salary", | 857 | text: "Basic Salary", |
850 | value: "basicSalary", | 858 | value: "basicSalary", |
851 | sortable: false, | 859 | sortable: false, |
852 | align: "center" | 860 | align: "center", |
853 | }, | 861 | }, |
854 | { | 862 | { |
855 | text: "Overtime Rate", | 863 | text: "Overtime Rate", |
856 | value: "overtimeRate", | 864 | value: "overtimeRate", |
857 | sortable: false, | 865 | sortable: false, |
858 | align: "center" | 866 | align: "center", |
859 | }, | 867 | }, |
860 | { text: "Action", value: "", sortable: false, align: "center" } | 868 | { text: "Action", value: "", sortable: false, align: "center" }, |
861 | ], | 869 | ], |
862 | salaryData: [], | 870 | salaryData: [], |
863 | editedItem: {}, | 871 | editedItem: {}, |
864 | token: "" | 872 | token: "", |
865 | }), | 873 | }), |
874 | watch: { | ||
875 | addSalaryDialog: function (val) { | ||
876 | if (!val) { | ||
877 | this.salaryType = []; | ||
878 | this.grossSalary = 0; | ||
879 | this.totalDeduction = 0; | ||
880 | (this.salaryTypeData = [ | ||
881 | { | ||
882 | allowancesValue: "", | ||
883 | allowancesName: "", | ||
884 | totalAllowances: 0, | ||
885 | }, | ||
886 | ]), | ||
887 | (this.salaryTypeDeductionData = [ | ||
888 | { | ||
889 | deductionValue: "", | ||
890 | deductionName: "", | ||
891 | totalDeductions: 0, | ||
892 | }, | ||
893 | ]); | ||
894 | } | ||
895 | }, | ||
896 | }, | ||
866 | methods: { | 897 | methods: { |
867 | getSalaryList() { | 898 | getSalaryList() { |
868 | this.showLoader = true; | 899 | this.showLoader = true; |
869 | this.loadingSearch = true; | 900 | this.loadingSearch = true; |
870 | http() | 901 | http() |
871 | .get("/getSalaryList", { | 902 | .get("/getSalaryList", { |
872 | headers: { Authorization: "Bearer " + this.token } | 903 | headers: { Authorization: "Bearer " + this.token }, |
873 | }) | 904 | }) |
874 | .then(response => { | 905 | .then((response) => { |
875 | this.salaryData = response.data.data; | 906 | this.salaryData = response.data.data; |
876 | this.showLoader = false; | 907 | this.showLoader = false; |
877 | this.loadingSearch = false; | 908 | this.loadingSearch = false; |
878 | }) | 909 | }) |
879 | .catch(error => { | 910 | .catch((error) => { |
880 | // console.log("err====>", err); | 911 | // console.log("err====>", err); |
881 | this.showLoader = false; | 912 | this.showLoader = false; |
882 | this.loadingSearch = false; | 913 | this.loadingSearch = false; |
883 | this.snackbar = true; | 914 | this.snackbar = true; |
884 | this.text = error.response.data.message; | 915 | this.text = error.response.data.message; |
885 | if (error.response.status === 401) { | 916 | if (error.response.status === 401) { |
886 | this.$router.replace({ path: "/" }); | 917 | this.$router.replace({ path: "/" }); |
887 | this.$store.dispatch("setToken", null); | 918 | this.$store.dispatch("setToken", null); |
888 | this.$store.dispatch("Id", null); | 919 | this.$store.dispatch("Id", null); |
889 | } | 920 | } |
890 | }); | 921 | }); |
891 | }, | 922 | }, |
892 | editItem(item) { | 923 | editItem(item) { |
893 | this.editedIndex = this.salaryData.indexOf(item); | 924 | this.editedIndex = this.salaryData.indexOf(item); |
894 | this.editedItem = Object.assign({}, item); | 925 | this.editedItem = Object.assign({}, item); |
895 | this.editedItem.date = | 926 | this.editedItem.date = |
896 | this.editedItem.date != undefined | 927 | this.editedItem.date != undefined |
897 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) | 928 | ? (this.editedItem.date = this.editedItem.date.substring(0, 10)) |
898 | : (this.editedItem.date = ""); | 929 | : (this.editedItem.date = ""); |
899 | this.editSalaryDialog = true; | 930 | this.editSalaryDialog = true; |
900 | }, | 931 | }, |
901 | profile(item) { | 932 | profile(item) { |
902 | this.editedIndex = this.salaryData.indexOf(item); | 933 | this.editedIndex = this.salaryData.indexOf(item); |
903 | this.editedItem = Object.assign({}, item); | 934 | this.editedItem = Object.assign({}, item); |
904 | this.profileSalaryDialog = true; | 935 | this.profileSalaryDialog = true; |
905 | }, | 936 | }, |
906 | deleteItem(item) { | 937 | deleteItem(item) { |
907 | let Salary = { | 938 | let Salary = { |
908 | salaryId: item._id | 939 | salaryId: item._id, |
909 | }; | 940 | }; |
910 | http() | 941 | http() |
911 | .delete( | 942 | .delete( |
912 | "/deleteSalary", | 943 | "/deleteSalary", |
913 | confirm("Are you sure you want to Delete this?") && { | 944 | confirm("Are you sure you want to Delete this?") && { |
914 | params: Salary | 945 | params: Salary, |
915 | }, | 946 | }, |
916 | { | 947 | { |
917 | headers: { Authorization: "Bearer " + this.token } | 948 | headers: { Authorization: "Bearer " + this.token }, |
918 | } | 949 | } |
919 | ) | 950 | ) |
920 | .then(response => { | 951 | .then((response) => { |
921 | this.snackbar = true; | 952 | this.snackbar = true; |
922 | this.text = "Successfully Delete Salary "; | 953 | this.text = "Successfully Delete Salary "; |
923 | this.text = response.data.message; | 954 | this.text = response.data.message; |
924 | this.color = "green"; | 955 | this.color = "green"; |
925 | this.getSalaryList(); | 956 | this.getSalaryList(); |
926 | }) | 957 | }) |
927 | .catch(error => { | 958 | .catch((error) => { |
928 | this.snackbar = true; | 959 | this.snackbar = true; |
929 | this.text = error.response.data.message; | 960 | this.text = error.response.data.message; |
930 | this.color = "red"; | 961 | this.color = "red"; |
931 | }); | 962 | }); |
932 | }, | 963 | }, |
933 | close() { | 964 | close() { |
934 | this.editSalaryDialog = false; | 965 | this.editSalaryDialog = false; |
935 | }, | 966 | }, |
967 | closeAddSalaryModel() { | ||
968 | this.addSalaryDialog = false; | ||
969 | this.salaryData = []; | ||
970 | this.salaryType = []; | ||
971 | this.grossSalary = 0; | ||
972 | this.totalDeduction = 0; | ||
973 | (this.salaryTypeData = [ | ||
974 | { | ||
975 | allowancesValue: "", | ||
976 | allowancesName: "", | ||
977 | totalAllowances: 0, | ||
978 | }, | ||
979 | ]), | ||
980 | (this.salaryTypeDeductionData = [ | ||
981 | { | ||
982 | deductionValue: "", | ||
983 | deductionName: "", | ||
984 | totalDeductions: 0, | ||
985 | }, | ||
986 | ]); | ||
987 | }, | ||
936 | submit() { | 988 | submit() { |
937 | var salary = { | 989 | var salary = { |
938 | salaryGrades: this.salaryType.salaryGrades, | 990 | salaryGrades: this.salaryType.salaryGrades, |
939 | basicSalary: this.salaryType.basicSalary, | 991 | basicSalary: this.salaryType.basicSalary, |
940 | overtimeRate: this.salaryType.overtimeRate, | 992 | overtimeRate: this.salaryType.overtimeRate, |
941 | allowances: this.salaryTypeData, | 993 | allowances: this.salaryTypeData, |
942 | deduction: this.salaryTypeDeductionData, | 994 | deduction: this.salaryTypeDeductionData, |
943 | grossSalary: this.grossSalary, | 995 | grossSalary: this.grossSalary, |
944 | totalDeduction: this.totalDeduction, | 996 | totalDeduction: this.totalDeduction, |
945 | netSalary: this.salaryType.netSalary | 997 | netSalary: this.salaryType.netSalary, |
946 | }; | 998 | }; |
947 | if (this.$refs.form.validate()) { | 999 | if (this.$refs.form.validate()) { |
948 | this.loading = true; | 1000 | this.loading = true; |
949 | // console.log("api data", this.salaryType); | 1001 | // console.log("api data", this.salaryType); |
950 | http() | 1002 | http() |
951 | .post("/createSalary", salary) | 1003 | .post("/createSalary", salary) |
952 | .then(response => { | 1004 | .then((response) => { |
953 | // console.log("response", response); | 1005 | // console.log("response", response); |
954 | this.snackbar = true; | 1006 | this.snackbar = true; |
955 | this.text = "Successfully Created Salary "; | 1007 | this.text = "Successfully Created Salary "; |
956 | this.text = response.data.message; | 1008 | this.text = response.data.message; |
957 | this.color = "green"; | 1009 | this.color = "green"; |
958 | this.addSalaryDialog = false; | 1010 | this.addSalaryDialog = false; |
959 | this.getSalaryList(); | 1011 | this.getSalaryList(); |
960 | this.color = "success"; | 1012 | this.color = "success"; |
961 | this.salaryTypeData = []; | 1013 | this.salaryTypeData = []; |
962 | this.salaryTypeDeductionData = []; | 1014 | this.salaryTypeDeductionData = []; |
963 | this.salaryType = ""; | 1015 | this.salaryType = ""; |
964 | this.grossSalary = ""; | 1016 | this.grossSalary = ""; |
965 | this.totalDeduction = ""; | 1017 | this.totalDeduction = ""; |
966 | this.loading = false; | 1018 | this.loading = false; |
967 | this.clear(); | 1019 | this.clear(); |
968 | }) | 1020 | }) |
969 | .catch(error => { | 1021 | .catch((error) => { |
970 | console.log("error", error); | 1022 | console.log("error", error); |
971 | this.snackbar = true; | 1023 | this.snackbar = true; |
972 | this.text = error.response.data.message; | 1024 | this.text = error.response.data.message; |
973 | this.color = "red"; | 1025 | this.color = "red"; |
974 | this.loading = false; | 1026 | this.loading = false; |
975 | }); | 1027 | }); |
976 | } | 1028 | } |
977 | }, | 1029 | }, |
978 | selectAllowances() { | 1030 | selectAllowances() { |
979 | this.salaryTypeData.push({ | 1031 | this.salaryTypeData.push({ |
980 | allowancesValue: (this.salaryType.allowancesValue = "") | 1032 | allowancesValue: (this.salaryType.allowancesValue = ""), |
981 | }); | 1033 | }); |
982 | // console.log("this.salaryTypeData", this.salaryTypeData); | 1034 | // console.log("this.salaryTypeData", this.salaryTypeData); |
983 | var totalAllowances = ""; | 1035 | var totalAllowances = ""; |
984 | this.salaryTypeData.forEach(allowancesValue_ => { | 1036 | this.salaryTypeData.forEach((allowancesValue_) => { |
985 | if (allowancesValue_.allowancesValue != "") { | 1037 | if (allowancesValue_.allowancesValue != "") { |
986 | // console.log("allowances", allowancesValue_.allowancesValue); | 1038 | // console.log("allowances", allowancesValue_.allowancesValue); |
987 | totalAllowances = | 1039 | totalAllowances = |
988 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 1040 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
989 | } | 1041 | } |
990 | this.grossSalary = | 1042 | this.grossSalary = |
991 | totalAllowances + Number(this.salaryType.basicSalary); | 1043 | totalAllowances + Number(this.salaryType.basicSalary); |
992 | }); | 1044 | }); |
993 | }, | 1045 | }, |
994 | allowancesAdd() { | 1046 | allowancesAdd() { |
995 | this.editedItem.allowances.push({ | 1047 | this.editedItem.allowances.push({ |
996 | allowancesValue: (this.salaryType.allowancesValue = "") | 1048 | allowancesValue: (this.salaryType.allowancesValue = ""), |
997 | }); | 1049 | }); |
998 | var totalAllowances = ""; | 1050 | var totalAllowances = ""; |
999 | this.editedItem.allowances.forEach(allowancesValue_ => { | 1051 | this.editedItem.allowances.forEach((allowancesValue_) => { |
1000 | if (allowancesValue_.allowancesValue != "") { | 1052 | if (allowancesValue_.allowancesValue != "") { |
1001 | // console.log("allowances", allowancesValue_.allowancesValue); | 1053 | // console.log("allowances", allowancesValue_.allowancesValue); |
1002 | totalAllowances = | 1054 | totalAllowances = |
1003 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 1055 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
1004 | console.log("totalAllowances", totalAllowances); | 1056 | console.log("totalAllowances", totalAllowances); |
1005 | } | 1057 | } |
1006 | this.editedItem.grossSalary = | 1058 | this.editedItem.grossSalary = |
1007 | totalAllowances + Number(this.editedItem.basicSalary); | 1059 | totalAllowances + Number(this.editedItem.basicSalary); |
1008 | console.log("this.editedItem.grossSalary", this.editedItem.grossSalary); | 1060 | console.log("this.editedItem.grossSalary", this.editedItem.grossSalary); |
1009 | }); | 1061 | }); |
1010 | }, | 1062 | }, |
1011 | selectDeduction() { | 1063 | selectDeduction() { |
1012 | this.salaryTypeDeductionData.push({ | 1064 | this.salaryTypeDeductionData.push({ |
1013 | deductionValue: (this.salaryType.deductionValue = "") | 1065 | deductionValue: (this.salaryType.deductionValue = ""), |
1014 | }); | 1066 | }); |
1015 | var totalDeductions = ""; | 1067 | var totalDeductions = ""; |
1016 | this.salaryTypeDeductionData.forEach(deductionValue_ => { | 1068 | this.salaryTypeDeductionData.forEach((deductionValue_) => { |
1017 | if (deductionValue_.deductionValue != "") { | 1069 | if (deductionValue_.deductionValue != "") { |
1018 | // console.log("deduction", deductionValue_.deductionValue); | 1070 | // console.log("deduction", deductionValue_.deductionValue); |
1019 | totalDeductions = | 1071 | totalDeductions = |
1020 | Number(totalDeductions) + Number(deductionValue_.deductionValue); | 1072 | Number(totalDeductions) + Number(deductionValue_.deductionValue); |
1021 | } | 1073 | } |
1022 | }); | 1074 | }); |
1023 | }, | 1075 | }, |
1024 | deductionAdd() { | 1076 | deductionAdd() { |
1025 | this.editedItem.deduction.push({ | 1077 | this.editedItem.deduction.push({ |
1026 | deductionValue: (this.salaryType.deductionValue = "") | 1078 | deductionValue: (this.salaryType.deductionValue = ""), |
1027 | }); | 1079 | }); |
1028 | var totalDeductions = ""; | 1080 | var totalDeductions = ""; |
1029 | this.editedItem.deduction.forEach(deductionValue_ => { | 1081 | this.editedItem.deduction.forEach((deductionValue_) => { |
1030 | if (deductionValue_.deductionValue != "") { | 1082 | if (deductionValue_.deductionValue != "") { |
1031 | // console.log("deduction", deductionValue_.deductionValue); | 1083 | // console.log("deduction", deductionValue_.deductionValue); |
1032 | totalDeductions = | 1084 | totalDeductions = |
1033 | Number(totalDeductions) + Number(deductionValue_.deductionValue); | 1085 | Number(totalDeductions) + Number(deductionValue_.deductionValue); |
1034 | console.log("this.totalDeductions", totalDeductions); | 1086 | console.log("this.totalDeductions", totalDeductions); |
1035 | } | 1087 | } |
1036 | // this.editedItem.totalDeduction = totalDeductions; | 1088 | // this.editedItem.totalDeduction = totalDeductions; |
1037 | // console.log("this.totalDeduction", this.editedItem.totalDeduction); | 1089 | // console.log("this.totalDeduction", this.editedItem.totalDeduction); |
1038 | }); | 1090 | }); |
1039 | }, | 1091 | }, |
1040 | deleteSelectAllowances: function(index) { | 1092 | deleteSelectAllowances: function (index) { |
1041 | this.salaryTypeData.splice(index, 1); | 1093 | this.salaryTypeData.splice(index, 1); |
1042 | }, | 1094 | }, |
1043 | deleteallowancesAdd: function(index) { | 1095 | deleteallowancesAdd: function (index) { |
1044 | this.editedItem.allowances.splice(index, 1); | 1096 | this.editedItem.allowances.splice(index, 1); |
1045 | }, | 1097 | }, |
1046 | deleteSelectDeduction: function(index) { | 1098 | deleteSelectDeduction: function (index) { |
1047 | this.salaryTypeDeductionData.splice(index, 1); | 1099 | this.salaryTypeDeductionData.splice(index, 1); |
1048 | }, | 1100 | }, |
1049 | deletedeductionAdd: function(index) { | 1101 | deletedeductionAdd: function (index) { |
1050 | this.editedItem.deduction.splice(index, 1); | 1102 | this.editedItem.deduction.splice(index, 1); |
1051 | }, | 1103 | }, |
1052 | clear() { | 1104 | clear() { |
1053 | this.$refs.form.reset(); | 1105 | this.$refs.form.reset(); |
1054 | this.disable = false; | 1106 | this.disable = false; |
1055 | }, | 1107 | }, |
1056 | save() { | 1108 | save() { |
1057 | var updateSalary = { | 1109 | var updateSalary = { |
1058 | salaryId: this.editedItem._id, | 1110 | salaryId: this.editedItem._id, |
1059 | salaryGrades: this.editedItem.salaryGrades, | 1111 | salaryGrades: this.editedItem.salaryGrades, |
1060 | basicSalary: this.editedItem.basicSalary, | 1112 | basicSalary: this.editedItem.basicSalary, |
1061 | overtimeRate: this.editedItem.overtimeRate, | 1113 | overtimeRate: this.editedItem.overtimeRate, |
1062 | allowances: this.salaryTypeData, | 1114 | allowances: this.salaryTypeData, |
1063 | deduction: this.salaryTypeDeductionData, | 1115 | deduction: this.salaryTypeDeductionData, |
1064 | grossSalary: this.editedItem.grossSalary, | 1116 | grossSalary: this.editedItem.grossSalary, |
1065 | totalDeduction: this.editedItem.totalDeduction, | 1117 | totalDeduction: this.editedItem.totalDeduction, |
1066 | netSalary: this.editedItem.netSalary | 1118 | netSalary: this.editedItem.netSalary, |
1067 | }; | 1119 | }; |
1068 | http() | 1120 | http() |
1069 | .put("/updateSalary", updateSalary) | 1121 | .put("/updateSalary", updateSalary) |
1070 | .then(response => { | 1122 | .then((response) => { |
1071 | this.snackbar = true; | 1123 | this.snackbar = true; |
1072 | this.text = response.data.message; | 1124 | this.text = response.data.message; |
1073 | this.color = "green"; | 1125 | this.color = "green"; |
1074 | this.getSalaryList(); | 1126 | this.getSalaryList(); |
1075 | this.close(); | 1127 | this.close(); |
1076 | }) | 1128 | }) |
1077 | .catch(error => { | 1129 | .catch((error) => { |
1078 | this.snackbar = true; | 1130 | this.snackbar = true; |
1079 | this.text = error.response.data.message; | 1131 | this.text = error.response.data.message; |
1080 | this.color = "red"; | 1132 | this.color = "red"; |
1081 | }); | 1133 | }); |
1082 | }, | 1134 | }, |
1083 | displaySearch() { | 1135 | displaySearch() { |
1084 | (this.show = false), (this.showSearch = true); | 1136 | (this.show = false), (this.showSearch = true); |
1085 | }, | 1137 | }, |
1086 | closeSearch() { | 1138 | closeSearch() { |
1087 | this.showSearch = false; | 1139 | this.showSearch = false; |
1088 | this.show = true; | 1140 | this.show = true; |
1089 | this.search = ""; | 1141 | this.search = ""; |
1090 | }, | 1142 | }, |
1091 | addSalary: function() { | 1143 | addSalary: function () { |
1092 | var showSalary = this.salaryType.basicSalary; | 1144 | var showSalary = this.salaryType.basicSalary; |
1093 | this.grossSalary = showSalary; | 1145 | this.grossSalary = showSalary; |
1094 | // console.log("salary", this.grossSalary); | 1146 | // console.log("salary", this.grossSalary); |
1095 | }, | 1147 | }, |
1096 | addAllowances: function() { | 1148 | addAllowances: function () { |
1097 | var totalAllowances = ""; | 1149 | var totalAllowances = ""; |
1098 | this.salaryTypeData.forEach(allowancesValue_ => { | 1150 | this.salaryTypeData.forEach((allowancesValue_) => { |
1099 | if (allowancesValue_.allowancesValue != "") { | 1151 | if (allowancesValue_.allowancesValue != "") { |
1100 | totalAllowances = | 1152 | totalAllowances = |
1101 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 1153 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
1102 | } | 1154 | } |
1103 | this.grossSalary = | 1155 | this.grossSalary = |
1104 | totalAllowances + | 1156 | totalAllowances + |
1105 | Number(this.salaryType.basicSalary) + | 1157 | Number(this.salaryType.basicSalary) + |
1106 | Number(this.salaryType.allowancesValue); | 1158 | Number(this.salaryType.allowancesValue); |
1107 | }); | 1159 | }); |
1108 | }, | 1160 | }, |
1109 | addAllowancesValue: function() { | 1161 | addAllowancesValue: function () { |
1110 | var totalAllowances = ""; | 1162 | var totalAllowances = ""; |
1111 | this.editedItem.allowances.forEach(allowancesValue_ => { | 1163 | this.editedItem.allowances.forEach((allowancesValue_) => { |
1112 | if (allowancesValue_.allowancesValue != "") { | 1164 | if (allowancesValue_.allowancesValue != "") { |
1113 | totalAllowances = | 1165 | totalAllowances = |
1114 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); | 1166 | Number(totalAllowances) + Number(allowancesValue_.allowancesValue); |
1115 | } | 1167 | } |
1116 | this.grossSalary = | 1168 | this.grossSalary = |
1117 | totalAllowances + | 1169 | totalAllowances + |
1118 | Number(this.editedItem.basicSalary) + | 1170 | Number(this.editedItem.basicSalary) + |
1119 | Number(this.editedItem.allowancesValue); | 1171 | Number(this.editedItem.allowancesValue); |
1120 | }); | 1172 | }); |
1121 | }, | 1173 | }, |
1122 | addDeduction: function() { | 1174 | addDeduction: function () { |
1123 | // console.log( | 1175 | // console.log( |
1124 | // "this.salaryType.deductionValue", | 1176 | // "this.salaryType.deductionValue", |
1125 | // this.salaryType.deductionValue | 1177 | // this.salaryType.deductionValue |
1126 | // ); | 1178 | // ); |
1127 | var totalDeductions = ""; | 1179 | var totalDeductions = ""; |
1128 | this.salaryTypeDeductionData.forEach(deductionValue_ => { | 1180 | this.salaryTypeDeductionData.forEach((deductionValue_) => { |
1129 | if (deductionValue_.deductionValue != "") { | 1181 | if (deductionValue_.deductionValue != "") { |
1130 | totalDeductions = | 1182 | totalDeductions = |
1131 | Number(totalDeductions) + Number(deductionValue_.deductionValue); | 1183 | Number(totalDeductions) + Number(deductionValue_.deductionValue); |
1132 | } | 1184 | } |
1133 | }); | 1185 | }); |
1134 | // console.log("deduction", totalDeductions); | 1186 | // console.log("deduction", totalDeductions); |
1135 | this.totalDeduction = totalDeductions; | 1187 | this.totalDeduction = totalDeductions; |
1136 | this.salaryType.netSalary = this.grossSalary - this.totalDeduction; | 1188 | this.salaryType.netSalary = this.grossSalary - this.totalDeduction; |
1137 | }, | 1189 | }, |
1138 | addDeductionValue: function() { | 1190 | addDeductionValue: function () { |
1139 | var totalDeductions = ""; | 1191 | var totalDeductions = ""; |
1140 | this.editedItem.deduction.forEach(deductionValue_ => { | 1192 | this.editedItem.deduction.forEach((deductionValue_) => { |
1141 | if (deductionValue_.deductionValue != "") { | 1193 | if (deductionValue_.deductionValue != "") { |
1142 | totalDeductions = | 1194 | totalDeductions = |
1143 | Number(totalDeductions) + Number(deductionValue_.deductionValue); | 1195 | Number(totalDeductions) + Number(deductionValue_.deductionValue); |
1144 | } | 1196 | } |
1145 | // this.totalDeduction = totalDeductions; | 1197 | // this.totalDeduction = totalDeductions; |
1146 | // console.log("this.totalDeductions", this.totalDeduction); | 1198 | // console.log("this.totalDeductions", this.totalDeduction); |
1147 | }); | 1199 | }); |
1148 | this.editedItem.totalDeduction = totalDeductions; | 1200 | this.editedItem.totalDeduction = totalDeductions; |
1149 | this.editedItem.netSalary = | 1201 | this.editedItem.netSalary = |
1150 | this.editedItem.grossSalary - this.editedItem.totalDeduction; | 1202 | this.editedItem.grossSalary - this.editedItem.totalDeduction; |
1151 | } | 1203 | }, |
1152 | }, | 1204 | }, |
1153 | 1205 | ||
1154 | mounted() { | 1206 | mounted() { |
1155 | this.token = this.$store.state.token; | 1207 | this.token = this.$store.state.token; |
1156 | this.getSalaryList(); | 1208 | this.getSalaryList(); |
1157 | } | 1209 | }, |
1158 | }; | 1210 | }; |
1159 | </script> | 1211 | </script> |
1160 | 1212 | ||
1161 | <style scoped> | 1213 | <style scoped> |
1162 | </style> | 1214 | </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-if="showSearch"> | 167 | <v-flex xs8 v-if="showSearch"> |
168 | <v-layout> | 168 | <v-layout> |
169 | <v-text-field | 169 | <v-text-field |
170 | autofocus | 170 | autofocus |
171 | v-model="search" | 171 | v-model="search" |
172 | label="Search" | 172 | label="Search" |
173 | prepend-inner-icon="search" | 173 | prepend-inner-icon="search" |
174 | color="primary" | 174 | color="primary" |
175 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" | 175 | style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important" |
176 | ></v-text-field> | 176 | ></v-text-field> |
177 | <v-icon @click="closeSearch" color="error">close</v-icon> | 177 | <v-icon @click="closeSearch" color="error">close</v-icon> |
178 | </v-layout> | 178 | </v-layout> |
179 | </v-flex> | 179 | </v-flex> |
180 | </v-toolbar> | 180 | </v-toolbar> |
181 | <v-data-table | 181 | <v-data-table |
182 | :headers="headers" | 182 | :headers="headers" |
183 | :items="sectionList" | 183 | :items="sectionList" |
184 | :pagination.sync="pagination" | 184 | :pagination.sync="pagination" |
185 | :search="search" | 185 | :search="search" |
186 | > | 186 | > |
187 | <template slot="items" slot-scope="props"> | 187 | <template slot="items" slot-scope="props"> |
188 | <tr class="tr"> | 188 | <tr class="tr"> |
189 | <td class="td td-row">{{ props.index + 1 }}</td> | 189 | <td class="td td-row">{{ props.index + 1 }}</td> |
190 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum }}</td> | 190 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum }}</td> |
191 | <td class="text-xs-center td td-row">{{ props.item.name }}</td> | 191 | <td class="text-xs-center td td-row">{{ props.item.name }}</td> |
192 | <td class="text-xs-center td td-row">{{ props.item.session }}</td> | 192 | <td class="text-xs-center td td-row">{{ props.item.session }}</td> |
193 | <td class="text-xs-center td td-row"> | 193 | <td class="text-xs-center td td-row"> |
194 | <span> | 194 | <span> |
195 | <v-tooltip top> | 195 | <v-tooltip top> |
196 | <img | 196 | <img |
197 | slot="activator" | 197 | slot="activator" |
198 | style="cursor:pointer; width:25px; height:25px;" | 198 | style="cursor:pointer; width:25px; height:25px;" |
199 | class="mr-3" | 199 | class="mr-3" |
200 | @click="profile(props.item)" | 200 | @click="profile(props.item)" |
201 | src="/static/icon/view.png" | 201 | src="/static/icon/view.png" |
202 | /> | 202 | /> |
203 | <span>View</span> | 203 | <span>View</span> |
204 | </v-tooltip> | 204 | </v-tooltip> |
205 | <v-tooltip top> | 205 | <v-tooltip top> |
206 | <img | 206 | <img |
207 | slot="activator" | 207 | slot="activator" |
208 | style="cursor:pointer; width:20px; height:18px; " | 208 | style="cursor:pointer; width:20px; height:18px; " |
209 | class="mr-3" | 209 | class="mr-3" |
210 | @click="editItem(props.item)" | 210 | @click="editItem(props.item)" |
211 | src="/static/icon/edit.png" | 211 | src="/static/icon/edit.png" |
212 | /> | 212 | /> |
213 | <span>Edit</span> | 213 | <span>Edit</span> |
214 | </v-tooltip> | 214 | </v-tooltip> |
215 | <!-- <v-tooltip top> | 215 | <!-- <v-tooltip top> |
216 | <img | 216 | <img |
217 | slot="activator" | 217 | slot="activator" |
218 | style="cursor:pointer; width:20px; height:20px; " | 218 | style="cursor:pointer; width:20px; height:20px; " |
219 | @click="deleteItem(props.item)" | 219 | @click="deleteItem(props.item)" |
220 | src="/static/icon/delete.png" | 220 | src="/static/icon/delete.png" |
221 | class="mr-3" | 221 | class="mr-3" |
222 | /> | 222 | /> |
223 | <span>Delete</span> | 223 | <span>Delete</span> |
224 | </v-tooltip> --> | 224 | </v-tooltip>--> |
225 | </span> | 225 | </span> |
226 | </td> | 226 | </td> |
227 | </tr> | 227 | </tr> |
228 | </template> | 228 | </template> |
229 | <v-alert | 229 | <v-alert |
230 | slot="no-results" | 230 | slot="no-results" |
231 | :value="true" | 231 | :value="true" |
232 | color="error" | 232 | color="error" |
233 | icon="warning" | 233 | icon="warning" |
234 | >Your search for "{{ search }}" found no results.</v-alert> | 234 | >Your search for "{{ search }}" found no results.</v-alert> |
235 | </v-data-table> | 235 | </v-data-table> |
236 | <!-- </v-tab-item> --> | 236 | <!-- </v-tab-item> --> |
237 | 237 | ||
238 | <!-- DIALOG BOX - ADD Students Dialog box --> | 238 | <!-- DIALOG BOX - ADD Students Dialog box --> |
239 | <v-dialog v-model="addSectionDialog" max-width="400px"> | 239 | <v-dialog v-model="addSectionDialog" max-width="400px" v-if="addSectionDialog"> |
240 | <v-card flat class="card-style pa-2" dark> | 240 | <v-card flat class="card-style pa-2" dark> |
241 | <v-layout> | 241 | <v-layout> |
242 | <v-flex xs12> | 242 | <v-flex xs12> |
243 | <label class="title text-xs-center">Add Section</label> | 243 | <label class="title text-xs-center">Add Section</label> |
244 | <v-icon size="24" class="right" @click="$refs.form.reset();addSectionDialog = false">cancel</v-icon> | 244 | <v-icon |
245 | size="24" | ||
246 | class="right" | ||
247 | @click="$refs.form.reset();addSectionDialog = false" | ||
248 | >cancel</v-icon> | ||
245 | </v-flex> | 249 | </v-flex> |
246 | </v-layout> | 250 | </v-layout> |
247 | <v-container fluid fill-height> | 251 | <v-container fluid fill-height> |
248 | <v-layout align-center> | 252 | <v-layout align-center> |
249 | <v-flex xs12> | 253 | <v-flex xs12> |
250 | <v-form ref="form" v-model="valid" lazy-validation> | 254 | <v-form ref="form" v-model="valid" lazy-validation> |
251 | <v-layout> | 255 | <v-layout> |
252 | <v-flex xs4 class="pt-4 subheading"> | 256 | <v-flex xs4 class="pt-4 subheading"> |
253 | <label class="right">Section :</label> | 257 | <label class="right">Section :</label> |
254 | </v-flex> | 258 | </v-flex> |
255 | <v-flex xs8 class="ml-3"> | 259 | <v-flex xs8 class="ml-3"> |
256 | <v-autocomplete | 260 | <v-autocomplete |
257 | v-model="sectionData.name" | 261 | v-model="sectionData.name" |
258 | placeholder="fill your Section Name" | 262 | placeholder="fill your Section Name" |
259 | :items="SectionName" | 263 | :items="SectionName" |
260 | :rules="nameRules" | 264 | :rules="nameRules" |
261 | required | 265 | required |
262 | ></v-autocomplete> | 266 | ></v-autocomplete> |
263 | </v-flex> | 267 | </v-flex> |
264 | </v-layout> | 268 | </v-layout> |
265 | <v-layout> | 269 | <v-layout> |
266 | <v-flex xs4 class="pt-4 subheading"> | 270 | <v-flex xs4 class="pt-4 subheading"> |
267 | <label class="right">Class :</label> | 271 | <label class="right">Class :</label> |
268 | </v-flex> | 272 | </v-flex> |
269 | <v-flex xs8 class="ml-3"> | 273 | <v-flex xs8 class="ml-3"> |
270 | <v-select | 274 | <v-select |
271 | :items="addclass" | 275 | :items="addclass" |
272 | label="Select Class" | 276 | label="Select Class" |
273 | v-model="sectionData.classNum" | 277 | v-model="sectionData.classNum" |
274 | item-text="classNum" | 278 | item-text="classNum" |
275 | item-value="_id" | 279 | item-value="_id" |
276 | name="Select Class" | 280 | name="Select Class" |
277 | :rules="classRules" | 281 | :rules="classRules" |
278 | required | 282 | required |
279 | ></v-select> | 283 | ></v-select> |
280 | </v-flex> | 284 | </v-flex> |
281 | </v-layout> | 285 | </v-layout> |
282 | <v-layout> | 286 | <v-layout> |
283 | <v-flex xs4 class="pt-4 subheading"> | 287 | <v-flex xs4 class="pt-4 subheading"> |
284 | <label class="right">Incharge :</label> | 288 | <label class="right">Incharge :</label> |
285 | </v-flex> | 289 | </v-flex> |
286 | <v-flex xs8 class="ml-3"> | 290 | <v-flex xs8 class="ml-3"> |
287 | <v-select | 291 | <v-select |
288 | :items="teacherList" | 292 | :items="teacherList" |
289 | label="Select Incharge" | 293 | label="Select Incharge" |
290 | v-model="sectionData.sectionId" | 294 | v-model="sectionData.sectionId" |
291 | item-text="name" | 295 | item-text="name" |
292 | item-value="_id" | 296 | item-value="_id" |
293 | name="Select Class" | 297 | name="Select Class" |
294 | :rules="inchargeRules" | 298 | :rules="inchargeRules" |
295 | required | 299 | required |
296 | ></v-select> | 300 | ></v-select> |
297 | </v-flex> | 301 | </v-flex> |
298 | </v-layout> | 302 | </v-layout> |
299 | <v-layout> | 303 | <v-layout> |
300 | <v-flex xs4 class="pt-4 subheading"> | 304 | <v-flex xs4 class="pt-4 subheading"> |
301 | <label class="right">Session:</label> | 305 | <label class="right">Session:</label> |
302 | </v-flex> | 306 | </v-flex> |
303 | <v-flex xs8 class="ml-3"> | 307 | <v-flex xs8 class="ml-3"> |
304 | <v-text-field | 308 | <v-text-field |
305 | v-model="sectionData.session" | 309 | v-model="sectionData.session" |
306 | placeholder="fill your Session" | 310 | placeholder="fill your Session" |
307 | name="name" | 311 | name="name" |
308 | type="text" | 312 | type="text" |
309 | :rules="sessionRules" | 313 | :rules="sessionRules" |
310 | required | 314 | required |
311 | ></v-text-field> | 315 | ></v-text-field> |
312 | </v-flex> | 316 | </v-flex> |
313 | </v-layout> | 317 | </v-layout> |
314 | <v-layout> | 318 | <v-layout> |
315 | <v-flex xs12 sm12> | 319 | <v-flex xs12 sm12> |
316 | <v-card-actions> | 320 | <v-card-actions> |
317 | <v-btn @click="clear" class="add-button" round dark>Clear</v-btn> | 321 | <v-btn @click="clear" class="add-button" round dark>Clear</v-btn> |
318 | <v-spacer></v-spacer> | 322 | <v-spacer></v-spacer> |
319 | <v-btn @click="submit" class="add-button" round dark :loading="loading">Add</v-btn> | 323 | <v-btn @click="submit" class="add-button" round dark :loading="loading">Add</v-btn> |
320 | </v-card-actions> | 324 | </v-card-actions> |
321 | </v-flex> | 325 | </v-flex> |
322 | </v-layout> | 326 | </v-layout> |
323 | </v-form> | 327 | </v-form> |
324 | </v-flex> | 328 | </v-flex> |
325 | </v-layout> | 329 | </v-layout> |
326 | </v-container> | 330 | </v-container> |
327 | </v-card> | 331 | </v-card> |
328 | </v-dialog> | 332 | </v-dialog> |
329 | <v-snackbar | 333 | <v-snackbar |
330 | :timeout="timeout" | 334 | :timeout="timeout" |
331 | :top="y === 'top'" | 335 | :top="y === 'top'" |
332 | :right="x === 'right'" | 336 | :right="x === 'right'" |
333 | :vertical="mode === 'vertical'" | 337 | :vertical="mode === 'vertical'" |
334 | v-model="snackbar" | 338 | v-model="snackbar" |
335 | :color="color" | 339 | :color="color" |
336 | >{{ text }}</v-snackbar> | 340 | >{{ text }}</v-snackbar> |
337 | <div class="loader" v-if="showLoader"> | 341 | <div class="loader" v-if="showLoader"> |
338 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 342 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
339 | </div> | 343 | </div> |
340 | </v-container> | 344 | </v-container> |
341 | </template> | 345 | </template> |
342 | 346 | ||
343 | <script> | 347 | <script> |
344 | import http from "@/Services/http.js"; | 348 | import http from "@/Services/http.js"; |
345 | // import { apiCollection } from "@/schoolApi/apiCollection"; | 349 | // import { apiCollection } from "@/schoolApi/apiCollection"; |
346 | // const getSectionData = apiCollection.get("posts"); | 350 | // const getSectionData = apiCollection.get("posts"); |
347 | 351 | ||
348 | export default { | 352 | export default { |
349 | data: () => ({ | 353 | data: () => ({ |
350 | snackbar: false, | 354 | snackbar: false, |
351 | y: "top", | 355 | y: "top", |
352 | x: "right", | 356 | x: "right", |
353 | mode: "", | 357 | mode: "", |
354 | timeout: 5000, | 358 | timeout: 5000, |
355 | text: "", | 359 | text: "", |
356 | color: "", | 360 | color: "", |
357 | show: true, | 361 | show: true, |
358 | showSearch: false, | 362 | showSearch: false, |
359 | showLoader: false, | 363 | showLoader: false, |
360 | loading: false, | 364 | loading: false, |
361 | date: null, | 365 | date: null, |
362 | search: "", | 366 | search: "", |
363 | editSectionDialog: false, | 367 | editSectionDialog: false, |
364 | viewSectionDialog: false, | 368 | viewSectionDialog: false, |
365 | valid: true, | 369 | valid: true, |
366 | validEdit: true, | 370 | validEdit: true, |
367 | addSectionDialog: false, | 371 | addSectionDialog: false, |
368 | editLoading: false, | 372 | editLoading: false, |
369 | details: [], | 373 | details: [], |
370 | pagination: { | 374 | pagination: { |
371 | rowsPerPage: 10 | 375 | rowsPerPage: 10, |
372 | }, | 376 | }, |
373 | nameRules: [v => !!v || " Section Name is required"], | 377 | nameRules: [(v) => !!v || " Section Name is required"], |
374 | classRules: [v => !!v || " Class Name is required"], | 378 | classRules: [(v) => !!v || " Class Name is required"], |
375 | sessionRules: [v => !!v || " Session is required"], | 379 | sessionRules: [(v) => !!v || " Session is required"], |
376 | inchargeRules: [v => !!v || " Incharge Name is required"], | 380 | inchargeRules: [(v) => !!v || " Incharge Name is required"], |
377 | SectionName: ["A", "B", "C", "D", "E", "F"], | 381 | SectionName: ["A", "B", "C", "D", "E", "F"], |
378 | headers: [ | 382 | headers: [ |
379 | { | 383 | { |
380 | text: "No", | 384 | text: "No", |
381 | align: "", | 385 | align: "", |
382 | sortable: false, | 386 | sortable: false, |
383 | value: "No" | 387 | value: "No", |
384 | }, | 388 | }, |
385 | { | 389 | { |
386 | text: "Class Name", | 390 | text: "Class Name", |
387 | value: "classData.classNum", | 391 | value: "classData.classNum", |
388 | sortable: false, | 392 | sortable: false, |
389 | align: "center" | 393 | align: "center", |
390 | }, | 394 | }, |
391 | { text: "Section Name", value: "name", sortable: false, align: "center" }, | 395 | { text: "Section Name", value: "name", sortable: false, align: "center" }, |
392 | { text: "Session", value: "session", sortable: false, align: "center" }, | 396 | { text: "Session", value: "session", sortable: false, align: "center" }, |
393 | { text: "Action", value: "", sortable: false, align: "center" } | 397 | { text: "Action", value: "", sortable: false, align: "center" }, |
394 | ], | 398 | ], |
395 | sectionList: [], | 399 | sectionList: [], |
396 | addclass: [], | 400 | addclass: [], |
397 | teacherList: [], | 401 | teacherList: [], |
398 | select: "", | 402 | select: "", |
399 | selectId: "", | 403 | selectId: "", |
400 | token: "", | 404 | token: "", |
401 | editedIndex: -1, | 405 | editedIndex: -1, |
402 | editedItem: { | 406 | editedItem: { |
403 | classData: { | 407 | classData: { |
404 | classNum: "" | 408 | classNum: "", |
405 | }, | 409 | }, |
406 | teacherData: [ | 410 | teacherData: [ |
407 | { | 411 | { |
408 | name: "" | 412 | name: "", |
409 | } | 413 | }, |
410 | ] | 414 | ], |
411 | // name: "", | 415 | // name: "", |
412 | // session: new Date().getFullYear() | 416 | // session: new Date().getFullYear() |
413 | }, | 417 | }, |
414 | sectionData: { | 418 | sectionData: { |
415 | session: new Date().getFullYear() | 419 | session: new Date().getFullYear(), |
416 | } | 420 | }, |
417 | }), | 421 | }), |
422 | watch: { | ||
423 | addSectionDialog: function (val) { | ||
424 | if (!val) { | ||
425 | this.sectionData = []; | ||
426 | } | ||
427 | }, | ||
428 | }, | ||
418 | methods: { | 429 | methods: { |
419 | getSectionList() { | 430 | getSectionList() { |
420 | // const { data } = await getSectionData.get(); | 431 | // const { data } = await getSectionData.get(); |
421 | this.showLoader = true; | 432 | this.showLoader = true; |
422 | http() | 433 | http() |
423 | .get("/getAllSections", { | 434 | .get("/getAllSections", { |
424 | headers: { Authorization: "Bearer " + this.token } | 435 | headers: { Authorization: "Bearer " + this.token }, |
425 | }) | 436 | }) |
426 | .then(response => { | 437 | .then((response) => { |
427 | this.sectionList = response.data.data; | 438 | this.sectionList = response.data.data; |
428 | this.showLoader = false; | 439 | this.showLoader = false; |
429 | // console.log("getAllSections=====>",response.data.data) | 440 | // console.log("getAllSections=====>",response.data.data) |
430 | }) | 441 | }) |
431 | .catch(error => { | 442 | .catch((error) => { |
432 | this.showLoader = false; | 443 | this.showLoader = false; |
433 | if (error.response.status === 401) { | 444 | if (error.response.status === 401) { |
434 | this.$router.replace({ path: "/" }); | 445 | this.$router.replace({ path: "/" }); |
435 | this.$store.dispatch("setToken", null); | 446 | this.$store.dispatch("setToken", null); |
436 | this.$store.dispatch("Id", null); | 447 | this.$store.dispatch("Id", null); |
437 | } | 448 | } |
438 | }); | 449 | }); |
439 | }, | 450 | }, |
440 | editItem(item) { | 451 | editItem(item) { |
441 | this.editedIndex = this.sectionList.indexOf(item); | 452 | this.editedIndex = this.sectionList.indexOf(item); |
442 | this.editedItem = Object.assign({}, item); | 453 | this.editedItem = Object.assign({}, item); |
443 | this.editSectionDialog = true; | 454 | this.editSectionDialog = true; |
444 | }, | 455 | }, |
445 | profile(item) { | 456 | profile(item) { |
446 | this.editedIndex = this.sectionList.indexOf(item); | 457 | this.editedIndex = this.sectionList.indexOf(item); |
447 | this.editedItem = Object.assign({}, item); | 458 | this.editedItem = Object.assign({}, item); |
448 | this.viewSectionDialog = true; | 459 | this.viewSectionDialog = true; |
449 | }, | 460 | }, |
450 | deleteItem(item) { | 461 | deleteItem(item) { |
451 | let deleteStudent = { | 462 | let deleteStudent = { |
452 | sectionId: item._id | 463 | sectionId: item._id, |
453 | }; | 464 | }; |
454 | http() | 465 | http() |
455 | .delete( | 466 | .delete( |
456 | "/deleteSection", | 467 | "/deleteSection", |
457 | confirm("Are you sure you want to delete this?") && { | 468 | confirm("Are you sure you want to delete this?") && { |
458 | params: deleteStudent | 469 | params: deleteStudent, |
459 | } | 470 | } |
460 | ) | 471 | ) |
461 | .then(response => { | 472 | .then((response) => { |
462 | this.snackbar = true; | 473 | this.snackbar = true; |
463 | this.text = response.data.message; | 474 | this.text = response.data.message; |
464 | this.color = "green"; | 475 | this.color = "green"; |
465 | this.getSectionList(); | 476 | this.getSectionList(); |
466 | }) | 477 | }) |
467 | .catch(error => { | 478 | .catch((error) => { |
468 | this.snackbar = true; | 479 | this.snackbar = true; |
469 | this.text = error.response.data.message; | 480 | this.text = error.response.data.message; |
470 | this.color = "green"; | 481 | this.color = "green"; |
471 | }); | 482 | }); |
472 | }, | 483 | }, |
473 | closeSectionDialog() { | 484 | closeSectionDialog() { |
474 | this.editSectionDialog = false; | 485 | this.editSectionDialog = false; |
475 | }, | 486 | }, |
476 | closeviewSectionDialog() { | 487 | closeviewSectionDialog() { |
477 | this.viewSectionDialog = false; | 488 | this.viewSectionDialog = false; |
478 | }, | 489 | }, |
479 | submit() { | 490 | submit() { |
480 | if (this.$refs.form.validate()) { | 491 | if (this.$refs.form.validate()) { |
481 | let addSection = { | 492 | let addSection = { |
482 | name: this.sectionData.name, | 493 | name: this.sectionData.name, |
483 | classId: this.sectionData.classNum, | 494 | classId: this.sectionData.classNum, |
484 | session: this.sectionData.session, | 495 | session: this.sectionData.session, |
485 | classInchargeId: this.sectionData.sectionId | 496 | classInchargeId: this.sectionData.sectionId, |
486 | }; | 497 | }; |
487 | this.loading = true; | 498 | this.loading = true; |
488 | http() | 499 | http() |
489 | .post("/createSection", addSection) | 500 | .post("/createSection", addSection) |
490 | .then(response => { | 501 | .then((response) => { |
491 | this.getSectionList(); | 502 | this.getSectionList(); |
492 | this.snackbar = true; | 503 | this.snackbar = true; |
493 | this.color = "green"; | 504 | this.color = "green"; |
494 | this.text = "New Section added successfully"; | 505 | this.text = "New Section added successfully"; |
495 | this.clear(); | 506 | this.clear(); |
496 | this.addSectionDialog = false; | 507 | this.addSectionDialog = false; |
497 | this.loading = false; | 508 | this.loading = false; |
498 | }) | 509 | }) |
499 | .catch(error => { | 510 | .catch((error) => { |
500 | this.snackbar = true; | 511 | this.snackbar = true; |
501 | this.color = "error"; | 512 | this.color = "error"; |
502 | this.text = error.response.data.message; | 513 | this.text = error.response.data.message; |
503 | this.loading = false; | 514 | this.loading = false; |
504 | }); | 515 | }); |
505 | } | 516 | } |
506 | }, | 517 | }, |
507 | clear() { | 518 | clear() { |
508 | this.$refs.form.reset(); | 519 | this.$refs.form.reset(); |
509 | }, | 520 | }, |
510 | save() { | 521 | save() { |
511 | this.editedItem.sectionId = this.editedItem._id; | 522 | this.editedItem.sectionId = this.editedItem._id; |
512 | this.editLoading = true; | 523 | this.editLoading = true; |
513 | http() | 524 | http() |
514 | .put("/updateSection", this.editedItem) | 525 | .put("/updateSection", this.editedItem) |
515 | .then(response => { | 526 | .then((response) => { |
516 | this.editLoading = false; | 527 | this.editLoading = false; |
517 | this.snackbar = true; | 528 | this.snackbar = true; |
518 | this.color = "green"; | 529 | this.color = "green"; |
519 | this.text = response.data.message; | 530 | this.text = response.data.message; |
520 | this.getSectionList(); | 531 | this.getSectionList(); |
521 | this.closeSectionDialog(); | 532 | this.closeSectionDialog(); |
522 | }) | 533 | }) |
523 | .catch(error => { | 534 | .catch((error) => { |
524 | this.editLoading = false; | 535 | this.editLoading = false; |
525 | this.snackbar = true; | 536 | this.snackbar = true; |
526 | this.color = "error"; | 537 | this.color = "error"; |
527 | this.text = error.response.data.message; | 538 | this.text = error.response.data.message; |
528 | }); | 539 | }); |
529 | }, | 540 | }, |
530 | getAllTeacher() { | 541 | getAllTeacher() { |
531 | http() | 542 | http() |
532 | .get("/getTeachersList", { | 543 | .get("/getTeachersList", { |
533 | headers: { Authorization: "Bearer " + this.token } | 544 | headers: { Authorization: "Bearer " + this.token }, |
534 | }) | 545 | }) |
535 | .then(response => { | 546 | .then((response) => { |
536 | this.teacherList = response.data.data; | 547 | this.teacherList = response.data.data; |
537 | this.showLoader = false; | 548 | this.showLoader = false; |
538 | }) | 549 | }) |
539 | .catch(err => { | 550 | .catch((err) => { |
540 | // console.log("err====>", err); | 551 | // console.log("err====>", err); |
541 | this.showLoader = false; | 552 | this.showLoader = false; |
542 | }); | 553 | }); |
543 | }, | 554 | }, |
544 | getAllClasses() { | 555 | getAllClasses() { |
545 | http() | 556 | http() |
546 | .get("/getClassesList", { | 557 | .get("/getClassesList", { |
547 | headers: { Authorization: "Bearer " + this.token } | 558 | headers: { Authorization: "Bearer " + this.token }, |
548 | }) | 559 | }) |
549 | .then(response => { | 560 | .then((response) => { |
550 | this.addclass = response.data.data; | 561 | this.addclass = response.data.data; |
551 | }) | 562 | }) |
552 | .catch(err => { | 563 | .catch((err) => { |
553 | // console.log("err====>", err); | 564 | // console.log("err====>", err); |
554 | // this.$router.replace({ path: "/" }); | 565 | // this.$router.replace({ path: "/" }); |
555 | }); | 566 | }); |
556 | }, | 567 | }, |
557 | displaySearch() { | 568 | displaySearch() { |
558 | (this.show = false), (this.showSearch = true); | 569 | (this.show = false), (this.showSearch = true); |
559 | }, | 570 | }, |
560 | closeSearch() { | 571 | closeSearch() { |
561 | this.showSearch = false; | 572 | this.showSearch = false; |
562 | this.show = true; | 573 | this.show = true; |
563 | this.search = ""; | 574 | this.search = ""; |
564 | } | 575 | }, |
565 | }, | 576 | }, |
566 | mounted() { | 577 | mounted() { |
567 | this.token = this.$store.state.token; | 578 | this.token = this.$store.state.token; |
568 | this.getSectionList(); | 579 | this.getSectionList(); |
569 | this.getAllClasses(); | 580 | this.getAllClasses(); |
570 | this.getAllTeacher(); | 581 | this.getAllTeacher(); |
571 | } | 582 | }, |
572 | }; | 583 | }; |
573 | </script> | 584 | </script> |
574 | 585 |
src/pages/Students/students.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDITS STUDENTS DETAILS ****** --> | 3 | <!-- ****** EDITS STUDENTS DETAILS ****** --> |
4 | <v-dialog v-model="editStudentDialog" max-width="1700px" scrollable> | 4 | <v-dialog v-model="editStudentDialog" max-width="1700px" 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 Student Details</label> | 8 | <label class="title text-xs-center">Edit Student Details</label> |
9 | <v-icon size="24" class="right" @click="editStudentDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editStudentDialog = 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> | 15 | <v-layout> |
16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> | 16 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center"> |
17 | <v-avatar size="100px" v-if="!editedItem.profilePicUrl && !editImageUrl"> | 17 | <v-avatar size="100px" v-if="!editedItem.profilePicUrl && !editImageUrl"> |
18 | <img src="/static/icon/user.png" /> | 18 | <img src="/static/icon/user.png" /> |
19 | </v-avatar> | 19 | </v-avatar> |
20 | <img | 20 | <img |
21 | :src="editedItem.profilePicUrl" | 21 | :src="editedItem.profilePicUrl" |
22 | v-else-if="editedItem.profilePicUrl && !editImageUrl" | 22 | v-else-if="editedItem.profilePicUrl && !editImageUrl" |
23 | height="150" | 23 | height="150" |
24 | style="border-radius:50%; width:150px" | 24 | style="border-radius:50%; width:150px" |
25 | /> | 25 | /> |
26 | <img | 26 | <img |
27 | v-if="editImageUrl" | 27 | v-if="editImageUrl" |
28 | :src="editImageUrl" | 28 | :src="editImageUrl" |
29 | style="border-radius:50%; width:150px;height:150px" | 29 | style="border-radius:50%; width:150px;height:150px" |
30 | /> | 30 | /> |
31 | <input | 31 | <input |
32 | type="file" | 32 | type="file" |
33 | style="display: none" | 33 | style="display: none" |
34 | ref="editDataImage" | 34 | ref="editDataImage" |
35 | accept="image/*" | 35 | accept="image/*" |
36 | @change="onEditFilePicked" | 36 | @change="onEditFilePicked" |
37 | /> | 37 | /> |
38 | </v-flex> | 38 | </v-flex> |
39 | </v-layout> | 39 | </v-layout> |
40 | <v-layout wrap> | 40 | <v-layout wrap> |
41 | <v-flex xs12 sm4> | 41 | <v-flex xs12 sm4> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-flex xs4 class="pt-4 subheading"> | 43 | <v-flex xs4 class="pt-4 subheading"> |
44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 44 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
46 | </v-flex> | 46 | </v-flex> |
47 | <v-flex xs8 class="ml-3"> | 47 | <v-flex xs8 class="ml-3"> |
48 | <v-select | 48 | <v-select |
49 | :items="addclass" | 49 | :items="addclass" |
50 | label="Select Class" | 50 | label="Select Class" |
51 | v-model="editedItem.select" | 51 | v-model="editedItem.select" |
52 | item-text="classNum" | 52 | item-text="classNum" |
53 | item-value="_id" | 53 | item-value="_id" |
54 | name="Select Class" | 54 | name="Select Class" |
55 | @change="getSections(editedItem.select)" | 55 | @change="getSections(editedItem.select)" |
56 | required | 56 | required |
57 | ></v-select> | 57 | ></v-select> |
58 | </v-flex> | 58 | </v-flex> |
59 | </v-layout> | 59 | </v-layout> |
60 | </v-flex> | 60 | </v-flex> |
61 | <v-flex xs12 sm4> | 61 | <v-flex xs12 sm4> |
62 | <v-layout> | 62 | <v-layout> |
63 | <v-flex xs4 class="pt-4 subheading"> | 63 | <v-flex xs4 class="pt-4 subheading"> |
64 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> | 64 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> |
65 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> | 65 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> |
66 | </v-flex> | 66 | </v-flex> |
67 | <v-flex xs8 class="ml-3"> | 67 | <v-flex xs8 class="ml-3"> |
68 | <v-select | 68 | <v-select |
69 | :items="addSection" | 69 | :items="addSection" |
70 | label="Select Section" | 70 | label="Select Section" |
71 | v-model="editedItem.selectSection" | 71 | v-model="editedItem.selectSection" |
72 | item-text="name" | 72 | item-text="name" |
73 | item-value="_id" | 73 | item-value="_id" |
74 | name="Select Section" | 74 | name="Select Section" |
75 | required | 75 | required |
76 | ></v-select> | 76 | ></v-select> |
77 | </v-flex> | 77 | </v-flex> |
78 | </v-layout> | 78 | </v-layout> |
79 | </v-flex> | 79 | </v-flex> |
80 | <v-flex xs12 sm4> | 80 | <v-flex xs12 sm4> |
81 | <v-layout> | 81 | <v-layout> |
82 | <v-flex xs4 class="pt-4 subheading"> | 82 | <v-flex xs4 class="pt-4 subheading"> |
83 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> | 83 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> |
84 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label> | 84 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label> |
85 | </v-flex> | 85 | </v-flex> |
86 | <v-flex xs8 class="ml-3"> | 86 | <v-flex xs8 class="ml-3"> |
87 | <v-text-field | 87 | <v-text-field |
88 | v-model="editedItem.name" | 88 | v-model="editedItem.name" |
89 | placeholder="fill your full Name" | 89 | placeholder="fill your full Name" |
90 | name="name" | 90 | name="name" |
91 | type="text" | 91 | type="text" |
92 | required | 92 | required |
93 | ></v-text-field> | 93 | ></v-text-field> |
94 | </v-flex> | 94 | </v-flex> |
95 | </v-layout> | 95 | </v-layout> |
96 | </v-flex> | 96 | </v-flex> |
97 | </v-layout> | 97 | </v-layout> |
98 | <v-layout wrap> | 98 | <v-layout wrap> |
99 | <v-flex xs12 sm4> | 99 | <v-flex xs12 sm4> |
100 | <v-layout> | 100 | <v-layout> |
101 | <v-flex xs4 class="pt-4 subheading"> | 101 | <v-flex xs4 class="pt-4 subheading"> |
102 | <label class="right hidden-xs-only hidden-sm-only">Email Id:</label> | 102 | <label class="right hidden-xs-only hidden-sm-only">Email Id:</label> |
103 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Email:</label> | 103 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Email:</label> |
104 | </v-flex> | 104 | </v-flex> |
105 | <v-flex xs8 class="ml-3"> | 105 | <v-flex xs8 class="ml-3"> |
106 | <v-text-field | 106 | <v-text-field |
107 | placeholder="fill your email" | 107 | placeholder="fill your email" |
108 | v-model="editedItem.email" | 108 | v-model="editedItem.email" |
109 | type="text" | 109 | type="text" |
110 | name="email" | 110 | name="email" |
111 | required | 111 | required |
112 | ></v-text-field> | 112 | ></v-text-field> |
113 | </v-flex> | 113 | </v-flex> |
114 | </v-layout> | 114 | </v-layout> |
115 | </v-flex> | 115 | </v-flex> |
116 | <v-flex xs12 sm4> | 116 | <v-flex xs12 sm4> |
117 | <v-layout> | 117 | <v-layout> |
118 | <v-flex xs4 class="pt-4 subheading"> | 118 | <v-flex xs4 class="pt-4 subheading"> |
119 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 119 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
120 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> | 120 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> |
121 | </v-flex> | 121 | </v-flex> |
122 | <v-flex xs8 class="ml-3"> | 122 | <v-flex xs8 class="ml-3"> |
123 | <v-menu | 123 | <v-menu |
124 | ref="menu" | 124 | ref="menu" |
125 | :close-on-content-click="false" | 125 | :close-on-content-click="false" |
126 | v-model="menu1" | 126 | v-model="menu1" |
127 | :nudge-right="40" | 127 | :nudge-right="40" |
128 | lazy | 128 | lazy |
129 | transition="scale-transition" | 129 | transition="scale-transition" |
130 | offset-y | 130 | offset-y |
131 | full-width | 131 | full-width |
132 | min-width="290px" | 132 | min-width="290px" |
133 | > | 133 | > |
134 | <v-text-field | 134 | <v-text-field |
135 | slot="activator" | 135 | slot="activator" |
136 | v-model="editedItem.dob" | 136 | v-model="editedItem.dob" |
137 | placeholder="Select Dob" | 137 | placeholder="Select Dob" |
138 | ></v-text-field> | 138 | ></v-text-field> |
139 | <v-date-picker | 139 | <v-date-picker |
140 | ref="picker" | 140 | ref="picker" |
141 | v-model="editedItem.dob" | 141 | v-model="editedItem.dob" |
142 | :max="new Date().toISOString().substr(0, 10)" | 142 | :max="new Date().toISOString().substr(0, 10)" |
143 | min="1950-01-01" | 143 | min="1950-01-01" |
144 | @input="menu1 = false" | 144 | @input="menu1 = false" |
145 | ></v-date-picker> | 145 | ></v-date-picker> |
146 | </v-menu> | 146 | </v-menu> |
147 | </v-flex> | 147 | </v-flex> |
148 | </v-layout> | 148 | </v-layout> |
149 | </v-flex> | 149 | </v-flex> |
150 | <v-flex xs12 sm4> | 150 | <v-flex xs12 sm4> |
151 | <v-layout> | 151 | <v-layout> |
152 | <v-flex xs4 class="pt-4 subheading"> | 152 | <v-flex xs4 class="pt-4 subheading"> |
153 | <label class="right">City:</label> | 153 | <label class="right">City:</label> |
154 | </v-flex> | 154 | </v-flex> |
155 | <v-flex xs8 class="ml-3"> | 155 | <v-flex xs8 class="ml-3"> |
156 | <v-text-field | 156 | <v-text-field |
157 | v-model="editedItem.city" | 157 | v-model="editedItem.city" |
158 | placeholder="fill your City Name" | 158 | placeholder="fill your City Name" |
159 | name="City" | 159 | name="City" |
160 | type="text" | 160 | type="text" |
161 | required | 161 | required |
162 | ></v-text-field> | 162 | ></v-text-field> |
163 | </v-flex> | 163 | </v-flex> |
164 | </v-layout> | 164 | </v-layout> |
165 | </v-flex> | 165 | </v-flex> |
166 | </v-layout> | 166 | </v-layout> |
167 | <v-layout wrap> | 167 | <v-layout wrap> |
168 | <v-flex xs12 sm4> | 168 | <v-flex xs12 sm4> |
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 hidden-xs-only hidden-sm-only">Blood Group:</label> | 171 | <label class="right hidden-xs-only hidden-sm-only">Blood Group:</label> |
172 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Blood:</label> | 172 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Blood:</label> |
173 | </v-flex> | 173 | </v-flex> |
174 | <v-flex xs8 class="ml-3"> | 174 | <v-flex xs8 class="ml-3"> |
175 | <v-text-field | 175 | <v-text-field |
176 | v-model="editedItem.bloodGroup" | 176 | v-model="editedItem.bloodGroup" |
177 | placeholder="fill your BloodGroup" | 177 | placeholder="fill your BloodGroup" |
178 | name="state" | 178 | name="state" |
179 | type="text" | 179 | type="text" |
180 | required | 180 | required |
181 | ></v-text-field> | 181 | ></v-text-field> |
182 | </v-flex> | 182 | </v-flex> |
183 | </v-layout> | 183 | </v-layout> |
184 | </v-flex> | 184 | </v-flex> |
185 | <v-flex xs12 sm4> | 185 | <v-flex xs12 sm4> |
186 | <v-layout> | 186 | <v-layout> |
187 | <v-flex xs4 class="pt-4 subheading"> | 187 | <v-flex xs4 class="pt-4 subheading"> |
188 | <label class="right">Gender:</label> | 188 | <label class="right">Gender:</label> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex xs8 class="ml-3"> | 190 | <v-flex xs8 class="ml-3"> |
191 | <v-select | 191 | <v-select |
192 | :items="gender" | 192 | :items="gender" |
193 | v-model="editedItem.gender" | 193 | v-model="editedItem.gender" |
194 | placeholder="Select Gender" | 194 | placeholder="Select Gender" |
195 | required | 195 | required |
196 | ></v-select> | 196 | ></v-select> |
197 | </v-flex> | 197 | </v-flex> |
198 | </v-layout> | 198 | </v-layout> |
199 | </v-flex> | 199 | </v-flex> |
200 | <v-flex xs12 sm4> | 200 | <v-flex xs12 sm4> |
201 | <v-layout> | 201 | <v-layout> |
202 | <v-flex xs4 class="pt-4 subheading"> | 202 | <v-flex xs4 class="pt-4 subheading"> |
203 | <label class="right">Medical Notes:</label> | 203 | <label class="right">Medical Notes:</label> |
204 | </v-flex> | 204 | </v-flex> |
205 | <v-flex xs8 class="ml-3"> | 205 | <v-flex xs8 class="ml-3"> |
206 | <v-text-field | 206 | <v-text-field |
207 | v-model="editedItem.medicalNotes" | 207 | v-model="editedItem.medicalNotes" |
208 | placeholder="fill your medicalNotes" | 208 | placeholder="fill your medicalNotes" |
209 | required | 209 | required |
210 | ></v-text-field> | 210 | ></v-text-field> |
211 | </v-flex> | 211 | </v-flex> |
212 | </v-layout> | 212 | </v-layout> |
213 | </v-flex> | 213 | </v-flex> |
214 | </v-layout> | 214 | </v-layout> |
215 | <v-layout wrap> | 215 | <v-layout wrap> |
216 | <v-flex xs12 sm4> | 216 | <v-flex xs12 sm4> |
217 | <v-layout> | 217 | <v-layout> |
218 | <v-flex xs4 class="pt-4 subheading"> | 218 | <v-flex xs4 class="pt-4 subheading"> |
219 | <label class="right">Height:</label> | 219 | <label class="right">Height:</label> |
220 | </v-flex> | 220 | </v-flex> |
221 | <v-flex xs8 class="ml-3"> | 221 | <v-flex xs8 class="ml-3"> |
222 | <v-text-field | 222 | <v-text-field |
223 | v-model="editedItem.height" | 223 | v-model="editedItem.height" |
224 | placeholder="fill your Height" | 224 | placeholder="fill your Height" |
225 | name="state" | 225 | name="state" |
226 | type="text" | 226 | type="text" |
227 | required | 227 | required |
228 | ></v-text-field> | 228 | ></v-text-field> |
229 | </v-flex> | 229 | </v-flex> |
230 | </v-layout> | 230 | </v-layout> |
231 | </v-flex> | 231 | </v-flex> |
232 | <v-flex xs12 sm4> | 232 | <v-flex xs12 sm4> |
233 | <v-layout> | 233 | <v-layout> |
234 | <v-flex xs4 class="pt-4 subheading"> | 234 | <v-flex xs4 class="pt-4 subheading"> |
235 | <label class="right">Weight:</label> | 235 | <label class="right">Weight:</label> |
236 | </v-flex> | 236 | </v-flex> |
237 | <v-flex xs8 class="ml-3"> | 237 | <v-flex xs8 class="ml-3"> |
238 | <v-text-field | 238 | <v-text-field |
239 | v-model="editedItem.weight" | 239 | v-model="editedItem.weight" |
240 | placeholder="fill your Weight" | 240 | placeholder="fill your Weight" |
241 | name="pincode" | 241 | name="pincode" |
242 | required | 242 | required |
243 | ></v-text-field> | 243 | ></v-text-field> |
244 | </v-flex> | 244 | </v-flex> |
245 | </v-layout> | 245 | </v-layout> |
246 | </v-flex> | 246 | </v-flex> |
247 | <v-flex xs12 sm4> | 247 | <v-flex xs12 sm4> |
248 | <v-layout> | 248 | <v-layout> |
249 | <v-flex xs4 class="pt-4 subheading"> | 249 | <v-flex xs4 class="pt-4 subheading"> |
250 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 250 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
251 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> | 251 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> |
252 | </v-flex> | 252 | </v-flex> |
253 | <v-flex xs8 class="ml-3"> | 253 | <v-flex xs8 class="ml-3"> |
254 | <v-text-field | 254 | <v-text-field |
255 | label="Select Image" | 255 | label="Select Image" |
256 | @click="pickEditFile" | 256 | @click="pickEditFile" |
257 | v-model="editImageName" | 257 | v-model="editImageName" |
258 | append-icon="attach_file" | 258 | append-icon="attach_file" |
259 | ></v-text-field> | 259 | ></v-text-field> |
260 | </v-flex> | 260 | </v-flex> |
261 | </v-layout> | 261 | </v-layout> |
262 | </v-flex> | 262 | </v-flex> |
263 | </v-layout> | 263 | </v-layout> |
264 | <v-layout wrap> | 264 | <v-layout wrap> |
265 | <v-flex xs12 sm4> | 265 | <v-flex xs12 sm4> |
266 | <v-layout> | 266 | <v-layout> |
267 | <v-flex xs4 class="pt-4 subheading"> | 267 | <v-flex xs4 class="pt-4 subheading"> |
268 | <label class="right">State:</label> | 268 | <label class="right">State:</label> |
269 | </v-flex> | 269 | </v-flex> |
270 | <v-flex xs8 class="ml-3"> | 270 | <v-flex xs8 class="ml-3"> |
271 | <v-text-field | 271 | <v-text-field |
272 | v-model="editedItem.state" | 272 | v-model="editedItem.state" |
273 | placeholder="fill your State Name" | 273 | placeholder="fill your State Name" |
274 | name="state" | 274 | name="state" |
275 | type="text" | 275 | type="text" |
276 | required | 276 | required |
277 | ></v-text-field> | 277 | ></v-text-field> |
278 | </v-flex> | 278 | </v-flex> |
279 | </v-layout> | 279 | </v-layout> |
280 | </v-flex> | 280 | </v-flex> |
281 | <v-flex xs12 sm4> | 281 | <v-flex xs12 sm4> |
282 | <v-layout> | 282 | <v-layout> |
283 | <v-flex xs4 class="pt-4 subheading"> | 283 | <v-flex xs4 class="pt-4 subheading"> |
284 | <label class="right">Pincode:</label> | 284 | <label class="right">Pincode:</label> |
285 | </v-flex> | 285 | </v-flex> |
286 | <v-flex xs8 class="ml-3"> | 286 | <v-flex xs8 class="ml-3"> |
287 | <v-text-field | 287 | <v-text-field |
288 | v-model="editedItem.pincode" | 288 | v-model="editedItem.pincode" |
289 | placeholder="fill your pincode" | 289 | placeholder="fill your pincode" |
290 | name="pincode" | 290 | name="pincode" |
291 | type="number" | 291 | type="number" |
292 | required | 292 | required |
293 | ></v-text-field> | 293 | ></v-text-field> |
294 | </v-flex> | 294 | </v-flex> |
295 | </v-layout> | 295 | </v-layout> |
296 | </v-flex> | 296 | </v-flex> |
297 | <v-flex xs12 sm4> | 297 | <v-flex xs12 sm4> |
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 hidden-xs-only hidden-sm-only">Mobile No:</label> | 300 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> |
301 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> | 301 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> |
302 | </v-flex> | 302 | </v-flex> |
303 | <v-flex xs8 class="ml-3"> | 303 | <v-flex xs8 class="ml-3"> |
304 | <v-text-field | 304 | <v-text-field |
305 | v-model="editedItem.mobile" | 305 | v-model="editedItem.mobile" |
306 | placeholder="fill your MobileNo" | 306 | placeholder="fill your MobileNo" |
307 | name="mobileNo" | 307 | name="mobileNo" |
308 | type="number" | 308 | type="number" |
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-flex> | 313 | </v-flex> |
314 | </v-layout> | 314 | </v-layout> |
315 | <v-layout wrap> | 315 | <v-layout wrap> |
316 | <v-flex xs12 sm4> | 316 | <v-flex xs12 sm4> |
317 | <v-layout> | 317 | <v-layout> |
318 | <v-flex xs4 class="pt-4 subheading"> | 318 | <v-flex xs4 class="pt-4 subheading"> |
319 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> | 319 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> |
320 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> | 320 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> |
321 | </v-flex> | 321 | </v-flex> |
322 | <v-flex xs8 class="ml-3"> | 322 | <v-flex xs8 class="ml-3"> |
323 | <v-autocomplete | 323 | <v-autocomplete |
324 | v-model="editedItem.country" | 324 | v-model="editedItem.country" |
325 | :items="countries" | 325 | :items="countries" |
326 | placeholder="Select Country Name" | 326 | placeholder="Select Country Name" |
327 | required | 327 | required |
328 | ></v-autocomplete> | 328 | ></v-autocomplete> |
329 | </v-flex> | 329 | </v-flex> |
330 | </v-layout> | 330 | </v-layout> |
331 | </v-flex> | 331 | </v-flex> |
332 | <v-flex xs12 sm4 class="hidden-xs-only hidden-sm-only"> | 332 | <v-flex xs12 sm4 class="hidden-xs-only hidden-sm-only"> |
333 | <v-layout> | 333 | <v-layout> |
334 | <v-flex xs4 class="pt-4 subheading"> | 334 | <v-flex xs4 class="pt-4 subheading"> |
335 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> | 335 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> |
336 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Roll No:</label> | 336 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Roll No:</label> |
337 | </v-flex> | 337 | </v-flex> |
338 | <v-flex xs8 class="ml-3"> | 338 | <v-flex xs8 class="ml-3"> |
339 | <v-text-field | 339 | <v-text-field |
340 | v-model="editedItem.rollNo" | 340 | v-model="editedItem.rollNo" |
341 | placeholder="fill roll number" | 341 | placeholder="fill roll number" |
342 | required | 342 | required |
343 | ></v-text-field> | 343 | ></v-text-field> |
344 | </v-flex> | 344 | </v-flex> |
345 | </v-layout> | 345 | </v-layout> |
346 | </v-flex> | 346 | </v-flex> |
347 | <v-flex xs12 sm4 class="hidden-xs-only hidden-sm-only"> | 347 | <v-flex xs12 sm4 class="hidden-xs-only hidden-sm-only"> |
348 | <v-layout> | 348 | <v-layout> |
349 | <v-flex xs4 sm4 class="pt-4 subheading"> | 349 | <v-flex xs4 sm4 class="pt-4 subheading"> |
350 | <label class="right hidden-xs-only hidden-sm-only">Permanent Address:</label> | 350 | <label class="right hidden-xs-only hidden-sm-only">Permanent Address:</label> |
351 | <label | 351 | <label |
352 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 352 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
353 | >Permanent Address:</label> | 353 | >Permanent Address:</label> |
354 | </v-flex> | 354 | </v-flex> |
355 | <v-flex xs12 sm8 class="ml-3"> | 355 | <v-flex xs12 sm8 class="ml-3"> |
356 | <v-text-field | 356 | <v-text-field |
357 | v-model="editedItem.permanentAddress" | 357 | v-model="editedItem.permanentAddress" |
358 | placeholder="fill Your Permanent Address" | 358 | placeholder="fill Your Permanent Address" |
359 | required | 359 | required |
360 | ></v-text-field> | 360 | ></v-text-field> |
361 | </v-flex> | 361 | </v-flex> |
362 | </v-layout> | 362 | </v-layout> |
363 | </v-flex> | 363 | </v-flex> |
364 | </v-layout> | 364 | </v-layout> |
365 | <v-layout class="hidden-xs-only hidden-sm-only"> | 365 | <v-layout class="hidden-xs-only hidden-sm-only"> |
366 | <v-flex xs12 sm4> | 366 | <v-flex xs12 sm4> |
367 | <v-layout> | 367 | <v-layout> |
368 | <v-flex xs4 class="pt-4 subheading"> | 368 | <v-flex xs4 class="pt-4 subheading"> |
369 | <label class="right hidden-xs-only hidden-sm-only">Present Address:</label> | 369 | <label class="right hidden-xs-only hidden-sm-only">Present Address:</label> |
370 | <label | 370 | <label |
371 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 371 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
372 | >Present Address:</label> | 372 | >Present Address:</label> |
373 | </v-flex> | 373 | </v-flex> |
374 | <v-flex xs8 class="ml-3"> | 374 | <v-flex xs8 class="ml-3"> |
375 | <v-text-field | 375 | <v-text-field |
376 | v-model="editedItem.presentAddress" | 376 | v-model="editedItem.presentAddress" |
377 | placeholder="Select Country Name" | 377 | placeholder="Select Country Name" |
378 | required | 378 | required |
379 | ></v-text-field> | 379 | ></v-text-field> |
380 | </v-flex> | 380 | </v-flex> |
381 | </v-layout> | 381 | </v-layout> |
382 | </v-flex> | 382 | </v-flex> |
383 | </v-layout> | 383 | </v-layout> |
384 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> | 384 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> |
385 | <v-flex xs12 sm12> | 385 | <v-flex xs12 sm12> |
386 | <v-layout> | 386 | <v-layout> |
387 | <v-flex xs4 class="pt-4 subheading"> | 387 | <v-flex xs4 class="pt-4 subheading"> |
388 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> | 388 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> |
389 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Roll No:</label> | 389 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Roll No:</label> |
390 | </v-flex> | 390 | </v-flex> |
391 | <v-flex xs8 class="ml-3"> | 391 | <v-flex xs8 class="ml-3"> |
392 | <v-text-field | 392 | <v-text-field |
393 | v-model="editedItem.rollNo" | 393 | v-model="editedItem.rollNo" |
394 | placeholder="fill roll number" | 394 | placeholder="fill roll number" |
395 | required | 395 | required |
396 | ></v-text-field> | 396 | ></v-text-field> |
397 | </v-flex> | 397 | </v-flex> |
398 | </v-layout> | 398 | </v-layout> |
399 | </v-flex> | 399 | </v-flex> |
400 | </v-layout> | 400 | </v-layout> |
401 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> | 401 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> |
402 | <v-flex xs12 sm12> | 402 | <v-flex xs12 sm12> |
403 | <v-layout> | 403 | <v-layout> |
404 | <v-flex xs12 sm3 class="pt-4 subheading text-xs-center"> | 404 | <v-flex xs12 sm3 class="pt-4 subheading text-xs-center"> |
405 | <label class>Present Address :</label> | 405 | <label class>Present Address :</label> |
406 | </v-flex> | 406 | </v-flex> |
407 | </v-layout> | 407 | </v-layout> |
408 | <v-layout> | 408 | <v-layout> |
409 | <v-flex xs12 sm12> | 409 | <v-flex xs12 sm12> |
410 | <v-textarea | 410 | <v-textarea |
411 | v-model="editedItem.presentAddress" | 411 | v-model="editedItem.presentAddress" |
412 | placeholder="fill Your present Address" | 412 | placeholder="fill Your present Address" |
413 | required | 413 | required |
414 | ></v-textarea> | 414 | ></v-textarea> |
415 | </v-flex> | 415 | </v-flex> |
416 | </v-layout> | 416 | </v-layout> |
417 | </v-flex> | 417 | </v-flex> |
418 | <v-flex xs12 sm12> | 418 | <v-flex xs12 sm12> |
419 | <v-layout> | 419 | <v-layout> |
420 | <v-flex xs12 sm3 class="pt-4 pr-4 subheading text-xs-center addressForm"> | 420 | <v-flex xs12 sm3 class="pt-4 pr-4 subheading text-xs-center addressForm"> |
421 | <label>Permanent addr:</label> | 421 | <label>Permanent addr:</label> |
422 | </v-flex> | 422 | </v-flex> |
423 | </v-layout> | 423 | </v-layout> |
424 | <v-layout> | 424 | <v-layout> |
425 | <v-flex xs12 sm12> | 425 | <v-flex xs12 sm12> |
426 | <v-textarea | 426 | <v-textarea |
427 | name="input-4-3" | 427 | name="input-4-3" |
428 | v-model="editedItem.permanentAddress" | 428 | v-model="editedItem.permanentAddress" |
429 | placeholder="fill Your Permanent Address" | 429 | placeholder="fill Your Permanent Address" |
430 | required | 430 | required |
431 | ></v-textarea> | 431 | ></v-textarea> |
432 | </v-flex> | 432 | </v-flex> |
433 | </v-layout> | 433 | </v-layout> |
434 | </v-flex> | 434 | </v-flex> |
435 | </v-layout> | 435 | </v-layout> |
436 | <v-layout> | 436 | <v-layout> |
437 | <v-flex xs12 sm12> | 437 | <v-flex xs12 sm12> |
438 | <v-layout class="right"> | 438 | <v-layout class="right"> |
439 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> | 439 | <v-btn @click="save" round dark :loading="editLoading" class="add-button">Save</v-btn> |
440 | </v-layout> | 440 | </v-layout> |
441 | </v-flex> | 441 | </v-flex> |
442 | </v-layout> | 442 | </v-layout> |
443 | </v-container> | 443 | </v-container> |
444 | </v-form> | 444 | </v-form> |
445 | </v-card-text> | 445 | </v-card-text> |
446 | </v-card> | 446 | </v-card> |
447 | </v-dialog> | 447 | </v-dialog> |
448 | 448 | ||
449 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> | 449 | <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** --> |
450 | 450 | ||
451 | <v-dialog v-model="profileStudentDialog" max-width="1000px" scrollable> | 451 | <v-dialog v-model="profileStudentDialog" max-width="1000px" scrollable> |
452 | <v-card flat class="card-style pa-3" dark> | 452 | <v-card flat class="card-style pa-3" dark> |
453 | <v-layout> | 453 | <v-layout> |
454 | <v-flex xs12> | 454 | <v-flex xs12> |
455 | <label class="title text-xs-center">View Student Details</label> | 455 | <label class="title text-xs-center">View Student Details</label> |
456 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> | 456 | <v-icon size="24" class="right" @click="profileStudentDialog = false">cancel</v-icon> |
457 | </v-flex> | 457 | </v-flex> |
458 | </v-layout> | 458 | </v-layout> |
459 | <v-card-text> | 459 | <v-card-text> |
460 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> | 460 | <v-flex align-center justify-center layout text-xs-center class="mt-3"> |
461 | <v-avatar size="100px"> | 461 | <v-avatar size="100px"> |
462 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 462 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
463 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> | 463 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> |
464 | </v-avatar> | 464 | </v-avatar> |
465 | </v-flex> | 465 | </v-flex> |
466 | <v-container grid-list-md> | 466 | <v-container grid-list-md> |
467 | <v-layout wrap> | 467 | <v-layout wrap> |
468 | <v-flex xs12 sm5> | 468 | <v-flex xs12 sm5> |
469 | <v-layout> | 469 | <v-layout> |
470 | <v-flex xs6 sm6> | 470 | <v-flex xs6 sm6> |
471 | <h5 class="right my-1"> | 471 | <h5 class="right my-1"> |
472 | <b>Full Name:</b> | 472 | <b>Full Name:</b> |
473 | </h5> | 473 | </h5> |
474 | </v-flex> | 474 | </v-flex> |
475 | <v-flex sm6 xs6> | 475 | <v-flex sm6 xs6> |
476 | <h5 class="my-1 left">{{ editedItem.name }}</h5> | 476 | <h5 class="my-1 left">{{ editedItem.name }}</h5> |
477 | </v-flex> | 477 | </v-flex> |
478 | </v-layout> | 478 | </v-layout> |
479 | </v-flex> | 479 | </v-flex> |
480 | <v-flex xs12 sm7> | 480 | <v-flex xs12 sm7> |
481 | <v-layout> | 481 | <v-layout> |
482 | <v-flex xs6 sm4> | 482 | <v-flex xs6 sm4> |
483 | <h5 class="right my-1"> | 483 | <h5 class="right my-1"> |
484 | <b>Email:</b> | 484 | <b>Email:</b> |
485 | </h5> | 485 | </h5> |
486 | </v-flex> | 486 | </v-flex> |
487 | <v-flex sm8 xs6> | 487 | <v-flex sm8 xs6> |
488 | <h5 class="my-1 left">{{ editedItem.email }}</h5> | 488 | <h5 class="my-1 left">{{ editedItem.email }}</h5> |
489 | </v-flex> | 489 | </v-flex> |
490 | </v-layout> | 490 | </v-layout> |
491 | </v-flex> | 491 | </v-flex> |
492 | </v-layout> | 492 | </v-layout> |
493 | <v-layout wrap> | 493 | <v-layout wrap> |
494 | <v-flex xs12 sm5> | 494 | <v-flex xs12 sm5> |
495 | <v-layout> | 495 | <v-layout> |
496 | <v-flex xs6 sm6> | 496 | <v-flex xs6 sm6> |
497 | <b> | 497 | <b> |
498 | <h5 class="right my-1"> | 498 | <h5 class="right my-1"> |
499 | <b>Gender:</b> | 499 | <b>Gender:</b> |
500 | </h5> | 500 | </h5> |
501 | </b> | 501 | </b> |
502 | </v-flex> | 502 | </v-flex> |
503 | <v-flex sm6 xs6> | 503 | <v-flex sm6 xs6> |
504 | <h5 class="my-1 left">{{ editedItem.gender }}</h5> | 504 | <h5 class="my-1 left">{{ editedItem.gender }}</h5> |
505 | </v-flex> | 505 | </v-flex> |
506 | </v-layout> | 506 | </v-layout> |
507 | </v-flex> | 507 | </v-flex> |
508 | <v-flex xs12 sm7> | 508 | <v-flex xs12 sm7> |
509 | <v-layout> | 509 | <v-layout> |
510 | <v-flex xs6 sm4> | 510 | <v-flex xs6 sm4> |
511 | <b> | 511 | <b> |
512 | <h5 class="right my-1"> | 512 | <h5 class="right my-1"> |
513 | <b>D.O.B:</b> | 513 | <b>D.O.B:</b> |
514 | </h5> | 514 | </h5> |
515 | </b> | 515 | </b> |
516 | </v-flex> | 516 | </v-flex> |
517 | <v-flex sm8 xs6> | 517 | <v-flex sm8 xs6> |
518 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> | 518 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> |
519 | </v-flex> | 519 | </v-flex> |
520 | </v-layout> | 520 | </v-layout> |
521 | </v-flex> | 521 | </v-flex> |
522 | </v-layout> | 522 | </v-layout> |
523 | <v-layout wrap> | 523 | <v-layout wrap> |
524 | <v-flex xs12 sm5> | 524 | <v-flex xs12 sm5> |
525 | <v-layout> | 525 | <v-layout> |
526 | <v-flex xs6 sm6> | 526 | <v-flex xs6 sm6> |
527 | <b> | 527 | <b> |
528 | <h5 class="right my-1"> | 528 | <h5 class="right my-1"> |
529 | <b>BloodGroup:</b> | 529 | <b>BloodGroup:</b> |
530 | </h5> | 530 | </h5> |
531 | </b> | 531 | </b> |
532 | </v-flex> | 532 | </v-flex> |
533 | <v-flex sm6 xs6> | 533 | <v-flex sm6 xs6> |
534 | <h5 class="my-1 left">{{ editedItem.bloodGroup }}</h5> | 534 | <h5 class="my-1 left">{{ editedItem.bloodGroup }}</h5> |
535 | </v-flex> | 535 | </v-flex> |
536 | </v-layout> | 536 | </v-layout> |
537 | </v-flex> | 537 | </v-flex> |
538 | <v-flex xs12 sm7> | 538 | <v-flex xs12 sm7> |
539 | <v-layout> | 539 | <v-layout> |
540 | <v-flex xs6 sm4> | 540 | <v-flex xs6 sm4> |
541 | <b> | 541 | <b> |
542 | <h5 class="right my-1"> | 542 | <h5 class="right my-1"> |
543 | <b>Roll No. :</b> | 543 | <b>Roll No. :</b> |
544 | </h5> | 544 | </h5> |
545 | </b> | 545 | </b> |
546 | </v-flex> | 546 | </v-flex> |
547 | <v-flex sm8 xs6> | 547 | <v-flex sm8 xs6> |
548 | <h5 class="my-1">{{ editedItem.rollNo }}</h5> | 548 | <h5 class="my-1">{{ editedItem.rollNo }}</h5> |
549 | </v-flex> | 549 | </v-flex> |
550 | </v-layout> | 550 | </v-layout> |
551 | </v-flex> | 551 | </v-flex> |
552 | </v-layout> | 552 | </v-layout> |
553 | <v-layout wrap> | 553 | <v-layout wrap> |
554 | <v-flex xs12 sm5> | 554 | <v-flex xs12 sm5> |
555 | <v-layout> | 555 | <v-layout> |
556 | <v-flex xs6 sm6> | 556 | <v-flex xs6 sm6> |
557 | <b> | 557 | <b> |
558 | <h5 class="right my-1"> | 558 | <h5 class="right my-1"> |
559 | <b>Height:</b> | 559 | <b>Height:</b> |
560 | </h5> | 560 | </h5> |
561 | </b> | 561 | </b> |
562 | </v-flex> | 562 | </v-flex> |
563 | <v-flex sm6 xs6> | 563 | <v-flex sm6 xs6> |
564 | <h5 class="my-1 left">{{ editedItem.height }}</h5> | 564 | <h5 class="my-1 left">{{ editedItem.height }}</h5> |
565 | </v-flex> | 565 | </v-flex> |
566 | </v-layout> | 566 | </v-layout> |
567 | </v-flex> | 567 | </v-flex> |
568 | <v-flex xs12 sm7> | 568 | <v-flex xs12 sm7> |
569 | <v-layout> | 569 | <v-layout> |
570 | <v-flex xs6 sm4> | 570 | <v-flex xs6 sm4> |
571 | <b> | 571 | <b> |
572 | <h5 class="right my-1"> | 572 | <h5 class="right my-1"> |
573 | <b>Weight:</b> | 573 | <b>Weight:</b> |
574 | </h5> | 574 | </h5> |
575 | </b> | 575 | </b> |
576 | </v-flex> | 576 | </v-flex> |
577 | <v-flex sm8 xs6> | 577 | <v-flex sm8 xs6> |
578 | <h5 class="my-1">{{ editedItem.weight }}</h5> | 578 | <h5 class="my-1">{{ editedItem.weight }}</h5> |
579 | </v-flex> | 579 | </v-flex> |
580 | </v-layout> | 580 | </v-layout> |
581 | </v-flex> | 581 | </v-flex> |
582 | </v-layout> | 582 | </v-layout> |
583 | <v-layout wrap> | 583 | <v-layout wrap> |
584 | <v-flex xs12 sm5> | 584 | <v-flex xs12 sm5> |
585 | <v-layout> | 585 | <v-layout> |
586 | <v-flex xs6 sm6> | 586 | <v-flex xs6 sm6> |
587 | <b> | 587 | <b> |
588 | <h5 class="right my-1"> | 588 | <h5 class="right my-1"> |
589 | <b>City:</b> | 589 | <b>City:</b> |
590 | </h5> | 590 | </h5> |
591 | </b> | 591 | </b> |
592 | </v-flex> | 592 | </v-flex> |
593 | <v-flex sm6 xs6> | 593 | <v-flex sm6 xs6> |
594 | <h5 class="my-1 left">{{ editedItem.city }}</h5> | 594 | <h5 class="my-1 left">{{ editedItem.city }}</h5> |
595 | </v-flex> | 595 | </v-flex> |
596 | </v-layout> | 596 | </v-layout> |
597 | </v-flex> | 597 | </v-flex> |
598 | <v-flex xs12 sm7> | 598 | <v-flex xs12 sm7> |
599 | <v-layout> | 599 | <v-layout> |
600 | <v-flex xs6 sm4> | 600 | <v-flex xs6 sm4> |
601 | <b> | 601 | <b> |
602 | <h5 class="right my-1"> | 602 | <h5 class="right my-1"> |
603 | <b>State:</b> | 603 | <b>State:</b> |
604 | </h5> | 604 | </h5> |
605 | </b> | 605 | </b> |
606 | </v-flex> | 606 | </v-flex> |
607 | <v-flex sm8 xs6> | 607 | <v-flex sm8 xs6> |
608 | <h5 class="my-1">{{ editedItem.state }}</h5> | 608 | <h5 class="my-1">{{ editedItem.state }}</h5> |
609 | </v-flex> | 609 | </v-flex> |
610 | </v-layout> | 610 | </v-layout> |
611 | </v-flex> | 611 | </v-flex> |
612 | </v-layout> | 612 | </v-layout> |
613 | <v-layout wrap> | 613 | <v-layout wrap> |
614 | <v-flex xs12 sm5> | 614 | <v-flex xs12 sm5> |
615 | <v-layout> | 615 | <v-layout> |
616 | <v-flex xs6 sm6> | 616 | <v-flex xs6 sm6> |
617 | <b> | 617 | <b> |
618 | <h5 class="right my-1"> | 618 | <h5 class="right my-1"> |
619 | <b>Pincode:</b> | 619 | <b>Pincode:</b> |
620 | </h5> | 620 | </h5> |
621 | </b> | 621 | </b> |
622 | </v-flex> | 622 | </v-flex> |
623 | <v-flex sm6 xs6> | 623 | <v-flex sm6 xs6> |
624 | <h5 class="my-1">{{ editedItem.pincode }}</h5> | 624 | <h5 class="my-1">{{ editedItem.pincode }}</h5> |
625 | </v-flex> | 625 | </v-flex> |
626 | </v-layout> | 626 | </v-layout> |
627 | </v-flex> | 627 | </v-flex> |
628 | <v-flex xs12 sm7> | 628 | <v-flex xs12 sm7> |
629 | <v-layout> | 629 | <v-layout> |
630 | <v-flex xs6 sm4> | 630 | <v-flex xs6 sm4> |
631 | <b> | 631 | <b> |
632 | <h5 class="right my-1"> | 632 | <h5 class="right my-1"> |
633 | <b>Country:</b> | 633 | <b>Country:</b> |
634 | </h5> | 634 | </h5> |
635 | </b> | 635 | </b> |
636 | </v-flex> | 636 | </v-flex> |
637 | <v-flex sm7 xs6> | 637 | <v-flex sm7 xs6> |
638 | <h5 class="my-1">{{ editedItem.country }}</h5> | 638 | <h5 class="my-1">{{ editedItem.country }}</h5> |
639 | </v-flex> | 639 | </v-flex> |
640 | </v-layout> | 640 | </v-layout> |
641 | </v-flex> | 641 | </v-flex> |
642 | </v-layout> | 642 | </v-layout> |
643 | <v-layout wrap> | 643 | <v-layout wrap> |
644 | <v-flex xs12 sm5> | 644 | <v-flex xs12 sm5> |
645 | <v-layout> | 645 | <v-layout> |
646 | <v-flex sm6 xs6> | 646 | <v-flex sm6 xs6> |
647 | <b> | 647 | <b> |
648 | <h5 class="right my-1"> | 648 | <h5 class="right my-1"> |
649 | <b>Mobile No:</b> | 649 | <b>Mobile No:</b> |
650 | </h5> | 650 | </h5> |
651 | </b> | 651 | </b> |
652 | </v-flex> | 652 | </v-flex> |
653 | <v-flex sm6 xs6> | 653 | <v-flex sm6 xs6> |
654 | <h5 class="my-1">{{ editedItem.mobile }}</h5> | 654 | <h5 class="my-1">{{ editedItem.mobile }}</h5> |
655 | </v-flex> | 655 | </v-flex> |
656 | </v-layout> | 656 | </v-layout> |
657 | </v-flex> | 657 | </v-flex> |
658 | <v-flex xs12 sm7> | 658 | <v-flex xs12 sm7> |
659 | <v-layout> | 659 | <v-layout> |
660 | <v-flex xs6 sm4> | 660 | <v-flex xs6 sm4> |
661 | <b> | 661 | <b> |
662 | <h5 class="right my-1"> | 662 | <h5 class="right my-1"> |
663 | <b>FahterName:</b> | 663 | <b>FahterName:</b> |
664 | </h5> | 664 | </h5> |
665 | </b> | 665 | </b> |
666 | </v-flex> | 666 | </v-flex> |
667 | <v-flex sm8 xs6> | 667 | <v-flex sm8 xs6> |
668 | <h5 class="my-1">{{ editedItem.fatherName }}</h5> | 668 | <h5 class="my-1">{{ editedItem.fatherName }}</h5> |
669 | </v-flex> | 669 | </v-flex> |
670 | </v-layout> | 670 | </v-layout> |
671 | </v-flex> | 671 | </v-flex> |
672 | </v-layout> | 672 | </v-layout> |
673 | <v-layout wrap> | 673 | <v-layout wrap> |
674 | <v-flex xs12 sm5> | 674 | <v-flex xs12 sm5> |
675 | <v-layout> | 675 | <v-layout> |
676 | <v-flex xs6 sm6> | 676 | <v-flex xs6 sm6> |
677 | <b> | 677 | <b> |
678 | <h5 class="right my-1"> | 678 | <h5 class="right my-1"> |
679 | <b>MotherName:</b> | 679 | <b>MotherName:</b> |
680 | </h5> | 680 | </h5> |
681 | </b> | 681 | </b> |
682 | </v-flex> | 682 | </v-flex> |
683 | <v-flex sm6 xs6> | 683 | <v-flex sm6 xs6> |
684 | <h5 class="my-1">{{ editedItem.motherName }}</h5> | 684 | <h5 class="my-1">{{ editedItem.motherName }}</h5> |
685 | </v-flex> | 685 | </v-flex> |
686 | </v-layout> | 686 | </v-layout> |
687 | </v-flex> | 687 | </v-flex> |
688 | <v-flex xs12 sm7> | 688 | <v-flex xs12 sm7> |
689 | <v-layout> | 689 | <v-layout> |
690 | <v-flex xs6 sm4> | 690 | <v-flex xs6 sm4> |
691 | <b> | 691 | <b> |
692 | <h5 class="right my-1"> | 692 | <h5 class="right my-1"> |
693 | <b>FatherCellNo:</b> | 693 | <b>FatherCellNo:</b> |
694 | </h5> | 694 | </h5> |
695 | </b> | 695 | </b> |
696 | </v-flex> | 696 | </v-flex> |
697 | <v-flex sm6 xs6> | 697 | <v-flex sm6 xs6> |
698 | <h5 class="my-1">{{ editedItem.fatherCellNo }}</h5> | 698 | <h5 class="my-1">{{ editedItem.fatherCellNo }}</h5> |
699 | </v-flex> | 699 | </v-flex> |
700 | </v-layout> | 700 | </v-layout> |
701 | </v-flex> | 701 | </v-flex> |
702 | </v-layout> | 702 | </v-layout> |
703 | <v-layout wrap> | 703 | <v-layout wrap> |
704 | <v-flex xs12 sm5> | 704 | <v-flex xs12 sm5> |
705 | <v-layout> | 705 | <v-layout> |
706 | <v-flex xs6 sm6> | 706 | <v-flex xs6 sm6> |
707 | <b> | 707 | <b> |
708 | <h5 class="right my-1"> | 708 | <h5 class="right my-1"> |
709 | <b>MotherCellNo:</b> | 709 | <b>MotherCellNo:</b> |
710 | </h5> | 710 | </h5> |
711 | </b> | 711 | </b> |
712 | </v-flex> | 712 | </v-flex> |
713 | <v-flex sm6 xs6> | 713 | <v-flex sm6 xs6> |
714 | <h5 class="my-1">{{ editedItem.motherCellNo }}</h5> | 714 | <h5 class="my-1">{{ editedItem.motherCellNo }}</h5> |
715 | </v-flex> | 715 | </v-flex> |
716 | </v-layout> | 716 | </v-layout> |
717 | </v-flex> | 717 | </v-flex> |
718 | <v-flex xs12 sm7> | 718 | <v-flex xs12 sm7> |
719 | <v-layout> | 719 | <v-layout> |
720 | <v-flex xs6 sm4> | 720 | <v-flex xs6 sm4> |
721 | <b> | 721 | <b> |
722 | <h5 class="my-1 right"> | 722 | <h5 class="my-1 right"> |
723 | <b>AcademicYear:</b> | 723 | <b>AcademicYear:</b> |
724 | </h5> | 724 | </h5> |
725 | </b> | 725 | </b> |
726 | </v-flex> | 726 | </v-flex> |
727 | <v-flex sm5 xs8> | 727 | <v-flex sm5 xs8> |
728 | <h5 class="my-1">{{ editedItem.establishmentYear }}</h5> | 728 | <h5 class="my-1">{{ editedItem.establishmentYear }}</h5> |
729 | </v-flex> | 729 | </v-flex> |
730 | </v-layout> | 730 | </v-layout> |
731 | </v-flex> | 731 | </v-flex> |
732 | </v-layout> | 732 | </v-layout> |
733 | <v-layout wrap> | 733 | <v-layout wrap> |
734 | <v-flex xs12 sm5> | 734 | <v-flex xs12 sm5> |
735 | <v-layout> | 735 | <v-layout> |
736 | <v-flex xs6 sm6> | 736 | <v-flex xs6 sm6> |
737 | <b> | 737 | <b> |
738 | <h5 class="my-1 right"> | 738 | <h5 class="my-1 right"> |
739 | <b>MedicalNotes:</b> | 739 | <b>MedicalNotes:</b> |
740 | </h5> | 740 | </h5> |
741 | </b> | 741 | </b> |
742 | </v-flex> | 742 | </v-flex> |
743 | <v-flex sm5 xs6> | 743 | <v-flex sm5 xs6> |
744 | <h5 class="my-1">{{ editedItem.medicalNotes }}</h5> | 744 | <h5 class="my-1">{{ editedItem.medicalNotes }}</h5> |
745 | </v-flex> | 745 | </v-flex> |
746 | </v-layout> | 746 | </v-layout> |
747 | </v-flex> | 747 | </v-flex> |
748 | <v-flex xs12 sm7 class="hidden-xs-only"> | 748 | <v-flex xs12 sm7 class="hidden-xs-only"> |
749 | <v-layout wrap> | 749 | <v-layout wrap> |
750 | <v-flex sm4> | 750 | <v-flex sm4> |
751 | <b> | 751 | <b> |
752 | <h5 class="my-1 right"> | 752 | <h5 class="my-1 right"> |
753 | <b>present Address:</b> | 753 | <b>present Address:</b> |
754 | </h5> | 754 | </h5> |
755 | </b> | 755 | </b> |
756 | </v-flex> | 756 | </v-flex> |
757 | <v-flex sm8> | 757 | <v-flex sm8> |
758 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> | 758 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> |
759 | </v-flex> | 759 | </v-flex> |
760 | </v-layout> | 760 | </v-layout> |
761 | </v-flex> | 761 | </v-flex> |
762 | <v-flex sm6 class="hidden-xs-only"> | 762 | <v-flex sm6 class="hidden-xs-only"> |
763 | <v-layout wrap> | 763 | <v-layout wrap> |
764 | <v-flex sm5> | 764 | <v-flex sm5> |
765 | <b> | 765 | <b> |
766 | <h5 class="my-1 right"> | 766 | <h5 class="my-1 right"> |
767 | <b>Permanent Address:</b> | 767 | <b>Permanent Address:</b> |
768 | </h5> | 768 | </h5> |
769 | </b> | 769 | </b> |
770 | </v-flex> | 770 | </v-flex> |
771 | <v-flex sm7> | 771 | <v-flex sm7> |
772 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> | 772 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> |
773 | </v-flex> | 773 | </v-flex> |
774 | </v-layout> | 774 | </v-layout> |
775 | </v-flex> | 775 | </v-flex> |
776 | </v-layout> | 776 | </v-layout> |
777 | <v-layout wrap class="hidden-sm-only hidden-md-only hidden-lg-only hidden-xl-only"> | 777 | <v-layout wrap class="hidden-sm-only hidden-md-only hidden-lg-only hidden-xl-only"> |
778 | <v-flex xs12 sm5> | 778 | <v-flex xs12 sm5> |
779 | <v-layout wrap> | 779 | <v-layout wrap> |
780 | <v-flex xs12 sm6> | 780 | <v-flex xs12 sm6> |
781 | <b> | 781 | <b> |
782 | <h5 class="my-1"> | 782 | <h5 class="my-1"> |
783 | <b>present Address:-</b> | 783 | <b>present Address:-</b> |
784 | </h5> | 784 | </h5> |
785 | </b> | 785 | </b> |
786 | </v-flex> | 786 | </v-flex> |
787 | <v-flex sm5 xs12> | 787 | <v-flex sm5 xs12> |
788 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> | 788 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> |
789 | </v-flex> | 789 | </v-flex> |
790 | </v-layout> | 790 | </v-layout> |
791 | </v-flex> | 791 | </v-flex> |
792 | <v-flex xs12 sm6> | 792 | <v-flex xs12 sm6> |
793 | <v-layout wrap> | 793 | <v-layout wrap> |
794 | <v-flex xs12 sm6> | 794 | <v-flex xs12 sm6> |
795 | <b> | 795 | <b> |
796 | <h5 class="my-1"> | 796 | <h5 class="my-1"> |
797 | <b>Permanent Address:-</b> | 797 | <b>Permanent Address:-</b> |
798 | </h5> | 798 | </h5> |
799 | </b> | 799 | </b> |
800 | </v-flex> | 800 | </v-flex> |
801 | <v-flex sm6 xs12> | 801 | <v-flex sm6 xs12> |
802 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> | 802 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> |
803 | </v-flex> | 803 | </v-flex> |
804 | </v-layout> | 804 | </v-layout> |
805 | </v-flex> | 805 | </v-flex> |
806 | </v-layout> | 806 | </v-layout> |
807 | </v-container> | 807 | </v-container> |
808 | </v-card-text> | 808 | </v-card-text> |
809 | </v-card> | 809 | </v-card> |
810 | </v-dialog> | 810 | </v-dialog> |
811 | 811 | ||
812 | <!-- ****** STUDENTS TABLE ****** --> | 812 | <!-- ****** STUDENTS TABLE ****** --> |
813 | <v-toolbar color="transparent" flat> | 813 | <v-toolbar color="transparent" flat> |
814 | <v-btn | 814 | <v-btn |
815 | fab | 815 | fab |
816 | dark | 816 | dark |
817 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 817 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
818 | small | 818 | small |
819 | @click="addStudentDialog = true" | 819 | @click="addStudentDialog = true" |
820 | > | 820 | > |
821 | <v-icon dark>add</v-icon> | 821 | <v-icon dark>add</v-icon> |
822 | </v-btn> | 822 | </v-btn> |
823 | <v-btn | 823 | <v-btn |
824 | v-if="role != 'TEACHER' " | 824 | v-if="role != 'TEACHER' " |
825 | round | 825 | round |
826 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 826 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
827 | dark | 827 | dark |
828 | @click="addStudentDialog = true" | 828 | @click="addStudentDialog = true" |
829 | > | 829 | > |
830 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Student | 830 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Student |
831 | </v-btn> | 831 | </v-btn> |
832 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 832 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
833 | <v-flex md13 lg12> | 833 | <v-flex md13 lg12> |
834 | <v-layout> | 834 | <v-layout> |
835 | <v-flex lg3 md4> | 835 | <v-flex lg3 md4> |
836 | <v-select | 836 | <v-select |
837 | :items="addclass" | 837 | :items="addclass" |
838 | label="Select Class" | 838 | label="Select Class" |
839 | v-model="selectStudents.select" | 839 | v-model="selectStudents.select" |
840 | item-text="classNum" | 840 | item-text="classNum" |
841 | item-value="_id" | 841 | item-value="_id" |
842 | name="Select Class" | 842 | name="Select Class" |
843 | :rules="classRules" | 843 | :rules="classRules" |
844 | @change="getSections(selectStudents.select)" | 844 | @change="getSections(selectStudents.select)" |
845 | required | 845 | required |
846 | class="ml-2" | 846 | class="ml-2" |
847 | ></v-select> | 847 | ></v-select> |
848 | </v-flex> | 848 | </v-flex> |
849 | <v-flex lg3 md4 class="ml-2"> | 849 | <v-flex lg3 md4 class="ml-2"> |
850 | <v-layout> | 850 | <v-layout> |
851 | <v-select | 851 | <v-select |
852 | :items="addSection" | 852 | :items="addSection" |
853 | label="Select Section" | 853 | label="Select Section" |
854 | v-model="selectStudents.selectSection" | 854 | v-model="selectStudents.selectSection" |
855 | item-text="name" | 855 | item-text="name" |
856 | item-value="_id" | 856 | item-value="_id" |
857 | name="Select Section" | 857 | name="Select Section" |
858 | :rules="sectionRules" | 858 | :rules="sectionRules" |
859 | required | 859 | required |
860 | ></v-select> | 860 | ></v-select> |
861 | </v-layout> | 861 | </v-layout> |
862 | </v-flex> | 862 | </v-flex> |
863 | </v-layout> | 863 | </v-layout> |
864 | </v-flex> | 864 | </v-flex> |
865 | </v-card-actions> | 865 | </v-card-actions> |
866 | <v-spacer></v-spacer> | 866 | <v-spacer></v-spacer> |
867 | <v-btn | 867 | <v-btn |
868 | @click="findStudents()" | 868 | @click="findStudents()" |
869 | round | 869 | round |
870 | dark | 870 | dark |
871 | :loading="loading" | 871 | :loading="loading" |
872 | class="open-dialog-button hidden-xs-only hidden-sm-only" | 872 | class="open-dialog-button hidden-xs-only hidden-sm-only" |
873 | >Find</v-btn> | 873 | >Find</v-btn> |
874 | <v-card-title class="body-1" v-show="show"> | 874 | <v-card-title class="body-1" v-show="show"> |
875 | <v-btn icon large flat @click="displaySearch"> | 875 | <v-btn icon large flat @click="displaySearch"> |
876 | <v-avatar size="27"> | 876 | <v-avatar size="27"> |
877 | <img src="/static/icon/search.png" alt="icon" /> | 877 | <img src="/static/icon/search.png" alt="icon" /> |
878 | </v-avatar> | 878 | </v-avatar> |
879 | </v-btn> | 879 | </v-btn> |
880 | </v-card-title> | 880 | </v-card-title> |
881 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> | 881 | <v-flex xs8 sm7 lg2 md3 v-if="showSearch"> |
882 | <v-layout> | 882 | <v-layout> |
883 | <v-text-field | 883 | <v-text-field |
884 | autofocus | 884 | autofocus |
885 | v-model="search" | 885 | v-model="search" |
886 | label="Search" | 886 | label="Search" |
887 | prepend-inner-icon="search" | 887 | prepend-inner-icon="search" |
888 | color="primary" | 888 | color="primary" |
889 | ></v-text-field> | 889 | ></v-text-field> |
890 | <v-icon @click="closeSearch" color="error">close</v-icon> | 890 | <v-icon @click="closeSearch" color="error">close</v-icon> |
891 | </v-layout> | 891 | </v-layout> |
892 | </v-flex> | 892 | </v-flex> |
893 | </v-toolbar> | 893 | </v-toolbar> |
894 | <v-card flat class="elevation-0 transparent"> | 894 | <v-card flat class="elevation-0 transparent"> |
895 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> | 895 | <v-flex class="hidden-xl-only hidden-lg-only hidden-md-only"> |
896 | <v-layout> | 896 | <v-layout> |
897 | <v-flex xs4> | 897 | <v-flex xs4> |
898 | <label class="right mt-4">Select Class:</label> | 898 | <label class="right mt-4">Select Class:</label> |
899 | </v-flex> | 899 | </v-flex> |
900 | <v-flex xs8> | 900 | <v-flex xs8> |
901 | <v-select | 901 | <v-select |
902 | :items="addclass" | 902 | :items="addclass" |
903 | label="Select Class" | 903 | label="Select Class" |
904 | v-model="selectStudents.select" | 904 | v-model="selectStudents.select" |
905 | item-text="classNum" | 905 | item-text="classNum" |
906 | item-value="_id" | 906 | item-value="_id" |
907 | name="Select Class" | 907 | name="Select Class" |
908 | :rules="classRules" | 908 | :rules="classRules" |
909 | @change="getSections(selectStudents.select)" | 909 | @change="getSections(selectStudents.select)" |
910 | class="px-2" | 910 | class="px-2" |
911 | ></v-select> | 911 | ></v-select> |
912 | </v-flex> | 912 | </v-flex> |
913 | </v-layout> | 913 | </v-layout> |
914 | <v-layout> | 914 | <v-layout> |
915 | <v-flex xs4> | 915 | <v-flex xs4> |
916 | <label class="right mt-4">Select Section:</label> | 916 | <label class="right mt-4">Select Section:</label> |
917 | </v-flex> | 917 | </v-flex> |
918 | <v-flex xs8> | 918 | <v-flex xs8> |
919 | <v-select | 919 | <v-select |
920 | :items="addSection" | 920 | :items="addSection" |
921 | label="Select Section" | 921 | label="Select Section" |
922 | v-model="selectStudents.selectSection" | 922 | v-model="selectStudents.selectSection" |
923 | item-text="name" | 923 | item-text="name" |
924 | item-value="_id" | 924 | item-value="_id" |
925 | name="Select Section" | 925 | name="Select Section" |
926 | :rules="sectionRules" | 926 | :rules="sectionRules" |
927 | class="px-2" | 927 | class="px-2" |
928 | required | 928 | required |
929 | ></v-select> | 929 | ></v-select> |
930 | </v-flex> | 930 | </v-flex> |
931 | </v-layout> | 931 | </v-layout> |
932 | <v-layout> | 932 | <v-layout> |
933 | <v-flex xs5 class="mx-auto mb-2"> | 933 | <v-flex xs5 class="mx-auto mb-2"> |
934 | <v-btn | 934 | <v-btn |
935 | @click="findStudents()" | 935 | @click="findStudents()" |
936 | block | 936 | block |
937 | round | 937 | round |
938 | dark | 938 | dark |
939 | :loading="loading" | 939 | :loading="loading" |
940 | class="add-button" | 940 | class="add-button" |
941 | >Find</v-btn> | 941 | >Find</v-btn> |
942 | </v-flex> | 942 | </v-flex> |
943 | </v-layout> | 943 | </v-layout> |
944 | </v-flex> | 944 | </v-flex> |
945 | </v-card> | 945 | </v-card> |
946 | <v-data-table | 946 | <v-data-table |
947 | :headers="headers" | 947 | :headers="headers" |
948 | :items="studentsData" | 948 | :items="studentsData" |
949 | :pagination.sync="pagination" | 949 | :pagination.sync="pagination" |
950 | :search="search" | 950 | :search="search" |
951 | > | 951 | > |
952 | <template slot="items" slot-scope="props"> | 952 | <template slot="items" slot-scope="props"> |
953 | <tr class="tr"> | 953 | <tr class="tr"> |
954 | <td class="text-xs-center td td-row">{{ props.item.rollNo}}</td> | 954 | <td class="text-xs-center td td-row">{{ props.item.rollNo}}</td> |
955 | <td class="text-xs-center td td-row"> | 955 | <td class="text-xs-center td td-row"> |
956 | <v-avatar size="40"> | 956 | <v-avatar size="40"> |
957 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 957 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
958 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 958 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
959 | </v-avatar> | 959 | </v-avatar> |
960 | </td> | 960 | </td> |
961 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 961 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
962 | <td class="text-xs-center td td-row">{{ props.item.gender }}</td> | 962 | <td class="text-xs-center td td-row">{{ props.item.gender }}</td> |
963 | <td class="text-xs-center td td-row">{{ props.item.parentId.fatherName }}</td> | 963 | <td class="text-xs-center td td-row">{{ props.item.parentId.fatherName }}</td> |
964 | <td class="text-xs-center td td-row">{{ props.item.parentId.motherName }}</td> | 964 | <td class="text-xs-center td td-row">{{ props.item.parentId.motherName }}</td> |
965 | <td class="text-xs-center td td-row">{{ props.item.establishmentYear }}</td> | 965 | <td class="text-xs-center td td-row">{{ props.item.establishmentYear }}</td> |
966 | <!-- <td class="text-xs-center td td-row">{{ props.item.mobile}}</td> --> | 966 | <!-- <td class="text-xs-center td td-row">{{ props.item.mobile}}</td> --> |
967 | <td class="text-xs-center td td-row"> | 967 | <td class="text-xs-center td td-row"> |
968 | <v-switch | 968 | <v-switch |
969 | class="pl-3" | 969 | class="pl-3" |
970 | :disabled="role === 'TEACHER'" | 970 | :disabled="role === 'TEACHER'" |
971 | v-model="props.item.status" | 971 | v-model="props.item.status" |
972 | @change="suspendStudentStatus(props.item.status,props.item._id)" | 972 | @change="suspendStudentStatus(props.item.status,props.item._id)" |
973 | ></v-switch> | 973 | ></v-switch> |
974 | </td> | 974 | </td> |
975 | <td class="text-xs-center td td-row"> | 975 | <td class="text-xs-center td td-row"> |
976 | <span> | 976 | <span> |
977 | <v-tooltip top> | 977 | <v-tooltip top> |
978 | <img | 978 | <img |
979 | slot="activator" | 979 | slot="activator" |
980 | style="cursor:pointer; width:25px; height:25px; " | 980 | style="cursor:pointer; width:25px; height:25px; " |
981 | class="mr-3" | 981 | class="mr-3" |
982 | @click="profile(props.item)" | 982 | @click="profile(props.item)" |
983 | src="/static/icon/view.png" | 983 | src="/static/icon/view.png" |
984 | /> | 984 | /> |
985 | <span>View</span> | 985 | <span>View</span> |
986 | </v-tooltip> | 986 | </v-tooltip> |
987 | <v-tooltip top v-if="role != 'TEACHER' "> | 987 | <v-tooltip top v-if="role != 'TEACHER' "> |
988 | <img | 988 | <img |
989 | slot="activator" | 989 | slot="activator" |
990 | style="cursor:pointer; width:20px; height:18px; " | 990 | style="cursor:pointer; width:20px; height:18px; " |
991 | class="mr-3" | 991 | class="mr-3" |
992 | @click="editItem(props.item)" | 992 | @click="editItem(props.item)" |
993 | src="/static/icon/edit.png" | 993 | src="/static/icon/edit.png" |
994 | /> | 994 | /> |
995 | <span>Edit</span> | 995 | <span>Edit</span> |
996 | </v-tooltip> | 996 | </v-tooltip> |
997 | <v-tooltip top v-if="role != 'TEACHER' "> | 997 | <v-tooltip top v-if="role != 'TEACHER' "> |
998 | <img | 998 | <img |
999 | slot="activator" | 999 | slot="activator" |
1000 | style="cursor:pointer; width:20px; height:20px; " | 1000 | style="cursor:pointer; width:20px; height:20px; " |
1001 | class="mr-3" | 1001 | class="mr-3" |
1002 | @click="deleteItem(props.item)" | 1002 | @click="deleteItem(props.item)" |
1003 | src="/static/icon/delete.png" | 1003 | src="/static/icon/delete.png" |
1004 | /> | 1004 | /> |
1005 | <span>Delete</span> | 1005 | <span>Delete</span> |
1006 | </v-tooltip> | 1006 | </v-tooltip> |
1007 | </span> | 1007 | </span> |
1008 | </td> | 1008 | </td> |
1009 | </tr> | 1009 | </tr> |
1010 | </template> | 1010 | </template> |
1011 | <v-alert | 1011 | <v-alert |
1012 | slot="no-results" | 1012 | slot="no-results" |
1013 | :value="true" | 1013 | :value="true" |
1014 | color="error" | 1014 | color="error" |
1015 | icon="warning" | 1015 | icon="warning" |
1016 | >Your search for "{{ search }}" found no results.</v-alert> | 1016 | >Your search for "{{ search }}" found no results.</v-alert> |
1017 | </v-data-table> | 1017 | </v-data-table> |
1018 | <!-- DIALOG -- ADD STUDENTS DETAILS --> | 1018 | <!-- DIALOG -- ADD STUDENTS DETAILS --> |
1019 | <v-dialog v-model="addStudentDialog" max-width="1280"> | 1019 | <v-dialog v-model="addStudentDialog" max-width="1280" v-if="addStudentDialog"> |
1020 | <v-card flat class="card-style pa-2" dark> | 1020 | <v-card flat class="card-style pa-2" dark> |
1021 | <v-layout> | 1021 | <v-layout> |
1022 | <v-flex xs12> | 1022 | <v-flex xs12> |
1023 | <label class="title text-xs-center">Add Student</label> | 1023 | <label class="title text-xs-center">Add Student</label> |
1024 | <v-icon | 1024 | <v-icon |
1025 | size="24" | 1025 | size="24" |
1026 | class="right" | 1026 | class="right" |
1027 | @click="$refs.parentForm.reset();$refs.parentFormLgScr.reset();$refs.form.reset();e2 = 1;addStudentDialog = false" | 1027 | @click="$refs.parentForm.reset();$refs.parentFormLgScr.reset();$refs.form.reset();e2 = 1;addStudentDialog = false" |
1028 | >cancel</v-icon> | 1028 | >cancel</v-icon> |
1029 | </v-flex> | 1029 | </v-flex> |
1030 | </v-layout> | 1030 | </v-layout> |
1031 | <v-container fluid> | 1031 | <v-container fluid> |
1032 | <v-layout align-center> | 1032 | <v-layout align-center> |
1033 | <v-flex xs12> | 1033 | <v-flex xs12> |
1034 | <v-stepper v-model="e2" flat class="card-style elevation-0" dark> | 1034 | <v-stepper v-model="e2" flat class="card-style elevation-0" dark> |
1035 | <v-stepper-header> | 1035 | <v-stepper-header> |
1036 | <v-stepper-step :complete="e2 > 1" step="1">Fill parent Details</v-stepper-step> | 1036 | <v-stepper-step :complete="e2 > 1" step="1">Fill parent Details</v-stepper-step> |
1037 | <v-divider></v-divider> | 1037 | <v-divider></v-divider> |
1038 | <v-stepper-step step="2">Fill Student Details</v-stepper-step> | 1038 | <v-stepper-step step="2">Fill Student Details</v-stepper-step> |
1039 | </v-stepper-header> | 1039 | </v-stepper-header> |
1040 | <v-stepper-items> | 1040 | <v-stepper-items> |
1041 | <v-stepper-content step="1"> | 1041 | <v-stepper-content step="1"> |
1042 | <v-container fluid class> | 1042 | <v-container fluid class> |
1043 | <v-flex xs12 sm12 class="hidden-md-only hidden-lg-only hidden-xl-only"> | 1043 | <v-flex xs12 sm12 class="hidden-md-only hidden-lg-only hidden-xl-only"> |
1044 | <v-form ref="parentForm" v-model="valid" lazy-validation> | 1044 | <v-form ref="parentForm" v-model="valid" lazy-validation> |
1045 | <v-layout wrap> | 1045 | <v-layout wrap> |
1046 | <v-flex xs12 sm6> | 1046 | <v-flex xs12 sm6> |
1047 | <v-layout wrap> | 1047 | <v-layout wrap> |
1048 | <v-flex xs12 class="pt-4 subheading"> | 1048 | <v-flex xs12 class="pt-4 subheading"> |
1049 | <label>Father Cell No:</label> | 1049 | <label>Father Cell No:</label> |
1050 | </v-flex> | 1050 | </v-flex> |
1051 | <v-flex xs12> | 1051 | <v-flex xs12> |
1052 | <v-text-field | 1052 | <v-text-field |
1053 | v-model.trim="parentData.fatherCellNo" | 1053 | v-model.trim="parentData.fatherCellNo" |
1054 | placeholder="fill your father Cell Number" | 1054 | placeholder="fill your father Cell Number" |
1055 | type="number" | 1055 | type="number" |
1056 | :rules="fatheCellNoRules" | 1056 | :rules="fatheCellNoRules" |
1057 | counter="10" | 1057 | counter="10" |
1058 | v-on:keyup="getParentDetails()" | 1058 | v-on:keyup="getParentDetails()" |
1059 | required | 1059 | required |
1060 | ></v-text-field> | 1060 | ></v-text-field> |
1061 | </v-flex> | 1061 | </v-flex> |
1062 | </v-layout> | 1062 | </v-layout> |
1063 | </v-flex> | 1063 | </v-flex> |
1064 | <v-flex xs12 sm6> | 1064 | <v-flex xs12 sm6> |
1065 | <v-layout wrap> | 1065 | <v-layout wrap> |
1066 | <v-flex xs12 class="pt-4 subheading"> | 1066 | <v-flex xs12 class="pt-4 subheading"> |
1067 | <label>Parent Email Id:</label> | 1067 | <label>Parent Email Id:</label> |
1068 | </v-flex> | 1068 | </v-flex> |
1069 | <v-flex xs12> | 1069 | <v-flex xs12> |
1070 | <v-text-field | 1070 | <v-text-field |
1071 | placeholder="fill Parent email" | 1071 | placeholder="fill Parent email" |
1072 | v-model="parentData.email" | 1072 | v-model="parentData.email" |
1073 | type="text" | 1073 | type="text" |
1074 | required | 1074 | required |
1075 | ></v-text-field> | 1075 | ></v-text-field> |
1076 | </v-flex> | 1076 | </v-flex> |
1077 | </v-layout> | 1077 | </v-layout> |
1078 | </v-flex> | 1078 | </v-flex> |
1079 | </v-layout> | 1079 | </v-layout> |
1080 | <v-layout wrap> | 1080 | <v-layout wrap> |
1081 | <v-flex xs12 sm6> | 1081 | <v-flex xs12 sm6> |
1082 | <v-layout wrap> | 1082 | <v-layout wrap> |
1083 | <v-flex xs12 class="pt-4 subheading"> | 1083 | <v-flex xs12 class="pt-4 subheading"> |
1084 | <label>Father Name:</label> | 1084 | <label>Father Name:</label> |
1085 | </v-flex> | 1085 | </v-flex> |
1086 | <v-flex xs12> | 1086 | <v-flex xs12> |
1087 | <v-text-field | 1087 | <v-text-field |
1088 | v-model="parentData.fatherName" | 1088 | v-model="parentData.fatherName" |
1089 | placeholder="Fill your father Name" | 1089 | placeholder="Fill your father Name" |
1090 | required | 1090 | required |
1091 | ></v-text-field> | 1091 | ></v-text-field> |
1092 | </v-flex> | 1092 | </v-flex> |
1093 | </v-layout> | 1093 | </v-layout> |
1094 | </v-flex> | 1094 | </v-flex> |
1095 | <v-flex xs12 sm6> | 1095 | <v-flex xs12 sm6> |
1096 | <v-layout wrap> | 1096 | <v-layout wrap> |
1097 | <v-flex xs12 class="pt-4 subheading"> | 1097 | <v-flex xs12 class="pt-4 subheading"> |
1098 | <label>Mother Name:</label> | 1098 | <label>Mother Name:</label> |
1099 | </v-flex> | 1099 | </v-flex> |
1100 | <v-flex xs12> | 1100 | <v-flex xs12> |
1101 | <v-text-field | 1101 | <v-text-field |
1102 | v-model="parentData.motherName" | 1102 | v-model="parentData.motherName" |
1103 | placeholder="fill your Mother Name" | 1103 | placeholder="fill your Mother Name" |
1104 | type="text" | 1104 | type="text" |
1105 | required | 1105 | required |
1106 | ></v-text-field> | 1106 | ></v-text-field> |
1107 | </v-flex> | 1107 | </v-flex> |
1108 | </v-layout> | 1108 | </v-layout> |
1109 | </v-flex> | 1109 | </v-flex> |
1110 | </v-layout> | 1110 | </v-layout> |
1111 | <v-layout wrap> | 1111 | <v-layout wrap> |
1112 | <v-flex xs12 sm6> | 1112 | <v-flex xs12 sm6> |
1113 | <v-layout wrap> | 1113 | <v-layout wrap> |
1114 | <v-flex xs12 class="pt-4 subheading"> | 1114 | <v-flex xs12 class="pt-4 subheading"> |
1115 | <label>Mother Cell No:</label> | 1115 | <label>Mother Cell No:</label> |
1116 | </v-flex> | 1116 | </v-flex> |
1117 | <v-flex xs12> | 1117 | <v-flex xs12> |
1118 | <v-text-field | 1118 | <v-text-field |
1119 | v-model="parentData.motherCellNo" | 1119 | v-model="parentData.motherCellNo" |
1120 | placeholder="fill your Mother Cell Number" | 1120 | placeholder="fill your Mother Cell Number" |
1121 | type="number" | 1121 | type="number" |
1122 | required | 1122 | required |
1123 | ></v-text-field> | 1123 | ></v-text-field> |
1124 | </v-flex> | 1124 | </v-flex> |
1125 | </v-layout> | 1125 | </v-layout> |
1126 | </v-flex> | 1126 | </v-flex> |
1127 | <v-flex xs12 sm6> | 1127 | <v-flex xs12 sm6> |
1128 | <v-layout wrap> | 1128 | <v-layout wrap> |
1129 | <v-flex xs12 class="pt-4 subheading"> | 1129 | <v-flex xs12 class="pt-4 subheading"> |
1130 | <label>Father Profession:</label> | 1130 | <label>Father Profession:</label> |
1131 | </v-flex> | 1131 | </v-flex> |
1132 | <v-flex xs12> | 1132 | <v-flex xs12> |
1133 | <v-text-field | 1133 | <v-text-field |
1134 | v-model="parentData.fatherProfession" | 1134 | v-model="parentData.fatherProfession" |
1135 | placeholder="fill your father profession" | 1135 | placeholder="fill your father profession" |
1136 | ></v-text-field> | 1136 | ></v-text-field> |
1137 | </v-flex> | 1137 | </v-flex> |
1138 | </v-layout> | 1138 | </v-layout> |
1139 | </v-flex> | 1139 | </v-flex> |
1140 | </v-layout> | 1140 | </v-layout> |
1141 | <v-layout wrap> | 1141 | <v-layout wrap> |
1142 | <v-flex xs12 sm6> | 1142 | <v-flex xs12 sm6> |
1143 | <v-layout wrap> | 1143 | <v-layout wrap> |
1144 | <v-flex xs12 class="pt-4 subheading"> | 1144 | <v-flex xs12 class="pt-4 subheading"> |
1145 | <label>Mother Profession:</label> | 1145 | <label>Mother Profession:</label> |
1146 | </v-flex> | 1146 | </v-flex> |
1147 | <v-flex xs12> | 1147 | <v-flex xs12> |
1148 | <v-text-field | 1148 | <v-text-field |
1149 | v-model="parentData.motherProfession" | 1149 | v-model="parentData.motherProfession" |
1150 | placeholder="fill your mother profession" | 1150 | placeholder="fill your mother profession" |
1151 | ></v-text-field> | 1151 | ></v-text-field> |
1152 | </v-flex> | 1152 | </v-flex> |
1153 | </v-layout> | 1153 | </v-layout> |
1154 | </v-flex> | 1154 | </v-flex> |
1155 | <v-flex xs12 sm6> | 1155 | <v-flex xs12 sm6> |
1156 | <v-layout wrap> | 1156 | <v-layout wrap> |
1157 | <v-flex xs12 class="pt-4 subheading"> | 1157 | <v-flex xs12 class="pt-4 subheading"> |
1158 | <label>Password:</label> | 1158 | <label>Password:</label> |
1159 | </v-flex> | 1159 | </v-flex> |
1160 | <v-flex xs12> | 1160 | <v-flex xs12> |
1161 | <v-text-field | 1161 | <v-text-field |
1162 | v-model="parentData.password" | 1162 | v-model="parentData.password" |
1163 | placeholder="Enter Your Password" | 1163 | placeholder="Enter Your Password" |
1164 | ></v-text-field> | 1164 | ></v-text-field> |
1165 | </v-flex> | 1165 | </v-flex> |
1166 | </v-layout> | 1166 | </v-layout> |
1167 | </v-flex> | 1167 | </v-flex> |
1168 | </v-layout> | 1168 | </v-layout> |
1169 | <v-flex sm12 class="hidden-xs-only"> | 1169 | <v-flex sm12 class="hidden-xs-only"> |
1170 | <v-card-actions> | 1170 | <v-card-actions> |
1171 | <v-spacer></v-spacer> | 1171 | <v-spacer></v-spacer> |
1172 | <v-btn | 1172 | <v-btn |
1173 | @click="submitParentDetails" | 1173 | @click="submitParentDetails" |
1174 | round | 1174 | round |
1175 | dark | 1175 | dark |
1176 | :loading="loading" | 1176 | :loading="loading" |
1177 | v-show="showParent" | 1177 | v-show="showParent" |
1178 | class="add-button" | 1178 | class="add-button" |
1179 | >Add</v-btn> | 1179 | >Add</v-btn> |
1180 | <v-btn | 1180 | <v-btn |
1181 | v-show="showNext" | 1181 | v-show="showNext" |
1182 | @click="e2 = 2" | 1182 | @click="e2 = 2" |
1183 | round | 1183 | round |
1184 | dark | 1184 | dark |
1185 | class="add-button" | 1185 | class="add-button" |
1186 | >Next</v-btn> | 1186 | >Next</v-btn> |
1187 | </v-card-actions> | 1187 | </v-card-actions> |
1188 | </v-flex> | 1188 | </v-flex> |
1189 | <v-flex | 1189 | <v-flex |
1190 | xs6 | 1190 | xs6 |
1191 | class="hidden-md-only hidden-sm-only hidden-lg-only hidden-xl-only mx-auto mt-2" | 1191 | class="hidden-md-only hidden-sm-only hidden-lg-only hidden-xl-only mx-auto mt-2" |
1192 | > | 1192 | > |
1193 | <v-btn | 1193 | <v-btn |
1194 | @click="submitParentDetails" | 1194 | @click="submitParentDetails" |
1195 | round | 1195 | round |
1196 | dark | 1196 | dark |
1197 | :loading="loading" | 1197 | :loading="loading" |
1198 | v-show="showParent" | 1198 | v-show="showParent" |
1199 | class="add-button" | 1199 | class="add-button" |
1200 | >Add</v-btn> | 1200 | >Add</v-btn> |
1201 | <v-btn | 1201 | <v-btn |
1202 | v-show="showNext" | 1202 | v-show="showNext" |
1203 | @click="e2 = 2" | 1203 | @click="e2 = 2" |
1204 | round | 1204 | round |
1205 | dark | 1205 | dark |
1206 | class="add-button" | 1206 | class="add-button" |
1207 | >Next</v-btn> | 1207 | >Next</v-btn> |
1208 | </v-flex> | 1208 | </v-flex> |
1209 | </v-form> | 1209 | </v-form> |
1210 | </v-flex> | 1210 | </v-flex> |
1211 | <v-flex xs12 sm12 class="hidden-xs-only hidden-sm-only"> | 1211 | <v-flex xs12 sm12 class="hidden-xs-only hidden-sm-only"> |
1212 | <v-form ref="parentFormLgScr" v-model="valid" lazy-validation> | 1212 | <v-form ref="parentFormLgScr" v-model="valid" lazy-validation> |
1213 | <v-layout wrap> | 1213 | <v-layout wrap> |
1214 | <v-flex xs12 sm6> | 1214 | <v-flex xs12 sm6> |
1215 | <v-layout> | 1215 | <v-layout> |
1216 | <v-flex xs4 class="pt-4 subheading"> | 1216 | <v-flex xs4 class="pt-4 subheading"> |
1217 | <label class="right">Father Cell No:</label> | 1217 | <label class="right">Father Cell No:</label> |
1218 | </v-flex> | 1218 | </v-flex> |
1219 | <v-flex xs8 class="ml-3"> | 1219 | <v-flex xs8 class="ml-3"> |
1220 | <v-text-field | 1220 | <v-text-field |
1221 | v-model.trim="parentData.fatherCellNo" | 1221 | v-model.trim="parentData.fatherCellNo" |
1222 | placeholder="fill your father Cell Number" | 1222 | placeholder="fill your father Cell Number" |
1223 | type="number" | 1223 | type="number" |
1224 | :rules="fatheCellNoRules" | 1224 | :rules="fatheCellNoRules" |
1225 | counter="10" | 1225 | counter="10" |
1226 | required | 1226 | required |
1227 | v-on:keyup="getParentDetails()" | 1227 | v-on:keyup="getParentDetails()" |
1228 | ></v-text-field> | 1228 | ></v-text-field> |
1229 | </v-flex> | 1229 | </v-flex> |
1230 | </v-layout> | 1230 | </v-layout> |
1231 | </v-flex> | 1231 | </v-flex> |
1232 | <v-flex xs12 sm6> | 1232 | <v-flex xs12 sm6> |
1233 | <v-layout> | 1233 | <v-layout> |
1234 | <v-flex xs4 class="pt-4 subheading"> | 1234 | <v-flex xs4 class="pt-4 subheading"> |
1235 | <label class="right">Parent Email Id:</label> | 1235 | <label class="right">Parent Email Id:</label> |
1236 | </v-flex> | 1236 | </v-flex> |
1237 | <v-flex xs8 class="ml-3"> | 1237 | <v-flex xs8 class="ml-3"> |
1238 | <v-text-field | 1238 | <v-text-field |
1239 | placeholder="fill Parent email" | 1239 | placeholder="fill Parent email" |
1240 | v-model="parentData.email" | 1240 | v-model="parentData.email" |
1241 | type="text" | 1241 | type="text" |
1242 | required | 1242 | required |
1243 | ></v-text-field> | 1243 | ></v-text-field> |
1244 | </v-flex> | 1244 | </v-flex> |
1245 | </v-layout> | 1245 | </v-layout> |
1246 | </v-flex> | 1246 | </v-flex> |
1247 | </v-layout> | 1247 | </v-layout> |
1248 | <v-layout wrap> | 1248 | <v-layout wrap> |
1249 | <v-flex xs12 sm6> | 1249 | <v-flex xs12 sm6> |
1250 | <v-layout> | 1250 | <v-layout> |
1251 | <v-flex xs4 class="pt-4 subheading"> | 1251 | <v-flex xs4 class="pt-4 subheading"> |
1252 | <label class="right">Father Name:</label> | 1252 | <label class="right">Father Name:</label> |
1253 | </v-flex> | 1253 | </v-flex> |
1254 | <v-flex xs8 class="ml-3"> | 1254 | <v-flex xs8 class="ml-3"> |
1255 | <v-text-field | 1255 | <v-text-field |
1256 | v-model="parentData.fatherName" | 1256 | v-model="parentData.fatherName" |
1257 | placeholder="Fill your father Name" | 1257 | placeholder="Fill your father Name" |
1258 | required | 1258 | required |
1259 | ></v-text-field> | 1259 | ></v-text-field> |
1260 | </v-flex> | 1260 | </v-flex> |
1261 | </v-layout> | 1261 | </v-layout> |
1262 | </v-flex> | 1262 | </v-flex> |
1263 | <v-flex xs12 sm6> | 1263 | <v-flex xs12 sm6> |
1264 | <v-layout> | 1264 | <v-layout> |
1265 | <v-flex xs4 class="pt-4 subheading"> | 1265 | <v-flex xs4 class="pt-4 subheading"> |
1266 | <label class="right">Mother Name:</label> | 1266 | <label class="right">Mother Name:</label> |
1267 | </v-flex> | 1267 | </v-flex> |
1268 | <v-flex xs8 class="ml-3"> | 1268 | <v-flex xs8 class="ml-3"> |
1269 | <v-text-field | 1269 | <v-text-field |
1270 | v-model="parentData.motherName" | 1270 | v-model="parentData.motherName" |
1271 | placeholder="fill your Mother Name" | 1271 | placeholder="fill your Mother Name" |
1272 | type="text" | 1272 | type="text" |
1273 | required | 1273 | required |
1274 | ></v-text-field> | 1274 | ></v-text-field> |
1275 | </v-flex> | 1275 | </v-flex> |
1276 | </v-layout> | 1276 | </v-layout> |
1277 | </v-flex> | 1277 | </v-flex> |
1278 | </v-layout> | 1278 | </v-layout> |
1279 | <v-layout wrap> | 1279 | <v-layout wrap> |
1280 | <v-flex xs12 sm6> | 1280 | <v-flex xs12 sm6> |
1281 | <v-layout> | 1281 | <v-layout> |
1282 | <v-flex xs4 class="pt-4 subheading"> | 1282 | <v-flex xs4 class="pt-4 subheading"> |
1283 | <label class="right">Mother Cell No:</label> | 1283 | <label class="right">Mother Cell No:</label> |
1284 | </v-flex> | 1284 | </v-flex> |
1285 | <v-flex xs8 class="ml-3"> | 1285 | <v-flex xs8 class="ml-3"> |
1286 | <v-text-field | 1286 | <v-text-field |
1287 | v-model="parentData.motherCellNo" | 1287 | v-model="parentData.motherCellNo" |
1288 | placeholder="fill your Mother Cell Number" | 1288 | placeholder="fill your Mother Cell Number" |
1289 | type="number" | 1289 | type="number" |
1290 | required | 1290 | required |
1291 | ></v-text-field> | 1291 | ></v-text-field> |
1292 | </v-flex> | 1292 | </v-flex> |
1293 | </v-layout> | 1293 | </v-layout> |
1294 | </v-flex> | 1294 | </v-flex> |
1295 | <v-flex xs12 sm6> | 1295 | <v-flex xs12 sm6> |
1296 | <v-layout> | 1296 | <v-layout> |
1297 | <v-flex xs4 class="pt-4 subheading"> | 1297 | <v-flex xs4 class="pt-4 subheading"> |
1298 | <label class="right">Father Profession:</label> | 1298 | <label class="right">Father Profession:</label> |
1299 | </v-flex> | 1299 | </v-flex> |
1300 | <v-flex xs8 class="ml-3"> | 1300 | <v-flex xs8 class="ml-3"> |
1301 | <v-text-field | 1301 | <v-text-field |
1302 | v-model="parentData.fatherProfession" | 1302 | v-model="parentData.fatherProfession" |
1303 | placeholder="fill your father profession" | 1303 | placeholder="fill your father profession" |
1304 | ></v-text-field> | 1304 | ></v-text-field> |
1305 | </v-flex> | 1305 | </v-flex> |
1306 | </v-layout> | 1306 | </v-layout> |
1307 | </v-flex> | 1307 | </v-flex> |
1308 | </v-layout> | 1308 | </v-layout> |
1309 | <v-layout wrap> | 1309 | <v-layout wrap> |
1310 | <v-flex xs12 sm6> | 1310 | <v-flex xs12 sm6> |
1311 | <v-layout> | 1311 | <v-layout> |
1312 | <v-flex xs4 class="pt-4 subheading"> | 1312 | <v-flex xs4 class="pt-4 subheading"> |
1313 | <label class="right">Mother Profession:</label> | 1313 | <label class="right">Mother Profession:</label> |
1314 | </v-flex> | 1314 | </v-flex> |
1315 | <v-flex xs8 class="ml-3"> | 1315 | <v-flex xs8 class="ml-3"> |
1316 | <v-text-field | 1316 | <v-text-field |
1317 | v-model="parentData.motherProfession" | 1317 | v-model="parentData.motherProfession" |
1318 | placeholder="fill your mother profession" | 1318 | placeholder="fill your mother profession" |
1319 | ></v-text-field> | 1319 | ></v-text-field> |
1320 | </v-flex> | 1320 | </v-flex> |
1321 | </v-layout> | 1321 | </v-layout> |
1322 | </v-flex> | 1322 | </v-flex> |
1323 | <v-flex xs12 sm6> | 1323 | <v-flex xs12 sm6> |
1324 | <v-layout> | 1324 | <v-layout> |
1325 | <v-flex xs4 class="pt-4 subheading"> | 1325 | <v-flex xs4 class="pt-4 subheading"> |
1326 | <label class="right">Password:</label> | 1326 | <label class="right">Password:</label> |
1327 | </v-flex> | 1327 | </v-flex> |
1328 | <v-flex xs8 class="ml-3"> | 1328 | <v-flex xs8 class="ml-3"> |
1329 | <v-text-field | 1329 | <v-text-field |
1330 | :append-icon="e1 ? 'visibility_off' : 'visibility'" | 1330 | :append-icon="e1 ? 'visibility_off' : 'visibility'" |
1331 | :append-icon-cb="() => (e1 = !e1)" | 1331 | :append-icon-cb="() => (e1 = !e1)" |
1332 | :type="e1 ? 'password' : 'text'" | 1332 | :type="e1 ? 'password' : 'text'" |
1333 | :rules="password" | 1333 | :rules="password" |
1334 | v-model="parentData.password" | 1334 | v-model="parentData.password" |
1335 | placeholder="Enter Your Password" | 1335 | placeholder="Enter Your Password" |
1336 | :disabled="isFatherCellExists" | 1336 | :disabled="isFatherCellExists" |
1337 | required | 1337 | required |
1338 | ></v-text-field> | 1338 | ></v-text-field> |
1339 | </v-flex> | 1339 | </v-flex> |
1340 | </v-layout> | 1340 | </v-layout> |
1341 | </v-flex> | 1341 | </v-flex> |
1342 | </v-layout> | 1342 | </v-layout> |
1343 | <v-flex sm12 class="hidden-xs-only"> | 1343 | <v-flex sm12 class="hidden-xs-only"> |
1344 | <v-card-actions> | 1344 | <v-card-actions> |
1345 | <v-spacer></v-spacer> | 1345 | <v-spacer></v-spacer> |
1346 | <v-btn | 1346 | <v-btn |
1347 | @click="submitParentDetails" | 1347 | @click="submitParentDetails" |
1348 | round | 1348 | round |
1349 | dark | 1349 | dark |
1350 | :loading="loading" | 1350 | :loading="loading" |
1351 | v-show="showParent" | 1351 | v-show="showParent" |
1352 | class="add-button" | 1352 | class="add-button" |
1353 | >Add</v-btn> | 1353 | >Add</v-btn> |
1354 | <v-btn | 1354 | <v-btn |
1355 | v-show="showNext" | 1355 | v-show="showNext" |
1356 | @click="e2 = 2" | 1356 | @click="e2 = 2" |
1357 | round | 1357 | round |
1358 | dark | 1358 | dark |
1359 | class="add-button" | 1359 | class="add-button" |
1360 | >Next</v-btn> | 1360 | >Next</v-btn> |
1361 | </v-card-actions> | 1361 | </v-card-actions> |
1362 | </v-flex> | 1362 | </v-flex> |
1363 | <v-flex | 1363 | <v-flex |
1364 | xs6 | 1364 | xs6 |
1365 | class="hidden-md-only hidden-sm-only hidden-lg-only hidden-xl-only mx-auto mt-2" | 1365 | class="hidden-md-only hidden-sm-only hidden-lg-only hidden-xl-only mx-auto mt-2" |
1366 | > | 1366 | > |
1367 | <v-btn | 1367 | <v-btn |
1368 | @click="submitParentDetails" | 1368 | @click="submitParentDetails" |
1369 | round | 1369 | round |
1370 | dark | 1370 | dark |
1371 | :loading="loading" | 1371 | :loading="loading" |
1372 | v-show="showParent" | 1372 | v-show="showParent" |
1373 | class="add-button" | 1373 | class="add-button" |
1374 | >Add</v-btn> | 1374 | >Add</v-btn> |
1375 | <v-btn | 1375 | <v-btn |
1376 | v-show="showNext" | 1376 | v-show="showNext" |
1377 | @click="e2 = 2" | 1377 | @click="e2 = 2" |
1378 | round | 1378 | round |
1379 | dark | 1379 | dark |
1380 | class="add-button" | 1380 | class="add-button" |
1381 | >Next</v-btn> | 1381 | >Next</v-btn> |
1382 | </v-flex> | 1382 | </v-flex> |
1383 | </v-form> | 1383 | </v-form> |
1384 | </v-flex> | 1384 | </v-flex> |
1385 | </v-container> | 1385 | </v-container> |
1386 | </v-stepper-content> | 1386 | </v-stepper-content> |
1387 | <v-stepper-content step="2"> | 1387 | <v-stepper-content step="2"> |
1388 | <v-flex xs12 sm12> | 1388 | <v-flex xs12 sm12> |
1389 | <v-form ref="form" v-model="valid" lazy-validation> | 1389 | <v-form ref="form" v-model="valid" lazy-validation> |
1390 | <v-layout> | 1390 | <v-layout> |
1391 | <v-flex | 1391 | <v-flex |
1392 | xs12 | 1392 | xs12 |
1393 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 1393 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
1394 | > | 1394 | > |
1395 | <v-avatar size="100px"> | 1395 | <v-avatar size="100px"> |
1396 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 1396 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
1397 | </v-avatar> | 1397 | </v-avatar> |
1398 | <input | 1398 | <input |
1399 | type="file" | 1399 | type="file" |
1400 | style="display: none" | 1400 | style="display: none" |
1401 | ref="image" | 1401 | ref="image" |
1402 | accept="image/*" | 1402 | accept="image/*" |
1403 | @change="onFilePicked" | 1403 | @change="onFilePicked" |
1404 | /> | 1404 | /> |
1405 | <img | 1405 | <img |
1406 | :src="imageData.imageUrl" | 1406 | :src="imageData.imageUrl" |
1407 | height="150" | 1407 | height="150" |
1408 | v-if="imageUrl" | 1408 | v-if="imageUrl" |
1409 | style="border-radius:50%; width:200px" | 1409 | style="border-radius:50%; width:200px" |
1410 | /> | 1410 | /> |
1411 | </v-flex> | 1411 | </v-flex> |
1412 | </v-layout> | 1412 | </v-layout> |
1413 | <v-layout wrap> | 1413 | <v-layout wrap> |
1414 | <v-flex xs12 sm6> | 1414 | <v-flex xs12 sm6> |
1415 | <v-layout> | 1415 | <v-layout> |
1416 | <v-flex x4 sm4 class="pt-4 subheading"> | 1416 | <v-flex x4 sm4 class="pt-4 subheading"> |
1417 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 1417 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
1418 | <label | 1418 | <label |
1419 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1419 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1420 | >Class:</label> | 1420 | >Class:</label> |
1421 | </v-flex> | 1421 | </v-flex> |
1422 | <v-flex xs8 sm8 class="ml-3"> | 1422 | <v-flex xs8 sm8 class="ml-3"> |
1423 | <v-select | 1423 | <v-select |
1424 | :items="addclass" | 1424 | :items="addclass" |
1425 | label="Select Class" | 1425 | label="Select Class" |
1426 | v-model="addStudents.select" | 1426 | v-model="addStudents.select" |
1427 | item-text="classNum" | 1427 | item-text="classNum" |
1428 | item-value="_id" | 1428 | item-value="_id" |
1429 | name="Select Class" | 1429 | name="Select Class" |
1430 | :rules="classRules" | 1430 | :rules="classRules" |
1431 | @change="getSection(addStudents.select)" | 1431 | @change="getSection(addStudents.select)" |
1432 | required | 1432 | required |
1433 | ></v-select> | 1433 | ></v-select> |
1434 | </v-flex> | 1434 | </v-flex> |
1435 | </v-layout> | 1435 | </v-layout> |
1436 | </v-flex> | 1436 | </v-flex> |
1437 | <v-flex xs12 sm6> | 1437 | <v-flex xs12 sm6> |
1438 | <v-layout> | 1438 | <v-layout> |
1439 | <v-flex xs4 class="pt-4 subheading"> | 1439 | <v-flex xs4 class="pt-4 subheading"> |
1440 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> | 1440 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> |
1441 | <label | 1441 | <label |
1442 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1442 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1443 | >Section:</label> | 1443 | >Section:</label> |
1444 | </v-flex> | 1444 | </v-flex> |
1445 | <v-flex xs8 class="ml-3"> | 1445 | <v-flex xs8 class="ml-3"> |
1446 | <v-select | 1446 | <v-select |
1447 | :items="addSection" | 1447 | :items="addSection" |
1448 | label="Select Section" | 1448 | label="Select Section" |
1449 | v-model="addStudents.selectSection" | 1449 | v-model="addStudents.selectSection" |
1450 | item-text="name" | 1450 | item-text="name" |
1451 | item-value="_id" | 1451 | item-value="_id" |
1452 | name="Select Section" | 1452 | name="Select Section" |
1453 | :rules="sectionRules" | 1453 | :rules="sectionRules" |
1454 | required | 1454 | required |
1455 | ></v-select> | 1455 | ></v-select> |
1456 | </v-flex> | 1456 | </v-flex> |
1457 | </v-layout> | 1457 | </v-layout> |
1458 | </v-flex> | 1458 | </v-flex> |
1459 | </v-layout> | 1459 | </v-layout> |
1460 | <v-layout wrap> | 1460 | <v-layout wrap> |
1461 | <v-flex xs12 sm6> | 1461 | <v-flex xs12 sm6> |
1462 | <v-layout> | 1462 | <v-layout> |
1463 | <v-flex xs4 sm4 class="pt-4 subheading"> | 1463 | <v-flex xs4 sm4 class="pt-4 subheading"> |
1464 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> | 1464 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> |
1465 | <label | 1465 | <label |
1466 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1466 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1467 | >Name:</label> | 1467 | >Name:</label> |
1468 | </v-flex> | 1468 | </v-flex> |
1469 | <v-flex xs8 sm8 class="ml-3"> | 1469 | <v-flex xs8 sm8 class="ml-3"> |
1470 | <v-text-field | 1470 | <v-text-field |
1471 | v-model="addStudents.name" | 1471 | v-model="addStudents.name" |
1472 | placeholder="fill your full Name" | 1472 | placeholder="fill your full Name" |
1473 | name="name" | 1473 | name="name" |
1474 | type="text" | 1474 | type="text" |
1475 | :rules="nameRules" | 1475 | :rules="nameRules" |
1476 | required | 1476 | required |
1477 | ></v-text-field> | 1477 | ></v-text-field> |
1478 | </v-flex> | 1478 | </v-flex> |
1479 | </v-layout> | 1479 | </v-layout> |
1480 | </v-flex> | 1480 | </v-flex> |
1481 | <v-flex xs12 sm6> | 1481 | <v-flex xs12 sm6> |
1482 | <v-layout> | 1482 | <v-layout> |
1483 | <v-flex xs4 sm4 class="pt-4 subheading"> | 1483 | <v-flex xs4 sm4 class="pt-4 subheading"> |
1484 | <label class="right">Email:</label> | 1484 | <label class="right">Email:</label> |
1485 | </v-flex> | 1485 | </v-flex> |
1486 | <v-flex xs8 sm8 class="ml-3"> | 1486 | <v-flex xs8 sm8 class="ml-3"> |
1487 | <v-text-field | 1487 | <v-text-field |
1488 | placeholder="fill your email" | 1488 | placeholder="fill your email" |
1489 | v-model="addStudents.email" | 1489 | v-model="addStudents.email" |
1490 | type="text" | 1490 | type="text" |
1491 | name="email" | 1491 | name="email" |
1492 | required | 1492 | required |
1493 | ></v-text-field> | 1493 | ></v-text-field> |
1494 | </v-flex> | 1494 | </v-flex> |
1495 | </v-layout> | 1495 | </v-layout> |
1496 | </v-flex> | 1496 | </v-flex> |
1497 | </v-layout> | 1497 | </v-layout> |
1498 | <v-layout wrap> | 1498 | <v-layout wrap> |
1499 | <v-flex xs12 sm6> | 1499 | <v-flex xs12 sm6> |
1500 | <v-layout> | 1500 | <v-layout> |
1501 | <v-flex xs4 sm4 class="pt-4 subheading"> | 1501 | <v-flex xs4 sm4 class="pt-4 subheading"> |
1502 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 1502 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
1503 | <label | 1503 | <label |
1504 | class="right hidden-lg-only hidden-xl-only hidden-md-only" | 1504 | class="right hidden-lg-only hidden-xl-only hidden-md-only" |
1505 | >D.O.B:</label> | 1505 | >D.O.B:</label> |
1506 | </v-flex> | 1506 | </v-flex> |
1507 | <v-flex xs8 sm8 class="ml-3"> | 1507 | <v-flex xs8 sm8 class="ml-3"> |
1508 | <v-menu | 1508 | <v-menu |
1509 | ref="menu" | 1509 | ref="menu" |
1510 | :close-on-content-click="false" | 1510 | :close-on-content-click="false" |
1511 | v-model="menu" | 1511 | v-model="menu" |
1512 | :nudge-right="40" | 1512 | :nudge-right="40" |
1513 | lazy | 1513 | lazy |
1514 | transition="scale-transition" | 1514 | transition="scale-transition" |
1515 | offset-y | 1515 | offset-y |
1516 | full-width | 1516 | full-width |
1517 | min-width="290px" | 1517 | min-width="290px" |
1518 | > | 1518 | > |
1519 | <v-text-field | 1519 | <v-text-field |
1520 | slot="activator" | 1520 | slot="activator" |
1521 | :rules="dateRules" | 1521 | :rules="dateRules" |
1522 | v-model="addStudents.date" | 1522 | v-model="addStudents.date" |
1523 | placeholder="Select date" | 1523 | placeholder="Select date" |
1524 | ></v-text-field> | 1524 | ></v-text-field> |
1525 | <v-date-picker | 1525 | <v-date-picker |
1526 | ref="picker" | 1526 | ref="picker" |
1527 | v-model="addStudents.date" | 1527 | v-model="addStudents.date" |
1528 | :max="new Date().toISOString().substr(0, 10)" | 1528 | :max="new Date().toISOString().substr(0, 10)" |
1529 | min="1950-01-01" | 1529 | min="1950-01-01" |
1530 | @input="menu = false" | 1530 | @input="menu = false" |
1531 | ></v-date-picker> | 1531 | ></v-date-picker> |
1532 | </v-menu> | 1532 | </v-menu> |
1533 | </v-flex> | 1533 | </v-flex> |
1534 | </v-layout> | 1534 | </v-layout> |
1535 | </v-flex> | 1535 | </v-flex> |
1536 | <v-flex xs12 sm6> | 1536 | <v-flex xs12 sm6> |
1537 | <v-layout> | 1537 | <v-layout> |
1538 | <v-flex xs4 class="pt-4 subheading"> | 1538 | <v-flex xs4 class="pt-4 subheading"> |
1539 | <label class="right">City:</label> | 1539 | <label class="right">City:</label> |
1540 | </v-flex> | 1540 | </v-flex> |
1541 | <v-flex xs8 class="ml-3"> | 1541 | <v-flex xs8 class="ml-3"> |
1542 | <v-text-field | 1542 | <v-text-field |
1543 | v-model="addStudents.city" | 1543 | v-model="addStudents.city" |
1544 | placeholder="fill your City Name" | 1544 | placeholder="fill your City Name" |
1545 | name="City" | 1545 | name="City" |
1546 | type="text" | 1546 | type="text" |
1547 | :rules="cityRules" | 1547 | :rules="cityRules" |
1548 | required | 1548 | required |
1549 | ></v-text-field> | 1549 | ></v-text-field> |
1550 | </v-flex> | 1550 | </v-flex> |
1551 | </v-layout> | 1551 | </v-layout> |
1552 | </v-flex> | 1552 | </v-flex> |
1553 | </v-layout> | 1553 | </v-layout> |
1554 | <v-layout wrap> | 1554 | <v-layout wrap> |
1555 | <v-flex xs12 sm6> | 1555 | <v-flex xs12 sm6> |
1556 | <v-layout> | 1556 | <v-layout> |
1557 | <v-flex xs4 class="pt-4 subheading"> | 1557 | <v-flex xs4 class="pt-4 subheading"> |
1558 | <label class="right">State:</label> | 1558 | <label class="right">State:</label> |
1559 | </v-flex> | 1559 | </v-flex> |
1560 | <v-flex xs8 class="ml-3"> | 1560 | <v-flex xs8 class="ml-3"> |
1561 | <v-text-field | 1561 | <v-text-field |
1562 | v-model="addStudents.state" | 1562 | v-model="addStudents.state" |
1563 | placeholder="fill your State Name" | 1563 | placeholder="fill your State Name" |
1564 | name="state" | 1564 | name="state" |
1565 | type="text" | 1565 | type="text" |
1566 | :rules="stateRules" | 1566 | :rules="stateRules" |
1567 | required | 1567 | required |
1568 | ></v-text-field> | 1568 | ></v-text-field> |
1569 | </v-flex> | 1569 | </v-flex> |
1570 | </v-layout> | 1570 | </v-layout> |
1571 | </v-flex> | 1571 | </v-flex> |
1572 | <v-flex xs12 sm6> | 1572 | <v-flex xs12 sm6> |
1573 | <v-layout> | 1573 | <v-layout> |
1574 | <v-flex xs4 class="pt-4 subheading"> | 1574 | <v-flex xs4 class="pt-4 subheading"> |
1575 | <label class="right">Pincode:</label> | 1575 | <label class="right">Pincode:</label> |
1576 | </v-flex> | 1576 | </v-flex> |
1577 | <v-flex xs8 class="ml-3"> | 1577 | <v-flex xs8 class="ml-3"> |
1578 | <v-text-field | 1578 | <v-text-field |
1579 | v-model="addStudents.pincode" | 1579 | v-model="addStudents.pincode" |
1580 | placeholder="fill your pincode" | 1580 | placeholder="fill your pincode" |
1581 | name="pincode" | 1581 | name="pincode" |
1582 | type="number" | 1582 | type="number" |
1583 | :rules="pincode" | 1583 | :rules="pincode" |
1584 | required | 1584 | required |
1585 | ></v-text-field> | 1585 | ></v-text-field> |
1586 | </v-flex> | 1586 | </v-flex> |
1587 | </v-layout> | 1587 | </v-layout> |
1588 | </v-flex> | 1588 | </v-flex> |
1589 | </v-layout> | 1589 | </v-layout> |
1590 | <v-layout wrap> | 1590 | <v-layout wrap> |
1591 | <v-flex xs12 sm6> | 1591 | <v-flex xs12 sm6> |
1592 | <v-layout> | 1592 | <v-layout> |
1593 | <v-flex xs4 class="pt-4 subheading"> | 1593 | <v-flex xs4 class="pt-4 subheading"> |
1594 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> | 1594 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> |
1595 | <label | 1595 | <label |
1596 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1596 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1597 | >Mobile:</label> | 1597 | >Mobile:</label> |
1598 | </v-flex> | 1598 | </v-flex> |
1599 | <v-flex xs8 class="ml-3"> | 1599 | <v-flex xs8 class="ml-3"> |
1600 | <v-text-field | 1600 | <v-text-field |
1601 | v-model="addStudents.mobile" | 1601 | v-model="addStudents.mobile" |
1602 | placeholder="fill your MobileNo" | 1602 | placeholder="fill your MobileNo" |
1603 | name="mobileNo" | 1603 | name="mobileNo" |
1604 | type="number" | 1604 | type="number" |
1605 | ></v-text-field> | 1605 | ></v-text-field> |
1606 | </v-flex> | 1606 | </v-flex> |
1607 | </v-layout> | 1607 | </v-layout> |
1608 | </v-flex> | 1608 | </v-flex> |
1609 | <v-flex xs12 sm6> | 1609 | <v-flex xs12 sm6> |
1610 | <v-layout> | 1610 | <v-layout> |
1611 | <v-flex xs4 class="pt-4 subheading"> | 1611 | <v-flex xs4 class="pt-4 subheading"> |
1612 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> | 1612 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> |
1613 | <label | 1613 | <label |
1614 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1614 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1615 | >Country:</label> | 1615 | >Country:</label> |
1616 | </v-flex> | 1616 | </v-flex> |
1617 | <v-flex xs8 class="ml-3"> | 1617 | <v-flex xs8 class="ml-3"> |
1618 | <v-autocomplete | 1618 | <v-autocomplete |
1619 | v-model="addStudents.country" | 1619 | v-model="addStudents.country" |
1620 | :rules="country" | 1620 | :rules="country" |
1621 | :items="countries" | 1621 | :items="countries" |
1622 | placeholder="Select Country Name" | 1622 | placeholder="Select Country Name" |
1623 | required | 1623 | required |
1624 | ></v-autocomplete> | 1624 | ></v-autocomplete> |
1625 | </v-flex> | 1625 | </v-flex> |
1626 | </v-layout> | 1626 | </v-layout> |
1627 | </v-flex> | 1627 | </v-flex> |
1628 | </v-layout> | 1628 | </v-layout> |
1629 | <v-layout wrap> | 1629 | <v-layout wrap> |
1630 | <v-flex xs12 sm6> | 1630 | <v-flex xs12 sm6> |
1631 | <v-layout> | 1631 | <v-layout> |
1632 | <v-flex xs4 class="pt-4 subheading"> | 1632 | <v-flex xs4 class="pt-4 subheading"> |
1633 | <label class="right">Gender:</label> | 1633 | <label class="right">Gender:</label> |
1634 | </v-flex> | 1634 | </v-flex> |
1635 | <v-flex xs8 class="ml-3"> | 1635 | <v-flex xs8 class="ml-3"> |
1636 | <v-select | 1636 | <v-select |
1637 | :items="gender" | 1637 | :items="gender" |
1638 | v-model="addStudents.gender" | 1638 | v-model="addStudents.gender" |
1639 | :rules="genderRules" | 1639 | :rules="genderRules" |
1640 | label="Select Gender" | 1640 | label="Select Gender" |
1641 | required | 1641 | required |
1642 | ></v-select> | 1642 | ></v-select> |
1643 | </v-flex> | 1643 | </v-flex> |
1644 | </v-layout> | 1644 | </v-layout> |
1645 | </v-flex> | 1645 | </v-flex> |
1646 | <v-flex xs12 sm6> | 1646 | <v-flex xs12 sm6> |
1647 | <v-layout> | 1647 | <v-layout> |
1648 | <v-flex xs4 class="pt-4 subheading"> | 1648 | <v-flex xs4 class="pt-4 subheading"> |
1649 | <label class="right hidden-xs-only hidden-sm-only">Blood Group:</label> | 1649 | <label class="right hidden-xs-only hidden-sm-only">Blood Group:</label> |
1650 | <label | 1650 | <label |
1651 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1651 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1652 | >Blood:</label> | 1652 | >Blood:</label> |
1653 | </v-flex> | 1653 | </v-flex> |
1654 | <v-flex xs8 class="ml-3"> | 1654 | <v-flex xs8 class="ml-3"> |
1655 | <v-text-field | 1655 | <v-text-field |
1656 | v-model="addStudents.bloodGroup" | 1656 | v-model="addStudents.bloodGroup" |
1657 | placeholder="Fill your Blood Group" | 1657 | placeholder="Fill your Blood Group" |
1658 | required | 1658 | required |
1659 | ></v-text-field> | 1659 | ></v-text-field> |
1660 | </v-flex> | 1660 | </v-flex> |
1661 | </v-layout> | 1661 | </v-layout> |
1662 | </v-flex> | 1662 | </v-flex> |
1663 | </v-layout> | 1663 | </v-layout> |
1664 | <v-layout wrap> | 1664 | <v-layout wrap> |
1665 | <v-flex xs12 sm6> | 1665 | <v-flex xs12 sm6> |
1666 | <v-layout> | 1666 | <v-layout> |
1667 | <v-flex xs4 class="pt-4 subheading"> | 1667 | <v-flex xs4 class="pt-4 subheading"> |
1668 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> | 1668 | <label class="right hidden-xs-only hidden-sm-only">Roll Number:</label> |
1669 | <label | 1669 | <label |
1670 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1670 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1671 | >Roll No:</label> | 1671 | >Roll No:</label> |
1672 | </v-flex> | 1672 | </v-flex> |
1673 | <v-flex xs8 class="ml-3"> | 1673 | <v-flex xs8 class="ml-3"> |
1674 | <v-text-field | 1674 | <v-text-field |
1675 | v-model="addStudents.rollNo" | 1675 | v-model="addStudents.rollNo" |
1676 | placeholder="Fill your Roll Number" | 1676 | placeholder="Fill your Roll Number" |
1677 | :rules="rollNo" | 1677 | :rules="rollNo" |
1678 | required | 1678 | required |
1679 | ></v-text-field> | 1679 | ></v-text-field> |
1680 | </v-flex> | 1680 | </v-flex> |
1681 | </v-layout> | 1681 | </v-layout> |
1682 | </v-flex> | 1682 | </v-flex> |
1683 | <v-flex xs12 sm6> | 1683 | <v-flex xs12 sm6> |
1684 | <v-layout> | 1684 | <v-layout> |
1685 | <v-flex xs4 class="pt-4 subheading"> | 1685 | <v-flex xs4 class="pt-4 subheading"> |
1686 | <label class="right hidden-xs-only hidden-sm-only">Medical Notes:</label> | 1686 | <label class="right hidden-xs-only hidden-sm-only">Medical Notes:</label> |
1687 | <label | 1687 | <label |
1688 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1688 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1689 | >Medical:</label> | 1689 | >Medical:</label> |
1690 | </v-flex> | 1690 | </v-flex> |
1691 | <v-flex xs8 class="ml-3"> | 1691 | <v-flex xs8 class="ml-3"> |
1692 | <v-text-field | 1692 | <v-text-field |
1693 | v-model="addStudents.medicalNotes" | 1693 | v-model="addStudents.medicalNotes" |
1694 | placeholder="Fill your Medical Notes" | 1694 | placeholder="Fill your Medical Notes" |
1695 | required | 1695 | required |
1696 | ></v-text-field> | 1696 | ></v-text-field> |
1697 | </v-flex> | 1697 | </v-flex> |
1698 | </v-layout> | 1698 | </v-layout> |
1699 | </v-flex> | 1699 | </v-flex> |
1700 | </v-layout> | 1700 | </v-layout> |
1701 | <v-layout wrap> | 1701 | <v-layout wrap> |
1702 | <v-flex xs12 sm6> | 1702 | <v-flex xs12 sm6> |
1703 | <v-layout> | 1703 | <v-layout> |
1704 | <v-flex xs4 class="pt-4 subheading"> | 1704 | <v-flex xs4 class="pt-4 subheading"> |
1705 | <label class="right">Height:</label> | 1705 | <label class="right">Height:</label> |
1706 | </v-flex> | 1706 | </v-flex> |
1707 | <v-flex xs8 class="ml-3"> | 1707 | <v-flex xs8 class="ml-3"> |
1708 | <v-text-field | 1708 | <v-text-field |
1709 | v-model="addStudents.height" | 1709 | v-model="addStudents.height" |
1710 | placeholder="Fill your Height" | 1710 | placeholder="Fill your Height" |
1711 | required | 1711 | required |
1712 | ></v-text-field> | 1712 | ></v-text-field> |
1713 | </v-flex> | 1713 | </v-flex> |
1714 | </v-layout> | 1714 | </v-layout> |
1715 | </v-flex> | 1715 | </v-flex> |
1716 | <v-flex xs12 sm6> | 1716 | <v-flex xs12 sm6> |
1717 | <v-layout> | 1717 | <v-layout> |
1718 | <v-flex xs4 class="pt-4 subheading"> | 1718 | <v-flex xs4 class="pt-4 subheading"> |
1719 | <label class="right">Weight:</label> | 1719 | <label class="right">Weight:</label> |
1720 | </v-flex> | 1720 | </v-flex> |
1721 | <v-flex xs8 class="ml-3"> | 1721 | <v-flex xs8 class="ml-3"> |
1722 | <v-text-field | 1722 | <v-text-field |
1723 | v-model="addStudents.weight" | 1723 | v-model="addStudents.weight" |
1724 | placeholder="Fill your Weight" | 1724 | placeholder="Fill your Weight" |
1725 | required | 1725 | required |
1726 | ></v-text-field> | 1726 | ></v-text-field> |
1727 | </v-flex> | 1727 | </v-flex> |
1728 | </v-layout> | 1728 | </v-layout> |
1729 | </v-flex> | 1729 | </v-flex> |
1730 | </v-layout> | 1730 | </v-layout> |
1731 | <v-layout wrap> | 1731 | <v-layout wrap> |
1732 | <v-flex xs12 sm6> | 1732 | <v-flex xs12 sm6> |
1733 | <v-layout> | 1733 | <v-layout> |
1734 | <v-flex xs4 class="pt-4 subheading"> | 1734 | <v-flex xs4 class="pt-4 subheading"> |
1735 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 1735 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
1736 | <label | 1736 | <label |
1737 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1737 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1738 | >Uplaod :</label> | 1738 | >Uplaod :</label> |
1739 | </v-flex> | 1739 | </v-flex> |
1740 | <v-flex xs8 class="ml-3"> | 1740 | <v-flex xs8 class="ml-3"> |
1741 | <v-text-field | 1741 | <v-text-field |
1742 | label="Select Image" | 1742 | label="Select Image" |
1743 | @click="pickFile" | 1743 | @click="pickFile" |
1744 | v-model="imageName" | 1744 | v-model="imageName" |
1745 | append-icon="attach_file" | 1745 | append-icon="attach_file" |
1746 | ></v-text-field> | 1746 | ></v-text-field> |
1747 | </v-flex> | 1747 | </v-flex> |
1748 | </v-layout> | 1748 | </v-layout> |
1749 | </v-flex> | 1749 | </v-flex> |
1750 | <v-flex xs12 sm6> | 1750 | <v-flex xs12 sm6> |
1751 | <v-layout> | 1751 | <v-layout> |
1752 | <v-flex xs4 class="pt-4 subheading"> | 1752 | <v-flex xs4 class="pt-4 subheading"> |
1753 | <label class="right hidden-xs-only hidden-sm-only">Academic Year:</label> | 1753 | <label class="right hidden-xs-only hidden-sm-only">Academic Year:</label> |
1754 | <label | 1754 | <label |
1755 | class="right hidden-lg-only hidden-md-only hidden-xl-only" | 1755 | class="right hidden-lg-only hidden-md-only hidden-xl-only" |
1756 | >Year:</label> | 1756 | >Year:</label> |
1757 | </v-flex> | 1757 | </v-flex> |
1758 | <v-flex xs8 class="ml-3"> | 1758 | <v-flex xs8 class="ml-3"> |
1759 | <v-text-field | 1759 | <v-text-field |
1760 | v-model="addStudents.establishmentYear" | 1760 | v-model="addStudents.establishmentYear" |
1761 | placeholder="fill your Academic Year" | 1761 | placeholder="fill your Academic Year" |
1762 | name="state" | 1762 | name="state" |
1763 | type="number" | 1763 | type="number" |
1764 | :rules="establishmentYearRules" | 1764 | :rules="establishmentYearRules" |
1765 | required | 1765 | required |
1766 | ></v-text-field> | 1766 | ></v-text-field> |
1767 | </v-flex> | 1767 | </v-flex> |
1768 | </v-layout> | 1768 | </v-layout> |
1769 | </v-flex> | 1769 | </v-flex> |
1770 | </v-layout> | 1770 | </v-layout> |
1771 | <v-layout wrap class="hidden-xs-only hidden-sm-only"> | 1771 | <v-layout wrap class="hidden-xs-only hidden-sm-only"> |
1772 | <v-flex xs12 sm6> | 1772 | <v-flex xs12 sm6> |
1773 | <v-layout> | 1773 | <v-layout> |
1774 | <v-flex xs4 sm4 class="pt-4 subheading"> | 1774 | <v-flex xs4 sm4 class="pt-4 subheading"> |
1775 | <label class="right">Present Address:</label> | 1775 | <label class="right">Present Address:</label> |
1776 | </v-flex> | 1776 | </v-flex> |
1777 | <v-flex xs8 sm8 class="ml-3"> | 1777 | <v-flex xs8 sm8 class="ml-3"> |
1778 | <v-text-field | 1778 | <v-text-field |
1779 | v-model="addStudents.presentAddress" | 1779 | v-model="addStudents.presentAddress" |
1780 | :rules="presentAddress" | 1780 | :rules="presentAddress" |
1781 | placeholder="fill Your present Address" | 1781 | placeholder="fill Your present Address" |
1782 | @keyup="copyData" | 1782 | @keyup="copyData" |
1783 | ></v-text-field> | 1783 | ></v-text-field> |
1784 | </v-flex> | 1784 | </v-flex> |
1785 | </v-layout> | 1785 | </v-layout> |
1786 | </v-flex> | 1786 | </v-flex> |
1787 | <v-flex xs12 sm6> | 1787 | <v-flex xs12 sm6> |
1788 | <v-layout> | 1788 | <v-layout> |
1789 | <v-flex xs4 sm4 class="pt-4 subheading addressForm"> | 1789 | <v-flex xs4 sm4 class="pt-4 subheading addressForm"> |
1790 | <label class="right">Permanent Address:</label> | 1790 | <label class="right">Permanent Address:</label> |
1791 | </v-flex> | 1791 | </v-flex> |
1792 | <v-flex xs12 sm8 class="ml-3"> | 1792 | <v-flex xs12 sm8 class="ml-3"> |
1793 | <v-switch | 1793 | <v-switch |
1794 | v-model="addStudents.permanentAddress" | 1794 | v-model="addStudents.permanentAddress" |
1795 | label="Select Permanent Address" | 1795 | label="Select Permanent Address" |
1796 | :value="addStudents.presentAddress" | 1796 | :value="addStudents.presentAddress" |
1797 | ></v-switch> | 1797 | ></v-switch> |
1798 | </v-flex> | 1798 | </v-flex> |
1799 | </v-layout> | 1799 | </v-layout> |
1800 | </v-flex> | 1800 | </v-flex> |
1801 | </v-layout> | 1801 | </v-layout> |
1802 | <v-layout class="hidden-xs-only hidden-sm-only"> | 1802 | <v-layout class="hidden-xs-only hidden-sm-only"> |
1803 | <v-flex xs12 sm6> | 1803 | <v-flex xs12 sm6> |
1804 | <v-layout> | 1804 | <v-layout> |
1805 | <v-flex xs4 sm4 class="pt-4 subheading addressForm"> | 1805 | <v-flex xs4 sm4 class="pt-4 subheading addressForm"> |
1806 | <label class="right">Permanent Address:</label> | 1806 | <label class="right">Permanent Address:</label> |
1807 | </v-flex> | 1807 | </v-flex> |
1808 | <v-flex xs12 sm8 class="ml-3"> | 1808 | <v-flex xs12 sm8 class="ml-3"> |
1809 | <v-text-field | 1809 | <v-text-field |
1810 | v-model="addStudents.permanentAddress" | 1810 | v-model="addStudents.permanentAddress" |
1811 | :rules="permanentAddress" | 1811 | :rules="permanentAddress" |
1812 | placeholder="fill Your Permanent Address" | 1812 | placeholder="fill Your Permanent Address" |
1813 | ></v-text-field> | 1813 | ></v-text-field> |
1814 | </v-flex> | 1814 | </v-flex> |
1815 | </v-layout> | 1815 | </v-layout> |
1816 | </v-flex> | 1816 | </v-flex> |
1817 | </v-layout> | 1817 | </v-layout> |
1818 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> | 1818 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> |
1819 | <v-flex xs12 sm12> | 1819 | <v-flex xs12 sm12> |
1820 | <v-layout> | 1820 | <v-layout> |
1821 | <v-flex xs12 sm12 class="pt-4 subheading text-xs-center"> | 1821 | <v-flex xs12 sm12 class="pt-4 subheading text-xs-center"> |
1822 | <label class>Present Address:</label> | 1822 | <label class>Present Address:</label> |
1823 | </v-flex> | 1823 | </v-flex> |
1824 | </v-layout> | 1824 | </v-layout> |
1825 | <v-layout> | 1825 | <v-layout> |
1826 | <v-flex xs12 sm12> | 1826 | <v-flex xs12 sm12> |
1827 | <v-textarea | 1827 | <v-textarea |
1828 | name="input-4-3" | 1828 | name="input-4-3" |
1829 | v-model="addStudents.presentAddress" | 1829 | v-model="addStudents.presentAddress" |
1830 | :rules="presentAddress" | 1830 | :rules="presentAddress" |
1831 | placeholder="fill Your present Address" | 1831 | placeholder="fill Your present Address" |
1832 | required | 1832 | required |
1833 | ></v-textarea> | 1833 | ></v-textarea> |
1834 | </v-flex> | 1834 | </v-flex> |
1835 | </v-layout> | 1835 | </v-layout> |
1836 | </v-flex> | 1836 | </v-flex> |
1837 | <v-flex xs12 sm12> | 1837 | <v-flex xs12 sm12> |
1838 | <v-layout> | 1838 | <v-layout> |
1839 | <v-flex | 1839 | <v-flex |
1840 | xs12 | 1840 | xs12 |
1841 | sm12 | 1841 | sm12 |
1842 | class="pt-4 pr-4 subheading text-xs-center addressForm" | 1842 | class="pt-4 pr-4 subheading text-xs-center addressForm" |
1843 | > | 1843 | > |
1844 | <label>Permanent Address:</label> | 1844 | <label>Permanent Address:</label> |
1845 | </v-flex> | 1845 | </v-flex> |
1846 | </v-layout> | 1846 | </v-layout> |
1847 | <v-layout> | 1847 | <v-layout> |
1848 | <v-flex xs12 sm12> | 1848 | <v-flex xs12 sm12> |
1849 | <v-textarea | 1849 | <v-textarea |
1850 | name="input-4-3" | 1850 | name="input-4-3" |
1851 | v-model="addStudents.permanentAddress" | 1851 | v-model="addStudents.permanentAddress" |
1852 | :rules="permanentAddress" | 1852 | :rules="permanentAddress" |
1853 | placeholder="fill Your Permanent Address" | 1853 | placeholder="fill Your Permanent Address" |
1854 | required | 1854 | required |
1855 | ></v-textarea> | 1855 | ></v-textarea> |
1856 | </v-flex> | 1856 | </v-flex> |
1857 | </v-layout> | 1857 | </v-layout> |
1858 | </v-flex> | 1858 | </v-flex> |
1859 | </v-layout> | 1859 | </v-layout> |
1860 | <v-layout> | 1860 | <v-layout> |
1861 | <v-flex xs12 sm12> | 1861 | <v-flex xs12 sm12> |
1862 | <v-layout class="right"> | 1862 | <v-layout class="right"> |
1863 | <!-- <v-flex xs6> --> | 1863 | <!-- <v-flex xs6> --> |
1864 | <v-btn round dark @click="e2 = 1" class="clear-button">Back</v-btn> | 1864 | <v-btn round dark @click="e2 = 1" class="clear-button">Back</v-btn> |
1865 | <!-- </v-flex> | 1865 | <!-- </v-flex> |
1866 | <v-flex xs6>--> | 1866 | <v-flex xs6>--> |
1867 | <v-btn | 1867 | <v-btn |
1868 | @click="submit" | 1868 | @click="submit" |
1869 | round | 1869 | round |
1870 | dark | 1870 | dark |
1871 | :loading="loading" | 1871 | :loading="loading" |
1872 | class="add-button" | 1872 | class="add-button" |
1873 | >Add</v-btn> | 1873 | >Add</v-btn> |
1874 | <!-- </v-flex> --> | 1874 | <!-- </v-flex> --> |
1875 | </v-layout> | 1875 | </v-layout> |
1876 | </v-flex> | 1876 | </v-flex> |
1877 | </v-layout> | 1877 | </v-layout> |
1878 | </v-form> | 1878 | </v-form> |
1879 | </v-flex> | 1879 | </v-flex> |
1880 | </v-stepper-content> | 1880 | </v-stepper-content> |
1881 | </v-stepper-items> | 1881 | </v-stepper-items> |
1882 | </v-stepper> | 1882 | </v-stepper> |
1883 | </v-flex> | 1883 | </v-flex> |
1884 | </v-layout> | 1884 | </v-layout> |
1885 | </v-container> | 1885 | </v-container> |
1886 | </v-card> | 1886 | </v-card> |
1887 | </v-dialog> | 1887 | </v-dialog> |
1888 | <v-snackbar | 1888 | <v-snackbar |
1889 | :timeout="timeout" | 1889 | :timeout="timeout" |
1890 | :top="y === 'top'" | 1890 | :top="y === 'top'" |
1891 | :right="x === 'right'" | 1891 | :right="x === 'right'" |
1892 | :vertical="mode === 'vertical'" | 1892 | :vertical="mode === 'vertical'" |
1893 | v-model="snackbar" | 1893 | v-model="snackbar" |
1894 | :color="color" | 1894 | :color="color" |
1895 | >{{ text }}</v-snackbar> | 1895 | >{{ text }}</v-snackbar> |
1896 | <div class="loader" v-if="showLoader"> | 1896 | <div class="loader" v-if="showLoader"> |
1897 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 1897 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
1898 | </div> | 1898 | </div> |
1899 | </v-container> | 1899 | </v-container> |
1900 | </template> | 1900 | </template> |
1901 | 1901 | ||
1902 | <script> | 1902 | <script> |
1903 | import http from "@/Services/http.js"; | 1903 | import http from "@/Services/http.js"; |
1904 | import moment from "moment"; | 1904 | import moment from "moment"; |
1905 | import countryList from "@/script/country.js"; | 1905 | import countryList from "@/script/country.js"; |
1906 | import parent from "@/script/parents.js"; | 1906 | import parent from "@/script/parents.js"; |
1907 | 1907 | ||
1908 | export default { | 1908 | export default { |
1909 | data: () => ({ | 1909 | data: () => ({ |
1910 | e1: true, | 1910 | e1: true, |
1911 | e2: 0, | 1911 | e2: 0, |
1912 | showParent: true, | 1912 | showParent: true, |
1913 | showNext: false, | 1913 | showNext: false, |
1914 | snackbar: false, | 1914 | snackbar: false, |
1915 | y: "top", | 1915 | y: "top", |
1916 | x: "right", | 1916 | x: "right", |
1917 | role: "", | 1917 | role: "", |
1918 | mode: "", | 1918 | mode: "", |
1919 | append: "", | 1919 | append: "", |
1920 | timeout: 3000, | 1920 | timeout: 3000, |
1921 | text: "", | 1921 | text: "", |
1922 | show: true, | 1922 | show: true, |
1923 | color: "", | 1923 | color: "", |
1924 | showSearch: false, | 1924 | showSearch: false, |
1925 | showLoader: false, | 1925 | showLoader: false, |
1926 | loading: false, | 1926 | loading: false, |
1927 | editLoading: false, | 1927 | editLoading: false, |
1928 | date: null, | 1928 | date: null, |
1929 | search: "", | 1929 | search: "", |
1930 | password: "", | 1930 | password: "", |
1931 | menu: false, | 1931 | menu: false, |
1932 | menu1: false, | 1932 | menu1: false, |
1933 | editStudentDialog: false, | 1933 | editStudentDialog: false, |
1934 | profileStudentDialog: false, | 1934 | profileStudentDialog: false, |
1935 | addStudentDialog: false, | 1935 | addStudentDialog: false, |
1936 | valid: true, | 1936 | valid: true, |
1937 | addclass: [], | 1937 | addclass: [], |
1938 | addSection: [], | 1938 | addSection: [], |
1939 | gender: ["Male", "Female"], | 1939 | gender: ["Male", "Female"], |
1940 | pagination: { | 1940 | pagination: { |
1941 | rowsPerPage: 10, | 1941 | rowsPerPage: 10, |
1942 | }, | 1942 | }, |
1943 | imageData: {}, | 1943 | imageData: {}, |
1944 | imageName: "", | 1944 | imageName: "", |
1945 | imageUrl: "", | 1945 | imageUrl: "", |
1946 | imageFile: "", | 1946 | imageFile: "", |
1947 | editImageName: "", | 1947 | editImageName: "", |
1948 | editImageUrl: "", | 1948 | editImageUrl: "", |
1949 | nameRules: [(v) => !!v || " Full Name is required"], | 1949 | nameRules: [(v) => !!v || " Full Name is required"], |
1950 | dateRules: [(v) => !!v || " DOB is required"], | 1950 | dateRules: [(v) => !!v || " DOB is required"], |
1951 | cityRules: [(v) => !!v || " City Name is required"], | 1951 | cityRules: [(v) => !!v || " City Name is required"], |
1952 | pincode: [(v) => !!v || " Pincode is required"], | 1952 | pincode: [(v) => !!v || " Pincode is required"], |
1953 | country: [(v) => !!v || " Country Name is required"], | 1953 | country: [(v) => !!v || " Country Name is required"], |
1954 | rollNo: [(v) => !!v || "Roll No is required"], | 1954 | rollNo: [(v) => !!v || "Roll No is required"], |
1955 | permanentAddress: [(v) => !!v || " Permanent Address is required"], | 1955 | permanentAddress: [(v) => !!v || " Permanent Address is required"], |
1956 | presentAddress: [(v) => !!v || " Present Address is required"], | 1956 | presentAddress: [(v) => !!v || " Present Address is required"], |
1957 | stateRules: [(v) => !!v || "State Name is required"], | 1957 | stateRules: [(v) => !!v || "State Name is required"], |
1958 | classRules: [(v) => !!v || " Class Name is required"], | 1958 | classRules: [(v) => !!v || " Class Name is required"], |
1959 | sectionRules: [(v) => !!v || " Section Name is required"], | 1959 | sectionRules: [(v) => !!v || " Section Name is required"], |
1960 | genderRules: [(v) => !!v || " Select Gender is required"], | 1960 | genderRules: [(v) => !!v || " Select Gender is required"], |
1961 | fatheCellNoRules: [ | 1961 | fatheCellNoRules: [ |
1962 | (v) => !!v || " father Cell Number is required", | 1962 | (v) => !!v || " father Cell Number is required", |
1963 | (v) => v <= 10000000000 || "Max 10 characters is required", | 1963 | (v) => v <= 10000000000 || "Max 10 characters is required", |
1964 | ], | 1964 | ], |
1965 | password: [ | 1965 | password: [ |
1966 | (v) => !!v || "Password field is Required.", | 1966 | (v) => !!v || "Password field is Required.", |
1967 | // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 | 1967 | // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 |
1968 | ], | 1968 | ], |
1969 | mobileNoRule: [(v) => !!v || " Mobile Number is required"], | 1969 | mobileNoRule: [(v) => !!v || " Mobile Number is required"], |
1970 | establishmentYearRules: [(v) => !!v || " Academic Year is required"], | 1970 | establishmentYearRules: [(v) => !!v || " Academic Year is required"], |
1971 | errorMessages: "", | 1971 | errorMessages: "", |
1972 | countries: [], | 1972 | countries: [], |
1973 | headers: [ | 1973 | headers: [ |
1974 | { | 1974 | { |
1975 | text: "Roll No.", | 1975 | text: "Roll No.", |
1976 | align: "center", | 1976 | align: "center", |
1977 | sortable: false, | 1977 | sortable: false, |
1978 | value: "rollNo", | 1978 | value: "rollNo", |
1979 | }, | 1979 | }, |
1980 | { | 1980 | { |
1981 | text: "Profile Pic", | 1981 | text: "Profile Pic", |
1982 | value: "profilePicUrl", | 1982 | value: "profilePicUrl", |
1983 | sortable: false, | 1983 | sortable: false, |
1984 | align: "center", | 1984 | align: "center", |
1985 | }, | 1985 | }, |
1986 | { text: "Name", value: "name", sortable: false, align: "center" }, | 1986 | { text: "Name", value: "name", sortable: false, align: "center" }, |
1987 | { text: "Gender", value: "gender", sortable: false, align: "center" }, | 1987 | { text: "Gender", value: "gender", sortable: false, align: "center" }, |
1988 | { | 1988 | { |
1989 | text: "Father Name", | 1989 | text: "Father Name", |
1990 | value: "fatherName", | 1990 | value: "fatherName", |
1991 | sortable: false, | 1991 | sortable: false, |
1992 | align: "center", | 1992 | align: "center", |
1993 | }, | 1993 | }, |
1994 | { | 1994 | { |
1995 | text: "Mother Name", | 1995 | text: "Mother Name", |
1996 | value: "motherName", | 1996 | value: "motherName", |
1997 | sortable: false, | 1997 | sortable: false, |
1998 | align: "center", | 1998 | align: "center", |
1999 | }, | 1999 | }, |
2000 | { | 2000 | { |
2001 | text: "Academic Year", | 2001 | text: "Academic Year", |
2002 | value: "establishmentYear", | 2002 | value: "establishmentYear", |
2003 | sortable: false, | 2003 | sortable: false, |
2004 | align: "center", | 2004 | align: "center", |
2005 | }, | 2005 | }, |
2006 | // { text: "Mobile No", value: "mobile", sortable: false, align: "center" }, | 2006 | // { text: "Mobile No", value: "mobile", sortable: false, align: "center" }, |
2007 | { | 2007 | { |
2008 | text: "Status", | 2008 | text: "Status", |
2009 | value: "status", | 2009 | value: "status", |
2010 | sortable: false, | 2010 | sortable: false, |
2011 | align: "center", | 2011 | align: "center", |
2012 | }, | 2012 | }, |
2013 | { text: "Action", value: "", sortable: false, align: "center" }, | 2013 | { text: "Action", value: "", sortable: false, align: "center" }, |
2014 | ], | 2014 | ], |
2015 | studentsData: [], | 2015 | studentsData: [], |
2016 | parentId: "", | 2016 | parentId: "", |
2017 | editedIndex: -1, | 2017 | editedIndex: -1, |
2018 | parentData: {}, | 2018 | parentData: {}, |
2019 | addStudents: { | 2019 | addStudents: { |
2020 | role: "STUDENT", | 2020 | role: "STUDENT", |
2021 | name: "", | 2021 | name: "", |
2022 | email: "", | 2022 | email: "", |
2023 | date: "", | 2023 | date: "", |
2024 | city: "", | 2024 | city: "", |
2025 | pincode: "", | 2025 | pincode: "", |
2026 | country: "", | 2026 | country: "", |
2027 | permanentAddress: "", | 2027 | permanentAddress: "", |
2028 | presentAddress: "", | 2028 | presentAddress: "", |
2029 | mobile: "", | 2029 | mobile: "", |
2030 | state: "", | 2030 | state: "", |
2031 | gender: "", | 2031 | gender: "", |
2032 | select: "", | 2032 | select: "", |
2033 | selectSection: "", | 2033 | selectSection: "", |
2034 | bloodGroup: "", | 2034 | bloodGroup: "", |
2035 | allergies: "", | 2035 | allergies: "", |
2036 | medicalNotes: "", | 2036 | medicalNotes: "", |
2037 | height: "", | 2037 | height: "", |
2038 | weight: "", | 2038 | weight: "", |
2039 | rollNo: "", | 2039 | rollNo: "", |
2040 | establishmentYear: new Date().getFullYear(), | 2040 | establishmentYear: new Date().getFullYear(), |
2041 | }, | 2041 | }, |
2042 | selectStudents: { | 2042 | selectStudents: { |
2043 | select: "", | 2043 | select: "", |
2044 | selectSection: "", | 2044 | selectSection: "", |
2045 | }, | 2045 | }, |
2046 | editedItem: { | 2046 | editedItem: { |
2047 | role: "STUDENT", | 2047 | role: "STUDENT", |
2048 | name: "", | 2048 | name: "", |
2049 | email: "", | 2049 | email: "", |
2050 | dob: "", | 2050 | dob: "", |
2051 | city: "", | 2051 | city: "", |
2052 | pincode: "", | 2052 | pincode: "", |
2053 | country: "", | 2053 | country: "", |
2054 | permanentAddress: "", | 2054 | permanentAddress: "", |
2055 | presentAddress: "", | 2055 | presentAddress: "", |
2056 | mobile: "", | 2056 | mobile: "", |
2057 | state: "", | 2057 | state: "", |
2058 | gender: "", | 2058 | gender: "", |
2059 | select: "", | 2059 | select: "", |
2060 | selectSection: "", | 2060 | selectSection: "", |
2061 | bloodGroup: "", | 2061 | bloodGroup: "", |
2062 | allergies: "", | 2062 | allergies: "", |
2063 | medicalNotes: "", | 2063 | medicalNotes: "", |
2064 | height: "", | 2064 | height: "", |
2065 | weight: "", | 2065 | weight: "", |
2066 | rollNo: "", | 2066 | rollNo: "", |
2067 | establishmentYear: new Date().getFullYear(), | 2067 | establishmentYear: new Date().getFullYear(), |
2068 | }, | 2068 | }, |
2069 | isFatherCellExists: false, | 2069 | isFatherCellExists: false, |
2070 | }), | 2070 | }), |
2071 | watch: { | 2071 | watch: { |
2072 | menu(val) { | 2072 | menu(val) { |
2073 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 2073 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
2074 | }, | 2074 | }, |
2075 | menu1(val) { | 2075 | menu1(val) { |
2076 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 2076 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
2077 | }, | 2077 | }, |
2078 | addStudentDialog: function (val) { | ||
2079 | if (!val) { | ||
2080 | this.parentData = []; | ||
2081 | this.addStudents = []; | ||
2082 | this.imageName = ""; | ||
2083 | this.imageFile = ""; | ||
2084 | this.imageUrl = ""; | ||
2085 | } | ||
2086 | }, | ||
2078 | }, | 2087 | }, |
2079 | methods: { | 2088 | methods: { |
2080 | findStudents() { | 2089 | findStudents() { |
2081 | this.showLoader = true; | 2090 | this.showLoader = true; |
2082 | http() | 2091 | http() |
2083 | .get("/getStudentWithClass", { | 2092 | .get("/getStudentWithClass", { |
2084 | params: { | 2093 | params: { |
2085 | classId: this.selectStudents.select, | 2094 | classId: this.selectStudents.select, |
2086 | sectionId: this.selectStudents.selectSection, | 2095 | sectionId: this.selectStudents.selectSection, |
2087 | }, | 2096 | }, |
2088 | }) | 2097 | }) |
2089 | .then((response) => { | 2098 | .then((response) => { |
2090 | this.studentsData = response.data.data; | 2099 | this.studentsData = response.data.data; |
2091 | this.showLoader = false; | 2100 | this.showLoader = false; |
2092 | }) | 2101 | }) |
2093 | .catch((err) => { | 2102 | .catch((err) => { |
2094 | console.log("err====>", err); | 2103 | console.log("err====>", err); |
2095 | this.showLoader = false; | 2104 | this.showLoader = false; |
2096 | }); | 2105 | }); |
2097 | }, | 2106 | }, |
2098 | getSections(_id) { | 2107 | getSections(_id) { |
2099 | var token = this.$store.state.token; | 2108 | var token = this.$store.state.token; |
2100 | this.showLoader = true; | 2109 | this.showLoader = true; |
2101 | http() | 2110 | http() |
2102 | .get( | 2111 | .get( |
2103 | "/getSectionsList", | 2112 | "/getSectionsList", |
2104 | { params: { classId: _id } }, | 2113 | { params: { classId: _id } }, |
2105 | { | 2114 | { |
2106 | headers: { Authorization: "Bearer " + token }, | 2115 | headers: { Authorization: "Bearer " + token }, |
2107 | } | 2116 | } |
2108 | ) | 2117 | ) |
2109 | .then((response) => { | 2118 | .then((response) => { |
2110 | this.addSection = response.data.data; | 2119 | this.addSection = response.data.data; |
2111 | this.showLoader = false; | 2120 | this.showLoader = false; |
2112 | }) | 2121 | }) |
2113 | .catch((err) => { | 2122 | .catch((err) => { |
2114 | this.showLoader = false; | 2123 | this.showLoader = false; |
2115 | }); | 2124 | }); |
2116 | }, | 2125 | }, |
2117 | getSection(_id) { | 2126 | getSection(_id) { |
2118 | var token = this.$store.state.token; | 2127 | var token = this.$store.state.token; |
2119 | this.showLoader = true; | 2128 | this.showLoader = true; |
2120 | http() | 2129 | http() |
2121 | .get( | 2130 | .get( |
2122 | "/getSectionsList", | 2131 | "/getSectionsList", |
2123 | { params: { classId: _id } }, | 2132 | { params: { classId: _id } }, |
2124 | { | 2133 | { |
2125 | headers: { Authorization: "Bearer " + token }, | 2134 | headers: { Authorization: "Bearer " + token }, |
2126 | } | 2135 | } |
2127 | ) | 2136 | ) |
2128 | .then((response) => { | 2137 | .then((response) => { |
2129 | this.addSection = response.data.data; | 2138 | this.addSection = response.data.data; |
2130 | this.showLoader = false; | 2139 | this.showLoader = false; |
2131 | }) | 2140 | }) |
2132 | .catch((err) => { | 2141 | .catch((err) => { |
2133 | this.showLoader = false; | 2142 | this.showLoader = false; |
2134 | }); | 2143 | }); |
2135 | }, | 2144 | }, |
2136 | pickFile() { | 2145 | pickFile() { |
2137 | this.$refs.image.click(); | 2146 | this.$refs.image.click(); |
2138 | }, | 2147 | }, |
2139 | pickEditFile() { | 2148 | pickEditFile() { |
2140 | this.$refs.editDataImage.click(); | 2149 | this.$refs.editDataImage.click(); |
2141 | }, | 2150 | }, |
2142 | dates: function (date) { | 2151 | dates: function (date) { |
2143 | return moment(date).format("MMMM DD, YYYY"); | 2152 | return moment(date).format("MMMM DD, YYYY"); |
2144 | return date; | 2153 | return date; |
2145 | }, | 2154 | }, |
2146 | onFilePicked(e) { | 2155 | onFilePicked(e) { |
2147 | // console.log(e) | 2156 | // console.log(e) |
2148 | const files = e.target.files; | 2157 | const files = e.target.files; |
2149 | this.imageData.upload = e.target.files[0]; | 2158 | this.imageData.upload = e.target.files[0]; |
2150 | if (files[0] !== undefined) { | 2159 | if (files[0] !== undefined) { |
2151 | this.imageName = files[0].name; | 2160 | this.imageName = files[0].name; |
2152 | if (this.imageName.lastIndexOf(".") <= 0) { | 2161 | if (this.imageName.lastIndexOf(".") <= 0) { |
2153 | return; | 2162 | return; |
2154 | } | 2163 | } |
2155 | const fr = new FileReader(); | 2164 | const fr = new FileReader(); |
2156 | fr.readAsDataURL(files[0]); | 2165 | fr.readAsDataURL(files[0]); |
2157 | fr.addEventListener("load", () => { | 2166 | fr.addEventListener("load", () => { |
2158 | this.imageUrl = fr.result; | 2167 | this.imageUrl = fr.result; |
2159 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 2168 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
2160 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 2169 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
2161 | }); | 2170 | }); |
2162 | } else { | 2171 | } else { |
2163 | this.imageName = ""; | 2172 | this.imageName = ""; |
2164 | this.imageFile = ""; | 2173 | this.imageFile = ""; |
2165 | this.imageUrl = ""; | 2174 | this.imageUrl = ""; |
2166 | } | 2175 | } |
2167 | }, | 2176 | }, |
2168 | onEditFilePicked(e) { | 2177 | onEditFilePicked(e) { |
2169 | console.log(e); | 2178 | console.log(e); |
2170 | const files = e.target.files; | 2179 | const files = e.target.files; |
2171 | if (files[0] !== undefined) { | 2180 | if (files[0] !== undefined) { |
2172 | this.editImageName = files[0].name; | 2181 | this.editImageName = files[0].name; |
2173 | console.log("this.editImageName", this.editImageName); | 2182 | console.log("this.editImageName", this.editImageName); |
2174 | 2183 | ||
2175 | if (this.editImageName.lastIndexOf(".") <= 0) { | 2184 | if (this.editImageName.lastIndexOf(".") <= 0) { |
2176 | return; | 2185 | return; |
2177 | } | 2186 | } |
2178 | const fr = new FileReader(); | 2187 | const fr = new FileReader(); |
2179 | fr.readAsDataURL(files[0]); | 2188 | fr.readAsDataURL(files[0]); |
2180 | fr.addEventListener("load", () => { | 2189 | fr.addEventListener("load", () => { |
2181 | this.editImageUrl = fr.result; | 2190 | this.editImageUrl = fr.result; |
2182 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... | 2191 | this.editiImageFile = files[0]; // this is an image file that can be sent to server... |
2183 | }); | 2192 | }); |
2184 | } else { | 2193 | } else { |
2185 | this.editImageName = ""; | 2194 | this.editImageName = ""; |
2186 | this.editiImageFile = ""; | 2195 | this.editiImageFile = ""; |
2187 | } | 2196 | } |
2188 | }, | 2197 | }, |
2189 | editItem(item) { | 2198 | editItem(item) { |
2190 | this.editedIndex = this.studentsData.indexOf(item); | 2199 | this.editedIndex = this.studentsData.indexOf(item); |
2191 | this.editedItem = Object.assign({}, item); | 2200 | this.editedItem = Object.assign({}, item); |
2192 | this.editedItem.fatherName = item.parentId.fatherName; | 2201 | this.editedItem.fatherName = item.parentId.fatherName; |
2193 | this.editedItem.fatherCellNo = item.parentId.fatherCellNo; | 2202 | this.editedItem.fatherCellNo = item.parentId.fatherCellNo; |
2194 | this.editedItem.motherName = item.parentId.motherName; | 2203 | this.editedItem.motherName = item.parentId.motherName; |
2195 | this.editedItem.motherCellNo = item.parentId.motherCellNo; | 2204 | this.editedItem.motherCellNo = item.parentId.motherCellNo; |
2196 | this.editedItem.dob = | 2205 | this.editedItem.dob = |
2197 | this.editedItem.dob != undefined | 2206 | this.editedItem.dob != undefined |
2198 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) | 2207 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) |
2199 | : (this.editedItem.dob = ""); | 2208 | : (this.editedItem.dob = ""); |
2200 | this.editStudentDialog = true; | 2209 | this.editStudentDialog = true; |
2201 | }, | 2210 | }, |
2202 | profile(item) { | 2211 | profile(item) { |
2203 | this.editedIndex = this.studentsData.indexOf(item); | 2212 | this.editedIndex = this.studentsData.indexOf(item); |
2204 | this.editedItem = Object.assign({}, item); | 2213 | this.editedItem = Object.assign({}, item); |
2205 | this.editedItem.fatherName = item.parentId.fatherName; | 2214 | this.editedItem.fatherName = item.parentId.fatherName; |
2206 | this.editedItem.fatherCellNo = item.parentId.fatherCellNo; | 2215 | this.editedItem.fatherCellNo = item.parentId.fatherCellNo; |
2207 | this.editedItem.motherName = item.parentId.motherName; | 2216 | this.editedItem.motherName = item.parentId.motherName; |
2208 | this.editedItem.motherCellNo = item.parentId.motherCellNo; | 2217 | this.editedItem.motherCellNo = item.parentId.motherCellNo; |
2209 | 2218 | ||
2210 | this.profileStudentDialog = true; | 2219 | this.profileStudentDialog = true; |
2211 | }, | 2220 | }, |
2212 | deleteItem(item) { | 2221 | deleteItem(item) { |
2213 | let deleteStudent = { | 2222 | let deleteStudent = { |
2214 | studentId: item._id, | 2223 | studentId: item._id, |
2215 | }; | 2224 | }; |
2216 | http() | 2225 | http() |
2217 | .delete( | 2226 | .delete( |
2218 | "/deleteStudent", | 2227 | "/deleteStudent", |
2219 | confirm("Are you sure you want to delete this?") && { | 2228 | confirm("Are you sure you want to delete this?") && { |
2220 | params: deleteStudent, | 2229 | params: deleteStudent, |
2221 | } | 2230 | } |
2222 | ) | 2231 | ) |
2223 | .then((response) => { | 2232 | .then((response) => { |
2224 | this.snackbar = true; | 2233 | this.snackbar = true; |
2225 | this.text = response.data.message; | 2234 | this.text = response.data.message; |
2226 | this.color = "green"; | 2235 | this.color = "green"; |
2227 | this.findStudents(); | 2236 | this.findStudents(); |
2228 | }) | 2237 | }) |
2229 | .catch((error) => { | 2238 | .catch((error) => { |
2230 | this.snackbar = true; | 2239 | this.snackbar = true; |
2231 | this.text = error.response.data.message; | 2240 | this.text = error.response.data.message; |
2232 | this.color = "error"; | 2241 | this.color = "error"; |
2233 | }); | 2242 | }); |
2234 | }, | 2243 | }, |
2235 | close() { | 2244 | close() { |
2236 | this.editStudentDialog = false; | 2245 | this.editStudentDialog = false; |
2237 | }, | 2246 | }, |
2238 | closeStudentProfile() { | 2247 | closeStudentProfile() { |
2239 | this.profileStudentDialog = false; | 2248 | this.profileStudentDialog = false; |
2240 | }, | 2249 | }, |
2241 | copyData() { | 2250 | copyData() { |
2242 | this.addStudents.permanentAddress = this.addStudents.presentAddress; | 2251 | this.addStudents.permanentAddress = this.addStudents.presentAddress; |
2243 | }, | 2252 | }, |
2244 | submit() { | 2253 | submit() { |
2245 | if (this.$refs.form.validate()) { | 2254 | if (this.$refs.form.validate()) { |
2246 | let addStudent = { | 2255 | let addStudent = { |
2247 | parentId: this.parentId, | 2256 | parentId: this.parentId, |
2248 | name: this.addStudents.name, | 2257 | name: this.addStudents.name, |
2249 | email: this.addStudents.email, | 2258 | email: this.addStudents.email, |
2250 | role: this.addStudents.role, | 2259 | role: this.addStudents.role, |
2251 | dob: this.addStudents.date, | 2260 | dob: this.addStudents.date, |
2252 | city: this.addStudents.city, | 2261 | city: this.addStudents.city, |
2253 | pincode: this.addStudents.pincode, | 2262 | pincode: this.addStudents.pincode, |
2254 | country: this.addStudents.country, | 2263 | country: this.addStudents.country, |
2255 | permanentAddress: this.addStudents.permanentAddress, | 2264 | permanentAddress: this.addStudents.permanentAddress, |
2256 | presentAddress: this.addStudents.presentAddress, | 2265 | presentAddress: this.addStudents.presentAddress, |
2257 | mobile: this.addStudents.mobile, | 2266 | mobile: this.addStudents.mobile, |
2258 | state: this.addStudents.state, | 2267 | state: this.addStudents.state, |
2259 | gender: this.addStudents.gender, | 2268 | gender: this.addStudents.gender, |
2260 | establishmentYear: this.addStudents.establishmentYear, | 2269 | establishmentYear: this.addStudents.establishmentYear, |
2261 | classId: this.addStudents.select, | 2270 | classId: this.addStudents.select, |
2262 | sectionId: this.addStudents.selectSection, | 2271 | sectionId: this.addStudents.selectSection, |
2263 | bloodGroup: this.addStudents.bloodGroup, | 2272 | bloodGroup: this.addStudents.bloodGroup, |
2264 | medicalNotes: this.addStudents.medicalNotes, | 2273 | medicalNotes: this.addStudents.medicalNotes, |
2265 | height: this.addStudents.height, | 2274 | height: this.addStudents.height, |
2266 | weight: this.addStudents.weight, | 2275 | weight: this.addStudents.weight, |
2267 | rollNo: this.addStudents.rollNo, | 2276 | rollNo: this.addStudents.rollNo, |
2268 | }; | 2277 | }; |
2269 | if (this.imageUrl) { | 2278 | if (this.imageUrl) { |
2270 | var str = this.imageUrl; | 2279 | var str = this.imageUrl; |
2271 | const [baseUrl, imageUrl] = str.split(/,/); | 2280 | const [baseUrl, imageUrl] = str.split(/,/); |
2272 | addStudent.upload = imageUrl; | 2281 | addStudent.upload = imageUrl; |
2273 | } | 2282 | } |
2274 | this.loading = true; | 2283 | this.loading = true; |
2275 | http() | 2284 | http() |
2276 | .post("/createStudent", addStudent) | 2285 | .post("/createStudent", addStudent) |
2277 | .then((response) => { | 2286 | .then((response) => { |
2278 | this.snackbar = true; | 2287 | this.snackbar = true; |
2279 | this.text = "New Student added successfully"; | 2288 | this.text = "New Student added successfully"; |
2280 | this.color = "green"; | 2289 | this.color = "green"; |
2281 | this.addStudentDialog = false; | 2290 | this.addStudentDialog = false; |
2282 | this.$refs.parentForm.reset(); | 2291 | this.$refs.parentForm.reset(); |
2283 | this.$refs.parentFormLgScr.reset(); | 2292 | this.$refs.parentFormLgScr.reset(); |
2284 | this.$refs.form.reset(); | 2293 | this.$refs.form.reset(); |
2285 | this.e2 = 1; | 2294 | this.e2 = 1; |
2286 | // this.clear(); | 2295 | // this.clear(); |
2287 | // this.clearParents(); | 2296 | // this.clearParents(); |
2288 | this.loading = false; | 2297 | this.loading = false; |
2289 | }) | 2298 | }) |
2290 | .catch((error) => { | 2299 | .catch((error) => { |
2291 | this.snackbar = true; | 2300 | this.snackbar = true; |
2292 | this.text = error.response.data.message; | 2301 | this.text = error.response.data.message; |
2293 | this.color = "error"; | 2302 | this.color = "error"; |
2294 | this.loading = false; | 2303 | this.loading = false; |
2295 | }); | 2304 | }); |
2296 | } | 2305 | } |
2297 | }, | 2306 | }, |
2298 | clear() { | 2307 | clear() { |
2299 | this.$refs.form.reset(); | 2308 | this.$refs.form.reset(); |
2300 | this.imageUrl = ""; | 2309 | this.imageUrl = ""; |
2301 | }, | 2310 | }, |
2302 | clearParents() { | 2311 | clearParents() { |
2303 | this.$refs.parentForm.reset(); | 2312 | this.$refs.parentForm.reset(); |
2304 | }, | 2313 | }, |
2305 | save() { | 2314 | save() { |
2306 | let editStudent = { | 2315 | let editStudent = { |
2307 | studentId: this.editedItem._id, | 2316 | studentId: this.editedItem._id, |
2308 | name: this.editedItem.name, | 2317 | name: this.editedItem.name, |
2309 | email: this.editedItem.email, | 2318 | email: this.editedItem.email, |
2310 | role: this.editedItem.role, | 2319 | role: this.editedItem.role, |
2311 | dob: this.editedItem.dob, | 2320 | dob: this.editedItem.dob, |
2312 | city: this.editedItem.city, | 2321 | city: this.editedItem.city, |
2313 | pincode: this.editedItem.pincode, | 2322 | pincode: this.editedItem.pincode, |
2314 | country: this.editedItem.country, | 2323 | country: this.editedItem.country, |
2315 | permanentAddress: this.editedItem.permanentAddress, | 2324 | permanentAddress: this.editedItem.permanentAddress, |
2316 | presentAddress: this.editedItem.presentAddress, | 2325 | presentAddress: this.editedItem.presentAddress, |
2317 | mobile: this.editedItem.mobile, | 2326 | mobile: this.editedItem.mobile, |
2318 | state: this.editedItem.state, | 2327 | state: this.editedItem.state, |
2319 | gender: this.editedItem.gender, | 2328 | gender: this.editedItem.gender, |
2320 | establishmentYear: this.editedItem.establishmentYear, | 2329 | establishmentYear: this.editedItem.establishmentYear, |
2321 | classId: this.editedItem.select, | 2330 | classId: this.editedItem.select, |
2322 | sectionId: this.editedItem.selectSection, | 2331 | sectionId: this.editedItem.selectSection, |
2323 | bloodGroup: this.editedItem.bloodGroup, | 2332 | bloodGroup: this.editedItem.bloodGroup, |
2324 | medicalNotes: this.editedItem.medicalNotes, | 2333 | medicalNotes: this.editedItem.medicalNotes, |
2325 | height: this.editedItem.height, | 2334 | height: this.editedItem.height, |
2326 | weight: this.editedItem.weight, | 2335 | weight: this.editedItem.weight, |
2327 | rollNo: this.editedItem.rollNo, | 2336 | rollNo: this.editedItem.rollNo, |
2328 | }; | 2337 | }; |
2329 | if (this.editImageUrl) { | 2338 | if (this.editImageUrl) { |
2330 | var str = this.editImageUrl; | 2339 | var str = this.editImageUrl; |
2331 | const [baseUrl, editImageUrl] = str.split(/,/); | 2340 | const [baseUrl, editImageUrl] = str.split(/,/); |
2332 | editStudent.upload = editImageUrl; | 2341 | editStudent.upload = editImageUrl; |
2333 | } | 2342 | } |
2334 | this.editLoading = true; | 2343 | this.editLoading = true; |
2335 | http() | 2344 | http() |
2336 | .put("/updateStudent", editStudent) | 2345 | .put("/updateStudent", editStudent) |
2337 | .then((response) => { | 2346 | .then((response) => { |
2338 | this.snackbar = true; | 2347 | this.snackbar = true; |
2339 | this.text = response.data.message; | 2348 | this.text = response.data.message; |
2340 | this.color = "green"; | 2349 | this.color = "green"; |
2341 | this.imageUrl = ""; | 2350 | this.imageUrl = ""; |
2342 | this.findStudents(); | 2351 | this.findStudents(); |
2343 | this.close(); | 2352 | this.close(); |
2344 | this.editLoading = false; | 2353 | this.editLoading = false; |
2345 | }) | 2354 | }) |
2346 | .catch((error) => { | 2355 | .catch((error) => { |
2347 | this.snackbar = true; | 2356 | this.snackbar = true; |
2348 | this.text = error.response.data.statusText; | 2357 | this.text = error.response.data.statusText; |
2349 | this.color = "error"; | 2358 | this.color = "error"; |
2350 | this.editLoading = false; | 2359 | this.editLoading = false; |
2351 | }); | 2360 | }); |
2352 | }, | 2361 | }, |
2353 | submitParentDetails() { | 2362 | submitParentDetails() { |
2354 | if (this.$refs.parentForm.validate()) { | 2363 | if (this.$refs.parentForm.validate()) { |
2355 | this.parentData.fatherCellNo = this.parentData.fatherCellNo; | 2364 | this.parentData.fatherCellNo = this.parentData.fatherCellNo; |
2356 | this.parentData.motherCellNo = this.parentData.motherCellNo; | 2365 | this.parentData.motherCellNo = this.parentData.motherCellNo; |
2357 | let addparentDetails = { | 2366 | let addparentDetails = { |
2358 | email: this.parentData.email, | 2367 | email: this.parentData.email, |
2359 | fatherName: this.parentData.fatherName, | 2368 | fatherName: this.parentData.fatherName, |
2360 | fatherCellNo: this.parentData.fatherCellNo, | 2369 | fatherCellNo: this.parentData.fatherCellNo, |
2361 | motherName: this.parentData.motherName, | 2370 | motherName: this.parentData.motherName, |
2362 | motherCellNo: this.parentData.motherCellNo, | 2371 | motherCellNo: this.parentData.motherCellNo, |
2363 | fatherProfession: this.parentData.fatherProfession, | 2372 | fatherProfession: this.parentData.fatherProfession, |
2364 | motherProfession: this.parentData.motherProfession, | 2373 | motherProfession: this.parentData.motherProfession, |
2365 | password: this.parentData.password, | 2374 | password: this.parentData.password, |
2366 | role: "PARENT", | 2375 | role: "PARENT", |
2367 | }; | 2376 | }; |
2368 | this.loading = true; | 2377 | this.loading = true; |
2369 | http() | 2378 | http() |
2370 | .post("/createParent", addparentDetails) | 2379 | .post("/createParent", addparentDetails) |
2371 | .then((response) => { | 2380 | .then((response) => { |
2372 | this.parentId = response.data.data.id; | 2381 | this.parentId = response.data.data.id; |
2373 | this.e2 = 2; | 2382 | this.e2 = 2; |
2374 | this.snackbar = true; | 2383 | this.snackbar = true; |
2375 | this.text = response.data.message; | 2384 | this.text = response.data.message; |
2376 | this.color = "green"; | 2385 | this.color = "green"; |
2377 | // this.getStudentList(); | 2386 | // this.getStudentList(); |
2378 | this.clear(); | 2387 | this.clear(); |
2379 | this.loading = false; | 2388 | this.loading = false; |
2380 | }) | 2389 | }) |
2381 | .catch((error) => { | 2390 | .catch((error) => { |
2382 | this.snackbar = true; | 2391 | this.snackbar = true; |
2383 | this.text = error.response.data.message; | 2392 | this.text = error.response.data.message; |
2384 | this.color = "error"; | 2393 | this.color = "error"; |
2385 | if (error.response.data.statusText) { | 2394 | if (error.response.data.statusText) { |
2386 | this.text = error.response.data.statusText; | 2395 | this.text = error.response.data.statusText; |
2387 | } | 2396 | } |
2388 | this.loading = false; | 2397 | this.loading = false; |
2389 | }); | 2398 | }); |
2390 | } | 2399 | } |
2391 | }, | 2400 | }, |
2392 | getParentDetails() { | 2401 | getParentDetails() { |
2393 | if (this.parentData.fatherCellNo.length > 9) { | 2402 | if (this.parentData.fatherCellNo.length > 9) { |
2394 | this.showLoader = true; | 2403 | this.showLoader = true; |
2395 | this.isFatherCellExists = false; | 2404 | this.isFatherCellExists = false; |
2396 | http() | 2405 | http() |
2397 | .get("getParticularParent", { | 2406 | .get("getParticularParent", { |
2398 | params: { fatherCellNo: this.parentData.fatherCellNo }, | 2407 | params: { fatherCellNo: this.parentData.fatherCellNo }, |
2399 | headers: { | 2408 | headers: { |
2400 | Authorization: "Bearer " + this.$store.state.token, | 2409 | Authorization: "Bearer " + this.$store.state.token, |
2401 | }, | 2410 | }, |
2402 | }) | 2411 | }) |
2403 | .then((response) => { | 2412 | .then((response) => { |
2404 | this.showNext = true; | 2413 | this.showNext = true; |
2405 | this.showParent = false; | 2414 | this.showParent = false; |
2406 | this.parentData = response.data.data; | 2415 | this.parentData = response.data.data; |
2407 | this.parentId = response.data.data._id; | 2416 | this.parentId = response.data.data._id; |
2408 | this.showLoader = false; | 2417 | this.showLoader = false; |
2409 | this.isFatherCellExists = true; | 2418 | this.isFatherCellExists = true; |
2410 | }) | 2419 | }) |
2411 | .catch((error) => { | 2420 | .catch((error) => { |
2412 | console.log("err====>", error.response.data.message); | 2421 | console.log("err====>", error.response.data.message); |
2413 | this.text = error.response.data.message; | 2422 | this.text = error.response.data.message; |
2414 | this.snackbar = true; | 2423 | this.snackbar = true; |
2424 | this.color = "error"; | ||
2415 | if (this.text === "Data not found!") { | 2425 | if (this.text === "Data not found!") { |
2416 | this.showNext = false; | 2426 | this.showNext = false; |
2417 | this.showParent = true; | 2427 | this.showParent = true; |
2418 | this.parentData.email = ""; | 2428 | this.parentData.email = ""; |
2419 | this.parentData.fatherName = ""; | 2429 | this.parentData.fatherName = ""; |
2420 | this.parentData.motherName = ""; | 2430 | this.parentData.motherName = ""; |
2421 | this.parentData.motherCellNo = ""; | 2431 | this.parentData.motherCellNo = ""; |
2422 | this.parentData.fatherProfession = ""; | 2432 | this.parentData.fatherProfession = ""; |
2423 | this.parentData.motherProfession = ""; | 2433 | this.parentData.motherProfession = ""; |
2424 | this.parentData.password = ""; | 2434 | this.parentData.password = ""; |
2425 | } | 2435 | } |
2426 | this.showLoader = false; | 2436 | this.showLoader = false; |
2427 | }); | 2437 | }); |
2428 | } | 2438 | } |
2429 | }, | 2439 | }, |
2430 | suspendStudentStatus(status, id) { | 2440 | suspendStudentStatus(status, id) { |
2431 | let suspendStudentData = { | 2441 | let suspendStudentData = { |
2432 | studentId: id, | 2442 | studentId: id, |
2433 | status: status, | 2443 | status: status, |
2434 | }; | 2444 | }; |
2435 | http() | 2445 | http() |
2436 | .put("/suspendStudentAccount", suspendStudentData) | 2446 | .put("/suspendStudentAccount", suspendStudentData) |
2437 | .then((response) => { | 2447 | .then((response) => { |
2438 | this.findStudents(); | 2448 | this.findStudents(); |
2439 | this.text = response.data.message; | 2449 | this.text = response.data.message; |
2440 | this.color = "green"; | 2450 | this.color = "green"; |
2441 | this.snackbar = true; | 2451 | this.snackbar = true; |
2442 | }) | 2452 | }) |
2443 | .catch((error) => { | 2453 | .catch((error) => { |
2444 | this.snackbar = true; | 2454 | this.snackbar = true; |
2445 | this.color = "error"; | 2455 | this.color = "error"; |
2446 | this.text = error.response.data.message; | 2456 | this.text = error.response.data.message; |
2447 | }); | 2457 | }); |
2448 | }, | 2458 | }, |
2449 | displaySearch() { | 2459 | displaySearch() { |
2450 | (this.show = false), (this.showSearch = true); | 2460 | (this.show = false), (this.showSearch = true); |
2451 | }, | 2461 | }, |
2452 | closeSearch() { | 2462 | closeSearch() { |
2453 | this.showSearch = false; | 2463 | this.showSearch = false; |
2454 | this.show = true; | 2464 | this.show = true; |
2455 | this.search = ""; | 2465 | this.search = ""; |
2456 | }, | 2466 | }, |
2457 | }, | 2467 | }, |
2458 | mounted() { | 2468 | mounted() { |
2459 | const getCountryList = countryList(); | 2469 | const getCountryList = countryList(); |
2460 | this.role = this.$store.state.role; | 2470 | this.role = this.$store.state.role; |
2461 | this.countries = getCountryList; | 2471 | this.countries = getCountryList; |
2462 | var token = this.$store.state.token; | 2472 | var token = this.$store.state.token; |
2463 | http() | 2473 | http() |
2464 | .get("/getClassesList", { | 2474 | .get("/getClassesList", { |
2465 | headers: { Authorization: "Bearer " + token }, | 2475 | headers: { Authorization: "Bearer " + token }, |
2466 | }) | 2476 | }) |
2467 | .then((response) => { | 2477 | .then((response) => { |
2468 | this.addclass = response.data.data; | 2478 | this.addclass = response.data.data; |
2469 | }) | 2479 | }) |
2470 | .catch((error) => { | 2480 | .catch((error) => { |
2471 | this.showLoader = false; | 2481 | this.showLoader = false; |
2472 | if (error.response.status === 401) { | 2482 | if (error.response.status === 401) { |
2473 | this.$router.replace({ path: "/" }); | 2483 | this.$router.replace({ path: "/" }); |
2474 | this.$store.dispatch("setToken", null); | 2484 | this.$store.dispatch("setToken", null); |
2475 | this.$store.dispatch("Id", null); | 2485 | this.$store.dispatch("Id", null); |
2476 | this.$store.dispatch("Role", null); | 2486 | this.$store.dispatch("Role", null); |
2477 | } | 2487 | } |
2478 | }); | 2488 | }); |
2479 | }, | 2489 | }, |
2480 | }; | 2490 | }; |
2481 | </script> | 2491 | </script> |
2482 | <style scoped> | 2492 | <style scoped> |
2483 | .active { | 2493 | .active { |
2484 | background-color: gray; | 2494 | background-color: gray; |
2485 | color: white !important; | 2495 | color: white !important; |
2486 | } | 2496 | } |
2487 | .activebtn { | 2497 | .activebtn { |
2488 | color: black !important; | 2498 | color: black !important; |
2489 | } | 2499 | } |
2490 | </style> | 2500 | </style> |
src/pages/Teachers/teachers.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT TEACHERS DETAILS ****** --> | 3 | <!-- ****** EDIT TEACHERS DETAILS ****** --> |
4 | <v-dialog v-model="editTeacherDialog" max-width="1160px" scrollable> | 4 | <v-dialog v-model="editTeacherDialog" max-width="1160px" scrollable> |
5 | <v-card flat class="card-style" dark> | 5 | <v-card flat class="card-style" dark> |
6 | <v-card-text> | 6 | <v-card-text> |
7 | <v-layout> | 7 | <v-layout> |
8 | <v-flex xs12> | 8 | <v-flex xs12> |
9 | <label class="title text-xs-center">Edit Teacher Details</label> | 9 | <label class="title text-xs-center">Edit Teacher Details</label> |
10 | <v-icon size="24" class="right" @click="editTeacherDialog = false">cancel</v-icon> | 10 | <v-icon size="24" class="right" @click="editTeacherDialog = false">cancel</v-icon> |
11 | </v-flex> | 11 | </v-flex> |
12 | </v-layout> | 12 | </v-layout> |
13 | <v-container fluid> | 13 | <v-container fluid> |
14 | <v-layout> | 14 | <v-layout> |
15 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 15 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
16 | <v-avatar size="100px" v-if="!editedItem.profilePicUrl && !imageUrl"> | 16 | <v-avatar size="100px" v-if="!editedItem.profilePicUrl && !imageUrl"> |
17 | <img src="/static/icon/user.png" /> | 17 | <img src="/static/icon/user.png" /> |
18 | </v-avatar> | 18 | </v-avatar> |
19 | <img | 19 | <img |
20 | :src="editedItem.profilePicUrl" | 20 | :src="editedItem.profilePicUrl" |
21 | v-else-if="editedItem.profilePicUrl && !imageUrl" | 21 | v-else-if="editedItem.profilePicUrl && !imageUrl" |
22 | height="150" | 22 | height="150" |
23 | style="border-radius:50%; width:150px" | 23 | style="border-radius:50%; width:150px" |
24 | /> | 24 | /> |
25 | <img | 25 | <img |
26 | v-if="imageUrl" | 26 | v-if="imageUrl" |
27 | :src="imageUrl" | 27 | :src="imageUrl" |
28 | height="150" | 28 | height="150" |
29 | style="border-radius:50%; width:150px" | 29 | style="border-radius:50%; width:150px" |
30 | /> | 30 | /> |
31 | <input | 31 | <input |
32 | type="file" | 32 | type="file" |
33 | style="display:none" | 33 | style="display:none" |
34 | ref="image" | 34 | ref="image" |
35 | accept="image/*" | 35 | accept="image/*" |
36 | @change="onFilePicked" | 36 | @change="onFilePicked" |
37 | /> | 37 | /> |
38 | </v-flex> | 38 | </v-flex> |
39 | </v-layout> | 39 | </v-layout> |
40 | <v-layout wrap> | 40 | <v-layout wrap> |
41 | <v-flex xs12 sm6> | 41 | <v-flex xs12 sm6> |
42 | <v-layout> | 42 | <v-layout> |
43 | <v-flex xs4 class="pt-4 subheading"> | 43 | <v-flex xs4 class="pt-4 subheading"> |
44 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> | 44 | <label class="right hidden-xs-only hidden-sm-only">Full Name:</label> |
45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label> | 45 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Name:</label> |
46 | </v-flex> | 46 | </v-flex> |
47 | <v-flex xs8 class="ml-3"> | 47 | <v-flex xs8 class="ml-3"> |
48 | <v-text-field | 48 | <v-text-field |
49 | v-model="editedItem.name" | 49 | v-model="editedItem.name" |
50 | placeholder="fill your full Name" | 50 | placeholder="fill your full Name" |
51 | type="text" | 51 | type="text" |
52 | required | 52 | required |
53 | ></v-text-field> | 53 | ></v-text-field> |
54 | </v-flex> | 54 | </v-flex> |
55 | </v-layout> | 55 | </v-layout> |
56 | </v-flex> | 56 | </v-flex> |
57 | <v-flex xs12 sm6> | 57 | <v-flex xs12 sm6> |
58 | <v-layout> | 58 | <v-layout> |
59 | <v-flex xs4 sm4 class="pt-4 subheading"> | 59 | <v-flex xs4 sm4 class="pt-4 subheading"> |
60 | <label class="right">Email ID:</label> | 60 | <label class="right">Email ID:</label> |
61 | </v-flex> | 61 | </v-flex> |
62 | <v-flex xs8 sm8 class="ml-3"> | 62 | <v-flex xs8 sm8 class="ml-3"> |
63 | <v-text-field | 63 | <v-text-field |
64 | placeholder="fill your email" | 64 | placeholder="fill your email" |
65 | v-model="editedItem.email" | 65 | v-model="editedItem.email" |
66 | type="text" | 66 | type="text" |
67 | required | 67 | required |
68 | ></v-text-field> | 68 | ></v-text-field> |
69 | </v-flex> | 69 | </v-flex> |
70 | </v-layout> | 70 | </v-layout> |
71 | </v-flex> | 71 | </v-flex> |
72 | </v-layout> | 72 | </v-layout> |
73 | <v-layout wrap> | 73 | <v-layout wrap> |
74 | <v-flex xs12 sm6> | 74 | <v-flex xs12 sm6> |
75 | <v-layout> | 75 | <v-layout> |
76 | <v-flex xs4 class="pt-4 subheading"> | 76 | <v-flex xs4 class="pt-4 subheading"> |
77 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 77 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
78 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> | 78 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> |
79 | </v-flex> | 79 | </v-flex> |
80 | <v-flex xs8 class="ml-3"> | 80 | <v-flex xs8 class="ml-3"> |
81 | <v-menu | 81 | <v-menu |
82 | ref="menu" | 82 | ref="menu" |
83 | :close-on-content-click="false" | 83 | :close-on-content-click="false" |
84 | v-model="menu2" | 84 | v-model="menu2" |
85 | :nudge-right="40" | 85 | :nudge-right="40" |
86 | lazy | 86 | lazy |
87 | transition="scale-transition" | 87 | transition="scale-transition" |
88 | offset-y | 88 | offset-y |
89 | full-width | 89 | full-width |
90 | min-width="290px" | 90 | min-width="290px" |
91 | > | 91 | > |
92 | <v-text-field | 92 | <v-text-field |
93 | slot="activator" | 93 | slot="activator" |
94 | v-model="editedItem.dob" | 94 | v-model="editedItem.dob" |
95 | placeholder="Select date" | 95 | placeholder="Select date" |
96 | ></v-text-field> | 96 | ></v-text-field> |
97 | <v-date-picker | 97 | <v-date-picker |
98 | ref="picker" | 98 | ref="picker" |
99 | v-model="editedItem.dob" | 99 | v-model="editedItem.dob" |
100 | :max="new Date().toISOString().substr(0, 10)" | 100 | :max="new Date().toISOString().substr(0, 10)" |
101 | min="1950-01-01" | 101 | min="1950-01-01" |
102 | @input="menu2 = false" | 102 | @input="menu2 = false" |
103 | ></v-date-picker> | 103 | ></v-date-picker> |
104 | </v-menu> | 104 | </v-menu> |
105 | </v-flex> | 105 | </v-flex> |
106 | </v-layout> | 106 | </v-layout> |
107 | </v-flex> | 107 | </v-flex> |
108 | <v-flex xs12 sm6> | 108 | <v-flex xs12 sm6> |
109 | <v-layout> | 109 | <v-layout> |
110 | <v-flex xs4 class="pt-4 subheading"> | 110 | <v-flex xs4 class="pt-4 subheading"> |
111 | <label class="right">City:</label> | 111 | <label class="right">City:</label> |
112 | </v-flex> | 112 | </v-flex> |
113 | <v-flex xs8 class="ml-3"> | 113 | <v-flex xs8 class="ml-3"> |
114 | <v-text-field | 114 | <v-text-field |
115 | v-model="editedItem.city" | 115 | v-model="editedItem.city" |
116 | placeholder="fill your City Name" | 116 | placeholder="fill your City Name" |
117 | type="text" | 117 | type="text" |
118 | required | 118 | required |
119 | ></v-text-field> | 119 | ></v-text-field> |
120 | </v-flex> | 120 | </v-flex> |
121 | </v-layout> | 121 | </v-layout> |
122 | </v-flex> | 122 | </v-flex> |
123 | </v-layout> | 123 | </v-layout> |
124 | <v-layout wrap> | 124 | <v-layout wrap> |
125 | <v-flex xs12 sm6> | 125 | <v-flex xs12 sm6> |
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">State:</label> | 128 | <label class="right">State:</label> |
129 | </v-flex> | 129 | </v-flex> |
130 | <v-flex xs8 class="ml-3"> | 130 | <v-flex xs8 class="ml-3"> |
131 | <v-text-field | 131 | <v-text-field |
132 | v-model="editedItem.state" | 132 | v-model="editedItem.state" |
133 | placeholder="fill your State Name" | 133 | placeholder="fill your State Name" |
134 | type="text" | 134 | type="text" |
135 | required | 135 | required |
136 | ></v-text-field> | 136 | ></v-text-field> |
137 | </v-flex> | 137 | </v-flex> |
138 | </v-layout> | 138 | </v-layout> |
139 | </v-flex> | 139 | </v-flex> |
140 | <v-flex xs12 sm6> | 140 | <v-flex xs12 sm6> |
141 | <v-layout> | 141 | <v-layout> |
142 | <v-flex xs4 class="pt-4 subheading"> | 142 | <v-flex xs4 class="pt-4 subheading"> |
143 | <label class="right">PinCode:</label> | 143 | <label class="right">PinCode:</label> |
144 | </v-flex> | 144 | </v-flex> |
145 | <v-flex xs8 class="ml-3"> | 145 | <v-flex xs8 class="ml-3"> |
146 | <v-text-field | 146 | <v-text-field |
147 | v-model="editedItem.pincode" | 147 | v-model="editedItem.pincode" |
148 | placeholder="fill your pincode" | 148 | placeholder="fill your pincode" |
149 | type="number" | 149 | type="number" |
150 | required | 150 | required |
151 | ></v-text-field> | 151 | ></v-text-field> |
152 | </v-flex> | 152 | </v-flex> |
153 | </v-layout> | 153 | </v-layout> |
154 | </v-flex> | 154 | </v-flex> |
155 | </v-layout> | 155 | </v-layout> |
156 | <v-layout wrap> | 156 | <v-layout wrap> |
157 | <v-flex xs12 sm6> | 157 | <v-flex xs12 sm6> |
158 | <v-layout> | 158 | <v-layout> |
159 | <v-flex xs4 class="pt-4 subheading"> | 159 | <v-flex xs4 class="pt-4 subheading"> |
160 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> | 160 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> |
161 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> | 161 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> |
162 | </v-flex> | 162 | </v-flex> |
163 | <v-flex xs8 class="ml-3"> | 163 | <v-flex xs8 class="ml-3"> |
164 | <v-text-field | 164 | <v-text-field |
165 | v-model="editedItem.mobileNo" | 165 | v-model="editedItem.mobileNo" |
166 | placeholder="fill your MobileNo" | 166 | placeholder="fill your MobileNo" |
167 | type="number" | 167 | type="number" |
168 | required | 168 | required |
169 | ></v-text-field> | 169 | ></v-text-field> |
170 | </v-flex> | 170 | </v-flex> |
171 | </v-layout> | 171 | </v-layout> |
172 | </v-flex> | 172 | </v-flex> |
173 | <v-flex xs12 sm6> | 173 | <v-flex xs12 sm6> |
174 | <v-layout> | 174 | <v-layout> |
175 | <v-flex xs4 class="pt-4 subheading"> | 175 | <v-flex xs4 class="pt-4 subheading"> |
176 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> | 176 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> |
177 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> | 177 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> |
178 | </v-flex> | 178 | </v-flex> |
179 | <v-flex xs8 sm8 class="ml-3"> | 179 | <v-flex xs8 sm8 class="ml-3"> |
180 | <v-autocomplete | 180 | <v-autocomplete |
181 | v-model="editedItem.country" | 181 | v-model="editedItem.country" |
182 | :items="countries" | 182 | :items="countries" |
183 | placeholder="Select Country Name" | 183 | placeholder="Select Country Name" |
184 | required | 184 | required |
185 | ></v-autocomplete> | 185 | ></v-autocomplete> |
186 | </v-flex> | 186 | </v-flex> |
187 | </v-layout> | 187 | </v-layout> |
188 | </v-flex> | 188 | </v-flex> |
189 | </v-layout> | 189 | </v-layout> |
190 | <v-layout wrap> | 190 | <v-layout wrap> |
191 | <v-flex xs12 sm6> | 191 | <v-flex xs12 sm6> |
192 | <v-layout> | 192 | <v-layout> |
193 | <v-flex xs4 class="pt-4 subheading"> | 193 | <v-flex xs4 class="pt-4 subheading"> |
194 | <label class="right">Join Date:</label> | 194 | <label class="right">Join Date:</label> |
195 | </v-flex> | 195 | </v-flex> |
196 | <v-flex xs8 sm8 class="ml-3"> | 196 | <v-flex xs8 sm8 class="ml-3"> |
197 | <v-menu | 197 | <v-menu |
198 | ref="menu" | 198 | ref="menu" |
199 | :close-on-content-click="false" | 199 | :close-on-content-click="false" |
200 | v-model="menu3" | 200 | v-model="menu3" |
201 | :nudge-right="40" | 201 | :nudge-right="40" |
202 | lazy | 202 | lazy |
203 | transition="scale-transition" | 203 | transition="scale-transition" |
204 | offset-y | 204 | offset-y |
205 | full-width | 205 | full-width |
206 | min-width="290px" | 206 | min-width="290px" |
207 | > | 207 | > |
208 | <v-text-field | 208 | <v-text-field |
209 | slot="activator" | 209 | slot="activator" |
210 | v-model="editedItem.joinDate" | 210 | v-model="editedItem.joinDate" |
211 | placeholder="Select date" | 211 | placeholder="Select date" |
212 | ></v-text-field> | 212 | ></v-text-field> |
213 | <v-date-picker | 213 | <v-date-picker |
214 | ref="picker" | 214 | ref="picker" |
215 | v-model="editedItem.joinDate" | 215 | v-model="editedItem.joinDate" |
216 | :max="new Date().toISOString().substr(0, 10)" | 216 | :max="new Date().toISOString().substr(0, 10)" |
217 | min="1950-01-01" | 217 | min="1950-01-01" |
218 | @input="menu3 = false" | 218 | @input="menu3 = false" |
219 | ></v-date-picker> | 219 | ></v-date-picker> |
220 | </v-menu> | 220 | </v-menu> |
221 | </v-flex> | 221 | </v-flex> |
222 | </v-layout> | 222 | </v-layout> |
223 | </v-flex> | 223 | </v-flex> |
224 | <v-flex xs12 sm6> | 224 | <v-flex xs12 sm6> |
225 | <v-layout> | 225 | <v-layout> |
226 | <v-flex xs4 class="pt-4 subheading"> | 226 | <v-flex xs4 class="pt-4 subheading"> |
227 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 227 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
228 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> | 228 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod :</label> |
229 | </v-flex> | 229 | </v-flex> |
230 | <v-flex xs8 sm8 class="ml-3"> | 230 | <v-flex xs8 sm8 class="ml-3"> |
231 | <v-text-field | 231 | <v-text-field |
232 | label="Select Image" | 232 | label="Select Image" |
233 | @click="pickFile" | 233 | @click="pickFile" |
234 | v-model="imageName" | 234 | v-model="imageName" |
235 | append-icon="attach_file" | 235 | append-icon="attach_file" |
236 | ></v-text-field> | 236 | ></v-text-field> |
237 | </v-flex> | 237 | </v-flex> |
238 | </v-layout> | 238 | </v-layout> |
239 | </v-flex> | 239 | </v-flex> |
240 | </v-layout> | 240 | </v-layout> |
241 | <v-layout class="hidden-xs-only hidden-sm-only" wrap> | 241 | <v-layout class="hidden-xs-only hidden-sm-only" wrap> |
242 | <v-flex xs12 sm6> | 242 | <v-flex xs12 sm6> |
243 | <v-layout> | 243 | <v-layout> |
244 | <v-flex xs4 sm4 class="pt-4 subheading"> | 244 | <v-flex xs4 sm4 class="pt-4 subheading"> |
245 | <label class="right">Present Address:</label> | 245 | <label class="right">Present Address:</label> |
246 | </v-flex> | 246 | </v-flex> |
247 | <v-flex xs8 sm8 class="ml-3"> | 247 | <v-flex xs8 sm8 class="ml-3"> |
248 | <v-text-field | 248 | <v-text-field |
249 | name="input-4-3" | 249 | name="input-4-3" |
250 | v-model="editedItem.presentAddress" | 250 | v-model="editedItem.presentAddress" |
251 | placeholder="fill Your present Address" | 251 | placeholder="fill Your present Address" |
252 | required | 252 | required |
253 | ></v-text-field> | 253 | ></v-text-field> |
254 | </v-flex> | 254 | </v-flex> |
255 | </v-layout> | 255 | </v-layout> |
256 | </v-flex> | 256 | </v-flex> |
257 | <v-flex xs12 sm6> | 257 | <v-flex xs12 sm6> |
258 | <v-layout> | 258 | <v-layout> |
259 | <v-flex xs4 sm4 class="pt-4 subheading"> | 259 | <v-flex xs4 sm4 class="pt-4 subheading"> |
260 | <label class="right">Permanent Address:</label> | 260 | <label class="right">Permanent Address:</label> |
261 | </v-flex> | 261 | </v-flex> |
262 | <v-flex xs12 sm8 class="ml-3"> | 262 | <v-flex xs12 sm8 class="ml-3"> |
263 | <v-text-field | 263 | <v-text-field |
264 | name="input-4-3" | 264 | name="input-4-3" |
265 | v-model="editedItem.permanentAddress" | 265 | v-model="editedItem.permanentAddress" |
266 | placeholder="fill Your Permanent Address" | 266 | placeholder="fill Your Permanent Address" |
267 | required | 267 | required |
268 | ></v-text-field> | 268 | ></v-text-field> |
269 | </v-flex> | 269 | </v-flex> |
270 | </v-layout> | 270 | </v-layout> |
271 | </v-flex> | 271 | </v-flex> |
272 | </v-layout> | 272 | </v-layout> |
273 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> | 273 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> |
274 | <v-flex xs12 sm12> | 274 | <v-flex xs12 sm12> |
275 | <v-layout> | 275 | <v-layout> |
276 | <v-flex xs12 sm3 class="pt-4 subheading text-xs-center"> | 276 | <v-flex xs12 sm3 class="pt-4 subheading text-xs-center"> |
277 | <label class>Present Address:</label> | 277 | <label class>Present Address:</label> |
278 | </v-flex> | 278 | </v-flex> |
279 | </v-layout> | 279 | </v-layout> |
280 | <v-layout> | 280 | <v-layout> |
281 | <v-flex xs12 sm12> | 281 | <v-flex xs12 sm12> |
282 | <v-textarea | 282 | <v-textarea |
283 | name="input-4-3" | 283 | name="input-4-3" |
284 | v-model="editedItem.presentAddress" | 284 | v-model="editedItem.presentAddress" |
285 | placeholder="fill Your present Address" | 285 | placeholder="fill Your present Address" |
286 | required | 286 | required |
287 | ></v-textarea> | 287 | ></v-textarea> |
288 | </v-flex> | 288 | </v-flex> |
289 | </v-layout> | 289 | </v-layout> |
290 | </v-flex> | 290 | </v-flex> |
291 | <v-flex xs12 sm12> | 291 | <v-flex xs12 sm12> |
292 | <v-layout> | 292 | <v-layout> |
293 | <v-flex xs12 sm3 class="pt-4 pr-4 subheading text-xs-center addressForm"> | 293 | <v-flex xs12 sm3 class="pt-4 pr-4 subheading text-xs-center addressForm"> |
294 | <label>Permanent Address:</label> | 294 | <label>Permanent Address:</label> |
295 | </v-flex> | 295 | </v-flex> |
296 | </v-layout> | 296 | </v-layout> |
297 | <v-layout> | 297 | <v-layout> |
298 | <v-flex xs12 sm12> | 298 | <v-flex xs12 sm12> |
299 | <v-textarea | 299 | <v-textarea |
300 | name="input-4-3" | 300 | name="input-4-3" |
301 | v-model="editedItem.permanentAddress" | 301 | v-model="editedItem.permanentAddress" |
302 | placeholder="fill Your Permanent Address" | 302 | placeholder="fill Your Permanent Address" |
303 | required | 303 | required |
304 | ></v-textarea> | 304 | ></v-textarea> |
305 | </v-flex> | 305 | </v-flex> |
306 | </v-layout> | 306 | </v-layout> |
307 | </v-flex> | 307 | </v-flex> |
308 | </v-layout> | 308 | </v-layout> |
309 | <v-layout> | 309 | <v-layout> |
310 | <v-flex xs12 sm12> | 310 | <v-flex xs12 sm12> |
311 | <v-flex xs12 sm12> | 311 | <v-flex xs12 sm12> |
312 | <v-layout class="right"> | 312 | <v-layout class="right"> |
313 | <v-btn @click="save" round dark :loading="loading" class="add-button">Save</v-btn> | 313 | <v-btn @click="save" round dark :loading="loading" class="add-button">Save</v-btn> |
314 | </v-layout> | 314 | </v-layout> |
315 | </v-flex> | 315 | </v-flex> |
316 | </v-flex> | 316 | </v-flex> |
317 | </v-layout> | 317 | </v-layout> |
318 | </v-container> | 318 | </v-container> |
319 | </v-card-text> | 319 | </v-card-text> |
320 | </v-card> | 320 | </v-card> |
321 | </v-dialog> | 321 | </v-dialog> |
322 | 322 | ||
323 | <!-- ****** PROFILE VIEW TEACHERS DETAILS ****** --> | 323 | <!-- ****** PROFILE VIEW TEACHERS DETAILS ****** --> |
324 | 324 | ||
325 | <v-dialog v-model="viewTeacherProfileDialog" max-width="500px" scrollable> | 325 | <v-dialog v-model="viewTeacherProfileDialog" max-width="500px" scrollable> |
326 | <v-card flat class="card-style pa-3" dark> | 326 | <v-card flat class="card-style pa-3" dark> |
327 | <v-layout> | 327 | <v-layout> |
328 | <v-flex xs12> | 328 | <v-flex xs12> |
329 | <label class="title text-xs-center">View Teacher</label> | 329 | <label class="title text-xs-center">View Teacher</label> |
330 | <v-icon size="24" class="right" @click="viewTeacherProfileDialog = false">cancel</v-icon> | 330 | <v-icon size="24" class="right" @click="viewTeacherProfileDialog = false">cancel</v-icon> |
331 | </v-flex> | 331 | </v-flex> |
332 | </v-layout> | 332 | </v-layout> |
333 | <v-card-text> | 333 | <v-card-text> |
334 | <v-container grid-list-md> | 334 | <v-container grid-list-md> |
335 | <v-layout wrap> | 335 | <v-layout wrap> |
336 | <v-flex> | 336 | <v-flex> |
337 | <v-flex align-center justify-center layout text-xs-center> | 337 | <v-flex align-center justify-center layout text-xs-center> |
338 | <v-avatar size="80"> | 338 | <v-avatar size="80"> |
339 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 339 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
340 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> | 340 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> |
341 | </v-avatar> | 341 | </v-avatar> |
342 | </v-flex> | 342 | </v-flex> |
343 | <v-layout> | 343 | <v-layout> |
344 | <v-flex xs5 sm6> | 344 | <v-flex xs5 sm6> |
345 | <h5 class="right my-1"> | 345 | <h5 class="right my-1"> |
346 | <b>Full Name:</b> | 346 | <b>Full Name:</b> |
347 | </h5> | 347 | </h5> |
348 | </v-flex> | 348 | </v-flex> |
349 | <v-flex sm6 xs8> | 349 | <v-flex sm6 xs8> |
350 | <h5 class="my-1">{{ editedItem.name }}</h5> | 350 | <h5 class="my-1">{{ editedItem.name }}</h5> |
351 | </v-flex> | 351 | </v-flex> |
352 | </v-layout> | 352 | </v-layout> |
353 | <v-layout> | 353 | <v-layout> |
354 | <v-flex xs5 sm6> | 354 | <v-flex xs5 sm6> |
355 | <h5 class="right my-1"> | 355 | <h5 class="right my-1"> |
356 | <b>Email:</b> | 356 | <b>Email:</b> |
357 | </h5> | 357 | </h5> |
358 | </v-flex> | 358 | </v-flex> |
359 | <v-flex sm6 xs8> | 359 | <v-flex sm6 xs8> |
360 | <h5 class="my-1">{{ editedItem.email }}</h5> | 360 | <h5 class="my-1">{{ editedItem.email }}</h5> |
361 | </v-flex> | 361 | </v-flex> |
362 | </v-layout> | 362 | </v-layout> |
363 | <v-layout> | 363 | <v-layout> |
364 | <v-flex xs5 sm6> | 364 | <v-flex xs5 sm6> |
365 | <h5 class="right my-1"> | 365 | <h5 class="right my-1"> |
366 | <b>City:</b> | 366 | <b>City:</b> |
367 | </h5> | 367 | </h5> |
368 | </v-flex> | 368 | </v-flex> |
369 | <v-flex sm6 xs8> | 369 | <v-flex sm6 xs8> |
370 | <h5 class="my-1">{{ editedItem.city }}</h5> | 370 | <h5 class="my-1">{{ editedItem.city }}</h5> |
371 | </v-flex> | 371 | </v-flex> |
372 | </v-layout> | 372 | </v-layout> |
373 | <v-layout> | 373 | <v-layout> |
374 | <v-flex xs5 sm6> | 374 | <v-flex xs5 sm6> |
375 | <h5 class="right my-1"> | 375 | <h5 class="right my-1"> |
376 | <b>State:</b> | 376 | <b>State:</b> |
377 | </h5> | 377 | </h5> |
378 | </v-flex> | 378 | </v-flex> |
379 | <v-flex sm6 xs8> | 379 | <v-flex sm6 xs8> |
380 | <h5 class="my-1">{{ editedItem.state }}</h5> | 380 | <h5 class="my-1">{{ editedItem.state }}</h5> |
381 | </v-flex> | 381 | </v-flex> |
382 | </v-layout> | 382 | </v-layout> |
383 | <v-layout> | 383 | <v-layout> |
384 | <v-flex xs5 sm6> | 384 | <v-flex xs5 sm6> |
385 | <h5 class="right my-1"> | 385 | <h5 class="right my-1"> |
386 | <b>Country:</b> | 386 | <b>Country:</b> |
387 | </h5> | 387 | </h5> |
388 | </v-flex> | 388 | </v-flex> |
389 | <v-flex sm6 xs8> | 389 | <v-flex sm6 xs8> |
390 | <h5 class="my-1">{{ editedItem.country }}</h5> | 390 | <h5 class="my-1">{{ editedItem.country }}</h5> |
391 | </v-flex> | 391 | </v-flex> |
392 | </v-layout> | 392 | </v-layout> |
393 | <v-layout> | 393 | <v-layout> |
394 | <v-flex xs5 sm6> | 394 | <v-flex xs5 sm6> |
395 | <h5 class="right my-1"> | 395 | <h5 class="right my-1"> |
396 | <b>Pincode:</b> | 396 | <b>Pincode:</b> |
397 | </h5> | 397 | </h5> |
398 | </v-flex> | 398 | </v-flex> |
399 | <v-flex sm6 xs8> | 399 | <v-flex sm6 xs8> |
400 | <h5 class="my-1">{{ editedItem.pincode }}</h5> | 400 | <h5 class="my-1">{{ editedItem.pincode }}</h5> |
401 | </v-flex> | 401 | </v-flex> |
402 | </v-layout> | 402 | </v-layout> |
403 | <v-layout> | 403 | <v-layout> |
404 | <v-flex xs5 sm6> | 404 | <v-flex xs5 sm6> |
405 | <h5 class="right my-1"> | 405 | <h5 class="right my-1"> |
406 | <b>Mobile No:</b> | 406 | <b>Mobile No:</b> |
407 | </h5> | 407 | </h5> |
408 | </v-flex> | 408 | </v-flex> |
409 | <v-flex sm6 xs8> | 409 | <v-flex sm6 xs8> |
410 | <h5 class="my-1">{{ editedItem.mobileNo }}</h5> | 410 | <h5 class="my-1">{{ editedItem.mobileNo }}</h5> |
411 | </v-flex> | 411 | </v-flex> |
412 | </v-layout> | 412 | </v-layout> |
413 | <v-layout> | 413 | <v-layout> |
414 | <v-flex xs5 sm6> | 414 | <v-flex xs5 sm6> |
415 | <h5 class="right my-1"> | 415 | <h5 class="right my-1"> |
416 | <b>Join Date:</b> | 416 | <b>Join Date:</b> |
417 | </h5> | 417 | </h5> |
418 | </v-flex> | 418 | </v-flex> |
419 | <v-flex sm6 xs8> | 419 | <v-flex sm6 xs8> |
420 | <h5 class="my-1">{{ dates(editedItem.joinDate) }}</h5> | 420 | <h5 class="my-1">{{ dates(editedItem.joinDate) }}</h5> |
421 | </v-flex> | 421 | </v-flex> |
422 | </v-layout> | 422 | </v-layout> |
423 | <v-layout> | 423 | <v-layout> |
424 | <v-flex xs5 sm6> | 424 | <v-flex xs5 sm6> |
425 | <h5 class="right my-1"> | 425 | <h5 class="right my-1"> |
426 | <b>D.O.B :</b> | 426 | <b>D.O.B :</b> |
427 | </h5> | 427 | </h5> |
428 | </v-flex> | 428 | </v-flex> |
429 | <v-flex sm6 xs8> | 429 | <v-flex sm6 xs8> |
430 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> | 430 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> |
431 | </v-flex> | 431 | </v-flex> |
432 | </v-layout> | 432 | </v-layout> |
433 | <v-layout> | 433 | <v-layout> |
434 | <v-flex xs6 sm6> | 434 | <v-flex xs6 sm6> |
435 | <h5 class="right my-1"> | 435 | <h5 class="right my-1"> |
436 | <b>Permanent Address:</b> | 436 | <b>Permanent Address:</b> |
437 | </h5> | 437 | </h5> |
438 | </v-flex> | 438 | </v-flex> |
439 | <v-flex sm6 xs8> | 439 | <v-flex sm6 xs8> |
440 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> | 440 | <h5 class="my-1">{{ editedItem.permanentAddress }}</h5> |
441 | </v-flex> | 441 | </v-flex> |
442 | </v-layout> | 442 | </v-layout> |
443 | <v-layout> | 443 | <v-layout> |
444 | <v-flex xs6 sm6> | 444 | <v-flex xs6 sm6> |
445 | <h5 class="right my-1"> | 445 | <h5 class="right my-1"> |
446 | <b>present Address:</b> | 446 | <b>present Address:</b> |
447 | </h5> | 447 | </h5> |
448 | </v-flex> | 448 | </v-flex> |
449 | <v-flex sm6 xs8> | 449 | <v-flex sm6 xs8> |
450 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> | 450 | <h5 class="my-1">{{ editedItem.presentAddress }}</h5> |
451 | </v-flex> | 451 | </v-flex> |
452 | </v-layout> | 452 | </v-layout> |
453 | </v-flex> | 453 | </v-flex> |
454 | </v-layout> | 454 | </v-layout> |
455 | </v-container> | 455 | </v-container> |
456 | </v-card-text> | 456 | </v-card-text> |
457 | </v-card> | 457 | </v-card> |
458 | </v-dialog> | 458 | </v-dialog> |
459 | <!-- ****** EXISTING-Teachers TABLE DATA****** --> | 459 | <!-- ****** EXISTING-Teachers TABLE DATA****** --> |
460 | <v-toolbar color="transparent" flat> | 460 | <v-toolbar color="transparent" flat> |
461 | <v-btn | 461 | <v-btn |
462 | fab | 462 | fab |
463 | dark | 463 | dark |
464 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 464 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
465 | small | 465 | small |
466 | @click="addTeacherDialog = true" | 466 | @click="addTeacherDialog = true" |
467 | > | 467 | > |
468 | <v-icon dark>add</v-icon> | 468 | <v-icon dark>add</v-icon> |
469 | </v-btn> | 469 | </v-btn> |
470 | <v-btn | 470 | <v-btn |
471 | v-if="role != 'TEACHER' " | 471 | v-if="role != 'TEACHER' " |
472 | round | 472 | round |
473 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 473 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
474 | dark | 474 | dark |
475 | @click="addTeacherDialog = true" | 475 | @click="addTeacherDialog = true" |
476 | > | 476 | > |
477 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Teacher | 477 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Teacher |
478 | </v-btn> | 478 | </v-btn> |
479 | <v-spacer></v-spacer> | 479 | <v-spacer></v-spacer> |
480 | <v-card-title class="body-1" v-show="show"> | 480 | <v-card-title class="body-1" v-show="show"> |
481 | <v-btn icon large flat @click="displaySearch"> | 481 | <v-btn icon large flat @click="displaySearch"> |
482 | <v-avatar size="27"> | 482 | <v-avatar size="27"> |
483 | <img src="/static/icon/search.png" alt="icon" /> | 483 | <img src="/static/icon/search.png" alt="icon" /> |
484 | </v-avatar> | 484 | </v-avatar> |
485 | </v-btn> | 485 | </v-btn> |
486 | </v-card-title> | 486 | </v-card-title> |
487 | <v-flex md2 lg2 sm6 xs8 v-if="showSearch"> | 487 | <v-flex md2 lg2 sm6 xs8 v-if="showSearch"> |
488 | <v-layout> | 488 | <v-layout> |
489 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 489 | <v-text-field |
490 | autofocus | ||
491 | v-model="search" | ||
492 | label="Search" | ||
493 | prepend-inner-icon="search" | ||
494 | color="primary" | ||
495 | ></v-text-field> | ||
490 | <v-icon @click="closeSearch" color="error">close</v-icon> | 496 | <v-icon @click="closeSearch" color="error">close</v-icon> |
491 | </v-layout> | 497 | </v-layout> |
492 | </v-flex> | 498 | </v-flex> |
493 | </v-toolbar> | 499 | </v-toolbar> |
494 | <v-data-table | 500 | <v-data-table |
495 | :headers="headers" | 501 | :headers="headers" |
496 | :items="desserts" | 502 | :items="desserts" |
497 | :pagination.sync="pagination" | 503 | :pagination.sync="pagination" |
498 | :search="search" | 504 | :search="search" |
499 | > | 505 | > |
500 | <template slot="items" slot-scope="props"> | 506 | <template slot="items" slot-scope="props"> |
501 | <tr class="tr"> | 507 | <tr class="tr"> |
502 | <td class="td td-row">{{ props.index + 1}}</td> | 508 | <td class="td td-row">{{ props.index + 1}}</td> |
503 | <td class="td td-row text-xs-center"> | 509 | <td class="td td-row text-xs-center"> |
504 | <v-avatar size="40"> | 510 | <v-avatar size="40"> |
505 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 511 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
506 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 512 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
507 | </v-avatar> | 513 | </v-avatar> |
508 | </td> | 514 | </td> |
509 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> | 515 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
510 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> | 516 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
511 | <td class="td td-row text-xs-center">{{ dates(props.item.dob) }}</td> | 517 | <td class="td td-row text-xs-center">{{ dates(props.item.dob) }}</td> |
512 | <td class="td td-row text-xs-center">{{ dates(props.item.joinDate)}}</td> | 518 | <td class="td td-row text-xs-center">{{ dates(props.item.joinDate)}}</td> |
513 | <td class="td td-row text-xs-center">{{ props.item.mobileNo }}</td> | 519 | <td class="td td-row text-xs-center">{{ props.item.mobileNo }}</td> |
514 | <td class="td td-row text-xs-center"> | 520 | <td class="td td-row text-xs-center"> |
515 | <v-switch | 521 | <v-switch |
516 | class="pl-3" | 522 | class="pl-3" |
517 | v-model="props.item.status" | 523 | v-model="props.item.status" |
518 | @change="suspendStatus(props.item.status,props.item._id)" | 524 | @change="suspendStatus(props.item.status,props.item._id)" |
519 | ></v-switch> | 525 | ></v-switch> |
520 | </td> | 526 | </td> |
521 | <td class="text-xs-center td td-row"> | 527 | <td class="text-xs-center td td-row"> |
522 | <span> | 528 | <span> |
523 | <v-tooltip top> | 529 | <v-tooltip top> |
524 | <img | 530 | <img |
525 | slot="activator" | 531 | slot="activator" |
526 | style="cursor:pointer; width:25px; height:25px; " | 532 | style="cursor:pointer; width:25px; height:25px; " |
527 | class="mr-3" | 533 | class="mr-3" |
528 | @click="profile(props.item)" | 534 | @click="profile(props.item)" |
529 | src="/static/icon/view.png" | 535 | src="/static/icon/view.png" |
530 | /> | 536 | /> |
531 | <span>View</span> | 537 | <span>View</span> |
532 | </v-tooltip> | 538 | </v-tooltip> |
533 | <v-tooltip top v-if="role != 'TEACHER' "> | 539 | <v-tooltip top v-if="role != 'TEACHER' "> |
534 | <img | 540 | <img |
535 | slot="activator" | 541 | slot="activator" |
536 | style="cursor:pointer; width:20px; height:18px; " | 542 | style="cursor:pointer; width:20px; height:18px; " |
537 | class="mr-3" | 543 | class="mr-3" |
538 | @click="editItem(props.item)" | 544 | @click="editItem(props.item)" |
539 | src="/static/icon/edit.png" | 545 | src="/static/icon/edit.png" |
540 | /> | 546 | /> |
541 | <span>Edit</span> | 547 | <span>Edit</span> |
542 | </v-tooltip> | 548 | </v-tooltip> |
543 | <!-- <v-tooltip top v-if="role != 'TEACHER' "> | 549 | <!-- <v-tooltip top v-if="role != 'TEACHER' "> |
544 | <img | 550 | <img |
545 | slot="activator" | 551 | slot="activator" |
546 | style="cursor:pointer; width:20px; height:20px; " | 552 | style="cursor:pointer; width:20px; height:20px; " |
547 | @click="deleteItem(props.item)" | 553 | @click="deleteItem(props.item)" |
548 | src="/static/icon/delete.png" | 554 | src="/static/icon/delete.png" |
549 | class="mr-3" | 555 | class="mr-3" |
550 | /> | 556 | /> |
551 | <span>Delete</span> | 557 | <span>Delete</span> |
552 | </v-tooltip> --> | 558 | </v-tooltip>--> |
553 | </span> | 559 | </span> |
554 | </td> | 560 | </td> |
555 | </tr> | 561 | </tr> |
556 | </template> | 562 | </template> |
557 | <v-alert | 563 | <v-alert |
558 | slot="no-results" | 564 | slot="no-results" |
559 | :value="true" | 565 | :value="true" |
560 | color="error" | 566 | color="error" |
561 | icon="warning" | 567 | icon="warning" |
562 | >Your search for "{{ search }}" found no results.</v-alert> | 568 | >Your search for "{{ search }}" found no results.</v-alert> |
563 | </v-data-table> | 569 | </v-data-table> |
564 | 570 | ||
565 | <!-- ****** DIALOG BOX - Add Teachers Data****** --> | 571 | <!-- ****** DIALOG BOX - Add Teachers Data****** --> |
566 | <v-dialog v-model="addTeacherDialog" max-width="1160"> | 572 | <v-dialog v-model="addTeacherDialog" max-width="1160" v-if="addTeacherDialog"> |
567 | <v-card flat class="card-style pa-2" dark> | 573 | <v-card flat class="card-style pa-2" dark> |
568 | <v-layout> | 574 | <v-layout> |
569 | <v-flex xs12 class="pa-0"> | 575 | <v-flex xs12 class="pa-0"> |
570 | <label class="title text-xs-center">Add Teacher</label> | 576 | <label class="title text-xs-center">Add Teacher</label> |
571 | <v-icon size="24" class="right" @click="$refs.form.reset();addTeacherDialog = false">cancel</v-icon> | 577 | <v-icon |
578 | size="24" | ||
579 | class="right" | ||
580 | @click="$refs.form.reset();addTeacherDialog = false" | ||
581 | >cancel</v-icon> | ||
572 | </v-flex> | 582 | </v-flex> |
573 | </v-layout> | 583 | </v-layout> |
574 | <v-form ref="form" v-model="valid" lazy-validation> | 584 | <v-form ref="form" v-model="valid" lazy-validation> |
575 | <v-container fluid> | 585 | <v-container fluid> |
576 | <v-layout> | 586 | <v-layout> |
577 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 587 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
578 | <v-avatar size="120px"> | 588 | <v-avatar size="120px"> |
579 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 589 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
580 | </v-avatar> | 590 | </v-avatar> |
581 | <img | 591 | <img |
582 | :src="imageUrl" | 592 | :src="imageUrl" |
583 | height="150" | 593 | height="150" |
584 | v-if="imageUrl" | 594 | v-if="imageUrl" |
585 | style="border-radius:50%; width:150px" | 595 | style="border-radius:50%; width:150px" |
586 | /> | 596 | /> |
587 | </v-flex> | 597 | </v-flex> |
588 | </v-layout> | 598 | </v-layout> |
589 | <v-layout wrap> | 599 | <v-layout wrap> |
590 | <v-flex xs12 sm6> | 600 | <v-flex xs12 sm6> |
591 | <v-layout> | 601 | <v-layout> |
592 | <v-flex xs4 class="pt-4 subheading"> | 602 | <v-flex xs4 class="pt-4 subheading"> |
593 | <label class="right hidden-sm-only hidden-xs-only">Full Name:</label> | 603 | <label class="right hidden-sm-only hidden-xs-only">Full Name:</label> |
594 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Full Name</label> | 604 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Full Name</label> |
595 | </v-flex> | 605 | </v-flex> |
596 | <v-flex xs8 class="ml-3"> | 606 | <v-flex xs8 class="ml-3"> |
597 | <v-text-field | 607 | <v-text-field |
598 | v-model="addTeachers.name" | 608 | v-model="addTeachers.name" |
599 | placeholder="fill your full Name" | 609 | placeholder="fill your full Name" |
600 | name="name" | 610 | name="name" |
601 | type="text" | 611 | type="text" |
602 | :rules="nameRules" | 612 | :rules="nameRules" |
603 | required | 613 | required |
604 | ></v-text-field> | 614 | ></v-text-field> |
605 | </v-flex> | 615 | </v-flex> |
606 | </v-layout> | 616 | </v-layout> |
607 | </v-flex> | 617 | </v-flex> |
608 | <v-flex xs12 sm6> | 618 | <v-flex xs12 sm6> |
609 | <v-layout> | 619 | <v-layout> |
610 | <v-flex xs4 class="pt-4 subheading"> | 620 | <v-flex xs4 class="pt-4 subheading"> |
611 | <label class="right">Email ID:</label> | 621 | <label class="right">Email ID:</label> |
612 | </v-flex> | 622 | </v-flex> |
613 | <v-flex xs8 class="ml-3"> | 623 | <v-flex xs8 class="ml-3"> |
614 | <v-text-field | 624 | <v-text-field |
615 | placeholder="fill your email" | 625 | placeholder="fill your email" |
616 | v-model="addTeachers.email" | 626 | v-model="addTeachers.email" |
617 | type="text" | 627 | type="text" |
618 | name="email" | 628 | name="email" |
619 | required | 629 | required |
620 | ></v-text-field> | 630 | ></v-text-field> |
621 | </v-flex> | 631 | </v-flex> |
622 | </v-layout> | 632 | </v-layout> |
623 | </v-flex> | 633 | </v-flex> |
624 | </v-layout> | 634 | </v-layout> |
625 | <v-layout wrap> | 635 | <v-layout wrap> |
626 | <v-flex xs12 sm6> | 636 | <v-flex xs12 sm6> |
627 | <v-layout> | 637 | <v-layout> |
628 | <v-flex xs4 sm4 class="pt-4 subheading"> | 638 | <v-flex xs4 sm4 class="pt-4 subheading"> |
629 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 639 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
630 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> | 640 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> |
631 | </v-flex> | 641 | </v-flex> |
632 | <v-flex xs8 class="ml-3"> | 642 | <v-flex xs8 class="ml-3"> |
633 | <v-menu | 643 | <v-menu |
634 | ref="menu" | 644 | ref="menu" |
635 | :close-on-content-click="false" | 645 | :close-on-content-click="false" |
636 | v-model="menu" | 646 | v-model="menu" |
637 | :nudge-right="40" | 647 | :nudge-right="40" |
638 | lazy | 648 | lazy |
639 | transition="scale-transition" | 649 | transition="scale-transition" |
640 | offset-y | 650 | offset-y |
641 | full-width | 651 | full-width |
642 | min-width="290px" | 652 | min-width="290px" |
643 | > | 653 | > |
644 | <v-text-field | 654 | <v-text-field |
645 | slot="activator" | 655 | slot="activator" |
646 | :rules="dateRules" | 656 | :rules="dateRules" |
647 | v-model="addTeachers.date" | 657 | v-model="addTeachers.date" |
648 | placeholder="Select date" | 658 | placeholder="Select date" |
649 | ></v-text-field> | 659 | ></v-text-field> |
650 | <v-date-picker | 660 | <v-date-picker |
651 | ref="picker" | 661 | ref="picker" |
652 | v-model="addTeachers.date" | 662 | v-model="addTeachers.date" |
653 | :max="new Date().toISOString().substr(0, 10)" | 663 | :max="new Date().toISOString().substr(0, 10)" |
654 | min="1950-01-01" | 664 | min="1950-01-01" |
655 | @input="menu = false" | 665 | @input="menu = false" |
656 | ></v-date-picker> | 666 | ></v-date-picker> |
657 | </v-menu> | 667 | </v-menu> |
658 | </v-flex> | 668 | </v-flex> |
659 | </v-layout> | 669 | </v-layout> |
660 | </v-flex> | 670 | </v-flex> |
661 | <v-flex xs12 sm6> | 671 | <v-flex xs12 sm6> |
662 | <v-layout> | 672 | <v-layout> |
663 | <v-flex xs4 class="pt-4 subheading"> | 673 | <v-flex xs4 class="pt-4 subheading"> |
664 | <label class="right">City:</label> | 674 | <label class="right">City:</label> |
665 | </v-flex> | 675 | </v-flex> |
666 | <v-flex xs8 class="ml-3"> | 676 | <v-flex xs8 class="ml-3"> |
667 | <v-text-field | 677 | <v-text-field |
668 | v-model="addTeachers.city" | 678 | v-model="addTeachers.city" |
669 | placeholder="fill your City Name" | 679 | placeholder="fill your City Name" |
670 | name="City" | 680 | name="City" |
671 | type="text" | 681 | type="text" |
672 | :rules="cityRules" | 682 | :rules="cityRules" |
673 | required | 683 | required |
674 | ></v-text-field> | 684 | ></v-text-field> |
675 | </v-flex> | 685 | </v-flex> |
676 | </v-layout> | 686 | </v-layout> |
677 | </v-flex> | 687 | </v-flex> |
678 | </v-layout> | 688 | </v-layout> |
679 | <v-layout wrap> | 689 | <v-layout wrap> |
680 | <v-flex xs12 sm6> | 690 | <v-flex xs12 sm6> |
681 | <v-layout> | 691 | <v-layout> |
682 | <v-flex xs4 class="pt-4 subheading"> | 692 | <v-flex xs4 class="pt-4 subheading"> |
683 | <label class="right">State:</label> | 693 | <label class="right">State:</label> |
684 | </v-flex> | 694 | </v-flex> |
685 | <v-flex xs8 class="ml-3"> | 695 | <v-flex xs8 class="ml-3"> |
686 | <v-text-field | 696 | <v-text-field |
687 | v-model="addTeachers.state" | 697 | v-model="addTeachers.state" |
688 | placeholder="fill your State Name" | 698 | placeholder="fill your State Name" |
689 | name="state" | 699 | name="state" |
690 | type="text" | 700 | type="text" |
691 | :rules="stateRules" | 701 | :rules="stateRules" |
692 | required | 702 | required |
693 | ></v-text-field> | 703 | ></v-text-field> |
694 | </v-flex> | 704 | </v-flex> |
695 | </v-layout> | 705 | </v-layout> |
696 | </v-flex> | 706 | </v-flex> |
697 | <v-flex xs12 sm6> | 707 | <v-flex xs12 sm6> |
698 | <v-layout> | 708 | <v-layout> |
699 | <v-flex xs4 class="pt-4 subheading"> | 709 | <v-flex xs4 class="pt-4 subheading"> |
700 | <label class="right">PinCode:</label> | 710 | <label class="right">PinCode:</label> |
701 | </v-flex> | 711 | </v-flex> |
702 | <v-flex xs8 class="ml-3"> | 712 | <v-flex xs8 class="ml-3"> |
703 | <v-text-field | 713 | <v-text-field |
704 | v-model="addTeachers.pincode" | 714 | v-model="addTeachers.pincode" |
705 | placeholder="fill your pincode" | 715 | placeholder="fill your pincode" |
706 | name="pincode" | 716 | name="pincode" |
707 | type="number" | 717 | type="number" |
708 | :rules="pincode" | 718 | :rules="pincode" |
709 | required | 719 | required |
710 | ></v-text-field> | 720 | ></v-text-field> |
711 | </v-flex> | 721 | </v-flex> |
712 | </v-layout> | 722 | </v-layout> |
713 | </v-flex> | 723 | </v-flex> |
714 | </v-layout> | 724 | </v-layout> |
715 | <v-layout wrap> | 725 | <v-layout wrap> |
716 | <v-flex xs12 sm6> | 726 | <v-flex xs12 sm6> |
717 | <v-layout> | 727 | <v-layout> |
718 | <v-flex xs4 class="pt-4 subheading"> | 728 | <v-flex xs4 class="pt-4 subheading"> |
719 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> | 729 | <label class="right hidden-xs-only hidden-sm-only">Mobile No:</label> |
720 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> | 730 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Mobile:</label> |
721 | </v-flex> | 731 | </v-flex> |
722 | <v-flex xs8 class="ml-3"> | 732 | <v-flex xs8 class="ml-3"> |
723 | <v-text-field | 733 | <v-text-field |
724 | v-model="addTeachers.mobileNo" | 734 | v-model="addTeachers.mobileNo" |
725 | placeholder="fill your Mobile No." | 735 | placeholder="fill your Mobile No." |
726 | name="mobileNo" | 736 | name="mobileNo" |
727 | type="number" | 737 | type="number" |
728 | :rules="mobileNoRules" | 738 | :rules="mobileNoRules" |
729 | required | 739 | required |
730 | ></v-text-field> | 740 | ></v-text-field> |
731 | </v-flex> | 741 | </v-flex> |
732 | </v-layout> | 742 | </v-layout> |
733 | </v-flex> | 743 | </v-flex> |
734 | <v-flex xs12 sm6> | 744 | <v-flex xs12 sm6> |
735 | <v-layout> | 745 | <v-layout> |
736 | <v-flex xs4 class="pt-4 subheading"> | 746 | <v-flex xs4 class="pt-4 subheading"> |
737 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> | 747 | <label class="right hidden-xs-only hidden-sm-only">Select Country:</label> |
738 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> | 748 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Country:</label> |
739 | </v-flex> | 749 | </v-flex> |
740 | <v-flex xs8 class="ml-3"> | 750 | <v-flex xs8 class="ml-3"> |
741 | <v-autocomplete | 751 | <v-autocomplete |
742 | v-model="addTeachers.country" | 752 | v-model="addTeachers.country" |
743 | :rules="country" | 753 | :rules="country" |
744 | :items="countries" | 754 | :items="countries" |
745 | placeholder="Select Country Name" | 755 | placeholder="Select Country Name" |
746 | required | 756 | required |
747 | ></v-autocomplete> | 757 | ></v-autocomplete> |
748 | </v-flex> | 758 | </v-flex> |
749 | </v-layout> | 759 | </v-layout> |
750 | </v-flex> | 760 | </v-flex> |
751 | </v-layout> | 761 | </v-layout> |
752 | <v-layout wrap> | 762 | <v-layout wrap> |
753 | <v-flex xs12 sm6> | 763 | <v-flex xs12 sm6> |
754 | <v-layout> | 764 | <v-layout> |
755 | <v-flex xs4 class="pt-4 subheading"> | 765 | <v-flex xs4 class="pt-4 subheading"> |
756 | <label class="right">Join Date:</label> | 766 | <label class="right">Join Date:</label> |
757 | </v-flex> | 767 | </v-flex> |
758 | <v-flex xs8 class="ml-3"> | 768 | <v-flex xs8 class="ml-3"> |
759 | <v-menu | 769 | <v-menu |
760 | ref="menu1" | 770 | ref="menu1" |
761 | :close-on-content-click="false" | 771 | :close-on-content-click="false" |
762 | v-model="menu1" | 772 | v-model="menu1" |
763 | :nudge-right="40" | 773 | :nudge-right="40" |
764 | lazy | 774 | lazy |
765 | transition="scale-transition" | 775 | transition="scale-transition" |
766 | offset-y | 776 | offset-y |
767 | full-width | 777 | full-width |
768 | min-width="290px" | 778 | min-width="290px" |
769 | > | 779 | > |
770 | <v-text-field | 780 | <v-text-field |
771 | slot="activator" | 781 | slot="activator" |
772 | :rules="joinDateRules" | 782 | :rules="joinDateRules" |
773 | v-model="addTeachers.joinDate" | 783 | v-model="addTeachers.joinDate" |
774 | placeholder="Select date" | 784 | placeholder="Select date" |
775 | ></v-text-field> | 785 | ></v-text-field> |
776 | <v-date-picker | 786 | <v-date-picker |
777 | ref="picker" | 787 | ref="picker" |
778 | v-model="addTeachers.joinDate" | 788 | v-model="addTeachers.joinDate" |
779 | :max="new Date().toISOString().substr(0, 10)" | 789 | :max="new Date().toISOString().substr(0, 10)" |
780 | min="1950-01-01" | 790 | min="1950-01-01" |
781 | @input="menu1 = false" | 791 | @input="menu1 = false" |
782 | ></v-date-picker> | 792 | ></v-date-picker> |
783 | </v-menu> | 793 | </v-menu> |
784 | </v-flex> | 794 | </v-flex> |
785 | </v-layout> | 795 | </v-layout> |
786 | </v-flex> | 796 | </v-flex> |
787 | <v-flex xs12 sm6> | 797 | <v-flex xs12 sm6> |
788 | <v-layout> | 798 | <v-layout> |
789 | <v-flex xs4 class="pt-4 subheading"> | 799 | <v-flex xs4 class="pt-4 subheading"> |
790 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> | 800 | <label class="right hidden-xs-only hidden-sm-only">Uplaod Image:</label> |
791 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> | 801 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Uplaod:</label> |
792 | </v-flex> | 802 | </v-flex> |
793 | <v-flex xs8 class="ml-3"> | 803 | <v-flex xs8 class="ml-3"> |
794 | <v-text-field | 804 | <v-text-field |
795 | label="Select Image" | 805 | label="Select Image" |
796 | @click="pickFile" | 806 | @click="pickFile" |
797 | v-model="imageName" | 807 | v-model="imageName" |
798 | append-icon="attach_file" | 808 | append-icon="attach_file" |
799 | ></v-text-field> | 809 | ></v-text-field> |
800 | <input | 810 | <input |
801 | type="file" | 811 | type="file" |
802 | style="display:none" | 812 | style="display:none" |
803 | ref="image" | 813 | ref="image" |
804 | accept="image/*" | 814 | accept="image/*" |
805 | @change="onFilePicked" | 815 | @change="onFilePicked" |
806 | /> | 816 | /> |
807 | </v-flex> | 817 | </v-flex> |
808 | </v-layout> | 818 | </v-layout> |
809 | </v-flex> | 819 | </v-flex> |
810 | </v-layout> | 820 | </v-layout> |
811 | <v-layout class="hidden-xs-only hidden-sm-only"> | 821 | <v-layout class="hidden-xs-only hidden-sm-only"> |
812 | <v-flex xs12 sm6> | 822 | <v-flex xs12 sm6> |
813 | <v-layout> | 823 | <v-layout> |
814 | <v-flex xs4 md4 class="pt-4 subheading"> | 824 | <v-flex xs4 md4 class="pt-4 subheading"> |
815 | <label class="right">Present Address:</label> | 825 | <label class="right">Present Address:</label> |
816 | </v-flex> | 826 | </v-flex> |
817 | <v-flex xs8 md8 class="ml-3"> | 827 | <v-flex xs8 md8 class="ml-3"> |
818 | <v-text-field | 828 | <v-text-field |
819 | name="input-4-3" | 829 | name="input-4-3" |
820 | v-model="addTeachers.presentAddress" | 830 | v-model="addTeachers.presentAddress" |
821 | :rules="presentAddress" | 831 | :rules="presentAddress" |
822 | placeholder="fill Your present Address" | 832 | placeholder="fill Your present Address" |
823 | @keyup="copyData" | 833 | @keyup="copyData" |
824 | ></v-text-field> | 834 | ></v-text-field> |
825 | </v-flex> | 835 | </v-flex> |
826 | </v-layout> | 836 | </v-layout> |
827 | </v-flex> | 837 | </v-flex> |
828 | <v-flex xs12 sm6> | 838 | <v-flex xs12 sm6> |
829 | <v-layout> | 839 | <v-layout> |
830 | <v-flex xs4 md4 class="pt-4 subheading addressForm"> | 840 | <v-flex xs4 md4 class="pt-4 subheading addressForm"> |
831 | <label class="right">Permanent Address:</label> | 841 | <label class="right">Permanent Address:</label> |
832 | </v-flex> | 842 | </v-flex> |
833 | <v-flex xs12 md8 class="ml-3"> | 843 | <v-flex xs12 md8 class="ml-3"> |
834 | <v-switch | 844 | <v-switch |
835 | v-model="addTeachers.permanentAddress" | 845 | v-model="addTeachers.permanentAddress" |
836 | label="Select Permanent Address" | 846 | label="Select Permanent Address" |
837 | :value="addTeachers.presentAddress" | 847 | :value="addTeachers.presentAddress" |
838 | ></v-switch> | 848 | ></v-switch> |
839 | </v-flex> | 849 | </v-flex> |
840 | </v-layout> | 850 | </v-layout> |
841 | </v-flex> | 851 | </v-flex> |
842 | </v-layout> | 852 | </v-layout> |
843 | <v-layout class="hidden-xs-only hidden-sm-only"> | 853 | <v-layout class="hidden-xs-only hidden-sm-only"> |
844 | <v-flex xs12 sm6> | 854 | <v-flex xs12 sm6> |
845 | <v-layout> | 855 | <v-layout> |
846 | <v-flex xs4 md4 class="pt-4 subheading addressForm"> | 856 | <v-flex xs4 md4 class="pt-4 subheading addressForm"> |
847 | <label class="right">Permanent Address:</label> | 857 | <label class="right">Permanent Address:</label> |
848 | </v-flex> | 858 | </v-flex> |
849 | <v-flex xs12 md8 class="ml-3"> | 859 | <v-flex xs12 md8 class="ml-3"> |
850 | <v-text-field | 860 | <v-text-field |
851 | name="input-4-3" | 861 | name="input-4-3" |
852 | v-model="addTeachers.permanentAddress" | 862 | v-model="addTeachers.permanentAddress" |
853 | :rules="permanentAddress" | 863 | :rules="permanentAddress" |
854 | placeholder="fill Your Permanent Address" | 864 | placeholder="fill Your Permanent Address" |
855 | required | 865 | required |
856 | ></v-text-field> | 866 | ></v-text-field> |
857 | </v-flex> | 867 | </v-flex> |
858 | </v-layout> | 868 | </v-layout> |
859 | </v-flex> | 869 | </v-flex> |
860 | </v-layout> | 870 | </v-layout> |
861 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> | 871 | <v-layout class="hidden-lg-only hidden-md-only hidden-xl-only" wrap> |
862 | <v-flex xs12 sm12> | 872 | <v-flex xs12 sm12> |
863 | <v-layout> | 873 | <v-layout> |
864 | <v-flex xs12 sm12 class="pt-4 subheading text-xs-center"> | 874 | <v-flex xs12 sm12 class="pt-4 subheading text-xs-center"> |
865 | <label class>Present Addres:</label> | 875 | <label class>Present Addres:</label> |
866 | </v-flex> | 876 | </v-flex> |
867 | </v-layout> | 877 | </v-layout> |
868 | <v-layout> | 878 | <v-layout> |
869 | <v-flex xs12 sm12> | 879 | <v-flex xs12 sm12> |
870 | <v-textarea | 880 | <v-textarea |
871 | name="input-4-3" | 881 | name="input-4-3" |
872 | v-model="addTeachers.presentAddress" | 882 | v-model="addTeachers.presentAddress" |
873 | :rules="presentAddress" | 883 | :rules="presentAddress" |
874 | placeholder="fill Your present Address" | 884 | placeholder="fill Your present Address" |
875 | required | 885 | required |
876 | ></v-textarea> | 886 | ></v-textarea> |
877 | </v-flex> | 887 | </v-flex> |
878 | </v-layout> | 888 | </v-layout> |
879 | </v-flex> | 889 | </v-flex> |
880 | <v-flex xs12 sm12> | 890 | <v-flex xs12 sm12> |
881 | <v-layout> | 891 | <v-layout> |
882 | <v-flex xs12 sm12 class="pt-4 pr-4 subheading text-xs-center addressForm"> | 892 | <v-flex xs12 sm12 class="pt-4 pr-4 subheading text-xs-center addressForm"> |
883 | <label>Permanent Address:</label> | 893 | <label>Permanent Address:</label> |
884 | </v-flex> | 894 | </v-flex> |
885 | </v-layout> | 895 | </v-layout> |
886 | <v-layout> | 896 | <v-layout> |
887 | <v-flex xs12 sm12> | 897 | <v-flex xs12 sm12> |
888 | <v-textarea | 898 | <v-textarea |
889 | name="input-4-3" | 899 | name="input-4-3" |
890 | v-model="addTeachers.permanentAddress" | 900 | v-model="addTeachers.permanentAddress" |
891 | :rules="permanentAddress" | 901 | :rules="permanentAddress" |
892 | placeholder="fill Your Permanent Address" | 902 | placeholder="fill Your Permanent Address" |
893 | required | 903 | required |
894 | ></v-textarea> | 904 | ></v-textarea> |
895 | </v-flex> | 905 | </v-flex> |
896 | </v-layout> | 906 | </v-layout> |
897 | </v-flex> | 907 | </v-flex> |
898 | </v-layout> | 908 | </v-layout> |
899 | <v-layout> | 909 | <v-layout> |
900 | <v-flex xs12 sm12> | 910 | <v-flex xs12 sm12> |
901 | <v-layout class="right"> | 911 | <v-layout class="right"> |
902 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> | 912 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> |
903 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 913 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
904 | </v-layout> | 914 | </v-layout> |
905 | </v-flex> | 915 | </v-flex> |
906 | </v-layout> | 916 | </v-layout> |
907 | </v-container> | 917 | </v-container> |
908 | </v-form> | 918 | </v-form> |
909 | </v-card> | 919 | </v-card> |
910 | </v-dialog> | 920 | </v-dialog> |
911 | <div class="loader" v-if="showLoader"> | 921 | <div class="loader" v-if="showLoader"> |
912 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 922 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
913 | </div> | 923 | </div> |
914 | </v-container> | 924 | </v-container> |
915 | </template> | 925 | </template> |
916 | 926 | ||
917 | <script> | 927 | <script> |
918 | import http from "@/Services/http.js"; | 928 | import http from "@/Services/http.js"; |
919 | import moment from "moment"; | 929 | import moment from "moment"; |
920 | import countryList from "@/script/country.js"; | 930 | import countryList from "@/script/country.js"; |
921 | 931 | ||
922 | export default { | 932 | export default { |
923 | data: () => ({ | 933 | data: () => ({ |
924 | component: "report-generate", | 934 | component: "report-generate", |
925 | snackbar: false, | 935 | snackbar: false, |
926 | y: "top", | 936 | y: "top", |
927 | x: "right", | 937 | x: "right", |
928 | role: "", | 938 | role: "", |
929 | mode: "", | 939 | mode: "", |
930 | timeout: 3000, | 940 | timeout: 3000, |
931 | text: "", | 941 | text: "", |
932 | color: "", | 942 | color: "", |
933 | showLoader: false, | 943 | showLoader: false, |
934 | loading: false, | 944 | loading: false, |
935 | date: null, | 945 | date: null, |
936 | search: "", | 946 | search: "", |
937 | show: true, | 947 | show: true, |
938 | showSearch: false, | 948 | showSearch: false, |
939 | menu: false, | 949 | menu: false, |
940 | menu1: false, | 950 | menu1: false, |
941 | menu2: false, | 951 | menu2: false, |
942 | menu3: false, | 952 | menu3: false, |
943 | editTeacherDialog: false, | 953 | editTeacherDialog: false, |
944 | viewTeacherProfileDialog: false, | 954 | viewTeacherProfileDialog: false, |
945 | addTeacherDialog: false, | 955 | addTeacherDialog: false, |
946 | valid: true, | 956 | valid: true, |
947 | pagination: { | 957 | pagination: { |
948 | rowsPerPage: 10 | 958 | rowsPerPage: 10, |
949 | }, | 959 | }, |
950 | imageData: {}, | 960 | imageData: {}, |
951 | imageName: "", | 961 | imageName: "", |
952 | imageUrl: "", | 962 | imageUrl: "", |
953 | imageFile: "", | 963 | imageFile: "", |
954 | nameRules: [v => !!v || " Full Name is required"], | 964 | nameRules: [(v) => !!v || " Full Name is required"], |
955 | dateRules: [v => !!v || " DOB is required"], | 965 | dateRules: [(v) => !!v || " DOB is required"], |
956 | cityRules: [v => !!v || " City Name is required"], | 966 | cityRules: [(v) => !!v || " City Name is required"], |
957 | pincode: [v => !!v || " Pincode is required"], | 967 | pincode: [(v) => !!v || " Pincode is required"], |
958 | country: [v => !!v || " Country Name is required"], | 968 | country: [(v) => !!v || " Country Name is required"], |
959 | permanentAddress: [v => !!v || " Permanent Address is required"], | 969 | permanentAddress: [(v) => !!v || " Permanent Address is required"], |
960 | presentAddress: [v => !!v || " Present Address is required"], | 970 | presentAddress: [(v) => !!v || " Present Address is required"], |
961 | mobileNoRules: [v => !!v || "Mobile Number is required"], | 971 | mobileNoRules: [(v) => !!v || "Mobile Number is required"], |
962 | stateRules: [v => !!v || "State Name is required"], | 972 | stateRules: [(v) => !!v || "State Name is required"], |
963 | joinDateRules: [v => !!v || " Join Date is required"], | 973 | joinDateRules: [(v) => !!v || " Join Date is required"], |
964 | errorMessages: "", | 974 | errorMessages: "", |
965 | switch1: true, | 975 | switch1: true, |
966 | countries: [], | 976 | countries: [], |
967 | headers: [ | 977 | headers: [ |
968 | { | 978 | { |
969 | text: "No", | 979 | text: "No", |
970 | align: "", | 980 | align: "", |
971 | sortable: false, | 981 | sortable: false, |
972 | value: "No" | 982 | value: "No", |
973 | }, | 983 | }, |
974 | { | 984 | { |
975 | text: "Profile Pic", | 985 | text: "Profile Pic", |
976 | value: "profilePicUrl", | 986 | value: "profilePicUrl", |
977 | sortable: false, | 987 | sortable: false, |
978 | align: "center" | 988 | align: "center", |
979 | }, | 989 | }, |
980 | { text: "Name", value: "name", sortable: false, align: "center" }, | 990 | { text: "Name", value: "name", sortable: false, align: "center" }, |
981 | { text: "Email", value: "email", sortable: false, align: "center" }, | 991 | { text: "Email", value: "email", sortable: false, align: "center" }, |
982 | { text: "DOB", value: "dob", sortable: false, align: "center" }, | 992 | { text: "DOB", value: "dob", sortable: false, align: "center" }, |
983 | { | 993 | { |
984 | text: "Join Date", | 994 | text: "Join Date", |
985 | value: "joinDate", | 995 | value: "joinDate", |
986 | sortable: false, | 996 | sortable: false, |
987 | align: "center" | 997 | align: "center", |
988 | }, | 998 | }, |
989 | { | 999 | { |
990 | text: "Mobile No", | 1000 | text: "Mobile No", |
991 | value: "mobileNo", | 1001 | value: "mobileNo", |
992 | sortable: false, | 1002 | sortable: false, |
993 | align: "center" | 1003 | align: "center", |
994 | }, | 1004 | }, |
995 | { | 1005 | { |
996 | text: "Status", | 1006 | text: "Status", |
997 | value: "status", | 1007 | value: "status", |
998 | sortable: false, | 1008 | sortable: false, |
999 | align: "center" | 1009 | align: "center", |
1000 | }, | 1010 | }, |
1001 | { text: "Action", value: "", sortable: false, align: "center" } | 1011 | { text: "Action", value: "", sortable: false, align: "center" }, |
1002 | ], | 1012 | ], |
1003 | desserts: [], | 1013 | desserts: [], |
1004 | editedIndex: -1, | 1014 | editedIndex: -1, |
1005 | upload: "", | 1015 | upload: "", |
1006 | editedItem: { | 1016 | editedItem: { |
1007 | role: "TEACHER", | 1017 | role: "TEACHER", |
1008 | name: "", | 1018 | name: "", |
1009 | email: "", | 1019 | email: "", |
1010 | date: null, | 1020 | date: null, |
1011 | city: "", | 1021 | city: "", |
1012 | pincode: "", | 1022 | pincode: "", |
1013 | country: "", | 1023 | country: "", |
1014 | permanentAddress: "", | 1024 | permanentAddress: "", |
1015 | presentAddress: "", | 1025 | presentAddress: "", |
1016 | mobileNo: "", | 1026 | mobileNo: "", |
1017 | state: "", | 1027 | state: "", |
1018 | joinDate: null | 1028 | joinDate: null, |
1019 | }, | 1029 | }, |
1020 | addTeachers: { | 1030 | addTeachers: { |
1021 | role: "TEACHER", | 1031 | role: "TEACHER", |
1022 | name: "", | 1032 | name: "", |
1023 | email: "", | 1033 | email: "", |
1024 | date: null, | 1034 | date: null, |
1025 | city: "", | 1035 | city: "", |
1026 | pincode: "", | 1036 | pincode: "", |
1027 | country: "", | 1037 | country: "", |
1028 | permanentAddress: "", | 1038 | permanentAddress: "", |
1029 | presentAddress: "", | 1039 | presentAddress: "", |
1030 | mobileNo: "", | 1040 | mobileNo: "", |
1031 | state: "", | 1041 | state: "", |
1032 | joinDate: null | 1042 | joinDate: null, |
1033 | }, | 1043 | }, |
1034 | status: "" | 1044 | status: "", |
1035 | }), | 1045 | }), |
1036 | watch: { | 1046 | watch: { |
1037 | menu(val) { | 1047 | menu(val) { |
1038 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 1048 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
1039 | }, | 1049 | }, |
1040 | menu1(val) { | 1050 | menu1(val) { |
1041 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 1051 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
1042 | } | 1052 | }, |
1053 | addTeacherDialog: function (val) { | ||
1054 | if (!val) { | ||
1055 | this.addTeachers = []; | ||
1056 | this.imageName = ""; | ||
1057 | this.imageFile = ""; | ||
1058 | this.imageUrl = ""; | ||
1059 | } | ||
1060 | }, | ||
1043 | }, | 1061 | }, |
1044 | methods: { | 1062 | methods: { |
1045 | save(date) { | 1063 | save(date) { |
1046 | this.$refs.menu.save(date); | 1064 | this.$refs.menu.save(date); |
1047 | }, | 1065 | }, |
1048 | save(date) { | 1066 | save(date) { |
1049 | this.$refs.menu1.save(date); | 1067 | this.$refs.menu1.save(date); |
1050 | }, | 1068 | }, |
1051 | pickFile() { | 1069 | pickFile() { |
1052 | this.$refs.image.click(); | 1070 | this.$refs.image.click(); |
1053 | }, | 1071 | }, |
1054 | onFilePicked(e) { | 1072 | onFilePicked(e) { |
1055 | const files = e.target.files; | 1073 | const files = e.target.files; |
1056 | this.upload = e.target.files[0]; | 1074 | this.upload = e.target.files[0]; |
1057 | if (files[0] !== undefined) { | 1075 | if (files[0] !== undefined) { |
1058 | this.imageName = files[0].name; | 1076 | this.imageName = files[0].name; |
1059 | if (this.imageName.lastIndexOf(".") <= 0) { | 1077 | if (this.imageName.lastIndexOf(".") <= 0) { |
1060 | return; | 1078 | return; |
1061 | } | 1079 | } |
1062 | const fr = new FileReader(); | 1080 | const fr = new FileReader(); |
1063 | fr.readAsDataURL(files[0]); | 1081 | fr.readAsDataURL(files[0]); |
1064 | fr.addEventListener("load", () => { | 1082 | fr.addEventListener("load", () => { |
1065 | this.imageUrl = fr.result; | 1083 | this.imageUrl = fr.result; |
1066 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 1084 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
1067 | }); | 1085 | }); |
1068 | } else { | 1086 | } else { |
1069 | this.imageName = ""; | 1087 | this.imageName = ""; |
1070 | this.imageFile = ""; | 1088 | this.imageFile = ""; |
1071 | this.imageUrl = ""; | 1089 | this.imageUrl = ""; |
1072 | } | 1090 | } |
1073 | }, | 1091 | }, |
1074 | dates: function(date) { | 1092 | dates: function (date) { |
1075 | return moment(date).format("MMMM DD, YYYY"); | 1093 | return moment(date).format("MMMM DD, YYYY"); |
1076 | }, | 1094 | }, |
1077 | getTeacherList() { | 1095 | getTeacherList() { |
1078 | this.showLoader = true; | 1096 | this.showLoader = true; |
1079 | var token = this.$store.state.token; | 1097 | var token = this.$store.state.token; |
1080 | http() | 1098 | http() |
1081 | .get("/getTeachersList", { | 1099 | .get("/getTeachersList", { |
1082 | headers: { Authorization: "Bearer " + token } | 1100 | headers: { Authorization: "Bearer " + token }, |
1083 | }) | 1101 | }) |
1084 | .then(response => { | 1102 | .then((response) => { |
1085 | this.desserts = response.data.data; | 1103 | this.desserts = response.data.data; |
1086 | this.showLoader = false; | 1104 | this.showLoader = false; |
1087 | // console.log("getTeacherList=====>",this.desserts) | 1105 | // console.log("getTeacherList=====>",this.desserts) |
1088 | }) | 1106 | }) |
1089 | .catch(error => { | 1107 | .catch((error) => { |
1090 | this.showLoader = false; | 1108 | this.showLoader = false; |
1091 | if (error.response.status === 401) { | 1109 | if (error.response.status === 401) { |
1092 | this.$router.replace({ path: "/" }); | 1110 | this.$router.replace({ path: "/" }); |
1093 | this.$store.dispatch("setToken", null); | 1111 | this.$store.dispatch("setToken", null); |
1094 | this.$store.dispatch("Id", null); | 1112 | this.$store.dispatch("Id", null); |
1095 | } | 1113 | } |
1096 | }); | 1114 | }); |
1097 | }, | 1115 | }, |
1098 | editItem(item) { | 1116 | editItem(item) { |
1099 | this.editedIndex = this.desserts.indexOf(item); | 1117 | this.editedIndex = this.desserts.indexOf(item); |
1100 | this.editedItem = Object.assign({}, item); | 1118 | this.editedItem = Object.assign({}, item); |
1101 | this.editedItem.dob = | 1119 | this.editedItem.dob = |
1102 | this.editedItem.dob != undefined | 1120 | this.editedItem.dob != undefined |
1103 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) | 1121 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) |
1104 | : (this.editedItem.dob = ""); | 1122 | : (this.editedItem.dob = ""); |
1105 | this.editedItem.joinDate = | 1123 | this.editedItem.joinDate = |
1106 | this.editedItem.joinDate != undefined | 1124 | this.editedItem.joinDate != undefined |
1107 | ? (this.editedItem.joinDate = this.editedItem.joinDate.substring( | 1125 | ? (this.editedItem.joinDate = this.editedItem.joinDate.substring( |
1108 | 0, | 1126 | 0, |
1109 | 10 | 1127 | 10 |
1110 | )) | 1128 | )) |
1111 | : (this.editedItem.joinDate = ""); | 1129 | : (this.editedItem.joinDate = ""); |
1112 | 1130 | ||
1113 | this.editTeacherDialog = true; | 1131 | this.editTeacherDialog = true; |
1114 | }, | 1132 | }, |
1115 | profile(item) { | 1133 | profile(item) { |
1116 | this.editedIndex = this.desserts.indexOf(item); | 1134 | this.editedIndex = this.desserts.indexOf(item); |
1117 | this.editedItem = Object.assign({}, item); | 1135 | this.editedItem = Object.assign({}, item); |
1118 | this.viewTeacherProfileDialog = true; | 1136 | this.viewTeacherProfileDialog = true; |
1119 | }, | 1137 | }, |
1120 | deleteItem(item) { | 1138 | deleteItem(item) { |
1121 | let deleteTeachers = { | 1139 | let deleteTeachers = { |
1122 | teacherId: item._id | 1140 | teacherId: item._id, |
1123 | }; | 1141 | }; |
1124 | http() | 1142 | http() |
1125 | .delete( | 1143 | .delete( |
1126 | "/deleteTeacher", | 1144 | "/deleteTeacher", |
1127 | confirm("Are you sure you want to delete this?") && { | 1145 | confirm("Are you sure you want to delete this?") && { |
1128 | params: deleteTeachers | 1146 | params: deleteTeachers, |
1129 | } | 1147 | } |
1130 | ) | 1148 | ) |
1131 | .then(response => { | 1149 | .then((response) => { |
1132 | this.snackbar = true; | 1150 | this.snackbar = true; |
1133 | this.text = "Successfully delete Existing Teacher"; | 1151 | this.text = "Successfully delete Existing Teacher"; |
1134 | this.color = "green"; | 1152 | this.color = "green"; |
1135 | this.getTeacherList(); | 1153 | this.getTeacherList(); |
1136 | }) | 1154 | }) |
1137 | .catch(error => { | 1155 | .catch((error) => { |
1138 | this.snackbar = true; | 1156 | this.snackbar = true; |
1139 | this.text = error.response.data.message; | 1157 | this.text = error.response.data.message; |
1140 | this.color = "error"; | 1158 | this.color = "error"; |
1141 | }); | 1159 | }); |
1142 | }, | 1160 | }, |
1143 | closeEditTeacherDialog() { | 1161 | closeEditTeacherDialog() { |
1144 | this.editTeacherDialog = false; | 1162 | this.editTeacherDialog = false; |
1145 | }, | 1163 | }, |
1146 | close1() { | 1164 | close1() { |
1147 | this.viewTeacherProfileDialog = false; | 1165 | this.viewTeacherProfileDialog = false; |
1148 | }, | 1166 | }, |
1149 | copyData() { | 1167 | copyData() { |
1150 | this.addTeachers.permanentAddress = this.addTeachers.presentAddress; | 1168 | this.addTeachers.permanentAddress = this.addTeachers.presentAddress; |
1151 | }, | 1169 | }, |
1152 | submit() { | 1170 | submit() { |
1153 | if (this.$refs.form.validate()) { | 1171 | if (this.$refs.form.validate()) { |
1154 | let addTeacher = { | 1172 | let addTeacher = { |
1155 | name: this.addTeachers.name, | 1173 | name: this.addTeachers.name, |
1156 | email: this.addTeachers.email, | 1174 | email: this.addTeachers.email, |
1157 | role: this.addTeachers.role, | 1175 | role: this.addTeachers.role, |
1158 | dob: this.addTeachers.date, | 1176 | dob: this.addTeachers.date, |
1159 | city: this.addTeachers.city, | 1177 | city: this.addTeachers.city, |
1160 | pincode: this.addTeachers.pincode, | 1178 | pincode: this.addTeachers.pincode, |
1161 | country: this.addTeachers.country, | 1179 | country: this.addTeachers.country, |
1162 | permanentAddress: this.addTeachers.permanentAddress, | 1180 | permanentAddress: this.addTeachers.permanentAddress, |
1163 | presentAddress: this.addTeachers.presentAddress, | 1181 | presentAddress: this.addTeachers.presentAddress, |
1164 | mobileNo: this.addTeachers.mobileNo, | 1182 | mobileNo: this.addTeachers.mobileNo, |
1165 | state: this.addTeachers.state, | 1183 | state: this.addTeachers.state, |
1166 | joinDate: this.addTeachers.joinDate | 1184 | joinDate: this.addTeachers.joinDate, |
1167 | }; | 1185 | }; |
1168 | if (this.imageUrl) { | 1186 | if (this.imageUrl) { |
1169 | var str = this.imageUrl; | 1187 | var str = this.imageUrl; |
1170 | const [baseUrl, imageUrl] = str.split(/,/); | 1188 | const [baseUrl, imageUrl] = str.split(/,/); |
1171 | addTeacher.upload = imageUrl; | 1189 | addTeacher.upload = imageUrl; |
1172 | } | 1190 | } |
1173 | this.loading = true; | 1191 | this.loading = true; |
1174 | http() | 1192 | http() |
1175 | .post("/createTeacher", addTeacher) | 1193 | .post("/createTeacher", addTeacher) |
1176 | .then(response => { | 1194 | .then((response) => { |
1177 | this.imageUrl = ""; | 1195 | this.imageUrl = ""; |
1178 | this.getTeacherList(); | 1196 | this.getTeacherList(); |
1179 | this.snackbar = true; | 1197 | this.snackbar = true; |
1180 | this.text = "New Teacher added successfully"; | 1198 | this.text = "New Teacher added successfully"; |
1181 | this.color = "green"; | 1199 | this.color = "green"; |
1182 | this.clear(); | 1200 | this.clear(); |
1183 | this.loading = false; | 1201 | this.loading = false; |
1184 | this.addTeacherDialog = false; | 1202 | this.addTeacherDialog = false; |
1185 | }) | 1203 | }) |
1186 | .catch(error => { | 1204 | .catch((error) => { |
1187 | this.snackbar = true; | 1205 | this.snackbar = true; |
1188 | this.text = error.response.data.message; | 1206 | this.text = error.response.data.message; |
1189 | this.color = "error"; | 1207 | this.color = "error"; |
1190 | this.loading = false; | 1208 | this.loading = false; |
1191 | }); | 1209 | }); |
1192 | } | 1210 | } |
1193 | }, | 1211 | }, |
1194 | clear() { | 1212 | clear() { |
1195 | this.$refs.form.reset(); | 1213 | this.$refs.form.reset(); |
1196 | this.imageUrl = ""; | 1214 | this.imageUrl = ""; |
1197 | }, | 1215 | }, |
1198 | save() { | 1216 | save() { |
1199 | this.loading = true; | 1217 | this.loading = true; |
1200 | let editTeacher = { | 1218 | let editTeacher = { |
1201 | teacherId: this.editedItem._id, | 1219 | teacherId: this.editedItem._id, |
1202 | name: this.editedItem.name, | 1220 | name: this.editedItem.name, |
1203 | email: this.editedItem.email, | 1221 | email: this.editedItem.email, |
1204 | role: this.editedItem.role, | 1222 | role: this.editedItem.role, |
1205 | dob: this.editedItem.dob, | 1223 | dob: this.editedItem.dob, |
1206 | city: this.editedItem.city, | 1224 | city: this.editedItem.city, |
1207 | pincode: this.editedItem.pincode, | 1225 | pincode: this.editedItem.pincode, |
1208 | country: this.editedItem.country, | 1226 | country: this.editedItem.country, |
1209 | permanentAddress: this.editedItem.permanentAddress, | 1227 | permanentAddress: this.editedItem.permanentAddress, |
1210 | presentAddress: this.editedItem.presentAddress, | 1228 | presentAddress: this.editedItem.presentAddress, |
1211 | mobileNo: this.editedItem.mobileNo, | 1229 | mobileNo: this.editedItem.mobileNo, |
1212 | state: this.editedItem.state, | 1230 | state: this.editedItem.state, |
1213 | joinDate: this.editedItem.joinDate | 1231 | joinDate: this.editedItem.joinDate, |
1214 | }; | 1232 | }; |
1215 | if (this.imageUrl) { | 1233 | if (this.imageUrl) { |
1216 | var str = this.imageUrl; | 1234 | var str = this.imageUrl; |
1217 | const [baseUrl, imageUrl] = str.split(/,/); | 1235 | const [baseUrl, imageUrl] = str.split(/,/); |
1218 | editTeacher.upload = imageUrl; | 1236 | editTeacher.upload = imageUrl; |
1219 | } | 1237 | } |
1220 | http() | 1238 | http() |
1221 | .put("/updateTeacher", editTeacher) | 1239 | .put("/updateTeacher", editTeacher) |
1222 | .then(response => { | 1240 | .then((response) => { |
1223 | this.snackbar = true; | 1241 | this.snackbar = true; |
1224 | this.text = "Successfully Edit Existing Teacher"; | 1242 | this.text = "Successfully Edit Existing Teacher"; |
1225 | this.color = "green"; | 1243 | this.color = "green"; |
1226 | this.loading = false; | 1244 | this.loading = false; |
1227 | this.getTeacherList(); | 1245 | this.getTeacherList(); |
1228 | this.closeEditTeacherDialog(); | 1246 | this.closeEditTeacherDialog(); |
1229 | }) | 1247 | }) |
1230 | .catch(error => { | 1248 | .catch((error) => { |
1231 | this.snackbar = true; | 1249 | this.snackbar = true; |
1232 | this.text = error.response.data.message; | 1250 | this.text = error.response.data.message; |
1233 | this.color = "error"; | 1251 | this.color = "error"; |
1234 | this.loading = false; | 1252 | this.loading = false; |
1235 | }); | 1253 | }); |
1236 | }, | 1254 | }, |
1237 | suspendStatus(suspendStatus, id) { | 1255 | suspendStatus(suspendStatus, id) { |
1238 | let suspendStatusData = { | 1256 | let suspendStatusData = { |
1239 | teacherId: id, | 1257 | teacherId: id, |
1240 | status: suspendStatus | 1258 | status: suspendStatus, |
1241 | }; | 1259 | }; |
1242 | this.showLoader = true; | 1260 | this.showLoader = true; |
1243 | http() | 1261 | http() |
1244 | .put("/suspendAccount", suspendStatusData) | 1262 | .put("/suspendAccount", suspendStatusData) |
1245 | .then(response => { | 1263 | .then((response) => { |
1246 | this.getTeacherList(); | 1264 | this.getTeacherList(); |
1247 | this.text = response.data.message; | 1265 | this.text = response.data.message; |
1248 | this.color = "green"; | 1266 | this.color = "green"; |
1249 | this.snackbar = true; | 1267 | this.snackbar = true; |
1250 | this.showLoader = false; | 1268 | this.showLoader = false; |
1251 | }) | 1269 | }) |
1252 | .catch(error => { | 1270 | .catch((error) => { |
1253 | this.snackbar = true; | 1271 | this.snackbar = true; |
1254 | this.color = "error"; | 1272 | this.color = "error"; |
1255 | this.text = error.response.data.message; | 1273 | this.text = error.response.data.message; |
1256 | this.showLoader = false; | 1274 | this.showLoader = false; |
1257 | }); | 1275 | }); |
1258 | }, | 1276 | }, |
1259 | displaySearch() { | 1277 | displaySearch() { |
1260 | (this.show = false), (this.showSearch = true); | 1278 | (this.show = false), (this.showSearch = true); |
1261 | }, | 1279 | }, |
1262 | closeSearch() { | 1280 | closeSearch() { |
1263 | this.showSearch = false; | 1281 | this.showSearch = false; |
1264 | this.show = true; | 1282 | this.show = true; |
1265 | this.search = ""; | 1283 | this.search = ""; |
1266 | } | 1284 | }, |
1267 | }, | 1285 | }, |
1268 | mounted() { | 1286 | mounted() { |
1269 | const getCountryList = countryList(); | 1287 | const getCountryList = countryList(); |
1270 | this.countries = getCountryList; | 1288 | this.countries = getCountryList; |
1271 | this.getTeacherList(); | 1289 | this.getTeacherList(); |
1272 | this.role = this.$store.state.role; | 1290 | this.role = this.$store.state.role; |
1273 | } | 1291 | }, |
1274 | }; | 1292 | }; |
1275 | </script> | 1293 | </script> |
1276 | <style scoped> | 1294 | <style scoped> |
1277 | .active { | 1295 | .active { |
1278 | background-color: gray; | 1296 | background-color: gray; |
1279 | color: white !important; | 1297 | color: white !important; |
1280 | } | 1298 | } |
1281 | .activebtn { | 1299 | .activebtn { |
1282 | color: black !important; | 1300 | color: black !important; |
1283 | } | 1301 | } |
1284 | </style> | 1302 | </style> |
src/pages/TimeTable/timeTable.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT TIME-TABLE****** --> | 3 | <!-- ****** EDIT TIME-TABLE****** --> |
4 | <v-dialog v-model="dialog" max-width="600px"> | 4 | <v-dialog v-model="dialog" max-width="600px"> |
5 | <v-flex xs12 sm12> | 5 | <v-flex xs12 sm12> |
6 | <v-card flat class="card-style pa-2" dark> | 6 | <v-card flat class="card-style pa-2" dark> |
7 | <v-layout> | 7 | <v-layout> |
8 | <v-flex xs12> | 8 | <v-flex xs12> |
9 | <label class="title text-xs-center">Edit Time Table</label> | 9 | <label class="title text-xs-center">Edit Time Table</label> |
10 | <v-icon size="24" class="right" @click="dialog = false">cancel</v-icon> | 10 | <v-icon size="24" class="right" @click="dialog = false">cancel</v-icon> |
11 | </v-flex> | 11 | </v-flex> |
12 | </v-layout> | 12 | </v-layout> |
13 | <!-- <v-layout> | 13 | <!-- <v-layout> |
14 | <v-flex | 14 | <v-flex |
15 | xs12 | 15 | xs12 |
16 | class="text-xs-center text-sm-center text-md-center text-lg-center" | 16 | class="text-xs-center text-sm-center text-md-center text-lg-center" |
17 | > | 17 | > |
18 | <v-avatar size="100px"> | 18 | <v-avatar size="100px"> |
19 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 19 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
20 | </v-avatar> | 20 | </v-avatar> |
21 | <input | 21 | <input |
22 | type="file" | 22 | type="file" |
23 | style="display: none" | 23 | style="display: none" |
24 | ref="image" | 24 | ref="image" |
25 | accept="image/*" | 25 | accept="image/*" |
26 | @change="onFilePicked" | 26 | @change="onFilePicked" |
27 | /> | 27 | /> |
28 | <img | 28 | <img |
29 | :src="imageData.imageUrl" | 29 | :src="imageData.imageUrl" |
30 | height="150" | 30 | height="150" |
31 | v-if="imageUrl" | 31 | v-if="imageUrl" |
32 | style="border-radius:50%; width:200px" | 32 | style="border-radius:50%; width:200px" |
33 | /> | 33 | /> |
34 | </v-flex> | 34 | </v-flex> |
35 | </v-layout>--> | 35 | </v-layout>--> |
36 | <v-flex xs12 sm12> | 36 | <v-flex xs12 sm12> |
37 | <v-layout> | 37 | <v-layout> |
38 | <v-flex xs4 class="pt-4 subheading"> | 38 | <v-flex xs4 class="pt-4 subheading"> |
39 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 39 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
40 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 40 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
41 | </v-flex> | 41 | </v-flex> |
42 | <v-flex xs8 sm5 class="ml-3"> | 42 | <v-flex xs8 sm5 class="ml-3"> |
43 | <v-select | 43 | <v-select |
44 | :items="addclass" | 44 | :items="addclass" |
45 | label="Select Class" | 45 | label="Select Class" |
46 | v-model="editedItem.classNum" | 46 | v-model="editedItem.classNum" |
47 | item-text="classNum" | 47 | item-text="classNum" |
48 | item-value="_id" | 48 | item-value="_id" |
49 | @change="getSections(editedItem.classNum)" | 49 | @change="getSections(editedItem.classNum)" |
50 | ></v-select> | 50 | ></v-select> |
51 | </v-flex> | 51 | </v-flex> |
52 | </v-layout> | 52 | </v-layout> |
53 | </v-flex> | 53 | </v-flex> |
54 | <v-flex xs12 sm12> | 54 | <v-flex xs12 sm12> |
55 | <v-layout> | 55 | <v-layout> |
56 | <v-flex xs4 class="pt-4 subheading"> | 56 | <v-flex xs4 class="pt-4 subheading"> |
57 | <label class="right hidden-xs-only hidden-sm-only">Section Name:</label> | 57 | <label class="right hidden-xs-only hidden-sm-only">Section Name:</label> |
58 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> | 58 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> |
59 | </v-flex> | 59 | </v-flex> |
60 | <v-flex xs8 sm5 class="ml-3"> | 60 | <v-flex xs8 sm5 class="ml-3"> |
61 | <v-select | 61 | <v-select |
62 | :items="addSection" | 62 | :items="addSection" |
63 | label="Select Section" | 63 | label="Select Section" |
64 | v-model="editedItem.selectSection" | 64 | v-model="editedItem.selectSection" |
65 | item-text="name" | 65 | item-text="name" |
66 | item-value="_id" | 66 | item-value="_id" |
67 | ></v-select> | 67 | ></v-select> |
68 | </v-flex> | 68 | </v-flex> |
69 | </v-layout> | 69 | </v-layout> |
70 | </v-flex> | 70 | </v-flex> |
71 | <v-layout> | 71 | <v-layout> |
72 | <v-flex xs12 sm9 offset-sm1> | 72 | <v-flex xs12 sm9 offset-sm1> |
73 | <v-card-actions> | 73 | <v-card-actions> |
74 | <v-spacer></v-spacer> | 74 | <v-spacer></v-spacer> |
75 | <v-btn round dark @click.native="close" class="clear-button">Cancel</v-btn> | 75 | <v-btn round dark @click.native="close" class="clear-button">Cancel</v-btn> |
76 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 76 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
77 | </v-card-actions> | 77 | </v-card-actions> |
78 | </v-flex> | 78 | </v-flex> |
79 | </v-layout> | 79 | </v-layout> |
80 | </v-card> | 80 | </v-card> |
81 | </v-flex> | 81 | </v-flex> |
82 | </v-dialog> | 82 | </v-dialog> |
83 | 83 | ||
84 | <!-- ****** ADD Dialog Schedule IN TIME-TABLE ****** --> | 84 | <!-- ****** ADD Dialog Schedule IN TIME-TABLE ****** --> |
85 | 85 | ||
86 | <v-dialog v-model="dialogSchedule" max-width="600px"> | 86 | <v-dialog v-model="dialogSchedule" max-width="600px"> |
87 | <v-flex xs12 sm12> | 87 | <v-flex xs12 sm12> |
88 | <v-card flat class="card-style pa-2" dark> | 88 | <v-card flat class="card-style pa-2" dark> |
89 | <v-layout> | 89 | <v-layout> |
90 | <v-flex xs12> | 90 | <v-flex xs12> |
91 | <label class="title text-xs-center">Add Schedule</label> | 91 | <label class="title text-xs-center">Add Schedule</label> |
92 | <v-icon size="24" class="right" @click="dialogSchedule = false">cancel</v-icon> | 92 | <v-icon size="24" class="right" @click="dialogSchedule = false">cancel</v-icon> |
93 | </v-flex> | 93 | </v-flex> |
94 | </v-layout> | 94 | </v-layout> |
95 | <v-form ref="formAddDay" v-model="validAddDay" lazy-validation> | 95 | <v-form ref="formAddDay" v-model="validAddDay" lazy-validation> |
96 | <v-container fluid> | 96 | <v-container fluid> |
97 | <v-flex xs12 sm12 class="py-3"> | 97 | <v-flex xs12 sm12 class="py-3"> |
98 | <v-layout> | 98 | <v-layout> |
99 | <v-flex xs4 class="pt-4 subheading"> | 99 | <v-flex xs4 class="pt-4 subheading"> |
100 | <label class="right hidden-xs-only hidden-sm-only">Select Day:</label> | 100 | <label class="right hidden-xs-only hidden-sm-only">Select Day:</label> |
101 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Day:</label> | 101 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Day:</label> |
102 | </v-flex> | 102 | </v-flex> |
103 | <v-flex xs12 sm5 class="pl-3"> | 103 | <v-flex xs12 sm5 class="pl-3"> |
104 | <v-select | 104 | <v-select |
105 | :items="addOneDay" | 105 | :items="addOneDay" |
106 | label="Select Day" | 106 | label="Select Day" |
107 | v-model="schedule.selectDay" | 107 | v-model="schedule.selectDay" |
108 | :rules="selecDayRule" | 108 | :rules="selecDayRule" |
109 | ></v-select> | 109 | ></v-select> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | </v-flex> | 112 | </v-flex> |
113 | <v-layout> | 113 | <v-layout> |
114 | <v-flex xs12 sm8 offset-sm2> | 114 | <v-flex xs12 sm8 offset-sm2> |
115 | <v-card-actions> | 115 | <v-card-actions> |
116 | <v-spacer></v-spacer> | 116 | <v-spacer></v-spacer> |
117 | <v-btn round dark @click="submitSchedule" class="add-button">Save</v-btn> | 117 | <v-btn round dark @click="submitSchedule" class="add-button">Save</v-btn> |
118 | <v-spacer></v-spacer> | 118 | <v-spacer></v-spacer> |
119 | </v-card-actions> | 119 | </v-card-actions> |
120 | </v-flex> | 120 | </v-flex> |
121 | </v-layout> | 121 | </v-layout> |
122 | </v-container> | 122 | </v-container> |
123 | </v-form> | 123 | </v-form> |
124 | </v-card> | 124 | </v-card> |
125 | </v-flex> | 125 | </v-flex> |
126 | </v-dialog> | 126 | </v-dialog> |
127 | 127 | ||
128 | <!-- ****** ADD LECTURES IN TIME-TABLE ****** --> | 128 | <!-- ****** ADD LECTURES IN TIME-TABLE ****** --> |
129 | 129 | ||
130 | <v-dialog v-model="dialogAddLecture" max-width="600px" persistent> | 130 | <v-dialog v-model="dialogAddLecture" max-width="600px" persistent> |
131 | <v-flex xs12 sm12> | 131 | <v-flex xs12 sm12> |
132 | <v-card flat class="card-style pa-2" dark> | 132 | <v-card flat class="card-style pa-2" dark> |
133 | <v-layout> | 133 | <v-layout> |
134 | <v-flex xs12> | 134 | <v-flex xs12> |
135 | <label class="title text-xs-center">Add Lecture</label> | 135 | <label class="title text-xs-center">Add Lecture</label> |
136 | <v-icon size="24" class="right" @click="dialogAddLecture = false">cancel</v-icon> | 136 | <v-icon size="24" class="right" @click="dialogAddLecture = false">cancel</v-icon> |
137 | </v-flex> | 137 | </v-flex> |
138 | </v-layout> | 138 | </v-layout> |
139 | <v-form ref="lectureForm" v-model="valid" lazy-validation> | 139 | <v-form ref="lectureForm" v-model="valid" lazy-validation> |
140 | <v-container fluid> | 140 | <v-container fluid> |
141 | <v-flex xs12 sm12> | 141 | <v-flex xs12 sm12> |
142 | <v-layout> | 142 | <v-layout> |
143 | <v-flex xs4 class="pt-4 subheading"> | 143 | <v-flex xs4 class="pt-4 subheading"> |
144 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 144 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
145 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 145 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
146 | </v-flex> | 146 | </v-flex> |
147 | <v-flex xs5 class="ml-3"> | 147 | <v-flex xs5 class="ml-3"> |
148 | <v-select | 148 | <v-select |
149 | :items="addclass" | 149 | :items="addclass" |
150 | label="Select Class" | 150 | label="Select Class" |
151 | v-model="timeTable.select" | 151 | v-model="timeTable.select" |
152 | item-text="classNum" | 152 | item-text="classNum" |
153 | item-value="_id" | 153 | item-value="_id" |
154 | @change="getClassSubject(timeTable.select)" | 154 | @change="getClassSubject(timeTable.select)" |
155 | :rules="classRules" | 155 | :rules="classRules" |
156 | required | 156 | required |
157 | ></v-select> | 157 | ></v-select> |
158 | </v-flex> | 158 | </v-flex> |
159 | </v-layout> | 159 | </v-layout> |
160 | </v-flex> | 160 | </v-flex> |
161 | <v-flex xs12 sm12> | 161 | <v-flex xs12 sm12> |
162 | <v-layout> | 162 | <v-layout> |
163 | <v-flex xs4 class="pt-4 subheading"> | 163 | <v-flex xs4 class="pt-4 subheading"> |
164 | <label class="right">Subject Name:</label> | 164 | <label class="right">Subject Name:</label> |
165 | </v-flex> | 165 | </v-flex> |
166 | <v-flex xs5 class="ml-3"> | 166 | <v-flex xs5 class="ml-3"> |
167 | <v-select | 167 | <v-select |
168 | :items="subjectList.subjects" | 168 | :items="subjectList.subjects" |
169 | label="Select Subject" | 169 | label="Select Subject" |
170 | v-model="addlectures.subjectName" | 170 | v-model="addlectures.subjectName" |
171 | item-text="subjectName" | 171 | item-text="subjectName" |
172 | item-value="subjectName" | 172 | item-value="subjectName" |
173 | :rules="subjectNameRules" | 173 | :rules="subjectNameRules" |
174 | required | 174 | required |
175 | ></v-select> | 175 | ></v-select> |
176 | <!-- <v-text-field | 176 | <!-- <v-text-field |
177 | v-model="addlectures.subjectName" | 177 | v-model="addlectures.subjectName" |
178 | :rules="subjectNameRules" | 178 | :rules="subjectNameRules" |
179 | placeholder="fill your Subject Name" | 179 | placeholder="fill your Subject Name" |
180 | type="text" | 180 | type="text" |
181 | ></v-text-field>--> | 181 | ></v-text-field>--> |
182 | </v-flex> | 182 | </v-flex> |
183 | </v-layout> | 183 | </v-layout> |
184 | </v-flex> | 184 | </v-flex> |
185 | <v-flex xs12 sm12> | 185 | <v-flex xs12 sm12> |
186 | <v-layout> | 186 | <v-layout> |
187 | <v-flex xs4 class="pt-4 subheading"> | 187 | <v-flex xs4 class="pt-4 subheading"> |
188 | <label class="right">Time In:</label> | 188 | <label class="right">Time In:</label> |
189 | </v-flex> | 189 | </v-flex> |
190 | <v-flex xs5 class="ml-3"> | 190 | <v-flex xs5 class="ml-3"> |
191 | <v-menu | 191 | <v-menu |
192 | ref="menuD" | 192 | ref="menuD" |
193 | :close-on-content-click="false" | 193 | :close-on-content-click="false" |
194 | v-model="menu5" | 194 | v-model="menu5" |
195 | :nudge-right="40" | 195 | :nudge-right="40" |
196 | lazy | 196 | lazy |
197 | transition="scale-transition" | 197 | transition="scale-transition" |
198 | offset-y | 198 | offset-y |
199 | full-width | 199 | full-width |
200 | max-width="290px" | 200 | max-width="290px" |
201 | min-width="290px" | 201 | min-width="290px" |
202 | > | 202 | > |
203 | <v-text-field | 203 | <v-text-field |
204 | slot="activator" | 204 | slot="activator" |
205 | v-model="addlectures.timeIn" | 205 | v-model="addlectures.timeIn" |
206 | label="Select your Time In" | 206 | label="Select your Time In" |
207 | append-icon="access_time" | 207 | append-icon="access_time" |
208 | :rules="timeInRules" | 208 | :rules="timeInRules" |
209 | readonly | 209 | readonly |
210 | ></v-text-field> | 210 | ></v-text-field> |
211 | <v-time-picker v-model="addlectures.timeIn" @change="menu5 = false"></v-time-picker> | 211 | <v-time-picker v-model="addlectures.timeIn" @change="menu5 = false"></v-time-picker> |
212 | </v-menu> | 212 | </v-menu> |
213 | </v-flex> | 213 | </v-flex> |
214 | </v-layout> | 214 | </v-layout> |
215 | </v-flex> | 215 | </v-flex> |
216 | <v-flex xs12 sm12> | 216 | <v-flex xs12 sm12> |
217 | <v-layout> | 217 | <v-layout> |
218 | <v-flex xs4 class="pt-4 subheading"> | 218 | <v-flex xs4 class="pt-4 subheading"> |
219 | <label class="right">Time Out:</label> | 219 | <label class="right">Time Out:</label> |
220 | </v-flex> | 220 | </v-flex> |
221 | <v-flex xs5 class="ml-3"> | 221 | <v-flex xs5 class="ml-3"> |
222 | <v-menu | 222 | <v-menu |
223 | ref="menuE" | 223 | ref="menuE" |
224 | :close-on-content-click="false" | 224 | :close-on-content-click="false" |
225 | v-model="menu6" | 225 | v-model="menu6" |
226 | :nudge-right="40" | 226 | :nudge-right="40" |
227 | lazy | 227 | lazy |
228 | transition="scale-transition" | 228 | transition="scale-transition" |
229 | offset-y | 229 | offset-y |
230 | full-width | 230 | full-width |
231 | max-width="290px" | 231 | max-width="290px" |
232 | min-width="290px" | 232 | min-width="290px" |
233 | > | 233 | > |
234 | <v-text-field | 234 | <v-text-field |
235 | slot="activator" | 235 | slot="activator" |
236 | :rules="timeOutRules" | 236 | :rules="timeOutRules" |
237 | v-model="addlectures.timeOut" | 237 | v-model="addlectures.timeOut" |
238 | label="Select your Time Out" | 238 | label="Select your Time Out" |
239 | append-icon="access_time" | 239 | append-icon="access_time" |
240 | readonly | 240 | readonly |
241 | ></v-text-field> | 241 | ></v-text-field> |
242 | <v-time-picker v-model="addlectures.timeOut" @change="menu6 = false"></v-time-picker> | 242 | <v-time-picker v-model="addlectures.timeOut" @change="menu6 = false"></v-time-picker> |
243 | </v-menu> | 243 | </v-menu> |
244 | </v-flex> | 244 | </v-flex> |
245 | </v-layout> | 245 | </v-layout> |
246 | </v-flex> | 246 | </v-flex> |
247 | <v-flex xs12 sm12> | 247 | <v-flex xs12 sm12> |
248 | <v-layout> | 248 | <v-layout> |
249 | <v-flex xs4 class="pt-4 subheading"> | 249 | <v-flex xs4 class="pt-4 subheading"> |
250 | <label class="right">Select Teacher:</label> | 250 | <label class="right">Select Teacher:</label> |
251 | </v-flex> | 251 | </v-flex> |
252 | <v-flex xs5 class="ml-3"> | 252 | <v-flex xs5 class="ml-3"> |
253 | <v-select | 253 | <v-select |
254 | :items="addTeachers" | 254 | :items="addTeachers" |
255 | label="Select Teacher" | 255 | label="Select Teacher" |
256 | v-model="addlectures.teacherId" | 256 | v-model="addlectures.teacherId" |
257 | :rules="teacherRules" | 257 | :rules="teacherRules" |
258 | item-text="name" | 258 | item-text="name" |
259 | item-value="_id" | 259 | item-value="_id" |
260 | required | 260 | required |
261 | ></v-select> | 261 | ></v-select> |
262 | </v-flex> | 262 | </v-flex> |
263 | </v-layout> | 263 | </v-layout> |
264 | </v-flex> | 264 | </v-flex> |
265 | <v-layout> | 265 | <v-layout> |
266 | <v-flex xs12 sm8 offset-sm2> | 266 | <v-flex xs12 sm8 offset-sm2> |
267 | <v-card-actions> | 267 | <v-card-actions> |
268 | <v-spacer></v-spacer> | 268 | <v-spacer></v-spacer> |
269 | <v-btn round dark @click="AddLecture" class="add-button">Save</v-btn> | 269 | <v-btn round dark @click="AddLecture" class="add-button">Save</v-btn> |
270 | </v-card-actions> | 270 | </v-card-actions> |
271 | </v-flex> | 271 | </v-flex> |
272 | </v-layout> | 272 | </v-layout> |
273 | </v-container> | 273 | </v-container> |
274 | </v-form> | 274 | </v-form> |
275 | </v-card> | 275 | </v-card> |
276 | </v-flex> | 276 | </v-flex> |
277 | </v-dialog> | 277 | </v-dialog> |
278 | 278 | ||
279 | <!-- ****** EDIT PARTICULAR LECTURES TIME-TABLE ****** --> | 279 | <!-- ****** EDIT PARTICULAR LECTURES TIME-TABLE ****** --> |
280 | 280 | ||
281 | <v-dialog v-model="dialogUpdateLectures" max-width="600px"> | 281 | <v-dialog v-model="dialogUpdateLectures" max-width="600px"> |
282 | <v-flex xs12 sm12 class> | 282 | <v-flex xs12 sm12 class> |
283 | <v-card flat class="card-style pa-2" dark> | 283 | <v-card flat class="card-style pa-2" dark> |
284 | <v-layout> | 284 | <v-layout> |
285 | <v-flex xs12> | 285 | <v-flex xs12> |
286 | <label class="title text-xs-center">Edit Lecture</label> | 286 | <label class="title text-xs-center">Edit Lecture</label> |
287 | <v-icon size="24" class="right" @click="dialogUpdateLectures = false">cancel</v-icon> | 287 | <v-icon size="24" class="right" @click="dialogUpdateLectures = false">cancel</v-icon> |
288 | </v-flex> | 288 | </v-flex> |
289 | </v-layout> | 289 | </v-layout> |
290 | <v-flex xs12 sm12> | 290 | <v-flex xs12 sm12> |
291 | <v-layout> | 291 | <v-layout> |
292 | <v-flex xs4 class="pt-4 subheading"> | 292 | <v-flex xs4 class="pt-4 subheading"> |
293 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 293 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
294 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 294 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
295 | </v-flex> | 295 | </v-flex> |
296 | <v-flex xs7 sm6 class="ml-3"> | 296 | <v-flex xs7 sm6 class="ml-3"> |
297 | <v-select | 297 | <v-select |
298 | :items="addclass" | 298 | :items="addclass" |
299 | label="Select Class" | 299 | label="Select Class" |
300 | v-model="updateLectures.select" | 300 | v-model="updateLectures.select" |
301 | item-text="classNum" | 301 | item-text="classNum" |
302 | item-value="_id" | 302 | item-value="_id" |
303 | @change="getClassSubject(updateLectures.select)" | 303 | @change="getClassSubject(updateLectures.select)" |
304 | required | 304 | required |
305 | ></v-select> | 305 | ></v-select> |
306 | </v-flex> | 306 | </v-flex> |
307 | </v-layout> | 307 | </v-layout> |
308 | </v-flex> | 308 | </v-flex> |
309 | <v-flex xs12 sm12> | 309 | <v-flex xs12 sm12> |
310 | <v-layout> | 310 | <v-layout> |
311 | <v-flex xs4 class="pt-4 subheading"> | 311 | <v-flex xs4 class="pt-4 subheading"> |
312 | <label class="right hidden-xs-only hidden-sm-only">Select Subject:</label> | 312 | <label class="right hidden-xs-only hidden-sm-only">Select Subject:</label> |
313 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> | 313 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> |
314 | </v-flex> | 314 | </v-flex> |
315 | <v-flex xs7 sm6 class="ml-3"> | 315 | <v-flex xs7 sm6 class="ml-3"> |
316 | <v-select | 316 | <v-select |
317 | :items="subjectList.subjects" | 317 | :items="subjectList.subjects" |
318 | label="Select Subject" | 318 | label="Select Subject" |
319 | v-model="updateLectures.subjectName" | 319 | v-model="updateLectures.subjectName" |
320 | item-text="subjectName" | 320 | item-text="subjectName" |
321 | item-value="subjectName" | 321 | item-value="subjectName" |
322 | required | 322 | required |
323 | ></v-select> | 323 | ></v-select> |
324 | <!-- <v-text-field | 324 | <!-- <v-text-field |
325 | v-model="updateLectures.subjectName" | 325 | v-model="updateLectures.subjectName" |
326 | placeholder="fill your Subject Name" | 326 | placeholder="fill your Subject Name" |
327 | type="text" | 327 | type="text" |
328 | ></v-text-field>--> | 328 | ></v-text-field>--> |
329 | </v-flex> | 329 | </v-flex> |
330 | </v-layout> | 330 | </v-layout> |
331 | </v-flex> | 331 | </v-flex> |
332 | <v-flex xs12 sm12> | 332 | <v-flex xs12 sm12> |
333 | <v-layout> | 333 | <v-layout> |
334 | <v-flex xs5 sm4 class="pt-4 subheading"> | 334 | <v-flex xs5 sm4 class="pt-4 subheading"> |
335 | <label class="right">Time In:</label> | 335 | <label class="right">Time In:</label> |
336 | </v-flex> | 336 | </v-flex> |
337 | <v-flex xs7 sm6 class="ml-3"> | 337 | <v-flex xs7 sm6 class="ml-3"> |
338 | <v-menu | 338 | <v-menu |
339 | ref="menuC" | 339 | ref="menuC" |
340 | :close-on-content-click="false" | 340 | :close-on-content-click="false" |
341 | v-model="menu4" | 341 | v-model="menu4" |
342 | :nudge-right="40" | 342 | :nudge-right="40" |
343 | lazy | 343 | lazy |
344 | transition="scale-transition" | 344 | transition="scale-transition" |
345 | offset-y | 345 | offset-y |
346 | full-width | 346 | full-width |
347 | max-width="290px" | 347 | max-width="290px" |
348 | min-width="290px" | 348 | min-width="290px" |
349 | > | 349 | > |
350 | <v-text-field | 350 | <v-text-field |
351 | slot="activator" | 351 | slot="activator" |
352 | v-model="updateLectures.timeIn" | 352 | v-model="updateLectures.timeIn" |
353 | placeholder="Select your Time In" | 353 | placeholder="Select your Time In" |
354 | append-icon="access_time" | 354 | append-icon="access_time" |
355 | readonly | 355 | readonly |
356 | ></v-text-field> | 356 | ></v-text-field> |
357 | <v-time-picker v-model="updateLectures.timeIn" @change="menu4= false"></v-time-picker> | 357 | <v-time-picker v-model="updateLectures.timeIn" @change="menu4= false"></v-time-picker> |
358 | </v-menu> | 358 | </v-menu> |
359 | </v-flex> | 359 | </v-flex> |
360 | </v-layout> | 360 | </v-layout> |
361 | </v-flex> | 361 | </v-flex> |
362 | <v-flex xs12 sm12> | 362 | <v-flex xs12 sm12> |
363 | <v-layout> | 363 | <v-layout> |
364 | <v-flex xs5 sm4 class="pt-4 subheading"> | 364 | <v-flex xs5 sm4 class="pt-4 subheading"> |
365 | <label class="right">Time Out:</label> | 365 | <label class="right">Time Out:</label> |
366 | </v-flex> | 366 | </v-flex> |
367 | <v-flex xs7 sm6 class="ml-3"> | 367 | <v-flex xs7 sm6 class="ml-3"> |
368 | <v-menu | 368 | <v-menu |
369 | ref="menuB" | 369 | ref="menuB" |
370 | :close-on-content-click="false" | 370 | :close-on-content-click="false" |
371 | v-model="menu3" | 371 | v-model="menu3" |
372 | :nudge-right="40" | 372 | :nudge-right="40" |
373 | lazy | 373 | lazy |
374 | transition="scale-transition" | 374 | transition="scale-transition" |
375 | offset-y | 375 | offset-y |
376 | full-width | 376 | full-width |
377 | max-width="290px" | 377 | max-width="290px" |
378 | min-width="290px" | 378 | min-width="290px" |
379 | > | 379 | > |
380 | <v-text-field | 380 | <v-text-field |
381 | slot="activator" | 381 | slot="activator" |
382 | v-model="updateLectures.timeOut" | 382 | v-model="updateLectures.timeOut" |
383 | placeholder="Select your Time Out" | 383 | placeholder="Select your Time Out" |
384 | append-icon="access_time" | 384 | append-icon="access_time" |
385 | readonly | 385 | readonly |
386 | ></v-text-field> | 386 | ></v-text-field> |
387 | <v-time-picker v-model="updateLectures.timeOut" @change="menu3 = false"></v-time-picker> | 387 | <v-time-picker v-model="updateLectures.timeOut" @change="menu3 = false"></v-time-picker> |
388 | </v-menu> | 388 | </v-menu> |
389 | </v-flex> | 389 | </v-flex> |
390 | </v-layout> | 390 | </v-layout> |
391 | </v-flex> | 391 | </v-flex> |
392 | <v-flex xs12 sm12> | 392 | <v-flex xs12 sm12> |
393 | <v-layout> | 393 | <v-layout> |
394 | <v-flex xs5 sm4 class="pt-4 subheading"> | 394 | <v-flex xs5 sm4 class="pt-4 subheading"> |
395 | <label class="right">Select Teacher:</label> | 395 | <label class="right">Select Teacher:</label> |
396 | </v-flex> | 396 | </v-flex> |
397 | <v-flex xs7 sm6 class="ml-3"> | 397 | <v-flex xs7 sm6 class="ml-3"> |
398 | <v-select | 398 | <v-select |
399 | :items="addTeachers" | 399 | :items="addTeachers" |
400 | label="Select Teacher" | 400 | label="Select Teacher" |
401 | v-model="updateLectures.teacherId" | 401 | v-model="updateLectures.teacherId" |
402 | item-text="name" | 402 | item-text="name" |
403 | item-value="_id" | 403 | item-value="_id" |
404 | required | 404 | required |
405 | ></v-select> | 405 | ></v-select> |
406 | </v-flex> | 406 | </v-flex> |
407 | </v-layout> | 407 | </v-layout> |
408 | </v-flex> | 408 | </v-flex> |
409 | <v-layout> | 409 | <v-layout> |
410 | <v-flex xs12 sm10 offset-sm1> | 410 | <v-flex xs12 sm10 offset-sm1> |
411 | <v-card-actions> | 411 | <v-card-actions> |
412 | <!-- <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn> --> | 412 | <!-- <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn> --> |
413 | <v-spacer></v-spacer> | 413 | <v-spacer></v-spacer> |
414 | <v-btn | 414 | <v-btn |
415 | round | 415 | round |
416 | dark | 416 | dark |
417 | class="add-button" | 417 | class="add-button" |
418 | @click="updateParticularTable(updateLectures.timeIn,updateLectures.timeOut)" | 418 | @click="updateParticularTable(updateLectures.timeIn,updateLectures.timeOut)" |
419 | >Save</v-btn> | 419 | >Save</v-btn> |
420 | </v-card-actions> | 420 | </v-card-actions> |
421 | </v-flex> | 421 | </v-flex> |
422 | </v-layout> | 422 | </v-layout> |
423 | </v-card> | 423 | </v-card> |
424 | </v-flex> | 424 | </v-flex> |
425 | </v-dialog> | 425 | </v-dialog> |
426 | <!-- ****** EXISTING-USERS TIME-TABLE ****** --> | 426 | <!-- ****** EXISTING-USERS TIME-TABLE ****** --> |
427 | 427 | ||
428 | <!-- <v-card flat> | 428 | <!-- <v-card flat> |
429 | <v-card-actions class="hidden-xs-only hidden-sm-only"> | 429 | <v-card-actions class="hidden-xs-only hidden-sm-only"> |
430 | <v-layout> | 430 | <v-layout> |
431 | <label class="right mt-4 ml-5">Select Class:</label> | 431 | <label class="right mt-4 ml-5">Select Class:</label> |
432 | <v-select | 432 | <v-select |
433 | :items="addclass" | 433 | :items="addclass" |
434 | label="Select Class" | 434 | label="Select Class" |
435 | v-model="selectTimeTable.select" | 435 | v-model="selectTimeTable.select" |
436 | item-text="classNum" | 436 | item-text="classNum" |
437 | item-value="_id" | 437 | item-value="_id" |
438 | name="Select Class" | 438 | name="Select Class" |
439 | @change="getSections(selectTimeTable.select)" | 439 | @change="getSections(selectTimeTable.select)" |
440 | class="px-4" | 440 | class="px-4" |
441 | required | 441 | required |
442 | ></v-select> | 442 | ></v-select> |
443 | <label class="right mt-4">Select Section:</label> | 443 | <label class="right mt-4">Select Section:</label> |
444 | <v-select | 444 | <v-select |
445 | :items="addSection" | 445 | :items="addSection" |
446 | label="Select Section" | 446 | label="Select Section" |
447 | v-model="selectTimeTable.selectSection" | 447 | v-model="selectTimeTable.selectSection" |
448 | item-text="name" | 448 | item-text="name" |
449 | item-value="_id" | 449 | item-value="_id" |
450 | name="Select Section" | 450 | name="Select Section" |
451 | class="pl-3" | 451 | class="pl-3" |
452 | required | 452 | required |
453 | ></v-select> | 453 | ></v-select> |
454 | </v-layout> | 454 | </v-layout> |
455 | <v-spacer></v-spacer> | 455 | <v-spacer></v-spacer> |
456 | <v-btn @click="findTimeTable()" round dark :loading="loadingFindData" class="left">Find</v-btn> | 456 | <v-btn @click="findTimeTable()" round dark :loading="loadingFindData" class="left">Find</v-btn> |
457 | </v-card-actions> | 457 | </v-card-actions> |
458 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 458 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
459 | <v-flex xs4 sm2 class="mt-4 ml-2"> | 459 | <v-flex xs4 sm2 class="mt-4 ml-2"> |
460 | <label>Select Class:</label> | 460 | <label>Select Class:</label> |
461 | </v-flex> | 461 | </v-flex> |
462 | <v-flex xs6 sm9> | 462 | <v-flex xs6 sm9> |
463 | <v-select | 463 | <v-select |
464 | :items="addclass" | 464 | :items="addclass" |
465 | label="Select Class" | 465 | label="Select Class" |
466 | v-model="selectTimeTable.select" | 466 | v-model="selectTimeTable.select" |
467 | item-text="classNum" | 467 | item-text="classNum" |
468 | item-value="_id" | 468 | item-value="_id" |
469 | name="Select Class" | 469 | name="Select Class" |
470 | @change="getSections(selectTimeTable.select)" | 470 | @change="getSections(selectTimeTable.select)" |
471 | required | 471 | required |
472 | ></v-select> | 472 | ></v-select> |
473 | </v-flex> | 473 | </v-flex> |
474 | </v-layout> | 474 | </v-layout> |
475 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 475 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
476 | <v-flex xs4 sm2 class="mt-4 ml-2"> | 476 | <v-flex xs4 sm2 class="mt-4 ml-2"> |
477 | <label>Select Section:</label> | 477 | <label>Select Section:</label> |
478 | </v-flex> | 478 | </v-flex> |
479 | <v-flex xs6 sm9> | 479 | <v-flex xs6 sm9> |
480 | <v-select | 480 | <v-select |
481 | :items="addSection" | 481 | :items="addSection" |
482 | label="Select Section" | 482 | label="Select Section" |
483 | v-model="selectTimeTable.selectSection" | 483 | v-model="selectTimeTable.selectSection" |
484 | item-text="name" | 484 | item-text="name" |
485 | item-value="_id" | 485 | item-value="_id" |
486 | name="Select Section" | 486 | name="Select Section" |
487 | required | 487 | required |
488 | ></v-select> | 488 | ></v-select> |
489 | </v-flex> | 489 | </v-flex> |
490 | </v-layout> | 490 | </v-layout> |
491 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> | 491 | <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only"> |
492 | <v-flex xs12> | 492 | <v-flex xs12> |
493 | <v-btn @click="findTimeTable()" round dark :loading="loading" class="right mr-4 mb-2">Find</v-btn> | 493 | <v-btn @click="findTimeTable()" round dark :loading="loading" class="right mr-4 mb-2">Find</v-btn> |
494 | </v-flex> | 494 | </v-flex> |
495 | </v-layout> | 495 | </v-layout> |
496 | </v-card>--> | 496 | </v-card>--> |
497 | <v-flex xs12> | 497 | <v-flex xs12> |
498 | <v-toolbar color="transparent" flat> | 498 | <v-toolbar color="transparent" flat> |
499 | <v-btn | 499 | <v-btn |
500 | fab | 500 | fab |
501 | dark | 501 | dark |
502 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 502 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
503 | small | 503 | small |
504 | @click="addTimeTableDialog = true" | 504 | @click="addTimeTableDialog = true" |
505 | > | 505 | > |
506 | <v-icon dark>add</v-icon> | 506 | <v-icon dark>add</v-icon> |
507 | </v-btn> | 507 | </v-btn> |
508 | <v-btn | 508 | <v-btn |
509 | round | 509 | round |
510 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 510 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
511 | dark | 511 | dark |
512 | @click="addTimeTableDialog = true" | 512 | @click="addTimeTableDialog = true" |
513 | > | 513 | > |
514 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Time Table | 514 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Time Table |
515 | </v-btn> | 515 | </v-btn> |
516 | <v-flex xs4 md2> | 516 | <v-flex xs4 md2> |
517 | <v-select | 517 | <v-select |
518 | :items="addclass" | 518 | :items="addclass" |
519 | label="Select Class" | 519 | label="Select Class" |
520 | v-model="selectTimeTable.select" | 520 | v-model="selectTimeTable.select" |
521 | item-text="classNum" | 521 | item-text="classNum" |
522 | item-value="_id" | 522 | item-value="_id" |
523 | name="Select Class" | 523 | name="Select Class" |
524 | @change="getSections(selectTimeTable.select)" | 524 | @change="getSections(selectTimeTable.select)" |
525 | required | 525 | required |
526 | ></v-select> | 526 | ></v-select> |
527 | </v-flex> | 527 | </v-flex> |
528 | <v-flex xs4 md2 class="ml-4"> | 528 | <v-flex xs4 md2 class="ml-4"> |
529 | <v-select | 529 | <v-select |
530 | :items="addSection" | 530 | :items="addSection" |
531 | label="Select Section" | 531 | label="Select Section" |
532 | v-model="selectTimeTable.selectSection" | 532 | v-model="selectTimeTable.selectSection" |
533 | item-text="name" | 533 | item-text="name" |
534 | item-value="_id" | 534 | item-value="_id" |
535 | name="Select Section" | 535 | name="Select Section" |
536 | required | 536 | required |
537 | ></v-select> | 537 | ></v-select> |
538 | </v-flex> | 538 | </v-flex> |
539 | <v-spacer></v-spacer> | 539 | <v-spacer></v-spacer> |
540 | <v-btn | 540 | <v-btn |
541 | @click="findTimeTable()" | 541 | @click="findTimeTable()" |
542 | round | 542 | round |
543 | dark | 543 | dark |
544 | :loading="loading" | 544 | :loading="loading" |
545 | class="right mb-2 open-dialog-button" | 545 | class="right mb-2 open-dialog-button" |
546 | >Find</v-btn> | 546 | >Find</v-btn> |
547 | <v-card-title class="body-1" v-show="show"> | 547 | <v-card-title class="body-1" v-show="show"> |
548 | <v-btn icon large flat @click="displaySearch"> | 548 | <v-btn icon large flat @click="displaySearch"> |
549 | <v-avatar size="27"> | 549 | <v-avatar size="27"> |
550 | <img src="/static/icon/search.png" alt="icon" /> | 550 | <img src="/static/icon/search.png" alt="icon" /> |
551 | </v-avatar> | 551 | </v-avatar> |
552 | </v-btn> | 552 | </v-btn> |
553 | </v-card-title> | 553 | </v-card-title> |
554 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 554 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
555 | <v-layout> | 555 | <v-layout> |
556 | <v-text-field | 556 | <v-text-field |
557 | autofocus | 557 | autofocus |
558 | v-model="search" | 558 | v-model="search" |
559 | label="Search" | 559 | label="Search" |
560 | prepend-inner-icon="search" | 560 | prepend-inner-icon="search" |
561 | color="primary" | 561 | color="primary" |
562 | ></v-text-field> | 562 | ></v-text-field> |
563 | <v-icon @click="closeSearch" color="error">close</v-icon> | 563 | <v-icon @click="closeSearch" color="error">close</v-icon> |
564 | </v-layout> | 564 | </v-layout> |
565 | </v-flex> | 565 | </v-flex> |
566 | </v-toolbar> | 566 | </v-toolbar> |
567 | <v-data-table | 567 | <v-data-table |
568 | :headers="headers" | 568 | :headers="headers" |
569 | :items="desserts" | 569 | :items="desserts" |
570 | :pagination.sync="pagination" | 570 | :pagination.sync="pagination" |
571 | :search="search" | 571 | :search="search" |
572 | item-key="_id" | 572 | item-key="_id" |
573 | > | 573 | > |
574 | <template slot="items" slot-scope="props"> | 574 | <template slot="items" slot-scope="props"> |
575 | <tr | 575 | <tr |
576 | style="cursor: pointer;" | 576 | style="cursor: pointer;" |
577 | class="tr" | 577 | class="tr" |
578 | @click="getTimeTable(props.item), props.expanded = !props.expanded" | 578 | @click="getTimeTable(props.item), props.expanded = !props.expanded" |
579 | > | 579 | > |
580 | <td class="td td-row">{{ props.index + 1}}</td> | 580 | <td class="td td-row">{{ props.index + 1}}</td> |
581 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum}}</td> | 581 | <td class="text-xs-center td td-row">{{ props.item.classData.classNum}}</td> |
582 | <td class="text-xs-center td td-row">{{ props.item.sectionData.name }}</td> | 582 | <td class="text-xs-center td td-row">{{ props.item.sectionData.name }}</td> |
583 | <td class="text-xs-center td td-row"> | 583 | <td class="text-xs-center td td-row"> |
584 | <span> | 584 | <span> |
585 | <v-tooltip top> | 585 | <v-tooltip top> |
586 | <img | 586 | <img |
587 | slot="activator" | 587 | slot="activator" |
588 | style="cursor:pointer; width:20px; height:20px; " | 588 | style="cursor:pointer; width:20px; height:20px; " |
589 | class="mr-3" | 589 | class="mr-3" |
590 | @click="editItem(props.item)" | 590 | @click="editItem(props.item)" |
591 | src="/static/icon/edit.png" | 591 | src="/static/icon/edit.png" |
592 | /> | 592 | /> |
593 | <span>Edit</span> | 593 | <span>Edit</span> |
594 | </v-tooltip> | 594 | </v-tooltip> |
595 | <v-tooltip top> | 595 | <v-tooltip top> |
596 | <img | 596 | <img |
597 | slot="activator" | 597 | slot="activator" |
598 | style="cursor:pointer; width:20px; height:20px; " | 598 | style="cursor:pointer; width:20px; height:20px; " |
599 | class="mr-3" | 599 | class="mr-3" |
600 | @click="deleteItem(props.item)" | 600 | @click="deleteItem(props.item)" |
601 | src="/static/icon/delete.png" | 601 | src="/static/icon/delete.png" |
602 | /> | 602 | /> |
603 | <span>Delete</span> | 603 | <span>Delete</span> |
604 | </v-tooltip> | 604 | </v-tooltip> |
605 | <v-tooltip top> | 605 | <v-tooltip top> |
606 | <img | 606 | <img |
607 | slot="activator" | 607 | slot="activator" |
608 | style="cursor:pointer; width:20px; height:20px; " | 608 | style="cursor:pointer; width:20px; height:20px; " |
609 | class="mr-3" | 609 | class="mr-3" |
610 | src="/static/icon/add1.png" | 610 | src="/static/icon/add1.png" |
611 | @click="addSchedule(props.item._id)" | 611 | @click="addSchedule(props.item._id)" |
612 | /> | 612 | /> |
613 | <span>Add</span> | 613 | <span>Add</span> |
614 | </v-tooltip> | 614 | </v-tooltip> |
615 | </span> | 615 | </span> |
616 | </td> | 616 | </td> |
617 | </tr> | 617 | </tr> |
618 | </template> | 618 | </template> |
619 | <template slot="expand" slot-scope="props"> | 619 | <template slot="expand" slot-scope="props"> |
620 | <v-data-table | 620 | <v-data-table |
621 | :items="timeTableList.schedule" | 621 | :items="timeTableList.schedule" |
622 | hide-actions | 622 | hide-actions |
623 | item-key="title" | 623 | item-key="title" |
624 | style="width: auto;" | 624 | style="width: auto;" |
625 | > | 625 | > |
626 | <template slot="items" slot-scope="props"> | 626 | <template slot="items" slot-scope="props"> |
627 | <tr class="tr"> | 627 | <tr class="tr"> |
628 | <td class="text-xs-left subheading table-td td td-row"> | 628 | <td class="text-xs-left subheading table-td td td-row"> |
629 | <b>{{ props.item.day }}</b> | 629 | <b>{{ props.item.day }}</b> |
630 | </td> | 630 | </td> |
631 | <td class="table-td td td-row"> | 631 | <td class="table-td td td-row"> |
632 | <b>Subject</b> | 632 | <b>Subject</b> |
633 | <br /> | 633 | <br /> |
634 | <b>Time In</b> | 634 | <b>Time In</b> |
635 | <br /> | 635 | <br /> |
636 | <b>Time Out</b> | 636 | <b>Time Out</b> |
637 | </td> | 637 | </td> |
638 | <td v-for="list in props.item.lectures" class="table-td td td-row"> | 638 | <td v-for="list in props.item.lectures" class="table-td td td-row"> |
639 | <b>{{ list.subjectName }}</b> | 639 | <b>{{ list.subjectName }}</b> |
640 | <img | 640 | <img |
641 | style="cursor:pointer; width:20px; height:18px; " | 641 | style="cursor:pointer; width:20px; height:18px; " |
642 | class="mr-2 ml-2" | 642 | class="mr-2 ml-2" |
643 | src="/static/icon/edit1.png" | 643 | src="/static/icon/edit1.png" |
644 | @click="updateTimeTable(list, timeTableList,props.item._id)" | 644 | @click="updateTimeTable(list, timeTableList,props.item._id)" |
645 | /> | 645 | /> |
646 | <img | 646 | <img |
647 | style="cursor:pointer; width:20px; height:20px; " | 647 | style="cursor:pointer; width:20px; height:20px; " |
648 | src="/static/icon/delete1.png" | 648 | src="/static/icon/delete1.png" |
649 | @click="deleteTimeTable(list,props.item.lectures)" | 649 | @click="deleteTimeTable(list,props.item.lectures)" |
650 | /> | 650 | /> |
651 | <br /> | 651 | <br /> |
652 | {{list.timeIn}} | 652 | {{list.timeIn}} |
653 | <br /> | 653 | <br /> |
654 | {{list.timeOut}} | 654 | {{list.timeOut}} |
655 | </td> | 655 | </td> |
656 | <td class="td td-row"> | 656 | <td class="td td-row"> |
657 | <v-tooltip top> | 657 | <v-tooltip top> |
658 | <v-icon | 658 | <v-icon |
659 | slot="activator" | 659 | slot="activator" |
660 | color="black" | 660 | color="black" |
661 | @click="addLecture(props.item._id, timeTableList._id)" | 661 | @click="addLecture(props.item._id, timeTableList._id)" |
662 | >add_circle_outline</v-icon> | 662 | >add_circle_outline</v-icon> |
663 | <span>Add</span> | 663 | <span>Add</span> |
664 | </v-tooltip> | 664 | </v-tooltip> |
665 | </td> | 665 | </td> |
666 | </tr> | 666 | </tr> |
667 | </template> | 667 | </template> |
668 | </v-data-table> | 668 | </v-data-table> |
669 | </template> | 669 | </template> |
670 | <v-alert | 670 | <v-alert |
671 | slot="no-results" | 671 | slot="no-results" |
672 | :value="true" | 672 | :value="true" |
673 | color="error" | 673 | color="error" |
674 | icon="warning" | 674 | icon="warning" |
675 | >Your search for "{{ search }}" found no results.</v-alert> | 675 | >Your search for "{{ search }}" found no results.</v-alert> |
676 | </v-data-table> | 676 | </v-data-table> |
677 | <br /> | 677 | <br /> |
678 | <br /> | 678 | <br /> |
679 | </v-flex> | 679 | </v-flex> |
680 | 680 | ||
681 | <!-- ****** ADD TIME-TABLE ****** --> | 681 | <!-- ****** ADD TIME-TABLE ****** --> |
682 | <v-dialog v-model="addTimeTableDialog" max-width="600px"> | 682 | <v-dialog v-model="addTimeTableDialog" max-width="600px" v-if="addTimeTableDialog"> |
683 | <v-card flat class="card-style pa-2" dark> | 683 | <v-card flat class="card-style pa-2" dark> |
684 | <v-layout> | 684 | <v-layout> |
685 | <v-flex xs12> | 685 | <v-flex xs12> |
686 | <label class="title text-xs-center">Add Time Table</label> | 686 | <label class="title text-xs-center">Add Time Table</label> |
687 | <v-icon size="24" class="right" @click="addTimeTableDialog = false">cancel</v-icon> | 687 | <v-icon size="24" class="right" @click="closeAddTimeTableModel">cancel</v-icon> |
688 | </v-flex> | 688 | </v-flex> |
689 | </v-layout> | 689 | </v-layout> |
690 | <v-form ref="form" v-model="valid" lazy-validation> | 690 | <v-form ref="form" v-model="valid" lazy-validation> |
691 | <v-container fluid class="pt-3"> | 691 | <v-container fluid class="pt-3"> |
692 | <v-flex xs12> | 692 | <v-flex xs12> |
693 | <v-layout> | 693 | <v-layout> |
694 | <v-flex xs4 class="pt-4 subheading"> | 694 | <v-flex xs4 class="pt-4 subheading"> |
695 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> | 695 | <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> |
696 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> | 696 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> |
697 | </v-flex> | 697 | </v-flex> |
698 | <v-flex xs8 sm6 class="ml-3"> | 698 | <v-flex xs8 sm6 class="ml-3"> |
699 | <v-select | 699 | <v-select |
700 | :items="addclass" | 700 | :items="addclass" |
701 | label="Select Class" | 701 | label="Select Class" |
702 | v-model="timeTable.select" | 702 | v-model="timeTable.select" |
703 | item-text="classNum" | 703 | item-text="classNum" |
704 | item-value="_id" | 704 | item-value="_id" |
705 | @change="getSections(timeTable.select)" | 705 | @change="getSections(timeTable.select)" |
706 | :rules="classRules" | 706 | :rules="classRules" |
707 | required | 707 | required |
708 | ></v-select> | 708 | ></v-select> |
709 | </v-flex> | 709 | </v-flex> |
710 | </v-layout> | 710 | </v-layout> |
711 | </v-flex> | 711 | </v-flex> |
712 | <v-flex xs12> | 712 | <v-flex xs12> |
713 | <v-layout> | 713 | <v-layout> |
714 | <v-flex xs4 class="pt-4 subheading"> | 714 | <v-flex xs4 class="pt-4 subheading"> |
715 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> | 715 | <label class="right hidden-xs-only hidden-sm-only">Select Section:</label> |
716 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> | 716 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label> |
717 | </v-flex> | 717 | </v-flex> |
718 | <v-flex sm6 xs8 class="ml-3"> | 718 | <v-flex sm6 xs8 class="ml-3"> |
719 | <v-select | 719 | <v-select |
720 | :items="addSection" | 720 | :items="addSection" |
721 | label="Select Section" | 721 | label="Select Section" |
722 | v-model="timeTable.selectSection" | 722 | v-model="timeTable.selectSection" |
723 | item-text="name" | 723 | item-text="name" |
724 | item-value="_id" | 724 | item-value="_id" |
725 | :rules="sectionRules" | 725 | :rules="sectionRules" |
726 | @change="getClassSubject(timeTable.select)" | 726 | @change="getClassSubject(timeTable.select)" |
727 | required | 727 | required |
728 | ></v-select> | 728 | ></v-select> |
729 | </v-flex> | 729 | </v-flex> |
730 | </v-layout> | 730 | </v-layout> |
731 | <v-layout> | 731 | <v-layout> |
732 | <v-flex xs4 class="pt-4 subheading"> | 732 | <v-flex xs4 class="pt-4 subheading"> |
733 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> | 733 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> |
734 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> | 734 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> |
735 | </v-flex> | 735 | </v-flex> |
736 | <v-flex xs8 sm6 class="ml-3"> | 736 | <v-flex xs8 sm6 class="ml-3"> |
737 | <v-select | 737 | <v-select |
738 | :items="subjectList.subjects" | 738 | :items="subjectList.subjects" |
739 | label="Select Subject" | 739 | label="Select Subject" |
740 | v-model="timeTable.subjectName" | 740 | v-model="timeTable.subjectName" |
741 | item-text="subjectName" | 741 | item-text="subjectName" |
742 | item-value="subjectName" | 742 | item-value="subjectName" |
743 | :rules="subjectNameRules" | 743 | :rules="subjectNameRules" |
744 | required | 744 | required |
745 | ></v-select> | 745 | ></v-select> |
746 | </v-flex> | 746 | </v-flex> |
747 | </v-layout> | 747 | </v-layout> |
748 | </v-flex> | 748 | </v-flex> |
749 | <v-flex xs12> | 749 | <v-flex xs12> |
750 | <v-layout> | 750 | <v-layout> |
751 | <v-flex xs4 class="pt-4 subheading"> | 751 | <v-flex xs4 class="pt-4 subheading"> |
752 | <label class="right hidden-xs-only hidden-sm-only">Select Teacher:</label> | 752 | <label class="right hidden-xs-only hidden-sm-only">Select Teacher:</label> |
753 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Teacher:</label> | 753 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Teacher:</label> |
754 | </v-flex> | 754 | </v-flex> |
755 | <v-flex xs8 sm6 class="ml-3"> | 755 | <v-flex xs8 sm6 class="ml-3"> |
756 | <v-select | 756 | <v-select |
757 | :items="addTeachers" | 757 | :items="addTeachers" |
758 | label="Select Teacher" | 758 | label="Select Teacher" |
759 | v-model="timeTable.selectTeacher" | 759 | v-model="timeTable.selectTeacher" |
760 | item-text="name" | 760 | item-text="name" |
761 | item-value="_id" | 761 | item-value="_id" |
762 | :rules="teacherRules" | 762 | :rules="teacherRules" |
763 | required | 763 | required |
764 | ></v-select> | 764 | ></v-select> |
765 | </v-flex> | 765 | </v-flex> |
766 | </v-layout> | 766 | </v-layout> |
767 | </v-flex> | 767 | </v-flex> |
768 | <v-flex xs12> | 768 | <v-flex xs12> |
769 | <v-layout> | 769 | <v-layout> |
770 | <v-flex xs4 class="pt-4 subheading"> | 770 | <v-flex xs4 class="pt-4 subheading"> |
771 | <label class="right">Select Day:</label> | 771 | <label class="right">Select Day:</label> |
772 | </v-flex> | 772 | </v-flex> |
773 | <v-flex xs8 sm6 class="ml-3"> | 773 | <v-flex xs8 sm6 class="ml-3"> |
774 | <v-select | 774 | <v-select |
775 | :items="addOneDay" | 775 | :items="addOneDay" |
776 | label="Select Day" | 776 | label="Select Day" |
777 | v-model="timeTable.selectDay" | 777 | v-model="timeTable.selectDay" |
778 | :rules="dayRules" | 778 | :rules="dayRules" |
779 | item-text="name" | 779 | item-text="name" |
780 | item-value="_id" | 780 | item-value="_id" |
781 | required | 781 | required |
782 | ></v-select> | 782 | ></v-select> |
783 | </v-flex> | 783 | </v-flex> |
784 | </v-layout> | 784 | </v-layout> |
785 | </v-flex> | 785 | </v-flex> |
786 | <!-- <v-flex xs12> | 786 | <!-- <v-flex xs12> |
787 | <v-layout> | 787 | <v-layout> |
788 | <v-flex xs4 class="pt-4 subheading"> | 788 | <v-flex xs4 class="pt-4 subheading"> |
789 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> | 789 | <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label> |
790 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> | 790 | <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label> |
791 | </v-flex> | 791 | </v-flex> |
792 | <v-flex xs8 sm6 class="ml-3"> | 792 | <v-flex xs8 sm6 class="ml-3"> |
793 | <v-text-field | 793 | <v-text-field |
794 | placeholder="fill your Subject Name" | 794 | placeholder="fill your Subject Name" |
795 | :rules="subjectNameRules" | 795 | :rules="subjectNameRules" |
796 | v-model="timeTable.subjectName" | 796 | v-model="timeTable.subjectName" |
797 | type="text" | 797 | type="text" |
798 | required | 798 | required |
799 | ></v-text-field> | 799 | ></v-text-field> |
800 | </v-flex> | 800 | </v-flex> |
801 | </v-layout> | 801 | </v-layout> |
802 | </v-flex>--> | 802 | </v-flex>--> |
803 | <v-flex xs12> | 803 | <v-flex xs12> |
804 | <v-layout> | 804 | <v-layout> |
805 | <v-flex xs4 class="pt-4 subheading"> | 805 | <v-flex xs4 class="pt-4 subheading"> |
806 | <label class="right">Time In:</label> | 806 | <label class="right">Time In:</label> |
807 | </v-flex> | 807 | </v-flex> |
808 | <v-flex xs8 sm6 class="ml-3"> | 808 | <v-flex xs8 sm6 class="ml-3"> |
809 | <v-menu | 809 | <v-menu |
810 | ref="menuA" | 810 | ref="menuA" |
811 | :close-on-content-click="false" | 811 | :close-on-content-click="false" |
812 | v-model="menu2" | 812 | v-model="menu2" |
813 | :nudge-right="40" | 813 | :nudge-right="40" |
814 | :return-value.sync="timeTable.timeIn" | 814 | :return-value.sync="timeTable.timeIn" |
815 | lazy | 815 | lazy |
816 | transition="scale-transition" | 816 | transition="scale-transition" |
817 | offset-y | 817 | offset-y |
818 | full-width | 818 | full-width |
819 | max-width="290px" | 819 | max-width="290px" |
820 | min-width="290px" | 820 | min-width="290px" |
821 | > | 821 | > |
822 | <v-text-field | 822 | <v-text-field |
823 | slot="activator" | 823 | slot="activator" |
824 | v-model="timeTable.timeIn" | 824 | v-model="timeTable.timeIn" |
825 | label="Select your timeIn" | 825 | label="Select your timeIn" |
826 | append-icon="access_time" | 826 | append-icon="access_time" |
827 | :rules="timeInRules" | 827 | :rules="timeInRules" |
828 | readonly | 828 | readonly |
829 | ></v-text-field> | 829 | ></v-text-field> |
830 | <v-time-picker | 830 | <v-time-picker |
831 | v-model="timeTable.timeIn" | 831 | v-model="timeTable.timeIn" |
832 | @change="$refs.menuA.save(timeTable.timeIn)" | 832 | @change="$refs.menuA.save(timeTable.timeIn)" |
833 | ></v-time-picker> | 833 | ></v-time-picker> |
834 | </v-menu> | 834 | </v-menu> |
835 | </v-flex> | 835 | </v-flex> |
836 | </v-layout> | 836 | </v-layout> |
837 | </v-flex> | 837 | </v-flex> |
838 | <v-flex xs12> | 838 | <v-flex xs12> |
839 | <v-layout> | 839 | <v-layout> |
840 | <v-flex xs4 class="pt-4 subheading"> | 840 | <v-flex xs4 class="pt-4 subheading"> |
841 | <label class="right">Time Out:</label> | 841 | <label class="right">Time Out:</label> |
842 | </v-flex> | 842 | </v-flex> |
843 | <v-flex xs8 sm6 class="ml-3"> | 843 | <v-flex xs8 sm6 class="ml-3"> |
844 | <v-menu | 844 | <v-menu |
845 | ref="menu" | 845 | ref="menu" |
846 | :close-on-content-click="false" | 846 | :close-on-content-click="false" |
847 | v-model="menu1" | 847 | v-model="menu1" |
848 | :nudge-right="40" | 848 | :nudge-right="40" |
849 | :return-value.sync="timeTable.timeOut" | 849 | :return-value.sync="timeTable.timeOut" |
850 | lazy | 850 | lazy |
851 | transition="scale-transition" | 851 | transition="scale-transition" |
852 | offset-y | 852 | offset-y |
853 | full-width | 853 | full-width |
854 | max-width="290px" | 854 | max-width="290px" |
855 | min-width="290px" | 855 | min-width="290px" |
856 | > | 856 | > |
857 | <v-text-field | 857 | <v-text-field |
858 | slot="activator" | 858 | slot="activator" |
859 | v-model="timeTable.timeOut" | 859 | v-model="timeTable.timeOut" |
860 | label="Select your Time Out" | 860 | label="Select your Time Out" |
861 | append-icon="access_time" | 861 | append-icon="access_time" |
862 | :rules="timeOutRules" | 862 | :rules="timeOutRules" |
863 | readonly | 863 | readonly |
864 | ></v-text-field> | 864 | ></v-text-field> |
865 | <v-time-picker | 865 | <v-time-picker |
866 | v-model="timeTable.timeOut" | 866 | v-model="timeTable.timeOut" |
867 | @change="$refs.menu.save(timeTable.timeOut)" | 867 | @change="$refs.menu.save(timeTable.timeOut)" |
868 | ></v-time-picker> | 868 | ></v-time-picker> |
869 | </v-menu> | 869 | </v-menu> |
870 | </v-flex> | 870 | </v-flex> |
871 | </v-layout> | 871 | </v-layout> |
872 | </v-flex> | 872 | </v-flex> |
873 | <v-layout> | 873 | <v-layout> |
874 | <v-flex xs12 sm11> | 874 | <v-flex xs12 sm11> |
875 | <v-layout> | 875 | <v-layout> |
876 | <v-spacer></v-spacer> | 876 | <v-spacer></v-spacer> |
877 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 877 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
878 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 878 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
879 | </v-layout> | 879 | </v-layout> |
880 | </v-flex> | 880 | </v-flex> |
881 | </v-layout> | 881 | </v-layout> |
882 | </v-container> | 882 | </v-container> |
883 | </v-form> | 883 | </v-form> |
884 | </v-card> | 884 | </v-card> |
885 | </v-dialog> | 885 | </v-dialog> |
886 | <div class="loader" v-if="showLoader"> | 886 | <div class="loader" v-if="showLoader"> |
887 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 887 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
888 | </div> | 888 | </div> |
889 | <v-snackbar | 889 | <v-snackbar |
890 | :timeout="timeout" | 890 | :timeout="timeout" |
891 | :top="y === 'top'" | 891 | :top="y === 'top'" |
892 | :right="x === 'right'" | 892 | :right="x === 'right'" |
893 | :vertical="mode === 'vertical'" | 893 | :vertical="mode === 'vertical'" |
894 | v-model="snackbar" | 894 | v-model="snackbar" |
895 | :color="color" | 895 | :color="color" |
896 | >{{ text }}</v-snackbar> | 896 | >{{ text }}</v-snackbar> |
897 | </v-container> | 897 | </v-container> |
898 | </template> | 898 | </template> |
899 | <script> | 899 | <script> |
900 | import http from "@/Services/http.js"; | 900 | import http from "@/Services/http.js"; |
901 | import Util from "@/util"; | 901 | import Util from "@/util"; |
902 | 902 | ||
903 | export default { | 903 | export default { |
904 | data: () => ({ | 904 | data: () => ({ |
905 | y: "top", | 905 | y: "top", |
906 | x: "right", | 906 | x: "right", |
907 | mode: "", | 907 | mode: "", |
908 | timeout: 3000, | 908 | timeout: 3000, |
909 | text: "", | 909 | text: "", |
910 | search: "", | 910 | search: "", |
911 | color: "", | 911 | color: "", |
912 | snackbar: false, | 912 | snackbar: false, |
913 | loading: false, | 913 | loading: false, |
914 | showLoader: false, | 914 | showLoader: false, |
915 | dialog: false, | 915 | dialog: false, |
916 | show: true, | 916 | show: true, |
917 | showSearch: false, | 917 | showSearch: false, |
918 | dialogAddLecture: false, | 918 | dialogAddLecture: false, |
919 | dialogUpdateLectures: false, | 919 | dialogUpdateLectures: false, |
920 | dialogSchedule: false, | 920 | dialogSchedule: false, |
921 | dialog1: false, | 921 | dialog1: false, |
922 | valid: true, | 922 | valid: true, |
923 | addTimeTableDialog: false, | 923 | addTimeTableDialog: false, |
924 | validAddDay: true, | 924 | validAddDay: true, |
925 | loadingFindData: false, | 925 | loadingFindData: false, |
926 | addclass: [], | 926 | addclass: [], |
927 | addSection: [], | 927 | addSection: [], |
928 | subjectList: [], | 928 | subjectList: [], |
929 | addTeachers: [], | 929 | addTeachers: [], |
930 | gender: ["Male", "Female"], | 930 | gender: ["Male", "Female"], |
931 | pagination: { | 931 | pagination: { |
932 | rowsPerPage: 15 | 932 | rowsPerPage: 15, |
933 | }, | 933 | }, |
934 | imageData: {}, | 934 | imageData: {}, |
935 | imageName: "", | 935 | imageName: "", |
936 | imageUrl: "", | 936 | imageUrl: "", |
937 | imageFile: "", | 937 | imageFile: "", |
938 | timeInRules: [v => !!v || "Time In is required"], | 938 | timeInRules: [(v) => !!v || "Time In is required"], |
939 | timeOutRules: [v => !!v || "Time Out is required"], | 939 | timeOutRules: [(v) => !!v || "Time Out is required"], |
940 | lectureRules: [v => !!v || "Lecture No is required"], | 940 | lectureRules: [(v) => !!v || "Lecture No is required"], |
941 | subjectNameRules: [v => !!v || "Subject Name is required"], | 941 | subjectNameRules: [(v) => !!v || "Subject Name is required"], |
942 | classRules: [v => !!v || "Class Name is required"], | 942 | classRules: [(v) => !!v || "Class Name is required"], |
943 | sectionRules: [v => !!v || "Section Name is required"], | 943 | sectionRules: [(v) => !!v || "Section Name is required"], |
944 | sectionRules: [v => !!v || "Section Name is required"], | 944 | sectionRules: [(v) => !!v || "Section Name is required"], |
945 | teacherRules: [v => !!v || "Teacher Name is required"], | 945 | teacherRules: [(v) => !!v || "Teacher Name is required"], |
946 | selecDayRule: [v => !!v || "Day is required"], | 946 | selecDayRule: [(v) => !!v || "Day is required"], |
947 | dayRules: [v => !!v || "Day is required"], | 947 | dayRules: [(v) => !!v || "Day is required"], |
948 | getParticulerLecture: "", | 948 | getParticulerLecture: "", |
949 | headers: [ | 949 | headers: [ |
950 | { | 950 | { |
951 | text: "No", | 951 | text: "No", |
952 | align: "", | 952 | align: "", |
953 | sortable: false, | 953 | sortable: false, |
954 | value: "No" | 954 | value: "No", |
955 | }, | 955 | }, |
956 | { | 956 | { |
957 | text: "Class Name", | 957 | text: "Class Name", |
958 | value: "classData.classNum", | 958 | value: "classData.classNum", |
959 | sortable: false, | 959 | sortable: false, |
960 | align: "center" | 960 | align: "center", |
961 | }, | 961 | }, |
962 | { | 962 | { |
963 | text: "Section Name", | 963 | text: "Section Name", |
964 | value: "sectionData.name", | 964 | value: "sectionData.name", |
965 | sortable: false, | 965 | sortable: false, |
966 | align: "center" | 966 | align: "center", |
967 | }, | 967 | }, |
968 | { text: "Action", value: "", sortable: false, align: "center" } | 968 | { text: "Action", value: "", sortable: false, align: "center" }, |
969 | ], | 969 | ], |
970 | daysHeaders: [ | 970 | daysHeaders: [ |
971 | { text: "Day", value: "dayday", sortable: false, align: "center" }, | 971 | { text: "Day", value: "dayday", sortable: false, align: "center" }, |
972 | { | 972 | { |
973 | text: "Subject Name", | 973 | text: "Subject Name", |
974 | value: "subjectName", | 974 | value: "subjectName", |
975 | sortable: false, | 975 | sortable: false, |
976 | align: "center" | 976 | align: "center", |
977 | }, | 977 | }, |
978 | { text: "Time In", value: "timeIn", sortable: false, align: "center" }, | 978 | { text: "Time In", value: "timeIn", sortable: false, align: "center" }, |
979 | { text: "Time Out", value: "timeOut", sortable: false, align: "center" } | 979 | { text: "Time Out", value: "timeOut", sortable: false, align: "center" }, |
980 | ], | 980 | ], |
981 | addOneDay: [ | 981 | addOneDay: [ |
982 | "Monday", | 982 | "Monday", |
983 | "Tuesday", | 983 | "Tuesday", |
984 | "Wednesday", | 984 | "Wednesday", |
985 | "Thursday", | 985 | "Thursday", |
986 | "Friday", | 986 | "Friday", |
987 | "Saturday", | 987 | "Saturday", |
988 | "Sunday" | 988 | "Sunday", |
989 | ], | 989 | ], |
990 | schedule: { | 990 | schedule: { |
991 | selectDay: "" | 991 | selectDay: "", |
992 | }, | 992 | }, |
993 | desserts: [], | 993 | desserts: [], |
994 | timeTableList: [], | 994 | timeTableList: [], |
995 | editedIndex: -1, | 995 | editedIndex: -1, |
996 | selectTimeTable: { | 996 | selectTimeTable: { |
997 | select: "", | 997 | select: "", |
998 | selectSection: "" | 998 | selectSection: "", |
999 | }, | 999 | }, |
1000 | timeTable: { | 1000 | timeTable: { |
1001 | select: "", | 1001 | select: "", |
1002 | selectSection: "", | 1002 | selectSection: "", |
1003 | selectDay: "", | 1003 | selectDay: "", |
1004 | timeIn: null, | 1004 | timeIn: null, |
1005 | timeOut: null, | 1005 | timeOut: null, |
1006 | subjectName: "", | 1006 | subjectName: "", |
1007 | selectTeacher: "" | 1007 | selectTeacher: "", |
1008 | }, | 1008 | }, |
1009 | editedItem: { | 1009 | editedItem: { |
1010 | classNum: "", | 1010 | classNum: "", |
1011 | selectSection: "" | 1011 | selectSection: "", |
1012 | }, | 1012 | }, |
1013 | addlectures: { | 1013 | addlectures: { |
1014 | timeIn: null, | 1014 | timeIn: null, |
1015 | timeOut: null, | 1015 | timeOut: null, |
1016 | subjectName: "", | 1016 | subjectName: "", |
1017 | teacherId: "", | 1017 | teacherId: "", |
1018 | scheduleId: "", | 1018 | scheduleId: "", |
1019 | timeTableId: "", | 1019 | timeTableId: "", |
1020 | select: "" | 1020 | select: "", |
1021 | }, | 1021 | }, |
1022 | updateLectures: { | 1022 | updateLectures: { |
1023 | timeIn: null, | 1023 | timeIn: null, |
1024 | timeOut: null, | 1024 | timeOut: null, |
1025 | subjectName: "", | 1025 | subjectName: "", |
1026 | teacherId: "", | 1026 | teacherId: "", |
1027 | select: "" | 1027 | select: "", |
1028 | }, | 1028 | }, |
1029 | updateLecturesId: { | 1029 | updateLecturesId: { |
1030 | lectureId: "", | 1030 | lectureId: "", |
1031 | scheduleId: "" | 1031 | scheduleId: "", |
1032 | }, | 1032 | }, |
1033 | menu1: false, | 1033 | menu1: false, |
1034 | menu2: false, | 1034 | menu2: false, |
1035 | menu3: false, | 1035 | menu3: false, |
1036 | menu4: false, | 1036 | menu4: false, |
1037 | menu5: false, | 1037 | menu5: false, |
1038 | menu6: false, | 1038 | menu6: false, |
1039 | scheduleDayId: "" | 1039 | scheduleDayId: "", |
1040 | }), | 1040 | }), |
1041 | watch: { | ||
1042 | addTimeTableDialog: function (val) { | ||
1043 | if (!val) { | ||
1044 | this.timeTable = []; | ||
1045 | } | ||
1046 | }, | ||
1047 | }, | ||
1041 | methods: { | 1048 | methods: { |
1042 | findTimeTable() { | 1049 | findTimeTable() { |
1043 | this.loadingFindData = true; | 1050 | this.loadingFindData = true; |
1044 | http() | 1051 | http() |
1045 | .get("/getParticularClassTimeTable", { | 1052 | .get("/getParticularClassTimeTable", { |
1046 | params: { | 1053 | params: { |
1047 | sectionId: this.selectTimeTable.selectSection, | 1054 | sectionId: this.selectTimeTable.selectSection, |
1048 | classId: this.selectTimeTable.select | 1055 | classId: this.selectTimeTable.select, |
1049 | } | 1056 | }, |
1050 | }) | 1057 | }) |
1051 | .then(response => { | 1058 | .then((response) => { |
1052 | this.desserts = response.data.data; | 1059 | this.desserts = response.data.data; |
1053 | this.loadingFindData = false; | 1060 | this.loadingFindData = false; |
1054 | }) | 1061 | }) |
1055 | .catch(error => { | 1062 | .catch((error) => { |
1056 | this.loadingFindData = false; | 1063 | this.loadingFindData = false; |
1057 | this.snackbar = true; | 1064 | this.snackbar = true; |
1058 | this.text = error.response.data.message; | 1065 | this.text = error.response.data.message; |
1059 | this.text = error.response.data.statusText; | 1066 | this.text = error.response.data.statusText; |
1060 | }); | 1067 | }); |
1061 | }, | 1068 | }, |
1062 | getSections(_id) { | 1069 | getSections(_id) { |
1063 | var token = this.$store.state.token; | 1070 | var token = this.$store.state.token; |
1064 | http() | 1071 | http() |
1065 | .get( | 1072 | .get( |
1066 | "/getSectionsList", | 1073 | "/getSectionsList", |
1067 | { params: { classId: _id } }, | 1074 | { params: { classId: _id } }, |
1068 | { | 1075 | { |
1069 | headers: { Authorization: "Bearer " + token } | 1076 | headers: { Authorization: "Bearer " + token }, |
1070 | } | 1077 | } |
1071 | ) | 1078 | ) |
1072 | .then(response => { | 1079 | .then((response) => { |
1073 | this.addSection = response.data.data; | 1080 | this.addSection = response.data.data; |
1074 | }) | 1081 | }) |
1075 | .catch(err => { | 1082 | .catch((err) => { |
1076 | // console.log("err====>", err); | 1083 | // console.log("err====>", err); |
1077 | }); | 1084 | }); |
1078 | }, | 1085 | }, |
1079 | getClassSubject(_id) { | 1086 | getClassSubject(_id) { |
1080 | this.showLoader = true; | 1087 | this.showLoader = true; |
1081 | // this.classId = this.classId; | 1088 | // this.classId = this.classId; |
1082 | http() | 1089 | http() |
1083 | .get( | 1090 | .get( |
1084 | "/getParticularClass", | 1091 | "/getParticularClass", |
1085 | { params: { classId: _id } }, | 1092 | { params: { classId: _id } }, |
1086 | { | 1093 | { |
1087 | headers: { Authorization: "Bearer " + this.token } | 1094 | headers: { Authorization: "Bearer " + this.token }, |
1088 | } | 1095 | } |
1089 | ) | 1096 | ) |
1090 | .then(response => { | 1097 | .then((response) => { |
1091 | this.subjectList = response.data.data; | 1098 | this.subjectList = response.data.data; |
1092 | this.showLoader = false; | 1099 | this.showLoader = false; |
1093 | }) | 1100 | }) |
1094 | .catch(err => { | 1101 | .catch((err) => { |
1095 | this.showLoader = false; | 1102 | this.showLoader = false; |
1096 | }); | 1103 | }); |
1097 | }, | 1104 | }, |
1098 | getTimeTable(item) { | 1105 | getTimeTable(item) { |
1099 | this.showLoader = true; | 1106 | this.showLoader = true; |
1100 | this.getParticulerLecture = item._id; | 1107 | this.getParticulerLecture = item._id; |
1101 | this.getTimeTableDayData(); | 1108 | this.getTimeTableDayData(); |
1102 | }, | 1109 | }, |
1103 | getTimeTableDayData() { | 1110 | getTimeTableDayData() { |
1104 | var token = this.$store.state.token; | 1111 | var token = this.$store.state.token; |
1105 | http() | 1112 | http() |
1106 | .get( | 1113 | .get( |
1107 | "/getParticularTimeTable", | 1114 | "/getParticularTimeTable", |
1108 | { params: { timeTableId: this.getParticulerLecture } }, | 1115 | { params: { timeTableId: this.getParticulerLecture } }, |
1109 | { | 1116 | { |
1110 | headers: { Authorization: "Bearer " + token } | 1117 | headers: { Authorization: "Bearer " + token }, |
1111 | } | 1118 | } |
1112 | ) | 1119 | ) |
1113 | .then(response => { | 1120 | .then((response) => { |
1114 | this.timeTableList = response.data.data; | 1121 | this.timeTableList = response.data.data; |
1115 | this.showLoader = false; | 1122 | this.showLoader = false; |
1116 | }) | 1123 | }) |
1117 | .catch(err => { | 1124 | .catch((err) => { |
1118 | this.showLoader = false; | 1125 | this.showLoader = false; |
1119 | // console.log("err====>", err); | 1126 | // console.log("err====>", err); |
1120 | }); | 1127 | }); |
1121 | }, | 1128 | }, |
1122 | pickFile() { | 1129 | pickFile() { |
1123 | this.$refs.image.click(); | 1130 | this.$refs.image.click(); |
1124 | }, | 1131 | }, |
1125 | 1132 | ||
1126 | onFilePicked(e) { | 1133 | onFilePicked(e) { |
1127 | const files = e.target.files; | 1134 | const files = e.target.files; |
1128 | this.imageData.upload = e.target.files[0]; | 1135 | this.imageData.upload = e.target.files[0]; |
1129 | if (files[0] !== undefined) { | 1136 | if (files[0] !== undefined) { |
1130 | this.imageName = files[0].name; | 1137 | this.imageName = files[0].name; |
1131 | if (this.imageName.lastIndexOf(".") <= 0) { | 1138 | if (this.imageName.lastIndexOf(".") <= 0) { |
1132 | return; | 1139 | return; |
1133 | } | 1140 | } |
1134 | const fr = new FileReader(); | 1141 | const fr = new FileReader(); |
1135 | fr.readAsDataURL(files[0]); | 1142 | fr.readAsDataURL(files[0]); |
1136 | fr.addEventListener("load", () => { | 1143 | fr.addEventListener("load", () => { |
1137 | this.imageUrl = fr.result; | 1144 | this.imageUrl = fr.result; |
1138 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 1145 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
1139 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 1146 | this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
1140 | }); | 1147 | }); |
1141 | } else { | 1148 | } else { |
1142 | this.imageName = ""; | 1149 | this.imageName = ""; |
1143 | this.imageFile = ""; | 1150 | this.imageFile = ""; |
1144 | this.imageUrl = ""; | 1151 | this.imageUrl = ""; |
1145 | } | 1152 | } |
1146 | }, | 1153 | }, |
1147 | // getTimeTableList() { | 1154 | // getTimeTableList() { |
1148 | // this.showLoader = true; | 1155 | // this.showLoader = true; |
1149 | // var token = this.$store.state.token; | 1156 | // var token = this.$store.state.token; |
1150 | // http() | 1157 | // http() |
1151 | // .get("/getTimeTablesList", { | 1158 | // .get("/getTimeTablesList", { |
1152 | // headers: { Authorization: "Bearer " + token } | 1159 | // headers: { Authorization: "Bearer " + token } |
1153 | // }) | 1160 | // }) |
1154 | // .then(response => { | 1161 | // .then(response => { |
1155 | // this.desserts = response.data.data; | 1162 | // this.desserts = response.data.data; |
1156 | // this.showLoader = false; | 1163 | // this.showLoader = false; |
1157 | // // console.log("getTimeTableList=====>", response.data.data); | 1164 | // // console.log("getTimeTableList=====>", response.data.data); |
1158 | // }) | 1165 | // }) |
1159 | // .catch(err => { | 1166 | // .catch(err => { |
1160 | // // console.log("err====>", err); | 1167 | // // console.log("err====>", err); |
1161 | // this.showLoader = false; | 1168 | // this.showLoader = false; |
1162 | // this.$router.replace({ path: "/" }); | 1169 | // this.$router.replace({ path: "/" }); |
1163 | // }); | 1170 | // }); |
1164 | // }, | 1171 | // }, |
1165 | editItem(item) { | 1172 | editItem(item) { |
1166 | this.editedIndex = this.desserts.indexOf(item); | 1173 | this.editedIndex = this.desserts.indexOf(item); |
1167 | this.editedItem = Object.assign({}, item); | 1174 | this.editedItem = Object.assign({}, item); |
1168 | this.dialog = true; | 1175 | this.dialog = true; |
1169 | }, | 1176 | }, |
1170 | updateTimeTable(timeToUpdate, classToUpdate, scheduleId) { | 1177 | updateTimeTable(timeToUpdate, classToUpdate, scheduleId) { |
1171 | this.updateLecturesId.scheduleId = scheduleId; | 1178 | this.updateLecturesId.scheduleId = scheduleId; |
1172 | this.updateLecturesId.lectureId = timeToUpdate._id; | 1179 | this.updateLecturesId.lectureId = timeToUpdate._id; |
1173 | this.updateLectures = timeToUpdate; | 1180 | this.updateLectures = timeToUpdate; |
1174 | this.dialogUpdateLectures = true; | 1181 | this.dialogUpdateLectures = true; |
1175 | }, | 1182 | }, |
1176 | addLecture(scheduleId, timeTableId) { | 1183 | addLecture(scheduleId, timeTableId) { |
1177 | this.addlectures.scheduleId = scheduleId; | 1184 | this.addlectures.scheduleId = scheduleId; |
1178 | this.addlectures.timeTableId = timeTableId; | 1185 | this.addlectures.timeTableId = timeTableId; |
1179 | this.dialogAddLecture = true; | 1186 | this.dialogAddLecture = true; |
1180 | }, | 1187 | }, |
1181 | AddLecture() { | 1188 | AddLecture() { |
1182 | if (this.$refs.lectureForm.validate()) { | 1189 | if (this.$refs.lectureForm.validate()) { |
1183 | http() | 1190 | http() |
1184 | .post("/addLecture", this.addlectures) | 1191 | .post("/addLecture", this.addlectures) |
1185 | .then(response => { | 1192 | .then((response) => { |
1186 | this.snackbar = true; | 1193 | this.snackbar = true; |
1187 | this.text = "New Add Lecture successfully"; | 1194 | this.text = "New Add Lecture successfully"; |
1188 | var token = this.$store.state.token; | 1195 | var token = this.$store.state.token; |
1189 | http() | 1196 | http() |
1190 | .get( | 1197 | .get( |
1191 | "/getParticularTimeTable", | 1198 | "/getParticularTimeTable", |
1192 | { params: { timeTableId: this.getParticulerLecture } }, | 1199 | { params: { timeTableId: this.getParticulerLecture } }, |
1193 | { | 1200 | { |
1194 | headers: { Authorization: "Bearer " + token } | 1201 | headers: { Authorization: "Bearer " + token }, |
1195 | } | 1202 | } |
1196 | ) | 1203 | ) |
1197 | .then(response => { | 1204 | .then((response) => { |
1198 | this.timeTableList = response.data.data; | 1205 | this.timeTableList = response.data.data; |
1199 | this.snackbar = true; | 1206 | this.snackbar = true; |
1200 | this.text = response.data.message; | 1207 | this.text = response.data.message; |
1201 | this.color = "green"; | 1208 | this.color = "green"; |
1202 | this.showLoader = false; | 1209 | this.showLoader = false; |
1203 | }) | 1210 | }) |
1204 | .catch(err => { | 1211 | .catch((err) => { |
1205 | this.showLoader = false; | 1212 | this.showLoader = false; |
1206 | // console.log("err====>", err); | 1213 | // console.log("err====>", err); |
1207 | this.snackbar = true; | 1214 | this.snackbar = true; |
1208 | this.color = "error"; | 1215 | this.color = "error"; |
1209 | this.text = error.response.data.message; | 1216 | this.text = error.response.data.message; |
1210 | }); | 1217 | }); |
1211 | this.closedialogLecture(); | 1218 | this.closedialogLecture(); |
1212 | this.clearLeactureData(); | 1219 | this.clearLeactureData(); |
1213 | }) | 1220 | }) |
1214 | .catch(error => { | 1221 | .catch((error) => { |
1215 | this.snackbar = true; | 1222 | this.snackbar = true; |
1216 | this.text = error.response.data.message; | 1223 | this.text = error.response.data.message; |
1217 | this.text = error.response.data.statusText; | 1224 | this.text = error.response.data.statusText; |
1218 | }); | 1225 | }); |
1219 | } | 1226 | } |
1220 | }, | 1227 | }, |
1221 | updateParticularTable() { | 1228 | updateParticularTable() { |
1222 | let EditLecture = { | 1229 | let EditLecture = { |
1223 | lectureId: this.updateLecturesId.lectureId, | 1230 | lectureId: this.updateLecturesId.lectureId, |
1224 | scheduleId: this.updateLecturesId.scheduleId, | 1231 | scheduleId: this.updateLecturesId.scheduleId, |
1225 | updatedLecture: { | 1232 | updatedLecture: { |
1226 | timeIn: this.updateLectures.timeIn, | 1233 | timeIn: this.updateLectures.timeIn, |
1227 | timeOut: this.updateLectures.timeOut, | 1234 | timeOut: this.updateLectures.timeOut, |
1228 | subjectName: this.updateLectures.subjectName, | 1235 | subjectName: this.updateLectures.subjectName, |
1229 | teacherId: this.updateLectures.teacherId | 1236 | teacherId: this.updateLectures.teacherId, |
1230 | } | 1237 | }, |
1231 | }; | 1238 | }; |
1232 | http() | 1239 | http() |
1233 | .put("/updateLecture", EditLecture) | 1240 | .put("/updateLecture", EditLecture) |
1234 | .then(response => { | 1241 | .then((response) => { |
1235 | console.log("updateLecture", EditLecture); | 1242 | console.log("updateLecture", EditLecture); |
1236 | this.snackbar = true; | 1243 | this.snackbar = true; |
1237 | this.text = response.data.message; | 1244 | this.text = response.data.message; |
1238 | this.color = "green"; | 1245 | this.color = "green"; |
1239 | this.closeUpdateLectures(); | 1246 | this.closeUpdateLectures(); |
1240 | }) | 1247 | }) |
1241 | .catch(error => { | 1248 | .catch((error) => { |
1242 | // console.log(error); | 1249 | // console.log(error); |
1243 | 1250 | ||
1244 | this.snackbar = true; | 1251 | this.snackbar = true; |
1245 | this.color = "error"; | 1252 | this.color = "error"; |
1246 | this.text = error.response.data.message; | 1253 | this.text = error.response.data.message; |
1247 | if (error.response.data.statusText) { | 1254 | if (error.response.data.statusText) { |
1248 | this.text = error.response.data.statusText; | 1255 | this.text = error.response.data.statusText; |
1249 | } | 1256 | } |
1250 | }); | 1257 | }); |
1251 | }, | 1258 | }, |
1252 | deleteItem(item) { | 1259 | deleteItem(item) { |
1253 | let deleteTimeTable = { | 1260 | let deleteTimeTable = { |
1254 | timeTableId: item._id | 1261 | timeTableId: item._id, |
1255 | }; | 1262 | }; |
1256 | http() | 1263 | http() |
1257 | .delete( | 1264 | .delete( |
1258 | "/deleteTimeTable", | 1265 | "/deleteTimeTable", |
1259 | confirm("Are you sure you want to delete this?") && { | 1266 | confirm("Are you sure you want to delete this?") && { |
1260 | params: deleteTimeTable | 1267 | params: deleteTimeTable, |
1261 | } | 1268 | } |
1262 | ) | 1269 | ) |
1263 | .then(response => { | 1270 | .then((response) => { |
1264 | // console.log("deleteUers",deleteTimeTable) | 1271 | // console.log("deleteUers",deleteTimeTable) |
1265 | this.snackbar = true; | 1272 | this.snackbar = true; |
1266 | this.text = response.data.message; | 1273 | this.text = response.data.message; |
1267 | this.color = "green"; | 1274 | this.color = "green"; |
1268 | this.findTimeTable(); | 1275 | this.findTimeTable(); |
1269 | }) | 1276 | }) |
1270 | .catch(error => { | 1277 | .catch((error) => { |
1271 | // console.log(error); | 1278 | // console.log(error); |
1272 | }); | 1279 | }); |
1273 | }, | 1280 | }, |
1274 | close() { | 1281 | close() { |
1275 | this.dialog = false; | 1282 | this.dialog = false; |
1276 | }, | 1283 | }, |
1277 | close1() { | 1284 | close1() { |
1278 | this.dialog1 = false; | 1285 | this.dialog1 = false; |
1279 | }, | 1286 | }, |
1280 | closedialogLecture() { | 1287 | closedialogLecture() { |
1281 | this.dialogAddLecture = false; | 1288 | this.dialogAddLecture = false; |
1282 | }, | 1289 | }, |
1283 | closeUpdateLectures() { | 1290 | closeUpdateLectures() { |
1284 | this.dialogUpdateLectures = false; | 1291 | this.dialogUpdateLectures = false; |
1285 | }, | 1292 | }, |
1293 | closeAddTimeTableModel() { | ||
1294 | this.addTimeTableDialog = false; | ||
1295 | this.timeTableList = []; | ||
1296 | this.timeTable = []; | ||
1297 | }, | ||
1286 | submit() { | 1298 | submit() { |
1287 | if (this.$refs.form.validate()) { | 1299 | if (this.$refs.form.validate()) { |
1288 | let imageData = new FormData(); | 1300 | let imageData = new FormData(); |
1289 | imageData.append("upload", this.imageFile); | 1301 | imageData.append("upload", this.imageFile); |
1290 | let addTimeTable = { | 1302 | let addTimeTable = { |
1291 | sectionId: this.timeTable.selectSection, | 1303 | sectionId: this.timeTable.selectSection, |
1292 | classId: this.timeTable.select, | 1304 | classId: this.timeTable.select, |
1293 | schedule: [ | 1305 | schedule: [ |
1294 | { | 1306 | { |
1295 | day: this.timeTable.selectDay, | 1307 | day: this.timeTable.selectDay, |
1296 | lectures: [ | 1308 | lectures: [ |
1297 | { | 1309 | { |
1298 | timeIn: this.timeTable.timeIn, | 1310 | timeIn: this.timeTable.timeIn, |
1299 | timeOut: this.timeTable.timeOut, | 1311 | timeOut: this.timeTable.timeOut, |
1300 | subjectName: this.timeTable.subjectName, | 1312 | subjectName: this.timeTable.subjectName, |
1301 | teacherId: this.timeTable.selectTeacher | 1313 | teacherId: this.timeTable.selectTeacher, |
1302 | } | 1314 | }, |
1303 | ] | 1315 | ], |
1304 | } | 1316 | }, |
1305 | ] | 1317 | ], |
1306 | }; | 1318 | }; |
1307 | this.loading = true; | 1319 | this.loading = true; |
1308 | http() | 1320 | http() |
1309 | .post("/createTimeTable", addTimeTable) | 1321 | .post("/createTimeTable", addTimeTable) |
1310 | .then(response => { | 1322 | .then((response) => { |
1311 | // console.log("addTimeTable=====>", addTimeTable); | 1323 | // console.log("addTimeTable=====>", addTimeTable); |
1312 | if ((this.snackbar = true)) { | 1324 | if ((this.snackbar = true)) { |
1313 | this.text = "New Time Table added successfully"; | 1325 | this.text = "New Time Table added successfully"; |
1314 | } | 1326 | } |
1315 | this.color = "green"; | 1327 | this.color = "green"; |
1316 | this.clear(); | 1328 | this.clear(); |
1317 | this.addTimeTableDialog = false; | 1329 | this.addTimeTableDialog = false; |
1318 | this.loading = false; | 1330 | this.loading = false; |
1319 | }) | 1331 | }) |
1320 | .catch(error => { | 1332 | .catch((error) => { |
1321 | // console.log(error); | 1333 | // console.log(error); |
1322 | if ((this.snackbar = true)) { | 1334 | if ((this.snackbar = true)) { |
1323 | this.text = error.response.data.message; | 1335 | this.text = error.response.data.message; |
1324 | } | 1336 | } |
1325 | this.loading = false; | 1337 | this.loading = false; |
1326 | }); | 1338 | }); |
1327 | } | 1339 | } |
1328 | }, | 1340 | }, |
1329 | clear() { | 1341 | clear() { |
1330 | this.$refs.form.reset(); | 1342 | this.$refs.form.reset(); |
1331 | }, | 1343 | }, |
1332 | clearLeactureData() { | 1344 | clearLeactureData() { |
1333 | this.$refs.lectureForm.reset(); | 1345 | this.$refs.lectureForm.reset(); |
1334 | }, | 1346 | }, |
1335 | save() { | 1347 | save() { |
1336 | let imageData = new FormData(); | 1348 | let imageData = new FormData(); |
1337 | imageData.append("upload", this.imageFile); | 1349 | imageData.append("upload", this.imageFile); |
1338 | // console.log(imageData); | 1350 | // console.log(imageData); |
1339 | let editTimeTable = { | 1351 | let editTimeTable = { |
1340 | timeTableId: this.editedItem._id, | 1352 | timeTableId: this.editedItem._id, |
1341 | classId: this.editedItem.classNum, | 1353 | classId: this.editedItem.classNum, |
1342 | sectionId: this.editedItem.selectSection | 1354 | sectionId: this.editedItem.selectSection, |
1343 | // imageData | 1355 | // imageData |
1344 | }; | 1356 | }; |
1345 | http() | 1357 | http() |
1346 | .put("/updateTimeTable", editTimeTable) | 1358 | .put("/updateTimeTable", editTimeTable) |
1347 | .then(response => { | 1359 | .then((response) => { |
1348 | console.log("editTimeTable", editTimeTable); | 1360 | console.log("editTimeTable", editTimeTable); |
1349 | if ((this.snackbar = true)) { | 1361 | if ((this.snackbar = true)) { |
1350 | this.text = "Successfully Edit Existing Time Table"; | 1362 | this.text = "Successfully Edit Existing Time Table"; |
1351 | } | 1363 | } |
1352 | this.findTimeTable(); | 1364 | this.findTimeTable(); |
1353 | }) | 1365 | }) |
1354 | .catch(error => { | 1366 | .catch((error) => { |
1355 | // console.log(error); | 1367 | // console.log(error); |
1356 | if ((this.snackbar = true)) { | 1368 | if ((this.snackbar = true)) { |
1357 | this.text = error.response.data.message; | 1369 | this.text = error.response.data.message; |
1358 | } | 1370 | } |
1359 | }); | 1371 | }); |
1360 | this.close(); | 1372 | this.close(); |
1361 | }, | 1373 | }, |
1362 | deleteTimeTable(timeToDelete, deleteLectures) { | 1374 | deleteTimeTable(timeToDelete, deleteLectures) { |
1363 | let deleteLecture = { | 1375 | let deleteLecture = { |
1364 | lectureId: timeToDelete._id | 1376 | lectureId: timeToDelete._id, |
1365 | }; | 1377 | }; |
1366 | http() | 1378 | http() |
1367 | .delete( | 1379 | .delete( |
1368 | "/deleteLecture", | 1380 | "/deleteLecture", |
1369 | confirm("Are you sure you want to delete this?") && { | 1381 | confirm("Are you sure you want to delete this?") && { |
1370 | params: deleteLecture | 1382 | params: deleteLecture, |
1371 | } | 1383 | } |
1372 | ) | 1384 | ) |
1373 | .then(response => { | 1385 | .then((response) => { |
1374 | if ((this.snackbar = true)) { | 1386 | if ((this.snackbar = true)) { |
1375 | this.text = "Successfully delete Existing Time Table"; | 1387 | this.text = "Successfully delete Existing Time Table"; |
1376 | } | 1388 | } |
1377 | const index = this.timeTableList.schedule.indexOf(deleteLectures); | 1389 | const index = this.timeTableList.schedule.indexOf(deleteLectures); |
1378 | for (let i = 0; i < this.timeTableList.schedule.length; i++) { | 1390 | for (let i = 0; i < this.timeTableList.schedule.length; i++) { |
1379 | this.timeTableList.schedule[i].lectures.splice(index, 1); | 1391 | this.timeTableList.schedule[i].lectures.splice(index, 1); |
1380 | } | 1392 | } |
1381 | }) | 1393 | }) |
1382 | .catch(error => { | 1394 | .catch((error) => { |
1383 | console.log(error); | 1395 | console.log(error); |
1384 | }); | 1396 | }); |
1385 | }, | 1397 | }, |
1386 | addSchedule(id) { | 1398 | addSchedule(id) { |
1387 | this.scheduleDayId = id; | 1399 | this.scheduleDayId = id; |
1388 | this.dialogSchedule = true; | 1400 | this.dialogSchedule = true; |
1389 | }, | 1401 | }, |
1390 | submitSchedule() { | 1402 | submitSchedule() { |
1391 | if (this.$refs.formAddDay.validate()) { | 1403 | if (this.$refs.formAddDay.validate()) { |
1392 | let scheduleDayData = { | 1404 | let scheduleDayData = { |
1393 | timeTableId: this.scheduleDayId, | 1405 | timeTableId: this.scheduleDayId, |
1394 | day: this.schedule.selectDay | 1406 | day: this.schedule.selectDay, |
1395 | }; | 1407 | }; |
1396 | http() | 1408 | http() |
1397 | .post("/addSchedule", scheduleDayData) | 1409 | .post("/addSchedule", scheduleDayData) |
1398 | .then(response => { | 1410 | .then((response) => { |
1399 | this.snackbar = true; | 1411 | this.snackbar = true; |
1400 | this.text = "New Schedule Day added successfully"; | 1412 | this.text = "New Schedule Day added successfully"; |
1401 | this.dialogSchedule = false; | 1413 | this.dialogSchedule = false; |
1402 | this.loading = false; | 1414 | this.loading = false; |
1403 | this.getTimeTableDayData(); | 1415 | this.getTimeTableDayData(); |
1404 | }) | 1416 | }) |
1405 | .catch(error => { | 1417 | .catch((error) => { |
1406 | // console.log(error); | 1418 | // console.log(error); |
1407 | this.snackbar = true; | 1419 | this.snackbar = true; |
1408 | this.text = error.response.data.message; | 1420 | this.text = error.response.data.message; |
1409 | this.loading = false; | 1421 | this.loading = false; |
1410 | }); | 1422 | }); |
1411 | } | 1423 | } |
1412 | }, | 1424 | }, |
1413 | displaySearch() { | 1425 | displaySearch() { |
1414 | (this.show = false), (this.showSearch = true); | 1426 | (this.show = false), (this.showSearch = true); |
1415 | }, | 1427 | }, |
1416 | closeSearch() { | 1428 | closeSearch() { |
1417 | this.showSearch = false; | 1429 | this.showSearch = false; |
1418 | this.show = true; | 1430 | this.show = true; |
1419 | this.search = ""; | 1431 | this.search = ""; |
1420 | } | 1432 | }, |
1421 | }, | 1433 | }, |
1422 | mounted() { | 1434 | mounted() { |
1423 | // this.getTimeTableList(); | 1435 | // this.getTimeTableList(); |
1424 | var token = this.$store.state.token; | 1436 | var token = this.$store.state.token; |
1425 | http() | 1437 | http() |
1426 | .get("/getClassesList", { | 1438 | .get("/getClassesList", { |
1427 | headers: { Authorization: "Bearer " + token } | 1439 | headers: { Authorization: "Bearer " + token }, |
1428 | }) | 1440 | }) |
1429 | .then(response => { | 1441 | .then((response) => { |
1430 | this.addclass = response.data.data; | 1442 | this.addclass = response.data.data; |
1431 | // console.log("getClassesList=====>",this.addclass) | 1443 | // console.log("getClassesList=====>",this.addclass) |
1432 | }) | 1444 | }) |
1433 | .catch(error => { | 1445 | .catch((error) => { |
1434 | this.showLoader = false; | 1446 | this.showLoader = false; |
1435 | if (error.response.status === 401) { | 1447 | if (error.response.status === 401) { |
1436 | this.$router.replace({ path: "/" }); | 1448 | this.$router.replace({ path: "/" }); |
1437 | this.$store.dispatch("setToken", null); | 1449 | this.$store.dispatch("setToken", null); |
1438 | this.$store.dispatch("Id", null); | 1450 | this.$store.dispatch("Id", null); |
1439 | this.$store.dispatch("Role", null); | 1451 | this.$store.dispatch("Role", null); |
1440 | } | 1452 | } |
1441 | }); | 1453 | }); |
1442 | 1454 | ||
1443 | http() | 1455 | http() |
1444 | .get("/getTeachersList", { | 1456 | .get("/getTeachersList", { |
1445 | headers: { Authorization: "Bearer " + token } | 1457 | headers: { Authorization: "Bearer " + token }, |
1446 | }) | 1458 | }) |
1447 | .then(response => { | 1459 | .then((response) => { |
1448 | this.addTeachers = response.data.data; | 1460 | this.addTeachers = response.data.data; |
1449 | // console.log("getClassesList=====>",this.addTeachers) | 1461 | // console.log("getClassesList=====>",this.addTeachers) |
1450 | }) | 1462 | }) |
1451 | .catch(error => { | 1463 | .catch((error) => { |
1452 | this.showLoader = false; | 1464 | this.showLoader = false; |
1453 | if (error.response.status === 401) { | 1465 | if (error.response.status === 401) { |
1454 | this.$router.replace({ path: "/" }); | 1466 | this.$router.replace({ path: "/" }); |
1455 | this.$store.dispatch("setToken", null); | 1467 | this.$store.dispatch("setToken", null); |
1456 | this.$store.dispatch("Id", null); | 1468 | this.$store.dispatch("Id", null); |
1457 | this.$store.dispatch("Role", null); | 1469 | this.$store.dispatch("Role", null); |
1458 | } | 1470 | } |
1459 | }); | 1471 | }); |
1460 | } | 1472 | }, |
1461 | }; | 1473 | }; |
1462 | </script> | 1474 | </script> |
src/pages/User/user.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT USERS DETAILS ****** --> | 3 | <!-- ****** EDIT USERS DETAILS ****** --> |
4 | <v-dialog v-model="editUserDialog" max-width="1100px" scrollable> | 4 | <v-dialog v-model="editUserDialog" max-width="1100px" 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 User</label> | 8 | <label class="title text-xs-center">Edit User</label> |
9 | <v-icon size="24" class="right" @click="editUserDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editUserDialog = 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-layout> | 13 | <v-layout> |
14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> | 14 | <v-flex xs12 class="text-xs-center text-sm-center text-md-center text-lg-center my-4"> |
15 | <v-avatar size="120px"> | 15 | <v-avatar size="120px"> |
16 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl && !imageUrl" /> | 16 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl && !imageUrl" /> |
17 | <img | 17 | <img |
18 | :src="editedItem.profilePicUrl" | 18 | :src="editedItem.profilePicUrl" |
19 | v-else-if="editedItem.profilePicUrl && !imageUrl" | 19 | v-else-if="editedItem.profilePicUrl && !imageUrl" |
20 | /> | 20 | /> |
21 | <img | 21 | <img |
22 | v-if="imageUrl" | 22 | v-if="imageUrl" |
23 | :src="imageUrl" | 23 | :src="imageUrl" |
24 | height="150" | 24 | height="150" |
25 | style="border-radius:50%; width:150px" | 25 | style="border-radius:50%; width:150px" |
26 | /> | 26 | /> |
27 | </v-avatar> | 27 | </v-avatar> |
28 | <input | 28 | <input |
29 | type="file" | 29 | type="file" |
30 | style="display:none" | 30 | style="display:none" |
31 | ref="image" | 31 | ref="image" |
32 | accept="image/*" | 32 | accept="image/*" |
33 | @change="onFilePicked" | 33 | @change="onFilePicked" |
34 | /> | 34 | /> |
35 | </v-flex> | 35 | </v-flex> |
36 | </v-layout> | 36 | </v-layout> |
37 | <v-layout wrap> | 37 | <v-layout wrap> |
38 | <v-flex xs12 sm6> | 38 | <v-flex xs12 sm6> |
39 | <v-layout> | 39 | <v-layout> |
40 | <v-flex xs4 class="pt-4 subheading"> | 40 | <v-flex xs4 class="pt-4 subheading"> |
41 | <label class="right">Name:</label> | 41 | <label class="right">Name:</label> |
42 | </v-flex> | 42 | </v-flex> |
43 | <v-flex xs8 class="ml-3"> | 43 | <v-flex xs8 class="ml-3"> |
44 | <v-text-field | 44 | <v-text-field |
45 | v-model="editedItem.name" | 45 | v-model="editedItem.name" |
46 | placeholder="fill your Name" | 46 | placeholder="fill your Name" |
47 | name="name" | 47 | name="name" |
48 | type="text" | 48 | type="text" |
49 | required | 49 | required |
50 | ></v-text-field> | 50 | ></v-text-field> |
51 | </v-flex> | 51 | </v-flex> |
52 | </v-layout> | 52 | </v-layout> |
53 | </v-flex> | 53 | </v-flex> |
54 | <v-flex xs12 sm6> | 54 | <v-flex xs12 sm6> |
55 | <v-layout> | 55 | <v-layout> |
56 | <v-flex xs4 class="pt-4 subheading"> | 56 | <v-flex xs4 class="pt-4 subheading"> |
57 | <label class="right">Email ID:</label> | 57 | <label class="right">Email ID:</label> |
58 | </v-flex> | 58 | </v-flex> |
59 | <v-flex xs8 class="ml-3"> | 59 | <v-flex xs8 class="ml-3"> |
60 | <v-text-field | 60 | <v-text-field |
61 | placeholder="fill your email" | 61 | placeholder="fill your email" |
62 | v-model="editedItem.email" | 62 | v-model="editedItem.email" |
63 | type="text" | 63 | type="text" |
64 | name="email" | 64 | name="email" |
65 | required | 65 | required |
66 | ></v-text-field> | 66 | ></v-text-field> |
67 | </v-flex> | 67 | </v-flex> |
68 | </v-layout> | 68 | </v-layout> |
69 | </v-flex> | 69 | </v-flex> |
70 | </v-layout> | 70 | </v-layout> |
71 | <v-layout wrap> | 71 | <v-layout wrap> |
72 | <v-flex xs12 sm6> | 72 | <v-flex xs12 sm6> |
73 | <v-layout> | 73 | <v-layout> |
74 | <v-flex xs4 class="pt-4 subheading"> | 74 | <v-flex xs4 class="pt-4 subheading"> |
75 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 75 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
76 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> | 76 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> |
77 | </v-flex> | 77 | </v-flex> |
78 | <v-flex xs8 class="ml-3"> | 78 | <v-flex xs8 class="ml-3"> |
79 | <v-menu | 79 | <v-menu |
80 | ref="menu" | 80 | ref="menu" |
81 | :close-on-content-click="false" | 81 | :close-on-content-click="false" |
82 | v-model="menu2" | 82 | v-model="menu2" |
83 | :nudge-right="40" | 83 | :nudge-right="40" |
84 | lazy | 84 | lazy |
85 | transition="scale-transition" | 85 | transition="scale-transition" |
86 | offset-y | 86 | offset-y |
87 | full-width | 87 | full-width |
88 | min-width="290px" | 88 | min-width="290px" |
89 | > | 89 | > |
90 | <v-text-field | 90 | <v-text-field |
91 | slot="activator" | 91 | slot="activator" |
92 | v-model="editedItem.dob" | 92 | v-model="editedItem.dob" |
93 | placeholder="Select date" | 93 | placeholder="Select date" |
94 | ></v-text-field> | 94 | ></v-text-field> |
95 | <v-date-picker | 95 | <v-date-picker |
96 | ref="picker" | 96 | ref="picker" |
97 | v-model="editedItem.dob" | 97 | v-model="editedItem.dob" |
98 | :max="new Date().toISOString().substr(0, 10)" | 98 | :max="new Date().toISOString().substr(0, 10)" |
99 | min="1950-01-01" | 99 | min="1950-01-01" |
100 | @input="menu2 = false" | 100 | @input="menu2 = false" |
101 | ></v-date-picker> | 101 | ></v-date-picker> |
102 | </v-menu> | 102 | </v-menu> |
103 | </v-flex> | 103 | </v-flex> |
104 | </v-layout> | 104 | </v-layout> |
105 | </v-flex> | 105 | </v-flex> |
106 | <v-flex xs12 sm6> | 106 | <v-flex xs12 sm6> |
107 | <v-layout> | 107 | <v-layout> |
108 | <v-flex xs4 class="pt-4 subheading"> | 108 | <v-flex xs4 class="pt-4 subheading"> |
109 | <label class="right">Gender:</label> | 109 | <label class="right">Gender:</label> |
110 | </v-flex> | 110 | </v-flex> |
111 | <v-flex xs8 class="ml-3"> | 111 | <v-flex xs8 class="ml-3"> |
112 | <v-select | 112 | <v-select |
113 | :items="gender" | 113 | :items="gender" |
114 | v-model="editedItem.gender" | 114 | v-model="editedItem.gender" |
115 | label="Select gender" | 115 | label="Select gender" |
116 | name="gender" | 116 | name="gender" |
117 | required | 117 | required |
118 | ></v-select> | 118 | ></v-select> |
119 | </v-flex> | 119 | </v-flex> |
120 | </v-layout> | 120 | </v-layout> |
121 | </v-flex> | 121 | </v-flex> |
122 | </v-layout> | 122 | </v-layout> |
123 | <v-layout wrap> | 123 | <v-layout wrap> |
124 | <v-flex xs12 sm6> | 124 | <v-flex xs12 sm6> |
125 | <v-layout> | 125 | <v-layout> |
126 | <v-flex xs4 class="pt-4 subheading"> | 126 | <v-flex xs4 class="pt-4 subheading"> |
127 | <label class="right">Religion:</label> | 127 | <label class="right">Religion:</label> |
128 | </v-flex> | 128 | </v-flex> |
129 | <v-flex xs8 class="ml-3"> | 129 | <v-flex xs8 class="ml-3"> |
130 | <v-text-field | 130 | <v-text-field |
131 | v-model="editedItem.religion" | 131 | v-model="editedItem.religion" |
132 | placeholder="fill your Religion" | 132 | placeholder="fill your Religion" |
133 | name="religion" | 133 | name="religion" |
134 | type="text" | 134 | type="text" |
135 | required | 135 | required |
136 | ></v-text-field> | 136 | ></v-text-field> |
137 | </v-flex> | 137 | </v-flex> |
138 | </v-layout> | 138 | </v-layout> |
139 | </v-flex> | 139 | </v-flex> |
140 | <v-flex xs12 sm6> | 140 | <v-flex xs12 sm6> |
141 | <v-layout> | 141 | <v-layout> |
142 | <v-flex xs4 class="pt-4 subheading"> | 142 | <v-flex xs4 class="pt-4 subheading"> |
143 | <label class="right">JoiningDate:</label> | 143 | <label class="right">JoiningDate:</label> |
144 | </v-flex> | 144 | </v-flex> |
145 | <v-flex xs8 class="ml-3"> | 145 | <v-flex xs8 class="ml-3"> |
146 | <v-menu | 146 | <v-menu |
147 | ref="menu" | 147 | ref="menu" |
148 | :close-on-content-click="false" | 148 | :close-on-content-click="false" |
149 | v-model="menu3" | 149 | v-model="menu3" |
150 | :nudge-right="40" | 150 | :nudge-right="40" |
151 | lazy | 151 | lazy |
152 | transition="scale-transition" | 152 | transition="scale-transition" |
153 | offset-y | 153 | offset-y |
154 | full-width | 154 | full-width |
155 | min-width="290px" | 155 | min-width="290px" |
156 | > | 156 | > |
157 | <v-text-field | 157 | <v-text-field |
158 | slot="activator" | 158 | slot="activator" |
159 | v-model="editedItem.joiningDate" | 159 | v-model="editedItem.joiningDate" |
160 | placeholder="Select date" | 160 | placeholder="Select date" |
161 | ></v-text-field> | 161 | ></v-text-field> |
162 | <v-date-picker | 162 | <v-date-picker |
163 | ref="picker" | 163 | ref="picker" |
164 | v-model="editedItem.joiningDate" | 164 | v-model="editedItem.joiningDate" |
165 | :max="new Date().toISOString().substr(0, 10)" | 165 | :max="new Date().toISOString().substr(0, 10)" |
166 | min="1950-01-01" | 166 | min="1950-01-01" |
167 | @input="menu3 = false" | 167 | @input="menu3 = false" |
168 | ></v-date-picker> | 168 | ></v-date-picker> |
169 | </v-menu> | 169 | </v-menu> |
170 | </v-flex> | 170 | </v-flex> |
171 | </v-layout> | 171 | </v-layout> |
172 | </v-flex> | 172 | </v-flex> |
173 | </v-layout> | 173 | </v-layout> |
174 | <v-layout wrap> | 174 | <v-layout wrap> |
175 | <v-flex xs12 sm6> | 175 | <v-flex xs12 sm6> |
176 | <v-layout> | 176 | <v-layout> |
177 | <v-flex xs4 class="pt-4 subheading"> | 177 | <v-flex xs4 class="pt-4 subheading"> |
178 | <label class="right">Phone:</label> | 178 | <label class="right">Phone:</label> |
179 | </v-flex> | 179 | </v-flex> |
180 | <v-flex xs8 class="ml-3"> | 180 | <v-flex xs8 class="ml-3"> |
181 | <v-text-field | 181 | <v-text-field |
182 | v-model="editedItem.phone" | 182 | v-model="editedItem.phone" |
183 | placeholder="fill your MobileNo" | 183 | placeholder="fill your MobileNo" |
184 | name="mobileNo" | 184 | name="mobileNo" |
185 | type="number" | 185 | type="number" |
186 | required | 186 | required |
187 | ></v-text-field> | 187 | ></v-text-field> |
188 | </v-flex> | 188 | </v-flex> |
189 | </v-layout> | 189 | </v-layout> |
190 | </v-flex> | 190 | </v-flex> |
191 | <v-flex xs12 sm6> | 191 | <v-flex xs12 sm6> |
192 | <v-layout> | 192 | <v-layout> |
193 | <v-flex xs4 class="pt-4 subheading"> | 193 | <v-flex xs4 class="pt-4 subheading"> |
194 | <label class="right hidden-sm-only hidden-xs-only">Select Role:</label> | 194 | <label class="right hidden-sm-only hidden-xs-only">Select Role:</label> |
195 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> | 195 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> |
196 | </v-flex> | 196 | </v-flex> |
197 | <v-flex xs8 class="ml-3"> | 197 | <v-flex xs8 class="ml-3"> |
198 | <v-autocomplete | 198 | <v-autocomplete |
199 | v-model="editedItem.role" | 199 | v-model="editedItem.role" |
200 | :label="editedItem.role" | 200 | :label="editedItem.role" |
201 | :items="userRole" | 201 | :items="userRole" |
202 | item-text="name" | 202 | item-text="name" |
203 | item-value="role" | 203 | item-value="role" |
204 | required | 204 | required |
205 | ></v-autocomplete> | 205 | ></v-autocomplete> |
206 | </v-flex> | 206 | </v-flex> |
207 | </v-layout> | 207 | </v-layout> |
208 | </v-flex> | 208 | </v-flex> |
209 | </v-layout> | 209 | </v-layout> |
210 | <v-layout wrap> | 210 | <v-layout wrap> |
211 | <v-flex xs12 sm6> | 211 | <v-flex xs12 sm6> |
212 | <v-layout> | 212 | <v-layout> |
213 | <v-flex xs4 class="pt-4 subheading"> | 213 | <v-flex xs4 class="pt-4 subheading"> |
214 | <label class="right hidden-sm-only hidden-xs-only">Uplaod Image:</label> | 214 | <label class="right hidden-sm-only hidden-xs-only">Uplaod Image:</label> |
215 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Uplaod:</label> | 215 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Uplaod:</label> |
216 | </v-flex> | 216 | </v-flex> |
217 | <v-flex xs8 class="ml-3"> | 217 | <v-flex xs8 class="ml-3"> |
218 | <v-text-field | 218 | <v-text-field |
219 | label="Select Image" | 219 | label="Select Image" |
220 | @click="pickFile" | 220 | @click="pickFile" |
221 | v-model="imageName" | 221 | v-model="imageName" |
222 | append-icon="attach_file" | 222 | append-icon="attach_file" |
223 | ></v-text-field> | 223 | ></v-text-field> |
224 | </v-flex> | 224 | </v-flex> |
225 | </v-layout> | 225 | </v-layout> |
226 | </v-flex> | 226 | </v-flex> |
227 | <v-flex xs12 sm6> | 227 | <v-flex xs12 sm6> |
228 | <v-layout> | 228 | <v-layout> |
229 | <v-flex xs4 class="pt-4 subheading"> | 229 | <v-flex xs4 class="pt-4 subheading"> |
230 | <label class="right">Address:</label> | 230 | <label class="right">Address:</label> |
231 | </v-flex> | 231 | </v-flex> |
232 | <v-flex xs8 class="ml-3"> | 232 | <v-flex xs8 class="ml-3"> |
233 | <v-text-field | 233 | <v-text-field |
234 | name="input-4-3" | 234 | name="input-4-3" |
235 | v-model="editedItem.address" | 235 | v-model="editedItem.address" |
236 | placeholder="fill Your Address" | 236 | placeholder="fill Your Address" |
237 | required | 237 | required |
238 | ></v-text-field> | 238 | ></v-text-field> |
239 | </v-flex> | 239 | </v-flex> |
240 | </v-layout> | 240 | </v-layout> |
241 | </v-flex> | 241 | </v-flex> |
242 | </v-layout> | 242 | </v-layout> |
243 | <v-layout> | 243 | <v-layout> |
244 | <v-flex xs12 sm12> | 244 | <v-flex xs12 sm12> |
245 | <v-card-actions class="hidden-sm-only hidden-xs-only"> | 245 | <v-card-actions class="hidden-sm-only hidden-xs-only"> |
246 | <v-spacer></v-spacer> | 246 | <v-spacer></v-spacer> |
247 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> | 247 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> |
248 | </v-card-actions> | 248 | </v-card-actions> |
249 | <v-card-actions class="hidden-lg-only hidden-xl-only hidden-md-only"> | 249 | <v-card-actions class="hidden-lg-only hidden-xl-only hidden-md-only"> |
250 | <v-spacer></v-spacer> | 250 | <v-spacer></v-spacer> |
251 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> | 251 | <v-btn round dark :loading="loading" @click="save" class="add-button">Save</v-btn> |
252 | <v-spacer></v-spacer> | 252 | <v-spacer></v-spacer> |
253 | </v-card-actions> | 253 | </v-card-actions> |
254 | </v-flex> | 254 | </v-flex> |
255 | </v-layout> | 255 | </v-layout> |
256 | </v-card-text> | 256 | </v-card-text> |
257 | </v-card> | 257 | </v-card> |
258 | </v-dialog> | 258 | </v-dialog> |
259 | <!-- ****** PROFILE User DETAILS ****** --> | 259 | <!-- ****** PROFILE User DETAILS ****** --> |
260 | <v-dialog v-model="viewUserDialog" max-width="560px" scrollable> | 260 | <v-dialog v-model="viewUserDialog" max-width="560px" scrollable> |
261 | <v-card flat class="card-style pa-3" dark> | 261 | <v-card flat class="card-style pa-3" dark> |
262 | <v-layout> | 262 | <v-layout> |
263 | <v-flex xs12> | 263 | <v-flex xs12> |
264 | <label class="title text-xs-center">View User</label> | 264 | <label class="title text-xs-center">View User</label> |
265 | <v-icon size="24" class="right" @click="viewUserDialog = false">cancel</v-icon> | 265 | <v-icon size="24" class="right" @click="viewUserDialog = false">cancel</v-icon> |
266 | </v-flex> | 266 | </v-flex> |
267 | </v-layout> | 267 | </v-layout> |
268 | <v-card-text> | 268 | <v-card-text> |
269 | <v-container grid-list-md> | 269 | <v-container grid-list-md> |
270 | <v-layout wrap> | 270 | <v-layout wrap> |
271 | <v-flex> | 271 | <v-flex> |
272 | <v-flex align-center justify-center layout text-xs-center> | 272 | <v-flex align-center justify-center layout text-xs-center> |
273 | <v-avatar size="100px"> | 273 | <v-avatar size="100px"> |
274 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> | 274 | <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" /> |
275 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> | 275 | <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" /> |
276 | </v-avatar> | 276 | </v-avatar> |
277 | </v-flex> | 277 | </v-flex> |
278 | <v-layout> | 278 | <v-layout> |
279 | <v-flex xs4 sm6> | 279 | <v-flex xs4 sm6> |
280 | <h5 class="right my-1"> | 280 | <h5 class="right my-1"> |
281 | <b>Name:</b> | 281 | <b>Name:</b> |
282 | </h5> | 282 | </h5> |
283 | </v-flex> | 283 | </v-flex> |
284 | <v-flex sm6 xs8> | 284 | <v-flex sm6 xs8> |
285 | <h5 class="my-1">{{ editedItem.name }}</h5> | 285 | <h5 class="my-1">{{ editedItem.name }}</h5> |
286 | </v-flex> | 286 | </v-flex> |
287 | </v-layout> | 287 | </v-layout> |
288 | <v-layout> | 288 | <v-layout> |
289 | <v-flex xs4 sm6> | 289 | <v-flex xs4 sm6> |
290 | <h5 class="right my-1"> | 290 | <h5 class="right my-1"> |
291 | <b>Email:</b> | 291 | <b>Email:</b> |
292 | </h5> | 292 | </h5> |
293 | </v-flex> | 293 | </v-flex> |
294 | <v-flex sm6 xs8> | 294 | <v-flex sm6 xs8> |
295 | <h5 class="my-1">{{ editedItem.email }}</h5> | 295 | <h5 class="my-1">{{ editedItem.email }}</h5> |
296 | </v-flex> | 296 | </v-flex> |
297 | </v-layout> | 297 | </v-layout> |
298 | <v-layout> | 298 | <v-layout> |
299 | <v-flex xs4 sm6> | 299 | <v-flex xs4 sm6> |
300 | <h5 class="right my-1"> | 300 | <h5 class="right my-1"> |
301 | <b>Gender:</b> | 301 | <b>Gender:</b> |
302 | </h5> | 302 | </h5> |
303 | </v-flex> | 303 | </v-flex> |
304 | <v-flex sm6 xs8> | 304 | <v-flex sm6 xs8> |
305 | <h5 class="my-1">{{ editedItem.gender }}</h5> | 305 | <h5 class="my-1">{{ editedItem.gender }}</h5> |
306 | </v-flex> | 306 | </v-flex> |
307 | </v-layout> | 307 | </v-layout> |
308 | <v-layout> | 308 | <v-layout> |
309 | <v-flex xs4 sm6> | 309 | <v-flex xs4 sm6> |
310 | <h5 class="right my-1"> | 310 | <h5 class="right my-1"> |
311 | <b>Religion:</b> | 311 | <b>Religion:</b> |
312 | </h5> | 312 | </h5> |
313 | </v-flex> | 313 | </v-flex> |
314 | <v-flex sm6 xs8> | 314 | <v-flex sm6 xs8> |
315 | <h5 class="my-1">{{ editedItem.religion }}</h5> | 315 | <h5 class="my-1">{{ editedItem.religion }}</h5> |
316 | </v-flex> | 316 | </v-flex> |
317 | </v-layout> | 317 | </v-layout> |
318 | <v-layout> | 318 | <v-layout> |
319 | <v-flex xs4 sm6> | 319 | <v-flex xs4 sm6> |
320 | <h5 class="right my-1"> | 320 | <h5 class="right my-1"> |
321 | <b>Role:</b> | 321 | <b>Role:</b> |
322 | </h5> | 322 | </h5> |
323 | </v-flex> | 323 | </v-flex> |
324 | <v-flex sm6 xs8> | 324 | <v-flex sm6 xs8> |
325 | <h5 class="my-1">{{ editedItem.role }}</h5> | 325 | <h5 class="my-1">{{ editedItem.role }}</h5> |
326 | </v-flex> | 326 | </v-flex> |
327 | </v-layout> | 327 | </v-layout> |
328 | <v-layout> | 328 | <v-layout> |
329 | <v-flex xs4 sm6> | 329 | <v-flex xs4 sm6> |
330 | <h5 class="right my-1"> | 330 | <h5 class="right my-1"> |
331 | <b>Phone:</b> | 331 | <b>Phone:</b> |
332 | </h5> | 332 | </h5> |
333 | </v-flex> | 333 | </v-flex> |
334 | <v-flex sm6 xs8> | 334 | <v-flex sm6 xs8> |
335 | <h5 class="my-1">{{ editedItem.phone }}</h5> | 335 | <h5 class="my-1">{{ editedItem.phone }}</h5> |
336 | </v-flex> | 336 | </v-flex> |
337 | </v-layout> | 337 | </v-layout> |
338 | <v-layout> | 338 | <v-layout> |
339 | <v-flex xs4 sm6> | 339 | <v-flex xs4 sm6> |
340 | <h5 class="right my-1"> | 340 | <h5 class="right my-1"> |
341 | <b>JoiningDate:</b> | 341 | <b>JoiningDate:</b> |
342 | </h5> | 342 | </h5> |
343 | </v-flex> | 343 | </v-flex> |
344 | <v-flex sm6 xs8> | 344 | <v-flex sm6 xs8> |
345 | <h5 class="my-1">{{ dates(editedItem.joiningDate) }}</h5> | 345 | <h5 class="my-1">{{ dates(editedItem.joiningDate) }}</h5> |
346 | </v-flex> | 346 | </v-flex> |
347 | </v-layout> | 347 | </v-layout> |
348 | <v-layout> | 348 | <v-layout> |
349 | <v-flex xs4 sm6> | 349 | <v-flex xs4 sm6> |
350 | <h5 class="right my-1"> | 350 | <h5 class="right my-1"> |
351 | <label class="right hidden-sm-only hidden-xs-only"> | 351 | <label class="right hidden-sm-only hidden-xs-only"> |
352 | <b>Date of Birth:</b> | 352 | <b>Date of Birth:</b> |
353 | </label> | 353 | </label> |
354 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only"> | 354 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only"> |
355 | <b>D.O.B:</b> | 355 | <b>D.O.B:</b> |
356 | </label> | 356 | </label> |
357 | </h5> | 357 | </h5> |
358 | </v-flex> | 358 | </v-flex> |
359 | <v-flex sm6 xs8> | 359 | <v-flex sm6 xs8> |
360 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> | 360 | <h5 class="my-1">{{ dates(editedItem.dob) }}</h5> |
361 | </v-flex> | 361 | </v-flex> |
362 | </v-layout> | 362 | </v-layout> |
363 | <v-layout> | 363 | <v-layout> |
364 | <v-flex xs4 sm6> | 364 | <v-flex xs4 sm6> |
365 | <h5 class="right my-1"> | 365 | <h5 class="right my-1"> |
366 | <b>Address:</b> | 366 | <b>Address:</b> |
367 | </h5> | 367 | </h5> |
368 | </v-flex> | 368 | </v-flex> |
369 | <v-flex sm6 xs8> | 369 | <v-flex sm6 xs8> |
370 | <h5 class="my-1">{{ editedItem.address }}</h5> | 370 | <h5 class="my-1">{{ editedItem.address }}</h5> |
371 | </v-flex> | 371 | </v-flex> |
372 | </v-layout> | 372 | </v-layout> |
373 | </v-flex> | 373 | </v-flex> |
374 | </v-layout> | 374 | </v-layout> |
375 | </v-container> | 375 | </v-container> |
376 | </v-card-text> | 376 | </v-card-text> |
377 | </v-card> | 377 | </v-card> |
378 | </v-dialog> | 378 | </v-dialog> |
379 | 379 | ||
380 | <!-- ****** EXISTING-USER TABLE DATA****** --> | 380 | <!-- ****** EXISTING-USER TABLE DATA****** --> |
381 | <v-toolbar color="transparent" flat> | 381 | <v-toolbar color="transparent" flat> |
382 | <v-btn | 382 | <v-btn |
383 | fab | 383 | fab |
384 | dark | 384 | dark |
385 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 385 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
386 | small | 386 | small |
387 | @click="addUserDialog = true" | 387 | @click="addUserDialog = true" |
388 | > | 388 | > |
389 | <v-icon dark>add</v-icon> | 389 | <v-icon dark>add</v-icon> |
390 | </v-btn> | 390 | </v-btn> |
391 | <v-btn | 391 | <v-btn |
392 | round | 392 | round |
393 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 393 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
394 | dark | 394 | dark |
395 | @click="addUserDialog = true" | 395 | @click="addUserDialog = true" |
396 | > | 396 | > |
397 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add User | 397 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add User |
398 | </v-btn> | 398 | </v-btn> |
399 | <v-spacer></v-spacer> | 399 | <v-spacer></v-spacer> |
400 | <v-card-title class="body-1" v-show="show"> | 400 | <v-card-title class="body-1" v-show="show"> |
401 | <v-btn icon large flat @click="displaySearch"> | 401 | <v-btn icon large flat @click="displaySearch"> |
402 | <v-avatar size="27"> | 402 | <v-avatar size="27"> |
403 | <img src="/static/icon/search.png" alt="icon" /> | 403 | <img src="/static/icon/search.png" alt="icon" /> |
404 | </v-avatar> | 404 | </v-avatar> |
405 | </v-btn> | 405 | </v-btn> |
406 | </v-card-title> | 406 | </v-card-title> |
407 | <v-flex xs8 sm8 lg2 md3 v-if="showSearch"> | 407 | <v-flex xs8 sm8 lg2 md3 v-if="showSearch"> |
408 | <v-layout> | 408 | <v-layout> |
409 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 409 | <v-text-field |
410 | autofocus | ||
411 | v-model="search" | ||
412 | label="Search" | ||
413 | prepend-inner-icon="search" | ||
414 | color="primary" | ||
415 | ></v-text-field> | ||
410 | <v-icon @click="closeSearch" color="error">close</v-icon> | 416 | <v-icon @click="closeSearch" color="error">close</v-icon> |
411 | </v-layout> | 417 | </v-layout> |
412 | </v-flex> | 418 | </v-flex> |
413 | </v-toolbar> | 419 | </v-toolbar> |
414 | <v-data-table :headers="headers" :items="Users" :pagination.sync="pagination" :search="search"> | 420 | <v-data-table :headers="headers" :items="Users" :pagination.sync="pagination" :search="search"> |
415 | <template slot="items" slot-scope="props"> | 421 | <template slot="items" slot-scope="props"> |
416 | <td class="td td-row">{{ props.index + 1 }}</td> | 422 | <td class="td td-row">{{ props.index + 1 }}</td> |
417 | <td class="td td-row text-xs-center"> | 423 | <td class="td td-row text-xs-center"> |
418 | <v-avatar size="40"> | 424 | <v-avatar size="40"> |
419 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | 425 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
420 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | 426 | <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> |
421 | </v-avatar> | 427 | </v-avatar> |
422 | </td> | 428 | </td> |
423 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> | 429 | <td class="text-xs-center td td-row">{{ props.item.name}}</td> |
424 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> | 430 | <td class="text-xs-center td td-row">{{ props.item.email }}</td> |
425 | <td class="text-xs-center td td-row">{{ dates(props.item.dob) }}</td> | 431 | <td class="text-xs-center td td-row">{{ dates(props.item.dob) }}</td> |
426 | <td class="text-xs-center td td-row">{{ dates(props.item.joiningDate)}}</td> | 432 | <td class="text-xs-center td td-row">{{ dates(props.item.joiningDate)}}</td> |
427 | <td class="text-xs-center td td-row">{{ props.item.phone }}</td> | 433 | <td class="text-xs-center td td-row">{{ props.item.phone }}</td> |
428 | <td class="text-xs-center td td-row"> | 434 | <td class="text-xs-center td td-row"> |
429 | <v-switch | 435 | <v-switch |
430 | class="pl-3" | 436 | class="pl-3" |
431 | v-model="props.item.status" | 437 | v-model="props.item.status" |
432 | @change="suspendStatus(props.item.status,props.item._id)" | 438 | @change="suspendStatus(props.item.status,props.item._id)" |
433 | ></v-switch> | 439 | ></v-switch> |
434 | </td> | 440 | </td> |
435 | <td class="text-xs-center td td-row"> | 441 | <td class="text-xs-center td td-row"> |
436 | <span> | 442 | <span> |
437 | <v-tooltip top> | 443 | <v-tooltip top> |
438 | <img | 444 | <img |
439 | slot="activator" | 445 | slot="activator" |
440 | style="cursor:pointer; width:25px; height:25px; " | 446 | style="cursor:pointer; width:25px; height:25px; " |
441 | class="mr-3" | 447 | class="mr-3" |
442 | @click="profile(props.item)" | 448 | @click="profile(props.item)" |
443 | src="/static/icon/view.png" | 449 | src="/static/icon/view.png" |
444 | /> | 450 | /> |
445 | <span>View</span> | 451 | <span>View</span> |
446 | </v-tooltip> | 452 | </v-tooltip> |
447 | <v-tooltip top> | 453 | <v-tooltip top> |
448 | <img | 454 | <img |
449 | slot="activator" | 455 | slot="activator" |
450 | style="cursor:pointer; width:20px; height:18px; " | 456 | style="cursor:pointer; width:20px; height:18px; " |
451 | class="mr-3" | 457 | class="mr-3" |
452 | @click="editItem(props.item)" | 458 | @click="editItem(props.item)" |
453 | src="/static/icon/edit.png" | 459 | src="/static/icon/edit.png" |
454 | /> | 460 | /> |
455 | <span>Edit</span> | 461 | <span>Edit</span> |
456 | </v-tooltip> | 462 | </v-tooltip> |
457 | <v-tooltip top> | 463 | <v-tooltip top> |
458 | <img | 464 | <img |
459 | slot="activator" | 465 | slot="activator" |
460 | style="cursor:pointer; width:20px; height:20px; " | 466 | style="cursor:pointer; width:20px; height:20px; " |
461 | class="mr-3" | 467 | class="mr-3" |
462 | @click="deleteItem(props.item)" | 468 | @click="deleteItem(props.item)" |
463 | src="/static/icon/delete.png" | 469 | src="/static/icon/delete.png" |
464 | /> | 470 | /> |
465 | <span>Delete</span> | 471 | <span>Delete</span> |
466 | </v-tooltip> | 472 | </v-tooltip> |
467 | </span> | 473 | </span> |
468 | </td> | 474 | </td> |
469 | </template> | 475 | </template> |
470 | <v-alert | 476 | <v-alert |
471 | slot="no-results" | 477 | slot="no-results" |
472 | :value="true" | 478 | :value="true" |
473 | color="error" | 479 | color="error" |
474 | icon="warning" | 480 | icon="warning" |
475 | >Your search for "{{ search }}" found no results.</v-alert> | 481 | >Your search for "{{ search }}" found no results.</v-alert> |
476 | </v-data-table> | 482 | </v-data-table> |
477 | <!-- DIALOG BOX - Add User Data --> | 483 | <!-- DIALOG BOX - Add User Data --> |
478 | <v-dialog v-model="addUserDialog" max-width="900px"> | 484 | <v-dialog v-model="addUserDialog" max-width="900px" v-if="addUserDialog"> |
479 | <v-card flat class="card-style pa-2" dark> | 485 | <v-card flat class="card-style pa-2" dark> |
480 | <v-layout> | 486 | <v-layout> |
481 | <v-flex xs12> | 487 | <v-flex xs12> |
482 | <label class="title text-xs-center">Add User</label> | 488 | <label class="title text-xs-center">Add User</label> |
483 | <v-icon size="24" class="right" @click="$refs.form.reset();addUserDialog = false">cancel</v-icon> | 489 | <v-icon size="24" class="right" @click="$refs.form.reset();addUserDialog = false">cancel</v-icon> |
484 | </v-flex> | 490 | </v-flex> |
485 | </v-layout> | 491 | </v-layout> |
486 | <v-form ref="form" v-model="valid" lazy-validation> | 492 | <v-form ref="form" v-model="valid" lazy-validation> |
487 | <v-container fluid> | 493 | <v-container fluid> |
488 | <v-layout> | 494 | <v-layout> |
489 | <v-flex | 495 | <v-flex |
490 | xs12 | 496 | xs12 |
491 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" | 497 | class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" |
492 | > | 498 | > |
493 | <v-avatar size="80px"> | 499 | <v-avatar size="80px"> |
494 | <img src="/static/icon/user.png" v-if="!imageUrl" /> | 500 | <img src="/static/icon/user.png" v-if="!imageUrl" /> |
495 | </v-avatar> | 501 | </v-avatar> |
496 | <img | 502 | <img |
497 | :src="imageUrl" | 503 | :src="imageUrl" |
498 | height="150" | 504 | height="150" |
499 | v-if="imageUrl" | 505 | v-if="imageUrl" |
500 | style="border-radius:50%; width:150px" | 506 | style="border-radius:50%; width:150px" |
501 | /> | 507 | /> |
502 | </v-flex> | 508 | </v-flex> |
503 | </v-layout> | 509 | </v-layout> |
504 | <v-layout> | 510 | <v-layout> |
505 | <v-flex xs12 sm6> | 511 | <v-flex xs12 sm6> |
506 | <v-layout> | 512 | <v-layout> |
507 | <v-flex xs4 class="pt-4 subheading"> | 513 | <v-flex xs4 class="pt-4 subheading"> |
508 | <label class="right">Name:</label> | 514 | <label class="right">Name:</label> |
509 | </v-flex> | 515 | </v-flex> |
510 | <v-flex xs8 class="ml-3"> | 516 | <v-flex xs8 class="ml-3"> |
511 | <v-text-field | 517 | <v-text-field |
512 | v-model="addUser.name" | 518 | v-model="addUser.name" |
513 | placeholder="fill your Name" | 519 | placeholder="fill your Name" |
514 | name="name" | 520 | name="name" |
515 | type="text" | 521 | type="text" |
516 | :rules="nameRules" | 522 | :rules="nameRules" |
517 | required | 523 | required |
518 | ></v-text-field> | 524 | ></v-text-field> |
519 | </v-flex> | 525 | </v-flex> |
520 | </v-layout> | 526 | </v-layout> |
521 | </v-flex> | 527 | </v-flex> |
522 | <v-flex xs12 sm6> | 528 | <v-flex xs12 sm6> |
523 | <v-layout> | 529 | <v-layout> |
524 | <v-flex xs4 class="pt-4 subheading"> | 530 | <v-flex xs4 class="pt-4 subheading"> |
525 | <label class="right">Email ID:</label> | 531 | <label class="right">Email ID:</label> |
526 | </v-flex> | 532 | </v-flex> |
527 | <v-flex xs8 class="ml-3"> | 533 | <v-flex xs8 class="ml-3"> |
528 | <v-text-field | 534 | <v-text-field |
529 | placeholder="fill your email" | 535 | placeholder="fill your email" |
530 | :rules="emailRules" | 536 | :rules="emailRules" |
531 | v-model="addUser.email" | 537 | v-model="addUser.email" |
532 | type="text" | 538 | type="text" |
533 | name="email" | 539 | name="email" |
534 | required | 540 | required |
535 | ></v-text-field> | 541 | ></v-text-field> |
536 | </v-flex> | 542 | </v-flex> |
537 | </v-layout> | 543 | </v-layout> |
538 | </v-flex> | 544 | </v-flex> |
539 | </v-layout> | 545 | </v-layout> |
540 | <v-layout> | 546 | <v-layout> |
541 | <v-flex xs12 sm6> | 547 | <v-flex xs12 sm6> |
542 | <v-layout> | 548 | <v-layout> |
543 | <v-flex xs4 class="pt-4 subheading"> | 549 | <v-flex xs4 class="pt-4 subheading"> |
544 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> | 550 | <label class="right hidden-sm-only hidden-xs-only">Date of Birth:</label> |
545 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> | 551 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">D.O.B:</label> |
546 | </v-flex> | 552 | </v-flex> |
547 | <v-flex xs8 class="ml-3"> | 553 | <v-flex xs8 class="ml-3"> |
548 | <v-menu | 554 | <v-menu |
549 | ref="menu" | 555 | ref="menu" |
550 | :close-on-content-click="false" | 556 | :close-on-content-click="false" |
551 | v-model="menu" | 557 | v-model="menu" |
552 | :nudge-right="40" | 558 | :nudge-right="40" |
553 | lazy | 559 | lazy |
554 | transition="scale-transition" | 560 | transition="scale-transition" |
555 | offset-y | 561 | offset-y |
556 | full-width | 562 | full-width |
557 | min-width="290px" | 563 | min-width="290px" |
558 | > | 564 | > |
559 | <v-text-field | 565 | <v-text-field |
560 | slot="activator" | 566 | slot="activator" |
561 | :rules="dateRules" | 567 | :rules="dateRules" |
562 | v-model="addUser.dob" | 568 | v-model="addUser.dob" |
563 | placeholder="Select DOB" | 569 | placeholder="Select DOB" |
564 | ></v-text-field> | 570 | ></v-text-field> |
565 | <v-date-picker | 571 | <v-date-picker |
566 | ref="picker" | 572 | ref="picker" |
567 | v-model="addUser.dob" | 573 | v-model="addUser.dob" |
568 | :max="new Date().toISOString().substr(0, 10)" | 574 | :max="new Date().toISOString().substr(0, 10)" |
569 | min="1950-01-01" | 575 | min="1950-01-01" |
570 | @input="menu = false" | 576 | @input="menu = false" |
571 | ></v-date-picker> | 577 | ></v-date-picker> |
572 | </v-menu> | 578 | </v-menu> |
573 | </v-flex> | 579 | </v-flex> |
574 | </v-layout> | 580 | </v-layout> |
575 | </v-flex> | 581 | </v-flex> |
576 | <v-flex xs12 sm6> | 582 | <v-flex xs12 sm6> |
577 | <v-layout> | 583 | <v-layout> |
578 | <v-flex xs4 class="pt-4 subheading"> | 584 | <v-flex xs4 class="pt-4 subheading"> |
579 | <label class="right">Gender:</label> | 585 | <label class="right">Gender:</label> |
580 | </v-flex> | 586 | </v-flex> |
581 | <v-flex xs8 class="ml-3"> | 587 | <v-flex xs8 class="ml-3"> |
582 | <v-select | 588 | <v-select |
583 | v-model="addUser.gender" | 589 | v-model="addUser.gender" |
584 | :items="gender" | 590 | :items="gender" |
585 | label="Selct Gender " | 591 | label="Selct Gender " |
586 | :rules="genderRules" | 592 | :rules="genderRules" |
587 | required | 593 | required |
588 | ></v-select> | 594 | ></v-select> |
589 | </v-flex> | 595 | </v-flex> |
590 | </v-layout> | 596 | </v-layout> |
591 | </v-flex> | 597 | </v-flex> |
592 | </v-layout> | 598 | </v-layout> |
593 | <v-layout> | 599 | <v-layout> |
594 | <v-flex xs12 sm6> | 600 | <v-flex xs12 sm6> |
595 | <v-layout> | 601 | <v-layout> |
596 | <v-flex xs4 class="pt-4 subheading"> | 602 | <v-flex xs4 class="pt-4 subheading"> |
597 | <label class="right">Religion:</label> | 603 | <label class="right">Religion:</label> |
598 | </v-flex> | 604 | </v-flex> |
599 | <v-flex xs8 class="ml-3"> | 605 | <v-flex xs8 class="ml-3"> |
600 | <v-text-field | 606 | <v-text-field |
601 | v-model="addUser.religion" | 607 | v-model="addUser.religion" |
602 | placeholder="fill your Religion" | 608 | placeholder="fill your Religion" |
603 | name="Religion" | 609 | name="Religion" |
604 | type="text" | 610 | type="text" |
605 | :rules="religionRules" | 611 | :rules="religionRules" |
606 | required | 612 | required |
607 | ></v-text-field> | 613 | ></v-text-field> |
608 | </v-flex> | 614 | </v-flex> |
609 | </v-layout> | 615 | </v-layout> |
610 | </v-flex> | 616 | </v-flex> |
611 | <v-flex xs12 sm6> | 617 | <v-flex xs12 sm6> |
612 | <v-layout> | 618 | <v-layout> |
613 | <v-flex xs4 class="pt-4 subheading"> | 619 | <v-flex xs4 class="pt-4 subheading"> |
614 | <label class="right">JoiningDate:</label> | 620 | <label class="right">JoiningDate:</label> |
615 | </v-flex> | 621 | </v-flex> |
616 | <v-flex xs8 class="ml-3"> | 622 | <v-flex xs8 class="ml-3"> |
617 | <v-menu | 623 | <v-menu |
618 | ref="menu1" | 624 | ref="menu1" |
619 | :close-on-content-click="false" | 625 | :close-on-content-click="false" |
620 | v-model="menu1" | 626 | v-model="menu1" |
621 | :nudge-right="40" | 627 | :nudge-right="40" |
622 | lazy | 628 | lazy |
623 | transition="scale-transition" | 629 | transition="scale-transition" |
624 | offset-y | 630 | offset-y |
625 | full-width | 631 | full-width |
626 | min-width="290px" | 632 | min-width="290px" |
627 | > | 633 | > |
628 | <v-text-field | 634 | <v-text-field |
629 | slot="activator" | 635 | slot="activator" |
630 | :rules="joinDateRules" | 636 | :rules="joinDateRules" |
631 | v-model="addUser.joinDate" | 637 | v-model="addUser.joinDate" |
632 | placeholder="Select date" | 638 | placeholder="Select date" |
633 | ></v-text-field> | 639 | ></v-text-field> |
634 | <v-date-picker | 640 | <v-date-picker |
635 | ref="picker" | 641 | ref="picker" |
636 | v-model="addUser.joinDate" | 642 | v-model="addUser.joinDate" |
637 | :max="new Date().toISOString().substr(0, 10)" | 643 | :max="new Date().toISOString().substr(0, 10)" |
638 | min="1950-01-01" | 644 | min="1950-01-01" |
639 | @input="menu1 = false" | 645 | @input="menu1 = false" |
640 | ></v-date-picker> | 646 | ></v-date-picker> |
641 | </v-menu> | 647 | </v-menu> |
642 | </v-flex> | 648 | </v-flex> |
643 | </v-layout> | 649 | </v-layout> |
644 | </v-flex> | 650 | </v-flex> |
645 | </v-layout> | 651 | </v-layout> |
646 | <v-layout> | 652 | <v-layout> |
647 | <v-flex xs12 sm6> | 653 | <v-flex xs12 sm6> |
648 | <v-layout> | 654 | <v-layout> |
649 | <v-flex xs4 class="pt-4 subheading"> | 655 | <v-flex xs4 class="pt-4 subheading"> |
650 | <label class="right">Phone :</label> | 656 | <label class="right">Phone :</label> |
651 | </v-flex> | 657 | </v-flex> |
652 | <v-flex xs8 class="ml-3"> | 658 | <v-flex xs8 class="ml-3"> |
653 | <v-text-field | 659 | <v-text-field |
654 | v-model="addUser.mobileNo" | 660 | v-model="addUser.mobileNo" |
655 | placeholder="fill your Phone Number" | 661 | placeholder="fill your Phone Number" |
656 | name="mobileNo" | 662 | name="mobileNo" |
657 | type="number" | 663 | type="number" |
658 | :rules="mobileNoRules" | 664 | :rules="mobileNoRules" |
659 | required | 665 | required |
660 | ></v-text-field> | 666 | ></v-text-field> |
661 | </v-flex> | 667 | </v-flex> |
662 | </v-layout> | 668 | </v-layout> |
663 | </v-flex> | 669 | </v-flex> |
664 | <v-flex xs12 sm6> | 670 | <v-flex xs12 sm6> |
665 | <v-layout> | 671 | <v-layout> |
666 | <v-flex xs4 class="pt-4 subheading"> | 672 | <v-flex xs4 class="pt-4 subheading"> |
667 | <label class="right hidden-sm-only hidden-xs-only">Select Role:</label> | 673 | <label class="right hidden-sm-only hidden-xs-only">Select Role:</label> |
668 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> | 674 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Role:</label> |
669 | </v-flex> | 675 | </v-flex> |
670 | <v-flex xs8 class="ml-3"> | 676 | <v-flex xs8 class="ml-3"> |
671 | <v-autocomplete | 677 | <v-autocomplete |
672 | v-model="addUser.role" | 678 | v-model="addUser.role" |
673 | :rules="role" | 679 | :rules="role" |
674 | :items="userRole" | 680 | :items="userRole" |
675 | item-text="name" | 681 | item-text="name" |
676 | item-value="name" | 682 | item-value="name" |
677 | placeholder="Select Role Name" | 683 | placeholder="Select Role Name" |
678 | required | 684 | required |
679 | ></v-autocomplete> | 685 | ></v-autocomplete> |
680 | </v-flex> | 686 | </v-flex> |
681 | </v-layout> | 687 | </v-layout> |
682 | </v-flex> | 688 | </v-flex> |
683 | </v-layout> | 689 | </v-layout> |
684 | <v-layout wrap> | 690 | <v-layout wrap> |
685 | <!-- <v-flex xs12 sm6> | 691 | <!-- <v-flex xs12 sm6> |
686 | <v-layout> | 692 | <v-layout> |
687 | <v-flex xs4 class="pt-4 subheading"> | 693 | <v-flex xs4 class="pt-4 subheading"> |
688 | <label class="right">Username:</label> | 694 | <label class="right">Username:</label> |
689 | </v-flex> | 695 | </v-flex> |
690 | <v-flex xs8 class="ml-3"> | 696 | <v-flex xs8 class="ml-3"> |
691 | <v-text-field | 697 | <v-text-field |
692 | v-model="addUser.userName" | 698 | v-model="addUser.userName" |
693 | placeholder="fill your User Name" | 699 | placeholder="fill your User Name" |
694 | type="text" | 700 | type="text" |
695 | :rules="userNameRules" | 701 | :rules="userNameRules" |
696 | required | 702 | required |
697 | ></v-text-field> | 703 | ></v-text-field> |
698 | </v-flex> | 704 | </v-flex> |
699 | </v-layout> | 705 | </v-layout> |
700 | </v-flex> --> | 706 | </v-flex>--> |
701 | <v-flex xs12 sm6> | 707 | <v-flex xs12 sm6> |
702 | <v-layout> | 708 | <v-layout> |
703 | <v-flex xs4 class="pt-4 subheading"> | 709 | <v-flex xs4 class="pt-4 subheading"> |
704 | <label class="right hidden-sm-only hidden-xs-only">Uplaod Image:</label> | 710 | <label class="right hidden-sm-only hidden-xs-only">Uplaod Image:</label> |
705 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Image:</label> | 711 | <label class="right hidden-lg-only hidden-xl-only hidden-md-only">Image:</label> |
706 | </v-flex> | 712 | </v-flex> |
707 | <v-flex xs8 class="ml-3"> | 713 | <v-flex xs8 class="ml-3"> |
708 | <v-text-field | 714 | <v-text-field |
709 | label="Select Image" | 715 | label="Select Image" |
710 | @click="pickFile" | 716 | @click="pickFile" |
711 | v-model="imageName" | 717 | v-model="imageName" |
712 | append-icon="attach_file" | 718 | append-icon="attach_file" |
713 | ></v-text-field> | 719 | ></v-text-field> |
714 | <input | 720 | <input |
715 | type="file" | 721 | type="file" |
716 | style="display:none" | 722 | style="display:none" |
717 | ref="image" | 723 | ref="image" |
718 | accept="image/*" | 724 | accept="image/*" |
719 | @change="onFilePicked" | 725 | @change="onFilePicked" |
720 | /> | 726 | /> |
721 | </v-flex> | 727 | </v-flex> |
722 | </v-layout> | 728 | </v-layout> |
723 | </v-flex> | 729 | </v-flex> |
724 | <v-flex xs12 sm6> | 730 | <v-flex xs12 sm6> |
725 | <v-layout> | 731 | <v-layout> |
726 | <v-flex xs4 class="pt-4 subheading"> | 732 | <v-flex xs4 class="pt-4 subheading"> |
727 | <label class="right">Address:</label> | 733 | <label class="right">Address:</label> |
728 | </v-flex> | 734 | </v-flex> |
729 | <v-flex xs8 class="ml-3"> | 735 | <v-flex xs8 class="ml-3"> |
730 | <v-text-field | 736 | <v-text-field |
731 | name="input-4-3" | 737 | name="input-4-3" |
732 | v-model="addUser.presentAddress" | 738 | v-model="addUser.presentAddress" |
733 | :rules="presentAddress" | 739 | :rules="presentAddress" |
734 | placeholder="fill Your present Address" | 740 | placeholder="fill Your present Address" |
735 | required | 741 | required |
736 | ></v-text-field> | 742 | ></v-text-field> |
737 | </v-flex> | 743 | </v-flex> |
738 | </v-layout> | 744 | </v-layout> |
739 | </v-flex> | 745 | </v-flex> |
740 | </v-layout> | 746 | </v-layout> |
741 | <v-layout> | 747 | <v-layout> |
742 | <v-flex xs12 sm12> | 748 | <v-flex xs12 sm12> |
743 | <v-layout class="right"> | 749 | <v-layout class="right"> |
744 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> | 750 | <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> |
745 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 751 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
746 | </v-layout> | 752 | </v-layout> |
747 | </v-flex> | 753 | </v-flex> |
748 | </v-layout> | 754 | </v-layout> |
749 | </v-container> | 755 | </v-container> |
750 | </v-form> | 756 | </v-form> |
751 | </v-card> | 757 | </v-card> |
752 | </v-dialog> | 758 | </v-dialog> |
753 | <div class="loader" v-if="showLoader"> | 759 | <div class="loader" v-if="showLoader"> |
754 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 760 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
755 | </div> | 761 | </div> |
756 | <v-snackbar | 762 | <v-snackbar |
757 | :timeout="timeout" | 763 | :timeout="timeout" |
758 | :top="y === 'top'" | 764 | :top="y === 'top'" |
759 | :right="x === 'right'" | 765 | :right="x === 'right'" |
760 | :vertical="mode === 'vertical'" | 766 | :vertical="mode === 'vertical'" |
761 | v-model="snackbar" | 767 | v-model="snackbar" |
762 | :color="color" | 768 | :color="color" |
763 | >{{ text }}</v-snackbar> | 769 | >{{ text }}</v-snackbar> |
764 | </v-container> | 770 | </v-container> |
765 | </template> | 771 | </template> |
766 | 772 | ||
767 | <script> | 773 | <script> |
768 | import http from "@/Services/http.js"; | 774 | import http from "@/Services/http.js"; |
769 | import Util from "@/util"; | 775 | import Util from "@/util"; |
770 | import moment from "moment"; | 776 | import moment from "moment"; |
771 | import _ from 'lodash'; | 777 | import _ from "lodash"; |
772 | 778 | ||
773 | export default { | 779 | export default { |
774 | data: () => ({ | 780 | data: () => ({ |
775 | component: "report-generate", | 781 | component: "report-generate", |
776 | snackbar: false, | 782 | snackbar: false, |
777 | y: "top", | 783 | y: "top", |
778 | x: "right", | 784 | x: "right", |
779 | mode: "", | 785 | mode: "", |
780 | timeout: 3000, | 786 | timeout: 3000, |
781 | color: "", | 787 | color: "", |
782 | text: "", | 788 | text: "", |
783 | show: true, | 789 | show: true, |
784 | showSearch: false, | 790 | showSearch: false, |
785 | showLoader: false, | 791 | showLoader: false, |
786 | loading: false, | 792 | loading: false, |
787 | addUserDialog: false, | 793 | addUserDialog: false, |
788 | date: null, | 794 | date: null, |
789 | search: "", | 795 | search: "", |
790 | menu: false, | 796 | menu: false, |
791 | menu1: false, | 797 | menu1: false, |
792 | menu2: false, | 798 | menu2: false, |
793 | menu3: false, | 799 | menu3: false, |
794 | viewUserDialog: false, | 800 | viewUserDialog: false, |
795 | editUserDialog: false, | 801 | editUserDialog: false, |
796 | valid: true, | 802 | valid: true, |
797 | isActive: true, | 803 | isActive: true, |
798 | newActive: false, | 804 | newActive: false, |
799 | pagination: { | 805 | pagination: { |
800 | rowsPerPage: 10 | 806 | rowsPerPage: 10, |
801 | }, | 807 | }, |
802 | imageData: {}, | 808 | imageData: {}, |
803 | imageName: "", | 809 | imageName: "", |
804 | imageUrl: "", | 810 | imageUrl: "", |
805 | imageFile: "", | 811 | imageFile: "", |
806 | nameRules: [v => !!v || "Name is required"], | 812 | nameRules: [(v) => !!v || "Name is required"], |
807 | dateRules: [v => !!v || " DOB is required"], | 813 | dateRules: [(v) => !!v || " DOB is required"], |
808 | genderRules: [v => !!v || " Gender Name is required"], | 814 | genderRules: [(v) => !!v || " Gender Name is required"], |
809 | pincode: [v => !!v || " Pincode is required"], | 815 | pincode: [(v) => !!v || " Pincode is required"], |
810 | role: [v => !!v || "Role Name is required"], | 816 | role: [(v) => !!v || "Role Name is required"], |
811 | permanentAddress: [v => !!v || " Permanent Address is required"], | 817 | permanentAddress: [(v) => !!v || " Permanent Address is required"], |
812 | presentAddress: [v => !!v || " Present Address is required"], | 818 | presentAddress: [(v) => !!v || " Present Address is required"], |
813 | mobileNoRules: [v => !!v || "Phone Number is required"], | 819 | mobileNoRules: [(v) => !!v || "Phone Number is required"], |
814 | religionRules: [v => !!v || "Religion Name is required"], | 820 | religionRules: [(v) => !!v || "Religion Name is required"], |
815 | joinDateRules: [v => !!v || " Join Date is required"], | 821 | joinDateRules: [(v) => !!v || " Join Date is required"], |
816 | userNameRules: [v => !!v || " User Name is required"], | 822 | userNameRules: [(v) => !!v || " User Name is required"], |
817 | passwordRules: [v => !!v || " Password is required"], | 823 | passwordRules: [(v) => !!v || " Password is required"], |
818 | errorMessages: "", | 824 | errorMessages: "", |
819 | userRole: [], | 825 | userRole: [], |
820 | emailRules: [ | 826 | emailRules: [ |
821 | v => !!v || "E-mail is required", | 827 | (v) => !!v || "E-mail is required", |
822 | v => | 828 | (v) => |
823 | /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || | 829 | /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || |
824 | "E-mail must be valid" | 830 | "E-mail must be valid", |
825 | ], | 831 | ], |
826 | gender: ["Male", "Female"], | 832 | gender: ["Male", "Female"], |
827 | headers: [ | 833 | headers: [ |
828 | { | 834 | { |
829 | text: "No", | 835 | text: "No", |
830 | align: "", | 836 | align: "", |
831 | sortable: false, | 837 | sortable: false, |
832 | value: "No" | 838 | value: "No", |
833 | }, | 839 | }, |
834 | { | 840 | { |
835 | text: "Profile Pic", | 841 | text: "Profile Pic", |
836 | value: "profilePicUrl", | 842 | value: "profilePicUrl", |
837 | sortable: false, | 843 | sortable: false, |
838 | align: "center" | 844 | align: "center", |
839 | }, | 845 | }, |
840 | { text: "Name", value: "name", sortable: false, align: "center" }, | 846 | { text: "Name", value: "name", sortable: false, align: "center" }, |
841 | { text: "Email", value: "email", sortable: false, align: "center" }, | 847 | { text: "Email", value: "email", sortable: false, align: "center" }, |
842 | { text: "DOB", value: "dob", sortable: false, align: "center" }, | 848 | { text: "DOB", value: "dob", sortable: false, align: "center" }, |
843 | { | 849 | { |
844 | text: "Joining Date", | 850 | text: "Joining Date", |
845 | value: "joiningDate", | 851 | value: "joiningDate", |
846 | sortable: false, | 852 | sortable: false, |
847 | align: "center" | 853 | align: "center", |
848 | }, | 854 | }, |
849 | { | 855 | { |
850 | text: "Phone", | 856 | text: "Phone", |
851 | value: "phone", | 857 | value: "phone", |
852 | sortable: false, | 858 | sortable: false, |
853 | align: "center" | 859 | align: "center", |
854 | }, | 860 | }, |
855 | { | 861 | { |
856 | text: "Status", | 862 | text: "Status", |
857 | value: "status", | 863 | value: "status", |
858 | sortable: false, | 864 | sortable: false, |
859 | align: "center" | 865 | align: "center", |
860 | }, | 866 | }, |
861 | { text: "Action", value: "", sortable: false, align: "center" } | 867 | { text: "Action", value: "", sortable: false, align: "center" }, |
862 | ], | 868 | ], |
863 | Users: [], | 869 | Users: [], |
864 | editedIndex: -1, | 870 | editedIndex: -1, |
865 | upload: "", | 871 | upload: "", |
866 | editedItem: { | 872 | editedItem: { |
867 | role: "", | 873 | role: "", |
868 | name: "", | 874 | name: "", |
869 | email: "", | 875 | email: "", |
870 | dob: null, | 876 | dob: null, |
871 | gender: "", | 877 | gender: "", |
872 | role: "", | 878 | role: "", |
873 | address: "", | 879 | address: "", |
874 | phone: "", | 880 | phone: "", |
875 | religion: "", | 881 | religion: "", |
876 | joiningDate: null | 882 | joiningDate: null, |
877 | }, | 883 | }, |
878 | addUser: { | 884 | addUser: { |
879 | role: "", | 885 | role: "", |
880 | name: "", | 886 | name: "", |
881 | email: "", | 887 | email: "", |
882 | dob: null, | 888 | dob: null, |
883 | gender: "", | 889 | gender: "", |
884 | pincode: "", | 890 | pincode: "", |
885 | role: "", | 891 | role: "", |
886 | permanentAddress: "", | 892 | permanentAddress: "", |
887 | presentAddress: "", | 893 | presentAddress: "", |
888 | mobileNo: "", | 894 | mobileNo: "", |
889 | religion: "", | 895 | religion: "", |
890 | joiningDate: null | 896 | joiningDate: null, |
891 | } | 897 | }, |
892 | }), | 898 | }), |
893 | watch: { | 899 | watch: { |
894 | menu(val) { | 900 | menu(val) { |
895 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 901 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
896 | }, | 902 | }, |
897 | menu1(val) { | 903 | menu1(val) { |
898 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); | 904 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
899 | } | 905 | }, |
906 | addUserDialog: function (val) { | ||
907 | if (!val) { | ||
908 | this.addUser = []; | ||
909 | this.imageName = ""; | ||
910 | this.imageFile = ""; | ||
911 | this.imageUrl = ""; | ||
912 | } | ||
913 | }, | ||
900 | }, | 914 | }, |
901 | methods: { | 915 | methods: { |
902 | save(date) { | 916 | save(date) { |
903 | this.$refs.menu.save(date); | 917 | this.$refs.menu.save(date); |
904 | }, | 918 | }, |
905 | save(date) { | 919 | save(date) { |
906 | this.$refs.menu1.save(date); | 920 | this.$refs.menu1.save(date); |
907 | }, | 921 | }, |
908 | pickFile() { | 922 | pickFile() { |
909 | this.$refs.image.click(); | 923 | this.$refs.image.click(); |
910 | }, | 924 | }, |
911 | onFilePicked(e) { | 925 | onFilePicked(e) { |
912 | // console.log(e) | 926 | // console.log(e) |
913 | const files = e.target.files; | 927 | const files = e.target.files; |
914 | this.upload = e.target.files[0]; | 928 | this.upload = e.target.files[0]; |
915 | console.log("imageData-upload========>", this.upload); | 929 | console.log("imageData-upload========>", this.upload); |
916 | if (files[0] !== undefined) { | 930 | if (files[0] !== undefined) { |
917 | this.imageName = files[0].name; | 931 | this.imageName = files[0].name; |
918 | if (this.imageName.lastIndexOf(".") <= 0) { | 932 | if (this.imageName.lastIndexOf(".") <= 0) { |
919 | return; | 933 | return; |
920 | } | 934 | } |
921 | const fr = new FileReader(); | 935 | const fr = new FileReader(); |
922 | fr.readAsDataURL(files[0]); | 936 | fr.readAsDataURL(files[0]); |
923 | fr.addEventListener("load", () => { | 937 | fr.addEventListener("load", () => { |
924 | this.imageUrl = fr.result; | 938 | this.imageUrl = fr.result; |
925 | this.imageFile = files[0]; // this is an image file that can be sent to server... | 939 | this.imageFile = files[0]; // this is an image file that can be sent to server... |
926 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 940 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
927 | // console.log("upload=======>", this.imageData.imageUrl); | 941 | // console.log("upload=======>", this.imageData.imageUrl); |
928 | console.log("imageFile", this.imageUrl); | 942 | console.log("imageFile", this.imageUrl); |
929 | }); | 943 | }); |
930 | } else { | 944 | } else { |
931 | this.imageName = ""; | 945 | this.imageName = ""; |
932 | this.imageFile = ""; | 946 | this.imageFile = ""; |
933 | this.imageUrl = ""; | 947 | this.imageUrl = ""; |
934 | } | 948 | } |
935 | }, | 949 | }, |
936 | dates: function(date) { | 950 | dates: function (date) { |
937 | return moment(date).format("MMMM DD, YYYY"); | 951 | return moment(date).format("MMMM DD, YYYY"); |
938 | }, | 952 | }, |
939 | getUsersList() { | 953 | getUsersList() { |
940 | this.showLoader = true; | 954 | this.showLoader = true; |
941 | var token = this.$store.state.token; | 955 | var token = this.$store.state.token; |
942 | http() | 956 | http() |
943 | .get("/getUsersList", { | 957 | .get("/getUsersList", { |
944 | headers: { Authorization: "Bearer " + token } | 958 | headers: { Authorization: "Bearer " + token }, |
945 | }) | 959 | }) |
946 | .then(response => { | 960 | .then((response) => { |
947 | this.Users = response.data.data; | 961 | this.Users = response.data.data; |
948 | this.showLoader = false; | 962 | this.showLoader = false; |
949 | }) | 963 | }) |
950 | .catch(error => { | 964 | .catch((error) => { |
951 | this.showLoader = false; | 965 | this.showLoader = false; |
952 | if (error.response.status === 401) { | 966 | if (error.response.status === 401) { |
953 | this.$router.replace({ path: "/" }); | 967 | this.$router.replace({ path: "/" }); |
954 | this.$store.dispatch("setToken", null); | 968 | this.$store.dispatch("setToken", null); |
955 | this.$store.dispatch("Id", null); | 969 | this.$store.dispatch("Id", null); |
956 | } | 970 | } |
957 | }); | 971 | }); |
958 | }, | 972 | }, |
959 | editItem(item) { | 973 | editItem(item) { |
960 | this.editedIndex = this.Users.indexOf(item); | 974 | this.editedIndex = this.Users.indexOf(item); |
961 | this.editedItem = Object.assign({}, item); | 975 | this.editedItem = Object.assign({}, item); |
962 | this.editedItem.dob = | 976 | this.editedItem.dob = |
963 | this.editedItem.dob != undefined | 977 | this.editedItem.dob != undefined |
964 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) | 978 | ? (this.editedItem.dob = this.editedItem.dob.substring(0, 10)) |
965 | : (this.editedItem.dob = ""); | 979 | : (this.editedItem.dob = ""); |
966 | for (let i = 0; i < this.userRole.length; i++) { | 980 | for (let i = 0; i < this.userRole.length; i++) { |
967 | if (this.userRole[i].role === this.editedItem.role) { | 981 | if (this.userRole[i].role === this.editedItem.role) { |
968 | this.editedItem.role = this.userRole[i].name; | 982 | this.editedItem.role = this.userRole[i].name; |
969 | } | 983 | } |
970 | } | 984 | } |
971 | this.editUserDialog = true; | 985 | this.editUserDialog = true; |
972 | }, | 986 | }, |
973 | profile(item) { | 987 | profile(item) { |
974 | this.editedIndex = this.Users.indexOf(item); | 988 | this.editedIndex = this.Users.indexOf(item); |
975 | this.editedItem = Object.assign({}, item); | 989 | this.editedItem = Object.assign({}, item); |
976 | this.viewUserDialog = true; | 990 | this.viewUserDialog = true; |
977 | for (let i = 0; i < this.userRole.length; i++) { | 991 | for (let i = 0; i < this.userRole.length; i++) { |
978 | if (this.userRole[i].role === this.editedItem.role) { | 992 | if (this.userRole[i].role === this.editedItem.role) { |
979 | this.editedItem.role = this.userRole[i].name; | 993 | this.editedItem.role = this.userRole[i].name; |
980 | } | 994 | } |
981 | } | 995 | } |
982 | }, | 996 | }, |
983 | deleteItem(item) { | 997 | deleteItem(item) { |
984 | let deleteUser = { | 998 | let deleteUser = { |
985 | userId: item._id | 999 | userId: item._id, |
986 | }; | 1000 | }; |
987 | http() | 1001 | http() |
988 | .delete( | 1002 | .delete( |
989 | "/deleteUser", | 1003 | "/deleteUser", |
990 | confirm("Are you sure you want to delete this?") && { | 1004 | confirm("Are you sure you want to delete this?") && { |
991 | params: deleteUser | 1005 | params: deleteUser, |
992 | } | 1006 | } |
993 | ) | 1007 | ) |
994 | .then(response => { | 1008 | .then((response) => { |
995 | this.snackbar = true; | 1009 | this.snackbar = true; |
996 | this.text = response.data.message; | 1010 | this.text = response.data.message; |
997 | this.color = "green"; | 1011 | this.color = "green"; |
998 | this.getUsersList(); | 1012 | this.getUsersList(); |
999 | }) | 1013 | }) |
1000 | .catch(error => { | 1014 | .catch((error) => { |
1001 | this.snackbar = true; | 1015 | this.snackbar = true; |
1002 | this.color = "error"; | 1016 | this.color = "error"; |
1003 | this.text = error.response.data.message; | 1017 | this.text = error.response.data.message; |
1004 | }); | 1018 | }); |
1005 | }, | 1019 | }, |
1006 | close() { | 1020 | close() { |
1007 | this.editUserDialog = false; | 1021 | this.editUserDialog = false; |
1008 | }, | 1022 | }, |
1009 | closeProfileDialog() { | 1023 | closeProfileDialog() { |
1010 | this.viewUserDialog = false; | 1024 | this.viewUserDialog = false; |
1011 | }, | 1025 | }, |
1012 | submit() { | 1026 | submit() { |
1013 | if (this.$refs.form.validate()) { | 1027 | if (this.$refs.form.validate()) { |
1014 | let addUserData = { | 1028 | let addUserData = { |
1015 | name: this.addUser.name, | 1029 | name: this.addUser.name, |
1016 | email: this.addUser.email, | 1030 | email: this.addUser.email, |
1017 | dob: this.addUser.dob, | 1031 | dob: this.addUser.dob, |
1018 | gender: this.addUser.gender, | 1032 | gender: this.addUser.gender, |
1019 | religion: this.addUser.religion, | 1033 | religion: this.addUser.religion, |
1020 | role: this.addUser.role, | 1034 | role: this.addUser.role, |
1021 | address: this.addUser.presentAddress, | 1035 | address: this.addUser.presentAddress, |
1022 | phone: this.addUser.mobileNo, | 1036 | phone: this.addUser.mobileNo, |
1023 | religion: this.addUser.religion, | 1037 | religion: this.addUser.religion, |
1024 | joiningDate: this.addUser.joinDate | 1038 | joiningDate: this.addUser.joinDate, |
1025 | }; | 1039 | }; |
1026 | if (this.imageUrl) { | 1040 | if (this.imageUrl) { |
1027 | var str = this.imageUrl; | 1041 | var str = this.imageUrl; |
1028 | const [baseUrl, imageUrl] = str.split(/,/); | 1042 | const [baseUrl, imageUrl] = str.split(/,/); |
1029 | addUserData.profilePicUrl = imageUrl; | 1043 | addUserData.profilePicUrl = imageUrl; |
1030 | } | 1044 | } |
1031 | this.loading = true; | 1045 | this.loading = true; |
1032 | http() | 1046 | http() |
1033 | .post("/createUser", addUserData) | 1047 | .post("/createUser", addUserData) |
1034 | .then(response => { | 1048 | .then((response) => { |
1035 | this.imageUrl = ""; | 1049 | this.imageUrl = ""; |
1036 | this.getUsersList(); | 1050 | this.getUsersList(); |
1037 | this.snackbar = true; | 1051 | this.snackbar = true; |
1038 | this.addUserDialog = false; | 1052 | this.addUserDialog = false; |
1039 | this.text = response.data.message; | 1053 | this.text = response.data.message; |
1040 | this.color = "green"; | 1054 | this.color = "green"; |
1041 | this.clear(); | 1055 | this.clear(); |
1042 | this.loading = false; | 1056 | this.loading = false; |
1043 | }) | 1057 | }) |
1044 | .catch(error => { | 1058 | .catch((error) => { |
1045 | this.loading = false; | 1059 | this.loading = false; |
1046 | this.snackbar = true; | 1060 | this.snackbar = true; |
1047 | this.color = "error"; | 1061 | this.color = "error"; |
1048 | this.text = error.response.data.message; | 1062 | this.text = error.response.data.message; |
1049 | }); | 1063 | }); |
1050 | } | 1064 | } |
1051 | }, | 1065 | }, |
1052 | clear() { | 1066 | clear() { |
1053 | this.$refs.form.reset(); | 1067 | this.$refs.form.reset(); |
1054 | this.imageUrl = ""; | 1068 | this.imageUrl = ""; |
1055 | }, | 1069 | }, |
1056 | save() { | 1070 | save() { |
1057 | this.loading = true; | 1071 | this.loading = true; |
1058 | for (let i = 0; i < this.userRole.length; i++) { | 1072 | for (let i = 0; i < this.userRole.length; i++) { |
1059 | if (this.userRole[i].name === this.editedItem.role) { | 1073 | if (this.userRole[i].name === this.editedItem.role) { |
1060 | this.editedItem.role = this.userRole[i].role; | 1074 | this.editedItem.role = this.userRole[i].role; |
1061 | } | 1075 | } |
1062 | } | 1076 | } |
1063 | this.editedItem.userId = this.editedItem._id; | 1077 | this.editedItem.userId = this.editedItem._id; |
1064 | if (this.imageUrl) { | 1078 | if (this.imageUrl) { |
1065 | var str = this.imageUrl; | 1079 | var str = this.imageUrl; |
1066 | const [baseUrl, imageUrl] = str.split(/,/); | 1080 | const [baseUrl, imageUrl] = str.split(/,/); |
1067 | this.editedItem.upload = imageUrl; | 1081 | this.editedItem.upload = imageUrl; |
1068 | } | 1082 | } |
1069 | http() | 1083 | http() |
1070 | .put("/updateUser", this.editedItem) | 1084 | .put("/updateUser", this.editedItem) |
1071 | .then(response => { | 1085 | .then((response) => { |
1072 | this.snackbar = true; | 1086 | this.snackbar = true; |
1073 | this.text = response.data.message; | 1087 | this.text = response.data.message; |
1074 | this.color = "green"; | 1088 | this.color = "green"; |
1075 | this.loading = false; | 1089 | this.loading = false; |
1076 | this.getUsersList(); | 1090 | this.getUsersList(); |
1077 | this.close(); | 1091 | this.close(); |
1078 | }) | 1092 | }) |
1079 | .catch(error => { | 1093 | .catch((error) => { |
1080 | this.loading = false; | 1094 | this.loading = false; |
1081 | this.snackbar = true; | 1095 | this.snackbar = true; |
1082 | this.text = error.response.data.message; | 1096 | this.text = error.response.data.message; |
1083 | this.color = "error"; | 1097 | this.color = "error"; |
1084 | }); | 1098 | }); |
1085 | }, | 1099 | }, |
1086 | getRole() { | 1100 | getRole() { |
1087 | this.showLoader = true; | 1101 | this.showLoader = true; |
1088 | var token = this.$store.state.token; | 1102 | var token = this.$store.state.token; |
1089 | http() | 1103 | http() |
1090 | .get("/getRolesList", { | 1104 | .get("/getRolesList", { |
1091 | headers: { Authorization: "Bearer " + token } | 1105 | headers: { Authorization: "Bearer " + token }, |
1092 | }) | 1106 | }) |
1093 | .then(response => { | 1107 | .then((response) => { |
1094 | this.userRole = response.data.data; | 1108 | this.userRole = response.data.data; |
1095 | this.showLoader = false; | 1109 | this.showLoader = false; |
1096 | this.userRole = response.data.data; | 1110 | this.userRole = response.data.data; |
1097 | var removedRoles = _.remove(this.userRole, function(c) { | 1111 | var removedRoles = _.remove(this.userRole, function (c) { |
1098 | //remove if color is green or yellow | 1112 | //remove if color is green or yellow |
1099 | return c.name === "ADMIN" ||c.name === "SUPERADMIN" || c.name === "TEACHER" || c.name === "STUDENT" || c.name === "PARENT" ; | 1113 | return ( |
1100 | }); | 1114 | c.name === "ADMIN" || |
1115 | c.name === "SUPERADMIN" || | ||
1116 | c.name === "TEACHER" || | ||
1117 | c.name === "STUDENT" || | ||
1118 | c.name === "PARENT" | ||
1119 | ); | ||
1120 | }); | ||
1101 | }) | 1121 | }) |
1102 | .catch(error => { | 1122 | .catch((error) => { |
1103 | this.showLoader = false; | 1123 | this.showLoader = false; |
1104 | |||
1105 | }); | 1124 | }); |
1106 | }, | 1125 | }, |
1107 | suspendStatus(suspendStatus, id) { | 1126 | suspendStatus(suspendStatus, id) { |
1108 | let suspendStatusData = { | 1127 | let suspendStatusData = { |
1109 | userId: id, | 1128 | userId: id, |
1110 | status: suspendStatus | 1129 | status: suspendStatus, |
1111 | }; | 1130 | }; |
1112 | this.showLoader = true; | 1131 | this.showLoader = true; |
1113 | http() | 1132 | http() |
1114 | .put("/suspendUserAccount", suspendStatusData) | 1133 | .put("/suspendUserAccount", suspendStatusData) |
1115 | .then(response => { | 1134 | .then((response) => { |
1116 | this.getUsersList(); | 1135 | this.getUsersList(); |
1117 | this.text = response.data.message; | 1136 | this.text = response.data.message; |
1118 | this.snackbar = true; | 1137 | this.snackbar = true; |
1119 | this.showLoader = false; | 1138 | this.showLoader = false; |
1120 | }) | 1139 | }) |
1121 | .catch(error => { | 1140 | .catch((error) => { |
1122 | // console.log(error.response.data.data); | 1141 | // console.log(error.response.data.data); |
1123 | this.snackbar = true; | 1142 | this.snackbar = true; |
1124 | this.text = error.response.data.message; | 1143 | this.text = error.response.data.message; |
1125 | this.showLoader = false; | 1144 | this.showLoader = false; |
1126 | }); | 1145 | }); |
1127 | }, | 1146 | }, |
1128 | displaySearch() { | 1147 | displaySearch() { |
1129 | (this.show = false), (this.showSearch = true); | 1148 | (this.show = false), (this.showSearch = true); |
1130 | }, | 1149 | }, |
1131 | closeSearch() { | 1150 | closeSearch() { |
1132 | this.showSearch = false; | 1151 | this.showSearch = false; |
1133 | this.show = true; | 1152 | this.show = true; |
1134 | this.search = ""; | 1153 | this.search = ""; |
1135 | } | 1154 | }, |
1136 | }, | 1155 | }, |
1137 | mounted() { | 1156 | mounted() { |
1138 | this.getUsersList(); | 1157 | this.getUsersList(); |
1139 | this.getRole(); | 1158 | this.getRole(); |
1140 | } | 1159 | }, |
1141 | }; | 1160 | }; |
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-if="showSearch"> | 233 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
234 | <v-layout> | 234 | <v-layout> |
235 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 235 | <v-text-field |
236 | autofocus | ||
237 | v-model="search" | ||
238 | label="Search" | ||
239 | prepend-inner-icon="search" | ||
240 | color="primary" | ||
241 | ></v-text-field> | ||
236 | <v-icon @click="closeSearch" color="error">close</v-icon> | 242 | <v-icon @click="closeSearch" color="error">close</v-icon> |
237 | </v-layout> | 243 | </v-layout> |
238 | </v-flex> | 244 | </v-flex> |
239 | </v-toolbar> | 245 | </v-toolbar> |
240 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> | 246 | <v-data-table :headers="headers" :items="events" :pagination.sync="pagination" :search="search"> |
241 | <template slot="items" slot-scope="props"> | 247 | <template slot="items" slot-scope="props"> |
242 | <tr class="tr"> | 248 | <tr class="tr"> |
243 | <td class="td td-row">{{ props.index + 1}}</td> | 249 | <td class="td td-row">{{ props.index + 1}}</td> |
244 | <td | 250 | <td |
245 | class="td td-row text-xs-center" | 251 | class="td td-row text-xs-center" |
246 | >{{ props.item.classId ? props.item.classId.classNum : "-" }}</td> | 252 | >{{ props.item.classId ? props.item.classId.classNum : "-" }}</td> |
247 | <td class="td td-row text-xs-center">{{ props.item.title }}</td> | 253 | <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> | 254 | <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> | 255 | <td class="td td-row text-xs-center">{{ props.item.startTime }}</td> |
250 | <td class="td td-row text-xs-center"> | 256 | <td class="td td-row text-xs-center"> |
251 | <span> | 257 | <span> |
252 | <v-tooltip top> | 258 | <v-tooltip top> |
253 | <img | 259 | <img |
254 | slot="activator" | 260 | slot="activator" |
255 | style="cursor:pointer; width:25px; height:25px; " | 261 | style="cursor:pointer; width:25px; height:25px; " |
256 | class="mr-3" | 262 | class="mr-3" |
257 | @click="profile(props.item)" | 263 | @click="profile(props.item)" |
258 | src="/static/icon/view.png" | 264 | src="/static/icon/view.png" |
259 | /> | 265 | /> |
260 | <span>View</span> | 266 | <span>View</span> |
261 | </v-tooltip> | 267 | </v-tooltip> |
262 | <v-tooltip top> | 268 | <v-tooltip top> |
263 | <img | 269 | <img |
264 | slot="activator" | 270 | slot="activator" |
265 | style="cursor:pointer; width:20px; height:18px; " | 271 | style="cursor:pointer; width:20px; height:18px; " |
266 | class="mr-3" | 272 | class="mr-3" |
267 | @click="editItem(props.item)" | 273 | @click="editItem(props.item)" |
268 | src="/static/icon/edit.png" | 274 | src="/static/icon/edit.png" |
269 | /> | 275 | /> |
270 | <span>Edit</span> | 276 | <span>Edit</span> |
271 | </v-tooltip> | 277 | </v-tooltip> |
272 | <v-tooltip top> | 278 | <v-tooltip top> |
273 | <img | 279 | <img |
274 | slot="activator" | 280 | slot="activator" |
275 | style="cursor:pointer; width:20px; height:20px; " | 281 | style="cursor:pointer; width:20px; height:20px; " |
276 | class="mr-3" | 282 | class="mr-3" |
277 | @click="deleteItem(props.item)" | 283 | @click="deleteItem(props.item)" |
278 | src="/static/icon/delete.png" | 284 | src="/static/icon/delete.png" |
279 | /> | 285 | /> |
280 | <span>Delete</span> | 286 | <span>Delete</span> |
281 | </v-tooltip> | 287 | </v-tooltip> |
282 | </span> | 288 | </span> |
283 | </td> | 289 | </td> |
284 | </tr> | 290 | </tr> |
285 | </template> | 291 | </template> |
286 | <v-alert | 292 | <v-alert |
287 | slot="no-results" | 293 | slot="no-results" |
288 | :value="true" | 294 | :value="true" |
289 | color="error" | 295 | color="error" |
290 | icon="warning" | 296 | icon="warning" |
291 | >Your search for "{{ search }}" found no results.</v-alert> | 297 | >Your search for "{{ search }}" found no results.</v-alert> |
292 | </v-data-table> | 298 | </v-data-table> |
293 | <!-- ****** ADD MULTIPLE EVENT ****** --> | 299 | <!-- ****** ADD MULTIPLE EVENT ****** --> |
294 | <v-dialog v-model="meetEventDialog" max-width="500px" persistent> | 300 | <v-dialog v-model="meetEventDialog" max-width="500px" persistent v-if="meetEventDialog"> |
295 | <v-card flat class="card-style pa-2" dark> | 301 | <v-card flat class="card-style pa-2" dark> |
296 | <v-layout> | 302 | <v-layout> |
297 | <v-flex xs12> | 303 | <v-flex xs12> |
298 | <label class="title text-xs-center">Add Meeting Event</label> | 304 | <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> | 305 | <v-icon |
306 | size="24" | ||
307 | class="right" | ||
308 | @click="meetEventDialog = false; $refs.form.reset()" | ||
309 | >cancel</v-icon> | ||
300 | </v-flex> | 310 | </v-flex> |
301 | </v-layout> | 311 | </v-layout> |
302 | <v-form ref="form" v-model="valid" lazy-validation > | 312 | <v-form ref="form" v-model="valid" lazy-validation> |
303 | <v-container fluid> | 313 | <v-container fluid> |
304 | <v-flex xs12> | 314 | <v-flex xs12> |
305 | <v-layout> | 315 | <v-layout> |
306 | <v-flex xs4 class="pt-4 subheading"> | 316 | <v-flex xs4 class="pt-4 subheading"> |
307 | <label class="right">Title:</label> | 317 | <label class="right">Title:</label> |
308 | </v-flex> | 318 | </v-flex> |
309 | <v-flex xs8 sm8 class="ml-3"> | 319 | <v-flex xs8 sm8 class="ml-3"> |
310 | <v-text-field | 320 | <v-text-field |
311 | v-model="meetEvent.title" | 321 | v-model="meetEvent.title" |
312 | placeholder="fill your Title" | 322 | placeholder="fill your Title" |
313 | type="text" | 323 | type="text" |
314 | :rules="titleRules" | 324 | :rules="titleRules" |
315 | required | 325 | required |
316 | ></v-text-field> | 326 | ></v-text-field> |
317 | </v-flex> | 327 | </v-flex> |
318 | </v-layout> | 328 | </v-layout> |
319 | </v-flex> | 329 | </v-flex> |
320 | <v-flex xs12> | 330 | <v-flex xs12> |
321 | <v-layout> | 331 | <v-layout> |
322 | <v-flex xs4 class="pt-4 subheading"> | 332 | <v-flex xs4 class="pt-4 subheading"> |
323 | <label class="right">Date:</label> | 333 | <label class="right">Date:</label> |
324 | </v-flex> | 334 | </v-flex> |
325 | <v-flex xs8 sm8 class="ml-3"> | 335 | <v-flex xs8 sm8 class="ml-3"> |
326 | <v-menu | 336 | <v-menu |
327 | ref="menu1" | 337 | ref="menu1" |
328 | :close-on-content-click="false" | 338 | :close-on-content-click="false" |
329 | v-model="menu1" | 339 | v-model="menu1" |
330 | :nudge-right="40" | 340 | :nudge-right="40" |
331 | :return-value.sync="meetEvent.dateOfEvent" | 341 | :return-value.sync="meetEvent.dateOfEvent" |
332 | app | 342 | app |
333 | lazy | 343 | lazy |
334 | transition="scale-transition" | 344 | transition="scale-transition" |
335 | offset-y | 345 | offset-y |
336 | full-width | 346 | full-width |
337 | min-width="290px" | 347 | min-width="290px" |
338 | > | 348 | > |
339 | <v-text-field | 349 | <v-text-field |
340 | slot="activator" | 350 | slot="activator" |
341 | :rules="dateRules" | 351 | :rules="dateRules" |
342 | v-model="meetEvent.dateOfEvent" | 352 | v-model="meetEvent.dateOfEvent" |
343 | append-icon="event" | 353 | append-icon="event" |
344 | placeholder="Select date" | 354 | placeholder="Select date" |
345 | ></v-text-field> | 355 | ></v-text-field> |
346 | <v-date-picker | 356 | <v-date-picker |
347 | color="info" | 357 | color="info" |
348 | v-model="meetEvent.dateOfEvent" | 358 | v-model="meetEvent.dateOfEvent" |
349 | @input="$refs.menu1.save(meetEvent.dateOfEvent)" | 359 | @input="$refs.menu1.save(meetEvent.dateOfEvent)" |
350 | ></v-date-picker> | 360 | ></v-date-picker> |
351 | </v-menu> | 361 | </v-menu> |
352 | </v-flex> | 362 | </v-flex> |
353 | </v-layout> | 363 | </v-layout> |
354 | </v-flex> | 364 | </v-flex> |
355 | <v-flex xs12> | 365 | <v-flex xs12> |
356 | <v-layout> | 366 | <v-layout> |
357 | <v-flex xs4 class="pt-4 subheading"> | 367 | <v-flex xs4 class="pt-4 subheading"> |
358 | <label class="right">Start Time:</label> | 368 | <label class="right">Start Time:</label> |
359 | </v-flex> | 369 | </v-flex> |
360 | <v-flex xs8 sm8 class="ml-3"> | 370 | <v-flex xs8 sm8 class="ml-3"> |
361 | <v-menu | 371 | <v-menu |
362 | ref="menuA" | 372 | ref="menuA" |
363 | :close-on-content-click="false" | 373 | :close-on-content-click="false" |
364 | v-model="menu2" | 374 | v-model="menu2" |
365 | :nudge-right="40" | 375 | :nudge-right="40" |
366 | :return-value.sync="meetEvent.startTime" | 376 | :return-value.sync="meetEvent.startTime" |
367 | lazy | 377 | lazy |
368 | transition="scale-transition" | 378 | transition="scale-transition" |
369 | offset-y | 379 | offset-y |
370 | full-width | 380 | full-width |
371 | max-width="290px" | 381 | max-width="290px" |
372 | min-width="290px" | 382 | min-width="290px" |
373 | > | 383 | > |
374 | <v-text-field | 384 | <v-text-field |
375 | slot="activator" | 385 | slot="activator" |
376 | v-model="meetEvent.startTime" | 386 | v-model="meetEvent.startTime" |
377 | placeholder="Select Start time" | 387 | placeholder="Select Start time" |
378 | append-icon="access_time" | 388 | append-icon="access_time" |
379 | :rules="startTimeRules" | 389 | :rules="startTimeRules" |
380 | readonly | 390 | readonly |
381 | ></v-text-field> | 391 | ></v-text-field> |
382 | <v-time-picker | 392 | <v-time-picker |
383 | v-model="meetEvent.startTime" | 393 | v-model="meetEvent.startTime" |
384 | format="24hr" | 394 | format="24hr" |
385 | @change="$refs.menuA.save(meetEvent.startTime)" | 395 | @change="$refs.menuA.save(meetEvent.startTime)" |
386 | ></v-time-picker> | 396 | ></v-time-picker> |
387 | </v-menu> | 397 | </v-menu> |
388 | </v-flex> | 398 | </v-flex> |
389 | </v-layout> | 399 | </v-layout> |
390 | </v-flex> | 400 | </v-flex> |
391 | <v-flex xs12> | 401 | <v-flex xs12> |
392 | <v-layout> | 402 | <v-layout> |
393 | <v-flex xs4 class="pt-4 subheading"> | 403 | <v-flex xs4 class="pt-4 subheading"> |
394 | <label class="right">Type Of Event:</label> | 404 | <label class="right">Type Of Event:</label> |
395 | </v-flex> | 405 | </v-flex> |
396 | <v-flex xs8 sm8 class="ml-3"> | 406 | <v-flex xs8 sm8 class="ml-3"> |
397 | <v-select | 407 | <v-select |
398 | :items="typeOfEvent" | 408 | :items="typeOfEvent" |
399 | label="Select Type Of Event" | 409 | label="Select Type Of Event" |
400 | v-model="meetEvent.typeOfEvent" | 410 | v-model="meetEvent.typeOfEvent" |
401 | :rules="typeOfEventRules" | 411 | :rules="typeOfEventRules" |
402 | |||
403 | ></v-select> | 412 | ></v-select> |
404 | </v-flex> | 413 | </v-flex> |
405 | </v-layout> | 414 | </v-layout> |
406 | </v-flex> | 415 | </v-flex> |
407 | <v-flex xs12 v-show="meetEvent.typeOfEvent"> | 416 | <v-flex xs12 v-show="meetEvent.typeOfEvent"> |
408 | <v-layout> | 417 | <v-layout> |
409 | <v-flex xs4 class="pt-4 subheading"> | 418 | <v-flex xs4 class="pt-4 subheading"> |
410 | <label class="right">Class:</label> | 419 | <label class="right">Class:</label> |
411 | </v-flex> | 420 | </v-flex> |
412 | <v-flex xs8 sm8 class="ml-3"> | 421 | <v-flex xs8 sm8 class="ml-3"> |
413 | <v-select | 422 | <v-select |
414 | :items="addclass" | 423 | :items="addclass" |
415 | label="Select Class" | 424 | label="Select Class" |
416 | v-model="meetEvent.classId" | 425 | v-model="meetEvent.classId" |
417 | item-text="classNum" | 426 | item-text="classNum" |
418 | item-value="_id" | 427 | item-value="_id" |
419 | @change="getCourses(meetEvent.classId)" | 428 | @change="getCourses(meetEvent.classId)" |
420 | ></v-select> | 429 | ></v-select> |
421 | </v-flex> | 430 | </v-flex> |
422 | </v-layout> | 431 | </v-layout> |
423 | </v-flex> | 432 | </v-flex> |
424 | <v-flex xs12 v-show="meetEvent.typeOfEvent === 'Course'"> | 433 | <v-flex xs12 v-show="meetEvent.typeOfEvent === 'Course'"> |
425 | <v-layout> | 434 | <v-layout> |
426 | <v-flex xs4 class="pt-4 subheading"> | 435 | <v-flex xs4 class="pt-4 subheading"> |
427 | <label class="right">Courses:</label> | 436 | <label class="right">Courses:</label> |
428 | </v-flex> | 437 | </v-flex> |
429 | <v-flex xs8 sm8 class="ml-3"> | 438 | <v-flex xs8 sm8 class="ml-3"> |
430 | <v-select | 439 | <v-select |
431 | :items="courseData" | 440 | :items="courseData" |
432 | label="Select Course" | 441 | label="Select Course" |
433 | v-model="meetEvent.courseId" | 442 | v-model="meetEvent.courseId" |
434 | item-text="courseName" | 443 | item-text="courseName" |
435 | item-value="_id" | 444 | item-value="_id" |
436 | required | 445 | required |
437 | ></v-select> | 446 | ></v-select> |
438 | </v-flex> | 447 | </v-flex> |
439 | </v-layout> | 448 | </v-layout> |
440 | </v-flex> | 449 | </v-flex> |
441 | <v-flex xs12> | 450 | <v-flex xs12> |
442 | <v-layout> | 451 | <v-layout> |
443 | <v-flex xs4 class="pt-4 subheading"> | 452 | <v-flex xs4 class="pt-4 subheading"> |
444 | <label class="right">Duration</label> | 453 | <label class="right">Duration</label> |
445 | </v-flex> | 454 | </v-flex> |
446 | <v-flex xs8 sm8 class="ml-3"> | 455 | <v-flex xs8 sm8 class="ml-3"> |
447 | <v-text-field | 456 | <v-text-field |
448 | placeholder="fill your Description" | 457 | placeholder="fill your Description" |
449 | :rules="descriptionRules" | 458 | :rules="descriptionRules" |
450 | v-model="meetEvent.duration" | 459 | v-model="meetEvent.duration" |
451 | type="text" | 460 | type="text" |
452 | required | 461 | required |
453 | ></v-text-field> | 462 | ></v-text-field> |
454 | </v-flex> | 463 | </v-flex> |
455 | </v-layout> | 464 | </v-layout> |
456 | </v-flex> | 465 | </v-flex> |
457 | <v-layout> | 466 | <v-layout> |
458 | <v-flex xs12> | 467 | <v-flex xs12> |
459 | <v-layout class="right"> | 468 | <v-layout class="right"> |
460 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 469 | <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> | 470 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
462 | </v-layout> | 471 | </v-layout> |
463 | </v-flex> | 472 | </v-flex> |
464 | </v-layout> | 473 | </v-layout> |
465 | </v-container> | 474 | </v-container> |
466 | </v-form> | 475 | </v-form> |
467 | </v-card> | 476 | </v-card> |
468 | </v-dialog> | 477 | </v-dialog> |
469 | <v-snackbar | 478 | <v-snackbar |
470 | :timeout="timeout" | 479 | :timeout="timeout" |
471 | :top="y === 'top'" | 480 | :top="y === 'top'" |
472 | :right="x === 'right'" | 481 | :right="x === 'right'" |
473 | :vertical="mode === 'vertical'" | 482 | :vertical="mode === 'vertical'" |
474 | v-model="snackbar" | 483 | v-model="snackbar" |
475 | :color="color" | 484 | :color="color" |
476 | >{{ text }}</v-snackbar> | 485 | >{{ text }}</v-snackbar> |
477 | <div class="loader" v-if="showLoader"> | 486 | <div class="loader" v-if="showLoader"> |
478 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 487 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
479 | </div> | 488 | </div> |
480 | </v-container> | 489 | </v-container> |
481 | </template> | 490 | </template> |
482 | 491 | ||
483 | <script> | 492 | <script> |
484 | import http from "@/Services/http.js"; | 493 | import http from "@/Services/http.js"; |
485 | import moment from "moment"; | 494 | import moment from "moment"; |
486 | 495 | ||
487 | export default { | 496 | export default { |
488 | data: () => ({ | 497 | data: () => ({ |
489 | snackbar: false, | 498 | snackbar: false, |
490 | y: "top", | 499 | y: "top", |
491 | x: "right", | 500 | x: "right", |
492 | mode: "", | 501 | mode: "", |
493 | timeout: 5000, | 502 | timeout: 5000, |
494 | text: "", | 503 | text: "", |
495 | color: "", | 504 | color: "", |
496 | loading: false, | 505 | loading: false, |
497 | date: null, | 506 | date: null, |
498 | search: "", | 507 | search: "", |
499 | color: "", | 508 | color: "", |
500 | show: true, | 509 | show: true, |
501 | meetEventDialog: false, | 510 | meetEventDialog: false, |
502 | showSearch: false, | 511 | showSearch: false, |
503 | showLoader: false, | 512 | showLoader: false, |
504 | editEventdialog: false, | 513 | editEventdialog: false, |
505 | viewEventdialog: false, | 514 | viewEventdialog: false, |
506 | valid: true, | 515 | valid: true, |
507 | addclass: [], | 516 | addclass: [], |
508 | courseData: [], | 517 | courseData: [], |
509 | pagination: { | 518 | pagination: { |
510 | rowsPerPage: 10 | 519 | rowsPerPage: 10, |
511 | }, | 520 | }, |
512 | date: null, | 521 | date: null, |
513 | menu1: false, | 522 | menu1: false, |
514 | menu: false, | 523 | menu: false, |
515 | menuEditTime: false, | 524 | menuEditTime: false, |
516 | menuEditDate: false, | 525 | menuEditDate: false, |
517 | titleRules: [v => !!v || " Tilte is required"], | 526 | titleRules: [(v) => !!v || " Tilte is required"], |
518 | descriptionRules: [v => !!v || " Discription is required"], | 527 | descriptionRules: [(v) => !!v || " Discription is required"], |
519 | dateRules: [v => !!v || "Date of event is required"], | 528 | dateRules: [(v) => !!v || "Date of event is required"], |
520 | startTimeRules: [v => !!v || "Start Time is required"], | 529 | startTimeRules: [(v) => !!v || "Start Time is required"], |
521 | typeOfEventRules: [v => !!v || "Type of event is required"], | 530 | typeOfEventRules: [(v) => !!v || "Type of event is required"], |
522 | headers: [ | 531 | headers: [ |
523 | { | 532 | { |
524 | text: "No", | 533 | text: "No", |
525 | align: "", | 534 | align: "", |
526 | sortable: false, | 535 | sortable: false, |
527 | value: "No" | 536 | value: "No", |
528 | }, | 537 | }, |
529 | { | 538 | { |
530 | text: "Class", | 539 | text: "Class", |
531 | value: "classNum", | 540 | value: "classNum", |
532 | sortable: false, | 541 | sortable: false, |
533 | align: "center" | 542 | align: "center", |
534 | }, | 543 | }, |
535 | { text: "Title", value: "title", sortable: false, align: "center" }, | 544 | { text: "Title", value: "title", sortable: false, align: "center" }, |
536 | { | 545 | { |
537 | text: "Date Of Event", | 546 | text: "Date Of Event", |
538 | value: "dateOfEvent", | 547 | value: "dateOfEvent", |
539 | sortable: false, | 548 | sortable: false, |
540 | align: "center" | 549 | align: "center", |
541 | }, | 550 | }, |
542 | { | 551 | { |
543 | text: "Start Time", | 552 | text: "Start Time", |
544 | value: "startTime", | 553 | value: "startTime", |
545 | sortable: false, | 554 | sortable: false, |
546 | align: "center" | 555 | align: "center", |
547 | }, | 556 | }, |
548 | { text: "Action", value: "", sortable: false, align: "center" } | 557 | { text: "Action", value: "", sortable: false, align: "center" }, |
549 | ], | 558 | ], |
550 | events: [], | 559 | events: [], |
551 | typeOfEvent: ["Class", "Course"], | 560 | typeOfEvent: ["Class", "Course"], |
552 | editedIndex: -1, | 561 | editedIndex: -1, |
553 | meetEvent: { | 562 | meetEvent: { |
554 | startTime: null | 563 | startTime: null, |
555 | }, | 564 | }, |
556 | editedItem: {}, | 565 | editedItem: {}, |
557 | menu1: false, | 566 | menu1: false, |
558 | menu2: false, | 567 | menu2: false, |
559 | loginId: "" | 568 | loginId: "", |
560 | }), | 569 | }), |
570 | watch: { | ||
571 | meetEventDialog: function (val) { | ||
572 | if (!val) { | ||
573 | this.meetEvent = []; | ||
574 | } | ||
575 | }, | ||
576 | }, | ||
561 | methods: { | 577 | methods: { |
562 | dates: function(date) { | 578 | dates: function (date) { |
563 | return moment(date).format("MMMM DD, YYYY"); | 579 | return moment(date).format("MMMM DD, YYYY"); |
564 | }, | 580 | }, |
565 | getEvents() { | 581 | getEvents() { |
566 | this.showLoader = true; | 582 | this.showLoader = true; |
567 | var token = this.$store.state.token; | 583 | var token = this.$store.state.token; |
568 | http() | 584 | http() |
569 | .get("/getMeetingEventesList", { | 585 | .get("/getMeetingEventesList", { |
570 | params: { teacherId: this.loginId }, | 586 | params: { teacherId: this.loginId }, |
571 | headers: { Authorization: "Bearer " + token } | 587 | headers: { Authorization: "Bearer " + token }, |
572 | }) | 588 | }) |
573 | .then(response => { | 589 | .then((response) => { |
574 | this.events = response.data.data; | 590 | this.events = response.data.data; |
575 | this.showLoader = false; | 591 | this.showLoader = false; |
576 | }) | 592 | }) |
577 | .catch(error => { | 593 | .catch((error) => { |
578 | // console.log("err====>", err); | 594 | // console.log("err====>", err); |
579 | this.showLoader = false; | 595 | this.showLoader = false; |
580 | if (error.response.status === 401) { | 596 | if (error.response.status === 401) { |
581 | this.$router.replace({ path: "/" }); | 597 | this.$router.replace({ path: "/" }); |
582 | this.$store.dispatch("setToken", null); | 598 | this.$store.dispatch("setToken", null); |
583 | this.$store.dispatch("Id", null); | 599 | this.$store.dispatch("Id", null); |
584 | } | 600 | } |
585 | }); | 601 | }); |
586 | }, | 602 | }, |
587 | editItem(item) { | 603 | editItem(item) { |
588 | this.editedIndex = this.events.indexOf(item); | 604 | this.editedIndex = this.events.indexOf(item); |
589 | this.editedItem = Object.assign({}, item); | 605 | this.editedItem = Object.assign({}, item); |
590 | this.editedItem.meetingEventId = item._id; | 606 | this.editedItem.meetingEventId = item._id; |
591 | this.editedItem.startTime = moment(this.editedItem.startTime, ["h:mm A"]).format("HH:mm"); | 607 | this.editedItem.startTime = moment(this.editedItem.startTime, [ |
608 | "h:mm A", | ||
609 | ]).format("HH:mm"); | ||
592 | this.editEventdialog = true; | 610 | this.editEventdialog = true; |
593 | }, | 611 | }, |
594 | profile(item) { | 612 | profile(item) { |
595 | this.editedIndex = this.events.indexOf(item); | 613 | this.editedIndex = this.events.indexOf(item); |
596 | this.editedItem = Object.assign({}, item); | 614 | this.editedItem = Object.assign({}, item); |
597 | this.viewEventdialog = true; | 615 | this.viewEventdialog = true; |
598 | }, | 616 | }, |
599 | 617 | ||
600 | deleteItem(item) { | 618 | deleteItem(item) { |
601 | let deleteEvent = { | 619 | let deleteEvent = { |
602 | meetingEventId: item._id | 620 | meetingEventId: item._id, |
603 | }; | 621 | }; |
604 | http() | 622 | http() |
605 | .delete( | 623 | .delete( |
606 | "/deleteMeetingEvent", | 624 | "/deleteMeetingEvent", |
607 | confirm("Are you sure you want to delete this?") && { | 625 | confirm("Are you sure you want to delete this?") && { |
608 | params: deleteEvent | 626 | params: deleteEvent, |
609 | } | 627 | } |
610 | ) | 628 | ) |
611 | .then(response => { | 629 | .then((response) => { |
612 | this.snackbar = true; | 630 | this.snackbar = true; |
613 | this.text = response.data.message; | 631 | this.text = response.data.message; |
614 | this.getEvents(); | 632 | this.getEvents(); |
615 | this.snackbar = true; | 633 | this.snackbar = true; |
616 | this.color = "green"; | 634 | this.color = "green"; |
617 | this.text = response.data.message; | 635 | this.text = response.data.message; |
618 | }) | 636 | }) |
619 | .catch(error => { | 637 | .catch((error) => { |
620 | this.snackbar = true; | 638 | this.snackbar = true; |
621 | this.text = error.response.data.message; | 639 | this.text = error.response.data.message; |
622 | this.color = "error"; | 640 | this.color = "error"; |
623 | this.loading = false; | 641 | this.loading = false; |
624 | }); | 642 | }); |
625 | }, | 643 | }, |
626 | getAllClass() { | 644 | getAllClass() { |
627 | http() | 645 | http() |
628 | .get("/getClassesList") | 646 | .get("/getClassesList") |
629 | .then(response => { | 647 | .then((response) => { |
630 | this.addclass = response.data.data; | 648 | this.addclass = response.data.data; |
631 | }) | 649 | }) |
632 | .catch(error => { | 650 | .catch((error) => { |
633 | // console.log("err====>", err); | 651 | // console.log("err====>", err); |
634 | // this.$router.replace({ path: "/" }); | 652 | // this.$router.replace({ path: "/" }); |
635 | }); | 653 | }); |
636 | }, | 654 | }, |
637 | getCourses(classId) { | 655 | getCourses(classId) { |
638 | this.showLoader = true; | 656 | this.showLoader = true; |
639 | http() | 657 | http() |
640 | .get("/getCourseesList", { | 658 | .get("/getCourseesList", { |
641 | params: { | 659 | params: { |
642 | classId: classId | 660 | classId: classId, |
643 | } | 661 | }, |
644 | }) | 662 | }) |
645 | .then(response => { | 663 | .then((response) => { |
646 | this.courseData = response.data.data; | 664 | this.courseData = response.data.data; |
647 | this.showLoader = false; | 665 | this.showLoader = false; |
648 | }) | 666 | }) |
649 | .catch(err => { | 667 | .catch((err) => { |
650 | console.log("err====>", err); | 668 | console.log("err====>", err); |
651 | this.showLoader = false; | 669 | this.showLoader = false; |
652 | }); | 670 | }); |
653 | }, | 671 | }, |
654 | close() { | 672 | close() { |
655 | this.editEventdialog = false; | 673 | this.editEventdialog = false; |
656 | }, | 674 | }, |
657 | submit() { | 675 | submit() { |
658 | if (this.$refs.form.validate()) { | 676 | if (this.$refs.form.validate()) { |
659 | this.loading = true; | 677 | this.loading = true; |
660 | this.meetEvent.startTime = moment(this.meetEvent.startTime, "hh:mm").format("LT"); | 678 | this.meetEvent.startTime = moment( |
679 | this.meetEvent.startTime, | ||
680 | "hh:mm" | ||
681 | ).format("LT"); | ||
661 | http() | 682 | http() |
662 | .post("/createMeetingEvent", this.meetEvent) | 683 | .post("/createMeetingEvent", this.meetEvent) |
663 | .then(response => { | 684 | .then((response) => { |
664 | this.snackbar = true; | 685 | this.snackbar = true; |
665 | this.text = response.data.message; | 686 | this.text = response.data.message; |
666 | this.color = "green"; | 687 | this.color = "green"; |
667 | this.getEvents(); | 688 | this.getEvents(); |
668 | this.clear(); | 689 | this.clear(); |
669 | this.loading = false; | 690 | this.loading = false; |
670 | this.meetEventDialog = false; | 691 | this.meetEventDialog = false; |
671 | }) | 692 | }) |
672 | .catch(error => { | 693 | .catch((error) => { |
673 | this.snackbar = true; | 694 | this.snackbar = true; |
674 | this.text = error.response.data.message; | 695 | this.text = error.response.data.message; |
675 | this.color = "error"; | 696 | this.color = "error"; |
676 | this.loading = false; | 697 | this.loading = false; |
677 | }); | 698 | }); |
678 | } | 699 | } |
679 | }, | 700 | }, |
680 | clear() { | 701 | clear() { |
681 | this.$refs.form.reset(); | 702 | this.$refs.form.reset(); |
682 | }, | 703 | }, |
683 | save() { | 704 | save() { |
684 | console.log('=======this.editedItem=====', this.editedItem); | 705 | console.log("=======this.editedItem=====", this.editedItem); |
685 | if (this.editedItem.courseId) { | 706 | if (this.editedItem.courseId) { |
686 | this.editedItem.courseId = this.editedItem.courseId._id; | 707 | this.editedItem.courseId = this.editedItem.courseId._id; |
687 | } | 708 | } |
688 | delete this.editedItem.classId; | 709 | delete this.editedItem.classId; |
689 | 710 | ||
690 | this.editedItem.startTime = moment(this.editedItem.startTime, "hh:mm").format("LT"); | 711 | this.editedItem.startTime = moment( |
712 | this.editedItem.startTime, | ||
713 | "hh:mm" | ||
714 | ).format("LT"); | ||
691 | http() | 715 | http() |
692 | .put("/updateMeetingEvent", this.editedItem) | 716 | .put("/updateMeetingEvent", this.editedItem) |
693 | .then(response => { | 717 | .then((response) => { |
694 | this.snackbar = true; | 718 | this.snackbar = true; |
695 | this.text = response.data.message; | 719 | this.text = response.data.message; |
696 | this.color = "green"; | 720 | this.color = "green"; |
697 | this.getEvents(); | 721 | this.getEvents(); |
698 | this.close(); | 722 | this.close(); |
699 | }) | 723 | }) |
700 | .catch(error => { | 724 | .catch((error) => { |
701 | this.snackbar = true; | 725 | this.snackbar = true; |
702 | this.text = error.response.data.message; | 726 | this.text = error.response.data.message; |
703 | this.color = "error"; | 727 | this.color = "error"; |
704 | }); | 728 | }); |
705 | }, | 729 | }, |
706 | displaySearch() { | 730 | displaySearch() { |
707 | (this.show = false), (this.showSearch = true); | 731 | (this.show = false), (this.showSearch = true); |
708 | }, | 732 | }, |
709 | closeSearch() { | 733 | closeSearch() { |
710 | this.showSearch = false; | 734 | this.showSearch = false; |
711 | this.show = true; | 735 | this.show = true; |
712 | this.search = ""; | 736 | this.search = ""; |
713 | } | 737 | }, |
714 | }, | 738 | }, |
715 | mounted() { | 739 | mounted() { |
716 | this.loginId = this.$store.state.id; | 740 | this.loginId = this.$store.state.id; |
717 | this.getEvents(); | 741 | this.getEvents(); |
718 | this.getAllClass(); | 742 | this.getAllClass(); |
719 | } | 743 | }, |
720 | }; | 744 | }; |
src/pages/socialMedia/socialMedia.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid class="body-color"> | 2 | <v-container fluid class="body-color"> |
3 | <!-- ****** EDIT Social Media ****** --> | 3 | <!-- ****** EDIT Social Media ****** --> |
4 | <v-dialog v-model="editSocialMediaDialog" max-width="400px"> | 4 | <v-dialog v-model="editSocialMediaDialog" 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 Social Media</label> | 8 | <label class="title text-xs-center">Edit Social Media</label> |
9 | <v-icon size="24" class="right" @click="editSocialMediaDialog = false">cancel</v-icon> | 9 | <v-icon size="24" class="right" @click="editSocialMediaDialog = false">cancel</v-icon> |
10 | </v-flex> | 10 | </v-flex> |
11 | </v-layout> | 11 | </v-layout> |
12 | <v-form ref="form"> | 12 | <v-form ref="form"> |
13 | <v-container fluid> | 13 | <v-container fluid> |
14 | <v-flex xs12 sm12> | 14 | <v-flex xs12 sm12> |
15 | <v-layout> | 15 | <v-layout> |
16 | <v-flex xs4 class="pt-4 subheading"> | 16 | <v-flex xs4 class="pt-4 subheading"> |
17 | <label class="right">Type:</label> | 17 | <label class="right">Type:</label> |
18 | </v-flex> | 18 | </v-flex> |
19 | <v-flex xs8 sm8 class="ml-3"> | 19 | <v-flex xs8 sm8 class="ml-3"> |
20 | <v-select | 20 | <v-select |
21 | v-model="editedItem.type" | 21 | v-model="editedItem.type" |
22 | placeholder="fill your Title" | 22 | placeholder="fill your Title" |
23 | :items="socialLink" | 23 | :items="socialLink" |
24 | item-text="name" | 24 | item-text="name" |
25 | item-value="value" | 25 | item-value="value" |
26 | ></v-select> | 26 | ></v-select> |
27 | </v-flex> | 27 | </v-flex> |
28 | </v-layout> | 28 | </v-layout> |
29 | </v-flex> | 29 | </v-flex> |
30 | <v-flex xs12 sm12> | 30 | <v-flex xs12 sm12> |
31 | <v-layout> | 31 | <v-layout> |
32 | <v-flex xs4 class="pt-4 subheading"> | 32 | <v-flex xs4 class="pt-4 subheading"> |
33 | <label class="right">Url lINK:</label> | 33 | <label class="right">Url lINK:</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-text-field placeholder="fill your Description" v-model="editedItem.linkUrl"></v-text-field> | 36 | <v-text-field placeholder="fill your Description" v-model="editedItem.linkUrl"></v-text-field> |
37 | </v-flex> | 37 | </v-flex> |
38 | </v-layout> | 38 | </v-layout> |
39 | </v-flex> | 39 | </v-flex> |
40 | <v-layout> | 40 | <v-layout> |
41 | <v-flex xs12 sm12> | 41 | <v-flex xs12 sm12> |
42 | <v-card-actions> | 42 | <v-card-actions> |
43 | <v-spacer></v-spacer> | 43 | <v-spacer></v-spacer> |
44 | <v-btn round dark @click="save" class="add-button">Save</v-btn> | 44 | <v-btn round dark @click="save" class="add-button">Save</v-btn> |
45 | <v-spacer></v-spacer> | 45 | <v-spacer></v-spacer> |
46 | </v-card-actions> | 46 | </v-card-actions> |
47 | </v-flex> | 47 | </v-flex> |
48 | </v-layout> | 48 | </v-layout> |
49 | </v-container> | 49 | </v-container> |
50 | </v-form> | 50 | </v-form> |
51 | </v-card> | 51 | </v-card> |
52 | </v-dialog> | 52 | </v-dialog> |
53 | 53 | ||
54 | <!-- ****** PROFILE VIEW Social ****** --> | 54 | <!-- ****** PROFILE VIEW Social ****** --> |
55 | 55 | ||
56 | <v-dialog v-model="profileSocialMediaDialog" max-width="500px"> | 56 | <v-dialog v-model="profileSocialMediaDialog" max-width="500px"> |
57 | <v-card flat class="card-style pa-3" dark> | 57 | <v-card flat class="card-style pa-3" dark> |
58 | <v-layout> | 58 | <v-layout> |
59 | <v-flex xs12> | 59 | <v-flex xs12> |
60 | <label class="title text-xs-center">View Social Media</label> | 60 | <label class="title text-xs-center">View Social Media</label> |
61 | <v-icon size="24" class="right" @click="profileSocialMediaDialog = false">cancel</v-icon> | 61 | <v-icon size="24" class="right" @click="profileSocialMediaDialog = false">cancel</v-icon> |
62 | </v-flex> | 62 | </v-flex> |
63 | </v-layout> | 63 | </v-layout> |
64 | <v-card-text> | 64 | <v-card-text> |
65 | <v-container grid-list-md> | 65 | <v-container grid-list-md> |
66 | <v-layout> | 66 | <v-layout> |
67 | <v-flex xs4 sm6> | 67 | <v-flex xs4 sm6> |
68 | <h5 class="right my-1"> | 68 | <h5 class="right my-1"> |
69 | <b>Title:</b> | 69 | <b>Title:</b> |
70 | </h5> | 70 | </h5> |
71 | </v-flex> | 71 | </v-flex> |
72 | <v-flex sm6 xs8> | 72 | <v-flex sm6 xs8> |
73 | <h5 class="my-1">{{ editedItem.type }}</h5> | 73 | <h5 class="my-1">{{ editedItem.type }}</h5> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | <v-layout> | 76 | <v-layout> |
77 | <v-flex xs5 sm6> | 77 | <v-flex xs5 sm6> |
78 | <h5 class="right my-1"> | 78 | <h5 class="right my-1"> |
79 | <b>Description:</b> | 79 | <b>Description:</b> |
80 | </h5> | 80 | </h5> |
81 | </v-flex> | 81 | </v-flex> |
82 | <v-flex sm6 xs8> | 82 | <v-flex sm6 xs8> |
83 | <h5 class="my-1 linkCover">{{ editedItem.linkUrl }}</h5> | 83 | <h5 class="my-1 linkCover">{{ editedItem.linkUrl }}</h5> |
84 | </v-flex> | 84 | </v-flex> |
85 | </v-layout> | 85 | </v-layout> |
86 | </v-container> | 86 | </v-container> |
87 | </v-card-text> | 87 | </v-card-text> |
88 | </v-card> | 88 | </v-card> |
89 | </v-dialog> | 89 | </v-dialog> |
90 | <!-- ****** Social TABLE ****** --> | 90 | <!-- ****** Social TABLE ****** --> |
91 | <v-toolbar color="transparent" flat> | 91 | <v-toolbar color="transparent" flat> |
92 | <v-btn | 92 | <v-btn |
93 | fab | 93 | fab |
94 | dark | 94 | dark |
95 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | 95 | class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" |
96 | small | 96 | small |
97 | @click="addSocialMediaDialog = true" | 97 | @click="addSocialMediaDialog = true" |
98 | > | 98 | > |
99 | <v-icon dark>add</v-icon> | 99 | <v-icon dark>add</v-icon> |
100 | </v-btn> | 100 | </v-btn> |
101 | <v-btn | 101 | <v-btn |
102 | round | 102 | round |
103 | class="open-dialog-button hidden-sm-only hidden-xs-only" | 103 | class="open-dialog-button hidden-sm-only hidden-xs-only" |
104 | dark | 104 | dark |
105 | @click="addSocialMediaDialog = true" | 105 | @click="addSocialMediaDialog = true" |
106 | > | 106 | > |
107 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Social Media | 107 | <v-icon class="white--text pr-1" size="20">add</v-icon>Add Social Media |
108 | </v-btn> | 108 | </v-btn> |
109 | <v-spacer></v-spacer> | 109 | <v-spacer></v-spacer> |
110 | <v-card-title class="body-1" v-show="show"> | 110 | <v-card-title class="body-1" v-show="show"> |
111 | <v-btn icon large flat @click="displaySearch"> | 111 | <v-btn icon large flat @click="displaySearch"> |
112 | <v-avatar size="27"> | 112 | <v-avatar size="27"> |
113 | <img src="/static/icon/search.png" alt="icon" /> | 113 | <img src="/static/icon/search.png" alt="icon" /> |
114 | </v-avatar> | 114 | </v-avatar> |
115 | </v-btn> | 115 | </v-btn> |
116 | </v-card-title> | 116 | </v-card-title> |
117 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> | 117 | <v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
118 | <v-layout> | 118 | <v-layout> |
119 | <v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | 119 | <v-text-field |
120 | autofocus | ||
121 | v-model="search" | ||
122 | label="Search" | ||
123 | prepend-inner-icon="search" | ||
124 | color="primary" | ||
125 | ></v-text-field> | ||
120 | <v-icon @click="closeSearch" color="error">close</v-icon> | 126 | <v-icon @click="closeSearch" color="error">close</v-icon> |
121 | </v-layout> | 127 | </v-layout> |
122 | </v-flex> | 128 | </v-flex> |
123 | </v-toolbar> | 129 | </v-toolbar> |
124 | <v-data-table | 130 | <v-data-table |
125 | :headers="headers" | 131 | :headers="headers" |
126 | :items="desserts" | 132 | :items="desserts" |
127 | :pagination.sync="pagination" | 133 | :pagination.sync="pagination" |
128 | :search="search" | 134 | :search="search" |
129 | > | 135 | > |
130 | <template slot="items" slot-scope="props"> | 136 | <template slot="items" slot-scope="props"> |
131 | <tr class="tr"> | 137 | <tr class="tr"> |
132 | <td class="td td-row">{{ props.index + 1}}</td> | 138 | <td class="td td-row">{{ props.index + 1}}</td> |
133 | <td class="td td-row text-xs-center">{{ props.item.type}}</td> | 139 | <td class="td td-row text-xs-center">{{ props.item.type}}</td> |
134 | <td class="td td-row text-xs-center linkCover">{{ props.item.linkUrl}}</td> | 140 | <td class="td td-row text-xs-center linkCover">{{ props.item.linkUrl}}</td> |
135 | <td class="td td-row text-xs-center"> | 141 | <td class="td td-row text-xs-center"> |
136 | <span> | 142 | <span> |
137 | <v-tooltip top> | 143 | <v-tooltip top> |
138 | <img | 144 | <img |
139 | slot="activator" | 145 | slot="activator" |
140 | style="cursor:pointer; width:25px; height:25px; " | 146 | style="cursor:pointer; width:25px; height:25px; " |
141 | class="mr-3" | 147 | class="mr-3" |
142 | @click="profile(props.item)" | 148 | @click="profile(props.item)" |
143 | src="/static/icon/view.png" | 149 | src="/static/icon/view.png" |
144 | /> | 150 | /> |
145 | <span>View</span> | 151 | <span>View</span> |
146 | </v-tooltip> | 152 | </v-tooltip> |
147 | <v-tooltip top> | 153 | <v-tooltip top> |
148 | <img | 154 | <img |
149 | slot="activator" | 155 | slot="activator" |
150 | style="cursor:pointer; width:20 px; height:18px; " | 156 | style="cursor:pointer; width:20 px; height:18px; " |
151 | class="mr-3" | 157 | class="mr-3" |
152 | @click="editItem(props.item)" | 158 | @click="editItem(props.item)" |
153 | src="/static/icon/edit.png" | 159 | src="/static/icon/edit.png" |
154 | /> | 160 | /> |
155 | <span>Edit</span> | 161 | <span>Edit</span> |
156 | </v-tooltip> | 162 | </v-tooltip> |
157 | <v-tooltip top> | 163 | <v-tooltip top> |
158 | <img | 164 | <img |
159 | slot="activator" | 165 | slot="activator" |
160 | style="cursor:pointer; width:20px; height:20px; " | 166 | style="cursor:pointer; width:20px; height:20px; " |
161 | class="mr-3" | 167 | class="mr-3" |
162 | @click="deleteItem(props.item)" | 168 | @click="deleteItem(props.item)" |
163 | src="/static/icon/delete.png" | 169 | src="/static/icon/delete.png" |
164 | /> | 170 | /> |
165 | <span>Delete</span> | 171 | <span>Delete</span> |
166 | </v-tooltip> | 172 | </v-tooltip> |
167 | </span> | 173 | </span> |
168 | </td> | 174 | </td> |
169 | </tr> | 175 | </tr> |
170 | </template> | 176 | </template> |
171 | <v-alert | 177 | <v-alert |
172 | slot="no-results" | 178 | slot="no-results" |
173 | :value="true" | 179 | :value="true" |
174 | color="error" | 180 | color="error" |
175 | icon="warning" | 181 | icon="warning" |
176 | >Your search for "{{ search }}" found no results.</v-alert> | 182 | >Your search for "{{ search }}" found no results.</v-alert> |
177 | </v-data-table> | 183 | </v-data-table> |
178 | <!-- ****** ADD MULTIPLE REMINDER ****** --> | 184 | <!-- ****** ADD MULTIPLE REMINDER ****** --> |
179 | <v-dialog v-model="addSocialMediaDialog" max-width="400px"> | 185 | <v-dialog v-model="addSocialMediaDialog" max-width="400px" v-if="addSocialMediaDialog"> |
180 | <v-card flat class="card-style pa-2" dark> | 186 | <v-card flat class="card-style pa-2" dark> |
181 | <v-layout> | 187 | <v-layout> |
182 | <v-flex xs12> | 188 | <v-flex xs12> |
183 | <label class="title text-xs-center">Add Social Media</label> | 189 | <label class="title text-xs-center">Add Social Media</label> |
184 | <v-icon size="24" class="right" @click="addSocialMediaDialog = false">cancel</v-icon> | 190 | <v-icon size="24" class="right" @click="closeAddSocialMediaModel">cancel</v-icon> |
185 | </v-flex> | 191 | </v-flex> |
186 | </v-layout> | 192 | </v-layout> |
187 | <v-form ref="form" v-model="valid" lazy-validation> | 193 | <v-form ref="form" v-model="valid" lazy-validation> |
188 | <v-container fluid> | 194 | <v-container fluid> |
189 | <v-flex xs12> | 195 | <v-flex xs12> |
190 | <v-layout> | 196 | <v-layout> |
191 | <v-flex xs4 class="pt-4 subheading"> | 197 | <v-flex xs4 class="pt-4 subheading"> |
192 | <label class="right">Type:</label> | 198 | <label class="right">Type:</label> |
193 | </v-flex> | 199 | </v-flex> |
194 | <v-flex xs8 sm8 class="ml-3"> | 200 | <v-flex xs8 sm8 class="ml-3"> |
195 | <v-select | 201 | <v-select |
196 | v-model="socialMedia.type" | 202 | v-model="socialMedia.type" |
197 | :items="socialLink" | 203 | :items="socialLink" |
198 | item-text="name" | 204 | item-text="name" |
199 | item-value="value" | 205 | item-value="value" |
200 | label="Selct Type" | 206 | label="Selct Type" |
201 | type="text" | 207 | type="text" |
202 | :rules="socialRules" | 208 | :rules="socialRules" |
203 | required | 209 | required |
204 | ></v-select> | 210 | ></v-select> |
205 | </v-flex> | 211 | </v-flex> |
206 | </v-layout> | 212 | </v-layout> |
207 | </v-flex> | 213 | </v-flex> |
208 | <v-flex xs12> | 214 | <v-flex xs12> |
209 | <v-layout> | 215 | <v-layout> |
210 | <v-flex xs4 class="pt-4 subheading"> | 216 | <v-flex xs4 class="pt-4 subheading"> |
211 | <label class="right">Link Url:</label> | 217 | <label class="right">Link Url:</label> |
212 | </v-flex> | 218 | </v-flex> |
213 | <v-flex xs8 sm8 class="ml-3"> | 219 | <v-flex xs8 sm8 class="ml-3"> |
214 | <v-text-field | 220 | <v-text-field |
215 | placeholder="fill your link url" | 221 | placeholder="fill your link url" |
216 | :rules="linkUrlnRules" | 222 | :rules="linkUrlnRules" |
217 | v-model="socialMedia.linkUrl" | 223 | v-model="socialMedia.linkUrl" |
218 | type="text" | 224 | type="text" |
219 | required | 225 | required |
220 | ></v-text-field> | 226 | ></v-text-field> |
221 | </v-flex> | 227 | </v-flex> |
222 | </v-layout> | 228 | </v-layout> |
223 | </v-flex> | 229 | </v-flex> |
224 | <v-layout> | 230 | <v-layout> |
225 | <v-flex xs12 sm12> | 231 | <v-flex xs12 sm12> |
226 | <v-card-actions> | 232 | <v-card-actions> |
227 | <v-spacer></v-spacer> | 233 | <v-spacer></v-spacer> |
228 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> | 234 | <v-btn @click="clear" round class="clear-button" dark>clear</v-btn> |
229 | <v-spacer></v-spacer> | 235 | <v-spacer></v-spacer> |
230 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> | 236 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
231 | </v-card-actions> | 237 | </v-card-actions> |
232 | </v-flex> | 238 | </v-flex> |
233 | </v-layout> | 239 | </v-layout> |
234 | </v-container> | 240 | </v-container> |
235 | </v-form> | 241 | </v-form> |
236 | </v-card> | 242 | </v-card> |
237 | </v-dialog> | 243 | </v-dialog> |
238 | <v-snackbar | 244 | <v-snackbar |
239 | :timeout="timeout" | 245 | :timeout="timeout" |
240 | :top="y === 'top'" | 246 | :top="y === 'top'" |
241 | :right="x === 'right'" | 247 | :right="x === 'right'" |
242 | :vertical="mode === 'vertical'" | 248 | :vertical="mode === 'vertical'" |
243 | v-model="snackbar" | 249 | v-model="snackbar" |
244 | :color="color" | 250 | :color="color" |
245 | >{{ text }}</v-snackbar> | 251 | >{{ text }}</v-snackbar> |
246 | <div class="loader" v-if="showLoader"> | 252 | <div class="loader" v-if="showLoader"> |
247 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 253 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
248 | </div> | 254 | </div> |
249 | </v-container> | 255 | </v-container> |
250 | </template> | 256 | </template> |
251 | 257 | ||
252 | <script> | 258 | <script> |
253 | import http from "@/Services/http.js"; | 259 | import http from "@/Services/http.js"; |
254 | 260 | ||
255 | export default { | 261 | export default { |
256 | data: () => ({ | 262 | data: () => ({ |
257 | snackbar: false, | 263 | snackbar: false, |
258 | y: "top", | 264 | y: "top", |
259 | x: "right", | 265 | x: "right", |
260 | mode: "", | 266 | mode: "", |
261 | timeout: 3000, | 267 | timeout: 3000, |
262 | text: "", | 268 | text: "", |
263 | loading: false, | 269 | loading: false, |
264 | color: "", | 270 | color: "", |
265 | date: null, | 271 | date: null, |
266 | search: "", | 272 | search: "", |
267 | show: true, | 273 | show: true, |
268 | showSearch: false, | 274 | showSearch: false, |
269 | addSocialMediaDialog: false, | 275 | addSocialMediaDialog: false, |
270 | showLoader: false, | 276 | showLoader: false, |
271 | editSocialMediaDialog: false, | 277 | editSocialMediaDialog: false, |
272 | profileSocialMediaDialog: false, | 278 | profileSocialMediaDialog: false, |
273 | valid: true, | 279 | valid: true, |
274 | pagination: { | 280 | pagination: { |
275 | rowsPerPage: 10 | 281 | rowsPerPage: 10, |
276 | }, | 282 | }, |
277 | imageData: {}, | 283 | imageData: {}, |
278 | imageName: "", | 284 | imageName: "", |
279 | imageUrl: "", | 285 | imageUrl: "", |
280 | imageFile: "", | 286 | imageFile: "", |
281 | socialRules: [v => !!v || " Social media type is required"], | 287 | socialRules: [(v) => !!v || " Social media type is required"], |
282 | linkUrlnRules: [v => !!v || " Link Url is required"], | 288 | linkUrlnRules: [(v) => !!v || " Link Url is required"], |
283 | headers: [ | 289 | headers: [ |
284 | { | 290 | { |
285 | text: "No", | 291 | text: "No", |
286 | align: "", | 292 | align: "", |
287 | sortable: false, | 293 | sortable: false, |
288 | value: "No" | 294 | value: "No", |
289 | }, | 295 | }, |
290 | { text: "Type", value: "type", sortable: false, align: "center" }, | 296 | { text: "Type", value: "type", sortable: false, align: "center" }, |
291 | { | 297 | { |
292 | text: "Link Url", | 298 | text: "Link Url", |
293 | value: "linkUrl", | 299 | value: "linkUrl", |
294 | sortable: false, | 300 | sortable: false, |
295 | align: "center" | 301 | align: "center", |
296 | }, | 302 | }, |
297 | { text: "Action", value: "", sortable: false, align: "center" } | 303 | { text: "Action", value: "", sortable: false, align: "center" }, |
298 | ], | 304 | ], |
299 | desserts: [], | 305 | desserts: [], |
300 | editedIndex: -1, | 306 | editedIndex: -1, |
301 | socialMedia: {}, | 307 | socialMedia: {}, |
302 | editedItem: {}, | 308 | editedItem: {}, |
303 | socialLink: [ | 309 | socialLink: [ |
304 | { | 310 | { |
305 | name: "Face Book", | 311 | name: "Face Book", |
306 | value: "FACEBOOK" | 312 | value: "FACEBOOK", |
307 | }, | 313 | }, |
308 | { | 314 | { |
309 | name: "You Tube", | 315 | name: "You Tube", |
310 | value: "YOUTUBE" | 316 | value: "YOUTUBE", |
311 | } | 317 | }, |
312 | ], | 318 | ], |
313 | userName: "" | 319 | userName: "", |
314 | }), | 320 | }), |
321 | watch: { | ||
322 | addSocialMediaDialog: function (val) { | ||
323 | if (!val) { | ||
324 | this.socialMedia = []; | ||
325 | } | ||
326 | }, | ||
327 | }, | ||
315 | methods: { | 328 | methods: { |
316 | // pickFile() { | 329 | // pickFile() { |
317 | // this.$refs.image.click(); | 330 | // this.$refs.image.click(); |
318 | // }, | 331 | // }, |
319 | 332 | ||
320 | // onFilePicked(e) { | 333 | // onFilePicked(e) { |
321 | // // console.log(e) | 334 | // // console.log(e) |
322 | // const files = e.target.files; | 335 | // const files = e.target.files; |
323 | // this.imageData.upload = e.target.files[0]; | 336 | // this.imageData.upload = e.target.files[0]; |
324 | // if (files[0] !== undefined) { | 337 | // if (files[0] !== undefined) { |
325 | // this.imageName = files[0].name; | 338 | // this.imageName = files[0].name; |
326 | // if (this.imageName.lastIndexOf(".") <= 0) { | 339 | // if (this.imageName.lastIndexOf(".") <= 0) { |
327 | // return; | 340 | // return; |
328 | // } | 341 | // } |
329 | // const fr = new FileReader(); | 342 | // const fr = new FileReader(); |
330 | // fr.readAsDataURL(files[0]); | 343 | // fr.readAsDataURL(files[0]); |
331 | // fr.addEventListener("load", () => { | 344 | // fr.addEventListener("load", () => { |
332 | // this.imageUrl = fr.result; | 345 | // this.imageUrl = fr.result; |
333 | // this.imageFile = files[0]; // this is an image file that can be sent to server... | 346 | // this.imageFile = files[0]; // this is an image file that can be sent to server... |
334 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); | 347 | // this.imageData.imageUrl = URL.createObjectURL(this.imageFile); |
335 | // console.log("upload=======>", this.imageData.imageUrl); | 348 | // console.log("upload=======>", this.imageData.imageUrl); |
336 | // console.log("imageFile", this.imageFile); | 349 | // console.log("imageFile", this.imageFile); |
337 | // }); | 350 | // }); |
338 | // } else { | 351 | // } else { |
339 | // this.imageName = ""; | 352 | // this.imageName = ""; |
340 | // this.imageFile = ""; | 353 | // this.imageFile = ""; |
341 | // this.imageUrl = ""; | 354 | // this.imageUrl = ""; |
342 | // } | 355 | // } |
343 | // }, | 356 | // }, |
344 | getSocialMedia() { | 357 | getSocialMedia() { |
345 | this.showLoader = true; | 358 | this.showLoader = true; |
346 | var token = this.$store.state.token; | 359 | var token = this.$store.state.token; |
347 | http() | 360 | http() |
348 | .get("/getSocialList", { | 361 | .get("/getSocialList", { |
349 | headers: { Authorization: "Bearer " + token } | 362 | headers: { Authorization: "Bearer " + token }, |
350 | }) | 363 | }) |
351 | .then(response => { | 364 | .then((response) => { |
352 | this.desserts = response.data.data; | 365 | this.desserts = response.data.data; |
353 | this.showLoader = false; | 366 | this.showLoader = false; |
354 | }) | 367 | }) |
355 | .catch(error => { | 368 | .catch((error) => { |
356 | this.showLoader = false; | 369 | this.showLoader = false; |
357 | if (error.response.status === 401) { | 370 | if (error.response.status === 401) { |
358 | this.$router.replace({ path: "/" }); | 371 | this.$router.replace({ path: "/" }); |
359 | this.$store.dispatch("setToken", null); | 372 | this.$store.dispatch("setToken", null); |
360 | this.$store.dispatch("Id", null); | 373 | this.$store.dispatch("Id", null); |
361 | } | 374 | } |
362 | }); | 375 | }); |
363 | }, | 376 | }, |
364 | editItem(item) { | 377 | editItem(item) { |
365 | this.editedIndex = this.desserts.indexOf(item); | 378 | this.editedIndex = this.desserts.indexOf(item); |
366 | this.editedItem = Object.assign({}, item); | 379 | this.editedItem = Object.assign({}, item); |
367 | this.editSocialMediaDialog = true; | 380 | this.editSocialMediaDialog = true; |
368 | }, | 381 | }, |
369 | profile(item) { | 382 | profile(item) { |
370 | this.editedIndex = this.desserts.indexOf(item); | 383 | this.editedIndex = this.desserts.indexOf(item); |
371 | this.editedItem = Object.assign({}, item); | 384 | this.editedItem = Object.assign({}, item); |
372 | this.profileSocialMediaDialog = true; | 385 | this.profileSocialMediaDialog = true; |
373 | }, | 386 | }, |
374 | 387 | ||
375 | deleteItem(item) { | 388 | deleteItem(item) { |
376 | let deleteSocialMedia = { | 389 | let deleteSocialMedia = { |
377 | socialId: item._id | 390 | socialId: item._id, |
378 | }; | 391 | }; |
379 | http() | 392 | http() |
380 | .delete( | 393 | .delete( |
381 | "/deleteSocial", | 394 | "/deleteSocial", |
382 | confirm("Are you sure you want to delete this?") && { | 395 | confirm("Are you sure you want to delete this?") && { |
383 | params: deleteSocialMedia | 396 | params: deleteSocialMedia, |
384 | } | 397 | } |
385 | ) | 398 | ) |
386 | .then(response => { | 399 | .then((response) => { |
387 | this.snackbar = true; | 400 | this.snackbar = true; |
388 | this.text = response.data.message; | 401 | this.text = response.data.message; |
389 | this.color = "green"; | 402 | this.color = "green"; |
390 | this.getSocialMedia(); | 403 | this.getSocialMedia(); |
391 | }) | 404 | }) |
392 | .catch(error => { | 405 | .catch((error) => { |
393 | this.snackbar = true; | 406 | this.snackbar = true; |
394 | this.text = error.response.data.message; | 407 | this.text = error.response.data.message; |
395 | this.color = "error"; | 408 | this.color = "error"; |
396 | }); | 409 | }); |
397 | }, | 410 | }, |
398 | close() { | 411 | close() { |
399 | this.editSocialMediaDialog = false; | 412 | this.editSocialMediaDialog = false; |
400 | }, | 413 | }, |
414 | closeAddSocialMediaModel() { | ||
415 | this.addSocialMediaDialog = false; | ||
416 | this.socialMedia = []; | ||
417 | }, | ||
401 | submit() { | 418 | submit() { |
402 | if (this.$refs.form.validate()) { | 419 | if (this.$refs.form.validate()) { |
403 | this.loading = true; | 420 | this.loading = true; |
404 | http() | 421 | http() |
405 | .post("/addSocialLinks", this.socialMedia) | 422 | .post("/addSocialLinks", this.socialMedia) |
406 | .then(response => { | 423 | .then((response) => { |
407 | this.snackbar = true; | 424 | this.snackbar = true; |
408 | this.text = response.data.message; | 425 | this.text = response.data.message; |
409 | this.color = "green"; | 426 | this.color = "green"; |
410 | this.getSocialMedia(); | 427 | this.getSocialMedia(); |
411 | this.clear(); | 428 | this.clear(); |
412 | this.addSocialMediaDialog = false; | 429 | this.addSocialMediaDialog = false; |
413 | this.loading = false; | 430 | this.loading = false; |
414 | }) | 431 | }) |
415 | .catch(error => { | 432 | .catch((error) => { |
416 | this.snackbar = true; | 433 | this.snackbar = true; |
417 | this.color = "error"; | 434 | this.color = "error"; |
418 | this.text = error.response.data.message; | 435 | this.text = error.response.data.message; |
419 | this.loading = false; | 436 | this.loading = false; |
420 | }); | 437 | }); |
421 | } | 438 | } |
422 | }, | 439 | }, |
423 | clear() { | 440 | clear() { |
424 | this.$refs.form.reset(); | 441 | this.$refs.form.reset(); |
425 | }, | 442 | }, |
426 | save() { | 443 | save() { |
427 | (this.editedItem.socialId = this.editedItem._id), | 444 | (this.editedItem.socialId = this.editedItem._id), |
428 | http() | 445 | http() |
429 | .put("/updateSocial", this.editedItem) | 446 | .put("/updateSocial", this.editedItem) |
430 | .then(response => { | 447 | .then((response) => { |
431 | this.snackbar = true; | 448 | this.snackbar = true; |
432 | this.text = response.data.message; | 449 | this.text = response.data.message; |
433 | this.color = "green"; | 450 | this.color = "green"; |
434 | this.getSocialMedia(); | 451 | this.getSocialMedia(); |
435 | this.close(); | 452 | this.close(); |
436 | }) | 453 | }) |
437 | .catch(error => { | 454 | .catch((error) => { |
438 | this.snackbar = true; | 455 | this.snackbar = true; |
439 | this.text = error.response.data.message; | 456 | this.text = error.response.data.message; |
440 | this.color = "error"; | 457 | this.color = "error"; |
441 | }); | 458 | }); |
442 | }, | 459 | }, |
443 | displaySearch() { | 460 | displaySearch() { |
444 | (this.show = false), (this.showSearch = true); | 461 | (this.show = false), (this.showSearch = true); |
445 | }, | 462 | }, |
446 | closeSearch() { | 463 | closeSearch() { |
447 | this.showSearch = false; | 464 | this.showSearch = false; |
448 | this.show = true; | 465 | this.show = true; |
449 | this.search = ""; | 466 | this.search = ""; |
450 | } | 467 | }, |
451 | }, | 468 | }, |
452 | mounted() { | 469 | mounted() { |
453 | this.getSocialMedia(); | 470 | this.getSocialMedia(); |
454 | } | 471 | }, |
455 | }; | 472 | }; |
456 | </script> | 473 | </script> |