mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
[HIMA-845] customer negative filters now when switching to negative filters the gastkunde checkbox is checked automaticaly
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -36,4 +36,14 @@
|
||||
width: 14px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.mobile-poz {
|
||||
margin-left: 5px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
.mobile-neg {
|
||||
margin-left: 5px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
10
libs/ui/src/lib/checkbox/services/window-ref.service.ts
Normal file
10
libs/ui/src/lib/checkbox/services/window-ref.service.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class WindowRef {
|
||||
get nativeWindow(): Window {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user