Commit 159dff730cf1c24a325fabb8c3a1ab462886ca75

Authored by Neeraj Sharma
1 parent 0cd2fbfba4

implement functionality in viewTeacherAttendence

Showing 1 changed file with 45 additions and 31 deletions   Show diff stats
src/pages/Attendence/viewTeacherAttendence.vue
1 1 <template>
2 2 <v-container fluid grid-list-md>
3   - <!-- <div v-show="hideData"> -->
  3 + <div v-show="hideData">
4 4 <!-- <v-layout row>
5 5 <v-btn color="grey" @click="exportPdf" class="right" dark>
6 6 Export Pdf
... ... @@ -77,7 +77,7 @@
77 77 </v-card-actions>
78 78 </v-card>
79 79 </v-dialog>
80   - </v-layout> -->
  80 + </v-layout>-->
81 81 <v-layout wrap>
82 82 <v-flex xs12 sm12 md4>
83 83 <v-card flat>
... ... @@ -92,10 +92,10 @@
92 92 class="text-xs-center text-sm-center text-md-center text-lg-center"
93 93 >
94 94 <v-avatar size="160px">
95   - <img src="/static/icon/user.png" v-if="!teacherData.teacherData.profilePicUrl" />
  95 + <img src="/static/icon/user.png" v-if="!teacherData.profilePicUrl" />
96 96 <img
97   - :src="teacherData.teacherData.profilePicUrl"
98   - v-else-if="teacherData.teacherData.profilePicUrl"
  97 + :src="teacherData.profilePicUrl"
  98 + v-else-if="teacherData.profilePicUrl"
99 99 />
100 100 </v-avatar>
101 101 </v-flex>
... ... @@ -103,7 +103,7 @@
103 103 <v-layout>
104 104 <v-flex xs12 sm12>
105 105 <h3 class="text-xs-center">
106   - <b>{{ teacherData.teacherData.name }}</b>
  106 + <b>{{ teacherData.name }}</b>
107 107 </h3>
108 108 <p class="text-xs-center grey--text">Teacher</p>
109 109 </v-flex>
... ... @@ -117,7 +117,7 @@
117 117 <v-flex sm6 xs6 class="pa-0">
118 118 <h4>{{ teacherData.teacherData.gender }}</h4>
119 119 </v-flex>
120   - </v-layout> -->
  120 + </v-layout>-->
121 121 <v-layout style="border: 1px solid lightgrey;">
122 122 <v-flex xs6 sm6 class="pa-0">
123 123 <h4 class="right">
... ... @@ -125,7 +125,7 @@
125 125 </h4>
126 126 </v-flex>
127 127 <v-flex sm6 xs6 class="right pa-0">
128   - <h4>{{ dates(teacherData.teacherData.dob) }}</h4>
  128 + <h4>{{ dates(teacherData.dob) }}</h4>
129 129 </v-flex>
130 130 </v-layout>
131 131 <v-layout style="border: 1px solid lightgrey;">
... ... @@ -135,7 +135,7 @@
135 135 </h4>
136 136 </v-flex>
137 137 <v-flex sm6 xs6 class="right pa-0">
138   - <h4>{{ teacherData.teacherData.mobileNo}}</h4>
  138 + <h4>{{ teacherData.mobileNo}}</h4>
139 139 </v-flex>
140 140 </v-layout>
141 141 </v-flex>
... ... @@ -157,12 +157,12 @@
157 157 <span class="subheading">Absent</span>
158 158 </span>
159 159 </h3>
160   - <!-- <YearCalendar
  160 + <YearCalendar
161 161 v-model="year"
162 162 :activeDates="activeDates"
163 163 prefixClass="your_customized_wrapper_class"
164 164 :activeClass="activeClass"
165   - ></YearCalendar> -->
  165 + ></YearCalendar>
166 166 </v-card>
167 167 </v-flex>
168 168 </v-layout>
... ... @@ -179,7 +179,7 @@
179 179 >
180 180 Download
181 181 <v-icon dark right size="20">save_alt</v-icon>
182   - </v-btn> -->
  182 + </v-btn>-->
183 183 </v-flex>
184 184 </v-container>
185 185 </v-layout>
... ... @@ -238,7 +238,7 @@
238 238 <v-flex sm10 xs6 class="pa-0 mb-3">
239 239 <h4>: {{ studentData.sectionId.name}}</h4>
240 240 </v-flex>
241   - </v-layout> -->
  241 + </v-layout>-->
242 242 </v-flex>
243 243 <!-- <v-card flat>
244 244 <h3 class="py-2 text-xs-center grey lighten-1 white--text">
... ... @@ -257,8 +257,8 @@
257 257 :activeDates="activeDates"
258 258 prefixClass="your_customized_wrapper_class"
259 259 :activeClass="activeClass"
260   - ></YearCalendar>
261   - </v-card> -->
  260 + ></YearCalendactiveDatesar>
  261 + </v-card>-->
262 262 </div>
263 263 </v-flex>
264 264 </v-layout>
... ... @@ -323,22 +323,36 @@ export default {
323 323 )
324 324 .then(response => {
325 325 this.showLoader = false;
326   - this.teacherData = response.data.data;
327   - // let array = [];
328   - // for (let i = 0; i < response.data.data.length; i++) {
329   - // if (response.data.data[i].students[0].isPresent == true) {
330   - // array.push({
331   - // date: response.data.data[i].date,
332   - // className: "green"
333   - // });
334   - // } else if (response.data.data[i].students[0].isPresent == false) {
335   - // array.push({
336   - // date: response.data.data[i].date,
337   - // className: "red"
338   - // });
339   - // }
340   - // }
341   - // this.activeDates = array;
  326 + this.teacherData = response.data.data.teacherData;
  327 + let array = [];
  328 + for (let i = 0; i < response.data.data.attendanceData.length; i++) {
  329 + for (let j = 0; j < response.data.data.attendanceData[i].teachers.length; j++) {
  330 + if (response.data.data.attendanceData[i].teachers[j].attendanceType === "present") {
  331 + array.push({
  332 + date: response.data.data.attendanceData[i].date,
  333 + className: "green"
  334 + });
  335 + } else if (response.data.data.attendanceData[i].teachers[j].attendanceType === "latePresentWithExcuse") {
  336 + array.push({
  337 + date: response.data.data.attendanceData[i].date,
  338 + className: "yellow"
  339 + });
  340 + }
  341 + else if (response.data.data.attendanceData[i].teachers[j].attendanceType === "latePresent") {
  342 + array.push({
  343 + date: response.data.data.attendanceData[i].date,
  344 + className: "black"
  345 + });
  346 + }
  347 + else if (response.data.data.attendanceData[i].teachers[j].attendanceType === "absent") {
  348 + array.push({
  349 + date: response.data.data.attendanceData[i].date,
  350 + className: "red"
  351 + });
  352 + }
  353 + }
  354 + this.activeDates = array;
  355 + }
342 356 })
343 357 .catch(error => {
344 358 this.showLoader = false;
... ...