changed datepicker dialog
parent
d0e777e0a6
commit
8cbc259716
|
|
@ -44,7 +44,6 @@ import {MatBadgeModule} from '@angular/material/badge';
|
||||||
import { CustomPaginatorIntl } from './custom-paginator-intl.service';
|
import { CustomPaginatorIntl } from './custom-paginator-intl.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
|
|
@ -88,10 +87,8 @@ import { CustomPaginatorIntl } from './custom-paginator-intl.service';
|
||||||
MatButtonToggleModule,
|
MatButtonToggleModule,
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatBadgeModule
|
MatBadgeModule
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
providers: [ToolbarService,
|
providers: [ToolbarService,
|
||||||
EditService,
|
EditService,
|
||||||
SelectionService,
|
SelectionService,
|
||||||
|
|
@ -99,6 +96,7 @@ import { CustomPaginatorIntl } from './custom-paginator-intl.service';
|
||||||
SortService,
|
SortService,
|
||||||
FilterService,
|
FilterService,
|
||||||
{ provide: MatPaginatorIntl, useClass: CustomPaginatorIntl },
|
{ provide: MatPaginatorIntl, useClass: CustomPaginatorIntl },
|
||||||
|
ReactiveFormsModule
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,27 @@
|
||||||
[matBadge]="''" class="dot-badge"></mat-badge></mat-panel-title>
|
[matBadge]="''" class="dot-badge"></mat-badge></mat-panel-title>
|
||||||
<mat-panel-description>{{this.languageService.lMap.get('filterDilogDateText')}}</mat-panel-description>
|
<mat-panel-description>{{this.languageService.lMap.get('filterDilogDateText')}}</mat-panel-description>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
|
<mat-form-field appearance="fill" style="width: 100%;">
|
||||||
|
<mat-label>{{this.languageService.lMap.get('filterDilogDate')}}</mat-label>
|
||||||
|
<mat-date-range-input [formGroup]="range" [rangePicker]="picker">
|
||||||
|
<input matStartDate formControlName="start"
|
||||||
|
placeholder="{{this.languageService.lMap.get('filterDilogSearchFrom')}}">
|
||||||
|
<input matEndDate formControlName="end"
|
||||||
|
placeholder="{{this.languageService.lMap.get('filterDilogSearchTo')}}">
|
||||||
|
</mat-date-range-input>
|
||||||
|
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
|
||||||
|
<mat-date-range-picker #picker></mat-date-range-picker>
|
||||||
|
</mat-form-field>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
|
||||||
|
<!-- <mat-expansion-panel>
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>{{this.languageService.lMap.get('filterDilogDate')}}<mat-badge *ngIf="DateEnabled"
|
||||||
|
[matBadge]="''" class="dot-badge"></mat-badge></mat-panel-title>
|
||||||
|
<mat-panel-description>{{this.languageService.lMap.get('filterDilogDateText')}}</mat-panel-description>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
<mat-form-field appearance="fill" style="width: 48%;">
|
<mat-form-field appearance="fill" style="width: 48%;">
|
||||||
<mat-label>{{this.languageService.lMap.get('filterDilogSearchFrom')}}</mat-label>
|
<mat-label>{{this.languageService.lMap.get('filterDilogSearchFrom')}}</mat-label>
|
||||||
<input (input)="this.onDateSelect()" matInput [matDatepicker]="picker1" [(ngModel)]="filterStartDate">
|
<input (input)="this.onDateSelect()" matInput [matDatepicker]="picker1" [(ngModel)]="filterStartDate">
|
||||||
|
|
@ -83,7 +104,7 @@
|
||||||
<mat-datepicker-toggle matIconSuffix [for]="picker2"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matIconSuffix [for]="picker2"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #picker2></mat-datepicker>
|
<mat-datepicker #picker2></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel> -->
|
||||||
|
|
||||||
<mat-expansion-panel>
|
<mat-expansion-panel>
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { DataService } from '../data.service';
|
import { DataService } from '../data.service';
|
||||||
import { MAT_DATE_FORMATS } from '@angular/material/core'
|
import { MAT_DATE_FORMATS } from '@angular/material/core'
|
||||||
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||||
|
|
||||||
export interface FilterAttribute {
|
export interface FilterAttribute {
|
||||||
name: string,
|
name: string,
|
||||||
|
|
@ -75,6 +76,7 @@ export class FilterDialogComponent implements OnInit {
|
||||||
public IntervallEnabled: boolean = false;
|
public IntervallEnabled: boolean = false;
|
||||||
|
|
||||||
public filterObj;
|
public filterObj;
|
||||||
|
public range: FormGroup;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -84,8 +86,12 @@ export class FilterDialogComponent implements OnInit {
|
||||||
* @param data contains an array of Changes which should be sent to the backend for a status transition
|
* @param data contains an array of Changes which should be sent to the backend for a status transition
|
||||||
* @param dataService injects the dataService for data management and backend communication
|
* @param dataService injects the dataService for data management and backend communication
|
||||||
*/
|
*/
|
||||||
constructor(public languageService: LanguageService, public dialogRef: MatDialogRef<FilterDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any, private dataService: DataService, private _snackBar: MatSnackBar) {
|
constructor(public languageService: LanguageService, public dialogRef: MatDialogRef<FilterDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any, private dataService: DataService, private _snackBar: MatSnackBar, private fb: FormBuilder) {
|
||||||
//dialogRef.beforeClosed().subscribe(() => dialogRef.close(this.dataToReturn));
|
//dialogRef.beforeClosed().subscribe(() => dialogRef.close(this.dataToReturn));
|
||||||
|
this.range = this.fb.group({
|
||||||
|
start: [null],
|
||||||
|
end: [null]
|
||||||
|
});
|
||||||
|
|
||||||
if (data[0].filters) {
|
if (data[0].filters) {
|
||||||
////console.log(data[0].filters.filterElement);
|
////console.log(data[0].filters.filterElement);
|
||||||
|
|
@ -278,8 +284,7 @@ export class FilterDialogComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public onDateSelect() {
|
public onDateSelect() {
|
||||||
console.log("################################")
|
if (this.range.controls['start'].value && this.range.controls['end'].value) {
|
||||||
if(this.filterStartDate && this.filterEndDate){
|
|
||||||
this.DateEnabled = true;
|
this.DateEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
this.DateEnabled = false;
|
this.DateEnabled = false;
|
||||||
|
|
@ -287,7 +292,6 @@ export class FilterDialogComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function mapFilter builds a filterElement out of all the selected filters, delivers it back and closes the dialog
|
* The function mapFilter builds a filterElement out of all the selected filters, delivers it back and closes the dialog
|
||||||
*/
|
*/
|
||||||
|
|
@ -296,63 +300,68 @@ export class FilterDialogComponent implements OnInit {
|
||||||
if (this.paketTypesFilter.length > 0) {
|
if (this.paketTypesFilter.length > 0) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "PackageType",
|
"column": "PackageType",
|
||||||
"filter": "equals",
|
"filter": "equals",
|
||||||
"criteria": this.paketTypesFilter
|
"criteria": this.paketTypesFilter
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.statesFilter.length > 0) {
|
if (this.statesFilter.length > 0) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "State",
|
"column": "State",
|
||||||
"filter": "equals",
|
"filter": "equals",
|
||||||
"criteria": this.statesFilter
|
"criteria": this.statesFilter
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.contractsFilter.length > 0) {
|
if (this.contractsFilter.length > 0) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "Contract",
|
"column": "Contract",
|
||||||
"filter": "equals",
|
"filter": "equals",
|
||||||
"criteria": this.contractsFilter
|
"criteria": this.contractsFilter
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.supportGroupsFilter.length > 0) {
|
if (this.supportGroupsFilter.length > 0) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "SupportGroup",
|
"column": "SupportGroup",
|
||||||
"filter": "equals",
|
"filter": "equals",
|
||||||
"criteria": this.supportGroupsFilter
|
"criteria": this.supportGroupsFilter
|
||||||
});
|
});
|
||||||
//console.log(this.supportGroupsFilter);
|
//console.log(this.supportGroupsFilter);
|
||||||
} else {
|
} else {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "SupportGroup",
|
"column": "SupportGroup",
|
||||||
"filter": "equals",
|
"filter": "equals",
|
||||||
"criteria": [this.userSupportGroup]
|
"criteria": [this.userSupportGroup]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.range.controls['start'].value && this.range.controls['end'].value) {
|
||||||
|
filterElement.push({
|
||||||
|
"column": "D2",
|
||||||
|
"filter": "dateRange",
|
||||||
|
"criteria": [new Date(this.range.controls['start'].value), new Date(this.range.controls['end'].value)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.filterStartDate != null && this.filterEndDate != null) {
|
if (this.filterStartDate != null && this.filterEndDate != null) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "D2",
|
"column": "D2",
|
||||||
"filter": "dateRange",
|
"filter": "dateRange",
|
||||||
"criteria": [new Date(this.filterStartDate), new Date(this.filterEndDate)]
|
"criteria": [new Date(this.filterStartDate), new Date(this.filterEndDate)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.criteria != null && this.criteria != "") {
|
if (this.criteria != null && this.criteria != "") {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "ResourceName",
|
"column": "ResourceName",
|
||||||
"filter": "contains",
|
"filter": "contains",
|
||||||
"criteria": [this.criteria]
|
"criteria": [this.criteria]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.intervallFilter) {
|
if (this.intervallFilter) {
|
||||||
filterElement.push({
|
filterElement.push({
|
||||||
"column": "ASF_WI_HighestIntervall",
|
"column": "ASF_WI_HighestIntervall",
|
||||||
"filter": ">",
|
"filter": ">",
|
||||||
"criteria": [365]
|
"criteria": [365]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue