Blame view

src/pages/Report/progressCardReport.vue 14.9 KB
006544386   Neeraj Sharma   implement task
1
2
  <template>
    <v-app id="pages-dasboard">
495e4037c   Neeraj Sharma   update
3
      <!-- ******  Progress Card Report Table****** -->
006544386   Neeraj Sharma   implement task
4
5
6
      <v-card flat>
        <v-card-actions>
          <v-layout>
495e4037c   Neeraj Sharma   update
7
            <h4 class="ml-2">Progress Card Report</h4>
006544386   Neeraj Sharma   implement task
8
          </v-layout>
006544386   Neeraj Sharma   implement task
9
10
11
        </v-card-actions>
      </v-card>
      <v-card flat>
495e4037c   Neeraj Sharma   update
12
13
14
15
16
17
18
19
        <v-form ref="form" v-model="valid" lazy-validation>
          <v-flex xs12 sm12 lg12>
            <v-layout wrap>
              <v-flex xs12 sm12 lg3>
                <v-layout>
                  <v-flex xs3 sm6 lg2 class="subheading mt-4">
                    <label class="right">Class:</label>
                  </v-flex>
79583580d   Neeraj Sharma   implement task ma...
20
                  <v-flex xs9 sm6 lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
                    <v-select
                      v-model="getReport.classId"
                      label="Select your class"
                      type="text"
                      :items="classList"
                      item-text="classNum"
                      item-value="_id"
                      :rules="classRules"
                      @change="getSections(getReport.classId)"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12 lg3>
                <v-layout>
                  <v-flex xs3 sm6 lg2 class="subheading mt-4">
                    <label class="right">Section:</label>
                  </v-flex>
79583580d   Neeraj Sharma   implement task ma...
40
                  <v-flex xs9 sm6 lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
                    <v-select
                      :items="addSection"
                      label="Select your Section"
                      v-model="getReport.sectionId"
                      item-text="name"
                      item-value="_id"
                      name="Select Section"
                      @change="getStudents"
                      :rules="sectionRules"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12 lg3>
                <v-layout>
                  <v-flex xs3 sm6 lg2 class="subheading mt-4">
                    <label class="right">Student:</label>
                  </v-flex>
79583580d   Neeraj Sharma   implement task ma...
60
                  <v-flex xs9 sm6  lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
61
62
63
64
65
66
67
68
69
70
71
72
73
                    <v-select
                      :items="getStudentsList"
                      label="Select your student"
                      v-model="getReport.studentId"
                      item-text="name"
                      item-value="_id"
                      :rules="studentRules"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12 lg3>
79583580d   Neeraj Sharma   implement task ma...
74
75
76
77
78
79
80
                <v-btn
                  @click="getMarkReportList"
                  round
                  dark
                  :loading="loading"
                  class="right mt-3"
                >Get Report</v-btn>
495e4037c   Neeraj Sharma   update
81
82
83
84
              </v-flex>
            </v-layout>
          </v-flex>
        </v-form>
006544386   Neeraj Sharma   implement task
85
      </v-card>
