my team calendar change

zohaib-huawei-q2
Sultan Khan 5 years ago
parent 7bb565af80
commit 5b5f9b2cfd

@ -13,6 +13,7 @@ import { GetDayAndHoursDetailsRequest } from 'src/app/time-card/service/models/g
import { GetTimeCardSummaryRequest } from 'src/app/time-card/service/models/get-time-card-summary.request'; import { GetTimeCardSummaryRequest } from 'src/app/time-card/service/models/get-time-card-summary.request';
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service'; import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response'; import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response';
import { WorklistService } from 'src/app/notification/service/worklist.service';
@Component({ @Component({
selector: 'app-details', selector: 'app-details',
templateUrl: './details.component.html', templateUrl: './details.component.html',
@ -57,7 +58,7 @@ export class DetailsComponent implements OnInit {
public yearTitle: string; public yearTitle: string;
public activeMonth: any; public activeMonth: any;
public currentMonthName = ''; public currentMonthName = '';
favoriteUserList: [] = [];
public showAttendence = false; public showAttendence = false;
public showData = false; public showData = false;
public currentYear = new Date().getFullYear(); public currentYear = new Date().getFullYear();
@ -90,9 +91,9 @@ export class DetailsComponent implements OnInit {
public EmpTotal = []; public EmpTotal = [];
public selectedFilter = ''; public selectedFilter = '';
public itemType = ''; public itemType = '';
public monthNo : any; public monthNo: any;
public filters = [ public filters = [
{ {
@ -100,7 +101,7 @@ export class DetailsComponent implements OnInit {
name: 'JAN', name: 'JAN',
active: true, active: true,
color: '#0a0a0a', color: '#0a0a0a',
key: 'January', key: 'January',
monthNo: 1, monthNo: 1,
disable: false disable: false
}, },
@ -208,7 +209,7 @@ export class DetailsComponent implements OnInit {
slidesPerView: 7, slidesPerView: 7,
spaceBetween: 1 spaceBetween: 1
}; };
constructor( constructor(
public timeCardService: TimeCardService, public timeCardService: TimeCardService,
public menuService: MenuService, public menuService: MenuService,
@ -218,6 +219,7 @@ export class DetailsComponent implements OnInit {
public modalController: ModalController, public modalController: ModalController,
public authService: AuthenticationService, public authService: AuthenticationService,
public dashboardService: DashboredService, public dashboardService: DashboredService,
public worklistService: WorklistService,
) { ) {
this.direction = TranslatorService.getCurrentLanguageName(); this.direction = TranslatorService.getCurrentLanguageName();
} }
@ -229,7 +231,7 @@ export class DetailsComponent implements OnInit {
// tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length
this.currentMonthName = this.direction === 'en' ? this.common.getMonthName(this.monthIndex) : this.common.getMonthNameAr(this.monthIndex); this.currentMonthName = this.direction === 'en' ? this.common.getMonthName(this.monthIndex) : this.common.getMonthNameAr(this.monthIndex);
this.getSuborinatesAttStatus(); this.getSuborinatesAttStatus();
} }
showAttendanceTracking() { showAttendanceTracking() {
@ -239,11 +241,11 @@ export class DetailsComponent implements OnInit {
P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER
}; };
this.dashboardService.getAttendanceTracking(request).subscribe((result: AttendanceTrackingResponse) => { this.dashboardService.getAttendanceTracking(request).subscribe((result: AttendanceTrackingResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
const key = 'GetAttendanceTrackingList'; const key = 'GetAttendanceTrackingList';
this.attendanceTrackingList = result[key]; this.attendanceTrackingList = result[key];
} }
}); });
} }
public segmentChanged(event: any) { public segmentChanged(event: any) {
@ -264,7 +266,10 @@ export class DetailsComponent implements OnInit {
this.showData = false; this.showData = false;
this.nextMonth = new Date().getMonth() + 2; this.nextMonth = new Date().getMonth() + 2;
this.preMonth = new Date().getMonth(); this.preMonth = new Date().getMonth();
this.calendarConfig(this.common.getMonthName(new Date().getMonth() + 1) , new Date().getFullYear()); // this.currentActiveIndex = this.nextMonth -1;
this.activeFilter(this.preMonth);
this.calendarConfig(this.common.getMonthName(new Date().getMonth() + 1), new Date().getFullYear());
} }
calendarConfig(month?, year?) { calendarConfig(month?, year?) {
@ -301,31 +306,38 @@ export class DetailsComponent implements OnInit {
}); });
} }
monthCardSliders(monthNo){ monthCardSliders(monthNo) {
console.log(monthNo+"__________________") console.log(monthNo + "__________________")
// this.common.startLoading();
// this.showData = false; /* change
// this.currentMonth = this.nextMonth - 1; */
// this.currentDate = new Date(this.currentYear, (this.preMonth + 1), 1); this.currentMonthName = this.direction === 'en' ? this.common.getMonthName(this.monthIndex) : this.common.getMonthNameAr(this.monthIndex);
this.calendarConfig(this.getMonthName(this.monthNo) , this.currentYear); this.currentYear = new Date().getFullYear();
console.log("next month =" + this.nextMonth ); this.currentDate = new Date(new Date().getFullYear(), monthNo - 1);
console.log(" Month Name =" + this.currentMonthName); this.showData = false;
this.nextMonth = monthNo;//new Date().getMonth() + 2;
this.preMonth = monthNo - 1;///new Date().getMonth();
//end
this.calendarConfig(this.getMonthName(monthNo), this.currentYear);
console.log("next month =" + this.nextMonth);
console.log(" Month Name =" + this.currentMonthName);
} }
nextSlide() { nextSlide() {
if (this.currentMonthName !== this.month) { if (this.currentMonthName !== this.month) {
this.common.startLoading(); this.common.startLoading();
this.showData = false; this.showData = false;
if (this.nextMonth > 12) { if (this.nextMonth > 12) {
this.currentYear = this.currentYear + 1; this.currentYear = this.currentYear + 1;
this.nextMonth = 1; this.nextMonth = 1;
} }
this.currentDate = new Date(this.currentYear, (this.nextMonth - 1), 1); this.currentDate = new Date(this.currentYear, (this.nextMonth - 1), 1);
this.calendarConfig(this.getMonthName(this.nextMonth) , this.currentYear); this.calendarConfig(this.getMonthName(this.nextMonth), this.currentYear);
this.nextMonth = this.nextMonth + 1; this.nextMonth = this.nextMonth + 1;
this.preMonth = this.nextMonth - 2; this.preMonth = this.nextMonth - 2;
} }
} }
@ -333,12 +345,12 @@ export class DetailsComponent implements OnInit {
this.common.startLoading(); this.common.startLoading();
this.showData = false; this.showData = false;
if (this.preMonth === 0) { if (this.preMonth === 0) {
this.currentYear = this.currentYear - 1; this.currentYear = this.currentYear - 1;
this.preMonth = 12; this.preMonth = 12;
} }
this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1); this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1);
console.log(this.currentDate); console.log(this.currentDate);
this.calendarConfig(this.getMonthName(this.preMonth) , this.currentYear); this.calendarConfig(this.getMonthName(this.preMonth), this.currentYear);
this.preMonth = this.preMonth - 1; this.preMonth = this.preMonth - 1;
this.nextMonth = this.preMonth + 2; this.nextMonth = this.preMonth + 2;
} }
@ -363,14 +375,14 @@ export class DetailsComponent implements OnInit {
allDays[i].customDaysOff = false; allDays[i].customDaysOff = false;
allDays[i].customSchedule = false; allDays[i].customSchedule = false;
allDays[i].customScheduleDate = new Date(allDays[i].SCHEDULE_DATE); allDays[i].customScheduleDate = new Date(allDays[i].SCHEDULE_DATE);
// tslint:disable-next-line: triple-equals // tslint:disable-next-line: triple-equals
} else if (allDays[i].ATTENDED_FLAG == 'N' && allDays[i].ABSENT_FLAG == 'Y') { } else if (allDays[i].ATTENDED_FLAG == 'N' && allDays[i].ABSENT_FLAG == 'Y') {
allDays[i].customPresent = false; allDays[i].customPresent = false;
allDays[i].customAbsent = true; allDays[i].customAbsent = true;
allDays[i].customDaysOff = false; allDays[i].customDaysOff = false;
allDays[i].customSchedule = false; allDays[i].customSchedule = false;
allDays[i].customScheduleDate = new Date(allDays[i].SCHEDULE_DATE); allDays[i].customScheduleDate = new Date(allDays[i].SCHEDULE_DATE);
// tslint:disable-next-line: triple-equals // tslint:disable-next-line: triple-equals
} else if (allDays[i].ATTENDED_FLAG == 'N' && allDays[i].DAY_TYPE === 'OFF') { } else if (allDays[i].ATTENDED_FLAG == 'N' && allDays[i].DAY_TYPE === 'OFF') {
allDays[i].customPresent = false; allDays[i].customPresent = false;
allDays[i].customAbsent = false; allDays[i].customAbsent = false;
@ -424,12 +436,12 @@ export class DetailsComponent implements OnInit {
], ],
borderWidth: 1, borderWidth: 1,
// cutoutPrecentage:20 , // cutoutPrecentage:20 ,
}], }],
labels: [ labels: [
'Apsent', 'Apsent',
'Present' 'Present'
] ]
}; };
} }
@ -455,7 +467,7 @@ export class DetailsComponent implements OnInit {
return 'July'; return 'July';
case 8: case 8:
return 'August'; return 'August';
case 9 : case 9:
return 'September'; return 'September';
case 10: case 10:
return 'October'; return 'October';
@ -468,32 +480,32 @@ export class DetailsComponent implements OnInit {
} }
public getMonthNameAr(value: any): any { public getMonthNameAr(value: any): any {
switch (value) { switch (value) {
case 1: case 1:
return 'يناير'; return 'يناير';
case 2: case 2:
return ' فبراير'; return ' فبراير';
case 3: case 3:
return 'مارس'; return 'مارس';
case 4: case 4:
return 'أبريل'; return 'أبريل';
case 5: case 5:
return 'مايو'; return 'مايو';
case 6: case 6:
return 'يونيو'; return 'يونيو';
case 7: case 7:
return 'يوليو'; return 'يوليو';
case 8: case 8:
return 'أغسطس'; return 'أغسطس';
case 9: case 9:
return 'سبتمبر'; return 'سبتمبر';
case 10: case 10:
return ' اكتوبر'; return ' اكتوبر';
case 11: case 11:
return ' نوفمبر'; return ' نوفمبر';
case 12: case 12:
return 'ديسمبر'; return 'ديسمبر';
} }
} }
intializeMemberDetail(userID?) { intializeMemberDetail(userID?) {
@ -502,8 +514,8 @@ export class DetailsComponent implements OnInit {
this.pageLimit = 50; this.pageLimit = 50;
this.pageNum = 1; this.pageNum = 1;
this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false); this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false);
const employees = this.common.sharedService.getSharedData( DetailsComponent.opendEmployeesARR, false); const employees = this.common.sharedService.getSharedData(DetailsComponent.opendEmployeesARR, false);
if ( employees ) { if (employees) {
this.opendEmployees.push(this.employee); this.opendEmployees.push(this.employee);
this.common.sharedService.setSharedData(this.opendEmployees, DetailsComponent.opendEmployeesARR); this.common.sharedService.setSharedData(this.opendEmployees, DetailsComponent.opendEmployeesARR);
} }
@ -524,14 +536,14 @@ export class DetailsComponent implements OnInit {
} else { } else {
// tslint:disable-next-line: prefer-for-of // tslint:disable-next-line: prefer-for-of
for (let i = 0; i < this.opendEmployees.length; i++) { for (let i = 0; i < this.opendEmployees.length; i++) {
if (this.opendEmployees[i].EMPLOYEE_NUMBER === this.employee.SUPERVISOR_NUMBER) { if (this.opendEmployees[i].EMPLOYEE_NUMBER === this.employee.SUPERVISOR_NUMBER) {
this.common.sharedService.setSharedData( this.common.sharedService.setSharedData(
this.opendEmployees[i], this.opendEmployees[i],
MyTeamService.EMPLOYEE_SHARED_DATA MyTeamService.EMPLOYEE_SHARED_DATA
); );
break; break;
}
} }
}
this.intializeMemberDetail(this.employee.SUPERVISOR_NUMBER); this.intializeMemberDetail(this.employee.SUPERVISOR_NUMBER);
} }
} }
@ -562,8 +574,8 @@ export class DetailsComponent implements OnInit {
if (userID) { if (userID) {
selEmpNo = userID; selEmpNo = userID;
} else { } else {
selEmpNo = this.employee.EMPLOYEE_NUMBER; selEmpNo = this.employee.EMPLOYEE_NUMBER;
} }
const body = { const body = {
P_SELECTED_EMPLOYEE_NUMBER: selEmpNo, P_SELECTED_EMPLOYEE_NUMBER: selEmpNo,
P_SEARCH_EMPLOYEE_NUMBER: searchEmpNum, P_SEARCH_EMPLOYEE_NUMBER: searchEmpNum,
@ -576,8 +588,8 @@ export class DetailsComponent implements OnInit {
this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => {
console.log('one'); console.log('one');
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.handleEmpResult(result.GetEmployeeSubordinatesList); this.handleEmpResult(result.GetEmployeeSubordinatesList);
} }
}); });
} }
@ -607,23 +619,23 @@ export class DetailsComponent implements OnInit {
} else { } else {
this.empSubordinate = []; this.empSubordinate = [];
} }
} }
doInfinite(infiniteScroll) { doInfinite(infiniteScroll) {
if (!this.isReachEnd) { if (!this.isReachEnd) {
this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => {
console.log('two'); console.log('two');
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.handleEmpResult(result.GetEmployeeSubordinatesList); this.handleEmpResult(result.GetEmployeeSubordinatesList);
} }
this.infiniteScroll.complete(); this.infiniteScroll.complete();
}); });
} else { } else {
if (this.infiniteScroll) { if (this.infiniteScroll) {
this.infiniteScroll.complete(); this.infiniteScroll.complete();
}
} }
} }
}
getDetails(index) { getDetails(index) {
this.common.sharedService.setSharedData(this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA); this.common.sharedService.setSharedData(this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA);
@ -692,17 +704,17 @@ doInfinite(infiniteScroll) {
this.showEmailInput = true; this.showEmailInput = true;
} }
} }
showCalender(){
if(this.showAttendence){
this.showAttendence = false
}else{ showCalender() {
if (this.showAttendence) {
this.showAttendence = false
} else {
this.showAttendence = true this.showAttendence = true
} }
} }
getSuborinatesAttStatus(){ getSuborinatesAttStatus() {
const request = { const request = {
// VersionID:2.8, // VersionID:2.8,
// Channel:37, // Channel:37,
@ -714,53 +726,121 @@ doInfinite(infiniteScroll) {
// P_USER_NAME:"111209", // P_USER_NAME:"111209",
// UserName:"111209", // UserName:"111209",
// P_EMAIL_ADDRESS:"Faisal.AlQurashi@cloudsolutions.com.sa", // P_EMAIL_ADDRESS:"Faisal.AlQurashi@cloudsolutions.com.sa",
SearchMonth:"January", SearchMonth: "January",
SearchYear:2021 SearchYear: 2021
}; };
// this.myTeamService.getSuborinatesAttStatus().subscribe((result: any) => // this.myTeamService.getSuborinatesAttStatus().subscribe((result: any) =>
this.myTeamService.getSuborinatesAttStatus(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> this.myTeamService.getSuborinatesAttStatus(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
{ this.handleRespondSuborinatesAttStatusResult(result);
this.handleRespondSuborinatesAttStatusResult(result);
})
}
handleRespondSuborinatesAttStatusResult(result){ })
// this.EmpTotal = result.GetSubordinatesAttdStatusList.length; }
this.EmpTotal = result.GetSubordinatesAttdStatusList[0].NUMBER_OF_EMPLOYEES;
console.log("total no "+this.EmpTotal) handleRespondSuborinatesAttStatusResult(result) {
// this.EmpTotal = result.GetSubordinatesAttdStatusList.length;
this.EmpTotal = result.GetSubordinatesAttdStatusList[0].NUMBER_OF_EMPLOYEES;
console.log("total no " + this.EmpTotal)
}
activeFilter(index: number) {
console.log(this.filters);
if (this.currentActiveIndex !== index) {
this.previousActiveIndex = this.currentActiveIndex;
this.currentActiveIndex = index;
this.filters[this.previousActiveIndex].active = false;
this.filters[this.currentActiveIndex].active = true;
this.selectedFilter = this.filters[this.currentActiveIndex].key;
}
}
disableFilters() {
for (const filter of this.filters) {
if (filter.key === this.itemType) {
filter.disable = false;
filter.active = true;
// filter.value = this.nextMonth - 1;
this.selectedFilter = filter.name;
} else if (this.itemType === '') {
filter.disable = false;
filter.active = false;
} else {
filter.disable = true;
filter.active = false;
} }
}
if (this.itemType === '') {
this.filters[0].active = true;
}
}
activeFilter(index: number) { //save favorite here
console.log(this.filters);
if (this.currentActiveIndex !== index) { setFavorite(selEmp) {
this.previousActiveIndex = this.currentActiveIndex; selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME;
this.currentActiveIndex = index; selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : '';
this.filters[this.previousActiveIndex].active = false; selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : '';
this.filters[this.currentActiveIndex].active = true; var confirmBoxhtml = `<div>
this.selectedFilter = this.filters[this.currentActiveIndex].key; <h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4>
} <br/>
<br/>
<div class="fav-profileImageDiv"><ion-row>`;
if (selEmp.EMPLOYEE_IMAGE)
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
if (!selEmp.EMPLOYEE_IMAGE)
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details">
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`
let userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] == selEmp.USER_NAME)
if (userIndex == -1)
this.common.presentConfirmDialog(
confirmBoxhtml
, () => {
var request =
[{ "USER_NAME": selEmp['USER_NAME'], "EMPLOYEE_DISPLAY_NAME": selEmp['EMPLOYEE_DISPLAY_NAME'], "EMAIL_ADDRESS": selEmp.EMAIL_ADDRESS, "EMPLOYEE_IMAGE": selEmp.EMPLOYEE_IMAGE, "IsFavorite": true }];
this.saveUserFavruiteList(request);
}, () => {
})
// if (selectValue == "1" || selectValue == "2" || selectValue == "3") {
// this.isSelect = true;
// }
// else {
// this.isSelect = false;
// }
}
getFavruite() {
this.worklistService.getFavorite({}, () => {
}).subscribe((result) => {
if (this.common.validResponse(result)) {
this.common.stopLoading();
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
} }
})
}
saveUserFavruiteList(request) {
this.worklistService.saveFavoriteList(request, () => {
}).subscribe((result) => {
if (this.common.validResponse(result)) {
this.common.toastPK("replacementRoll", "favorite-saved");
disableFilters() {
for (const filter of this.filters) {
if (filter.key === this.itemType) {
filter.disable = false;
filter.active = true;
// filter.value = this.nextMonth - 1;
this.selectedFilter = filter.name;
} else if (this.itemType === '') {
filter.disable = false;
filter.active = false;
} else {
filter.disable = true;
filter.active = false;
}
}
if (this.itemType === '') {
this.filters[0].active = true;
}
} }
})
}
} }

Loading…
Cancel
Save