Commit 748acd1a6e445bc41d28bf50db67414171fb3fb1
1 parent
ea5696f777
Exists in
master
and in
3 other branches
solve bugs in progressCardReport
Showing
3 changed files
with
144 additions
and
146 deletions
Show diff stats
src/pages/Administrator/bulkImport.vue
1 | <template> | 1 | <template> |
2 | <v-container fluid grid-list-md> | 2 | <v-container fluid grid-list-md> |
3 | <v-card flat> | 3 | <v-card flat> |
4 | <v-toolbar class="fixcolors" dark flat> | 4 | <v-toolbar class="fixcolors" dark flat> |
5 | <v-spacer></v-spacer> | 5 | <v-spacer></v-spacer> |
6 | <v-toolbar-title>Import</v-toolbar-title> | 6 | <v-toolbar-title>Import</v-toolbar-title> |
7 | <v-spacer></v-spacer> | 7 | <v-spacer></v-spacer> |
8 | </v-toolbar> | 8 | </v-toolbar> |
9 | <v-container fluid> | 9 | <v-container fluid> |
10 | <v-layout> | 10 | <v-layout> |
11 | <v-flex xs12> | 11 | <v-flex xs12> |
12 | <v-layout wrap> | 12 | <v-layout wrap> |
13 | <v-flex xs6 sm5 lg2 class="pt-4"> | 13 | <v-flex xs6 sm5 lg2 class="pt-4"> |
14 | <label class="title right">Add Teacher:</label> | 14 | <label class="title right">Add Teacher:</label> |
15 | </v-flex> | 15 | </v-flex> |
16 | <v-flex xs12 sm6 lg3> | 16 | <v-flex xs12 sm6 lg3> |
17 | <v-text-field v-model="teacherFileName" placeholder="Choose file" :disabled="true"></v-text-field> | 17 | <v-text-field v-model="teacherFileName" placeholder="Choose file" :disabled="true"></v-text-field> |
18 | <input | 18 | <input |
19 | type="file" | 19 | type="file" |
20 | style="display: none" | 20 | style="display: none" |
21 | ref="file" | 21 | ref="file" |
22 | @change="convertFile" | 22 | @change="convertFile" |
23 | id="fileInput" | 23 | id="fileInput" |
24 | /> | 24 | /> |
25 | </v-flex> | 25 | </v-flex> |
26 | <v-flex xs6 sm4 lg2 class="mt-1"> | 26 | <v-flex xs6 sm4 lg2 class="mt-1"> |
27 | <v-btn class="grey" dark block @click="pickFile"> | 27 | <v-btn class="grey" dark block @click="pickFile"> |
28 | <v-icon small class="pr-1">refresh</v-icon>Upload | 28 | <v-icon small class="pr-1">refresh</v-icon>Upload |
29 | </v-btn> | 29 | </v-btn> |
30 | </v-flex> | 30 | </v-flex> |
31 | <v-flex xs6 sm4 lg2 class="mt-1"> | 31 | <v-flex xs6 sm4 lg2 class="mt-1"> |
32 | <v-btn class="grey" dark block @click="importTeacher()" :loading="loading">import</v-btn> | 32 | <v-btn class="grey" dark block @click="importTeacher()" :loading="loading">import</v-btn> |
33 | </v-flex> | 33 | </v-flex> |
34 | <v-flex xs12 sm4 lg2 class="mt-1"> | 34 | <v-flex xs12 sm4 lg2 class="mt-1"> |
35 | <download-csv :data="teacherData"> | 35 | <download-csv :data="teacherData"> |
36 | <v-btn class="blue lighten-2" dark block> | 36 | <v-btn class="blue lighten-2" dark block> |
37 | <v-icon small class="pr-1">archive</v-icon>sample download | 37 | <v-icon small class="pr-1">archive</v-icon>sample download |
38 | </v-btn> | 38 | </v-btn> |
39 | </download-csv> | 39 | </download-csv> |
40 | </v-flex> | 40 | </v-flex> |
41 | </v-layout> | 41 | </v-layout> |
42 | </v-flex> | 42 | </v-flex> |
43 | </v-layout> | 43 | </v-layout> |
44 | <v-layout> | 44 | <v-layout> |
45 | <v-flex xs12> | 45 | <v-flex xs12> |
46 | <v-layout wrap> | 46 | <v-layout wrap> |
47 | <v-flex xs6 sm5 lg2 class="pt-4"> | 47 | <v-flex xs6 sm5 lg2 class="pt-4"> |
48 | <label class="title right">Add Parent:</label> | 48 | <label class="title right">Add Parent:</label> |
49 | </v-flex> | 49 | </v-flex> |
50 | <v-flex xs12 sm6 lg3> | 50 | <v-flex xs12 sm6 lg3> |
51 | <v-text-field v-model="parentFileName" placeholder="Choose file" :disabled="true"></v-text-field> | 51 | <v-text-field v-model="parentFileName" placeholder="Choose file" :disabled="true"></v-text-field> |
52 | <input | 52 | <input |
53 | type="file" | 53 | type="file" |
54 | style="display: none" | 54 | style="display: none" |
55 | ref="parentfile" | 55 | ref="parentfile" |
56 | @change="parentFile" | 56 | @change="parentFile" |
57 | id="parentInput" | 57 | id="parentInput" |
58 | /> | 58 | /> |
59 | </v-flex> | 59 | </v-flex> |
60 | <v-flex xs6 sm4 lg2 class="mt-1"> | 60 | <v-flex xs6 sm4 lg2 class="mt-1"> |
61 | <v-btn class="grey" dark block @click="pickParentFile"> | 61 | <v-btn class="grey" dark block @click="pickParentFile"> |
62 | <v-icon small class="pr-1">refresh</v-icon>Upload | 62 | <v-icon small class="pr-1">refresh</v-icon>Upload |
63 | </v-btn> | 63 | </v-btn> |
64 | </v-flex> | 64 | </v-flex> |
65 | <v-flex xs6 sm4 lg2 class="mt-1" @click="importParent"> | 65 | <v-flex xs6 sm4 lg2 class="mt-1" @click="importParent" :loading="parentLoading"> |
66 | <v-btn class="grey" dark block>import</v-btn> | 66 | <v-btn class="grey" dark block>import</v-btn> |
67 | </v-flex> | 67 | </v-flex> |
68 | <v-flex xs12 sm4 lg2 class="mt-1"> | 68 | <v-flex xs12 sm4 lg2 class="mt-1"> |
69 | <download-csv :data="parentData"> | 69 | <download-csv :data="parentData"> |
70 | <v-btn class="blue lighten-2" dark block> | 70 | <v-btn class="blue lighten-2" dark block> |
71 | <v-icon small class="pr-1">archive</v-icon>sample download | 71 | <v-icon small class="pr-1">archive</v-icon>sample download |
72 | </v-btn> | 72 | </v-btn> |
73 | </download-csv> | 73 | </download-csv> |
74 | </v-flex> | 74 | </v-flex> |
75 | </v-layout> | 75 | </v-layout> |
76 | </v-flex> | 76 | </v-flex> |
77 | </v-layout> | 77 | </v-layout> |
78 | <v-layout> | 78 | <v-layout> |
79 | <v-flex xs12> | 79 | <v-flex xs12> |
80 | <v-layout wrap> | 80 | <v-layout wrap> |
81 | <v-flex xs6 sm5 lg2 class="pt-4"> | 81 | <v-flex xs6 sm5 lg2 class="pt-4"> |
82 | <label class="title right">Add User:</label> | 82 | <label class="title right">Add User:</label> |
83 | </v-flex> | 83 | </v-flex> |
84 | <v-flex xs12 sm6 lg3> | 84 | <v-flex xs12 sm6 lg3> |
85 | <v-text-field placeholder="Choose file" v-model="userFileName" :disabled="true"></v-text-field> | 85 | <v-text-field placeholder="Choose file" v-model="userFileName" :disabled="true"></v-text-field> |
86 | <input | 86 | <input |
87 | type="file" | 87 | type="file" |
88 | style="display: none" | 88 | style="display: none" |
89 | ref="userfile" | 89 | ref="userfile" |
90 | @change="userFile" | 90 | @change="userFile" |
91 | id="userInput" | 91 | id="userInput" |
92 | /> | 92 | /> |
93 | </v-flex> | 93 | </v-flex> |
94 | <v-flex xs6 sm4 lg2 class="mt-1"> | 94 | <v-flex xs6 sm4 lg2 class="mt-1"> |
95 | <v-btn class="grey" dark block @click="pickUserFile"> | 95 | <v-btn class="grey" dark block @click="pickUserFile"> |
96 | <v-icon small class="pr-1">refresh</v-icon>Upload | 96 | <v-icon small class="pr-1">refresh</v-icon>Upload |
97 | </v-btn> | 97 | </v-btn> |
98 | </v-flex> | 98 | </v-flex> |
99 | <v-flex xs6 sm4 lg2 class="mt-1"> | 99 | <v-flex xs6 sm4 lg2 class="mt-1"> |
100 | <v-btn class="grey" dark block @click="importUser">import</v-btn> | 100 | <v-btn class="grey" dark block @click="importUser" :loading="userLoading">import</v-btn> |
101 | </v-flex> | 101 | </v-flex> |
102 | <v-flex xs12 sm4 lg2 class="mt-1"> | 102 | <v-flex xs12 sm4 lg2 class="mt-1"> |
103 | <download-csv :data="userData"> | 103 | <download-csv :data="userData"> |
104 | <v-btn class="blue lighten-2" dark block> | 104 | <v-btn class="blue lighten-2" dark block> |
105 | <v-icon small class="pr-1">archive</v-icon>sample download | 105 | <v-icon small class="pr-1">archive</v-icon>sample download |
106 | </v-btn> | 106 | </v-btn> |
107 | </download-csv> | 107 | </download-csv> |
108 | </v-flex> | 108 | </v-flex> |
109 | </v-layout> | 109 | </v-layout> |
110 | </v-flex> | 110 | </v-flex> |
111 | </v-layout> | 111 | </v-layout> |
112 | <v-layout> | 112 | <v-layout> |
113 | <v-flex xs12> | 113 | <v-flex xs12> |
114 | <v-layout wrap> | 114 | <v-layout wrap> |
115 | <v-flex xs6 sm5 lg2 class="pt-4"> | 115 | <v-flex xs6 sm5 lg2 class="pt-4"> |
116 | <label class="title right">Add Book:</label> | 116 | <label class="title right">Add Book:</label> |
117 | </v-flex> | 117 | </v-flex> |
118 | <v-flex xs12 sm6 lg3> | 118 | <v-flex xs12 sm6 lg3> |
119 | <v-text-field placeholder="Choose file" v-model="bookFileName" :disabled="true"></v-text-field> | 119 | <v-text-field placeholder="Choose file" v-model="bookFileName" :disabled="true"></v-text-field> |
120 | <input | 120 | <input |
121 | type="file" | 121 | type="file" |
122 | style="display: none" | 122 | style="display: none" |
123 | ref="bookfile" | 123 | ref="bookfile" |
124 | @change="bookFile" | 124 | @change="bookFile" |
125 | id="bookInput" | 125 | id="bookInput" |
126 | /> | 126 | /> |
127 | </v-flex> | 127 | </v-flex> |
128 | <v-flex xs6 sm4 lg2 class="mt-1"> | 128 | <v-flex xs6 sm4 lg2 class="mt-1"> |
129 | <v-btn class="grey" dark block @click="pickBookFile"> | 129 | <v-btn class="grey" dark block @click="pickBookFile"> |
130 | <v-icon small class="pr-1">refresh</v-icon>Upload | 130 | <v-icon small class="pr-1">refresh</v-icon>Upload |
131 | </v-btn> | 131 | </v-btn> |
132 | </v-flex> | 132 | </v-flex> |
133 | <v-flex xs6 sm4 lg2 class="mt-1"> | 133 | <v-flex xs6 sm4 lg2 class="mt-1"> |
134 | <v-btn class="grey" dark block @click="importBook">import</v-btn> | 134 | <v-btn class="grey" dark block @click="importBook" :loading="BookLoading">import</v-btn> |
135 | </v-flex> | 135 | </v-flex> |
136 | <v-flex xs12 sm4 lg2 class="mt-1"> | 136 | <v-flex xs12 sm4 lg2 class="mt-1"> |
137 | <download-csv :data="bookData"> | 137 | <download-csv :data="bookData"> |
138 | <v-btn class="blue lighten-2" dark block> | 138 | <v-btn class="blue lighten-2" dark block> |
139 | <v-icon small class="pr-1">archive</v-icon>sample download | 139 | <v-icon small class="pr-1">archive</v-icon>sample download |
140 | </v-btn> | 140 | </v-btn> |
141 | </download-csv> | 141 | </download-csv> |
142 | </v-flex> | 142 | </v-flex> |
143 | </v-layout> | 143 | </v-layout> |
144 | </v-flex> | 144 | </v-flex> |
145 | </v-layout> | 145 | </v-layout> |
146 | <v-layout> | 146 | <v-layout> |
147 | <v-flex xs12> | 147 | <v-flex xs12> |
148 | <v-layout wrap> | 148 | <v-layout wrap> |
149 | <v-flex xs6 sm5 lg2 class="pt-4"> | 149 | <v-flex xs6 sm5 lg2 class="pt-4"> |
150 | <label class="title right">Add Student:</label> | 150 | <label class="title right">Add Student:</label> |
151 | </v-flex> | 151 | </v-flex> |
152 | <v-flex xs12 sm6 lg3> | 152 | <v-flex xs12 sm6 lg3> |
153 | <v-text-field placeholder="Choose file" v-model="bookStudentName" :disabled="true"></v-text-field> | 153 | <v-text-field placeholder="Choose file" v-model="bookStudentName" :disabled="true"></v-text-field> |
154 | <input | 154 | <input |
155 | type="file" | 155 | type="file" |
156 | style="display: none" | 156 | style="display: none" |
157 | ref="studentfile" | 157 | ref="studentfile" |
158 | @change="studentFile" | 158 | @change="studentFile" |
159 | id="studentInput" | 159 | id="studentInput" |
160 | /> | 160 | /> |
161 | </v-flex> | 161 | </v-flex> |
162 | <v-flex xs6 sm4 lg2 class="mt-1"> | 162 | <v-flex xs6 sm4 lg2 class="mt-1"> |
163 | <v-btn class="grey" dark block @click="pickStudentFile"> | 163 | <v-btn class="grey" dark block @click="pickStudentFile"> |
164 | <v-icon small class="pr-1">refresh</v-icon>Upload | 164 | <v-icon small class="pr-1">refresh</v-icon>Upload |
165 | </v-btn> | 165 | </v-btn> |
166 | </v-flex> | 166 | </v-flex> |
167 | <v-flex xs6 sm4 lg2 class="mt-1"> | 167 | <v-flex xs6 sm4 lg2 class="mt-1"> |
168 | <v-btn class="grey" dark block @click="importStudent()">import</v-btn> | 168 | <v-btn |
169 | class="grey" | ||
170 | dark | ||
171 | block | ||
172 | @click="importStudent()" | ||
173 | :loading="studentLoading" | ||
174 | >import</v-btn> | ||
169 | </v-flex> | 175 | </v-flex> |
170 | <v-flex xs12 sm4 lg2 class="mt-1"> | 176 | <v-flex xs12 sm4 lg2 class="mt-1"> |
171 | <download-csv :data="studentData"> | 177 | <download-csv :data="studentData"> |
172 | <v-btn class="blue lighten-2" dark block> | 178 | <v-btn class="blue lighten-2" dark block> |
173 | <v-icon small class="pr-1">archive</v-icon>sample download | 179 | <v-icon small class="pr-1">archive</v-icon>sample download |
174 | </v-btn> | 180 | </v-btn> |
175 | </download-csv> | 181 | </download-csv> |
176 | </v-flex> | 182 | </v-flex> |
177 | </v-layout> | 183 | </v-layout> |
178 | </v-flex> | 184 | </v-flex> |
179 | </v-layout> | 185 | </v-layout> |
180 | <!-- <v-layout> | 186 | <!-- <v-layout> |
181 | <v-flex xs12> | 187 | <v-flex xs12> |
182 | <v-layout wrap> | 188 | <v-layout wrap> |
183 | <v-flex xs9 sm5 lg2 class="pt-4"> | 189 | <v-flex xs9 sm5 lg2 class="pt-4"> |
184 | <label class="title right">Students & Parents:</label> | 190 | <label class="title right">Students & Parents:</label> |
185 | </v-flex> | 191 | </v-flex> |
186 | <v-flex xs12 sm6 lg3> | 192 | <v-flex xs12 sm6 lg3> |
187 | <v-text-field placeholder="Choose file" :disabled="true"></v-text-field> | 193 | <v-text-field placeholder="Choose file" :disabled="true"></v-text-field> |
188 | </v-flex> | 194 | </v-flex> |
189 | <v-flex xs6 sm4 lg2 class="mt-1"> | 195 | <v-flex xs6 sm4 lg2 class="mt-1"> |
190 | <v-btn class="grey" dark block> | 196 | <v-btn class="grey" dark block> |
191 | <v-icon small class="pr-1">refresh</v-icon>Upload | 197 | <v-icon small class="pr-1">refresh</v-icon>Upload |
192 | </v-btn> | 198 | </v-btn> |
193 | </v-flex> | 199 | </v-flex> |
194 | <v-flex xs6 sm4 lg2 class="mt-1"> | 200 | <v-flex xs6 sm4 lg2 class="mt-1"> |
195 | <v-btn class="grey" dark block>import</v-btn> | 201 | <v-btn class="grey" dark block>import</v-btn> |
196 | </v-flex> | 202 | </v-flex> |
197 | <v-flex xs12 sm4 lg2 class="mt-1"> | 203 | <v-flex xs12 sm4 lg2 class="mt-1"> |
198 | <v-btn class="blue lighten-2" dark block> | 204 | <v-btn class="blue lighten-2" dark block> |
199 | <v-icon small class="pr-1">archive</v-icon>sample download | 205 | <v-icon small class="pr-1">archive</v-icon>sample download |
200 | </v-btn> | 206 | </v-btn> |
201 | </v-flex> | 207 | </v-flex> |
202 | </v-layout> | 208 | </v-layout> |
203 | </v-flex> | 209 | </v-flex> |
204 | </v-layout>--> | 210 | </v-layout>--> |
205 | </v-container> | 211 | </v-container> |
206 | </v-card> | 212 | </v-card> |
207 | <v-snackbar | 213 | <v-snackbar |
208 | :timeout="timeout" | 214 | :timeout="timeout" |
209 | :top="y === 'top'" | 215 | :top="y === 'top'" |
210 | :right="x === 'right'" | 216 | :right="x === 'right'" |
211 | :vertical="mode === 'vertical'" | 217 | :vertical="mode === 'vertical'" |
212 | v-model="snackbar" | 218 | v-model="snackbar" |
213 | :color= color | 219 | :color="color" |
214 | >{{ text }}</v-snackbar> | 220 | >{{ text }}</v-snackbar> |
215 | </v-container> | 221 | </v-container> |
216 | </template> | 222 | </template> |
217 | 223 | ||
218 | 224 | ||
219 | <script> | 225 | <script> |
220 | import http from "@/Services/http.js"; | 226 | import http from "@/Services/http.js"; |
221 | import moment from "moment"; | 227 | import moment from "moment"; |
222 | import teacherData from "@/script/teachers.js"; | 228 | import teacherData from "@/script/teachers.js"; |
223 | import studentData from "@/script/students.js"; | 229 | import studentData from "@/script/students.js"; |
224 | import parentData from "@/script/parents.js"; | 230 | import parentData from "@/script/parents.js"; |
225 | import userData from "@/script/users.js"; | 231 | import userData from "@/script/users.js"; |
226 | import bookData from "@/script/books.js"; | 232 | import bookData from "@/script/books.js"; |
233 | import XLSX from "xlsx"; | ||
227 | 234 | ||
228 | export default { | 235 | export default { |
229 | data: () => ({ | 236 | data: () => ({ |
230 | loading: false, | 237 | loading: false, |
238 | parentLoading: false, | ||
239 | userLoading: false, | ||
240 | BookLoading: false, | ||
241 | studentLoading: false, | ||
231 | snackbar: false, | 242 | snackbar: false, |
232 | y: "top", | 243 | y: "top", |
233 | x: "right", | 244 | x: "right", |
234 | mode: "", | 245 | mode: "", |
235 | timeout: 3000, | 246 | timeout: 3000, |
236 | text: "", | 247 | text: "", |
237 | color: "", | 248 | color: "", |
238 | teacherData: [], | 249 | teacherData: [], |
239 | studentData: [], | 250 | studentData: [], |
240 | parentData: [], | 251 | parentData: [], |
241 | userData: [], | 252 | userData: [], |
242 | bookData: [], | 253 | bookData: [], |
243 | teacherFileJson: [], | 254 | teacherFileJson: [], |
244 | parentFileJson: [], | 255 | parentFileJson: [], |
245 | userFileJson: [], | 256 | userFileJson: [], |
246 | bookFileJson: [], | 257 | bookFileJson: [], |
247 | studentFileJson: [], | 258 | studentFileJson: [], |
248 | teacherFileName: "", | 259 | teacherFileName: "", |
249 | parentFileName: "", | 260 | parentFileName: "", |
250 | userFileName: "", | 261 | userFileName: "", |
251 | bookFileName: "", | 262 | bookFileName: "", |
252 | bookStudentName: "", | 263 | bookStudentName: "", |
253 | token: "" | 264 | token: "" |
254 | }), | 265 | }), |
255 | methods: { | 266 | methods: { |
256 | pickFile() { | 267 | pickFile() { |
257 | this.$refs.file.click(); | 268 | this.$refs.file.click(); |
258 | }, | 269 | }, |
259 | pickParentFile() { | 270 | pickParentFile() { |
260 | this.$refs.parentfile.click(); | 271 | this.$refs.parentfile.click(); |
261 | }, | 272 | }, |
262 | pickUserFile() { | 273 | pickUserFile() { |
263 | this.$refs.userfile.click(); | 274 | this.$refs.userfile.click(); |
264 | }, | 275 | }, |
265 | pickBookFile() { | 276 | pickBookFile() { |
266 | this.$refs.bookfile.click(); | 277 | this.$refs.bookfile.click(); |
267 | }, | 278 | }, |
268 | pickStudentFile() { | 279 | pickStudentFile() { |
269 | this.$refs.studentfile.click(); | 280 | this.$refs.studentfile.click(); |
270 | }, | 281 | }, |
271 | convertFile() { | 282 | convertFile(e) { |
272 | const input = document.getElementById("fileInput"); | 283 | const input = document.getElementById("fileInput"); |
273 | const reader = new FileReader(); | ||
274 | reader.onload = () => { | ||
275 | let text = reader.result; | ||
276 | //convert text to json here | ||
277 | var json = this.csvJSON(text); | ||
278 | }; | ||
279 | reader.readAsText(input.files[0]); | ||
280 | this.teacherFileName = input.files[0].name; | 284 | this.teacherFileName = input.files[0].name; |
285 | // const reader = new FileReader(); | ||
286 | // console.log("reader", reader); | ||
287 | // reader.onload = () => { | ||
288 | // let text = reader.result; | ||
289 | // //convert text to json here | ||
290 | // console.log("text", text); | ||
291 | // var json = this.csvJSON(text); | ||
292 | // }; | ||
293 | // reader.readAsText(input.files[0]); | ||
294 | var files = e.target.files, | ||
295 | f = files[0]; | ||
296 | var reader = new FileReader(); | ||
297 | let array = []; | ||
298 | let _this = this; | ||
299 | reader.onload = function(e) { | ||
300 | var data = new Uint8Array(e.target.result); | ||
301 | var workbook = XLSX.read(data, { type: "array" }); | ||
302 | let sheetName = workbook.SheetNames[0]; | ||
303 | // /* DO SOMETHING WITH workbook HERE */ | ||
304 | let worksheet = workbook.Sheets[sheetName]; | ||
305 | array = XLSX.utils.sheet_to_json(worksheet); | ||
306 | _this.teacherFileJson = array; | ||
307 | }; | ||
308 | reader.readAsArrayBuffer(f); | ||
281 | }, | 309 | }, |
282 | parentFile() { | 310 | parentFile(e) { |
283 | const input = document.getElementById("parentInput"); | 311 | const input = document.getElementById("parentInput"); |
284 | const reader = new FileReader(); | ||
285 | reader.onload = () => { | ||
286 | let text = reader.result; | ||
287 | //convert text to json here | ||
288 | var json = this.csvParentJSON(text); | ||
289 | }; | ||
290 | reader.readAsText(input.files[0]); | ||
291 | this.parentFileName = input.files[0].name; | 312 | this.parentFileName = input.files[0].name; |
313 | console.log("this.parentFileName", this.parentFileName); | ||
314 | var files = e.target.files, | ||
315 | f = files[0]; | ||
316 | var reader = new FileReader(); | ||
317 | let array = []; | ||
318 | let _this = this; | ||
319 | reader.onload = function(e) { | ||
320 | var data = new Uint8Array(e.target.result); | ||
321 | var workbook = XLSX.read(data, { type: "array" }); | ||
322 | let sheetName = workbook.SheetNames[0]; | ||
323 | // /* DO SOMETHING WITH workbook HERE */ | ||
324 | let worksheet = workbook.Sheets[sheetName]; | ||
325 | array = XLSX.utils.sheet_to_json(worksheet); | ||
326 | _this.parentFileJson = array; | ||
327 | }; | ||
328 | reader.readAsArrayBuffer(f); | ||
292 | }, | 329 | }, |
293 | userFile() { | 330 | userFile(e) { |
294 | const input = document.getElementById("userInput"); | 331 | const input = document.getElementById("userInput"); |
295 | const reader = new FileReader(); | ||
296 | reader.onload = () => { | ||
297 | let text = reader.result; | ||
298 | //convert text to json here | ||
299 | var json = this.csvUserJSON(text); | ||
300 | }; | ||
301 | reader.readAsText(input.files[0]); | ||
302 | this.userFileName = input.files[0].name; | 332 | this.userFileName = input.files[0].name; |
333 | var files = e.target.files, | ||
334 | f = files[0]; | ||
335 | var reader = new FileReader(); | ||
336 | let array = []; | ||
337 | let _this = this; | ||
338 | reader.onload = function(e) { | ||
339 | var data = new Uint8Array(e.target.result); | ||
340 | var workbook = XLSX.read(data, { type: "array" }); | ||
341 | let sheetName = workbook.SheetNames[0]; | ||
342 | // /* DO SOMETHING WITH workbook HERE */ | ||
343 | let worksheet = workbook.Sheets[sheetName]; | ||
344 | array = XLSX.utils.sheet_to_json(worksheet); | ||
345 | _this.userFileJson = array; | ||
346 | }; | ||
347 | reader.readAsArrayBuffer(f); | ||
303 | }, | 348 | }, |
304 | bookFile() { | 349 | bookFile(e) { |
305 | const input = document.getElementById("bookInput"); | 350 | const input = document.getElementById("bookInput"); |
306 | const reader = new FileReader(); | ||
307 | reader.onload = () => { | ||
308 | let text = reader.result; | ||
309 | //convert text to json here | ||
310 | var json = this.csvBookJSON(text); | ||
311 | }; | ||
312 | reader.readAsText(input.files[0]); | ||
313 | this.bookFileName = input.files[0].name; | 351 | this.bookFileName = input.files[0].name; |
352 | console.log("this.bookFileName", this.bookFileName); | ||
353 | var files = e.target.files, | ||
354 | f = files[0]; | ||
355 | console.log("this.bookFileName", files); | ||
356 | var reader = new FileReader(); | ||
357 | console.log("reader================", reader); | ||
358 | let array = []; | ||
359 | let _this = this; | ||
360 | reader.onload = function(e) { | ||
361 | console.log("data", e.target.result); | ||
362 | var data = new Uint8Array(e.target.result); | ||
363 | console.log("data", data); | ||
364 | var workbook = XLSX.read(data, { type: "array" }); | ||
365 | let sheetName = workbook.SheetNames[0]; | ||
366 | // /* DO SOMETHING WITH workbook HERE */ | ||
367 | let worksheet = workbook.Sheets[sheetName]; | ||
368 | array = XLSX.utils.sheet_to_json(worksheet); | ||
369 | _this.bookFileJson = array; | ||
370 | console.log("this.bookFileJson ", _this.bookFileJson); | ||
371 | }; | ||
372 | reader.readAsArrayBuffer(f); | ||
314 | }, | 373 | }, |
315 | studentFile() { | 374 | studentFile(e) { |
316 | const input = document.getElementById("studentInput"); | 375 | const input = document.getElementById("studentInput"); |
317 | const reader = new FileReader(); | ||
318 | reader.onload = () => { | ||
319 | let text = reader.result; | ||
320 | //convert text to json here | ||
321 | var json = this.csvStudentJSON(text); | ||
322 | }; | ||
323 | reader.readAsText(input.files[0]); | ||
324 | this.bookStudentName = input.files[0].name; | 376 | this.bookStudentName = input.files[0].name; |
377 | var files = e.target.files, | ||
378 | f = files[0]; | ||
379 | var reader = new FileReader(); | ||
380 | let array = []; | ||
381 | let _this = this; | ||
382 | reader.onload = function(e) { | ||
383 | var data = new Uint8Array(e.target.result); | ||
384 | var workbook = XLSX.read(data, { type: "array" }); | ||
385 | let sheetName = workbook.SheetNames[0]; | ||
386 | // /* DO SOMETHING WITH workbook HERE */ | ||
387 | let worksheet = workbook.Sheets[sheetName]; | ||
388 | array = XLSX.utils.sheet_to_json(worksheet); | ||
389 | _this.studentFileJson = array; | ||
390 | }; | ||
391 | reader.readAsArrayBuffer(f); | ||
325 | }, | 392 | }, |
326 | csvJSON(csv) { | 393 | // csvJSON(csv) { |
327 | var lines = csv.split("\n"); | 394 | // var lines = csv.split("\n"); |
328 | |||
329 | var result = []; | ||
330 | var headers = lines[0].split(","); | ||
331 | |||
332 | for (var i = 1; i < lines.length; i++) { | ||
333 | var obj = {}; | ||
334 | var currentline = lines[i].split(","); | ||
335 | |||
336 | for (var j = 0; j < headers.length; j++) { | ||
337 | obj[headers[j]] = currentline[j]; | ||
338 | } | ||
339 | this.teacherFileJson.push(obj); | ||
340 | } | ||
341 | }, | ||
342 | csvParentJSON(csvParent) { | ||
343 | var lines = csvParent.split("\n"); | ||
344 | |||
345 | var result = []; | ||
346 | |||
347 | var headers = lines[0].split(","); | ||
348 | |||
349 | for (var i = 1; i < lines.length; i++) { | ||
350 | var obj = {}; | ||
351 | var currentline = lines[i].split(","); | ||
352 | |||
353 | for (var j = 0; j < headers.length; j++) { | ||
354 | obj[headers[j]] = currentline[j]; | ||
355 | } | ||
356 | this.parentFileJson.push(obj); | ||
357 | } | ||
358 | }, | ||
359 | csvUserJSON(cvsUser) { | ||
360 | var lines = cvsUser.split("\n"); | ||
361 | |||
362 | var result = []; | ||
363 | |||
364 | var headers = lines[0].split(","); | ||
365 | |||
366 | for (var i = 1; i < lines.length; i++) { | ||
367 | var obj = {}; | ||
368 | var currentline = lines[i].split(","); | ||
369 | |||
370 | for (var j = 0; j < headers.length; j++) { | ||
371 | obj[headers[j]] = currentline[j]; | ||
372 | } | ||
373 | |||
374 | this.userFileJson.push(obj); | ||
375 | } | ||
376 | }, | ||
377 | csvBookJSON(cvsBook) { | ||
378 | var lines = cvsBook.split("\n"); | ||
379 | |||
380 | var result = []; | ||
381 | |||
382 | var headers = lines[0].split(","); | ||
383 | |||
384 | for (var i = 1; i < lines.length; i++) { | ||
385 | var obj = {}; | ||
386 | var currentline = lines[i].split(","); | ||
387 | |||
388 | for (var j = 0; j < headers.length; j++) { | ||
389 | obj[headers[j]] = currentline[j]; | ||
390 | } | ||
391 | |||
392 | this.bookFileJson.push(obj); | ||
393 | } | ||
394 | }, | ||
395 | csvStudentJSON(cvsBook) { | ||
396 | var lines = cvsBook.split("\n"); | ||
397 | |||
398 | var result = []; | ||
399 | 395 | ||
400 | var headers = lines[0].split(","); | 396 | // var result = []; |
397 | // var headers = lines[0].split(","); | ||
401 | 398 | ||
402 | for (var i = 1; i < lines.length; i++) { | 399 | // for (var i = 1; i < lines.length; i++) { |
403 | var obj = {}; | 400 | // var obj = {}; |
404 | var currentline = lines[i].split(","); | 401 | // var currentline = lines[i].split(","); |
405 | 402 | ||
406 | for (var j = 0; j < headers.length; j++) { | 403 | // for (var j = 0; j < headers.length; j++) { |
407 | obj[headers[j]] = currentline[j]; | 404 | // obj[headers[j]] = currentline[j]; |
408 | } | 405 | // } |
409 | this.studentFileJson.push(obj); | 406 | // this.teacherFileJson.push(obj); |
410 | } | 407 | // } |
411 | }, | 408 | // }, |
412 | importTeacher() { | 409 | importTeacher() { |
413 | this.loading = true; | 410 | this.loading = true; |
414 | var teacherfile = {}; | 411 | var teacherfile = {}; |
415 | teacherfile.teacherData = this.teacherFileJson; | 412 | teacherfile.teacherData = this.teacherFileJson; |
416 | http() | 413 | http() |
417 | .post("/importTeacherData", teacherfile, { | 414 | .post("/importTeacherData", teacherfile, { |
418 | headers: { Authorization: "Bearer " + this.token } | 415 | headers: { Authorization: "Bearer " + this.token } |
419 | }) | 416 | }) |
420 | .then(response => { | 417 | .then(response => { |
421 | this.snackbar = true; | 418 | this.snackbar = true; |
422 | this.text = response.data.message; | 419 | this.text = response.data.message; |
423 | this.color = "green"; | 420 | this.color = "green"; |
424 | this.loading = false; | 421 | this.loading = false; |
425 | }) | 422 | }) |
426 | .catch(error => { | 423 | .catch(error => { |
427 | this.snackbar = true; | 424 | this.snackbar = true; |
428 | this.text = error.response.data.message; | 425 | this.text = error.response.data.message; |
429 | this.color = "red"; | 426 | this.color = "red"; |
430 | this.loading = false; | 427 | this.loading = false; |
431 | }); | 428 | }); |
432 | }, | 429 | }, |
433 | importParent() { | 430 | importParent() { |
434 | this.loading = true; | 431 | this.parentLoading = true; |
435 | var parentfile = {}; | 432 | var parentfile = {}; |
436 | parentfile.parentData = this.parentFileJson; | 433 | parentfile.parentData = this.parentFileJson; |
437 | http() | 434 | http() |
438 | .post("/importParentData", parentfile, { | 435 | .post("/importParentData", parentfile, { |
439 | headers: { Authorization: "Bearer " + this.token } | 436 | headers: { Authorization: "Bearer " + this.token } |
440 | }) | 437 | }) |
441 | .then(response => { | 438 | .then(response => { |
442 | this.snackbar = true; | 439 | this.snackbar = true; |
src/pages/Report/progressCardReport.vue
1 | <template> | 1 | <template> |
2 | <v-app id="pages-dasboard"> | 2 | <v-app id="pages-dasboard"> |
3 | <!-- ****** Progress Card Report Table****** --> | 3 | <!-- ****** Progress Card Report Table****** --> |
4 | 4 | ||
5 | <v-card flat> | 5 | <v-card flat> |
6 | <v-card-actions> | 6 | <v-card-actions> |
7 | <v-layout> | 7 | <v-layout> |
8 | <h4 class="ml-2">Progress Card Report</h4> | 8 | <h4 class="ml-2">Progress Card Report</h4> |
9 | </v-layout> | 9 | </v-layout> |
10 | </v-card-actions> | 10 | </v-card-actions> |
11 | </v-card> | 11 | </v-card> |
12 | <v-card flat> | 12 | <v-card flat> |
13 | <v-form ref="form" v-model="valid" lazy-validation> | 13 | <v-form ref="form" v-model="valid" lazy-validation> |
14 | <v-flex xs12 sm12 lg12> | 14 | <v-flex xs12 sm12 lg12> |
15 | <v-layout wrap> | 15 | <v-layout wrap> |
16 | <v-flex xs12 sm12 lg3> | 16 | <v-flex xs12 sm12 lg3> |
17 | <v-layout> | 17 | <v-layout> |
18 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 18 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
19 | <label class="right">Class:</label> | 19 | <label class="right">Class:</label> |
20 | </v-flex> | 20 | </v-flex> |
21 | <v-flex xs9 sm6 lg8 class="ml-2"> | 21 | <v-flex xs9 sm6 lg8 class="ml-2"> |
22 | <v-select | 22 | <v-select |
23 | v-model="getReport.classId" | 23 | v-model="getReport.classId" |
24 | label="Select your class" | 24 | label="Select your class" |
25 | type="text" | 25 | type="text" |
26 | :items="classList" | 26 | :items="classList" |
27 | item-text="classNum" | 27 | item-text="classNum" |
28 | item-value="_id" | 28 | item-value="_id" |
29 | :rules="classRules" | 29 | :rules="classRules" |
30 | @change="getSections(getReport.classId)" | 30 | @change="getSections(getReport.classId)" |
31 | required | 31 | required |
32 | ></v-select> | 32 | ></v-select> |
33 | </v-flex> | 33 | </v-flex> |
34 | </v-layout> | 34 | </v-layout> |
35 | </v-flex> | 35 | </v-flex> |
36 | <v-flex xs12 sm12 lg3> | 36 | <v-flex xs12 sm12 lg3> |
37 | <v-layout> | 37 | <v-layout> |
38 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 38 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
39 | <label class="right">Section:</label> | 39 | <label class="right">Section:</label> |
40 | </v-flex> | 40 | </v-flex> |
41 | <v-flex xs9 sm6 lg8 class="ml-2"> | 41 | <v-flex xs9 sm6 lg8 class="ml-2"> |
42 | <v-select | 42 | <v-select |
43 | :items="addSection" | 43 | :items="addSection" |
44 | label="Select your Section" | 44 | label="Select your Section" |
45 | v-model="getReport.sectionId" | 45 | v-model="getReport.sectionId" |
46 | item-text="name" | 46 | item-text="name" |
47 | item-value="_id" | 47 | item-value="_id" |
48 | name="Select Section" | 48 | name="Select Section" |
49 | @change="getStudents" | 49 | @change="getStudents" |
50 | :rules="sectionRules" | 50 | :rules="sectionRules" |
51 | required | 51 | required |
52 | ></v-select> | 52 | ></v-select> |
53 | </v-flex> | 53 | </v-flex> |
54 | </v-layout> | 54 | </v-layout> |
55 | </v-flex> | 55 | </v-flex> |
56 | <v-flex xs12 sm12 lg3> | 56 | <v-flex xs12 sm12 lg3> |
57 | <v-layout> | 57 | <v-layout> |
58 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> | 58 | <v-flex xs3 sm6 lg2 class="subheading mt-4"> |
59 | <label class="right">Student:</label> | 59 | <label class="right">Student:</label> |
60 | </v-flex> | 60 | </v-flex> |
61 | <v-flex xs9 sm6 lg8 class="ml-2"> | 61 | <v-flex xs9 sm6 lg8 class="ml-2"> |
62 | <v-select | 62 | <v-select |
63 | :items="getStudentsList" | 63 | :items="getStudentsList" |
64 | label="Select your student" | 64 | label="Select your student" |
65 | v-model="getReport.studentId" | 65 | v-model="getReport.studentId" |
66 | item-text="name" | 66 | item-text="name" |
67 | item-value="_id" | 67 | item-value="_id" |
68 | :rules="studentRules" | 68 | :rules="studentRules" |
69 | required | 69 | required |
70 | ></v-select> | 70 | ></v-select> |
71 | </v-flex> | 71 | </v-flex> |
72 | </v-layout> | 72 | </v-layout> |
73 | </v-flex> | 73 | </v-flex> |
74 | <v-flex xs12 sm12 lg3> | 74 | <v-flex xs12 sm12 lg3> |
75 | <v-btn | 75 | <v-btn |
76 | @click="getMarkReportList" | 76 | @click="getMarkReportList" |
77 | round | 77 | round |
78 | dark | 78 | dark |
79 | :loading="loading" | 79 | :loading="loading" |
80 | class="right mt-3" | 80 | class="right mt-3" |
81 | >Get Report</v-btn> | 81 | >Get Report</v-btn> |
82 | </v-flex> | 82 | </v-flex> |
83 | </v-layout> | 83 | </v-layout> |
84 | </v-flex> | 84 | </v-flex> |
85 | </v-form> | 85 | </v-form> |
86 | </v-card> | 86 | </v-card> |
87 | <v-container grid-list-md v-show="showReport"> | 87 | <v-container grid-list-md v-show="showReport"> |
88 | <!-- {{ filterData }} --> | 88 | <!-- {{ filterData }} --> |
89 | <v-layout> | 89 | <v-layout> |
90 | <v-flex xs12 sm12 v-if="filterData != {}"> | 90 | <v-flex xs12 sm12 v-if="filterData != {}"> |
91 | <v-btn class="grey" dark @click="print()"> | 91 | <v-btn class="grey" dark @click="print()"> |
92 | 92 | ||
93 | <v-icon right dark>print</v-icon> | 93 | <v-icon right dark>print</v-icon> |
94 | </v-btn> | 94 | </v-btn> |
95 | </v-flex> | 95 | </v-flex> |
96 | </v-layout> | 96 | </v-layout> |
97 | <v-flex xs12 sm12 id="printMe"> | 97 | <v-flex xs12 sm12 id="printMe"> |
98 | <v-layout wrap> | 98 | <v-layout wrap> |
99 | <!-- ****** TABLE DATA MARK ****** --> | 99 | <!-- ****** TABLE DATA MARK ****** --> |
100 | <v-flex xs12 sm12 md12> | 100 | <v-flex xs12 sm12 md12> |
101 | <v-card | 101 | <v-card |
102 | v-for="(value, id, index) in filterData" | 102 | v-for="(value, id, index) in filterData" |
103 | :key="index" | 103 | :key="index" |
104 | flat | 104 | flat |
105 | style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px" | 105 | style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px" |
106 | > | 106 | > |
107 | <!-- {{ value[index] }} --> | 107 | <v-layout v-if="index === 0"> |
108 | <v-layout v-if="value[0] === 0"> | ||
109 | <v-flex xs12 style="border-bottom: 1px solid #707478;padding-bottom:6px !important"> | 108 | <v-flex xs12 style="border-bottom: 1px solid #707478;padding-bottom:6px !important"> |
110 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" width="100" /> | 109 | <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" width="100" /> |
111 | <img src="/static/icon/user.png" v-else-if="!userData.schoolLogoUrl" width="100" /> | 110 | <img src="/static/icon/user.png" v-else-if="!userData.schoolLogoUrl" width="100" /> |
112 | </v-flex> | 111 | </v-flex> |
113 | </v-layout> | 112 | </v-layout> |
114 | <v-layout style="padding-top:10px" v-if="value[0] === 0"> | 113 | <v-layout style="padding-top:10px" v-if="index === 0"> |
115 | <v-flex xs5> | 114 | <v-flex xs5> |
116 | <p style="margin:0px;margin-bottom:4px"> | 115 | <p style="margin:0px;margin-bottom:4px"> |
117 | <span style="font-size:20px">{{ userData.name }}</span> | 116 | <span style="font-size:20px">{{ userData.name }}</span> |
118 | <br /> | 117 | <br /> |
119 | <span style="font-size: 15px;color: #707478;">{{ userData.address }}</span> | 118 | <span style="font-size: 15px;color: #707478;">{{ userData.address }}</span> |
120 | </p> | 119 | </p> |
121 | <p | 120 | <p |
122 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" | 121 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" |
123 | >phone : {{ userData.mobile }}</p> | 122 | >phone : {{ userData.mobile }}</p> |
124 | <p | 123 | <p |
125 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" | 124 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" |
126 | >Email : {{ userData.email }}</p> | 125 | >Email : {{ userData.email }}</p> |
127 | </v-flex> | 126 | </v-flex> |
128 | <v-flex xs5> | 127 | <v-flex xs5> |
129 | <p | 128 | <p |
130 | style="font-size:20px;margin:0px;margin-bottom:4px;" | 129 | style="font-size:20px;margin:0px;margin-bottom:4px;" |
131 | >{{ value[0].studentId.name }}</p> | 130 | >{{ value[0].studentId.name }}</p> |
132 | <p | 131 | <p |
133 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" | 132 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" |
134 | >Class : {{ value[0].classId.classNum }}</p> | 133 | >Class : {{ value[0].classId.classNum }}</p> |
135 | <p | 134 | <p |
136 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" | 135 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" |
137 | >Roll NO : {{ value[0].studentId.rollNo }}</p> | 136 | >Roll NO : {{ value[0].studentId.rollNo }}</p> |
138 | <p | 137 | <p |
139 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" | 138 | style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;" |
140 | >Section : {{ value[0].sectionId.name }}</p> | 139 | >Section : {{ value[0].sectionId.name }}</p> |
141 | </v-flex> | 140 | </v-flex> |
142 | <v-flex xs2> | 141 | <v-flex xs2> |
143 | <v-avatar size="100"> | 142 | <v-avatar size="100"> |
144 | <img | 143 | <img |
145 | :src="value[0].studentId.profilePicUrl" | 144 | :src="value[0].studentId.profilePicUrl" |
146 | v-if="value[0].studentId.profilePicUrl" | 145 | v-if="value[0].studentId.profilePicUrl" |
147 | width="100px" | 146 | width="100px" |
148 | /> | 147 | /> |
149 | <img | 148 | <img |
150 | src="/static/icon/user.png" | 149 | src="/static/icon/user.png" |
151 | v-else-if="!value[0].studentId.profilePicUrl" | 150 | v-else-if="!value[0].studentId.profilePicUrl" |
152 | width="100px" | 151 | width="100px" |
153 | /> | 152 | /> |
154 | </v-avatar> | 153 | </v-avatar> |
155 | </v-flex> | 154 | </v-flex> |
156 | </v-layout> | 155 | </v-layout> |
157 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> | 156 | <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> |
158 | <table | 157 | <table |
159 | class="mb-5 tableRsponsive feeTypeTable" | 158 | class="mb-5 tableRsponsive feeTypeTable" |
160 | style="border: 1px solid lightgrey; | 159 | style="border: 1px solid lightgrey; |
161 | border-collapse: collapse;!important | 160 | border-collapse: collapse;!important |
162 | table-layout: auto !important; | 161 | table-layout: auto !important; |
163 | width: 100% !important;" | 162 | width: 100% !important;" |
164 | > | 163 | > |
165 | <thead style="border: 1px solid lightgrey !important;"> | 164 | <thead style="border: 1px solid lightgrey !important;"> |
166 | <tr style="border: 1px solid lightgrey !important;padding:4px;"> | 165 | <tr style="border: 1px solid lightgrey !important;padding:4px;"> |
167 | <td | 166 | <td |
168 | rowspan="2" | 167 | rowspan="2" |
169 | style="border: 1px solid lightgrey !important;padding: 10px;" | 168 | style="border: 1px solid lightgrey !important;padding: 10px;" |
170 | >Subject</td> | 169 | >Subject</td> |
171 | <!-- <template v-for="(exam,i) in value[index].studentsMarks"> | 170 | <!-- <template v-for="(exam,i) in value[index].studentsMarks"> |
172 | <td | 171 | <td |
173 | colspan="2" | 172 | colspan="2" |
174 | style="border: 1px solid lightgrey !important;padding: 10px;" | 173 | style="border: 1px solid lightgrey !important;padding: 10px;" |
175 | >{{ exam.markDistributionId.distributionType }}</td> | 174 | >{{ exam.markDistributionId.distributionType }}</td> |
176 | </template>--> | 175 | </template>--> |
177 | <template v-for="values in value"> | 176 | <template v-for="studentData in value"> |
178 | <td | 177 | <td |
179 | colspan="2" | 178 | colspan="2" |
180 | v-for="studentData in values.studentsMarks" | 179 | v-for="studentMark in studentData.studentsMarks" |
181 | >{{ studentData.markDistributionId.distributionType }}</td> | 180 | >{{ studentMark.markDistributionId.distributionType }}</td> |
182 | </template> | 181 | </template> |
183 | <!-- <td>{{value[0].studentsMarks[1].markDistributionId.distributionType}}</td> --> | 182 | <!-- <td>{{value[0].studentsMarks[1].markDistributionId.distributionType}}</td> --> |
184 | 183 | ||
185 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Total</td> | 184 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Total</td> |
186 | </tr> | 185 | </tr> |
187 | <tr | 186 | <tr |
188 | v-for="(subject, ind) in value" | 187 | v-for="(subject, ind) in value" |
189 | v-if="ind == 0" | 188 | v-if="ind == 0" |
190 | style="border: 1px solid lightgrey !important;" | 189 | style="border: 1px solid lightgrey !important;" |
191 | > | 190 | > |
192 | <template v-for="(exam, i) in subject.studentsMarks"> | 191 | <template v-for="(exam, i) in subject.studentsMarks"> |
193 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td> | 192 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td> |
194 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Highest Mark</td> | 193 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Highest Mark</td> |
195 | </template> | 194 | </template> |
196 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td> | 195 | <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td> |
197 | </tr> | 196 | </tr> |
198 | </thead> | 197 | </thead> |
199 | <tbody style="border: 1px solid lightgrey !important;"> | 198 | <tbody style="border: 1px solid lightgrey !important;"> |
200 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> | 199 | <tr v-for="subject in value" style="border: 1px solid lightgrey !important;"> |
201 | <td | 200 | <td |
202 | style="border: 1px solid lightgrey !important;padding: 10px;" | 201 | style="border: 1px solid lightgrey !important;padding: 10px;" |
203 | >{{subject.subjectName}}</td> | 202 | >{{subject.subjectName}}</td> |
204 | <template v-for="(exam, i) in subject.studentsMarks"> | 203 | <template v-for="(exam, i) in subject.studentsMarks"> |
205 | <td | 204 | <td |
206 | style="border: 1px solid lightgrey !important;padding: 10px;" | 205 | style="border: 1px solid lightgrey !important;padding: 10px;" |
207 | >{{exam.marksScored}}</td> | 206 | >{{exam.marksScored}}</td> |
208 | <td | 207 | <td |
209 | style="border: 1px solid lightgrey !important;padding: 10px;" | 208 | style="border: 1px solid lightgrey !important;padding: 10px;" |
210 | >{{exam.markDistributionId.markValue}}</td> | 209 | >{{exam.markDistributionId.markValue}}</td> |
211 | </template> | 210 | </template> |
212 | <td | 211 | <td |
213 | style="border: 1px solid lightgrey !important;padding: 10px;" | 212 | style="border: 1px solid lightgrey !important;padding: 10px;" |
214 | >{{subject.totalMarks}}</td> | 213 | >{{subject.totalMarks}}</td> |
215 | </tr> | 214 | </tr> |
216 | </tbody> | 215 | </tbody> |
217 | <!-- <tfoot> | 216 | <!-- <tfoot> |
218 | <tr> | 217 | <tr> |
219 | <td colspan="4"> | 218 | <td colspan="4"> |
220 | <span class="right subheding">Total Amount (RS) :</span> | 219 | <span class="right subheding">Total Amount (RS) :</span> |
221 | </td> | 220 | </td> |
222 | <td>{{ feeType.subTotal }}</td> | 221 | <td>{{ feeType.subTotal }}</td> |
223 | </tr> | 222 | </tr> |
224 | <tr> | 223 | <tr> |
225 | <td colspan="4"> | 224 | <td colspan="4"> |
226 | <span class="right subheding">Paid (RS) :</span> | 225 | <span class="right subheding">Paid (RS) :</span> |
227 | </td> | 226 | </td> |
228 | <td>{{ feeType.totalPaidAmount ? feeType.totalPaidAmount : 0 }}</td> | 227 | <td>{{ feeType.totalPaidAmount ? feeType.totalPaidAmount : 0 }}</td> |
229 | </tr> | 228 | </tr> |
230 | <tr> | 229 | <tr> |
231 | <td colspan="4"> | 230 | <td colspan="4"> |
232 | <span class="right subheding">Balance (RS) :</span> | 231 | <span class="right subheding">Balance (RS) :</span> |
233 | </td> | 232 | </td> |
234 | <td>{{ feeType.totalPaidAmount ? feeType.subTotal - feeType.totalPaidAmount : feeType.subTotal }}</td> | 233 | <td>{{ feeType.totalPaidAmount ? feeType.subTotal - feeType.totalPaidAmount : feeType.subTotal }}</td> |
235 | </tr> | 234 | </tr> |
236 | </tfoot>--> | 235 | </tfoot>--> |
237 | </table> | 236 | </table> |
238 | </v-card> | 237 | </v-card> |
239 | </v-flex> | 238 | </v-flex> |
240 | </v-layout> | 239 | </v-layout> |
241 | </v-flex> | 240 | </v-flex> |
242 | </v-container> | 241 | </v-container> |
243 | <div class="loader" v-if="showLoader"> | 242 | <div class="loader" v-if="showLoader"> |
244 | <v-progress-circular indeterminate color="white"></v-progress-circular> | 243 | <v-progress-circular indeterminate color="white"></v-progress-circular> |
245 | </div> | 244 | </div> |
246 | </v-app> | 245 | </v-app> |
247 | </template> | 246 | </template> |
248 | 247 | ||
249 | <script> | 248 | <script> |
250 | import http from "@/Services/http.js"; | 249 | import http from "@/Services/http.js"; |
251 | import moment from "moment"; | 250 | import moment from "moment"; |
252 | import _ from "underscore"; | 251 | import _ from "underscore"; |
253 | 252 | ||
254 | export default { | 253 | export default { |
255 | data: () => ({ | 254 | data: () => ({ |
256 | showLoader: false, | 255 | showLoader: false, |
257 | markData: [], | 256 | markData: [], |
258 | token: "", | 257 | token: "", |
259 | markDistributions: [], | 258 | markDistributions: [], |
260 | markParticularDistributionData: [], | 259 | markParticularDistributionData: [], |
261 | loading: false, | 260 | loading: false, |
262 | valid: true, | 261 | valid: true, |
263 | loading: false, | 262 | loading: false, |
264 | showReport: false, | 263 | showReport: false, |
265 | addSection: [], | 264 | addSection: [], |
266 | filterData: [], | 265 | filterData: [], |
267 | getStudentsList: [], | 266 | getStudentsList: [], |
268 | classRules: [v => !!v || "Class is required"], | 267 | classRules: [v => !!v || "Class is required"], |
269 | sectionRules: [v => !!v || "Class is required"], | 268 | sectionRules: [v => !!v || "Class is required"], |
270 | studentRules: [v => !!v || "Student is required"], | 269 | studentRules: [v => !!v || "Student is required"], |
271 | getReport: {}, | 270 | getReport: {}, |
272 | classList: [], | 271 | classList: [], |
273 | output: null, | 272 | output: null, |
274 | userData: {} | 273 | userData: {} |
275 | }), | 274 | }), |
276 | mounted() { | 275 | mounted() { |
277 | this.token = this.$store.state.token; | 276 | this.token = this.$store.state.token; |
278 | this.getClass(); | 277 | this.getClass(); |
279 | this.getUserData(); | 278 | this.getUserData(); |
280 | }, | 279 | }, |
281 | methods: { | 280 | methods: { |
282 | clear() { | 281 | clear() { |
283 | this.$refs.form.reset(); | 282 | this.$refs.form.reset(); |
284 | }, | 283 | }, |
285 | getClass() { | 284 | getClass() { |
286 | this.showLoader = true; | 285 | this.showLoader = true; |
287 | http() | 286 | http() |
288 | .get("/getClassesList", { | 287 | .get("/getClassesList", { |
289 | headers: { Authorization: "Bearer " + this.token } | 288 | headers: { Authorization: "Bearer " + this.token } |
290 | }) | 289 | }) |
291 | .then(response => { | 290 | .then(response => { |
292 | this.classList = response.data.data; | 291 | this.classList = response.data.data; |
293 | this.showLoader = false; | 292 | this.showLoader = false; |
294 | }) | 293 | }) |
295 | .catch(error => { | 294 | .catch(error => { |
296 | this.showLoader = false; | 295 | this.showLoader = false; |
297 | // console.log("err====>", err); | 296 | // console.log("err====>", err); |
298 | }); | 297 | }); |
299 | }, | 298 | }, |
300 | getSections(_id) { | 299 | getSections(_id) { |
301 | this.showLoader = true; | 300 | this.showLoader = true; |
302 | http() | 301 | http() |
303 | .get( | 302 | .get( |
304 | "/getSectionsList", | 303 | "/getSectionsList", |
305 | { params: { classId: _id } }, | 304 | { params: { classId: _id } }, |
306 | { | 305 | { |
307 | headers: { Authorization: "Bearer " + this.token } | 306 | headers: { Authorization: "Bearer " + this.token } |
308 | } | 307 | } |
309 | ) | 308 | ) |
310 | .then(response => { | 309 | .then(response => { |
311 | this.addSection = response.data.data; | 310 | this.addSection = response.data.data; |
312 | this.showLoader = false; | 311 | this.showLoader = false; |
313 | }) | 312 | }) |
314 | .catch(err => { | 313 | .catch(err => { |
315 | this.showLoader = false; | 314 | this.showLoader = false; |
316 | // console.log("err====>", err); | 315 | // console.log("err====>", err); |
317 | }); | 316 | }); |
318 | }, | 317 | }, |
319 | getStudents() { | 318 | getStudents() { |
320 | this.showLoader = true; | 319 | this.showLoader = true; |
321 | http() | 320 | http() |
322 | .get("/getStudentWithClass", { | 321 | .get("/getStudentWithClass", { |
323 | params: { | 322 | params: { |
324 | classId: this.getReport.classId, | 323 | classId: this.getReport.classId, |
325 | sectionId: this.getReport.sectionId | 324 | sectionId: this.getReport.sectionId |
326 | } | 325 | } |
327 | }) | 326 | }) |
328 | .then(response => { | 327 | .then(response => { |
329 | this.getStudentsList = response.data.data; | 328 | this.getStudentsList = response.data.data; |
330 | this.showLoader = false; | 329 | this.showLoader = false; |
331 | // console.log("getSectionsList=====>", response.data.data); | 330 | // console.log("getSectionsList=====>", response.data.data); |
332 | }) | 331 | }) |
333 | .catch(error => { | 332 | .catch(error => { |
334 | console.log("err====>", error); | 333 | console.log("err====>", error); |
335 | this.showLoader = false; | 334 | this.showLoader = false; |
336 | }); | 335 | }); |
337 | }, | 336 | }, |
338 | getMarkReportList() { | 337 | getMarkReportList() { |
339 | // this.showLoader = true; | 338 | // this.showLoader = true; |
340 | this.showReport = true; | 339 | this.showReport = true; |
341 | http() | 340 | http() |
342 | .get("/getParticularMark", { | 341 | .get("/getParticularMark", { |
343 | params: { studentId: this.getReport.studentId }, | 342 | params: { studentId: this.getReport.studentId }, |
344 | headers: { Authorization: "Bearer " + this.token } | 343 | headers: { Authorization: "Bearer " + this.token } |
345 | }) | 344 | }) |
346 | .then(response => { | 345 | .then(response => { |
347 | this.showLoader = false; | 346 | this.showLoader = false; |
348 | let newData = response.data.data; | 347 | let newData = response.data.data; |
349 | // console.log("response", newData); | 348 | // console.log("response", newData); |
350 | for (var i = 0; i < newData.length; i++) { | 349 | for (var i = 0; i < newData.length; i++) { |
351 | newData[i].examination = newData[i].examId._id; | 350 | newData[i].examination = newData[i].examId._id; |
352 | // console.log("newData[i].examination", newData[i].examination); | 351 | // console.log("newData[i].examination", newData[i].examination); |
353 | } | 352 | } |
354 | this.filterData = _.groupBy(newData, ["examination"]); | 353 | this.filterData = _.groupBy(newData, ["examination"]); |
355 | for (let data in this.filterData) { | 354 | for (let data in this.filterData) { |
356 | // console.log("data+++++++++++++++++++++++++++++++++++", data); | 355 | // console.log("data+++++++++++++++++++++++++++++++++++", data); |
357 | 356 | ||
358 | for (let item in this.filterData[data]) { | 357 | for (let item in this.filterData[data]) { |
359 | console.log( | 358 | console.log( |
360 | "filterData[data]==========================>", | 359 | "filterData[data]==========================>", |
361 | this.filterData[data] | 360 | this.filterData[data] |
362 | ); | 361 | ); |
363 | console.log("filterData[item]==========================>", item); | 362 | console.log("filterData[item]==========================>", item); |
364 | var totalMarks = 0; | 363 | var totalMarks = 0; |
365 | for ( | 364 | for ( |
366 | let i = 0; | 365 | let i = 0; |
367 | i < this.filterData[data][item].studentsMarks.length; | 366 | i < this.filterData[data][item].studentsMarks.length; |
368 | i++ | 367 | i++ |
369 | ) { | 368 | ) { |
370 | totalMarks += this.filterData[data][item].studentsMarks[i] | 369 | totalMarks += this.filterData[data][item].studentsMarks[i] |
371 | .marksScored; | 370 | .marksScored; |
372 | } | 371 | } |
373 | this.filterData[data][item].totalMarks = totalMarks; | 372 | this.filterData[data][item].totalMarks = totalMarks; |
374 | // var total = 0; | 373 | // var total = 0; |
375 | // total += this.filterData[data][item].totalMarks ; | 374 | // total += this.filterData[data][item].totalMarks ; |
376 | // console.log("total", total); | 375 | // console.log("total", total); |
377 | } | 376 | } |
378 | } | 377 | } |
379 | }) | 378 | }) |
380 | .catch(error => { | 379 | .catch(error => { |
381 | // console.log("err====>", err); | 380 | // console.log("err====>", err); |
382 | this.showLoader = false; | 381 | this.showLoader = false; |
383 | this.snackbar = true; | 382 | this.snackbar = true; |
384 | this.text = error.response.data.message; | 383 | this.text = error.response.data.message; |
385 | if (error.response.status === 401) { | 384 | if (error.response.status === 401) { |
386 | this.$router.replace({ path: "/" }); | 385 | this.$router.replace({ path: "/" }); |
387 | this.$store.dispatch("setToken", null); | 386 | this.$store.dispatch("setToken", null); |
388 | this.$store.dispatch("Id", null); | 387 | this.$store.dispatch("Id", null); |
389 | } | 388 | } |
390 | }); | 389 | }); |
391 | }, | 390 | }, |
392 | print() { | 391 | print() { |
393 | // Pass the element id here | 392 | // Pass the element id here |
394 | this.$htmlToPaper("printMe"); | 393 | this.$htmlToPaper("printMe"); |
395 | }, | 394 | }, |
396 | getUserData() { | 395 | getUserData() { |
397 | http() | 396 | http() |
398 | .get("/getParticularUserDetail") | 397 | .get("/getParticularUserDetail") |
399 | .then(response => { | 398 | .then(response => { |
400 | this.userData = response.data.data; | 399 | this.userData = response.data.data; |
401 | }) | 400 | }) |
402 | .catch(error => { | 401 | .catch(error => { |
403 | if (error.response.status === 401) { | 402 | if (error.response.status === 401) { |
404 | this.$router.replace({ path: "/" }); | 403 | this.$router.replace({ path: "/" }); |
405 | this.$store.dispatch("setToken", null); | 404 | this.$store.dispatch("setToken", null); |
406 | this.$store.dispatch("Id", null); | 405 | this.$store.dispatch("Id", null); |
407 | } | 406 | } |
408 | }); | 407 | }); |
409 | } | 408 | } |
410 | } | 409 | } |
411 | }; | 410 | }; |
412 | </script> | 411 | </script> |
413 | 412 | ||
414 | <style scoped> | 413 | <style scoped> |
415 | table { | 414 | table { |
416 | border-collapse: collapse; | 415 | border-collapse: collapse; |
417 | border: 1px solid #e2e7eb; | 416 | border: 1px solid #e2e7eb; |
418 | } | 417 | } |
419 | 418 | ||
420 | th, | 419 | th, |
421 | td { | 420 | td { |
422 | border: 1px solid #e2e7eb; | 421 | border: 1px solid #e2e7eb; |
423 | padding: 10px; | 422 | padding: 10px; |
424 | text-align: center; | 423 | text-align: center; |
425 | } | 424 | } |
426 | table.feeTypeTable { | 425 | table.feeTypeTable { |
427 | table-layout: auto !important; | 426 | table-layout: auto !important; |
428 | width: 100% !important; | 427 | width: 100% !important; |
429 | } | 428 | } |
430 | .bg-sky { | 429 | .bg-sky { |
431 | background-color: #98b2cc !important; | 430 | background-color: #98b2cc !important; |
432 | } | 431 | } |
433 | .bg-sky-light { | 432 | .bg-sky-light { |
434 | background-color: #89a0b8; | 433 | background-color: #89a0b8; |
435 | } | 434 | } |
436 | .bg-purple { | 435 | .bg-purple { |
437 | background-color: #9583ac; | 436 | background-color: #9583ac; |
438 | } | 437 | } |
439 | .bg-skyDark { | 438 | .bg-skyDark { |
440 | background-color: #956785; | 439 | background-color: #956785; |
441 | } | 440 | } |
442 | @media screen and (max-width: 380px) { | 441 | @media screen and (max-width: 380px) { |
443 | .tableRsponsive { | 442 | .tableRsponsive { |
444 | display: block; | 443 | display: block; |
445 | position: relative; | 444 | position: relative; |
446 | overflow: scroll; | 445 | overflow: scroll; |
447 | } | 446 | } |
448 | } | 447 | } |
449 | </style> s | 448 | </style> s |
src/script/users.js
1 | export default () => { | 1 | export default () => { |
2 | 2 | ||
3 | const users = [{ | 3 | const users = [{ |
4 | "name": "Neeraj", | 4 | "name": "Neeraj", |
5 | "email": "neeraj.sharma@viithiisys.com", | 5 | "email": "neeraj.sharma@viithiisys.com", |
6 | "dob": "1995-01-14", | 6 | "dob": "1995-01-14", |
7 | "gender": "Male", | 7 | "gender": "Male", |
8 | "role": "LIBRARIAN", | ||
8 | "religion": "Hindu", | 9 | "religion": "Hindu", |
9 | "address": "Mohali", | 10 | "address": "Mohali", |
10 | "phone": "1234567890", | 11 | "phone": "1234567890", |
11 | "joiningDate": "2016-08-17", | 12 | "joiningDate": "2016-08-17", |
12 | }, | 13 | }, |
13 | { | 14 | { |
14 | "name": "Rishav", | 15 | "name": "Rishav", |
15 | "email": "rishav.singla@viithiisys.com", | 16 | "email": "rishav.singla@viithiisys.com", |
16 | "dob": "1995-01-14", | 17 | "dob": "1995-01-14", |
17 | "gender": "Male", | 18 | "gender": "Male", |
19 | "role": "ACCOUNTANT", | ||
18 | "religion": "Hindu", | 20 | "religion": "Hindu", |
19 | "address": "Punjab", | 21 | "address": "Punjab", |
20 | "phone": "9878768790", | 22 | "phone": "9878768790", |
21 | "joiningDate": "2016-08-17", | 23 | "joiningDate": "2016-08-17", |
22 | } | 24 | } |
23 | ] | 25 | ] |
24 | return users; | 26 | return users; |
25 | 27 | ||
26 | } | 28 | } |