Blame view

src/pages/Report/progressCardReport.vue 16.9 KB
006544386   Neeraj Sharma   implement task
1
  <template>
68d742034   Neeraj Sharma   implement new des...
2
    <v-container fluid class="body-color">
495e4037c   Neeraj Sharma   update
3
      <!-- ******  Progress Card Report Table****** -->
68d742034   Neeraj Sharma   implement new des...
4
      <v-card flat class="elevation-0 transparent">
495e4037c   Neeraj Sharma   update
5
6
7
8
9
10
11
12
        <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...
13
                  <v-flex xs9 sm6 lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
                    <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...
33
                  <v-flex xs9 sm6 lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
                    <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>
ec5677f43   Neeraj Sharma   implement print o...
53
                  <v-flex xs9 sm6 lg8 class="ml-2">
495e4037c   Neeraj Sharma   update
54
55
56
57
58
59
60
61
62
63
64
65
                    <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>
d4735dce7   Shikha Mishra   show school logo ...
66
              <v-flex xs12 sm12 lg3 class="hidden-xs-only hidden-sm-only pl-5">
79583580d   Neeraj Sharma   implement task ma...
67
68
69
70
71
                <v-btn
                  @click="getMarkReportList"
                  round
                  dark
                  :loading="loading"
d4735dce7   Shikha Mishra   show school logo ...
72
                  class="open-dialog-button mt-3 ml-5"
79583580d   Neeraj Sharma   implement task ma...
73
                >Get Report</v-btn>
495e4037c   Neeraj Sharma   update
74
75
76
77
              </v-flex>
            </v-layout>
          </v-flex>
        </v-form>
006544386   Neeraj Sharma   implement task
78
      </v-card>
d4735dce7   Shikha Mishra   show school logo ...
79
80
81
82
83
84
85
86
87
88
89
      <v-layout v-show="showReport">
        <v-flex xs12>
          <v-card class="transparent elevation-0">
            <v-layout>
              <v-flex xs12>
                <v-btn class="open-dialog-button right" round dark @click="printProgressReport()">
                  Print
                  <v-icon right dark>print</v-icon>
                </v-btn>
              </v-flex>
            </v-layout>
46993dc1d   Shikha Mishra   solve issue login
90
            <v-container grid-list-md v-show="showReport" class="report">
d4735dce7   Shikha Mishra   show school logo ...
91
92
93
94
95
96
97
              <v-flex xs12 sm12 id="printMe">
                <v-layout wrap>
                  <!-- ****** TABLE DATA MARK  ****** -->
                  <v-flex xs12 sm12 md12>
                    <v-card
                      v-for="(value, id, index) in filterData"
                      :key="index"
710438de6   Shikha Mishra   added teacher mod...
98
                      :items="newData"
d4735dce7   Shikha Mishra   show school logo ...
99
100
                      flat
                      style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px"
ec5677f43   Neeraj Sharma   implement print o...
101
                    >
25205ccca   Shikha Mishra   show school logo ...
102
103
                      <v-layout>
                        <v-flex xs12 sm12 md12 class="text-xs-center">
46993dc1d   Shikha Mishra   solve issue login
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
                          <div class="line">
                            <div class="school-logo">
                              <img :src="userData.schoolLogoUrl" width="140" alt="logo" />
                            </div>
                            <div class="school-name">
                              <h2>{{ userData.name }}</h2>
                            </div>
                          </div>
                          <div class="school-info">
                            <v-flex class="school-address">
                              <p class="title">{{ userData.name }}</p>
                              <p>{{ userData.address }}</p>
                            </v-flex>
                            <v-flex xs12 sm12 md12 class="text-xs-center student-data">
                              <v-avatar size="100">
710438de6   Shikha Mishra   added teacher mod...
119
120
121
122
123
124
125
126
127
128
                                <img
                                  :src="value[0].studentId.profilePicUrl"
                                  v-if="value[0].studentId.profilePicUrl"
                                  width="100px"
                                />
                                <img
                                  src="/static/icon/user.png"
                                  v-else-if="!value[0].studentId.profilePicUrl"
                                  width="100px"
                                />
