Skip to content

Instantly share code, notes, and snippets.

@Verthon
Last active January 7, 2020 16:41
Show Gist options
  • Save Verthon/16483676667fa45204f0fb0d17b507d5 to your computer and use it in GitHub Desktop.
Save Verthon/16483676667fa45204f0fb0d17b507d5 to your computer and use it in GitHub Desktop.
api_call
fetchData(): Observable<any[]> {
this.attendanceService.getDayOverViewByGroupId(this.dateForDayOverView, this.defaultGroup).then(
(res1: any) => {
let dayOverViewByGroup = res1.mobile_employee_dayoverview;
dayOverViewByGroup.forEach(element => {
element.children.forEach(children => {
if (null !== children.away) {
children.awayClass = "awayClass";
children.reason = children.away.reason;
} else {
children.awayClass = "";
children.reason = "";
}
if (true == children.additionalDay) {
children.addtionalClass = "additionalClass";
} else {
children.addtionalClass = "";
}
children.disableToggle = false;
if (children.checkin.length == 2) {
children.disableToggle = true;
}
if (children.checkin.length == 0) {
children.disabled = false;
children.checkout = "Nicht anwesend";
children.class = "notcheckin";
} else {
if (children.checkin[children.checkin.length - 1].inorout === 1) {
children.disabled = true;
children.class = "checkin";
children.checkout = "Anwesend";
} else {
children.disabled = false;
children.checkout = "Nicht anwesend";
children.class = "notcheckin";
}
}
});
});
this.appFunctionCtrl.dismissLoader();
console.log('dayOverViewByGroup', dayOverViewByGroup)
this.dayOverViewByGroup = dayOverViewByGroup;
},
error => {
console.log("Error", error);
}
);
return this.dateForDayOverView;
}
//provider part
that.http.post(`${that.baseUrl}/dayoverview?${params}`, null, options).timeout(this.timeTimeout).subscribe((success: any) => {
resolve(success);
}, (err) => {
this.appFunctionCtrl.dismissLoader();
if (err.name == 'TimeoutError') {
this.alert.present();
}
else {
reject(err);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment