Blame view

src/pages/Report/progressCardReport.vue 15.4 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
66
                    <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...
67
68
69
70
71
72
73
                <v-btn
                  @click="getMarkReportList"
                  round
                  dark
                  :loading="loading"
                  class="right mt-3"
                >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>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
79
80
      <v-container grid-list-md v-show="showReport">
        <!-- {{ filterData }} -->
ec5677f43   Neeraj Sharma   implement print o...
81
        <v-layout>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
82
          <v-flex xs12 sm12 v-if="filterData != {}">
68d742034   Neeraj Sharma   implement new des...
83
            <v-btn class="add-button" round dark @click="print()">
ec5677f43   Neeraj Sharma   implement print o...
84
85
86
87
88
89
              Print
              <v-icon right dark>print</v-icon>
            </v-btn>
          </v-flex>
        </v-layout>
        <v-flex xs12 sm12 id="printMe">
ec5677f43   Neeraj Sharma   implement print o...
90
          <v-layout wrap>
ec5677f43   Neeraj Sharma   implement print o...
91
            <!-- ****** TABLE DATA MARK  ****** -->
c0b01ae20   Neeraj Sharma   solve bugs in pro...
92
            <v-flex xs12 sm12 md12>
ec5677f43   Neeraj Sharma   implement print o...
93
94
95
96
              <v-card
                v-for="(value, id, index) in filterData"
                :key="index"
                flat
c0b01ae20   Neeraj Sharma   solve bugs in pro...
97
                style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px"
ec5677f43   Neeraj Sharma   implement print o...
98
              >
748acd1a6   Neeraj Sharma   solve bugs in pro...
99
                <v-layout v-if="index === 0">
c0b01ae20   Neeraj Sharma   solve bugs in pro...
100
101
102
103
104
                  <v-flex xs12 style="border-bottom: 1px solid #707478;padding-bottom:6px !important">
                    <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" width="100" />
                    <img src="/static/icon/user.png" v-else-if="!userData.schoolLogoUrl" width="100" />
                  </v-flex>
                </v-layout>
748acd1a6   Neeraj Sharma   solve bugs in pro...
105
                <v-layout style="padding-top:10px" v-if="index === 0">
c0b01ae20   Neeraj Sharma   solve bugs in pro...
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
                  <v-flex xs5>
                    <p style="margin:0px;margin-bottom:4px">
                      <span style="font-size:20px">{{ userData.name }}</span>
                      <br />
                      <span style="font-size: 15px;color: #707478;">{{ userData.address }}</span>
                    </p>
                    <p
                      style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                    >phone : {{ userData.mobile }}</p>
                    <p
                      style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                    >Email : {{ userData.email }}</p>
                  </v-flex>
                  <v-flex xs5>
                    <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;"
                    >Roll NO : {{ value[0].studentId.rollNo }}</p>
                    <p
                      style="font-size: 15px;color: #707478;margin:0px;margin-bottom:4px;"
                    >Section : {{ value[0].sectionId.name }}</p>
                  </v-flex>
                  <v-flex xs2>
                    <v-avatar size="100">
                      <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"
                      />
                    </v-avatar>
                  </v-flex>
                </v-layout>
ec5677f43   Neeraj Sharma   implement print o...
148
149
150
151
152
153
                <v-card-title class="subheading">{{value[0].examId.examName}}</v-card-title>
                <table
                  class="mb-5 tableRsponsive feeTypeTable"
                  style="border: 1px solid lightgrey;
                    border-collapse: collapse;!important
                    table-layout: auto !important;
67a276510   Shikha Mishra   fixed all bugs
154
155
156
157
                    width: 100% !important;
                    overflow: hidden; 
                    display: block;"
                    
ec5677f43   Neeraj Sharma   implement print o...
158
159
                >
                  <thead style="border: 1px solid lightgrey !important;">
c0b01ae20   Neeraj Sharma   solve bugs in pro...
160
                    <tr style="border: 1px solid lightgrey !important;padding:4px;">
ec5677f43   Neeraj Sharma   implement print o...
161
162
163
164
                      <td
                        rowspan="2"
                        style="border: 1px solid lightgrey !important;padding: 10px;"
                      >Subject</td>
68d742034   Neeraj Sharma   implement new des...
165
166
167
168
169
                      <!-- <td
                        v-for="(exam,i) in value[index].studentsMarks"
                        colspan="2"
                        style="border: 1px solid lightgrey !important;padding: 10px;"
                      >{{ exam.markDistributionId.distributionType }}</td>-->
748acd1a6   Neeraj Sharma   solve bugs in pro...
170
                      <template v-for="studentData in  value">
