From 5c107103e94e3d72e8a5812217cc46e10322c801 Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Thu, 17 Sep 2020 15:42:37 +0200
Subject: [PATCH] FEAT #13274 TIME 1:15 recipient address switch to manual mode

---
 .../registered-mail/indexing/recipient-input.component.html  | 5 +++--
 .../registered-mail/indexing/recipient-input.component.ts    | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.html b/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.html
index 94eaf505479..983c522c08e 100644
--- a/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.html
+++ b/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.html
@@ -27,7 +27,8 @@
         </mat-option>
     </mat-autocomplete>
 </mat-form-field>
-<mat-card color="primary" *ngIf="manualAddress && !emptyAddress()">
+<a *ngIf="!manualAddress && emptyAddress()" (click)="manualAddress=!manualAddress" style="cursor: pointer;">{{'lang.switchManualAddress' | translate}}</a>
+<mat-card color="primary" *ngIf="manualAddress">
     <button mat-icon-button class="address-icon" (click)="manualAddress=!manualAddress"
         [title]="'lang.showAddress' | translate">
         <mat-icon class="fa fa-eye"></mat-icon>
@@ -96,7 +97,7 @@
         </mat-autocomplete>
     </mat-form-field>
 </mat-card>
-<mat-card color="primary" *ngIf="!manualAddress && !emptyAddress()">
+<mat-card color="primary" *ngIf="!manualAddress && !emptyAddress()" style="min-height: 60px">
     <button *ngIf="this.control.status !== 'DISABLED'" mat-icon-button class="address-icon"
         (click)="manualAddress=!manualAddress" [title]="'lang.update' | translate">
         <mat-icon class="fa fa-edit"></mat-icon>
diff --git a/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.ts b/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.ts
index 66bbdbafbd8..5ee0c35ed49 100644
--- a/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.ts
+++ b/src/frontend/app/administration/registered-mail/indexing/recipient-input.component.ts
@@ -167,7 +167,7 @@ export class RegisteredMailRecipientInputComponent implements OnInit {
     emptyAddress() {
         let state: boolean = true;
         Object.keys(this.control.value).forEach(key => {
-            if (this.control.value[key] !== '') {
+            if (!this.functions.empty(this.control.value[key])) {
                 state = false;
             }
         });
-- 
GitLab