mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 00:45:41 +00:00
feat: add eTrade fields to company entity and onboarding process
- Added new fields to the Company entity: licenceNumber, statusDescription, dateRegistered, renewedFrom, renewalDate, renewedTo, region, zone, woreda, kebele, houseNo, and etradePhone. - Updated onboarding wizard to include a new contact step and fetch company information from eTrade using TIN. - Created ETradeInfo component to handle fetching and displaying eTrade data. - Implemented ETradeService to interact with eTrade API and extract relevant company registration data. - Added new DTOs for fetching eTrade data and handling responses. - Updated CompanyProfileForm to integrate new fields and handle eTrade data. - Created hooks for managing eTrade data fetching and error handling.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { CompanyRegistrationData } from "@edr/types";
|
||||
|
||||
export class ETradeResponseDto implements CompanyRegistrationData {
|
||||
licenceNumber!: string;
|
||||
statusDescription!: string;
|
||||
dateRegistered!: string;
|
||||
renewedFrom!: string;
|
||||
renewalDate!: string;
|
||||
renewedTo!: string;
|
||||
region!: string;
|
||||
zone!: string;
|
||||
woreda!: string;
|
||||
kebele!: string;
|
||||
houseNo!: string;
|
||||
mobilePhone!: string;
|
||||
regularPhone!: string;
|
||||
managerName!: string;
|
||||
managerEmail?: string;
|
||||
managerPhone!: string;
|
||||
|
||||
constructor(data: CompanyRegistrationData) {
|
||||
this.licenceNumber = data.licenceNumber;
|
||||
this.statusDescription = data.statusDescription;
|
||||
this.dateRegistered = data.dateRegistered;
|
||||
this.renewedFrom = data.renewedFrom;
|
||||
this.renewalDate = data.renewalDate;
|
||||
this.renewedTo = data.renewedTo;
|
||||
this.region = data.region;
|
||||
this.zone = data.zone;
|
||||
this.woreda = data.woreda;
|
||||
this.kebele = data.kebele;
|
||||
this.houseNo = data.houseNo;
|
||||
this.mobilePhone = data.mobilePhone;
|
||||
this.regularPhone = data.regularPhone;
|
||||
this.managerName = data.managerName;
|
||||
this.managerEmail = data.managerEmail;
|
||||
this.managerPhone = data.managerPhone;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { IsString, IsNotEmpty, Length } from "class-validator";
|
||||
|
||||
export class FetchETradeDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Length(10, 10, { message: "TIN must be exactly 10 digits" })
|
||||
tin!: string;
|
||||
}
|
||||
@@ -17,7 +17,22 @@ export class ProfileResponseDto {
|
||||
|
||||
companyProfiles: ResponseCompanyProfileDto[];
|
||||
|
||||
licenceNumber: string | null;
|
||||
statusDescription: string | null;
|
||||
dateRegistered: string | null;
|
||||
renewedFrom: string | null;
|
||||
renewalDate: string | null;
|
||||
renewedTo: string | null;
|
||||
region: string | null;
|
||||
zone: string | null;
|
||||
woreda: string | null;
|
||||
kebele: string | null;
|
||||
houseNo: string | null;
|
||||
etradePhone: string | null;
|
||||
|
||||
contactPersonName: string | null;
|
||||
contactPersonPosition: string | null;
|
||||
contactPersonEmail: string | null;
|
||||
contactPersonPhone: string | null;
|
||||
generalManagerName: string | null;
|
||||
generalManagerEmail: string | null;
|
||||
@@ -48,8 +63,23 @@ export class ProfileResponseDto {
|
||||
this.fanNumber = company.fanNumber ?? null;
|
||||
this.profileId = profile.id;
|
||||
|
||||
this.licenceNumber = company.licenceNumber ?? null;
|
||||
this.statusDescription = company.statusDescription ?? null;
|
||||
this.dateRegistered = company.dateRegistered ?? null;
|
||||
this.renewedFrom = company.renewedFrom ?? null;
|
||||
this.renewalDate = company.renewalDate ?? null;
|
||||
this.renewedTo = company.renewedTo ?? null;
|
||||
this.region = company.region ?? null;
|
||||
this.zone = company.zone ?? null;
|
||||
this.woreda = company.woreda ?? null;
|
||||
this.kebele = company.kebele ?? null;
|
||||
this.houseNo = company.houseNo ?? null;
|
||||
this.etradePhone = company.etradePhone ?? null;
|
||||
|
||||
const attrs = company.attributes ?? {};
|
||||
this.contactPersonName = attrs.contactPersonName ?? null;
|
||||
this.contactPersonPosition = attrs.contactPersonPosition ?? null;
|
||||
this.contactPersonEmail = attrs.contactPersonEmail ?? null;
|
||||
this.contactPersonPhone = attrs.contactPersonPhone ?? null;
|
||||
this.generalManagerName = attrs.generalManagerName ?? null;
|
||||
this.generalManagerEmail = attrs.generalManagerEmail ?? null;
|
||||
|
||||
@@ -50,6 +50,14 @@ export class UpdateProfileDto {
|
||||
@IsString()
|
||||
contactPersonName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
contactPersonPosition?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
contactPersonEmail?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
contactPersonPhone?: string;
|
||||
@@ -85,4 +93,63 @@ export class UpdateProfileDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
poaAddress?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
licenceNumber?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
statusDescription?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
dateRegistered?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
renewedFrom?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
renewalDate?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
renewedTo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
region?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
zone?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
woreda?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
kebele?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
houseNo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(20)
|
||||
etradePhone?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user