Claims: add alert when add or remove from the basket

This commit is contained in:
argirok 2022-05-11 18:46:51 +03:00
parent f8b76246f5
commit 4608635879
2 changed files with 29 additions and 3 deletions

View File

@ -28,11 +28,11 @@ declare var UIkit: any;
height="1"></rect></svg>
</span>
</a>
<span *ngIf="isSelected(entity)" class="uk-icon-button uk-button-primary ">
<a *ngIf="isSelected(entity)" class="uk-icon-button uk-button-primary " (click)="remove(entity)">
<span class="uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="check" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.1" points="4,10 8,15 17,4"></polyline></svg>
</span>
</span>
</a>
</div>
</div>
@ -78,6 +78,27 @@ export class ClaimResultsComponent {
if (this.selectedResults != null) {
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.selectedResults));
}
UIkit.notification(item.type + ' added in your basket!', {
status: 'success',
timeout: 4000,
pos: 'bottom-right'
});
}
}
remove(item: any) {
const index: number = this.selectedResults.indexOf(item);
if (index > -1) {
this.selectedResults.splice(index, 1);
if (this.selectedResults != null) {
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.selectedResults));
}
UIkit.notification(item.type + ' removed from your basket!', {
status: 'warning',
timeout: 4000,
pos: 'bottom-right'
});
}
}
}

View File

@ -1,6 +1,6 @@
import {Component, Input} from '@angular/core';
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
declare var UIkit: any;
@Component({
selector: 'claim-selected-results',
templateUrl: 'selectedResults.component.html'
@ -24,6 +24,11 @@ export class ClaimSelectedResultsComponent {
if (this.results != null) {
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.results));
}
UIkit.notification(item.type + ' removed from your basket!', {
status: 'warning',
timeout: 4000,
pos: 'bottom-right'
});
}
}