diff --git a/api/api-iam/iam-commons/src/main/java/fr/gouv/vitamui/iam/common/dto/CustomerDto.java b/api/api-iam/iam-commons/src/main/java/fr/gouv/vitamui/iam/common/dto/CustomerDto.java index c6b5040f7a1d0144354e3e387c73b959e38daac7..3970877df1efba42dc28d7e93d600aec5c853ff3 100644 --- a/api/api-iam/iam-commons/src/main/java/fr/gouv/vitamui/iam/common/dto/CustomerDto.java +++ b/api/api-iam/iam-commons/src/main/java/fr/gouv/vitamui/iam/common/dto/CustomerDto.java @@ -43,7 +43,6 @@ import java.util.Map; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import fr.gouv.vitamui.commons.api.enums.AddressType; import org.hibernate.validator.constraints.Length; import com.fasterxml.jackson.annotation.JsonInclude; @@ -101,13 +100,11 @@ public class CustomerDto extends IdDto { @NotNull private String defaultEmailDomain; + @NotNull private AddressDto address; private String internalCode; - @NotNull - private AddressType addressType; - private boolean subrogeable = false; private boolean readonly = false; diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/domain/Customer.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/domain/Customer.java index 36286385a4d6e7939a957973ce41041f79a23c5a..c60664d0c9d8aec215f0912d27a5f7607ef9adaa 100644 --- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/domain/Customer.java +++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/domain/Customer.java @@ -41,7 +41,6 @@ import java.util.List; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import fr.gouv.vitamui.commons.api.enums.AddressType; import org.hibernate.validator.constraints.Length; import org.springframework.data.annotation.TypeAlias; import org.springframework.data.mongodb.core.index.Indexed; @@ -105,13 +104,11 @@ public class Customer extends IdDocument { @NotNull private String defaultEmailDomain; + @NotNull private Address address; private String internalCode; - @NotNull - private AddressType addressType; - private boolean readonly = false; private boolean subrogeable = false; diff --git a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/enums/AddressType.java b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/enums/AddressType.java deleted file mode 100644 index 0c90007c0baaee3112a6ed8d72f63b46146ec34a..0000000000000000000000000000000000000000 --- a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/enums/AddressType.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) - * and the signatories of the "VITAM - Accord du Contributeur" agreement. - * - * contact@programmevitam.fr - * - * This software is a computer program whose purpose is to implement - * implement a digital archiving front-office system for the secure and - * efficient high volumetry VITAM solution. - * - * 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, - * 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". - * - * 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. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * 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. - * - * 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. - */ -package fr.gouv.vitamui.commons.api.enums; - -/** Possible address types of a Customer or an Owner **/ -public enum AddressType { - POSTAL, - INTERNAL_CODE, -} diff --git a/ui/ui-frontend-common/src/app/modules/models/customer/address-type.enum.ts b/ui/ui-frontend-common/src/app/modules/models/customer/address-type.enum.ts deleted file mode 100644 index 3e5d3f997377bcd54c5eab57be6bae1e13998092..0000000000000000000000000000000000000000 --- a/ui/ui-frontend-common/src/app/modules/models/customer/address-type.enum.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) - * and the signatories of the "VITAM - Accord du Contributeur" agreement. - * - * contact@programmevitam.fr - * - * This software is a computer program whose purpose is to implement - * implement a digital archiving front-office system for the secure and - * efficient high volumetry VITAM solution. - * - * 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, - * 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". - * - * 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. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * 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. - * - * 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. - */ -export enum AddressType { - POSTAL = 'POSTAL', - INTERNAL_CODE = 'INTERNAL_CODE' -} diff --git a/ui/ui-frontend-common/src/app/modules/models/customer/customer.interface.ts b/ui/ui-frontend-common/src/app/modules/models/customer/customer.interface.ts index 0221cef6be50d2685f6053a2516a16fc426344a0..7a936ae27567f205d9c55eab9868fe4ac8209ccb 100644 --- a/ui/ui-frontend-common/src/app/modules/models/customer/customer.interface.ts +++ b/ui/ui-frontend-common/src/app/modules/models/customer/customer.interface.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { Id } from '../id.interface'; -import { AddressType } from './address-type.enum'; import { Address } from './address.interface'; import { OtpState } from './otp-state.enum'; import { Owner } from './owner.interface'; @@ -51,7 +50,6 @@ export interface Customer extends Id { idp?: boolean; address: Address; internalCode?: string; - addressType: AddressType; language: string; emailDomains: string[]; defaultEmailDomain: string; diff --git a/ui/ui-frontend-common/src/app/modules/models/customer/index.ts b/ui/ui-frontend-common/src/app/modules/models/customer/index.ts index 4540adc74a94f430c267825f9a354e8084b049f6..00d32156eb64e779d8301dc62950edd0d20639b3 100644 --- a/ui/ui-frontend-common/src/app/modules/models/customer/index.ts +++ b/ui/ui-frontend-common/src/app/modules/models/customer/index.ts @@ -42,4 +42,3 @@ export * from './identity-provider.interface'; export * from './tenant.interface'; export * from './basic-customer.interface'; export * from './customer.interface'; -export * from './address-type.enum'; diff --git a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts index e5dc8bc0c7c5a6b9d931d21cc76ff96b8e58148a..af55bd04edd4facaa4ae51157406bcd9dbe787c9 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/api/customer-api.service.ts @@ -77,7 +77,6 @@ export class CustomerApiService extends BaseHttpClient<Customer> { otp: customer.otp, idp: customer.idp, address: customer.address, - addressType: customer.addressType, internalCode: customer.internalCode, language: customer.language, emailDomains: customer.emailDomains, diff --git a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts index a7d29330fd768e20c7b3d73850e9870bf40fcea8..07fd70e61e7f2b33bcc518f5c7a1eaebc1441fd4 100644 --- a/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/core/customer.service.spec.ts @@ -34,7 +34,7 @@ * 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. */ -import { AddressType, ENVIRONMENT, LoggerModule } from 'ui-frontend-common'; +import { ENVIRONMENT, LoggerModule } from 'ui-frontend-common'; import { BASE_URL, Customer, Operators, OtpState, SearchQuery } from 'ui-frontend-common'; import { environment } from './../../environments/environment'; @@ -169,7 +169,6 @@ const expectedCustomer: Customer = { companyName: 'John Co.', passwordRevocationDelay: 3, otp: OtpState.OPTIONAL, - addressType: AddressType.POSTAL, address: { street: 'street', zipCode: '12345', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html index 060f9ec8dca49a4536251dd11d77ff10f15fc250..0ec50b65bc9c2eace0637a4f580e6ed9b02176ad 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.html @@ -39,26 +39,7 @@ </vitamui-common-input> </div> - <div class="mb-4"> - <div i18n="Address type@@CustomerAddressType" class="mb-2">Type d'adresse</div> - <mat-button-toggle-group #group="matButtonToggleGroup" formControlName="addressType"> - <mat-button-toggle color="primary" value="POSTAL" - [ngClass]="{'selected': form.get('addressType').value === ADDRESS_TYPE.POSTAL}">Postale</mat-button-toggle> - <mat-button-toggle color="primary" value="INTERNAL_CODE" - [ngClass]="{'selected': form.get('addressType').value === ADDRESS_TYPE.INTERNAL_CODE}">Code interne</mat-button-toggle> - </mat-button-toggle-group> - </div> - - <div *ngIf="form.get('addressType').value === ADDRESS_TYPE.INTERNAL_CODE"> - <vitamui-common-input class="field-street" formControlName="internalCode" maxlength="20" required placeholder="Code interne" - i18n-placeholder="Internal code@@customerInternalCodePlaceholder"> - <vitamui-common-input-error - *ngIf="form.get('internalCode')?.touched && !!form.get('internalCode')?.errors?.required" - i18n="Required field error hint@@formErrorRequiredField">Champ requis</vitamui-common-input-error> - </vitamui-common-input> - </div> - - <ng-container formGroupName="address" *ngIf="form.get('addressType').value === ADDRESS_TYPE.POSTAL"> + <ng-container formGroupName="address"> <div> <vitamui-common-input class="field-street" formControlName="street" maxlength="250" required placeholder="N° et nom de rue" @@ -103,6 +84,9 @@ </div> </ng-container> + <vitamui-common-input class="field-street" formControlName="internalCode" maxlength="20" placeholder="Code interne" + i18n-placeholder="Internal code@@customerInternalCodePlaceholder"></vitamui-common-input> + <div class="d-flex"> <label for="language" class="inline-label label-language" i18n="Interface language (by default for the user)@@customerCreateLanguageInputLabel"> @@ -258,7 +242,7 @@ <h2 i18n="Create evidence owner title@@customerCreateTitle3">Création du propriétaire des éléments de preuve </h2> <div class="form-group"> - <app-owner-form [formControl]="form.get(['owners', 0])" [customerInfo]="customerInfo" [addressType]="form.get('addressType').value"></app-owner-form> + <app-owner-form [formControl]="form.get(['owners', 0])" [customerInfo]="customerInfo"></app-owner-form> <p class="hint" i18n="the evidence tenant is automatically created with the owner@@customerCreateHint">Le coffre des éléments de preuve est créé automatiquement avec son propriétaire</p> </div> diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts index a7d9b1a993b559493e545e4f1683d66509acb314..190ffb7e3bab9500731a71db17fae3c1d8894c4d 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.spec.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { EMPTY, of } from 'rxjs'; -import { AddressType } from 'ui-frontend-common'; import { ConfirmDialogService, OtpState } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; @@ -100,7 +99,6 @@ const expectedCustomer = { hasCustomGraphicIdentity: false, passwordRevocationDelay: 3, otp: OtpState.OPTIONAL, - addressType: AddressType.POSTAL, address: { street: 'street', zipCode: '12345', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts index be6dbfb932378625e2ed3bc20967dd6213e826fe..606acdef1d4c16fe93578b5b291a3ecd88330778 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-create.component.ts @@ -35,7 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { merge, Subscription } from 'rxjs'; -import { AddressType, ConfirmDialogService, Customer, OtpState, ThemeService } from 'ui-frontend-common'; +import { ConfirmDialogService, Customer, OtpState, ThemeService } from 'ui-frontend-common'; import { Component, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -52,7 +52,6 @@ interface CustomerInfo { code: string; name: string; companyName: string; - addressType: AddressType; } @Component({ @@ -61,8 +60,6 @@ interface CustomerInfo { styleUrls: ['./customer-create.component.scss'] }) export class CustomerCreateComponent implements OnInit, OnDestroy { - public readonly ADDRESS_TYPE = AddressType; - @ViewChild('fileSearch', { static: false }) public fileSearch: any; public form: FormGroup; @@ -83,7 +80,6 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { code: '', name: '', companyName: '', - addressType: AddressType.POSTAL }; // stepCount is the total number of steps and is used to calculate the advancement of the progress bar. @@ -117,13 +113,12 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { passwordRevocationDelay: 6, otp: OtpState.OPTIONAL, address: this.formBuilder.group({ - street: [''], - zipCode: [''], - city: [''], - country: ['FR'] + street: [null, Validators.required], + zipCode: [null, Validators.required], + city: [null, Validators.required], + country: ['FR', Validators.required] }), internalCode: [null], - addressType: [AddressType.POSTAL, Validators.required], language: ['FRENCH', Validators.required], emailDomains: [null, Validators.required], defaultEmailDomain: [null, Validators.required], @@ -172,7 +167,6 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { this.form.get('code').valueChanges, this.form.get('name').valueChanges, this.form.get('companyName').valueChanges, - this.form.get('addressType').valueChanges ) .subscribe(() => { // reset object to trigger customerInfo input update in child component @@ -180,7 +174,6 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { code: this.form.get('code').value, name: this.form.get('name').value, companyName: this.form.get('companyName').value, - addressType: this.form.get('addressType').value }; }); } @@ -271,18 +264,14 @@ export class CustomerCreateComponent implements OnInit, OnDestroy { } firstStepInvalid(): boolean { - const response = this.form.get('code').invalid || this.form.get('code').pending || - this.form.get('name').invalid || this.form.get('name').pending || - this.form.get('companyName').invalid || this.form.get('companyName').pending; - - if (this.form.get('addressType').value === AddressType.POSTAL) { - return response || this.form.get('address.street').invalid || this.form.get('address.street').pending || + return this.form.get('code').invalid || this.form.get('code').pending || + this.form.get('name').invalid || this.form.get('name').pending || + this.form.get('companyName').invalid || this.form.get('companyName').pending || + this.form.get('address.street').invalid || this.form.get('address.street').pending || this.form.get('address.zipCode').invalid || this.form.get('address.zipCode').pending || this.form.get('address.city').invalid || this.form.get('address.city').pending || - this.form.get('address.country').invalid || this.form.get('address.country').pending; - } else if (this.form.get('addressType').value === AddressType.INTERNAL_CODE) { - return response || this.form.get('internalCode').invalid || this.form.get('internalCode').pending; - } + this.form.get('address.country').invalid || this.form.get('address.country').pending || + this.form.get('internalCode').invalid || this.form.get('internalCode').pending; } secondStepInvalid(): boolean { diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts index 6a679bda405a9a0f15d2f354b5e5f2aceaf4470d..23fd0258b9c05ba38830bac60d77f4a50f9d806f 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.component.spec.ts @@ -45,7 +45,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router } from '@angular/router'; import { of , Subject } from 'rxjs'; -import { AddressType, Customer, OtpState, Owner, Tenant } from 'ui-frontend-common'; +import { Customer, OtpState, Owner, Tenant } from 'ui-frontend-common'; import { InfiniteScrollStubDirective, VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { CustomerService } from '../../core/customer.service'; import { CustomerDataService } from '../customer.data.service'; @@ -107,7 +107,6 @@ describe('CustomerListComponent', () => { 'kouygues.com', ], defaultEmailDomain: 'kouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', @@ -134,7 +133,6 @@ describe('CustomerListComponent', () => { 'louygues.com', ], defaultEmailDomain: 'louygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', @@ -161,7 +159,6 @@ describe('CustomerListComponent', () => { 'mouygues.com', ], defaultEmailDomain: 'mouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', @@ -188,7 +185,6 @@ describe('CustomerListComponent', () => { 'nrange.com', ], defaultEmailDomain: 'nrange.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', @@ -215,7 +211,6 @@ describe('CustomerListComponent', () => { 'bouygues.com', ], defaultEmailDomain: 'bouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts index cc9a7c709c6b924fe76adcc41cbfd47fbe6a98a5..fcc8ee661e15eea4e54826b19a98961a6ea5d52b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.spec.ts @@ -38,7 +38,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Type } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { AddressType, ENVIRONMENT } from 'ui-frontend-common'; +import { ENVIRONMENT } from 'ui-frontend-common'; import { BASE_URL, Customer, Direction, LoggerModule, OtpState, PageRequest } from 'ui-frontend-common'; import { environment } from './../../../environments/environment'; import { CustomerListService } from './customer-list.service'; @@ -93,7 +93,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu readonly: false }, ], - addressType: AddressType.POSTAL, internalCode: '1', address: { street: '73 rue du Faubourg Poissonnière ', @@ -151,7 +150,6 @@ const expectedCustomersPage: { values: Customer[], pageNum: number, pageSize: nu readonly: false }, ], - addressType: AddressType.POSTAL, internalCode: '1', address: { street: '22-30 Avenue de WAGRAM', @@ -217,7 +215,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha readonly: false }, ], - addressType: AddressType.POSTAL, internalCode: '1', address: { street: '73 rue du Faubourg Poissonnière ', @@ -275,7 +272,6 @@ const customersPage: { values: Customer[], pageNum: number, pageSize: number, ha readonly: false }, ], - addressType: AddressType.POSTAL, internalCode: '1', address: { street: '22-30 Avenue de WAGRAM', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts index 54755321c2ea499b4fbf9b0fb73db939681a7c81..99ced1b144cf9a1ab0a9e1bec7f42289d6d7c30e 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-list/customer-list.service.ts @@ -94,7 +94,6 @@ export class CustomerListService extends SearchService<Customer> { passwordRevocationDelay: customer.passwordRevocationDelay, otp: customer.otp, address: customer.address, - addressType: customer.addressType, internalCode: customer.internalCode, language: customer.language, emailDomains: customer.emailDomains, diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts index ffd21301b4fbca80ffe1b87b1e22ebb8a55e31a7..c3c5eaa24f3ce4bffbd3ba676b5859474f61a833 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-tab.component.spec.ts @@ -39,7 +39,7 @@ import { Component } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { of } from 'rxjs'; -import { AddressType, ENVIRONMENT } from 'ui-frontend-common'; +import { ENVIRONMENT } from 'ui-frontend-common'; import { BASE_URL, Customer, LoggerModule, OtpState } from 'ui-frontend-common'; import { VitamUISnackBar } from '../../../shared/vitamui-snack-bar'; import { environment } from './../../../../environments/environment'; @@ -57,7 +57,6 @@ let expectedCustomer: Customer = { passwordRevocationDelay: 6, otp: OtpState.DEACTIVATED, idp: true, - addressType: AddressType.POSTAL, address: { street: '85 rue des bois', zipCode: '75013', @@ -119,7 +118,6 @@ describe('GraphicIdentityTabComponent', () => { passwordRevocationDelay: 6, otp: OtpState.DEACTIVATED, idp: true, - addressType: AddressType.POSTAL, address: { street: '85 rue des bois', zipCode: '75013', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts index ce075c4d069f31e4b75a63f55954bea3cd703239..3e24ed5edd53eab0bc10a45f67164de6bda30323 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity-update/graphic-identity-update.component.spec.ts @@ -40,7 +40,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { AddressType, ENVIRONMENT } from 'ui-frontend-common'; +import { ENVIRONMENT } from 'ui-frontend-common'; import { BASE_URL, Customer, InjectorModule, LoggerModule, OtpState } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { environment } from './../../../../../environments/environment'; @@ -61,7 +61,6 @@ const expectedCustomer: Customer = { passwordRevocationDelay: 6, otp: OtpState.DEACTIVATED, idp: true, - addressType: AddressType.POSTAL, address: { street: '85 rue des bois', zipCode: '75013', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts index 7e874a308d7f3b9e880610f96cae9fb6a3cbb7b7..d89d402ee3a35544025fac5f26c32860dabd806b 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/information-tab/information-tab.component.spec.ts @@ -41,7 +41,7 @@ import { AsyncValidator, ControlValueAccessor, NG_VALUE_ACCESSOR, ReactiveFormsM import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of } from 'rxjs'; -import { AddressType, Customer, OtpState } from 'ui-frontend-common'; +import { Customer, OtpState } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { CustomerService } from '../../../core/customer.service'; import { CustomerCreateValidators } from '../../customer-create/customer-create.validators'; @@ -64,7 +64,6 @@ let expectedCustomer: Customer = { 'kouygues.com', ], defaultEmailDomain: 'kouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', @@ -143,7 +142,6 @@ describe('Customer InformationTabComponent', () => { 'kouygues.com', ], defaultEmailDomain: 'kouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts index 7414439be298d558f4a2255af04478691e1f0776..82d424d9d1beb1332220fabf116cb831d8627160 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/sso-tab/sso-tab.component.spec.ts @@ -40,7 +40,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialog } from '@angular/material/dialog'; import { of , Subject } from 'rxjs'; -import { AddressType, Customer, IdentityProvider, OtpState } from 'ui-frontend-common'; +import { Customer, IdentityProvider, OtpState } from 'ui-frontend-common'; import { IdentityProviderService } from './identity-provider.service'; import { SsoTabComponent } from './sso-tab.component'; @@ -85,7 +85,6 @@ class TestHostComponent { 'test6.com', ], defaultEmailDomain : '1test.com', - addressType: AddressType.POSTAL, address : { street : '73 rue du Faubourg Poissonnière ', zipCode : '75009', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts index 05cc3927d497ac4cc29be8f4afe16559c071c2a4..52ebeee63a3a166f714c809198b19f23a633fd40 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-resolver.service.spec.ts @@ -40,7 +40,7 @@ import { inject, TestBed } from '@angular/core/testing'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { of } from 'rxjs'; -import { AddressType, Customer, OtpState } from 'ui-frontend-common'; +import { Customer, OtpState } from 'ui-frontend-common'; import { CustomerService } from '../core/customer.service'; import { CustomerResolver } from './customer-resolver.service'; @@ -61,7 +61,6 @@ const expectedCustomer: Customer = { 'kouygues.com', ], defaultEmailDomain: 'kouygues.com', - addressType: AddressType.POSTAL, address: { street: '13 rue faubourg', zipCode: '75009', diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html index 1d401e7356ea94f76242e2132159afc34bf7c168..78b72721456b76e50a2b76cd6056a8f416177f87 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.html @@ -17,12 +17,7 @@ </vitamui-common-input> </div> - <div *ngIf="addressType === ADDRESS_TYPE.INTERNAL_CODE"> - <vitamui-common-input class="field-street" formControlName="internalCode" maxlength="20" placeholder="Code interne" - i18n-placeholder="Internal code@@OwnerInternalCodePlaceholder"></vitamui-common-input> - </div> - - <ng-container formGroupName="address" *ngIf="addressType === ADDRESS_TYPE.POSTAL"> + <ng-container formGroupName="address"> <div> <vitamui-common-input class="field-street" formControlName="street" maxlength="250" placeholder="N° et nom de la rue" i18n-placeholder="Owner street input placeholder@@ownerFormStreetInputPlaceholder"></vitamui-common-input> </div> @@ -47,4 +42,8 @@ </div> </mat-form-field> </ng-container> + + <vitamui-common-input class="field-street" formControlName="internalCode" maxlength="20" placeholder="Code interne" + i18n-placeholder="Internal code@@OwnerInternalCodePlaceholder"></vitamui-common-input> + </ng-container> diff --git a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts index b8d9056b17ee1485aed660e3b81b41b38705f3a6..62ddaccf030597753e2a3b1e476b9626c561ab48 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/owner-form/owner-form.component.ts @@ -39,7 +39,7 @@ import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core'; import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; import { merge } from 'rxjs'; import { distinctUntilChanged, map } from 'rxjs/operators'; -import { AddressType, Customer } from 'ui-frontend-common'; +import { Customer } from 'ui-frontend-common'; import { Owner } from 'ui-frontend-common'; import { OwnerFormValidators } from './owner-form.validators'; @@ -58,14 +58,10 @@ export const OWNER_FORM_VALUE_ACCESSOR: any = { }) export class OwnerFormComponent implements ControlValueAccessor, OnDestroy, OnInit { - @Input() addressType: AddressType; - form: FormGroup; private sub: any; - public ADDRESS_TYPE = AddressType; - @Input() set customerId(customerId: string) { this._customerId = customerId; diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.html b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.html index 317cf395157f91f643259e975227139673004cdb..79a9abaffce2b92c62b83c5bd7c317b8044763a9 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.html +++ b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.html @@ -156,16 +156,7 @@ <cdk-step> <div class="content"> <h2 i18n="@@userCreateAddressTitle">Coordonnées</h2> - - <ng-container *ngIf="customer.addressType === ADDRESS_TYPE.INTERNAL_CODE"> - <div> - <vitamui-common-input class="field-street" required formControlName="internalCode" maxlength="20" placeholder="Code interne" - i18n-placeholder="@@userCreateInternalCodeInputPlaceholder"> - </vitamui-common-input> - </div> - </ng-container> - - <ng-container formGroupName="address" *ngIf="!customer.addressType || customer.addressType === ADDRESS_TYPE.POSTAL"> + <ng-container formGroupName="address"> <div> <vitamui-common-input class="field-street" [required]="!addressEmpty" formControlName="street" maxlength="250" placeholder="N° et nom de rue" i18n-placeholder="@@userCreateStreetInputPlaceholder"> @@ -204,6 +195,12 @@ </mat-form-field> </div> + <div> + <vitamui-common-input class="field-street" required formControlName="internalCode" maxlength="20" placeholder="Code interne" + i18n-placeholder="@@userCreateInternalCodeInputPlaceholder"> + </vitamui-common-input> + </div> + <div> <vitamui-common-input class="field-site-code" formControlName="siteCode" placeholder="Code du site" i18n-placeholder="user create siteCode@@userCreateSiteCode"> diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts index 3149340d8b4457a354baefde84fce9e442f55d37..8227fc5a84fe2b98683106ecb068a8b1a777fa23 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-create/user-create.component.ts @@ -35,7 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { Subscription } from 'rxjs'; -import { AddressType } from 'ui-frontend-common'; import { AdminUserProfile, AuthService, ConfirmDialogService, Customer, isRootLevel, OtpState, ProfileSelection } from 'ui-frontend-common'; @@ -88,8 +87,6 @@ export class UserCreateComponent implements OnInit, OnDestroy { public creating = false; - public ADDRESS_TYPE = AddressType; - // stepCount is the total number of steps and is used to calculate the advancement of the progress bar. // We could get the number of steps using ViewChildren(StepComponent) but this triggers a // "Expression has changed after it was checked" error so we instead manually define the value. @@ -124,11 +121,6 @@ export class UserCreateComponent implements OnInit, OnDestroy { domain: [this.customer.emailDomains[0]] }); - let internalCode: string; - if (this.customer.addressType === AddressType.INTERNAL_CODE) { - internalCode = this.customer.internalCode; - } - this.form = this.formBuilder.group( { enabled: true, @@ -158,7 +150,7 @@ export class UserCreateComponent implements OnInit, OnDestroy { city: [null], country: ['FR'] }), - internalCode: [internalCode], + internalCode: [this.customer.internalCode], siteCode: [null], }, { validator: UserValidators.missingPhoneNumber } @@ -240,10 +232,8 @@ export class UserCreateComponent implements OnInit, OnDestroy { } public thirdStepInvalid(): boolean { - if (!this.customer.addressType || this.customer.addressType === AddressType.POSTAL) { - return this.form.get('address').pending || this.form.get('address').invalid; - } - return this.form.get('internalCode').pending || this.form.get('internalCode').invalid; + return this.form.get('address').pending || this.form.get('address').invalid || + this.form.get('internalCode').pending || this.form.get('internalCode').invalid; } passGroupStep() { diff --git a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts index 2e6c470cb62133264660d4bd5faada3b744e02bd..a6b7bd3d3ba1dde154b8f3cf266ac8f2c83e278e 100644 --- a/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts +++ b/ui/ui-frontend/projects/identity/src/app/user/user-preview/user-information-tab/user-information-tab.component.spec.ts @@ -37,7 +37,7 @@ /* tslint:disable: max-file-line-count max-classes-per-file */ import { of } from 'rxjs'; -import { AddressType, AdminUserProfile, AuthService, Customer, OtpState, User } from 'ui-frontend-common'; +import { AdminUserProfile, AuthService, Customer, OtpState, User } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { Component, Directive, Input, ViewChild } from '@angular/core'; @@ -90,7 +90,6 @@ let expectedCustomer: Customer = { passwordRevocationDelay: 6, otp: OtpState.DEACTIVATED, idp: true, - addressType: AddressType.POSTAL, address: { street: '85 rue des bois', zipCode: '75013', @@ -199,7 +198,6 @@ describe('UserInfoTabComponent', () => { passwordRevocationDelay: 6, otp: OtpState.DEACTIVATED, idp: true, - addressType: AddressType.POSTAL, address: { street: '85 rue des bois', zipCode: '75013', diff --git a/ui/ui-identity/src/test/java/fr/gouv/vitamui/identity/service/CustomerServiceTest.java b/ui/ui-identity/src/test/java/fr/gouv/vitamui/identity/service/CustomerServiceTest.java index 46f918be803d4d8ae963036d5d2591cd5e32bef7..f041b38a1383ddc0933c27b6d2a7bfd656c063e0 100644 --- a/ui/ui-identity/src/test/java/fr/gouv/vitamui/identity/service/CustomerServiceTest.java +++ b/ui/ui-identity/src/test/java/fr/gouv/vitamui/identity/service/CustomerServiceTest.java @@ -7,7 +7,6 @@ import static org.mockito.ArgumentMatchers.any; import java.util.Arrays; import java.util.Optional; -import fr.gouv.vitamui.commons.api.enums.AddressType; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -120,7 +119,6 @@ public class CustomerServiceTest extends UIIdentityServiceTest<CustomerDto> { customer.setOtp(OtpEnum.OPTIONAL); customer.setLanguage(LanguageDto.FRENCH); customer.setOwners(Arrays.asList(new OwnerDto())); - customer.setAddressType(AddressType.POSTAL); customer.setAddress(new AddressDto("street", "zipCode", "city", "country")); customer.setDefaultEmailDomain("@vitamui.com"); customer.setPasswordRevocationDelay(1);