Commit a31edf45 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18428 TIME 0:20 chnage uri to url + display m2m email

parent 5481bda9
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.dc35e0550e41e621c2e3.js" type="module"></script><script src="main-es5.dc35e0550e41e621c2e3.js" nomodule defer></script></body>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.65def4c6e35150a25546.js" type="module"></script><script src="main-es5.65def4c6e35150a25546.js" nomodule defer></script></body>
</html>
\ No newline at end of file
......@@ -104,7 +104,7 @@
*ngIf="(field.unit === unit.id && unit.id !== 'address') || (field.unit === unit.id && unit.id === 'address' && !addressBANMode)">
<p mat-line class="contact-content" *ngIf="field.display">
<ng-container
*ngIf="field.type === 'string' && field.id !== 'uri' && field.id !== 'externalId_m2m' && field.id != 'addressCountry'">
*ngIf="field.type === 'string' && field.id !== 'url' && field.id !== 'externalId_m2m' && field.id != 'addressCountry'">
<mat-form-field>
<input matInput [formControl]="field.control" [placeholder]="field.label"
(blur)="checkCompany(field);checkFilling();" (ngModelChange)="toUpperCase(field, $event)" [required]="field.required">
......@@ -184,7 +184,7 @@
<mat-error *ngIf="field.control.status!=='VALID' && field.control.touched">
{{getErrorMsg(field.control.errors)}}</mat-error>
</ng-container>
<ng-container *ngIf="field.id === 'uri'">
<ng-container *ngIf="field.id === 'url'">
<mat-form-field *ngIf="annuaryEnabled">
<input type="text" #autoCompleteInputCommunicationMean
[placeholder]="'lang.searchCommunicationMean' | translate" matInput
......
......@@ -253,7 +253,7 @@ export class ContactsFormComponent implements OnInit {
values: []
},
{
id: 'uri',
id: 'url',
unit: 'maarch2maarch',
label: this.translate.instant('lang.communicationMean'),
desc: `${this.translate.instant('lang.communicationMeanDesc')} (${this.translate.instant('lang.see')} <a href="${this.maarch2maarchUrl}" target="_blank">MAARCH2MAARCH</a>)`,
......@@ -264,6 +264,18 @@ export class ContactsFormComponent implements OnInit {
filling: false,
values: []
},
{
id: 'externalId_m2m',
unit: 'maarch2maarch',
label: this.translate.instant('lang.IdMaarch2Maarch'),
desc: `${this.translate.instant('lang.m2mContactInfo')} (${this.translate.instant('lang.see')} <a href="${this.maarch2maarchUrl}" target="_blank">MAARCH2MAARCH</a>)`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
},
{
id: 'login',
unit: 'maarch2maarch',
......@@ -300,18 +312,6 @@ export class ContactsFormComponent implements OnInit {
filling: false,
values: []
},
{
id: 'externalId_m2m',
unit: 'maarch2maarch',
label: this.translate.instant('lang.IdMaarch2Maarch'),
desc: `${this.translate.instant('lang.m2mContactInfo')} (${this.translate.instant('lang.see')} <a href="${this.maarch2maarchUrl}" target="_blank">MAARCH2MAARCH</a>)`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
}
];
addressBANInfo: string = '';
......@@ -754,7 +754,7 @@ export class ContactsFormComponent implements OnInit {
value: item.control.value
}));
const communicationMeans = {
uri: m2mData.find((item: any) => item.id === 'uri').value,
url: m2mData.find((item: any) => item.id === 'url').value,
externalId_m2m: m2mData.find((item: any) => item.id === 'externalId_m2m').value,
login: m2mData.find((item: any) => item.id === 'login').value,
password: m2mData.find((item: any) => item.id === 'password').value,
......@@ -850,14 +850,20 @@ export class ContactsFormComponent implements OnInit {
setCommunicationMeans(communicationMeans: any) {
let indexField = -1;
Object.keys(communicationMeans).forEach(element => {
element = element === 'email' ? 'email_m2m' : element;
indexField = this.contactForm.map(field => field.id).indexOf(element);
if (!this.isEmptyValue(communicationMeans[element]) && indexField > -1 && ['uri', 'login'].indexOf(element) > -1) {
this.contactForm[indexField].control.setValue(communicationMeans[element]);
if (!this.isEmptyValue(communicationMeans[element === 'email_m2m' ? 'email' : element]) && indexField > -1 && ['url', 'login', 'email_m2m'].indexOf(element) > -1) {
if (element === 'email_m2m') {
this.contactForm[indexField].control.setValue(communicationMeans['email']);
} else {
this.contactForm[indexField].control.setValue(communicationMeans[element]);
}
this.contactForm[indexField].display = true;
}
});
}
canDelete(field: any) {
if (field.id === 'company') {
const lastname = this.contactForm.filter(contact => contact.id === 'lastname')[0];
......@@ -897,7 +903,7 @@ export class ContactsFormComponent implements OnInit {
removeField(field: any) {
field.display = !field.display;
field.control.reset();
if ((field.id === 'externalId_m2m' || field.id === 'uri') && !field.display) {
if ((field.id === 'externalId_m2m' || field.id === 'url') && !field.display) {
const indexFieldAnnuaryId = this.contactForm.map(item => item.id).indexOf('externalId_m2m_annuary_id');
if (indexFieldAnnuaryId > -1) {
this.contactForm.splice(indexFieldAnnuaryId, 1);
......@@ -909,7 +915,7 @@ export class ContactsFormComponent implements OnInit {
initAutocompleteCommunicationMeans() {
this.communicationMeanInfo = this.translate.instant('lang.autocompleteInfo');
this.communicationMeanResult = [];
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('url');
this.contactForm[indexFieldCommunicationMeans].control.valueChanges
.pipe(
debounceTime(300),
......@@ -936,7 +942,7 @@ export class ContactsFormComponent implements OnInit {
}
selectCommunicationMean(ev: any) {
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('url');
this.contactForm[indexFieldCommunicationMeans].control.setValue(ev.option.value.communicationValue);
const indexFieldExternalId = this.contactForm.map(field => field.id).indexOf('externalId_m2m');
......@@ -950,7 +956,7 @@ export class ContactsFormComponent implements OnInit {
initAutocompleteExternalIdM2M() {
this.externalId_m2mInfo = this.translate.instant('lang.autocompleteInfo');
this.externalId_m2mResult = [];
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('uri');
const indexFieldCommunicationMeans = this.contactForm.map(field => field.id).indexOf('url');
const indexFieldExternalId = this.contactForm.map(field => field.id).indexOf('externalId_m2m');
this.contactForm[indexFieldExternalId].control.valueChanges
.pipe(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment