[HIMA-845] customer negative filters now when switching to negative filters the gastkunde checkbox is checked automaticaly

This commit is contained in:
Eraldo Hasanaj
2019-10-08 16:02:59 +02:00
parent 0a9cb43406
commit 40427e0b95
5 changed files with 45 additions and 7 deletions

View File

@@ -208,11 +208,11 @@ export class CustomerSearchResultComponent implements OnInit {
: false
: false;
this.filters = {
guestaccount: undefined,
guestaccount: side === Side.RIGHT ? false : undefined,
bonuscard: undefined,
onlineshop: undefined,
};
if (!noFilters) {
if (!noFilters || side === Side.RIGHT) {
this.ds = new CustomerSearchDataSource(
this.customerSearch.query,
this.store,

View File

@@ -1,8 +1,13 @@
<span class="option">
<span class="checkbox" (click)="onChange()">
<img class="checkbox-icon" src="/assets/images/Check_box_1.svg" />
<img class="checked negative" src="/assets/images/close.svg" *ngIf="option.selected && _negative" />
<img class="checked" src="/assets/images/Check.svg" *ngIf="option.selected && !_negative" />
<img
class="checked negative"
[ngClass]="{ 'mobile-neg': isIPad }"
src="/assets/images/close.svg"
*ngIf="option.selected && _negative"
/>
<img class="checked" [ngClass]="{ 'mobile-poz': isIPad }" src="/assets/images/Check.svg" *ngIf="option.selected && !_negative" />
</span>
<span class="text">{{ option.value }}</span>
</span>

View File

@@ -36,4 +36,14 @@
width: 14px;
height: 15px;
}
.mobile-poz {
margin-left: 5px;
margin-top: -2px;
}
.mobile-neg {
margin-left: 5px;
margin-top: -2px;
}
}

View File

@@ -1,5 +1,6 @@
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, OnInit } from '@angular/core';
import { CheckboxOption } from './models';
import { WindowRef } from './services/window-ref.service';
@Component({
selector: 'app-checkbox',
@@ -7,7 +8,7 @@ import { CheckboxOption } from './models';
styleUrls: ['./checkbox.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CheckboxComponent {
export class CheckboxComponent implements OnInit {
@Input() option: CheckboxOption;
@Input() set negative(val) {
this._negative = val;
@@ -15,8 +16,13 @@ export class CheckboxComponent {
}
@Output() valueChanges: EventEmitter<boolean> = new EventEmitter();
_negative = false;
isIPad = false;
constructor(private cdrf: ChangeDetectorRef) {}
constructor(private cdrf: ChangeDetectorRef, private windowRef: WindowRef) {}
ngOnInit() {
this.isIPad = this.isIPadEnv();
}
onChange() {
if (!this.option.disabled) {
@@ -24,4 +30,11 @@ export class CheckboxComponent {
this.valueChanges.emit(this.option.selected);
}
}
public isIPadEnv() {
const navigator = this.windowRef.nativeWindow.navigator as Navigator;
const userAgent = navigator.userAgent.toLowerCase(),
ios = /iphone|ipod|ipad/.test(userAgent);
return ios;
}
}

View File

@@ -0,0 +1,10 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class WindowRef {
get nativeWindow(): Window {
return window;
}
}