46993dc1d   Shikha Mishra   solve issue login
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
                              </v-avatar>
                              <div class="student-info">
                                <p
                                  style="font-size:20px;margin:0px;margin-bottom:4px;"
                                >{{ value[0].studentId.name }}</p>
                                <p
                                  style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                                >Class : {{ value[0].classId.classNum }}</p>
                                <p
                                  style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                                >Section : {{ value[0].sectionId.name }}</p>
                                <p
                                  style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                                >Roll NO : {{ value[0].studentId.rollNo }}</p>
                              </div>
                            </v-flex>
                          </div>
d4735dce7   Shikha Mishra   show school logo ...
146
147
                        </v-flex>
                      </v-layout>
819c223ec   Shikha Mishra   improve school an...
148
                      <!-- <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title> -->
d4735dce7   Shikha Mishra   show school logo ...
149
150
151
152
153
154
                      <table
                        class="mb-5 tableRsponsive feeTypeTable"
                        style="border: 1px solid lightgrey;
                          border-collapse: collapse;!important
                          table-layout: auto !important;
                          width: 100% !important;
819c223ec   Shikha Mishra   improve school an...
155
                          overflow: hidden;"
25205ccca   Shikha Mishra   show school logo ...
156
                      >
d4735dce7   Shikha Mishra   show school logo ...
157
158
                        <thead style="border: 1px solid lightgrey !important;">
                          <tr style="border: 1px solid lightgrey !important;padding:4px;">
710438de6   Shikha Mishra   added teacher mod...
159
160
                            <td rowspan="2">Subject</td>
                            <!-- <td
d4735dce7   Shikha Mishra   show school logo ...
161
162
163
                              v-for="(exam,i) in value[index].studentsMarks"
                              colspan="2"
                              style="border: 1px solid lightgrey !important;padding: 10px;"
710438de6   Shikha Mishra   added teacher mod...
164
                            >{{ exam.markDistributionId.distributionType }}</td>-->
819c223ec   Shikha Mishra   improve school an...
165
                            <!-- <template v-for="studentData in  value">
d4735dce7   Shikha Mishra   show school logo ...
166
167
168
169
                              <td
                                colspan="2"
                                v-for="studentMark in studentData.studentsMarks"
                              >{{ studentMark.markDistributionId.distributionType }}</td>
710438de6   Shikha Mishra   added teacher mod...
170
                            </template>-->
819c223ec   Shikha Mishra   improve school an...
171
                            <!-- <td>{{value[0].studentsMarks[1].markDistributionId.distributionType}}</td> -->
d4735dce7   Shikha Mishra   show school logo ...
172

710438de6   Shikha Mishra   added teacher mod...
173
174
175
                            <td
                              style="border: 1px solid lightgrey !important;padding: 10px;"
                            >Total Marks</td>
d4735dce7   Shikha Mishra   show school logo ...
176
                          </tr>
710438de6   Shikha Mishra   added teacher mod...
177
                          <!-- <tr
d4735dce7   Shikha Mishra   show school logo ...
178
179
180
                            v-for="(subject, ind) in value"
                            v-if="ind == 0"
                            style="border: 1px solid lightgrey !important;"
710438de6   Shikha Mishra   added teacher mod...
181
182
183
                          >-->
                          -->
                          <!-- <template v-for="(exam, i) in subject.studentsMarks">
d4735dce7   Shikha Mishra   show school logo ...
184
185
186
187
                              <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td>
                              <td
                                style="border: 1px solid lightgrey !important;padding: 10px;"
                              >Highest Mark</td>
710438de6   Shikha Mishra   added teacher mod...
188
189
190
                          </template>-->
                          <!-- <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td> -->
                          <!-- </tr> -->
