From 625675d43a06e928f75e14da1a548b6b83ca8b2b Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 24 Jan 2020 17:12:43 +0100
Subject: [PATCH] FIX #12622 TIME 0:30 new bloc for m2m in contact form +
 docker

---
 .gitlab-ci.yml                                  |  2 +-
 .../page/form/contacts-form.component.html      | 17 ++++++++++++++++-
 .../page/form/contacts-form.component.ts        | 12 ++++++++----
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d4723c45120..17a3a26e7fc 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,7 +46,7 @@ job_php-7.3:
    - sed 's/<databaseserver>.*<\/databaseserver>/<databaseserver>postgres<\/databaseserver>/;s/<databasepassword>.*<\/databasepassword>/<databasepassword><\/databasepassword>/;s/<databasename>.*<\/databasename>/<databasename>MaarchCourrier<\/databasename>/;s/<databaseuser>.*<\/databaseuser>/<databaseuser>maarch<\/databaseuser>/' apps/maarch_entreprise/xml/config.xml.default > apps/maarch_entreprise/xml/config.xml
    - curl --location -s --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.phar
    - chmod +x /usr/local/bin/phpunit
-   - phpunit
+   - phpunit --no-coverage
  only:
    - develop
 
diff --git a/src/frontend/app/administration/contact/page/form/contacts-form.component.html b/src/frontend/app/administration/contact/page/form/contacts-form.component.html
index a2f21a21343..fc12209d239 100644
--- a/src/frontend/app/administration/contact/page/form/contacts-form.component.html
+++ b/src/frontend/app/administration/contact/page/form/contacts-form.component.html
@@ -8,6 +8,8 @@
         <button mat-menu-item [matMenuTriggerFor]="address" [disabled]="noField('address')">{{lang.address}}</button>
         <button mat-menu-item [matMenuTriggerFor]="complement"
             [disabled]="noField('complement')">{{lang.additionals}}</button>
+        <button mat-menu-item [matMenuTriggerFor]="maarch2maarch"
+            [disabled]="noField('maarch2maarch')">Maarch2Maarch</button>
     </mat-menu>
 
     <mat-menu #mainInfo="matMenu">
@@ -50,6 +52,19 @@
             </button>
         </ng-container>
     </mat-menu>
+    <mat-menu #maarch2maarch="matMenu">
+        <button mat-menu-item (click)="toogleAllFieldsUnit('maarch2maarch')"
+            style="text-align: center;">{{lang.addAll}}</button>
+        <mat-divider></mat-divider>
+        <ng-container *ngFor="let field of contactForm">
+            <button mat-menu-item *ngIf="!field.display && field.unit === 'maarch2maarch'"
+                (click)="field.display=!field.display">
+                <mat-icon *ngIf="field.filling" style="height: auto;padding-right: 10px;"
+                    [title]="lang.targetFillingField" [style.color]="fillingRate.color" class="fas fa-circle rate"></mat-icon>
+                <span>{{field.label}}</span>
+            </button>
+        </ng-container>
+    </mat-menu>
     <div style="padding: 10px;" *ngIf="this.fillingParameters.enable">
         <div class="rate" [style.color]="fillingRate.color">{{lang.contactFilledTo}} <b>{{fillingRate.value}} %</b></div>
         <mat-progress-bar mode="determinate" class="fillingBar" [color]="fillingRate.class" [value]="fillingRate.value">
@@ -58,7 +73,7 @@
     </div>
     <div class="row">
         <ng-container *ngFor="let unit of contactUnit">
-            <div [class.col-sm-12]="unit.id !== 'complement' && !isEmptyUnit('mainInfo') && !isEmptyUnit('address')" [class.col-md-6]="unit.id !== 'complement' && !isEmptyUnit('mainInfo') && !isEmptyUnit('address')" [class.col-md-12]="unit.id === 'complement'" *ngIf="!isEmptyUnit(unit.id)">
+            <div [class.col-sm-12]="unit.id !== 'maarch2maarch' && unit.id !== 'complement' && !isEmptyUnit('mainInfo') && !isEmptyUnit('address')" [class.col-md-6]="unit.id !== 'maarch2maarch' && unit.id !== 'complement' && !isEmptyUnit('mainInfo') && !isEmptyUnit('address')" [class.col-md-12]="unit.id === 'complement' || unit.id === 'maarch2maarch'" *ngIf="!isEmptyUnit(unit.id)">
                 <mat-list>
                     <h3 mat-subheader class="unitTitle"><span style="flex:1">{{unit.label}}</span><a
                             *ngIf="unit.id === 'address'" (click)="addressBANMode=!addressBANMode"
diff --git a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts
index 289b37ec41e..0cc633478a7 100644
--- a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts
+++ b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts
@@ -49,6 +49,10 @@ export class ContactsFormComponent implements OnInit {
         {
             id: 'complement',
             label: this.lang.additionals
+        },
+        {
+            id: 'maarch2maarch',
+            label: 'Maarch2Maarch'
         }
     ];
 
@@ -220,7 +224,7 @@ export class ContactsFormComponent implements OnInit {
         },
         {
             id: 'communicationMeans',
-            unit: 'complement',
+            unit: 'maarch2maarch',
             label: this.lang.communicationMean,
             desc: `${this.lang.communicationMeanDesc} (${this.lang.see} <a href="${this.maarch2GecUrl}" target="_blank">MAARCH2GEC</a>)`,
             type: 'string',
@@ -232,7 +236,7 @@ export class ContactsFormComponent implements OnInit {
         },
         {
             id: 'externalId_m2m',
-            unit: 'complement',
+            unit: 'maarch2maarch',
             label: this.lang.IdMaarch2Gec,
             desc: `${this.lang.m2mContactInfo} (${this.lang.see} <a href="${this.maarch2GecUrl}" target="_blank">MAARCH2GEC</a>)`,
             type: 'string',
@@ -490,7 +494,7 @@ export class ContactsFormComponent implements OnInit {
                     } else {
                         this.contactForm.push({
                             id: `externalId_${id}`,
-                            unit: 'complement',
+                            unit: 'maarch2maarch',
                             label: id,
                             type: 'string',
                             control: new FormControl({ value: data.externalId[id], disabled: true }),
@@ -821,7 +825,7 @@ export class ContactsFormComponent implements OnInit {
         } else {
             this.contactForm.push({
                 id: `externalId_m2m_annuary_id`,
-                unit: 'complement',
+                unit: 'maarch2maarch',
                 label: 'm2m_annuary_id',
                 type: 'string',
                 control: new FormControl({ value: '', disabled: true }),
-- 
GitLab