diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts index 1e482163..89508f8b 100644 --- a/frontend/src/app/app.routes.ts +++ b/frontend/src/app/app.routes.ts @@ -31,6 +31,7 @@ import { AddNewPlatformComponent } from './features/components/platform-manageme import { AddSubPlatformComponent } from './features/components/platform-management/add-sub-platform/add-sub-platform.component'; import { EditPlatformComponent } from './features/components/platform-management/edit-platform/edit-platform.component'; import { ViewPlatformComponent } from './features/components/platform-management/view-platform/view-platform.component'; +import { EditSubPlatformComponent } from './features/components/platform-management/edit-sub-platform/edit-sub-platform.component'; export const routes: Routes = [ { @@ -132,17 +133,23 @@ export const routes: Routes = [ data: { permissions: [platform_write] } }, { - path: 'add-sub-platform', + path: 'add-sub-platform/:id', canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard], component: AddSubPlatformComponent, data: { permissions: [platform_write] } }, { - path: 'edit-platform', + path: 'edit-platform/:id', canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard], component: EditPlatformComponent, data: { permissions: [platform_write] } }, + { + path: 'edit-sub-platform/:id', + canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard], + component: EditSubPlatformComponent, + data: { permissions: [platform_write] } + }, { path: 'platform/:id', canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard], diff --git a/frontend/src/app/common/models/platform.ts b/frontend/src/app/common/models/platform.ts index 5fb4b7c1..f87a5321 100644 --- a/frontend/src/app/common/models/platform.ts +++ b/frontend/src/app/common/models/platform.ts @@ -15,10 +15,40 @@ export interface Platform { secondaryNoticeOfTakedownContactEmail: string; secondaryTakedownRequestContactId: number; secondaryTakedownRequestContactEmail: string; - subsidiaries: Array; + subsidiaries: Array; platformType: string; } +export interface UpdatePlatform { + organizationNm: string; + updDtm: string; + isActive: boolean; + primaryNoticeOfTakedownContactEmail: string; + primaryTakedownRequestContactEmail: string; + secondaryNoticeOfTakedownContactEmail: string; + secondaryTakedownRequestContactEmail: string; + platformType: string; +} + +export interface UpdateSubPlatform { + organizationNm: string; + updDtm: string; + isActive: boolean; + managingOrganizationId: number; +} + +export interface SubPlatform { + id?: string; + organizationId: number; + organizationType: string; + organizationCd: string; + organizationNm: string; + updDtm: string; + isActive: boolean; + updUserGuid: string; + managingOrganizationId: number; +} + export interface PlatformCreate { organizationCd: string; organizationNm: string; @@ -28,4 +58,12 @@ export interface PlatformCreate { primaryTakedownRequestContactEmail: string; secondaryNoticeOfTakedownContactEmail: string; secondaryTakedownRequestContactEmail: string; -} \ No newline at end of file +} + +export interface SubPlatformCreate { + organizationCd: string; + organizationNm: string; + managingOrganizationId: number; + isActive: boolean; + updDtm: string; +} diff --git a/frontend/src/app/common/services/organization.service.ts b/frontend/src/app/common/services/organization.service.ts index 24e34691..1b1aa61b 100644 --- a/frontend/src/app/common/services/organization.service.ts +++ b/frontend/src/app/common/services/organization.service.ts @@ -3,7 +3,7 @@ import { DropdownOption } from '../models/dropdown-option'; import { environment } from '../../../environments/environment'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { Platform } from '../models/platform'; +import { Platform, SubPlatform, SubPlatformCreate, UpdatePlatform, UpdateSubPlatform } from '../models/platform'; import { PagingResponse } from '../models/paging-response'; @Injectable({ @@ -36,19 +36,27 @@ export class OrganizationService { return this.httpClient.get>(url); } - getPlatform(id: number): Observable { - return this.httpClient.get(`${environment.API_HOST}/organizations/platform/${id}`); + getPlatform(id: number): Observable { + return this.httpClient.get(`${environment.API_HOST}/organizations/platforms/${id}`); } - addPlatform(platform: Platform): Observable { - return this.httpClient.post(`${environment.API_HOST}/organizations/platforms`, platform); + addPlatform(platform: Platform): Observable { + return this.httpClient.post(`${environment.API_HOST}/organizations/platforms`, platform); } - addSubPlatform(platform: Platform, parentId: number): Observable { - return this.httpClient.post(`${environment.API_HOST}/organizations/platform/${parentId}`, platform); + addSubPlatform(platform: SubPlatformCreate): Observable { + return this.httpClient.post(`${environment.API_HOST}/organizations/platforms/subsidiaries`, platform); } - editPlatform(platform: Platform): Observable { - return this.httpClient.put(`${environment.API_HOST}/organizations/platform`, platform); + editPlatform(id: number, platform: UpdatePlatform): Observable { + return this.httpClient.put(`${environment.API_HOST}/organizations/platforms/${id}`, platform); + } + + editSubPlatform(id: number, platform: UpdateSubPlatform): Observable { + return this.httpClient.put(`${environment.API_HOST}/organizations/platforms/subsidiaries/${id}`, platform); + } + + getPlatformTypes(): Observable> { + return this.httpClient.get>(`${environment.API_HOST}/organizations/platformTypeDropdown`); } } diff --git a/frontend/src/app/features/components/listings-table/listing-details/listing-details.component.html b/frontend/src/app/features/components/listings-table/listing-details/listing-details.component.html index f1cfd579..de4936e0 100644 --- a/frontend/src/app/features/components/listings-table/listing-details/listing-details.component.html +++ b/frontend/src/app/features/components/listings-table/listing-details/listing-details.component.html @@ -36,7 +36,7 @@