d4735dce7   Shikha Mishra   show school logo ...
191
192
                        </thead>
                        <tbody style="border: 1px solid lightgrey !important;">
710438de6   Shikha Mishra   added teacher mod...
193
                          <!-- <tr
d4735dce7   Shikha Mishra   show school logo ...
194
195
                            v-for="subject in value"
                            style="border: 1px solid lightgrey !important;"
710438de6   Shikha Mishra   added teacher mod...
196
                          >-->
1a34a28a1   Shikha Mishra   issue solved of t...
197
                          <td style="border: 1px solid lightgrey !important;padding: 10px;"></td>
710438de6   Shikha Mishra   added teacher mod...
198
                          <!-- <td
d4735dce7   Shikha Mishra   show school logo ...
199
                              style="border: 1px solid lightgrey !important;padding: 10px;"
710438de6   Shikha Mishra   added teacher mod...
200
201
                          >{{subject.subjectName}}</td>-->
                          <!-- <template v-for="(exam, i) in subject.studentsMarks">
d4735dce7   Shikha Mishra   show school logo ...
202
203
204
205
206
207
208
209
210
211
                              <td
                                style="border: 1px solid lightgrey !important;padding: 10px;"
                              >{{exam.marksScored}}</td>
                              <td
                                style="border: 1px solid lightgrey !important;padding: 10px;"
                              >{{exam.markDistributionId.markValue}}</td>
                            </template>
                            <td
                              style="border: 1px solid lightgrey !important;padding: 10px;"
                            >{{subject.totalMarks}}</td>
710438de6   Shikha Mishra   added teacher mod...
212
                          </tr>-->
d4735dce7   Shikha Mishra   show school logo ...
213
214
                        </tbody>
                        <!-- <tfoot>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
                    <tr>
                      <td colspan="4">
                        <span class="right subheding">Total Amount (RS) :</span>
                      </td>
                      <td>{{ feeType.subTotal }}</td>
                    </tr>
                    <tr>
                      <td colspan="4">
                        <span class="right subheding">Paid (RS) :</span>
                      </td>
                      <td>{{ feeType.totalPaidAmount ? feeType.totalPaidAmount : 0 }}</td>
                    </tr>
                    <tr>
                      <td colspan="4">
                        <span class="right subheding">Balance (RS) :</span>
                      </td>
                      <td>{{ feeType.totalPaidAmount ? feeType.subTotal - feeType.totalPaidAmount : feeType.subTotal }}</td>
                    </tr>
d4735dce7   Shikha Mishra   show school logo ...
233
234
235
236
237
238
239
240
                        </tfoot>-->
                      </table>
                    </v-card>
                  </v-flex>
                </v-layout>
              </v-flex>
            </v-container>
          </v-card>
79583580d   Neeraj Sharma   implement task ma...
241
        </v-flex>
d4735dce7   Shikha Mishra   show school logo ...
242
      </v-layout>
006544386   Neeraj Sharma   implement task
243
244
245
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
246
    </v-container>
006544386   Neeraj Sharma   implement task
247
248
249
250
251
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
79583580d   Neeraj Sharma   implement task ma...
252
  import _ from "underscore";