c0b01ae20   Neeraj Sharma   solve bugs in pro...
171
172
                        <td
                          colspan="2"
748acd1a6   Neeraj Sharma   solve bugs in pro...
173
174
                          v-for="studentMark in studentData.studentsMarks"
                        >{{ studentMark.markDistributionId.distributionType }}</td>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
175
176
                      </template>
                      <!-- <td>{{value[0].studentsMarks[1].markDistributionId.distributionType}}</td> -->
ec5677f43   Neeraj Sharma   implement print o...
177
178
179
180
181
182
183
184
                      <td style="border: 1px solid lightgrey !important;padding: 10px;">Total</td>
                    </tr>
                    <tr
                      v-for="(subject, ind) in value"
                      v-if="ind == 0"
                      style="border: 1px solid lightgrey !important;"
                    >
                      <template v-for="(exam, i) in subject.studentsMarks">
c0b01ae20   Neeraj Sharma   solve bugs in pro...
185
186
                        <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td>
                        <td style="border: 1px solid lightgrey !important;padding: 10px;">Highest Mark</td>
ec5677f43   Neeraj Sharma   implement print o...
187
                      </template>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
188
                      <td style="border: 1px solid lightgrey !important;padding: 10px;">Mark</td>
ec5677f43   Neeraj Sharma   implement print o...
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
                    </tr>
                  </thead>
                  <tbody style="border: 1px solid lightgrey !important;">
                    <tr v-for="subject in value" style="border: 1px solid lightgrey !important;">
                      <td
                        style="border: 1px solid lightgrey !important;padding: 10px;"
                      >{{subject.subjectName}}</td>
                      <template v-for="(exam, i) in subject.studentsMarks">
                        <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>
                    </tr>
                  </tbody>
c0b01ae20   Neeraj Sharma   solve bugs in pro...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
                  <!-- <tfoot>
                    <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>
                  </tfoot>-->
ec5677f43   Neeraj Sharma   implement print o...
229
230
231
232
                </table>
              </v-card>
            </v-flex>
          </v-layout>
79583580d   Neeraj Sharma   implement task ma...
233
234
        </v-flex>
      </v-container>
006544386   Neeraj Sharma   implement task
235
236
237
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
238
    </v-container>
006544386   Neeraj Sharma   implement task
239
240
241
242
243
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
79583580d   Neeraj Sharma   implement task ma...
244
  import _ from "underscore";
006544386   Neeraj Sharma   implement task
245
246
247
  
  export default {
    data: () => ({
006544386   Neeraj Sharma   implement task
248
      showLoader: false,
79583580d   Neeraj Sharma   implement task ma...
249
250
251
252
253
      markData: [],
      token: "",
      markDistributions: [],
      markParticularDistributionData: [],
      loading: false,
495e4037c   Neeraj Sharma   update
254
      valid: true,
79583580d   Neeraj Sharma   implement task ma...
255
256
      loading: false,
      showReport: false,
006544386   Neeraj Sharma   implement task
257
      addSection: [],
79583580d   Neeraj Sharma   implement task ma...
258
259
      filterData: [],
      getStudentsList: [],
495e4037c   Neeraj Sharma   update
260
261
262
      classRules: [v => !!v || "Class is required"],
      sectionRules: [v => !!v || "Class is required"],
      studentRules: [v => !!v || "Student is required"],
495e4037c   Neeraj Sharma   update
263
      getReport: {},
ec5677f43   Neeraj Sharma   implement print o...
264
      classList: [],
c0b01ae20   Neeraj Sharma   solve bugs in pro...
265
266
      output: null,
      userData: {}
006544386   Neeraj Sharma   implement task
267
    }),
79583580d   Neeraj Sharma   implement task ma...
268
269
270
    mounted() {
      this.token = this.$store.state.token;
      this.getClass();
c0b01ae20   Neeraj Sharma   solve bugs in pro...
271
      this.getUserData();
79583580d   Neeraj Sharma   implement task ma...
272
    },
006544386   Neeraj Sharma   implement task
273
    methods: {
495e4037c   Neeraj Sharma   update
274
275
276
      clear() {
        this.$refs.form.reset();
      },
006544386   Neeraj Sharma   implement task
277
      getClass() {
ec5677f43   Neeraj Sharma   implement print o...
278
        this.showLoader = true;
006544386   Neeraj Sharma   implement task
279
280
281
282
283
284
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classList = response.data.data;
ec5677f43   Neeraj Sharma   implement print o...
285
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
286
          })
c0b01ae20   Neeraj Sharma   solve bugs in pro...
287
          .catch(error => {
ec5677f43   Neeraj Sharma   implement print o...
288
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
289
290
291
292
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
293
        this.showLoader = true;
006544386   Neeraj Sharma   implement task
294
295
296
297
298
299
300
301
302
303
        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...
304
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
305
306
          })
          .catch(err => {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
307
            this.showLoader = false;
006544386   Neeraj Sharma   implement task
308
309
310
311
312
313
314
315
            // console.log("err====>", err);
          });
      },
      getStudents() {
        this.showLoader = true;
        http()
          .get("/getStudentWithClass", {
            params: {
495e4037c   Neeraj Sharma   update
316
317
              classId: this.getReport.classId,
              sectionId: this.getReport.sectionId
006544386   Neeraj Sharma   implement task
318
319
320
321
322
            }
          })
          .then(response => {
            this.getStudentsList = response.data.data;
            this.showLoader = false;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
323
            // console.log("getSectionsList=====>", response.data.data);
006544386   Neeraj Sharma   implement task
324
325
326
327
328
329
          })
          .catch(error => {
            console.log("err====>", error);
            this.showLoader = false;
          });
      },
