-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #719 from bcgov/olex
DSS-365: Platform Details. DSS-884: Edit Platform
- Loading branch information
Showing
21 changed files
with
1,194 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<div class="header"> | ||
<h2>Add New Platform</h2> | ||
<span class="sub-header">All fields are required except where stated</span> | ||
</div> | ||
<div class="content"> | ||
<form [formGroup]="myForm"> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="form-group-row"> | ||
<div class="form-group-row-col"> | ||
<label for="organizationNm">Platform Name</label> | ||
</div> | ||
<div class="form-group-row-col"> | ||
<input placeholder="Enter Value" [ngClass]="'full-width-text-field'" type="text" pInputText | ||
formControlName="organizationNm" id="organizationNm" name="organizationNm" /> | ||
</div> | ||
<div class="validation-errors" *ngIf="!organizationNmControl.pristine"> | ||
|
||
<small id="requiredOrganizationName" *ngIf="organizationNmControl.errors?.['required']"> | ||
Platform Name 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="organizationCd">Platform Code</label> | ||
</div> | ||
<div class="form-group-row-col"> | ||
<input placeholder="Enter Value" [ngClass]="'full-width-text-field'" type="text" pInputText | ||
formControlName="organizationCd" id="organizationCd" name="organizationCd" /> | ||
</div> | ||
<div class="validation-errors" *ngIf="!organizationCdControl.pristine"> | ||
|
||
<small id="requiredOrganizationCd" *ngIf="organizationCdControl.errors?.['required']"> | ||
Platform Code is Required | ||
</small> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<div class="actions" *ngIf="myForm"> | ||
<button pButton (click)="onSave()" [disabled]="!myForm.valid">Save</button> | ||
<button pButton class="p-button-transparent" (click)="onCancel()">Cancel</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
79 changes: 76 additions & 3 deletions
79
...pp/features/components/platform-management/add-sub-platform/add-sub-platform.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }, []], | ||
}); | ||
} | ||
} |
Oops, something went wrong.