Merged PR 874: #2223 WE Filter estimatedShippingDate queryParams Fix

#2223 WE Filter estimatedShippingDate queryParams Fix
This commit is contained in:
Nino Righi
2021-09-23 13:53:18 +00:00
committed by Lorenz Hilpert
parent 7b71c0e343
commit 1e2b527a80
2 changed files with 32 additions and 0 deletions

View File

@@ -23,6 +23,7 @@
[ngModel]="uiStartOption?.value"
(save)="uiStartOption?.setValue($event)"
>
<ng-container #content>Übernehmen</ng-container>
</ui-datepicker>
</div>
<div *ngIf="uiStopOption" class="option">
@@ -49,6 +50,7 @@
[ngModel]="uiStopOption?.value"
(save)="uiStopOption?.setValue($event)"
>
<ng-container #content>Übernehmen</ng-container>
</ui-datepicker>
</div>
</div>

View File

@@ -167,6 +167,7 @@ export class UiOption implements IUiOption {
trySetFromValue(value: string) {
const type = this.getParentInput()?.type;
switch (type) {
case UiInputType.Bool:
case UiInputType.InputSelector:
@@ -179,6 +180,9 @@ export class UiOption implements IUiOption {
case UiInputType.IntegerRange:
this.trySetFromNumberRange(value);
break;
case UiInputType.DateRange:
this.trySetFromDateRange(value);
break;
}
}
@@ -191,6 +195,32 @@ export class UiOption implements IUiOption {
}
}
trySetFromDateRange(value: string) {
let split: string[] = [];
if (value) {
if (value?.includes('"-"')) {
split = value.split('"-"');
} else if (value?.includes('-"')) {
split = value.split('-"');
} else if (value?.includes('"-')) {
split = value.split('"-');
}
}
if (this.key === 'start') {
if (split[0]) {
split[0] = split[0].replace(new RegExp('"', 'g'), '');
}
this.setValue(split[0]);
} else if (this.key === 'stop') {
if (split[1]) {
split[1] = split[1].replace(new RegExp('"', 'g'), '');
}
this.setValue(split[1]);
}
}
trySetBoolFromValue(value: string) {
const valueSplits = value?.split(';');
if (valueSplits.includes(this.value)) {