79583580d   Neeraj Sharma   implement task ma...
330
      getMarkReportList() {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
331
        // this.showLoader = true;
79583580d   Neeraj Sharma   implement task ma...
332
333
334
335
336
337
338
        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...
339
            this.showLoader = false;
79583580d   Neeraj Sharma   implement task ma...
340
            let newData = response.data.data;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
341
            // console.log("response", newData);
79583580d   Neeraj Sharma   implement task ma...
342
343
            for (var i = 0; i < newData.length; i++) {
              newData[i].examination = newData[i].examId._id;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
344
              // console.log("newData[i].examination", newData[i].examination);
79583580d   Neeraj Sharma   implement task ma...
345
346
            }
            this.filterData = _.groupBy(newData, ["examination"]);
79583580d   Neeraj Sharma   implement task ma...
347
            for (let data in this.filterData) {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
348
              // console.log("data+++++++++++++++++++++++++++++++++++", data);
79583580d   Neeraj Sharma   implement task ma...
349
              for (let item in this.filterData[data]) {
c0b01ae20   Neeraj Sharma   solve bugs in pro...
350
351
352
353
354
                console.log(
                  "filterData[data]==========================>",
                  this.filterData[data]
                );
                console.log("filterData[item]==========================>", item);
79583580d   Neeraj Sharma   implement task ma...
355
356
357
358
359
360
                var totalMarks = 0;
                for (
                  let i = 0;
                  i < this.filterData[data][item].studentsMarks.length;
                  i++
                ) {
79583580d   Neeraj Sharma   implement task ma...
361
362
363
364
                  totalMarks += this.filterData[data][item].studentsMarks[i]
                    .marksScored;
                }
                this.filterData[data][item].totalMarks = totalMarks;
c0b01ae20   Neeraj Sharma   solve bugs in pro...
365
366
367
                // var total = 0;
                // total += this.filterData[data][item].totalMarks  ;
                // console.log("total", total);
79583580d   Neeraj Sharma   implement task ma...
368
369
              }
            }
79583580d   Neeraj Sharma   implement task ma...
370
371
372
373
374
375
376
377
378
379
380
381
          })
          .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);
            }
          });
ec5677f43   Neeraj Sharma   implement print o...
382
383
384
385
      },
      print() {
        // Pass the element id here
        this.$htmlToPaper("printMe");
c0b01ae20   Neeraj Sharma   solve bugs in pro...
386
387
388
389
390
391
392
393
394
395
396
397
398
399
      },
      getUserData() {
        http()
          .get("/getParticularUserDetail")
          .then(response => {
            this.userData = response.data.data;
          })
          .catch(error => {
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
006544386   Neeraj Sharma   implement task
400
      }
006544386   Neeraj Sharma   implement task
401
402
403
    }
  };
  </script>
79583580d   Neeraj Sharma   implement task ma...
404

006544386   Neeraj Sharma   implement task
405
  <style scoped>
79583580d   Neeraj Sharma   implement task ma...
406
407
408
409
410
411
412
413
414
415
  table {
    border-collapse: collapse;
    border: 1px solid #e2e7eb;
  }
  
  th,
  td {
    border: 1px solid #e2e7eb;
    padding: 10px;
    text-align: center;
006544386   Neeraj Sharma   implement task
416
  }
79583580d   Neeraj Sharma   implement task ma...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
  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
439
  }
79583580d   Neeraj Sharma   implement task ma...
440
  </style> s