From 39e8595d3d1d20d795d81d3f9eaf7f3422b37380 Mon Sep 17 00:00:00 2001
From: OliveGerste <33114317+OliveGerste@users.noreply.github.com>
Date: Thu, 15 Jul 2021 16:48:55 +0200
Subject: [PATCH 01/14] Added Lacroix connection settings
---
.../Lacroix-asset-connection.component.html | 24 +++++++++
.../Lacroix-asset-connection.component.ts | 51 +++++++++++++++++++
.../asset-connection.component.html | 7 +++
.../connection/asset-connection.component.ts | 12 ++++-
.../settings-integration.module.ts | 3 ++
src/app/services/component.service.ts | 3 ++
src/app/types/Setting.ts | 4 ++
src/assets/i18n/de.json | 3 +-
src/assets/i18n/en.json | 3 +-
src/assets/i18n/es.json | 3 +-
src/assets/i18n/fr.json | 3 +-
src/assets/i18n/it.json | 3 +-
src/assets/i18n/pt.json | 3 +-
13 files changed, 114 insertions(+), 8 deletions(-)
create mode 100644 src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.html
create mode 100644 src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.ts
diff --git a/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.html b/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.html
new file mode 100644
index 0000000000..22a541ff71
--- /dev/null
+++ b/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ {{"general.mandatory_field" | translate}}
+
+
+
+
+
+
+
+
+ {{"general.mandatory_field" | translate}}
+
+
+
+
diff --git a/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.ts b/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.ts
new file mode 100644
index 0000000000..f8b5394b71
--- /dev/null
+++ b/src/app/pages/settings-integration/asset/connection/Lacroix/Lacroix-asset-connection.component.ts
@@ -0,0 +1,51 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
+
+import { AssetLacroixConnectionType } from '../../../../../types/Setting';
+
+@Component({
+ selector: 'app-settings-lacroix-connection',
+ templateUrl: './lacroix-asset-connection.component.html'
+})
+export class LacroixAssetConnectionComponent implements OnInit {
+ @Input() public formGroup!: FormGroup;
+ @Input() public lacroixConnection!: AssetLacroixConnectionType;
+
+ public lacroixLoginForm!: FormGroup;
+ public user!: AbstractControl;
+ public password!: AbstractControl;
+
+ public ngOnInit(): void {
+ // Set login credentials form
+ this.lacroixLoginForm = new FormGroup({
+ user: new FormControl('',
+ Validators.compose([
+ Validators.required,
+ ])),
+ password: new FormControl('',
+ Validators.compose([
+ Validators.required,
+ ])),
+ });
+ if (!this.formGroup.disabled) {
+ this.formGroup.addControl('lacroixConnection', this.lacroixLoginForm);
+ } else {
+ this.lacroixLoginForm.disable();
+ }
+ this.user = this.lacroixLoginForm.controls['user'];
+ this.password = this.lacroixLoginForm.controls['password'];
+ // Load existing credentials
+ this.loadCredentials();
+ }
+
+ public loadCredentials(): void {
+ if (this.lacroixConnection) {
+ if (this.lacroixConnection.user) {
+ this.lacroixLoginForm.controls.user.setValue(this.lacroixConnection.user);
+ }
+ if (this.lacroixConnection.password) {
+ this.lacroixLoginForm.controls.password.setValue(this.lacroixConnection.password);
+ }
+ }
+ }
+}
diff --git a/src/app/pages/settings-integration/asset/connection/asset-connection.component.html b/src/app/pages/settings-integration/asset/connection/asset-connection.component.html
index 1039456c9f..c433d4bd75 100644
--- a/src/app/pages/settings-integration/asset/connection/asset-connection.component.html
+++ b/src/app/pages/settings-integration/asset/connection/asset-connection.component.html
@@ -111,6 +111,13 @@
+