diff --git a/src/app/pages/organization/organization.module.ts b/src/app/pages/organization/organization.module.ts index b34f2a1ea4..acd94cc633 100644 --- a/src/app/pages/organization/organization.module.ts +++ b/src/app/pages/organization/organization.module.ts @@ -3,14 +3,15 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { AccountBillingComponent } from 'shared/component/account-billing/account-billing.component'; -import { PricingDefinitionsModule } from 'shared/pricing-definitions/pricing-definitions.module'; import { MaterialModule } from '../../app.module'; import { AddressModule } from '../../shared/address/address.module'; +import { AccountBillingComponent } from '../../shared/component/account-billing/account-billing.component'; import { ComponentModule } from '../../shared/component/component.module'; import { DialogsModule } from '../../shared/dialogs/dialogs.module'; +import { PricingDefinitionsModule } from '../../shared/pricing-definitions/pricing-definitions.module'; import { TableModule } from '../../shared/table/table.module'; +import { TenantSupportModule } from '../../shared/tenant-support/tenant-support.module'; import { CompanyLogoFormatterCellComponent } from './companies/cell-components/company-logo-formatter-cell.component'; import { CompanyDialogComponent } from './companies/company/company-dialog.component'; import { CompanyComponent } from './companies/company/company.component'; @@ -45,7 +46,6 @@ import { SiteComponent } from './sites/site/site.component'; @NgModule({ imports: [ - AddressModule, CommonModule, FormsModule, AddressModule, @@ -57,6 +57,7 @@ import { SiteComponent } from './sites/site/site.component'; RouterModule.forChild(OrganizationRoutes), ComponentModule, PricingDefinitionsModule, + TenantSupportModule, ], declarations: [ OrganizationComponent, diff --git a/src/app/pages/settings-technical/data/tenant-data.component.html b/src/app/pages/settings-technical/data/tenant-data.component.html index 2524579054..6498300fd8 100644 --- a/src/app/pages/settings-technical/data/tenant-data.component.html +++ b/src/app/pages/settings-technical/data/tenant-data.component.html @@ -5,20 +5,45 @@ save{{ "general.save" | translate }} +
business
-

{{ "technical_settings.tabs.organization" | translate }}

+

{{ "technical_settings.business.title" | translate }}

+
+
+ + + {{"general.mandatory_field" | translate}} + +
+
+
+
+
+ + + {{"general.mandatory_field" | translate}} + {{"authentication.invalid_email" | translate}} + +
+
+ + + {{"general.error_url_pattern" | translate}} + +
+
-
+
@@ -43,27 +68,99 @@

{{ "technical_settings.tabs.organization" | translate }}<

-
-
+
+
+ + + +
+
+
+
+
- - {{"general.mandatory_field" | translate}} - + +
-
- - - {{"general.mandatory_field" | translate}} - {{"authentication.invalid_email" | translate}} - +
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+
+
+ + + +
+
+
+ edit_location_alt +
+

{{ "general.address" | translate }}

+
+
{{ "technical_settings.tabs.organization" | translate }}<
+ +
+
+
+ contact_support +
+

{{ "technical_settings.support.title" | translate }}

+
+
+
+
+ +
+
+
+
diff --git a/src/app/pages/settings-technical/data/tenant-data.component.ts b/src/app/pages/settings-technical/data/tenant-data.component.ts index 63e606aa8a..c9166e2727 100644 --- a/src/app/pages/settings-technical/data/tenant-data.component.ts +++ b/src/app/pages/settings-technical/data/tenant-data.component.ts @@ -2,15 +2,17 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { AbstractControl, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { StatusCodes } from 'http-status-codes'; -import { CentralServerService } from 'services/central-server.service'; -import { ConfigService } from 'services/config.service'; -import { MessageService } from 'services/message.service'; -import { SpinnerService } from 'services/spinner.service'; -import { Address } from 'types/Address'; -import { RestResponse } from 'types/GlobalType'; -import { Tenant } from 'types/Tenant'; -import { Constants } from 'utils/Constants'; -import { Utils } from 'utils/Utils'; + +import { CentralServerService } from '../../../services/central-server.service'; +import { ConfigService } from '../../../services/config.service'; +import { MessageService } from '../../../services/message.service'; +import { SpinnerService } from '../../../services/spinner.service'; +import { Address } from '../../../types/Address'; +import { RestResponse } from '../../../types/GlobalType'; +import { Tenant } from '../../../types/Tenant'; +import { TenantSupport } from '../../../types/TenantSupport'; +import { Constants } from '../../../utils/Constants'; +import { Utils } from '../../../utils/Utils'; @Component({ selector: 'app-tenant-data', @@ -22,11 +24,18 @@ export class TenantDataComponent implements OnInit, OnChanges { public initialized = false; public formGroup!: UntypedFormGroup; public name!: AbstractControl; + public legalStatus!: AbstractControl; + public corporateName!: AbstractControl; + public website!: AbstractControl; public email!: AbstractControl; + public rcs!: AbstractControl; + public capital!: AbstractControl; + public siret!: AbstractControl; public logo = Constants.NO_IMAGE; public logoHasChanged = false; public logoMaxSize: number; public address: Address = {} as Address; + public tenantSupport: TenantSupport = {} as TenantSupport; public tenant: Tenant; public constructor( @@ -54,9 +63,43 @@ export class TenantDataComponent implements OnInit, OnChanges { Validators.email, ])) ); + this.formGroup.addControl('corporateName', new UntypedFormControl('', + Validators.compose([ + Validators.maxLength(100), + ])) + ); + this.formGroup.addControl('website', new UntypedFormControl('', + Validators.compose([ + Validators.pattern(Constants.URL_PATTERN) + ])) + ); + this.formGroup.addControl('rcs', new UntypedFormControl('', + Validators.compose([ + ])) + ); + this.formGroup.addControl('capital', new UntypedFormControl('', + Validators.compose([ + Validators.pattern('^[0-9]*$') + ])) + ); + this.formGroup.addControl('siret', new UntypedFormControl('', + Validators.compose([ + Validators.pattern('^[0-9]{14}$') + ])) + ); + this.formGroup.addControl('legalStatus', new UntypedFormControl('', + Validators.compose([ + ])) + ); // Assign this.name = this.formGroup.controls['name']; this.email = this.formGroup.controls['email']; + this.legalStatus = this.formGroup.controls['legalStatus']; + this.corporateName = this.formGroup.controls['corporateName']; + this.website = this.formGroup.controls['website']; + this.rcs = this.formGroup.controls['rcs']; + this.capital = this.formGroup.controls['capital']; + this.siret = this.formGroup.controls['siret']; this.initialized = true; this.loadTenant(); } @@ -70,9 +113,18 @@ export class TenantDataComponent implements OnInit, OnChanges { this.centralServerService.getTenant(this.centralServerService.getLoggedUser().tenantID).subscribe((tenant) => { this.name.setValue(tenant.name); this.email.setValue(tenant.email); + this.legalStatus.setValue(tenant.legalStatus); + this.corporateName.setValue(tenant.corporateName); + this.website.setValue(tenant.website); + this.rcs.setValue(tenant.rcs); + this.capital.setValue(tenant.capital); + this.siret.setValue(tenant.siret); if (tenant.address) { this.address = tenant.address; } + if (tenant.support) { + this.tenantSupport = tenant.support; + } this.tenant = tenant; this.formGroup.markAsPristine(); // Get Tenant logo @@ -91,6 +143,10 @@ export class TenantDataComponent implements OnInit, OnChanges { } } }); + // Update form group + this.formGroup.updateValueAndValidity(); + this.formGroup.markAsPristine(); + this.formGroup.markAllAsTouched(); }); } @@ -116,6 +172,10 @@ export class TenantDataComponent implements OnInit, OnChanges { } } + public toUpperCase(control: AbstractControl) { + control.setValue(control.value.toUpperCase()); + } + public clearLogo() { // Clear this.logo = Constants.NO_IMAGE; @@ -142,6 +202,7 @@ export class TenantDataComponent implements OnInit, OnChanges { this.spinnerService.show(); this.updateTenantLogo(tenant); tenant.id = this.centralServerService.getLoggedUser().tenantID; + // forthis.tenantSupport this.centralServerService.updateTenantData(tenant).subscribe({ next: (response) => { this.spinnerService.hide(); diff --git a/src/app/pages/settings-technical/settings-technical.module.ts b/src/app/pages/settings-technical/settings-technical.module.ts index 5dd16c0fac..cf38f8ba94 100644 --- a/src/app/pages/settings-technical/settings-technical.module.ts +++ b/src/app/pages/settings-technical/settings-technical.module.ts @@ -3,13 +3,14 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { AddressModule } from 'shared/address/address.module'; import { MaterialModule } from '../../app.module'; +import { AddressModule } from '../../shared/address/address.module'; import { DialogsModule } from '../../shared/dialogs/dialogs.module'; import { CommonDirectivesModule } from '../../shared/directives/directives.module'; import { FormattersModule } from '../../shared/formatters/formatters.module'; import { TableModule } from '../../shared/table/table.module'; +import { TenantSupportModule } from '../../shared/tenant-support/tenant-support.module'; import { SettingsCryptoKeyComponent } from './crypto/crypto-key/settings-crypto-key.component'; import { SettingsCryptoComponent } from './crypto/settings-crypto.component'; import { TenantDataComponent } from './data/tenant-data.component'; @@ -36,7 +37,8 @@ import { SettingsUserComponent } from './users/settings-user.component'; TableModule, FormsModule, ReactiveFormsModule, - AddressModule + AddressModule, + TenantSupportModule, ] }) export class SettingsTechnicalModule { } diff --git a/src/app/pages/tenants/tenants.module.ts b/src/app/pages/tenants/tenants.module.ts index 6d8957b3df..0f7ccd5596 100644 --- a/src/app/pages/tenants/tenants.module.ts +++ b/src/app/pages/tenants/tenants.module.ts @@ -9,6 +9,7 @@ import { AddressModule } from '../../shared/address/address.module'; import { DialogsModule } from '../../shared/dialogs/dialogs.module'; import { CommonDirectivesModule } from '../../shared/directives/directives.module'; import { TableModule } from '../../shared/table/table.module'; +import { TenantSupportModule } from '../../shared/tenant-support/tenant-support.module'; import { TenantLogoFormatterCellComponent } from './cell-components/tenant-logo-formatter-cell.component'; import { TenantsListTableDataSource } from './list/tenants-list-table-data-source'; import { TenantsListComponent } from './list/tenants-list.component'; @@ -30,6 +31,7 @@ import { TenantsRoutes } from './tenants.routing'; CommonDirectivesModule, DialogsModule, AddressModule, + TenantSupportModule ], declarations: [ TenantsListComponent, diff --git a/src/app/shared/tenant-support/tenant-support.component.html b/src/app/shared/tenant-support/tenant-support.component.html new file mode 100644 index 0000000000..51e2cca861 --- /dev/null +++ b/src/app/shared/tenant-support/tenant-support.component.html @@ -0,0 +1,14 @@ +
+
+ + + {{"users.invalid_phone_number" | translate}} + +
+
+ + + {{"authentication.invalid_email" | translate}} + +
+
diff --git a/src/app/shared/tenant-support/tenant-support.component.ts b/src/app/shared/tenant-support/tenant-support.component.ts new file mode 100644 index 0000000000..9c479c69be --- /dev/null +++ b/src/app/shared/tenant-support/tenant-support.component.ts @@ -0,0 +1,62 @@ +import { Component, Input, OnChanges, OnInit } from '@angular/core'; +import { AbstractControl, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms'; + +import { TenantSupport } from '../../types/TenantSupport'; +import { Users } from '../../utils/Users'; + +@Component({ + selector: 'app-tenant-support', + templateUrl: 'tenant-support.component.html', +}) +export class TenantSupportComponent implements OnInit, OnChanges { + @Input() public formGroup!: UntypedFormGroup; + @Input() public tenantSupport!: TenantSupport; + public tenantSupportFormGroup!: UntypedFormGroup; + public supportPhone!: AbstractControl; + public supportEmail: AbstractControl; + public initialized = false; + + // eslint-disable-next-line no-useless-constructor + public constructor() {} + + public ngOnInit() { + this.tenantSupportFormGroup = new UntypedFormGroup({ + supportPhone: new UntypedFormControl(null, + Validators.compose([ + Users.validatePhone, + ]) + ), + supportEmail: new UntypedFormControl(null, + Validators.compose([ + Validators.email, + ]) + ) + }); + // Add the form group to the parent component + if (!this.formGroup.disabled) { + this.formGroup.addControl('support', this.tenantSupportFormGroup); + } else { + this.tenantSupportFormGroup.disable(); + } + // Form + this.supportPhone = this.tenantSupportFormGroup.controls['supportPhone']; + this.supportEmail = this.tenantSupportFormGroup.controls['supportEmail']; + this.initialized = true; + this.loadSupport(); + } + + public ngOnChanges() { + this.loadSupport(); + } + + public loadSupport() { + if (this.initialized && this.tenantSupport) { + if (this.tenantSupport.supportEmail) { + this.supportEmail.setValue(this.tenantSupport.supportEmail ?? null); + } + if (this.tenantSupport.supportPhone) { + this.supportPhone.setValue(this.tenantSupport.supportPhone ?? null); + } + } + } +} diff --git a/src/app/shared/tenant-support/tenant-support.module.ts b/src/app/shared/tenant-support/tenant-support.module.ts new file mode 100644 index 0000000000..4daed85039 --- /dev/null +++ b/src/app/shared/tenant-support/tenant-support.module.ts @@ -0,0 +1,29 @@ +export class FooterModule { +} + +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; +import { GooglePlaceModule } from 'ngx-google-places-autocomplete'; + +import { MaterialModule } from '../../app.module'; +import { TenantSupportComponent } from './tenant-support.component'; + +@NgModule({ + imports: [ + CommonModule, + ReactiveFormsModule, + TranslateModule, + MaterialModule, + GooglePlaceModule, + ], + declarations: [ + TenantSupportComponent, + ], + exports: [ + TenantSupportComponent, + ], +}) +export class TenantSupportModule { +} diff --git a/src/app/types/Tenant.ts b/src/app/types/Tenant.ts index fd8bb3b639..763ad8d799 100644 --- a/src/app/types/Tenant.ts +++ b/src/app/types/Tenant.ts @@ -1,5 +1,6 @@ import { Address } from './Address'; import { TableData } from './Table'; +import { TenantSupport } from './TenantSupport'; export interface Tenant extends TableData { id: string; @@ -9,6 +10,13 @@ export interface Tenant extends TableData { subdomain: string; components?: TenantComponent; logo: string; + legalStatus: string; + corporateName: string; + website: string; + support: TenantSupport; + rcs: string; + capital: string; + siret: string; } export interface TenantComponent { diff --git a/src/app/types/TenantSupport.ts b/src/app/types/TenantSupport.ts new file mode 100644 index 0000000000..b99105ee07 --- /dev/null +++ b/src/app/types/TenantSupport.ts @@ -0,0 +1,5 @@ + +export interface TenantSupport { + supportEmail: string; + supportPhone: string; +} diff --git a/src/assets/i18n/cs.json b/src/assets/i18n/cs.json index 869d9b9014..8c11fa2aa0 100644 --- a/src/assets/i18n/cs.json +++ b/src/assets/i18n/cs.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Business Details", "crypto": "Krypto", - "users": "Uživatel", - "organization": "Organizace" + "users": "Uživatel" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 9d3c6b12dd..e77359363a 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Business Details", "crypto": "Krypto", - "users": "Nutzer", - "organization": "Organisation" + "users": "Nutzer" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 359e77ab73..7ee3f60940 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Business Details", "crypto": "Crypto", - "users": "Users", - "organization": "Organization" + "users": "Users" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index a8c6cf75d4..ace6eaf346 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Business Details", "crypto": "Crypto", - "users": "Users", - "organization": "Organización" + "users": "Users" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index d1b68ae2cd..113c6c9736 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Détails de l'entreprise", "crypto": "Chiffrement", - "users": "Utilisateurs", - "organization": "Organisation" + "users": "Utilisateurs" + }, + "tenant": { + "public_name": "Nom commercial", + "email": "Email de contact", + "website": "Site web de l'organisation" + }, + "business": { + "title": "Informations sur l'entreprise", + "corporate_name": "Dénomination sociale", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Statut juridique", + "siret": "SIRET", + "error_siret_pattern": "Numéro de SIRET invalide" + }, + "support": { + "title": "Informations sur le support", + "email": "Email du support", + "phone": "Numéro de téléphone du support" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json index de53df6954..4a183c5f77 100644 --- a/src/assets/i18n/it.json +++ b/src/assets/i18n/it.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Organizzazione", "crypto": "Crittografia", - "users": "Utenti", - "organization": "Organizzazione" + "users": "Utenti" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": { diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index 0df1f6b27e..2f9146cf11 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -1921,9 +1921,28 @@ }, "technical_settings": { "tabs": { + "organization": "Business Details", "crypto": "Crypto", - "users": "Users", - "organization": "Organização" + "users": "Users" + }, + "tenant": { + "public_name": "Public Name", + "email": "Public Email", + "website": "Organization's Website" + }, + "business": { + "title": "Business Information", + "corporate_name": "Corporate Name", + "rcs": "RCS", + "capital": "Capital", + "legal_status": "Legal Status", + "siret": "SIRET", + "error_siret_pattern": "Invalid SIRET number" + }, + "support": { + "title": "Support Information", + "email": "Support Email", + "phone": "Support Phone" }, "crypto": { "crypto_key": {