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();
@ -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();
} }
@ -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.currentActiveIndex = this.nextMonth -1;
this.activeFilter(this.preMonth);
this.calendarConfig(this.common.getMonthName(new Date().getMonth() + 1), new Date().getFullYear()); this.calendarConfig(this.common.getMonthName(new Date().getMonth() + 1), new Date().getFullYear());
} }
calendarConfig(month?, year?) { calendarConfig(month?, year?) {
@ -303,11 +308,18 @@ 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();
this.currentDate = new Date(new Date().getFullYear(), monthNo - 1);
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("next month =" + this.nextMonth);
console.log(" Month Name =" + this.currentMonthName); console.log(" Month Name =" + this.currentMonthName);
@ -719,8 +731,7 @@ doInfinite(infiniteScroll) {
}; };
// 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);
}) })
@ -763,4 +774,73 @@ doInfinite(infiniteScroll) {
} }
} }
//save favorite here
setFavorite(selEmp) {
selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME;
selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : '';
selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : '';
var confirmBoxhtml = `<div>
<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");
}
})
}
} }

Loading…
Cancel
Save