From 42f0938edfeae4a06cea8eefb1d16764e50aabc6 Mon Sep 17 00:00:00 2001 From: "hamza.hramchi" <hamza.hramchi@xelians.fr> Date: Thu, 15 Oct 2020 12:09:11 +0200 Subject: [PATCH] FEAT #13271 TIME 0:40 add and display the element in displaySecondryData after a remove all Data in basketList --- .../basket/list/list-administration.component.ts | 6 ++++-- .../search/search-administration.component.ts | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/app/administration/basket/list/list-administration.component.ts b/src/frontend/app/administration/basket/list/list-administration.component.ts index 9a1ba69f0f7..79e6c19b049 100644 --- a/src/frontend/app/administration/basket/list/list-administration.component.ts +++ b/src/frontend/app/administration/basket/list/list-administration.component.ts @@ -369,7 +369,7 @@ export class ListAdministrationComponent implements OnInit { addData(event: any) { const i = this.availableData.map((e: any) => e.value).indexOf(event.option.value.value); - if (this.displayedSecondaryData[this.displayedSecondaryData.length - 1].length >= this.selectedTemplateDisplayedSecondaryData) { + if ((this.displayedSecondaryData.length === 0) || (this.displayedSecondaryData[this.displayedSecondaryData.length - 1].length >= this.selectedTemplateDisplayedSecondaryData)) { this.displayedSecondaryData.push([]); } this.displayedSecondaryData[this.displayedSecondaryData.length - 1].push(event.option.value); @@ -385,7 +385,9 @@ export class ListAdministrationComponent implements OnInit { } removeAllData() { - this.availableData = this.availableData.concat(this.displayedSecondaryData); + this.displayedSecondaryData.forEach(element => { + this.availableData = this.availableData.concat(element); + }); this.displayedSecondaryData = []; this.dataControl.setValue(''); } diff --git a/src/frontend/app/administration/search/search-administration.component.ts b/src/frontend/app/administration/search/search-administration.component.ts index 300dcebd946..98af549180c 100644 --- a/src/frontend/app/administration/search/search-administration.component.ts +++ b/src/frontend/app/administration/search/search-administration.component.ts @@ -8,7 +8,6 @@ import { startWith, map, tap, catchError } from 'rxjs/operators'; import { Observable, of } from 'rxjs'; import { AppService } from '@service/app.service'; import { HeaderService } from '@service/header.service'; -import { each } from 'jquery'; declare var $: any; -- GitLab