79583580d   Neeraj Sharma   implement task ma...
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
      <!-- ****** PROFILE MARK  ****** -->
  
      <v-container fluid grid-list-md v-if="showReport">
        <v-flex xs12 sm12>
          <v-container fluid>
            <v-layout wrap>
              <v-flex xs12 sm12 md3 class="mt-4">
                <v-card flat>
                  <v-toolbar dark class="fixcolors" flat>
                    <v-spacer></v-spacer>
                    <v-toolbar-title>
                      <h3>Profile</h3>
                    </v-toolbar-title>
                    <v-spacer></v-spacer>
                  </v-toolbar>
                  <v-card-text>
                    <v-container>
                      <v-layout wrap v-for="(value, id, index) in filterData" v-if="index == 0">
                        <v-flex xs12>
                          <v-layout>
                            <v-flex
                              xs12
                              class="text-xs-center text-sm-center text-md-center text-lg-center"
                            >
                              <v-avatar size="100px">
                                <img
                                  src="/static/icon/user.png"
                                  v-if="!value[0].studentId.profilePicUrl"
                                />
                                <img
                                  :src="value[0].studentId.profilePicUrl"
                                  v-else-if="value[0].studentId.profilePicUrl"
                                />
                              </v-avatar>
                            </v-flex>
                          </v-layout>
                          <v-layout>
                            <v-flex xs12 sm12>
                              <h3 class="text-xs-center">
                                <b>{{ value[0].studentId.name }}</b>
                              </h3>
                              <p class="text-xs-center grey--text">Student</p>
                            </v-flex>
                          </v-layout>
                          <v-layout style="border: 1px solid lightgrey;">
                            <v-flex xs6 sm6>
                              <h4 class="right py-0">
                                <b>Roll No:</b>
                              </h4>
                            </v-flex>
                            <v-flex sm6 xs6 >
                              <h4 class="py-0">{{ value[0].studentId.rollNo }}</h4>
                            </v-flex>
                          </v-layout>
                          <v-layout style="border: 1px solid lightgrey;" >
                            <v-flex xs6 sm6>
                              <h4 class="right py-0">
                                <b>Class:</b>
                              </h4>
                            </v-flex>
                            <v-flex sm6 xs6>
                              <h4 class="py-0">{{value[0].classId.classNum }}</h4>
                            </v-flex>
                          </v-layout>
                          <v-layout style="border: 1px solid lightgrey;">
                            <v-flex xs6 sm6 class="right">
                              <h4 class="right py-0">
                                <b>Section:</b>
                              </h4>
                            </v-flex>
                            <v-flex sm6 xs6 class="right">
                              <h4 class="py-0">{{ value[0].sectionId.name}}</h4>
                            </v-flex>
                          </v-layout>
                        </v-flex>
                      </v-layout>
                    </v-container>
                  </v-card-text>
                </v-card>
              </v-flex>
  
              <!-- ****** TABLE DATA MARK  ****** -->
  
              <v-flex xs12 sm12 md9 class="mt-4">
                <v-toolbar dark class="fixcolors" flat>
                  <v-spacer></v-spacer>
                  <v-toolbar-title>
                    <h3>Mark</h3>
                  </v-toolbar-title>
                  <v-spacer></v-spacer>
                </v-toolbar>
                <v-card v-for="(value, id, index) in filterData">
                  <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title>
                  <table class="mb-4 tableRsponsive feeTypeTable">
                    <thead>
                      <tr class="info white--text">
                        <td rowspan="2">Subject</td>
                        <td
                          colspan="2"
                          v-for="exam in value[index].studentsMarks"
                        >{{exam.markDistributionId.distributionType}}</td>
                        <td>Total</td>
                      </tr>
                      <tr v-for="(subject, ind) in value" v-if="ind == 0">
                        <template v-for="(exam, i) in subject.studentsMarks">
                          <td class="bg-sky white--text">Mark</td>
                          <td class="bg-sky-light white--text">Highest Mark</td>
                        </template>
                        <td class="bg-sky white--text">Mark</td>
                      </tr>
                    </thead>
                    <tbody>
                      <tr v-for="subject in value">
                        <td>{{subject.subjectName}}</td>
                        <template v-for="(exam, i) in subject.studentsMarks">
                          <td>{{exam.marksScored}}</td>
                          <td>{{exam.markDistributionId.markValue}}</td>
                        </template>
                        <td>{{subject.totalMarks}}</td>
                      </tr>
                    </tbody>
                  </table>
                </v-card>
              </v-flex>
            </v-layout>
          </v-container>
        </v-flex>
      </v-container>
006544386   Neeraj Sharma   implement task
214
215
216
217
218
219
220
221
222
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-app>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
79583580d   Neeraj Sharma   implement task ma...
223
  import _ from "underscore";
006544386   Neeraj Sharma   implement task
224
225
226
  
  export default {
    data: () => ({
006544386   Neeraj Sharma   implement task
227
      showLoader: false,
79583580d   Neeraj Sharma   implement task ma...
228
229
230
231
232
      markData: [],
      token: "",
      markDistributions: [],
      markParticularDistributionData: [],
      loading: false,
495e4037c   Neeraj Sharma   update
233
      valid: true,
79583580d   Neeraj Sharma   implement task ma...
234
235
      loading: false,
      showReport: false,
006544386   Neeraj Sharma   implement task
236
      addSection: [],
79583580d   Neeraj Sharma   implement task ma...
237
238
      filterData: [],
      getStudentsList: [],
495e4037c   Neeraj Sharma   update
239
240
241
      classRules: [v => !!v || "Class is required"],
      sectionRules: [v => !!v || "Class is required"],
      studentRules: [v => !!v || "Student is required"],
495e4037c   Neeraj Sharma   update
242
      getReport: {},
79583580d   Neeraj Sharma   implement task ma...
243
      classList: []
006544386   Neeraj Sharma   implement task
244
    }),
79583580d   Neeraj Sharma   implement task ma...
245
246
247
248
    mounted() {
      this.token = this.$store.state.token;
      this.getClass();
    },
006544386   Neeraj Sharma   implement task
249
    methods: {
495e4037c   Neeraj Sharma   update
250
251
252
      clear() {
        this.$refs.form.reset();
      },
006544386   Neeraj Sharma   implement task
253
254
255
256
257
258
259
260
261
262
263
264
265
      getClass() {
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classList = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
006544386   Neeraj Sharma   implement task
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + this.token }
            }
          )
          .then(response => {
            this.addSection = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
          });
      },
      getStudents() {
        this.showLoader = true;
        http()
          .get("/getStudentWithClass", {
            params: {
495e4037c   Neeraj Sharma   update
286
287
              classId: this.getReport.classId,
              sectionId: this.getReport.sectionId
006544386   Neeraj Sharma   implement task
288
289
290
291
292
293
294
295
296
297
298
299
            }
          })
          .then(response => {
            this.getStudentsList = response.data.data;
            this.showLoader = false;
            console.log("getSectionsList=====>", response.data.data);
          })
          .catch(error => {
            console.log("err====>", error);
            this.showLoader = false;
          });
      },
