You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
239 lines
6.3 KiB
TypeScript
239 lines
6.3 KiB
TypeScript
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
|
import { ModalController, NavParams, IonInfiniteScroll } from '@ionic/angular';
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
// import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
|
|
@Component({
|
|
selector: 'app-date-info-modal',
|
|
templateUrl: './date-info-modal.component.html',
|
|
styleUrls: ['./date-info-modal.component.scss'],
|
|
})
|
|
export class DateInfoModalComponent implements OnInit {
|
|
[x: string]: any;
|
|
gaugeType = "full";
|
|
gaugeValue = 28.3;
|
|
gaugeLabel = "Days";
|
|
@Input() TODAYDATE: any;
|
|
@Input() SHIFTDETAILS:any;
|
|
today: any;
|
|
todayDate: any;
|
|
month: any;
|
|
monthDate: any;
|
|
excess: any;
|
|
shortage:any;
|
|
lateIn:any;
|
|
scheduled:any;
|
|
earlyOut:any;
|
|
shiftTime:any;
|
|
startDate:any;
|
|
endDate:any;
|
|
shift:any;
|
|
percentage:any;
|
|
data:any;
|
|
scheduleDate:any;
|
|
tests:any;
|
|
year: any;
|
|
nameMonth:any;
|
|
nameDay: any;
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
// public weekDaysEnSort = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
public weekDaysEn = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
|
|
public options = {
|
|
cutoutPercentage: 85,
|
|
|
|
tooltips: { enabled: false },
|
|
|
|
legend: { display: false }
|
|
|
|
};
|
|
|
|
constructor(public modalController: ModalController, public navParams: NavParams, public ts:TranslatorService,
|
|
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
// this.shift =this.common.sharedService.getSharedData('shiftDetailsData');
|
|
console.log(this.TODAYDATE.SCHEDULE_DATE.split(" ")[0].split(" "))
|
|
//22/2/2019
|
|
console.log(this.TODAYDATE.EXCESS_HRS)
|
|
|
|
this.excess = this.TODAYDATE.EXCESS_HRS
|
|
console.log(this.TODAYDATE.LATE_IN_HRS)
|
|
this.lateIn = this.TODAYDATE.LATE_IN_HRS
|
|
console.log(this.TODAYDATE.SHORTAGE_HRS)
|
|
this.shortage = this.TODAYDATE.SHORTAGE_HRS
|
|
console.log(this.TODAYDATE.SCHEDULED_HRS)
|
|
this.scheduled = this.TODAYDATE.SCHEDULED_HRS
|
|
console.log(this.TODAYDATE.EARLY_OUT_HRS )
|
|
this.earlyOut = this.TODAYDATE.EARLY_OUT_HRS
|
|
this.scheduleDate = this.TODAYDATE. SCHEDULE_DATE
|
|
|
|
console.log(this.TODAYDATE. SCHEDULE_DATE)
|
|
|
|
|
|
// console.log(this.SHIFTDETAILS)
|
|
// console.log(this.SHIFTDETAILS.SHT_NAME)
|
|
this.shiftTime= this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_NAME
|
|
this.startDate= this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_START_TIME
|
|
this.endDate= this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_END_TIME
|
|
this.percentage=this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].PERCENTAGE
|
|
|
|
this.percChart= this.percentage.substring(0,this.percentage.indexOf("%"));
|
|
let test = this.scheduleDate;
|
|
let splitdate =test.split(" ");
|
|
let date =splitdate[0];
|
|
let test1 =date.split("/");
|
|
console.log("" + test1);
|
|
this. month =test1[1];
|
|
console.log("" + this.month);
|
|
this. year =test1[2];
|
|
console.log("" + this.year);
|
|
this.day =test1[0];
|
|
console.log("date: "+ date);
|
|
console.log("this.percChart: " +this.percChart);
|
|
|
|
this.nameMonth=this.getMonthName(parseInt(this.month))
|
|
console.log("" + this.nameMonth)
|
|
console.log("" + this.month)
|
|
|
|
this.nameDay=this.getHeaderDay(new Date(date))
|
|
console.log("" + this.nameDay)
|
|
|
|
|
|
// let testnamdeday=this.weekDaysEnSort[new Date(date).getDay()];
|
|
|
|
// console.log("testnamdeday" + testnamdeday)
|
|
|
|
|
|
let d = new Date(date);
|
|
let dayName = d.toString().split(' ')[0];
|
|
|
|
this.data = {
|
|
labels: ['percentage'],
|
|
datasets: [
|
|
|
|
{
|
|
|
|
data: [this.percChart],
|
|
// data: [96],
|
|
backgroundColor: [
|
|
'#22C6B3',
|
|
|
|
// '#22C6B3'
|
|
],
|
|
|
|
borderWidth: 2
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
|
|
|
// this.startDate= this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_START_DATETIME;
|
|
|
|
// console.log(this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_START_TIME)
|
|
|
|
|
|
// console.log(this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_END_DATETIME );
|
|
// this.endDate= this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_END_DATETIME ;
|
|
|
|
// console.log(this.SHIFTDETAILS.GetScheduleShiftsDetailsList[0].SHT_ACTUAL_END_TIME )
|
|
|
|
// SHT_ACTUAL_START_DATETIME
|
|
// SHT_ACTUAL_START_TIME
|
|
// SHT_ACTUAL_END_DATETIME
|
|
// SHT_ACTUAL_END_TIME
|
|
|
|
|
|
//let dateData = this.TODAYDATE.split(' ');
|
|
// console.log(dateData)
|
|
// this.today = dateData[0];
|
|
// this.todayDate = dateData[1];
|
|
// this.monthDate = dateData[2];
|
|
// this.month = dateData[3];
|
|
// console.log(this.todayDate);
|
|
// console.log(this.today);
|
|
// console.log(this.monthDate);
|
|
// console.log(this.month);
|
|
|
|
}
|
|
|
|
|
|
public getMonthName(value: number): string {
|
|
switch (value) {
|
|
case 1:
|
|
return "Jan";
|
|
case 2:
|
|
return "Feb";
|
|
case 3:
|
|
return "Mar";
|
|
case 4:
|
|
return "Apr";
|
|
case 5:
|
|
return "May";
|
|
case 6:
|
|
return "Jun";
|
|
case 7:
|
|
return "Jul";
|
|
case 8:
|
|
return "Aug";
|
|
case 9:
|
|
return "Sep";
|
|
case 10:
|
|
return "Oct";
|
|
case 11:
|
|
return "Nov";
|
|
case 12:
|
|
return "Dec";
|
|
}
|
|
}
|
|
|
|
getHeaderDay(date: any) {
|
|
// return this.weekDaysEnSort[date.getDay()];
|
|
return this.weekDaysEn[date.getDay()];
|
|
|
|
}
|
|
|
|
// hide(){
|
|
// this.hideMe = true;
|
|
// }
|
|
// @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
// public options = {
|
|
// cutoutPercentage: 80,
|
|
|
|
// tooltips: { enabled: false },
|
|
|
|
// legend: { display: false }
|
|
|
|
// };
|
|
|
|
//
|
|
//return this.weekDaysEn[date.getDay()] + ", " + date.getDate() + " " + this.getMonthName(date.getMonth() + 1) + " " + date.getFullYear();
|
|
// create muthod recive date
|
|
// them get day date.getDay()
|
|
// them get month name this.getMonthName(date.getMonth() + 1)
|
|
// date.getFullYear()
|
|
//implemeition this.getMonthName()
|
|
|
|
//SCHEDULE_DATE: "2/1/2020 12:00:00 AM"
|
|
//GetDayHoursTypeDetailsList
|
|
|
|
|
|
// // date = {scheduleDate};
|
|
// let a = date.split(" ");
|
|
// let date = a[0];
|
|
//test=date.split("/")
|
|
// test[0]
|
|
// test[1]
|
|
// test[3]
|
|
|
|
|
|
// let date2 = date.split("/");
|
|
// String part1 = parts[0];
|
|
// String part2 = parts[1];
|
|
// String part3 = parts[2];
|
|
|
|
}
|