Skip to content

Commit 18a681a

Browse files
Metal dealers (#2069)
# Description This PR includes the following proposed change(s): - start work on metal dealers
1 parent 89d5df2 commit 18a681a

21 files changed

+1609
-24
lines changed

src/Spd.Presentation.Licensing/ClientApp/src/app/app-routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BusinessLicenceApplicationRoutes } from './modules/business-licence-application/business-license-application-routes';
22
import { ControllingMemberCrcRoutes } from './modules/controlling-member-crc/controlling-member-crc-routes';
3+
import { MetalDealersAndRecyclersRoutes } from './modules/metal-dealers-and-recyclers/metal-dealers-and-recyclers-routes';
34
import { PersonalLicenceApplicationRoutes } from './modules/personal-licence-application/personal-licence-application-routes';
45
import { SecurityLicenceStatusVerificationRoutes } from './modules/security-licence-status-verification/security-licence-status-verification-routes';
56

@@ -8,6 +9,7 @@ export class AppRoutes {
89
public static readonly BUSINESS_LICENCE_APPLICATION = BusinessLicenceApplicationRoutes.MODULE_PATH;
910
public static readonly CONTROLLING_MEMBERS_CRC = ControllingMemberCrcRoutes.MODULE_PATH;
1011
public static readonly SECURITY_LICENCE_STATUS_VERIFICATION = SecurityLicenceStatusVerificationRoutes.MODULE_PATH;
12+
public static readonly METAL_DEALERS_AND_RECYCLERS = MetalDealersAndRecyclersRoutes.MODULE_PATH;
1113
public static readonly LANDING = '';
1214
public static readonly ACCESS_DENIED = 'access-denied';
1315
public static readonly INVITATION_DENIED = 'invitation-denied';

src/Spd.Presentation.Licensing/ClientApp/src/app/app-routing.module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ const routes: Routes = [
3333
(m) => m.SecurityLicenceStatusVerificationModule
3434
),
3535
},
36+
{
37+
path: AppRoutes.METAL_DEALERS_AND_RECYCLERS,
38+
loadChildren: () =>
39+
import('./modules/metal-dealers-and-recyclers/metal-dealers-and-recyclers.module').then(
40+
(m) => m.MetalDealersAndRecyclersModule
41+
),
42+
},
3643
{
3744
path: AppRoutes.ACCESS_DENIED,
3845
component: AccessDeniedComponent,
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
2+
import { CommonApplicationHelper } from '@app/core/services/common-application.helper';
3+
import { ConfigService } from '@app/core/services/config.service';
4+
import { FileUtilService } from '@app/core/services/file-util.service';
5+
import { UtilService } from '@app/core/services/util.service';
6+
import { FormControlValidators } from '@app/core/validators/form-control.validators';
7+
import { FormGroupValidators } from '@app/core/validators/form-group.validators';
8+
import { FormatDatePipe } from '@app/shared/pipes/format-date.pipe';
9+
import { SPD_CONSTANTS } from '../constants/constants';
10+
11+
export abstract class MetalDealersApplicationHelper extends CommonApplicationHelper {
12+
businessOwnerFormGroup: FormGroup = this.formBuilder.group({
13+
legalBusinessName: new FormControl('', [FormControlValidators.required]),
14+
tradeName: new FormControl('', [FormControlValidators.required]),
15+
givenName: new FormControl(''),
16+
middleName: new FormControl(''),
17+
surname: new FormControl('', [FormControlValidators.required]),
18+
});
19+
20+
businessManagerFormGroup: FormGroup = this.formBuilder.group({
21+
givenName: new FormControl(''),
22+
middleName: new FormControl(''),
23+
surname: new FormControl('', [FormControlValidators.required]),
24+
phoneNumber: new FormControl('', [FormControlValidators.required]),
25+
emailAddress: new FormControl('', [FormControlValidators.email]),
26+
});
27+
28+
businessAddressFormGroup: FormGroup = this.formBuilder.group({
29+
addressSelected: new FormControl(false),
30+
addressLine1: new FormControl(''),
31+
addressLine2: new FormControl(''),
32+
city: new FormControl(''),
33+
postalCode: new FormControl(''),
34+
province: new FormControl(''),
35+
country: new FormControl(''),
36+
});
37+
38+
businessMailingAddressFormGroup: FormGroup = this.formBuilder.group(
39+
{
40+
addressSelected: new FormControl(false),
41+
addressLine1: new FormControl(''),
42+
addressLine2: new FormControl(''),
43+
city: new FormControl(''),
44+
postalCode: new FormControl(''),
45+
province: new FormControl(''),
46+
country: new FormControl(''),
47+
isAddressTheSame: new FormControl(false),
48+
},
49+
{
50+
validators: [
51+
FormGroupValidators.conditionalDefaultRequiredTrueValidator(
52+
'addressSelected',
53+
(_form) => _form.get('isAddressTheSame')?.value != true
54+
),
55+
FormGroupValidators.conditionalRequiredValidator(
56+
'addressLine1',
57+
(_form) => _form.get('isAddressTheSame')?.value != true
58+
),
59+
FormGroupValidators.conditionalRequiredValidator(
60+
'city',
61+
(_form) => _form.get('isAddressTheSame')?.value != true
62+
),
63+
FormGroupValidators.conditionalRequiredValidator(
64+
'postalCode',
65+
(_form) => _form.get('isAddressTheSame')?.value != true
66+
),
67+
FormGroupValidators.conditionalRequiredValidator(
68+
'province',
69+
(_form) => _form.get('isAddressTheSame')?.value != true
70+
),
71+
FormGroupValidators.conditionalRequiredValidator(
72+
'country',
73+
(_form) => _form.get('isAddressTheSame')?.value != true
74+
),
75+
],
76+
}
77+
);
78+
79+
branchesFormGroup: FormGroup = this.formBuilder.group({
80+
branches: this.formBuilder.array([]),
81+
});
82+
83+
branchFormGroup: FormGroup = this.formBuilder.group({
84+
addressSelected: new FormControl(false, [Validators.requiredTrue]),
85+
addressLine1: new FormControl('', [FormControlValidators.required]),
86+
addressLine2: new FormControl(''),
87+
city: new FormControl('', [FormControlValidators.required]),
88+
postalCode: new FormControl('', [FormControlValidators.required]),
89+
province: new FormControl('', [FormControlValidators.required]),
90+
country: new FormControl('', [
91+
FormControlValidators.required,
92+
FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA, SPD_CONSTANTS.address.countryCanada),
93+
]),
94+
givenName: new FormControl(''),
95+
middleName: new FormControl(''),
96+
surname: new FormControl('', [FormControlValidators.required]),
97+
phoneNumber: new FormControl('', [FormControlValidators.required]),
98+
emailAddress: new FormControl('', [FormControlValidators.email]),
99+
});
100+
101+
consentAndDeclarationFormGroup: FormGroup = this.formBuilder.group({
102+
check1: new FormControl(null, [Validators.requiredTrue]),
103+
agreeToCompleteAndAccurate: new FormControl(null, [Validators.requiredTrue]),
104+
dateSigned: new FormControl({ value: null, disabled: true }),
105+
captchaFormGroup: new FormGroup({
106+
token: new FormControl('', FormControlValidators.required),
107+
}),
108+
});
109+
110+
constructor(
111+
formBuilder: FormBuilder,
112+
protected configService: ConfigService,
113+
protected formatDatePipe: FormatDatePipe,
114+
protected utilService: UtilService,
115+
protected fileUtilService: FileUtilService
116+
) {
117+
super(formBuilder);
118+
}
119+
120+
getFullNameWithMiddle(
121+
givenName: string | null | undefined,
122+
middleName: string | null | undefined,
123+
surname: string | null | undefined
124+
): string {
125+
const userNameArray: string[] = [];
126+
if (givenName) {
127+
userNameArray.push(givenName);
128+
}
129+
if (middleName) {
130+
userNameArray.push(middleName);
131+
}
132+
if (surname) {
133+
userNameArray.push(surname);
134+
}
135+
return userNameArray.join(' ');
136+
}
137+
138+
getSummarybusinessOwnerDataname(modelData: any): string {
139+
return this.getFullNameWithMiddle(
140+
modelData.businessOwnerData.givenName,
141+
modelData.businessOwnerData.middleName,
142+
modelData.businessOwnerData.surname
143+
);
144+
}
145+
getSummarybusinessOwnerDatalegalBusinessName(modelData: any): string {
146+
return modelData.businessOwnerData.legalBusinessName ?? '';
147+
}
148+
getSummarybusinessOwnerDatatradeName(modelData: any): string {
149+
return modelData.businessOwnerData.tradeName ?? '';
150+
}
151+
152+
getSummarybusinessManagerDataname(modelData: any): string {
153+
return this.getFullNameWithMiddle(
154+
modelData.businessManagerData.givenName,
155+
modelData.businessManagerData.middleName,
156+
modelData.businessManagerData.surname
157+
);
158+
}
159+
getSummarybusinessManagerDataphoneNumber(modelData: any): string {
160+
return modelData.businessManagerData.phoneNumber ?? '';
161+
}
162+
getSummarybusinessManagerDataemailAddress(modelData: any): string {
163+
return modelData.businessManagerData.emailAddress ?? '';
164+
}
165+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Injectable } from '@angular/core';
2+
import { FormBuilder, FormGroup } from '@angular/forms';
3+
import { FormatDatePipe } from '@app/shared/pipes/format-date.pipe';
4+
import { BehaviorSubject } from 'rxjs';
5+
import { ConfigService } from './config.service';
6+
import { FileUtilService } from './file-util.service';
7+
import { MetalDealersApplicationHelper } from './metal-dealers-application.helper';
8+
import { UtilService } from './util.service';
9+
10+
@Injectable({
11+
providedIn: 'root',
12+
})
13+
export class MetalDealersApplicationService extends MetalDealersApplicationHelper {
14+
modelValueChanges$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
15+
16+
modelFormGroup: FormGroup = this.formBuilder.group({
17+
businessOwnerData: this.businessOwnerFormGroup,
18+
businessManagerData: this.businessManagerFormGroup,
19+
businessAddressData: this.businessAddressFormGroup,
20+
businessMailingAddressData: this.businessMailingAddressFormGroup,
21+
branchesData: this.branchesFormGroup,
22+
consentAndDeclarationData: this.consentAndDeclarationFormGroup,
23+
});
24+
25+
constructor(
26+
formBuilder: FormBuilder,
27+
configService: ConfigService,
28+
formatDatePipe: FormatDatePipe,
29+
utilService: UtilService,
30+
fileUtilService: FileUtilService
31+
) {
32+
super(formBuilder, configService, formatDatePipe, utilService, fileUtilService);
33+
}
34+
}