006544386   Neeraj Sharma   implement task
253
254
255
  
  export default {
    data: () => ({
006544386   Neeraj Sharma   implement task
256
      showLoader: false,
79583580d   Neeraj Sharma   implement task ma...
257
258
259
260
261
      markData: [],
      token: "",
      markDistributions: [],
      markParticularDistributionData: [],
      loading: false,
495e4037c   Neeraj Sharma   update
262
      valid: true,
79583580d   Neeraj Sharma   implement task ma...
263
264
      loading: false,
      showReport: false,
006544386   Neeraj Sharma   implement task
265
      addSection: [],
79583580d   Neeraj Sharma   implement task ma...
266
267
      filterData: [],
      getStudentsList: [],
495e4037c   Neeraj Sharma   update
268
269
270
      classRules: [v => !!v || "Class is required"],
      sectionRules: [v => !!v || "Class is required"],
      studentRules: [v => !!v || "Student is required"],
495e4037c   Neeraj Sharma   update
271
      getReport: {},
ec5677f43   Neeraj Sharma   implement print o...
272
      classList: [],
c0b01ae20   Neeraj Sharma   solve bugs in pro...
273
      output: null,
710438de6   Shikha Mishra   added teacher mod...
274
275
      userData: {},
      newData: [],
006544386   Neeraj Sharma   implement task
276
    }),
79583580d   Neeraj Sharma   implement task ma...
277
278
279
    mounted() {
      this.token = this.$store.state.token;
      this.getClass();
c0b01ae20   Neeraj Sharma   solve bugs in pro...
280
      this.getUserData();
79583580d   Neeraj Sharma   implement task ma...
281
    },
006544386   Neeraj Sharma   implement task
282
    methods: {
495e4037c   Neeraj Sharma   update
283
284
285
      clear() {
        this.$refs.form.reset();
      },
006544386   Neeraj Sharma   implement task
286
      getClass() {
ec5677f43   Neeraj Sharma   implement print o...
287
        this.showLoader = true;
006544386   Neeraj Sharma   implement task
288
289
290
291
292
293
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classList = response.data.data;
ec5677f43   Neeraj Sharma   implement print o...
294
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
295
          })
c0b01ae20   Neeraj Sharma   solve bugs in pro...
296
          .catch(error => {
ec5677f43   Neeraj Sharma   implement print o...
297
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
298
299
300
301
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
302
        this.showLoader = true;
006544386   Neeraj Sharma   implement task
303
304
305
306
307
308
309
310
311
312
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + this.token }
            }
          )
          .then(response => {
            this.addSection = response.data.data;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
313
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
314
315
          })
          .catch(err => {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
316
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
317
318
319
320
321
322
323
324
            // console.log("err====>", err);
          });
      },
      getStudents() {
        this.showLoader = true;
        http()
          .get("/getStudentWithClass", {
            params: {
495e4037c   Neeraj Sharma   update
325
326
              classId: this.getReport.classId,
              sectionId: this.getReport.sectionId
006544386   Neeraj Sharma   implement task
327
328
329
330
331
            }
          })
          .then(response => {
            this.getStudentsList = response.data.data;
            this.showLoader = false;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
332
            // console.log("getSectionsList=====>", response.data.data);
006544386   Neeraj Sharma   implement task
333
334
335
336
337
338
          })
          .catch(error => {
            console.log("err====>", error);
            this.showLoader = false;
          });
      },
79583580d   Neeraj Sharma   implement task ma...
339
      getMarkReportList() {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
340
        // this.showLoader = true;
79583580d   Neeraj Sharma   implement task ma...
341
342
343
344
345
346
347
        this.showReport = true;
        http()
          .get("/getParticularMark", {
            params: { studentId: this.getReport.studentId },
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
348
            this.showLoader = false;
79583580d   Neeraj Sharma   implement task ma...
349
            let newData = response.data.data;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
350
            // console.log("response", newData);
79583580d   Neeraj Sharma   implement task ma...
351
352
            for (var i = 0; i < newData.length; i++) {
              newData[i].examination = newData[i].examId._id;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
353
              // console.log("newData[i].examination", newData[i].examination);
79583580d   Neeraj Sharma   implement task ma...
354
355
            }
            this.filterData = _.groupBy(newData, ["examination"]);
79583580d   Neeraj Sharma   implement task ma...
356
            for (let data in this.filterData) {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
357
              // console.log("data+++++++++++++++++++++++++++++++++++", data);
79583580d   Neeraj Sharma   implement task ma...
358
              for (let item in this.filterData[data]) {
d4735dce7   Shikha Mishra   show school logo ...
359
360
361
362
363
                // console.log(
                //   "filterData[data]==========================>",
                //   this.filterData[data]
                // );
                // console.log("filterData[item]==========================>", item);
79583580d   Neeraj Sharma   implement task ma...
364
365
366
367
368
369
                var totalMarks = 0;
                for (
                  let i = 0;
                  i < this.filterData[data][item].studentsMarks.length;
                  i++
                ) {
79583580d   Neeraj Sharma   implement task ma...
370
371
372
373
                  totalMarks += this.filterData[data][item].studentsMarks[i]
                    .marksScored;
                }
                this.filterData[data][item].totalMarks = totalMarks;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
374
375
376
                // var total = 0;
                // total += this.filterData[data][item].totalMarks  ;
                // console.log("total", total);
79583580d   Neeraj Sharma   implement task ma...
377
378
              }
            }
79583580d   Neeraj Sharma   implement task ma...
379
380
381
382
383
          })
          .catch(error => {
            // console.log("err====>", err);
            this.showLoader = false;
            this.snackbar = true;
710438de6   Shikha Mishra   added teacher mod...
384
385
386
387
388
389
            // 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);
            // }
79583580d   Neeraj Sharma   implement task ma...
390
          });
ec5677f43   Neeraj Sharma   implement print o...
391
      },