79583580d   Neeraj Sharma   implement task ma...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
      getMarkReportList() {
        this.showLoader = false;
        this.showReport = true;
        http()
          .get("/getParticularMark", {
            params: { studentId: this.getReport.studentId },
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            let newData = response.data.data;
            for (var i = 0; i < newData.length; i++) {
              newData[i].examination = newData[i].examId._id;
            }
            this.filterData = _.groupBy(newData, ["examination"]);
            console.log("check filtered data", this.filterData);
            for (let data in this.filterData) {
              // console.log("this.filterData[data].length", this.filterData[data]);
              for (let item in this.filterData[data]) {
                // console.log("check", this.filterData[data][item].studentsMarks);
                var totalMarks = 0;
                for (
                  let i = 0;
                  i < this.filterData[data][item].studentsMarks.length;
                  i++
                ) {
                  // console.log(
                  //   "check data",
                  //   this.filterData[data][item].studentsMarks[i]
                  // );
                  totalMarks += this.filterData[data][item].studentsMarks[i]
                    .marksScored;
                }
                this.filterData[data][item].totalMarks = totalMarks;
              }
            }
            // var aray = [];
            // this.markData = response.data.data;
            // for (let i = 0; i < this.markData.length; i++) {
            //   console.log(this.markData[i].examId.examName);
            //   let index = -1;
  
            //   aray.forEach((dat_, k) => {
            //     if (dat_.category == this.markData[i].examId.examName) {
            //       index = k;
            //     }
            //   });
            //   if (index == -1) {
            //     var obj = {
            //       category: this.markData[i].examId.examName,
            //       extraData: []
            //     };
            //     obj.extraData.push(this.markData[i]);
            //     aray.push(obj);
            //   } else {
            //     console.log("=o", this.markData[i]);
            //     //  aray[index].extraData =
  
            //     aray[index].extraData.push(this.markData[i]);
            //   }
            //   console.log("aray-", aray);
  
            // for (let j = 0; j < this.markData[i].studentsMarks.length; j++) {
            //   //  console.log("this.studentsMarksSSSSSSSSSSSSS",this.markData[i].studentsMarks[j].marksObtained)
  
            //   this.markDistributions = this.markData[i].studentsMarks[
            //     j
            //   ].marksObtained;
            //   for (
            //     let k = 0;
            //     k < this.markData[i].studentsMarks[j].marksObtained.length;
            //     k++
            //   ) {
            //     this.markParticularDistributionData.push(
            //       this.markData[i].studentsMarks[j].marksObtained[k].marksScored
            //     );
            //     this.markParticularDistributionData.push(
            //       this.markData[i].studentsMarks[j].marksObtained[k]
            //         .markDistributionId.markValue
            //     );
            //     // console.log(
            //     //   "this.markParticularDistributionData",
            //     //   this.markParticularDistributionData
            //     // );
            //   }
            // }
            // }
            // this.markData = aray;
            // console.log("aray-2", aray);
            // this.showLoader = false;
          })
          .catch(error => {
            // console.log("err====>", err);
            this.showLoader = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
006544386   Neeraj Sharma   implement task
401
      }
006544386   Neeraj Sharma   implement task
402
403
404
    }
  };
  </script>
79583580d   Neeraj Sharma   implement task ma...
405

006544386   Neeraj Sharma   implement task
406
  <style scoped>
79583580d   Neeraj Sharma   implement task ma...
407
408
409
410
411
412
413
414
415
416
  table {
    border-collapse: collapse;
    border: 1px solid #e2e7eb;
  }
  
  th,
  td {
    border: 1px solid #e2e7eb;
    padding: 10px;
    text-align: center;
006544386   Neeraj Sharma   implement task
417
  }
79583580d   Neeraj Sharma   implement task ma...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
  table.feeTypeTable {
    table-layout: auto !important;
    width: 100% !important;
  }
  .bg-sky {
    background-color: #98b2cc !important;
  }
  .bg-sky-light {
    background-color: #89a0b8;
  }
  .bg-purple {
    background-color: #9583ac;
  }
  .bg-skyDark {
    background-color: #956785;
  }
  @media screen and (max-width: 380px) {
    .tableRsponsive {
      display: block;
      position: relative;
      overflow: scroll;
    }
006544386   Neeraj Sharma   implement task
440
  }
79583580d   Neeraj Sharma   implement task ma...
441
  </style> s