From e76feacb65a8d939b616cc383486535551cdb85e Mon Sep 17 00:00:00 2001
From: Florent POITTEVIN <poittevin.florent@gmail.com>
Date: Tue, 4 May 2021 12:11:53 +0200
Subject: [PATCH 1/2] feat(deposit): [AOU-275] use research group dropdown into
 deposit step

---
 package-lock.json                             |   6 +-
 package.json                                  |   2 +-
 ...ion-academic-structure.presentational.scss |   2 +-
 ...ption-academic-structure.presentational.ts |  13 ---
 ...form-description-group.presentational.html |  54 ---------
 ...form-description-group.presentational.scss |  11 --
 ...t-form-description-group.presentational.ts | 108 ------------------
 ...hird-step-contributors.presentational.html |  27 ++++-
 ...-third-step-contributors.presentational.ts |  29 ++++-
 .../deposit-form.presentational.ts            |  17 +--
 .../deposit-summary.presentational.ts         |   2 +-
 src/app/features/deposit/deposit.module.ts    |   2 -
 .../helpers/deposit-form-rule.helper.ts       |  40 -------
 .../models/deposit-form-definition.model.ts   |  11 +-
 src/sass/abstracts/_variables.scss            |   1 -
 15 files changed, 64 insertions(+), 261 deletions(-)
 delete mode 100644 src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.html
 delete mode 100644 src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.scss
 delete mode 100644 src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.ts