src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-bc-branches.component.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export interface BranchResponse {
2424
}
2525

2626
@Component({
27-
selector: 'app-business-bc-branches',
28-
template: `
27+
selector: 'app-business-bc-branches',
28+
template: `
2929
<form [formGroup]="form" novalidate>
3030
<div class="row">
3131
<div class="py-2">Does your business have any branches in B.C.?</div>
@@ -62,22 +62,15 @@ export interface BranchResponse {
6262
</ng-container>
6363
6464
<ng-container matColumnDef="city">
65-
<mat-header-cell class="mat-table-header-cell" *matHeaderCellDef sortActionDescription="Sort by city"
66-
>City</mat-header-cell
67-
>
65+
<mat-header-cell class="mat-table-header-cell" *matHeaderCellDef>City</mat-header-cell>
6866
<mat-cell *matCellDef="let branch">
6967
<span class="mobile-label">City:</span>
7068
{{ branch.city | default }}
7169
</mat-cell>
7270
</ng-container>
7371
7472
<ng-container matColumnDef="branchManager">
75-
<mat-header-cell
76-
class="mat-table-header-cell"
77-
*matHeaderCellDef
78-
sortActionDescription="Sort by manager name"
79-
>Manager</mat-header-cell
80-
>
73+
<mat-header-cell class="mat-table-header-cell" *matHeaderCellDef>Manager</mat-header-cell>
8174
<mat-cell *matCellDef="let branch">
8275
<span class="mobile-label">Manager:</span>
8376
{{ branch.branchManager | default }}
@@ -128,8 +121,8 @@ export interface BranchResponse {
128121
</div>
129122
</form>
130123
`,
131-
styles: [
132-
`
124+
styles: [
125+
`
133126
.mat-column-action1 {
134127
min-width: 150px;
135128
max-width: 150px;
@@ -146,9 +139,9 @@ export interface BranchResponse {
146139
}
147140
}
148141
`,
149-
],
150-
animations: [showHideTriggerSlideAnimation],
151-
standalone: false
142+
],
143+
animations: [showHideTriggerSlideAnimation],
144+
standalone: false,
152145
})
153146
export class BusinessBcBranchesComponent implements OnInit, LicenceChildStepperStepComponent {
154147
booleanTypeCodes = BooleanTypeCode;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { CommonApplicationService } from '@app/core/services/common-application.service';
3+
4+
@Component({
5+
selector: 'app-metal-dealers-base',
6+
template: `
7+
<div class="container px-0 my-0 px-md-2 my-md-3">
8+
<!-- hide padding/margin on smaller screens -->
9+
<div class="row">
10+
<div class="col-12">
11+
<router-outlet></router-outlet>
12+
</div>
13+
</div>
14+
</div>
15+
`,
16+
styles: ``,
17+
standalone: false,
18+
})
19+
export class MetalDealersBaseComponent implements OnInit {
20+
constructor(private commonApplicationService: CommonApplicationService) {}
21+
22+
ngOnInit(): void {
23+
this.commonApplicationService.setApplicationTitleText('Metal Dealers & Recyclers', 'Metal Dealers & Recyclers');
24+
}
25+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { Component } from '@angular/core';
2+
import { Router } from '@angular/router';
3+
import { MetalDealersAndRecyclersRoutes } from '@app/modules/metal-dealers-and-recyclers/metal-dealers-and-recyclers-routes';
4+
5+
@Component({
6+
selector: 'app-metal-dealers-main',
7+
template: `
8+
<section class="step-section">
9+
<div class="row">
10+
<div class="col-xxl-11 col-xl-12 col-lg-12 col-md-12 col-sm-12 mx-auto">
11+
<div class="row">
12+
<div class="col-12 my-auto">
13+
<h2 class="fs-3">Metal Dealers & Recyclers</h2>
14+
</div>
15+
</div>
16+
<mat-divider class="mat-divider-main mb-4"></mat-divider>
17+
18+
<div class="text-minor-heading my-3">Registering as a metal recycling dealer</div>
19+
20+
<div class="row">
21+
<div class="col-xl-8 col-lg-6 col-md-12 col-sm-12">
22+
<p>
23+
Metal theft puts public safety at risk because it interferes with telephone services, emergency
24+
communications and transportation systems, and may expose the public to electrocution from live wires.
25+
</p>
26+
27+
<p>
28+
The Province passed the <i>Metal Dealers and Recyclers Act</i> and
29+
<i>Metal Dealers Recyclers Regulation</i>. The act and regulation help deter and track metal theft, and
30+
protect the personal information of scrap metal sellers. They also increase the accountability of
31+
dealers and sellers and create consistent, minimum requirements across the province.
32+
</p>
33+
</div>
34+
<div class="col-xl-4 col-lg-6 col-md-12 col-sm-12">
35+
<button mat-flat-button color="primary" class="large" (click)="onRegister()">
36+
Register as a Metal Recycling Dealer
37+
</button>
38+
</div>
39+
</div>
40+
</div>
41+
</div>
42+
</section>
43+
`,
44+
styles: ``,
45+
standalone: false,
46+
})
47+
export class MetalDealersMainComponent {
48+
constructor(private router: Router) {}
49+
50+
onRegister(): void {
51+
this.router.navigateByUrl(
52+
MetalDealersAndRecyclersRoutes.path(MetalDealersAndRecyclersRoutes.METAL_DEALERS_AND_RECYCLERS_REGISTER)
53+
);
54+
}
55+
}

0 commit comments

Comments
 (0)