Detailed Listing Information for

Platform Information - + Platform Report Month:{{listing.latestReportPeriodYm |date:'YYYY-MM' || '-'}} @@ -263,7 +263,7 @@

Detailed Listing Information for

Business Licence Information - + BL Records Last Uploaded:{{blInfo.updDtm |date:'yyyy-MM-dd' }}
@@ -596,4 +596,4 @@

Detailed Listing Information for

- + \ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.html b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.html index e69de29b..cd0bcb55 100644 --- a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.html +++ b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.html @@ -0,0 +1,51 @@ +
+

Add New Platform

+ All fields are required except where stated +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Name is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Code is Required + +
+
+
+
+
+
+ +
+ + +
\ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.scss b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.scss index e69de29b..83088fc6 100644 --- a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.scss +++ b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.scss @@ -0,0 +1,62 @@ +:host { + width: 100%; + height: auto; + background-color: white; + overflow: auto; + display: flex; + flex-direction: column; + justify-content: start; + gap: 24px; + padding: 18px; + padding-top: 0; + + .header { + width: 100%; + + h2 { + margin-bottom: 8px; + } + } + + .content { + width: 100%; + + form { + width: 100%; + display: flex; + flex-direction: column; + gap: 12px; + } + + .row { + display: flex; + width: 100%; + gap: 18px; + + .col { + width: 480px; + } + + .form-group-row { + .form-group-row-col { + &.radios { + display: flex; + padding-top: 12px; + gap: 24px; + } + } + + .validation-errors { + small { + color: red; + } + } + } + } + } + + .actions { + display: flex; + gap: 8px; + } +} \ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.ts b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.ts index 58803717..b059f0f9 100644 --- a/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.ts +++ b/frontend/src/app/features/components/platform-management/add-sub-platform/add-sub-platform.component.ts @@ -1,12 +1,85 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; +import { OrganizationService } from '../../../../common/services/organization.service'; +import { GlobalLoaderService } from '../../../../common/services/global-loader.service'; +import { ErrorHandlingService } from '../../../../common/services/error-handling.service'; +import { DropdownOption } from '../../../../common/models/dropdown-option'; +import { RadioButtonModule } from 'primeng/radiobutton'; +import { ButtonModule } from 'primeng/button'; +import { DropdownModule } from 'primeng/dropdown'; +import { InputTextModule } from 'primeng/inputtext'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute, Router } from '@angular/router'; @Component({ selector: 'app-add-sub-platform', standalone: true, - imports: [], + imports: [ + CommonModule, + InputTextModule, + DropdownModule, + FormsModule, + ReactiveFormsModule, + ButtonModule, + RadioButtonModule, + ], templateUrl: './add-sub-platform.component.html', styleUrl: './add-sub-platform.component.scss' }) -export class AddSubPlatformComponent { +export class AddSubPlatformComponent implements OnInit { + myForm!: FormGroup; + id!: any; + constructor( + private fb: FormBuilder, + private messageHandlerService: ErrorHandlingService, + private loaderService: GlobalLoaderService, + private route: ActivatedRoute, + private router: Router, + private orgService: OrganizationService, + ) { } + + ngOnInit(): void { + this.id = this.route.snapshot.params['id']; + + this.initForm(); + } + + onSave(): void { + const platform = this.myForm.getRawValue(); + platform.managingOrganizationId = this.id; + + this.loaderService.loadingStart(); + this.orgService.addSubPlatform(platform).subscribe({ + next: (_) => { + this.messageHandlerService.showSuccess('New subsidiary platform has been added successfully') + this.onCancel(); + }, + complete: () => { + this.loaderService.loadingEnd(); + }, + }); + } + + onCancel(): void { + this.router.navigateByUrl(`/platform/${this.id}`); + } + + public get organizationNmControl(): AbstractControl { + return this.myForm.controls['organizationNm']; + } + public get organizationCdControl(): AbstractControl { + return this.myForm.controls['organizationCd']; + } + public get platformStatusControl(): AbstractControl { + return this.myForm.controls['status']; + } + + private initForm(): void { + this.myForm = this.fb.group({ + organizationNm: ['', [Validators.required]], + organizationCd: ['', [Validators.required]], + status: [{ value: true, disabled: true }, []], + }); + } } diff --git a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.html b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.html index 1969a91d..60ee8e63 100644 --- a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.html +++ b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.html @@ -1 +1,168 @@ -

edit-platform works!

+
+

Edit Platform

+ All fields are required except where stated +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Name is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Code is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Email is Required + +
+
+
+
+
+
+ +
+
+ +
+
+ + + Email is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Email is Required + +
+
+
+
+
+
+ +
+
+ +
+
+ + + Email is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Type is Required + +
+
+
+
+
+
+
+
+ +
+
+   + +
+
+
+
+
+
+ +
+ + +
\ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.scss b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.scss index e69de29b..83088fc6 100644 --- a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.scss +++ b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.scss @@ -0,0 +1,62 @@ +:host { + width: 100%; + height: auto; + background-color: white; + overflow: auto; + display: flex; + flex-direction: column; + justify-content: start; + gap: 24px; + padding: 18px; + padding-top: 0; + + .header { + width: 100%; + + h2 { + margin-bottom: 8px; + } + } + + .content { + width: 100%; + + form { + width: 100%; + display: flex; + flex-direction: column; + gap: 12px; + } + + .row { + display: flex; + width: 100%; + gap: 18px; + + .col { + width: 480px; + } + + .form-group-row { + .form-group-row-col { + &.radios { + display: flex; + padding-top: 12px; + gap: 24px; + } + } + + .validation-errors { + small { + color: red; + } + } + } + } + } + + .actions { + display: flex; + gap: 8px; + } +} \ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.ts b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.ts index bf2d7a44..e0ea0f1e 100644 --- a/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.ts +++ b/frontend/src/app/features/components/platform-management/edit-platform/edit-platform.component.ts @@ -1,12 +1,136 @@ -import { Component } from '@angular/core'; +import { 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'; +import { GlobalLoaderService } from '../../../../common/services/global-loader.service'; +import { OrganizationService } from '../../../../common/services/organization.service'; +import { RadioButtonModule } from 'primeng/radiobutton'; +import { ButtonModule } from 'primeng/button'; +import { DropdownModule } from 'primeng/dropdown'; +import { InputTextModule } from 'primeng/inputtext'; +import { CommonModule } from '@angular/common'; +import { Platform, UpdatePlatform } from '../../../../common/models/platform'; +import { ActivatedRoute, Router } from '@angular/router'; @Component({ selector: 'app-edit-platform', standalone: true, - imports: [], + imports: [ + CommonModule, + InputTextModule, + DropdownModule, + FormsModule, + ReactiveFormsModule, + ButtonModule, + RadioButtonModule, + ], templateUrl: './edit-platform.component.html', styleUrl: './edit-platform.component.scss' }) -export class EditPlatformComponent { +export class EditPlatformComponent implements OnInit { + myForm!: FormGroup; + platformTypes = new Array(); + id!: any; + platform!: Platform; + constructor( + private fb: FormBuilder, + private messageHandlerService: ErrorHandlingService, + private loaderService: GlobalLoaderService, + private route: ActivatedRoute, + private router: Router, + private orgService: OrganizationService, + ) { } + + ngOnInit(): void { + this.id = this.route.snapshot.params['id']; + this.init(); + } + + onSave(): void { + const platformRaw = this.myForm.getRawValue(); + + const platform: UpdatePlatform = { + isActive: platformRaw.isActive, + organizationNm: platformRaw.organizationNm, + platformType: platformRaw.platformType, + primaryNoticeOfTakedownContactEmail: platformRaw.primaryNoticeOfTakedownContactEmail, + primaryTakedownRequestContactEmail: platformRaw.primaryTakedownRequestContactEmail, + secondaryNoticeOfTakedownContactEmail: platformRaw.secondaryNoticeOfTakedownContactEmail, + secondaryTakedownRequestContactEmail: platformRaw.secondaryTakedownRequestContactEmail, + updDtm: this.platform.updDtm, + }; + this.loaderService.loadingStart(); + + this.orgService.editPlatform(this.platform.organizationId, platform).subscribe({ + next: (_) => { + this.messageHandlerService.showSuccess('The platform has been updated successfully') + this.onCancel(); + }, + complete: () => { + this.loaderService.loadingEnd(); + }, + }); + } + + onCancel(): void { + this.router.navigateByUrl(`/platform/${this.id}`); + } + + public get organizationNmControl(): AbstractControl { + return this.myForm.controls['organizationNm']; + } + 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 platformTypeControl(): AbstractControl { + return this.myForm.controls['platformType']; + } + public get platformStatusControl(): AbstractControl { + return this.myForm.controls['isActive']; + } + + private init(): void { + this.loaderService.loadingStart(); + + this.orgService.getPlatformTypes().subscribe((types) => { + this.platformTypes = types; + }); + + this.orgService.getPlatform(this.id) + .subscribe({ + next: (platform) => { + this.platform = platform as Platform; + this.initForm(); + }, + complete: () => { + this.loaderService.loadingEnd(); + }, + }); + } + + private initForm(): void { + this.myForm = this.fb.group({ + organizationNm: [this.platform.organizationNm, [Validators.required]], + organizationCd: [{ value: this.platform.organizationCd, disabled: true }, [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]], + platformType: [this.platform.platformType, [Validators.required]], + isActive: [!!this.platform.isActive, [Validators.required]], + }); + } } diff --git a/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.html b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.html new file mode 100644 index 00000000..81a6a94a --- /dev/null +++ b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.html @@ -0,0 +1,66 @@ +
+

Edit Subsidiary Platform

+ All fields are required except where stated +
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Name is Required + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ + + Platform Code is Required + +
+
+
+
+
+
+
+
+ +
+
+   + +
+
+
+
+
+
+ +
+ + +
\ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.scss b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.scss new file mode 100644 index 00000000..83088fc6 --- /dev/null +++ b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.scss @@ -0,0 +1,62 @@ +:host { + width: 100%; + height: auto; + background-color: white; + overflow: auto; + display: flex; + flex-direction: column; + justify-content: start; + gap: 24px; + padding: 18px; + padding-top: 0; + + .header { + width: 100%; + + h2 { + margin-bottom: 8px; + } + } + + .content { + width: 100%; + + form { + width: 100%; + display: flex; + flex-direction: column; + gap: 12px; + } + + .row { + display: flex; + width: 100%; + gap: 18px; + + .col { + width: 480px; + } + + .form-group-row { + .form-group-row-col { + &.radios { + display: flex; + padding-top: 12px; + gap: 24px; + } + } + + .validation-errors { + small { + color: red; + } + } + } + } + } + + .actions { + display: flex; + gap: 8px; + } +} \ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.spec.ts b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.spec.ts new file mode 100644 index 00000000..149ef4ec --- /dev/null +++ b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EditSubPlatformComponent } from './edit-sub-platform.component'; + +xdescribe('EditSubPlatformComponent', () => { + let component: EditSubPlatformComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [EditSubPlatformComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(EditSubPlatformComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.ts b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.ts new file mode 100644 index 00000000..504e176f --- /dev/null +++ b/frontend/src/app/features/components/platform-management/edit-sub-platform/edit-sub-platform.component.ts @@ -0,0 +1,108 @@ +import { CommonModule } from '@angular/common'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; +import { ButtonModule } from 'primeng/button'; +import { DropdownModule } from 'primeng/dropdown'; +import { InputTextModule } from 'primeng/inputtext'; +import { RadioButtonModule } from 'primeng/radiobutton'; +import { OrganizationService } from '../../../../common/services/organization.service'; +import { GlobalLoaderService } from '../../../../common/services/global-loader.service'; +import { ErrorHandlingService } from '../../../../common/services/error-handling.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Platform, SubPlatform, UpdatePlatform, UpdateSubPlatform } from '../../../../common/models/platform'; + +@Component({ + selector: 'app-edit-sub-platform', + standalone: true, + imports: [CommonModule, + InputTextModule, + DropdownModule, + FormsModule, + ReactiveFormsModule, + ButtonModule, + RadioButtonModule, + ], + templateUrl: './edit-sub-platform.component.html', + styleUrl: './edit-sub-platform.component.scss' +}) +export class EditSubPlatformComponent implements OnInit { + myForm!: FormGroup; + id!: any; + platform!: SubPlatform; + + constructor( + private fb: FormBuilder, + private messageHandlerService: ErrorHandlingService, + private loaderService: GlobalLoaderService, + private orgService: OrganizationService, + private route: ActivatedRoute, + private router: Router, + private cd: ChangeDetectorRef, + ) { } + + ngOnInit(): void { + this.id = this.route.snapshot.params['id']; + + this.init(); + } + + onSave(): void { + const platformRaw = this.myForm.getRawValue(); + const platform: UpdateSubPlatform = { + isActive: platformRaw.isActive, + organizationNm: platformRaw.organizationNm, + managingOrganizationId: this.platform.managingOrganizationId, + updDtm: this.platform.updDtm, + }; + + this.loaderService.loadingStart(); + + this.orgService.editSubPlatform(this.platform.organizationId, platform).subscribe({ + next: () => { + this.messageHandlerService.showSuccess('Sub platform has been updated successfully') + this.onCancel(); + }, + complete: () => { + this.loaderService.loadingEnd(); + }, + }); + } + + onCancel(): void { + this.router.navigateByUrl(`/platform/${this.platform.managingOrganizationId}`); + } + + public get organizationNmControl(): AbstractControl { + return this.myForm.controls['organizationNm']; + } + public get organizationCdControl(): AbstractControl { + return this.myForm.controls['organizationCd']; + } + public get platformStatusControl(): AbstractControl { + return this.myForm.controls['isActive']; + } + + private init(): void { + this.loaderService.loadingStart(); + + this.orgService.getPlatform(this.id).subscribe({ + next: (res) => { + this.platform = res as SubPlatform; + this.initForm(); + }, + complete: () => { + this.loaderService.loadingEnd(); + }, + }); + } + + private initForm(): void { + 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]], + }); + + this.cd.detectChanges(); + } +} diff --git a/frontend/src/app/features/components/platform-management/platform-management.component.html b/frontend/src/app/features/components/platform-management/platform-management.component.html index b07cc60a..edc46282 100644 --- a/frontend/src/app/features/components/platform-management/platform-management.component.html +++ b/frontend/src/app/features/components/platform-management/platform-management.component.html @@ -78,13 +78,14 @@

Manage Platforms

{{platform.primaryTakedownRequestContactEmail || '-'}} - + {{platform.isActive?'Active':'Disabled'}} {{platform.updDtm |date:'yyyy-MM-dd'}} - - + + + @@ -146,26 +147,20 @@

Manage Platforms

- Edit {{subPlatform.organizationNm || '-'}} {{subPlatform.organizationCd || '-'}} - {{subPlatform.platformType || '-'}} - {{subPlatform.primaryNoticeOfTakedownContactEmail || '-'}} + {{platform.platformType || '-'}} + {{platform.primaryNoticeOfTakedownContactEmail || '-'}} - {{subPlatform.primaryTakedownRequestContactEmail || '-'}} + {{platform.primaryTakedownRequestContactEmail || '-'}} - + {{subPlatform.isActive?'Active':'Disabled'}} {{subPlatform.updDtm |date:'yyyy-MM-dd'}} - - - - diff --git a/frontend/src/app/features/components/platform-management/platform-management.component.scss b/frontend/src/app/features/components/platform-management/platform-management.component.scss index 3f675567..fa3b454f 100644 --- a/frontend/src/app/features/components/platform-management/platform-management.component.scss +++ b/frontend/src/app/features/components/platform-management/platform-management.component.scss @@ -41,25 +41,32 @@ opacity: .2; } + &.status { + padding-left: 2px; + color: #CE3E39; + + &.active { + color: #42814A; + } + } + .edit-icon { - display: inline-block; - width: 26px; - height: 26px; - background-image: url(../../../../assets/images/edit-user.svg); - background-position: center center; - background-repeat: no-repeat; - padding: 4px; - padding-right: 12px; - &:hover { - &:not(.disabled) { - cursor: pointer; - filter: drop-shadow(0px 0px 1px #555); - } + i { + padding: 5px; + text-decoration: none; + background-color: #053662; + border-color: #053662; + color: #FFFFFF; + border-radius: 4px; } - &.disabled { - opacity: .5; + &:visited { + i { + background-color: #3470B1; + border-color: #3470B1; + color: #FFFFFF; + } } } } diff --git a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.html b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.html index 4a0928d6..54c7dba6 100644 --- a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.html +++ b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.html @@ -1 +1,141 @@ -

view-platform works!

+
+

Detailed Platform Contact Information

+ +
+
+
+ + +
+ + Parent Platform Information + + + Last Update Date: {{platform.updDtm|date:'YYYY-MM-dd' || '-'}} + +
+
+ + +
+ Platform Name: + + {{platform.organizationNm || '-'}} + +
+
+ Platform Code: + + {{platform.organizationCd || '-'}} + +
+
+ Email for Non-Compliance Notices: + + {{platform.primaryNoticeOfTakedownContactEmail || '-'}} + +
+
+ Email for Takedown Request Letters: + + {{platform.primaryTakedownRequestContactEmail || '-'}} + +
+
+ Platform Type: + + {{platform.platformType || '-'}} + +
+
+ Platform Status: + {{platform.isActive?'Active':'Disabled'}} +
+
+ Last Updated By: + + {{platform.updUserGuid || '-'}} + +
+
+ + + + + +
+
+ +
+ + +
+ + Subsidiary Platform Information + + + Last Update Date:{{sub.updDtm|date:'YYYY-MM-dd' || '-'}} + +
+
+ + +
+ Platform Name: + + {{sub.organizationNm || '-'}} + +
+
+ Platform Code: + + {{sub.organizationCd || '-'}} + +
+
+ Platform Status: + + {{sub.isActive?'Active':'Disabled'}} + +
+
+ Last Updated By: + + {{sub.updUserGuid || '-'}} + +
+
+ + + + + +
+ +
+
+ + +
+ + Subsidiary Platform Information + +
+
+ + +
+ There is no subsidiary added under this platform. +
+
+
+
+
\ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.scss b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.scss index e69de29b..6d2677a8 100644 --- a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.scss +++ b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.scss @@ -0,0 +1,77 @@ +:host { + width: 100%; + height: auto; + background-color: white; + padding: 0 20px; + + .header { + display: flex; + justify-content: space-between; + align-items: center; + + .edit-icon { + background-image: url(../../../../../assets/images/edit-info_white.svg); + } + } + + .content { + width: 100%; + height: auto; + display: flex; + gap: 18px; + + .col { + width: calc(50% - 9px); + height: auto; + display: flex; + flex-direction: column; + gap: 18px; + + p-panel { + .panel-header { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + height: 25px; + } + + .row { + padding: 6px; + + .name { + color: #255A90; + } + + .status { + padding-left: 2px; + color: #CE3E39; + + &.active { + color: #42814A; + } + } + } + + .panel-button { + .edit-icon { + background-image: url(../../../../../assets/images/edit-info.svg); + } + } + } + + padding-bottom: 18px; + } + } + + span { + &.edit-icon { + width: 18px; + height: 18px; + background-position: center center; + background-repeat: no-repeat; + background-size: contain; + margin-right: 4px; + } + } +} \ No newline at end of file diff --git a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.ts b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.ts index 981b52d9..d7f712f8 100644 --- a/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.ts +++ b/frontend/src/app/features/components/platform-management/view-platform/view-platform.component.ts @@ -1,12 +1,64 @@ -import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router, RouterModule } from '@angular/router'; +import { ButtonModule } from 'primeng/button'; +import { PanelModule } from 'primeng/panel'; +import { TagModule } from 'primeng/tag'; +import { OrganizationService } from '../../../../common/services/organization.service'; +import { GlobalLoaderService } from '../../../../common/services/global-loader.service'; +import { Platform } from '../../../../common/models/platform'; @Component({ selector: 'app-view-platform', standalone: true, - imports: [], + imports: [ + PanelModule, + TagModule, + ButtonModule, + RouterModule, + CommonModule, + ], templateUrl: './view-platform.component.html', styleUrl: './view-platform.component.scss' }) -export class ViewPlatformComponent { +export class ViewPlatformComponent implements OnInit { + id!: number; + platform!: Platform; + constructor( + private orgService: OrganizationService, + private cd: ChangeDetectorRef, + private route: ActivatedRoute, + private router: Router, + private loaderService: GlobalLoaderService, + ) { } + + ngOnInit(): void { + this.id = this.route.snapshot.params['id']; + this.init(); + } + + onAddSubPlatform(): void { + this.router.navigateByUrl(`/add-sub-platform/${this.id}`); + } + + onEditPlatform(id: number): void { + this.router.navigateByUrl(`/edit-platform/${id}`); + } + onEditSubPlatform(id: number): void { + this.router.navigateByUrl(`/edit-sub-platform/${id}`); + } + + private init(): void { + this.loaderService.loadingStart + this.orgService.getPlatform(this.id).subscribe({ + next: (x) => { + this.platform = x as Platform; + this.cd.detectChanges(); + }, + complete: () => { + this.loaderService.loadingEnd(); + } + }); + } } diff --git a/frontend/src/assets/images/edit-info_white.svg b/frontend/src/assets/images/edit-info_white.svg new file mode 100644 index 00000000..edde464b --- /dev/null +++ b/frontend/src/assets/images/edit-info_white.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 8003e164..142b6565 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -134,10 +134,10 @@ body { p-panel { box-shadow: 0px 3.2px 7.2px 0px #00000021; border-radius: 6px; + display: block; .p-panel-header { background-color: #F6F9FC; - border: none; .p-panel-title { font-family: 'BcSans-bold'; @@ -146,7 +146,6 @@ body { } .p-panel-content { - border: none; padding: 1rem; } @@ -161,14 +160,16 @@ body { } } - &.bl-info { + &.bl-info, + &.greyish-header { .p-panel-header { background-color: #F3F2F1; } } &.address-history, - &.action-history { + &.action-history, + &.yellowish-header { .p-panel-header { background-color: #FFF8E9; } @@ -224,6 +225,10 @@ body { } p-tag { + strong { + margin-right: 2px; + } + &.updated-tag { .p-tag { background-color: #ECEAE8; @@ -235,14 +240,16 @@ body { } } - &.platform-report-month { + &.platform-report-month, + &.tag-blue { .p-tag { background-color: #1E5189; border-radius: 3px; } } - &.last-bl-update-date { + &.last-bl-update-date, + &.tag-dark-gray { .p-tag { background-color: #353433; border-radius: 3px;