Blame view

src/pages/Report/progressCardReport.vue 8.42 KB
006544386   Neeraj Sharma   implement task
1
2
3
4
5
6
7
8
9
10
  <template>
    <v-app id="pages-dasboard">
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        color="success"
      >{{ text }}</v-snackbar>
495e4037c   Neeraj Sharma   update
11
      <!-- ******  Progress Card Report Table****** -->
006544386   Neeraj Sharma   implement task
12
13
14
      <v-card flat>
        <v-card-actions>
          <v-layout>
495e4037c   Neeraj Sharma   update
15
            <h4 class="ml-2">Progress Card Report</h4>
006544386   Neeraj Sharma   implement task
16
          </v-layout>
006544386   Neeraj Sharma   implement task
17
18
19
        </v-card-actions>
      </v-card>
      <v-card flat>
495e4037c   Neeraj Sharma   update
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
        <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>
                  <v-flex xs12 sm12 lg8 class="ml-2">
                    <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>
                  <v-flex xs12 sm12 lg8 class="ml-2">
                    <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>
                  <v-flex xs12 sm12 lg8 class="ml-2">
                    <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>
                <v-btn @click="getReport" round dark :loading="loading" class="right mt-3">Get Report</v-btn>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-form>
006544386   Neeraj Sharma   implement task
87
      </v-card>
495e4037c   Neeraj Sharma   update
88
      <!-- <v-data-table
006544386   Neeraj Sharma   implement task
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
        :headers="headers"
        :items="getStudentsList"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <td class="text-xs-center">{{ props.index + 1}}</td>
          <td id="td" class="text-xs-center">
            <v-avatar>
              <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" />
              <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" />
            </v-avatar>
          </td>
          <td id="td" class="text-xs-center">{{ props.item.name}}</td>
          <td id="td" class="text-xs-center">{{ props.item.rollNo }}</td>
          <td id="td" class="text-xs-center">{{ props.item.email }}</td>
          <td class="text-xs-center">
            <span>
006544386   Neeraj Sharma   implement task
107
108
109
110
111
112
113
              <router-link :to="{ name:'viewMark',params: { markId:props.item._id } }">
                <img
                  style="cursor:pointer; width:20px; height:18px; "
                  class="mr-5"
                  src="/static/icon/edit1.png"
                />
              </router-link>
006544386   Neeraj Sharma   implement task
114
115
116
117
118
119
120
121
122
            </span>
          </td>
        </template>
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
495e4037c   Neeraj Sharma   update
123
      </v-data-table>-->
006544386   Neeraj Sharma   implement task
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
      <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";
  
  export default {
    data: () => ({
      snackbar: false,
      color: "",
      y: "top",
      x: "right",
      mode: "",
      timeout: 10000,
      text: "",
      loading: false,
      search: "",
      showLoader: false,
495e4037c   Neeraj Sharma   update
146
      valid: true,
006544386   Neeraj Sharma   implement task
147
      addSection: [],
495e4037c   Neeraj Sharma   update
148
149
150
      classRules: [v => !!v || "Class is required"],
      sectionRules: [v => !!v || "Class is required"],
      studentRules: [v => !!v || "Student is required"],
006544386   Neeraj Sharma   implement task
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
      pagination: {
        rowsPerPage: 15
      },
      headers: [
        {
          align: "justify-center",
          text: "No",
          sortable: false,
          value: "No"
        },
        {
          text: "Profile Pic",
          vaue: "profilePicUrl",
          sortable: false,
          align: "center"
        },
        {
          text: "Name",
          vaue: "name",
          sortable: false,
          align: "center"
        },
        {
          text: "Roll No.",
          value: "rollNo",
          sortable: false,
          align: "center"
        },
        {
          text: "Email",
          value: "email",
          sortable: false,
          align: "center"
        },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
      classList: [],
495e4037c   Neeraj Sharma   update
188
      getReport: {},
006544386   Neeraj Sharma   implement task
189
190
191
192
193
194
      markData: [],
      examList: [],
      getStudentsList: [],
      token: ""
    }),
    methods: {
495e4037c   Neeraj Sharma   update
195
196
197
      clear() {
        this.$refs.form.reset();
      },
006544386   Neeraj Sharma   implement task
198
199
200
201
202
203
204
205
206
207
208
209
210
      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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
        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
231
232
              classId: this.getReport.classId,
              sectionId: this.getReport.sectionId
006544386   Neeraj Sharma   implement task
233
234
235
236
237
238
239
240
241
242
243
244
            }
          })
          .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;
          });
      },
495e4037c   Neeraj Sharma   update
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
      getReport() {
        if (this.$refs.form.validate()) {
          this.showLoader = true;
          http()
            .get("/getParticularMark", {
              params: { studentId: this.getReport.studentId },
              headers: { Authorization: "Bearer " + this.token }
            })
            .then(response => {
              console.log("response.data.data", response.data.data);
              // this.examList = response.data.data;
              this.showLoader = false;
              this.clear();
            })
            .catch(error => {
              console.log("err====>", error);
              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
271
272
273
274
      }
    },
    mounted() {
      this.token = this.$store.state.token;
495e4037c   Neeraj Sharma   update
275
      // this.getExamList();
006544386   Neeraj Sharma   implement task
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
      this.getClass();
    },
    created() {
      this.$root.$on("app:search", search => {
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
    }
  };
  </script>
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  </style>s