Skip to content
Snippets Groups Projects
Commit 91be5eb3 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #12635 TIME 0:20 add communication mean field

parent c75b51c2
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
<mat-form-field> <mat-form-field>
<input matInput [formControl]="field.control" [placeholder]="field.label" <input matInput [formControl]="field.control" [placeholder]="field.label"
(blur)="checkCompany(field);checkFilling();" [required]="field.required"> (blur)="checkCompany(field);checkFilling();" [required]="field.required">
<mat-hint *ngIf="!isEmptyValue(field.desc)" align="end" [innerHTML]="field.desc">
</mat-hint>
<mat-hint *ngIf="companyFound !== null && field.id === 'company'" align="end"> <mat-hint *ngIf="companyFound !== null && field.id === 'company'" align="end">
{{lang.contactsParameters_company}} <b>{{companyFound.company}}</b> {{lang.contactsParameters_company}} <b>{{companyFound.company}}</b>
{{lang.found}} {{lang.found}}
...@@ -81,7 +83,8 @@ ...@@ -81,7 +83,8 @@
{{lang.toCopyAddress}}</mat-hint> {{lang.toCopyAddress}}</mat-hint>
<mat-error *ngIf="field.control.status!=='VALID' && field.control.touched"> <mat-error *ngIf="field.control.status!=='VALID' && field.control.touched">
{{getErrorMsg(field.control.errors)}}</mat-error> {{getErrorMsg(field.control.errors)}}</mat-error>
<mat-icon style="height: auto;" *ngIf="field.filling" matSuffix [title]="lang.targetFillingField" <mat-icon style="height: auto;" *ngIf="field.filling" matSuffix
[title]="lang.targetFillingField"
class="fas fa-circle rate_{{fillingRate.class}}"></mat-icon> class="fas fa-circle rate_{{fillingRate.class}}"></mat-icon>
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
...@@ -217,7 +220,7 @@ ...@@ -217,7 +220,7 @@
</div> </div>
</ng-container> </ng-container>
</div> </div>
<div style="text-align:center;"> <div style="text-align:center;padding-top: 10px;">
<button mat-raised-button color="default" type="button" <button mat-raised-button color="default" type="button"
[matMenuTriggerFor]="menu">{{lang.moreInfos}}...</button> [matMenuTriggerFor]="menu">{{lang.moreInfos}}...</button>
......
...@@ -11,6 +11,8 @@ import { startWith, switchMap, map, catchError, filter, exhaustMap, tap, debounc ...@@ -11,6 +11,8 @@ import { startWith, switchMap, map, catchError, filter, exhaustMap, tap, debounc
import { FormControl, Validators, ValidatorFn, FormGroup, FormBuilder } from '@angular/forms'; import { FormControl, Validators, ValidatorFn, FormGroup, FormBuilder } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
declare var angularGlobals: any;
@Component({ @Component({
selector: 'app-contact-form', selector: 'app-contact-form',
templateUrl: "contacts-form.component.html", templateUrl: "contacts-form.component.html",
...@@ -21,6 +23,7 @@ export class ContactsFormComponent implements OnInit { ...@@ -21,6 +23,7 @@ export class ContactsFormComponent implements OnInit {
@ViewChild('snav', { static: true }) public sidenavLeft: MatSidenav; @ViewChild('snav', { static: true }) public sidenavLeft: MatSidenav;
@ViewChild('snav2', { static: true }) public sidenavRight: MatSidenav; @ViewChild('snav2', { static: true }) public sidenavRight: MatSidenav;
lang: any = LANG; lang: any = LANG;
loading: boolean = false; loading: boolean = false;
...@@ -30,6 +33,8 @@ export class ContactsFormComponent implements OnInit { ...@@ -30,6 +33,8 @@ export class ContactsFormComponent implements OnInit {
@Output() onSubmitEvent = new EventEmitter<number>(); @Output() onSubmitEvent = new EventEmitter<number>();
maarch2GecUrl: string = `https://docs.maarch.org/gitbook/html/MaarchCourrier/${angularGlobals.applicationVersion.split('.')[0] + '.' + angularGlobals.applicationVersion.split('.')[1]}/guat/guat_exploitation/maarch2gec.html`;
contactUnit = [ contactUnit = [
{ {
id: 'mainInfo', id: 'mainInfo',
...@@ -210,6 +215,18 @@ export class ContactsFormComponent implements OnInit { ...@@ -210,6 +215,18 @@ export class ContactsFormComponent implements OnInit {
display: false, display: false,
filling: false, filling: false,
values: [] values: []
},
{
id: 'communicationMeans',
unit: 'complement',
label: this.lang.communicationMean,
desc: `${this.lang.communicationMeanDesc} (${this.lang.see} <a href="${this.maarch2GecUrl}" target="_blank">MAARCH2GEC</a>)`,
type: 'string',
control: new FormControl(),
required: false,
display: false,
filling: false,
values: []
} }
]; ];
...@@ -263,7 +280,7 @@ export class ContactsFormComponent implements OnInit { ...@@ -263,7 +280,7 @@ export class ContactsFormComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
this.initCustomElementForm(data); this.initCustomElementForm(data);
this.initAutocompleteAddressBan(); this.initAutocompleteAddressBan();
}), }),
finalize(() => this.loading = false), finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
...@@ -282,7 +299,7 @@ export class ContactsFormComponent implements OnInit { ...@@ -282,7 +299,7 @@ export class ContactsFormComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
this.fillingParameters = data.contactsFilling; this.fillingParameters = data.contactsFilling;
this.initElemForm(data); this.initElemForm(data);
}), }),
exhaustMap(() => this.http.get("../../rest/civilities")), exhaustMap(() => this.http.get("../../rest/civilities")),
tap((data: any) => { tap((data: any) => {
...@@ -336,6 +353,7 @@ export class ContactsFormComponent implements OnInit { ...@@ -336,6 +353,7 @@ export class ContactsFormComponent implements OnInit {
targetField = this.contactForm.filter(contact => contact.id === field.id)[0]; targetField = this.contactForm.filter(contact => contact.id === field.id)[0];
} }
if (targetField !== undefined) { if (targetField !== undefined) {
if ((element.filling && this.creationMode) || element.mandatory) { if ((element.filling && this.creationMode) || element.mandatory) {
targetField.display = true; targetField.display = true;
} }
...@@ -382,10 +400,10 @@ export class ContactsFormComponent implements OnInit { ...@@ -382,10 +400,10 @@ export class ContactsFormComponent implements OnInit {
valArr = []; valArr = [];
field = this.contactForm.filter(contact => contact.id === 'customField_' + element.id)[0]; field = this.contactForm.filter(contact => contact.id === 'customField_' + element.id)[0];
if (field !== undefined) { if (field !== undefined) {
field.label = element.label; field.label = element.label;
field.type = element.type; field.type = element.type;
field.values = element.values.map((value: any) => {return {id: value, label: value}}); field.values = element.values.map((value: any) => { return { id: value, label: value } });
if (element.type === 'integer') { if (element.type === 'integer') {
valArr.push(Validators.pattern(/^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$/)); valArr.push(Validators.pattern(/^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$/));
field.control.setValidators(valArr); field.control.setValidators(valArr);
...@@ -535,7 +553,7 @@ export class ContactsFormComponent implements OnInit { ...@@ -535,7 +553,7 @@ export class ContactsFormComponent implements OnInit {
isEmptyValue(value: string) { isEmptyValue(value: string) {
if (value === null) { if (value === null || value === undefined) {
return true; return true;
} else if (Array.isArray(value)) { } else if (Array.isArray(value)) {
......
declare var angularGlobals: any;
export const LANG_FR = { export const LANG_FR = {
"actives" : "Actif(s)", "actives" : "Actif(s)",
"ARsimple" : "AR simple", "ARsimple" : "AR simple",
...@@ -1400,10 +1402,13 @@ export const LANG_FR = { ...@@ -1400,10 +1402,13 @@ export const LANG_FR = {
"here": "ici", "here": "ici",
"toCopyAddress": "pour copier son adresse", "toCopyAddress": "pour copier son adresse",
"badFormat": "Format incorrect", "badFormat": "Format incorrect",
"contactFilledTo": "Contact rempli à", "contactFilledTo": "Complétude à",
"targetFillingField": "Champ cible de complétude", "targetFillingField": "Champ cible de complétude",
"arGenWithModelMessage" : "Les fiches de liaisons seront générées avec les champs définis dans le model d'enregistrement du courrier.", "arGenWithModelMessage" : "Les fiches de liaisons seront générées avec les champs définis dans le model d'enregistrement du courrier.",
"createContact": "Créer un contact", "createContact": "Créer un contact",
"diffusionListUpdated": "Liste de diffusion mise à jour", "diffusionListUpdated": "Liste de diffusion mise à jour",
"saveModifications": "Sauvegarder les modifications", "saveModifications": "Sauvegarder les modifications",
"communicationMean": "Moyen de communication",
"communicationMeanDesc": "Lie un contact à une autre instance de maarch",
"see": "voir",
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment