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.
101 lines
2.2 KiB
TypeScript
101 lines
2.2 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ModalController } from '@ionic/angular';
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
import { TimeCardService } from 'src/app/time-card/service/time-card.service';
|
|
|
|
@Component({
|
|
selector: 'app-select-period',
|
|
templateUrl: './select-period.component.html',
|
|
styleUrls: ['./select-period.component.scss'],
|
|
})
|
|
export class SelectPeriodComponent implements OnInit {
|
|
public shiftTypesArray: any = [];
|
|
public selectFromDate: any;
|
|
public selectToDate: any;
|
|
public selectedShiftType: any;
|
|
|
|
public filtersArray: any = [
|
|
{
|
|
name: 'Excess',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Timeback',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Comp Off',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Non scheduled',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Late In',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Early Out',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Shortage',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Missing Swipe',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Work On Break',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Analyzed',
|
|
active: false,
|
|
},
|
|
{
|
|
name: 'Approved Timeback',
|
|
active: false,
|
|
},
|
|
];
|
|
constructor(
|
|
public modalController: ModalController,
|
|
public common: CommonService,
|
|
public timeCardService: TimeCardService) { }
|
|
|
|
ngOnInit() {
|
|
this.getShiftTypes();
|
|
}
|
|
|
|
public dismissModal() {
|
|
const selectedFilters: any = [];
|
|
for (const filter of this.filtersArray) {
|
|
if (filter.active) {
|
|
selectedFilters.push(filter);
|
|
}
|
|
}
|
|
this.modalController.dismiss({
|
|
dismissed: true,
|
|
selectedFiltersArray: selectedFilters,
|
|
selectedShiftType: this.selectedShiftType,
|
|
selectFromDate: this.selectFromDate,
|
|
selectToDate: this.selectToDate
|
|
});
|
|
}
|
|
|
|
public changeFiltersSelection(i: any) {
|
|
this.filtersArray[i].active = !this.filtersArray[i].active;
|
|
}
|
|
|
|
public getShiftTypes() {
|
|
this.timeCardService.getShiftType().subscribe((result) => {
|
|
if (this.common.validResponse(result)) {
|
|
this.shiftTypesArray = result.GetShiftTypesList;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|