diff --git a/package-lock.json b/package-lock.json
index 46ad2a0d8..175ea96f2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14836,9 +14836,9 @@
       }
     },
     "solidify-frontend": {
-      "version": "1.3.5",
-      "resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-1.3.5.tgz",
-      "integrity": "sha512-FdAEzL7UsnyTgUKVAELgV5Wgnbz2ufRtkcyuHp+S13px7VaajCoAQMzf4RXIqkhwjm022s5Qc2X63zMLIzFMKQ==",
+      "version": "1.3.6",
+      "resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-1.3.6.tgz",
+      "integrity": "sha512-dH0f1iUIi+1loMyQapP5nAZZIlXlGpcmbThZxet+nrun/e9oLGeFvWSHAjIpVdk/19vJlK999q91t87EK+79lA==",
       "requires": {
         "tslib": "^2.0.0"
       }
diff --git a/package.json b/package.json
index cf11e7202..77ec73f08 100644
--- a/package.json
+++ b/package.json
@@ -89,7 +89,7 @@
     "normalize.css": "8.0.1",
     "patch-package": "6.2.2",
     "rxjs": "6.6.0",
-    "solidify-frontend": "1.3.5",
+    "solidify-frontend": "1.3.6",
     "streamsaver": "2.0.4",
     "sync-pom-version-to-package": "1.5.0",
     "ts-key-enum": "2.0.3",
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.scss b/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.scss
index 58e271ed9..c789b512c 100644
--- a/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.scss
+++ b/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.scss
@@ -27,7 +27,7 @@
 
           .chip {
             border-radius: 20px;
-            background-color: $medium-light-grey;
+            background-color: $intermediate-grey;
             padding: 6px 10px;
             display: grid;
             grid-template-columns: 1fr max-content;
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.ts
index db02e34c3..637597a15 100644
--- a/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.ts
+++ b/src/app/features/deposit/components/presentationals/deposit-form-description-academic-structure/deposit-form-description-academic-structure.presentational.ts
@@ -2,14 +2,9 @@ import {
   ChangeDetectionStrategy,
   ChangeDetectorRef,
   Component,
-  HostBinding,
   Input,
-  OnInit,
-  Output,
 } from "@angular/core";
 import {
-  AbstractControl,
-  ControlValueAccessor,
   FormArray,
   FormBuilder,
   FormGroup,
@@ -20,7 +15,6 @@ import {MatDialog} from "@angular/material/dialog";
 import {DepositAbstractFormPresentational} from "@app/features/deposit/components/presentationals/deposit-abstract-form/deposit-abstract-form.presentational";
 import {
   DepositFormAcademicStructure,
-  DepositFormGroup,
   FormComponentFormDefinitionDepositFormAcademicStructure,
 } from "@app/features/deposit/models/deposit-form-definition.model";
 import {environment} from "@environments/environment";
@@ -34,20 +28,13 @@ import {
   SharedPersonStructureDialog,
   SharedPersonStructureDialogData,
 } from "@shared/components/dialogs/shared-person-structure/shared-person-structure.dialog";
-import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational";
 import {StructureTreeModeEnum} from "@shared/components/presentationals/shared-structure-tree/shared-structure-tree.presentational";
-import {
-  BehaviorSubject,
-  Observable,
-} from "rxjs";
 import {tap} from "rxjs/operators";
 import {
-  FormValidationHelper,
   isNonEmptyArray,
   isNotNullNorUndefined,
   isNullOrUndefined,
   NotificationService,
-  ObservableUtil,
   SolidifyValidator,
 } from "solidify-frontend";
 
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.html b/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.html
deleted file mode 100644
index c8e8bae88..000000000
--- a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<aou-deposit-repeatable-fields [labelSectionToTranslate]="depositFormRuleHelper.getLabel(mainFormGroup, path)"
-                               [fieldsTemplate]="fieldsTemplate"
-                               [formGroupFactory]="formGroupFactory"
-                               [formArray]="formArray"
-                               [readonly]="readonly"
-                               [listFormDefinitions]="listFormDefinitions"
-></aou-deposit-repeatable-fields>
-
-<ng-template #fieldsTemplate
-             let-formGroup="formGroup"
->
-  <div class="container">
-    <ng-container *ngIf="formDefinition.name as fieldName">
-      <ng-template [ngIf]="depositFormRuleHelper.shouldDisplayField(mainFormGroup, getPath(fieldName))">
-        <mat-form-field *ngIf="formValidationHelper.getFormControl(formGroup, fieldName) as fd"
-                        [appearance]="appearanceInputMaterial"
-                        [floatLabel]="positionLabelInputMaterial"
-                        solidifyTooltipOnEllipsis
-        >
-          <mat-label>{{depositFormRuleHelper.getLabel(mainFormGroup, getPath(fieldName)) | translate}}</mat-label>
-          <input [formControl]="fd"
-                 [required]="formValidationHelper.hasRequiredField(fd)"
-                 [solidifyValidation]="errors"
-                 matInput
-          >
-          <mat-error #errors></mat-error>
-          <mat-hint *ngIf="isADefaultValue(formGroup)"
-                    class="default-value"
-          >{{labelTranslateEnum.defaultValueAccordingToYourProfile | translate}}
-          </mat-hint>
-        </mat-form-field>
-      </ng-template>
-    </ng-container>
-
-    <ng-container *ngIf="formDefinition.code as fieldName">
-      <ng-template [ngIf]="depositFormRuleHelper.shouldDisplayField(mainFormGroup, getPath(fieldName))">
-        <mat-form-field *ngIf="formValidationHelper.getFormControl(formGroup, fieldName) as fd"
-                        [appearance]="appearanceInputMaterial"
-                        [floatLabel]="positionLabelInputMaterial"
-                        solidifyTooltipOnEllipsis
-        >
-          <mat-label>{{depositFormRuleHelper.getLabel(mainFormGroup, getPath(fieldName)) | translate}}</mat-label>
-          <input [formControl]="fd"
-                 [required]="formValidationHelper.hasRequiredField(fd)"
-                 [solidifyValidation]="errors"
-                 matInput
-                 type="number"
-          >
-          <mat-error #errors></mat-error>
-        </mat-form-field>
-      </ng-template>
-    </ng-container>
-  </div>
-</ng-template>
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.scss b/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.scss
deleted file mode 100644
index d08feb8d5..000000000
--- a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-@import "../deposit-abstract-form-list/deposit-abstract-form-list.presentational";
-
-:host {
-  .default-value {
-    color: $warning;
-  }
-
-  .container {
-    grid-template-columns: 1fr 1fr;
-  }
-}
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.ts
deleted file mode 100644
index a559bf4f2..000000000
--- a/src/app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-import {
-  ChangeDetectionStrategy,
-  ChangeDetectorRef,
-  Component,
-  HostBinding,
-  Input,
-  OnInit,
-  Output,
-} from "@angular/core";
-import {
-  AbstractControl,
-  ControlValueAccessor,
-  FormArray,
-  FormBuilder,
-  FormGroup,
-  NG_VALUE_ACCESSOR,
-  Validators,
-} from "@angular/forms";
-import {DepositAbstractFormListPresentational} from "@app/features/deposit/components/presentationals/deposit-abstract-form-list/deposit-abstract-form-list.presentational";
-import {
-  DepositFormClassification,
-  DepositFormGroup,
-  FormComponentFormDefinitionDepositFormClassification,
-  FormComponentFormDefinitionDepositFormGroup,
-} from "@app/features/deposit/models/deposit-form-definition.model";
-import {TranslateService} from "@ngx-translate/core";
-import {
-  Actions,
-  Store,
-} from "@ngxs/store";
-import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational";
-import {
-  BehaviorSubject,
-  Observable,
-} from "rxjs";
-import {
-  BaseFormDefinition,
-  FormValidationHelper,
-  isNonEmptyArray,
-  isNotNullNorUndefined,
-  isNullOrUndefined,
-  NotificationService,
-  ObservableUtil,
-  SolidifyValidator,
-} from "solidify-frontend";
-
-@Component({
-  selector: "aou-deposit-form-description-group",
-  templateUrl: "./deposit-form-description-group.presentational.html",
-  styleUrls: ["./deposit-form-description-group.presentational.scss"],
-  changeDetection: ChangeDetectionStrategy.OnPush,
-  providers: [
-    {
-      provide: NG_VALUE_ACCESSOR,
-      multi: true,
-      useExisting: DepositFormDescriptionGroupPresentational,
-    },
-  ],
-})
-export class DepositFormDescriptionGroupPresentational extends DepositAbstractFormListPresentational implements ControlValueAccessor {
-  formDefinition: FormComponentFormDefinitionDepositFormGroup = new FormComponentFormDefinitionDepositFormGroup();
-
-  listFormDefinitions: BaseFormDefinition[] = [this.formDefinition];
-
-  @Input()
-  defaultValue: DepositFormGroup[];
-
-  constructor(protected readonly _translate: TranslateService,
-              protected readonly _store: Store,
-              protected readonly _fb: FormBuilder,
-              protected readonly _changeDetector: ChangeDetectorRef,
-              protected readonly _actions$: Actions,
-              protected readonly _notificationService: NotificationService) {
-    super(_translate,
-      _store,
-      _fb,
-      _changeDetector,
-      _actions$,
-      _notificationService);
-  }
-
-  static createGroup(_fb: FormBuilder,
-                     formDefinition: FormComponentFormDefinitionDepositFormGroup,
-                     group: DepositFormGroup | undefined = undefined): FormGroup {
-    const form = _fb.group({
-      [formDefinition.name]: [undefined, [SolidifyValidator]],
-      [formDefinition.code]: [undefined, [SolidifyValidator]],
-    });
-
-    if (isNotNullNorUndefined(group)) {
-      form.setValue(group);
-    }
-
-    return form;
-  }
-
-  formGroupFactory(fb: FormBuilder, formDefinition: FormComponentFormDefinitionDepositFormGroup): FormGroup {
-    return DepositFormDescriptionGroupPresentational.createGroup(fb, formDefinition);
-  }
-
-  isADefaultValue(f: FormGroup): boolean {
-    if (isNonEmptyArray(this.defaultValue)) {
-      const index = this.defaultValue.findIndex(d => d.code === f.value[this.formDefinition.code] && d.name === f.value[this.formDefinition.name]);
-      return index !== -1;
-    }
-    return false;
-  }
-}
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.html b/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.html
index 45bd5d043..190d7f8f2 100644
--- a/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.html
+++ b/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.html
@@ -55,12 +55,27 @@
 
   <ng-container *ngIf="formDefinition.groups as fieldName">
     <ng-template [ngIf]="depositFormRuleHelper.shouldDisplayField(mainFormGroup, getPath(fieldName))">
-      <aou-deposit-form-description-group *ngIf="getFormControl(fieldName) as fd"
-                                          [formArray]="fd"
-                                          [defaultValue]="defaultData?.groups"
-                                          [path]="getPath(fieldName)"
-                                          [mainFormGroup]="mainFormGroup"
-      ></aou-deposit-form-description-group>
+      <solidify-searchable-multi-select *ngIf="getFormControl(fieldName) as fd"
+                                        [appearance]="appearanceInputMaterial"
+                                        [formControl]="fd"
+                                        [isWithLink]="false"
+                                        [labelKey]="'name'"
+                                        [placeholder]="labelTranslateEnum.clickHereToAddAResearchGroup | translate"
+                                        [required]="formValidationHelper.hasRequiredField(fd)"
+                                        [resourceNameSpace]="sharedResearchGroupActionNameSpace"
+                                        [sort]="sharedResearchGroupSort"
+                                        [state]="sharedResearchGroupState"
+                                        [title]="labelTranslateEnum.researchGroups | translate"
+                                        [valueKey]="'resId'"
+                                        [labelCallback]="researchGroupLabel"
+                                        [defaultValueToHighlight]="listDefaultGroup"
+                                        [defaultValueLabel]="labelTranslateEnum.defaultValueAccordingToYourProfile"
+                                        aria-label="research group"
+                                        solidifyValidation
+                                        class="group"
+      >
+      </solidify-searchable-multi-select>
+
     </ng-template>
   </ng-container>
 
diff --git a/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.ts
index 37f1df85a..90d95847f 100644
--- a/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.ts
+++ b/src/app/features/deposit/components/presentationals/deposit-form-third-step-contributors/deposit-form-third-step-contributors.presentational.ts
@@ -22,14 +22,23 @@ import {
   FormComponentFormDefinitionMain,
   FormComponentFormDefinitionThirdStepContributors,
 } from "@app/features/deposit/models/deposit-form-definition.model";
-import {Structure} from "@models";
+import {sharedResearchGroupActionNameSpace} from "@app/shared/stores/research-group/shared-research-group.action";
+import {
+  ResearchGroup,
+  Structure,
+} from "@models";
+import {SharedResearchGroupState} from "@shared/stores/research-group/shared-research-group.state";
 import {
   distinctUntilChanged,
   tap,
 } from "rxjs/operators";
 import {
+  isNonEmptyString,
   isNullOrUndefined,
+  OrderEnum,
   Override,
+  ResourceNameSpace,
+  Sort,
 } from "solidify-frontend";
 
 @Component({
@@ -117,4 +126,22 @@ export class DepositFormThirdStepContributorsPresentational extends DepositAbstr
     this.contributorMembersFrontendContainer?.externalDetectChanges();
     this.collaborationMembersFrontendContainer?.externalDetectChanges();
   }
+
+  get listDefaultGroup(): string[] {
+    return this.defaultData?.groups?.map(g => g.resId);
+  }
+
+  sharedResearchGroupSort: Sort<ResearchGroup> = {
+    field: "name",
+    order: OrderEnum.ascending,
+  };
+  sharedResearchGroupActionNameSpace: ResourceNameSpace = sharedResearchGroupActionNameSpace;
+  sharedResearchGroupState: typeof SharedResearchGroupState = SharedResearchGroupState;
+  researchGroupLabel: (value: ResearchGroup) => string = (value => {
+    let result = value.name;
+    if (isNonEmptyString(value.code)) {
+      result += " (" + value.code + ")";
+    }
+    return result;
+  });
 }
diff --git a/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.ts
index 1126e208e..128991e2b 100644
--- a/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.ts
+++ b/src/app/features/deposit/components/presentationals/deposit-form/deposit-form.presentational.ts
@@ -15,6 +15,7 @@ import {
   AbstractControl,
   FormArray,
   FormBuilder,
+  FormControl,
   FormGroup,
   Validators,
 } from "@angular/forms";
@@ -31,7 +32,6 @@ import {DepositFormDescriptionContainerPresentational} from "@app/features/depos
 import {DepositFormDescriptionDatasetPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-dataset/deposit-form-description-dataset.presentational";
 import {DepositFormDescriptionDatePresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-date/deposit-form-description-date.presentational";
 import {DepositFormDescriptionFundingPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-funding/deposit-form-description-funding.presentational";
-import {DepositFormDescriptionGroupPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational";
 import {DepositFormDescriptionLanguagePresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-language/deposit-form-description-language.presentational";
 import {DepositFormDescriptionLinkPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-link/deposit-form-description-link.presentational";
 import {DepositFormDescriptionPublicationIdentifierPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-publication-identifier/deposit-form-description-publication-identifier.presentational";
@@ -61,7 +61,6 @@ import {
   FormComponentFormDefinitionDepositFormDataset,
   FormComponentFormDefinitionDepositFormDate,
   FormComponentFormDefinitionDepositFormFunding,
-  FormComponentFormDefinitionDepositFormGroup,
   FormComponentFormDefinitionDepositFormLanguage,
   FormComponentFormDefinitionDepositFormLink,
   FormComponentFormDefinitionDepositFormPage,
@@ -137,7 +136,6 @@ export class DepositFormPresentational extends AbstractPresentational implements
   formDefinitionThirdStepContributors: FormComponentFormDefinitionThirdStepContributors = new FormComponentFormDefinitionThirdStepContributors();
   formDefinitionFourthStepDescription: FormComponentFormDefinitionFourthStepDescription = new FormComponentFormDefinitionFourthStepDescription();
   formDefinitionDepositFormTextLanguage: FormComponentFormDefinitionDepositFormTextLanguage = new FormComponentFormDefinitionDepositFormTextLanguage();
-  formDefinitionDepositFormGroup: FormComponentFormDefinitionDepositFormGroup = new FormComponentFormDefinitionDepositFormGroup();
   formDefinitionDepositFormPublisher: FormComponentFormDefinitionDepositFormPublisher = new FormComponentFormDefinitionDepositFormPublisher();
   formDefinitionDepositFormDataset: FormComponentFormDefinitionDepositFormDataset = new FormComponentFormDefinitionDepositFormDataset();
   formDefinitionDepositFormContainer: FormComponentFormDefinitionDepositFormContainer = new FormComponentFormDefinitionDepositFormContainer();
@@ -378,9 +376,7 @@ export class DepositFormPresentational extends AbstractPresentational implements
       [this.formDefinitionThirdStepContributors.collaborationMembersFrontend]: this._fb.array([], [SolidifyValidator]),
       [this.formDefinitionThirdStepContributors.isCollaboration]: [false, [SolidifyValidator]],
       [this.formDefinitionThirdStepContributors.academicStructures]: this._fb.array([], [SolidifyValidator]),
-      [this.formDefinitionThirdStepContributors.groups]: this._fb.array([
-        DepositFormDescriptionGroupPresentational.createGroup(this._fb, this.formDefinitionDepositFormGroup),
-      ], [SolidifyValidator]),
+      [this.formDefinitionThirdStepContributors.groups]: [],
       [this.formDefinitionThirdStepContributors.fundings]: this._fb.array([
         DepositFormDescriptionFundingPresentational.createFunding(this._fb, this.formDefinitionDepositFormFunding),
       ], [/*CustomFormValidator.minLengthArray(1), */SolidifyValidator]),
@@ -505,11 +501,8 @@ export class DepositFormPresentational extends AbstractPresentational implements
       });
 
       if (depositFormModel.contributors?.groups?.length > 0) {
-        const formArrayGroups = this.formGroupThirdStepContributors.get(this.formDefinitionThirdStepContributors.groups) as FormArray;
-        formArrayGroups.clear();
-        depositFormModel.contributors.groups.forEach(groups => {
-          formArrayGroups.push(DepositFormDescriptionGroupPresentational.createGroup(this._fb, this.formDefinitionDepositFormGroup, groups));
-        });
+        const formControlGroups = this.formGroupThirdStepContributors.get(this.formDefinitionThirdStepContributors.groups) as FormControl;
+        formControlGroups.setValue(depositFormModel.contributors.groups);
       }
 
       if (depositFormModel.contributors?.fundings?.length > 0) {
@@ -720,7 +713,7 @@ export class DepositFormPresentational extends AbstractPresentational implements
       depositForm.contributors.academicStructures = this.defaultData.academicStructures;
     }
     if (isNonEmptyArray(this.defaultData?.groups)) {
-      depositForm.contributors.groups = this.defaultData.groups;
+      depositForm.contributors.groups = this.defaultData.groups?.map(g => g.resId);
     }
   }
 
diff --git a/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
index 30222d0db..89bb9c4a8 100644
--- a/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
+++ b/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
@@ -230,7 +230,7 @@ export class DepositSummaryPresentational extends AbstractPresentational impleme
       },
       {
         label: LabelTranslateEnum.groups,
-        values: this.depositFormModel?.contributors?.groups?.map(c => (isNonEmptyString(c.name) ? c.name + " " : "") + (isNonEmptyString(c.code) ? "(" + c.code + ")" : SOLIDIFY_CONSTANTS.STRING_EMPTY)),
+        values: this.depositFormModel?.contributors?.groups?.map(c => c), // TODO RETRIEVE NAME HERE
         type: TypeInfoEnum.list,
       },
       {
diff --git a/src/app/features/deposit/deposit.module.ts b/src/app/features/deposit/deposit.module.ts
index 3f6d42c4f..d88745c04 100644
--- a/src/app/features/deposit/deposit.module.ts
+++ b/src/app/features/deposit/deposit.module.ts
@@ -15,7 +15,6 @@ import {DepositFormDescriptionContainerPresentational} from "@app/features/depos
 import {DepositFormDescriptionDatasetPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-dataset/deposit-form-description-dataset.presentational";
 import {DepositFormDescriptionDatePresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-date/deposit-form-description-date.presentational";
 import {DepositFormDescriptionFundingPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-funding/deposit-form-description-funding.presentational";
-import {DepositFormDescriptionGroupPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-group/deposit-form-description-group.presentational";
 import {DepositFormDescriptionLanguagePresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-language/deposit-form-description-language.presentational";
 import {DepositFormDescriptionLinkPresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-link/deposit-form-description-link.presentational";
 import {DepositFormDescriptionPagePresentational} from "@app/features/deposit/components/presentationals/deposit-form-description-page/deposit-form-description-page.presentational";
@@ -76,7 +75,6 @@ const presentationals = [
   DepositFormDescriptionContainerPresentational,
   DepositFormDescriptionLinkPresentational,
   DepositFormDescriptionTextLanguageListPresentational,
-  DepositFormDescriptionGroupPresentational,
   DepositFormDescriptionFundingPresentational,
   DepositFormDescriptionAcademicStructurePresentational,
   DepositFormDescriptionClassificationPresentational,
diff --git a/src/app/features/deposit/helpers/deposit-form-rule.helper.ts b/src/app/features/deposit/helpers/deposit-form-rule.helper.ts
index 36b84a8c7..e90cd6b4c 100644
--- a/src/app/features/deposit/helpers/deposit-form-rule.helper.ts
+++ b/src/app/features/deposit/helpers/deposit-form-rule.helper.ts
@@ -9,7 +9,6 @@ import {
   FormComponentFormDefinitionDepositFormDataset,
   FormComponentFormDefinitionDepositFormDate,
   FormComponentFormDefinitionDepositFormFunding,
-  FormComponentFormDefinitionDepositFormGroup,
   FormComponentFormDefinitionDepositFormLanguage,
   FormComponentFormDefinitionDepositFormLink,
   FormComponentFormDefinitionDepositFormPage,
@@ -47,7 +46,6 @@ export class DepositFormRuleHelper {
   private static fdThirdStepContributors: FormComponentFormDefinitionThirdStepContributors = new FormComponentFormDefinitionThirdStepContributors();
   private static fdFourthStepDescription: FormComponentFormDefinitionFourthStepDescription = new FormComponentFormDefinitionFourthStepDescription();
   private static fdTextLanguage: FormComponentFormDefinitionDepositFormTextLanguage = new FormComponentFormDefinitionDepositFormTextLanguage();
-  private static fdGroup: FormComponentFormDefinitionDepositFormGroup = new FormComponentFormDefinitionDepositFormGroup();
   private static fdLanguage: FormComponentFormDefinitionDepositFormLanguage = new FormComponentFormDefinitionDepositFormLanguage();
   private static fdPublisher: FormComponentFormDefinitionDepositFormPublisher = new FormComponentFormDefinitionDepositFormPublisher();
   private static fdDataset: FormComponentFormDefinitionDepositFormDataset = new FormComponentFormDefinitionDepositFormDataset();
@@ -74,8 +72,6 @@ export class DepositFormRuleHelper {
   static pathOriginalTitleLanguage: string = DepositFormRuleHelper.fdMain.description + dot + DepositFormRuleHelper.fdFourthStepDescription.originalTitle + dot + DepositFormRuleHelper.fdTextLanguage.lang;
   static pathStructure: string = DepositFormRuleHelper.fdMain.contributors + dot + DepositFormRuleHelper.fdThirdStepContributors.academicStructures;
   static pathGroup: string = DepositFormRuleHelper.fdMain.contributors + dot + DepositFormRuleHelper.fdThirdStepContributors.groups;
-  static pathGroupName: string = DepositFormRuleHelper.fdMain.contributors + dot + DepositFormRuleHelper.fdThirdStepContributors.groups + dot + DepositFormRuleHelper.fdGroup.name;
-  static pathGroupCode: string = DepositFormRuleHelper.fdMain.contributors + dot + DepositFormRuleHelper.fdThirdStepContributors.groups + dot + DepositFormRuleHelper.fdGroup.code;
   static pathIdentifier: string = DepositFormRuleHelper.fdMain.description + dot + DepositFormRuleHelper.fdFourthStepDescription.identifiers;
   static pathIdentifierDoi: string = DepositFormRuleHelper.fdMain.description + dot + DepositFormRuleHelper.fdFourthStepDescription.identifiers + dot + DepositFormRuleHelper.fdPublicationIdentifiers.doi;
   static pathIdentifierPmid: string = DepositFormRuleHelper.fdMain.description + dot + DepositFormRuleHelper.fdFourthStepDescription.identifiers + dot + DepositFormRuleHelper.fdPublicationIdentifiers.pmid;
@@ -163,8 +159,6 @@ export class DepositFormRuleHelper {
           this.pathOriginalTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathIdentifierPmid,
@@ -219,8 +213,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathIdentifierPmid,
@@ -275,8 +267,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierIssn,
           this.pathCommercialUrl,
@@ -324,8 +314,6 @@ export class DepositFormRuleHelper {
           this.pathOriginalTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathIdentifierIsbn,
@@ -372,8 +360,6 @@ export class DepositFormRuleHelper {
           this.pathOriginalTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathCommercialUrl,
@@ -428,8 +414,6 @@ export class DepositFormRuleHelper {
           this.pathOriginalTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathCommercialUrl,
@@ -483,8 +467,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathCommercialUrl,
@@ -535,8 +517,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathIdentifierPmid,
@@ -589,8 +569,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathContainer,
           this.pathContainerTitle,
           this.pathContainerTitleText,
@@ -633,8 +611,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathContainer,
           this.pathContainerTitle,
           this.pathContainerTitleText,
@@ -675,8 +651,6 @@ export class DepositFormRuleHelper {
           this.pathTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierLocalNumber,
           this.pathCollection,
@@ -716,8 +690,6 @@ export class DepositFormRuleHelper {
           this.pathTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathCollection,
           this.pathCollectionName,
           this.pathCollectionNumber,
@@ -756,8 +728,6 @@ export class DepositFormRuleHelper {
           this.pathTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathCollection,
           this.pathCollectionName,
           this.pathCollectionNumber,
@@ -797,8 +767,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierArXiv,
           this.pathIdentifierLocalNumber,
@@ -844,8 +812,6 @@ export class DepositFormRuleHelper {
           this.pathTitleText,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierArXiv,
           this.pathIdentifierRepEc,
@@ -893,8 +859,6 @@ export class DepositFormRuleHelper {
           this.pathOriginalTitleLanguage,
           this.pathStructure,
           this.pathGroup,
-          this.pathGroupName,
-          this.pathGroupCode,
           this.pathIdentifier,
           this.pathIdentifierDoi,
           this.pathIdentifierPmid,
@@ -1090,10 +1054,6 @@ export class DepositFormRuleHelper {
         return LabelTranslateEnum.structures;
       case this.pathGroup:
         return LabelTranslateEnum.groups;
-      case this.pathGroupName:
-        return LabelTranslateEnum.nameLabel;
-      case this.pathGroupCode:
-        return LabelTranslateEnum.code;
       case this.pathIdentifier:
         return LabelTranslateEnum.publicationIdentifiers;
       case this.pathIdentifierDoi:
diff --git a/src/app/features/deposit/models/deposit-form-definition.model.ts b/src/app/features/deposit/models/deposit-form-definition.model.ts
index 0e9489b05..d556ff326 100644
--- a/src/app/features/deposit/models/deposit-form-definition.model.ts
+++ b/src/app/features/deposit/models/deposit-form-definition.model.ts
@@ -82,7 +82,7 @@ export interface DepositFormStepContributors {
   collaborationMembersFrontend: DepositFormContributor[]; // Only on frontend
   isCollaboration: boolean;
   academicStructures?: DepositFormAcademicStructure[];
-  groups?: DepositFormGroup[];
+  groups?: string[];
   fundings: DepositFormFunding[];
 }
 
@@ -336,16 +336,13 @@ export class FormComponentFormDefinitionDepositFormAcademicStructure extends Bas
 export interface DepositFormAcademicStructure {
   name: string;
   code: string;
-}
-
-export class FormComponentFormDefinitionDepositFormGroup extends BaseFormDefinition {
-  @PropertyName() name: string;
-  @PropertyName() code: string;
+  resId: string;
 }
 
 export interface DepositFormGroup {
   name: string;
-  code?: number;
+  code: string;
+  resId: string;
 }
 
 export class FormComponentFormDefinitionDepositFormDataset extends BaseFormDefinition {
diff --git a/src/sass/abstracts/_variables.scss b/src/sass/abstracts/_variables.scss
index 42fce0924..992efbf1c 100644
--- a/src/sass/abstracts/_variables.scss
+++ b/src/sass/abstracts/_variables.scss
@@ -6,7 +6,6 @@
 
 // Color
 $green-sweet: #18bb9c;
-$warning-dark: #c17700;
 $panel-background: rgba(0, 0, 0, 0.015);
 
 // ------------
-- 
GitLab


From 4c89611e8aa8b96959b7748d3c14394dbd90d485 Mon Sep 17 00:00:00 2001
From: Florent POITTEVIN <poittevin.florent@gmail.com>
Date: Wed, 19 May 2021 15:31:35 +0200
Subject: [PATCH 2/2] fix: display research group name into summary

---
 .../deposit-summary.presentational.ts         | 26 +++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
index 89bb9c4a8..460ab2f25 100644
--- a/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
+++ b/src/app/features/deposit/components/presentationals/deposit-summary/deposit-summary.presentational.ts
@@ -34,6 +34,8 @@ import {sharedDepositTypeActionNameSpace} from "@shared/stores/deposit-type/shar
 import {SharedDepositTypeState} from "@shared/stores/deposit-type/shared-deposit-type.state";
 import {sharedDepositSubSubtypeActionNameSpace} from "@shared/stores/deposit-type/subtype/sub-subtype/shared-deposit-sub-subtype.action";
 import {SharedDepositSubSubtypeState} from "@shared/stores/deposit-type/subtype/sub-subtype/shared-deposit-sub-subtype.state";
+import {sharedResearchGroupActionNameSpace} from "@shared/stores/research-group/shared-research-group.action";
+import {SharedResearchGroupState} from "@shared/stores/research-group/shared-research-group.state";
 import {AouObjectUtil} from "@shared/utils/aou-object.util";
 import {
   BehaviorSubject,
@@ -228,11 +230,7 @@ export class DepositSummaryPresentational extends AbstractPresentational impleme
         values: this.depositFormModel?.contributors?.academicStructures?.map(c => (isNonEmptyString(c.name) ? c.name + " " : "") + (isNonEmptyString(c.code) ? "(" + c.code + ")" : SOLIDIFY_CONSTANTS.STRING_EMPTY)),
         type: TypeInfoEnum.list,
       },
-      {
-        label: LabelTranslateEnum.groups,
-        values: this.depositFormModel?.contributors?.groups?.map(c => c), // TODO RETRIEVE NAME HERE
-        type: TypeInfoEnum.list,
-      },
+      ...this.getGroups(),
       {
         label: LabelTranslateEnum.links,
         // tslint:disable-next-line:arrow-return-shorthand
@@ -466,6 +464,24 @@ export class DepositSummaryPresentational extends AbstractPresentational impleme
     }];
   }
 
+  private getGroups(): Info[] {
+    const listInfos = [];
+    if (isNullOrUndefined(this.depositFormModel?.contributors?.groups)) {
+      return listInfos;
+    }
+    this.depositFormModel?.contributors?.groups.forEach((resId, index) => {
+      listInfos.push({
+        label: index === 0 ? LabelTranslateEnum.researchGroups : SOLIDIFY_CONSTANTS.STRING_EMPTY,
+        type: TypeInfoEnum.translate,
+        value: resId,
+        state: SharedResearchGroupState,
+        action: sharedResearchGroupActionNameSpace,
+        labelKey: "name",
+      });
+    });
+    return listInfos;
+  }
+
   private getPages(): Info[] {
     if (isNullOrUndefined(this.depositFormModel?.description?.pages)) {
       return [];
-- 
GitLab