d4735dce7   Shikha Mishra   show school logo ...
392
      printProgressReport() {
ec5677f43   Neeraj Sharma   implement print o...
393
394
        // Pass the element id here
        this.$htmlToPaper("printMe");
c0b01ae20   Neeraj Sharma   solve bugs in pro...
395
396
397
398
399
400
401
402
      },
      getUserData() {
        http()
          .get("/getParticularUserDetail")
          .then(response => {
            this.userData = response.data.data;
          })
          .catch(error => {
25205ccca   Shikha Mishra   show school logo ...
403
404
405
406
407
            // if (error.response.status === 401) {
            //   this.$router.replace({ path: "/" });
            //   this.$store.dispatch("setToken", null);
            //   this.$store.dispatch("Id", null);
            // }
c0b01ae20   Neeraj Sharma   solve bugs in pro...
408
          });
006544386   Neeraj Sharma   implement task
409
      }
006544386   Neeraj Sharma   implement task
410
411
412
    }
  };
  </script>
79583580d   Neeraj Sharma   implement task ma...
413

006544386   Neeraj Sharma   implement task
414
  <style scoped>
79583580d   Neeraj Sharma   implement task ma...
415
416
417
418
419
420
421
422
423
424
  table {
    border-collapse: collapse;
    border: 1px solid #e2e7eb;
  }
  
  th,
  td {
    border: 1px solid #e2e7eb;
    padding: 10px;
    text-align: center;
006544386   Neeraj Sharma   implement task
425
  }
79583580d   Neeraj Sharma   implement task ma...
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
  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;
  }
46993dc1d   Shikha Mishra   solve issue login
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
  
  /* .report {
    overflow: hidden;
    max-width: 794px;
    margin: 0px auto;
    margin-bottom: 10px;
    padding: 30px;
  } */
  .line {
    border-bottom: 1px solid #ddd;
    overflow: hidden;
    padding-bottom: 10px;
    vertical-align: middle;
    margin-bottom: 4px;
  }
  .school-logo {
    float: left;
  }
  .school-name {
    box-sizing: border-box;
  }
  .school-info {
    width: 100%;
    overflow: hidden;
  }
  .school-address {
    float: left;
    width: 40%;
  }
  .student-data {
    float: right;
    width: 40%;
  }
  .student-info {
    float: left;
  }
79583580d   Neeraj Sharma   implement task ma...
478
479
  @media screen and (max-width: 380px) {
    .tableRsponsive {
d4735dce7   Shikha Mishra   show school logo ...
480
      /* display: block; */
79583580d   Neeraj Sharma   implement task ma...
481
482
483
      position: relative;
      overflow: scroll;
    }
006544386   Neeraj Sharma   implement task
484
  }
79583580d   Neeraj Sharma   implement task ma...
485
  </style> s