Skip to content

Commit

Permalink
Merge pull request #730 from bcgov/oleks
Browse files Browse the repository at this point in the history
Emails for SubPlatforms, minor fixes.
  • Loading branch information
ychung-mot authored Oct 22, 2024
2 parents 4815601 + 136ad32 commit cf2f46d
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 11 deletions.
14 changes: 14 additions & 0 deletions frontend/src/app/common/models/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface Platform {
secondaryTakedownRequestContactEmail: string;
subsidiaries: Array<SubPlatform>;
platformType: string;
updUserDisplayNm: string;
}

export interface UpdatePlatform {
Expand All @@ -35,6 +36,10 @@ export interface UpdateSubPlatform {
updDtm: string;
isActive: boolean;
managingOrganizationId: number;
primaryNoticeOfTakedownContactEmail: string;
primaryTakedownRequestContactEmail: string;
secondaryNoticeOfTakedownContactEmail: string;
secondaryTakedownRequestContactEmail: string;
}

export interface SubPlatform {
Expand All @@ -43,10 +48,15 @@ export interface SubPlatform {
organizationType: string;
organizationCd: string;
organizationNm: string;
primaryNoticeOfTakedownContactEmail: string;
primaryTakedownRequestContactEmail: string;
secondaryNoticeOfTakedownContactEmail: string;
secondaryTakedownRequestContactEmail: string;
updDtm: string;
isActive: boolean;
updUserGuid: string;
managingOrganizationId: number;
updUserDisplayNm: string;
}

export interface PlatformCreate {
Expand All @@ -66,4 +76,8 @@ export interface SubPlatformCreate {
managingOrganizationId: number;
isActive: boolean;
updDtm: string;
primaryNoticeOfTakedownContactEmail: string;
primaryTakedownRequestContactEmail: string;
secondaryNoticeOfTakedownContactEmail: string;
secondaryTakedownRequestContactEmail: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GlobalLoaderService } from '../../../../common/services/global-loader.s
import { OrganizationService } from '../../../../common/services/organization.service';
import { DropdownOption } from '../../../../common/models/dropdown-option';
import { RadioButtonModule } from 'primeng/radiobutton';
import { Router } from '@angular/router';

@Component({
selector: 'app-add-new-platform',
Expand All @@ -33,6 +34,7 @@ export class AddNewPlatformComponent implements OnInit {
private fb: FormBuilder,
private messageHandlerService: ErrorHandlingService,
private loaderService: GlobalLoaderService,
private router: Router,
private orgService: OrganizationService,
) { }

Expand Down Expand Up @@ -68,6 +70,7 @@ export class AddNewPlatformComponent implements OnInit {
onCancel(): void {
this.myForm.reset();
this.platformStatusControl.setValue(true);
this.router.navigateByUrl(`/platform-management`);
}

public get organizationNmControl(): AbstractControl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,88 @@ <h2>Add New Platform</h2>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="organizationCd">Email for Non-Compliance Notices</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="primaryNoticeOfTakedownContactEmail"
id="primaryNoticeOfTakedownContactEmail" name="primaryNoticeOfTakedownContactEmail" />
</div>
<div class="validation-errors" *ngIf="!primaryNoticeOfTakedownContactEmailControl.pristine">

<small id="requiredPrimaryNoticeOfTakedownContactEmail"
*ngIf="primaryNoticeOfTakedownContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="secondaryNoticeOfTakedownContactEmail">Secondary Email for Non-Compliance
Notices (optional)</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="secondaryNoticeOfTakedownContactEmail"
id="secondaryNoticeOfTakedownContactEmail" name="secondaryNoticeOfTakedownContactEmail" />
</div>
<div class="validation-errors" *ngIf="!secondaryNoticeOfTakedownContactEmailControl.pristine">

<small id="requiredSecondaryNoticeOfTakedownContactEmail"
*ngIf="secondaryNoticeOfTakedownContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="primaryTakedownRequestContactEmail">Email for Takedown Request Letters</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="primaryTakedownRequestContactEmail"
id="primaryTakedownRequestContactEmail" name="primaryTakedownRequestContactEmail" />
</div>
<div class="validation-errors" *ngIf="!primaryTakedownRequestContactEmailControl.pristine">

<small id="requiredPrimaryTakedownRequestContactEmail"
*ngIf="primaryTakedownRequestContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="secondaryTakedownRequestContactEmail">Secondary Email for Takedown Request
Letters (optional)</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="secondaryTakedownRequestContactEmail"
id="secondaryTakedownRequestContactEmail" name="secondaryTakedownRequestContactEmail" />
</div>
<div class="validation-errors" *ngIf="!secondaryTakedownRequestContactEmailControl.pristine">

<small id="requiredSecondaryTakedownRequestContactEmail"
*ngIf="secondaryTakedownRequestContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
</div>
</form>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,27 @@ export class AddSubPlatformComponent implements OnInit {
public get platformStatusControl(): AbstractControl {
return this.myForm.controls['status'];
}
public get primaryNoticeOfTakedownContactEmailControl(): AbstractControl {
return this.myForm.controls['primaryNoticeOfTakedownContactEmail'];
}
public get primaryTakedownRequestContactEmailControl(): AbstractControl {
return this.myForm.controls['primaryTakedownRequestContactEmail'];
}
public get secondaryNoticeOfTakedownContactEmailControl(): AbstractControl {
return this.myForm.controls['secondaryNoticeOfTakedownContactEmail'];
}
public get secondaryTakedownRequestContactEmailControl(): AbstractControl {
return this.myForm.controls['secondaryTakedownRequestContactEmail'];
}

private initForm(): void {
this.myForm = this.fb.group({
organizationNm: ['', [Validators.required]],
organizationCd: ['', [Validators.required]],
primaryNoticeOfTakedownContactEmail: ['', [Validators.required, Validators.email]],
primaryTakedownRequestContactEmail: ['', [Validators.required, Validators.email]],
secondaryNoticeOfTakedownContactEmail: ['', [Validators.email]],
secondaryTakedownRequestContactEmail: ['', [Validators.email]],
status: [{ value: true, disabled: true }, []],
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2>Edit Platform</h2>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="platformType">Platform Type</label>
<label for="platformType">Platform Status</label>
</div>
<div class="form-group-row-col">
<p-radioButton name="isActive" id="isActive-true" [value]="true" label="Active"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { DropdownOption } from '../../../../common/models/dropdown-option';
import { ErrorHandlingService } from '../../../../common/services/error-handling.service';
Expand Down Expand Up @@ -40,6 +40,7 @@ export class EditPlatformComponent implements OnInit {
private route: ActivatedRoute,
private router: Router,
private orgService: OrganizationService,
private cd: ChangeDetectorRef,
) { }

ngOnInit(): void {
Expand Down Expand Up @@ -130,7 +131,9 @@ export class EditPlatformComponent implements OnInit {
secondaryNoticeOfTakedownContactEmail: [this.platform.secondaryNoticeOfTakedownContactEmail, [Validators.email]],
secondaryTakedownRequestContactEmail: [this.platform.secondaryTakedownRequestContactEmail, [Validators.email]],
platformType: [this.platform.platformType, [Validators.required]],
isActive: [!!this.platform.isActive, [Validators.required]],
isActive: [{ value: !!this.platform.isActive, disabled: true }, [Validators.required]],
});

this.cd.detectChanges();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,89 @@ <h2>Edit Subsidiary Platform</h2>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="platformType">Platform Type</label>
<label for="organizationCd">Email for Non-Compliance Notices</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="primaryNoticeOfTakedownContactEmail"
id="primaryNoticeOfTakedownContactEmail" name="primaryNoticeOfTakedownContactEmail" />
</div>
<div class="validation-errors" *ngIf="!primaryNoticeOfTakedownContactEmailControl.pristine">

<small id="requiredPrimaryNoticeOfTakedownContactEmail"
*ngIf="primaryNoticeOfTakedownContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="secondaryNoticeOfTakedownContactEmail">Secondary Email for Non-Compliance
Notices (optional)</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="secondaryNoticeOfTakedownContactEmail"
id="secondaryNoticeOfTakedownContactEmail" name="secondaryNoticeOfTakedownContactEmail" />
</div>
<div class="validation-errors" *ngIf="!secondaryNoticeOfTakedownContactEmailControl.pristine">

<small id="requiredSecondaryNoticeOfTakedownContactEmail"
*ngIf="secondaryNoticeOfTakedownContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="primaryTakedownRequestContactEmail">Email for Takedown Request Letters</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="primaryTakedownRequestContactEmail"
id="primaryTakedownRequestContactEmail" name="primaryTakedownRequestContactEmail" />
</div>
<div class="validation-errors" *ngIf="!primaryTakedownRequestContactEmailControl.pristine">

<small id="requiredPrimaryTakedownRequestContactEmail"
*ngIf="primaryTakedownRequestContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="secondaryTakedownRequestContactEmail">Secondary Email for Takedown Request
Letters (optional)</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Platform’s Email Contact" [ngClass]="'full-width-text-field'"
type="text" pInputText formControlName="secondaryTakedownRequestContactEmail"
id="secondaryTakedownRequestContactEmail" name="secondaryTakedownRequestContactEmail" />
</div>
<div class="validation-errors" *ngIf="!secondaryTakedownRequestContactEmailControl.pristine">

<small id="requiredSecondaryTakedownRequestContactEmail"
*ngIf="secondaryTakedownRequestContactEmailControl.errors?.['required']">
Email is Required
</small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="platformType">Platform Status</label>
</div>
<div class="form-group-row-col">
<p-radioButton name="isActive" id="isActive-true" [value]="true" label="Active"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class EditSubPlatformComponent implements OnInit {
isActive: platformRaw.isActive,
organizationNm: platformRaw.organizationNm,
managingOrganizationId: this.platform.managingOrganizationId,
primaryNoticeOfTakedownContactEmail: platformRaw.primaryNoticeOfTakedownContactEmail,
primaryTakedownRequestContactEmail: platformRaw.primaryTakedownRequestContactEmail,
secondaryNoticeOfTakedownContactEmail: platformRaw.secondaryNoticeOfTakedownContactEmail,
secondaryTakedownRequestContactEmail: platformRaw.secondaryTakedownRequestContactEmail,
updDtm: this.platform.updDtm,
};

Expand All @@ -78,6 +82,18 @@ export class EditSubPlatformComponent implements OnInit {
public get organizationCdControl(): AbstractControl {
return this.myForm.controls['organizationCd'];
}
public get primaryNoticeOfTakedownContactEmailControl(): AbstractControl {
return this.myForm.controls['primaryNoticeOfTakedownContactEmail'];
}
public get primaryTakedownRequestContactEmailControl(): AbstractControl {
return this.myForm.controls['primaryTakedownRequestContactEmail'];
}
public get secondaryNoticeOfTakedownContactEmailControl(): AbstractControl {
return this.myForm.controls['secondaryNoticeOfTakedownContactEmail'];
}
public get secondaryTakedownRequestContactEmailControl(): AbstractControl {
return this.myForm.controls['secondaryTakedownRequestContactEmail'];
}
public get platformStatusControl(): AbstractControl {
return this.myForm.controls['isActive'];
}
Expand All @@ -100,7 +116,11 @@ export class EditSubPlatformComponent implements OnInit {
this.myForm = this.fb.group({
organizationNm: [this.platform.organizationNm, [Validators.required]],
organizationCd: [{ value: this.platform.organizationCd, disabled: true }, [Validators.required]],
isActive: [!!this.platform.isActive, [Validators.required]],
primaryNoticeOfTakedownContactEmail: [this.platform.primaryNoticeOfTakedownContactEmail, [Validators.required, Validators.email]],
primaryTakedownRequestContactEmail: [this.platform.primaryTakedownRequestContactEmail, [Validators.required, Validators.email]],
secondaryNoticeOfTakedownContactEmail: [this.platform.secondaryNoticeOfTakedownContactEmail, [Validators.email]],
secondaryTakedownRequestContactEmail: [this.platform.secondaryTakedownRequestContactEmail, [Validators.email]],
isActive: [{ value: !!this.platform.isActive, disabled: true }, [Validators.required]],
});

this.cd.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ <h2>Manage Platforms</h2>
<i class="pi pi-angle-up"
*ngIf="this.sortSub && this.sortSub.prop === 'organizationCd' && this.sortSub.dir === 'asc'"></i>
</th>
<th>Platform Type</th>
<th class="sortable-header" id="primaryNoticeOfTakedownContactEmail_header"
[class.sorted]="this.sortSub && this.sortSub.prop === 'primaryNoticeOfTakedownContactEmail'"
(click)="onSortSub('primaryNoticeOfTakedownContactEmail')">Notice of Non-compliance Email
Expand Down Expand Up @@ -153,10 +152,9 @@ <h2>Manage Platforms</h2>
<tr>
<td>{{subPlatform.organizationNm || '-'}}</td>
<td>{{subPlatform.organizationCd || '-'}}</td>
<td>{{platform.platformType || '-'}}</td>
<td>{{platform.primaryNoticeOfTakedownContactEmail || '-'}}
<td>{{subPlatform.primaryNoticeOfTakedownContactEmail || '-'}}
</td>
<td>{{platform.primaryTakedownRequestContactEmail || '-'}}
<td>{{subPlatform.primaryTakedownRequestContactEmail || '-'}}
</td>
<td class="status" [class.active]="!!subPlatform.isActive">
{{subPlatform.isActive?'Active':'Disabled'}}</td>
Expand Down
Loading

0 comments on commit cf2f46d

Please sign in to comment.