pd schedule changes
This commit is contained in:
parent
f146c7809d
commit
5d23626fad
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, Inject, Pipe, PipeTransform } from '@angular/core';
|
import { Component, OnInit, Inject, Pipe, PipeTransform, OnDestroy } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||||
import { NotifierService } from 'angular-notifier';
|
import { NotifierService } from 'angular-notifier';
|
||||||
@ -15,7 +15,8 @@ export interface Timeslot {
|
|||||||
templateUrl: './schedule-pd.component.html',
|
templateUrl: './schedule-pd.component.html',
|
||||||
styleUrls: ['./schedule-pd.component.scss']
|
styleUrls: ['./schedule-pd.component.scss']
|
||||||
})
|
})
|
||||||
export class SchedulePdComponent implements OnInit {
|
export class SchedulePdComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public pageTitle: string = "PD Schedule";
|
public pageTitle: string = "PD Schedule";
|
||||||
pipe = new DatePipe('en-US');
|
pipe = new DatePipe('en-US');
|
||||||
public selectedMoment = new Date();
|
public selectedMoment = new Date();
|
||||||
@ -55,6 +56,7 @@ export class SchedulePdComponent implements OnInit {
|
|||||||
|
|
||||||
// ];
|
// ];
|
||||||
public min = new Date();
|
public min = new Date();
|
||||||
|
validateTime:any;
|
||||||
constructor(notifier: NotifierService, private dialogRef: MatDialogRef<SchedulePdComponent>,
|
constructor(notifier: NotifierService, private dialogRef: MatDialogRef<SchedulePdComponent>,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||||
@ -62,9 +64,18 @@ export class SchedulePdComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.validateTime = setInterval(() => {
|
||||||
|
let currentTime:any = new Date();
|
||||||
|
currentTime = currentTime.getFullYear()+'-'+currentTime.getMonth()+'-'+currentTime.getDay()+currentTime.getHours()+'-'+currentTime.getMinutes();
|
||||||
|
let existTime:any = this.selectedMoment.getFullYear()+'-'+this.selectedMoment.getMonth()+'-'+this.selectedMoment.getDay() +'-'+this.selectedMoment.getHours()+'-'+this.selectedMoment.getMinutes();
|
||||||
|
if(existTime < currentTime) {
|
||||||
|
this.selectedMoment = new Date();
|
||||||
|
this.min = new Date();
|
||||||
|
|
||||||
|
}
|
||||||
|
},1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close pd schedule pop up
|
// close pd schedule pop up
|
||||||
closeScheduleComponent(): void {
|
closeScheduleComponent(): void {
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
@ -72,6 +83,7 @@ export class SchedulePdComponent implements OnInit {
|
|||||||
// update pd schedule
|
// update pd schedule
|
||||||
|
|
||||||
upatePDSchedule(date:any){
|
upatePDSchedule(date:any){
|
||||||
|
|
||||||
let myFormattedDate = this.pipe.transform(date, 'yyyy-MM-dd HH:mm');
|
let myFormattedDate = this.pipe.transform(date, 'yyyy-MM-dd HH:mm');
|
||||||
|
|
||||||
let updateData = {
|
let updateData = {
|
||||||
@ -94,4 +106,7 @@ export class SchedulePdComponent implements OnInit {
|
|||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
clearInterval(this.validateTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user