From 0efdedca6e18165c9152e1830be84d9c8b20699d Mon Sep 17 00:00:00 2001
From: Mazdak Gibran <141390141+mazdakgibran@users.noreply.github.com>
Date: Tue, 6 Jan 2026 15:48:56 +0500
Subject: [PATCH] third part registration
third part registration reactive form with validations and send payload
---
.../change-password.component.html | 8 +-
.../change-password.component.ts | 2 +-
.../third-party-registration.component.html | 98 ++++++++++++-------
.../third-party-registration.component.ts | 52 +++++++++-
src/app/utils/uri-enums.ts | 3 +-
src/assets/data/app.uri.json | 9 +-
src/assets/i18n/Arabic.json | 2 +
src/assets/i18n/English.json | 2 +
8 files changed, 128 insertions(+), 48 deletions(-)
diff --git a/src/app/user-management/change-password/change-password.component.html b/src/app/user-management/change-password/change-password.component.html
index 644826d..60cd786 100644
--- a/src/app/user-management/change-password/change-password.component.html
+++ b/src/app/user-management/change-password/change-password.component.html
@@ -15,7 +15,7 @@
{{'changePassword' | translate}}
@@ -101,12 +122,19 @@
-
-
+
+
+
+ {{ 'fieldRequired' | translate }}
+
+
+ {{"regPhoneNo"|translate}}
+
+
@@ -133,17 +166,20 @@
{{ 'password' | translate }}*
-
-
-
-
+
+
+
+
+
+ {{ 'fieldRequired' | translate }}
+
+
+ {{ 'passwordTooShort' | translate }}
+
+
@@ -152,18 +188,10 @@
-
diff --git a/src/app/user-management/third-party-registration/third-party-registration.component.ts b/src/app/user-management/third-party-registration/third-party-registration.component.ts
index 75cf93b..6e1ed9c 100644
--- a/src/app/user-management/third-party-registration/third-party-registration.component.ts
+++ b/src/app/user-management/third-party-registration/third-party-registration.component.ts
@@ -1,28 +1,70 @@
import { CommonModule } from '@angular/common';
-import { Component, ViewChild } from '@angular/core';
-import { FormsModule } from '@angular/forms';
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { NgSelectModule } from '@ng-select/ng-select';
import { PasswordHideShowComponent } from '../../shared/components/password-hide-show/password-hide-show.component';
import { pageSizeOptions } from '../../utils/app.constants';
+import { URIKey } from '../../utils/uri-enums';
+import { HttpURIService } from '../../app.http.uri.service';
@Component({
selector: 'app-third-party-registration',
- imports: [TranslateModule, CommonModule, FormsModule, PasswordHideShowComponent, NgSelectModule ],
+ imports: [TranslateModule, CommonModule, FormsModule, ReactiveFormsModule, PasswordHideShowComponent, NgSelectModule ],
templateUrl: './third-party-registration.component.html',
styleUrl: './third-party-registration.component.scss'
})
-export class ThirdPartyRegistrationComponent {
+export class ThirdPartyRegistrationComponent implements OnInit {
+ thirdPartyRegForm! : FormGroup;
searchText: string = '';
passwordType: string = 'password';
renewalDataExpanded = true;
pageSizeOptions = pageSizeOptions;
itemsPerPage: number = 5;
-
+ constructor(private fb: FormBuilder, private httpURIService: HttpURIService){}
@ViewChild(PasswordHideShowComponent) passwordHideShow?: PasswordHideShowComponent;
togglePasswordType() {
this.passwordType = this.passwordHideShow?.showPassword ? 'password' : 'text';
}
+
+ ngOnInit(): void{
+ this.thirdPartyRegForm = this.fb.group({
+ thirdPartyId: ['', [Validators.required]],
+ thirdPartyName: ['',[Validators.required]],
+ email: ['',[Validators.required, Validators.email]],
+ address: ['',[Validators.required]],
+ phoneNumber: ['',[Validators.required, Validators.pattern('^[0-9]{10}$') ], ],
+ newNumberOfAccounts: ['',[Validators.required]],
+ password: ['',[Validators.required, Validators.minLength(6)]],
+ });
+ }
+
+ get passwordError(){
+ const control = this.thirdPartyRegForm.get('password');
+ if (!control || !control.touched) return null;
+
+ if (control.hasError('minlength')) return 'passwordTooShort';
+ return null;
+ }
+
+ onSubmit(){
+
+ if(this.thirdPartyRegForm.invalid){return}
+
+ const payload = {
+ thirdPartyId: this.thirdPartyRegForm.value.thirdPartyId,
+ thirdPartyName: this.thirdPartyRegForm.value.thirdPartyName,
+ email: this.thirdPartyRegForm.value.email,
+ address: this.thirdPartyRegForm.value.address,
+ phoneNumber: this.thirdPartyRegForm.value.phoneNumber,
+ newNumberOfAccounts: this.thirdPartyRegForm.value.newNumberOfAccounts,
+ password: this.thirdPartyRegForm.value.password
+ };
+
+
+ this.httpURIService.requestPOST(URIKey.THIRD_PARTY_REGISTER_URI, payload)
+ .subscribe();
+ }
}
diff --git a/src/app/utils/uri-enums.ts b/src/app/utils/uri-enums.ts
index 2d1957c..c72670d 100644
--- a/src/app/utils/uri-enums.ts
+++ b/src/app/utils/uri-enums.ts
@@ -10,5 +10,6 @@ export enum URIKey {
USER_GET_PERMISSIONS = "USER_GET_PERMISSIONS",
GET_ALL_USER_URI = "GET_ALL_USER_URI",
RESET_PASSWORD_URI = "RESET_PASSWORD_URI",
- CHANGE_PASSWORD_URI = "CHANGE_PASSWORD_URI"
+ CHANGE_PASSWORD_URI = "CHANGE_PASSWORD_URI",
+ THIRD_PARTY_REGISTER_URI = "THIRD_PARTY_REGISTER_URI"
}
\ No newline at end of file
diff --git a/src/assets/data/app.uri.json b/src/assets/data/app.uri.json
index 9bb8d8c..1a95ee3 100644
--- a/src/assets/data/app.uri.json
+++ b/src/assets/data/app.uri.json
@@ -49,18 +49,23 @@
},
{
"Id" : "ENTITY_RESET_PASSWORD_URI",
- "URI": "/user/reset-password",
+ "URI": "/user/resetPassword",
"UUID": "RESET_PASSWORD_URI"
},
{
"Id" : "ENTITY_CHANGE_PASSWORD_URI",
- "URI": "/user/change-password",
+ "URI": "/user/changePassword",
"UUID": "CHANGE_PASSWORD_URI"
},
{
"Id" : "ENTITY_USER_SAVE_PERMISSION",
"URI": "/user/updatePermissions",
"UUID": "USER_SAVE_PERMISSION"
+ },
+ {
+ "Id" : "ENTITY_THIRD_PARTY_REGISTER_URI",
+ "URI": "/user/thirdPartyRegisteration",
+ "UUID": "THIRD_PARTY_REGISTER_URI"
}
]
}
diff --git a/src/assets/i18n/Arabic.json b/src/assets/i18n/Arabic.json
index 6e255f4..df25fab 100644
--- a/src/assets/i18n/Arabic.json
+++ b/src/assets/i18n/Arabic.json
@@ -84,9 +84,11 @@
"name":"اسم",
"EnterThirdPartyName":"أدخل اسم الطرف الثالث",
"Email":"البريد الإلكتروني",
+ "invalidEmail": "أدخل بريدًا إلكترونيًا صالحًا يحتوي على @",
"Address":"تبوك",
"phoneNumber":"رقم الهاتف",
"PhoneNumberPlaceHolder":"أدخل رقم الهاتف",
+ "regPhoneNo": "يجب أن يتكون رقم الهاتف من 10 أرقام",
"NewNoOfAccounts":"عدد جديد من الحسابات",
"EnterNewNumberOfAccounts":"أدخل عددًا جديدًا من الحسابات",
"TotalNoOfAccounts":"العدد الإجمالي للحسابات",
diff --git a/src/assets/i18n/English.json b/src/assets/i18n/English.json
index c007008..5efa2a7 100644
--- a/src/assets/i18n/English.json
+++ b/src/assets/i18n/English.json
@@ -87,6 +87,7 @@
"Address":"Address",
"phoneNumber":"Phone Number",
"PhoneNumberPlaceHolder":"Enter Phone Number",
+ "regPhoneNo": "Phone number must be 10 digits",
"NewNoOfAccounts":"New No of Accounts",
"EnterNewNumberOfAccounts":"Enter New Number of Accounts",
"TotalNoOfAccounts":"Total No of Accounts",
@@ -176,6 +177,7 @@
"emailLabel": "Email",
"emailRequiredError": "Email is required.",
"invalidEmailFormatError": "Invalid email format.",
+ "invalidEmail": "Enter a valid email with @",
"passNotMatch": "Password does not match",
"POR_ORGACODE": "Organization ID",
"purposeSetup": "Configure Transaction Purpose",