Commit 9287d08f authored by descamps's avatar descamps
Browse files

KDE - 18/08/2021 - Regrouper dans un cartouche les métadonnées identiques...

KDE - 18/08/2021 - Regrouper dans un cartouche les métadonnées identiques ajoutées dans la pop up d'Ajout de métadonnées - WIP
parent 6351108b
......@@ -7,12 +7,15 @@
<!-- The selected items -->
<div *ngIf="addedItems?.length > 0" class ="pastis-container-selected-items">
<div *ngIf="!isElementPresent;else pasPresent">
<div style="display: inline-flex" *ngFor="let item of addedItems| filter:'isElementPresent':false;let i =index ">
<div class="selected-items-box">
<!-- <div *ngIf="!isElementPresent;else pasPresent">-->
<div style="display: inline-flex" *ngFor="let item of addedItems ;let i =index ">
<!-- <div style="display: inline-flex" *ngFor="let item of addedItems | unique ;let i =index ">-->
<div class="selected-items-box" >
<span style="padding: 12px;">
<i *ngIf="isElementComplex(item)" class="vitamui-icon vitamui-icon-arborescence"></i>
<span class="item-text" *ngIf="isElementDupliquer(item)"> {{valeur}} X</span>
<!-- <span class="item-text" *ngIf="isElementDupliquer(item)"> {{valeur}} X</span>-->
<span class="badge" *ngIf="isElementDupliquer(item)">{{valeur}}</span>
<span class="item-text">{{onResolveName(item)}}</span>
</span>
<mat-divider vertical class="selected-items-separator"></mat-divider>
......@@ -20,20 +23,20 @@
</div>
</div>
</div>
<ng-template #pasPresent>
<div style="display: inline-flex" *ngFor="let item of addedItems ;let i =index ">
<div class="selected-items-box">
<span style="padding: 12px;">
<i *ngIf="isElementComplex(item)" class="vitamui-icon vitamui-icon-arborescence"></i>
<span class="item-text" *ngIf="isElementDupliquer(item)"> {{valeur}} X</span>
<span class="item-text">{{onResolveName(item)}}</span>
</span>
<mat-divider vertical class="selected-items-separator"></mat-divider>
<span class="selected-items-close" (click)="onRemoveSelectedElement(item)">&times;</span>
</div>
</div>
</ng-template>
</div>
<!-- <ng-template #pasPresent>-->
<!-- <div style="display: inline-flex" *ngFor="let item of addedItems ;let i =index ">-->
<!-- <div class="selected-items-box">-->
<!-- <span style="padding: 12px;">-->
<!-- <i *ngIf="isElementComplex(item)" class="vitamui-icon vitamui-icon-arborescence"></i>-->
<!-- <span class="item-text" *ngIf="isElementDupliquer(item)"> {{valeur}} X</span>-->
<!-- <span class="item-text">{{onResolveName(item)}}</span>-->
<!-- </span>-->
<!-- <mat-divider vertical class="selected-items-separator"></mat-divider>-->
<!-- <span class="selected-items-close" (click)="onRemoveSelectedElement(item)">&times;</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </ng-template>-->
<!-- </div>-->
<!-- The list of items to be selected-->
<mat-list *ngIf="allowedChildren?.length; else noItemsLeftToAdd" class="list-box-head">
......
......@@ -46,6 +46,7 @@ import { PastisDialogData } from '../../shared/pastis-dialog/classes/pastis-dial
import { PopupService } from '../../core/services/popup.service';
import { Subscription } from 'rxjs';
import { PastisPopupMetadataLanguageService } from '../../shared/pastis-popup-metadata-language/pastis-popup-metadata-language.service';
import * as _ from 'lodash';
export interface Item {
......@@ -84,6 +85,7 @@ export class UserActionAddMetadataComponent implements OnInit {
resultItem: Map<any, any>;
valeur: number;
isElementPresent: boolean;
d:number[] = [];
constructor(public dialogRef: MatDialogRef<PastisDialogConfirmComponent>,
......@@ -181,6 +183,9 @@ export class UserActionAddMetadataComponent implements OnInit {
else{
this.isElementPresent = false
console.log("NON PRESENT")
const a= this.addedItems.length;
this.d.push(a);
this.d.forEach(element => console.log(element + "tableau des index où il y a doublon"));
}
this.addedItems.push(elementName);
......@@ -219,10 +224,7 @@ export class UserActionAddMetadataComponent implements OnInit {
this.valeur = this.resultItem.get(elementName);
console.log(this.valeur + "valeur")
if(this.valeur > 1)
return true;
else
return false;
return this.valeur > 1;
}
getDefinition(elementName:string):string {
......@@ -270,3 +272,18 @@ export class FilterByNamePipe implements PipeTransform {
return listOfNames.filter(name => name.toLowerCase().indexOf(nameToFilter.toLowerCase()) >= 0);
}
}
@Pipe({
name: 'unique',
pure: false
})
export class UniquePipe implements PipeTransform {
transform(value: any): any{
if(value!== undefined && value!== null){
return _.uniqBy(value, 'name');
}
return value;
}
}
/*
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
[dad@cines.fr]
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
profiles based on the french SEDA standard
(https://redirect.francearchives.fr/seda/).
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
......@@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
......@@ -40,22 +40,22 @@ import { CommonModule } from '@angular/common';
import { FileUploadModule } from 'ng2-file-upload';
import { UserActionUploadProfileComponent } from './upload-profile/upload-profile.component';
import { SharedModule} from '../shared/shared.module'
import { FilterByNamePipe } from './add-metadata/add-metadata.component';
import {FilterByNamePipe, UniquePipe} from './add-metadata/add-metadata.component';
import { UserActionSaveProfileComponent } from './save-profile/save-profile.component';
import { PastisMaterialModule } from '../material.module';
import { UserActionsDownloadDocComponent } from './download-doc/download-doc.component';
@NgModule({
declarations: [UserActionUploadProfileComponent,FilterByNamePipe, UserActionSaveProfileComponent, UserActionsDownloadDocComponent],
declarations: [UserActionUploadProfileComponent,FilterByNamePipe,UniquePipe, UserActionSaveProfileComponent, UserActionsDownloadDocComponent],
imports: [
CommonModule,
PastisMaterialModule,
FileUploadModule,
SharedModule
],
exports: [UserActionUploadProfileComponent, UserActionSaveProfileComponent,UserActionsDownloadDocComponent,FilterByNamePipe ],
exports: [UserActionUploadProfileComponent, UserActionSaveProfileComponent,UserActionsDownloadDocComponent,FilterByNamePipe, UniquePipe ],
})
export class UserActionsModule {
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment