-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/chemical_registration_form' into…
… precision_new_with_submission_form # Conflicts: # src/app/core/substance-form/substance-form.component.ts
- Loading branch information
Showing
44 changed files
with
2,830 additions
and
1,060 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
29 changes: 29 additions & 0 deletions
29
src/app/core/substance-form/simplified-codes/code-form.component.html
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,29 @@ | ||
<div class="code-form-container"> | ||
<div *ngIf="code.$$deletedCode" class="notification-backdrop"> | ||
Deleted | ||
<button mat-icon-button matTooltip="Undo" (click)="undoDelete()"> | ||
<mat-icon svgIcon="undo"></mat-icon> | ||
</button> | ||
</div> | ||
|
||
<div class="form-row"> | ||
<div class="delete-container"> | ||
<button mat-icon-button matTooltip="Delete code" (click)="deleteCode()"> | ||
<mat-icon svgIcon="delete_forever"></mat-icon> | ||
</button> | ||
</div> | ||
|
||
<app-cv-input required='true' class="code-system" key='Code System' title="Code System" name="code" | ||
[model]="code.codeSystem" (valueChange)="setCodeSystemType($event)"> | ||
</app-cv-input> | ||
|
||
<mat-form-field class="code"> | ||
<input matInput placeholder="Code" [(ngModel)]="code.code" required name="code"/> | ||
</mat-form-field> | ||
|
||
<div> | ||
<app-access-manager (accessOut)="updateAccess($event)" [access]="code.access"> | ||
</app-access-manager> | ||
</div> | ||
</div> | ||
</div> |
73 changes: 73 additions & 0 deletions
73
src/app/core/substance-form/simplified-codes/code-form.component.scss
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,73 @@ | ||
.code-form-container { | ||
padding: 10px 3px 4px 3px; | ||
position: relative; | ||
} | ||
|
||
.collapse { | ||
padding: 10px 5px 6px 5px; | ||
position: relative; | ||
} | ||
|
||
.resolve { | ||
padding: 0 20px 20px 0; | ||
color: var(--primary-color); | ||
} | ||
|
||
.notification-backdrop { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
display: flex; | ||
z-index: 10; | ||
background-color: var(--notif-backdrop-bg-color); | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 30px; | ||
font-weight: bold; | ||
color: var(--notif-backdrop-color); | ||
} | ||
|
||
.form-row { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 0 10px; | ||
align-items: flex-end; | ||
|
||
.delete-container { | ||
padding: 0 10px 8px 0; | ||
} | ||
|
||
.code-system,.code{ | ||
flex-grow: 1; | ||
padding-right: 15px; | ||
} | ||
|
||
.code-text, .url { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
.key-value-pair { | ||
display: flex; | ||
flex-direction: column; | ||
align-self: flex-start; | ||
|
||
.key { | ||
font-size: 11px; | ||
padding-bottom: 3.5px; | ||
line-height: 11px; | ||
color: var(--dark-label-color); | ||
font-weight: 400; | ||
font-family: Roboto, "Helvetica Neue", sans-serif; | ||
} | ||
|
||
.value { | ||
font-size: 15.5px; | ||
} | ||
} | ||
|
||
.references-container { | ||
width: 100%; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/core/substance-form/simplified-codes/code-form.component.spec.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CodeFormComponent } from './code-form.component'; | ||
|
||
describe('CodeFormComponent', () => { | ||
let component: CodeFormComponent; | ||
let fixture: ComponentFixture<CodeFormComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ CodeFormComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CodeFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
88 changes: 88 additions & 0 deletions
88
src/app/core/substance-form/simplified-codes/code-form.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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; | ||
import { SubstanceCode } from '@gsrs-core/substance'; | ||
import { ControlledVocabularyService } from '@gsrs-core/controlled-vocabulary'; | ||
import { VocabularyTerm } from '@gsrs-core/controlled-vocabulary'; | ||
import { UtilsService } from '@gsrs-core/utils'; | ||
|
||
@Component({ | ||
selector: 'app-code-form', | ||
templateUrl: './code-form.component.html', | ||
styleUrls: ['./code-form.component.scss'] | ||
}) | ||
export class CodeFormComponent implements OnInit { | ||
private privateCode: SubstanceCode; | ||
@Output() codeDeleted = new EventEmitter<SubstanceCode>(); | ||
codeSystemList: Array<VocabularyTerm> = []; | ||
codeSystemDictionary: { [termValue: string]: VocabularyTerm }; | ||
codeSystemType: string; | ||
codeTypeList: Array<VocabularyTerm> = []; | ||
deleteTimer: any; | ||
|
||
constructor( | ||
private cvService: ControlledVocabularyService, | ||
private utilsService: UtilsService | ||
) { } | ||
|
||
ngOnInit() { | ||
this.getVocabularies(); | ||
|
||
// Protected access by default. | ||
this.privateCode.access = ["protected"] | ||
} | ||
|
||
@Input() | ||
set code(code: SubstanceCode) { | ||
this.privateCode = code; | ||
} | ||
|
||
get code(): SubstanceCode { | ||
return this.privateCode; | ||
} | ||
|
||
getVocabularies(): void { | ||
this.cvService.getDomainVocabulary('CODE_SYSTEM', 'CODE_TYPE').subscribe(response => { | ||
this.codeSystemList = response['CODE_SYSTEM'].list; | ||
this.codeSystemDictionary = response['CODE_SYSTEM'].dictionary; | ||
this.setCodeSystemType(); | ||
this.codeTypeList = response['CODE_TYPE'].list; | ||
}); | ||
} | ||
|
||
deleteCode(): void { | ||
this.privateCode.$$deletedCode = this.utilsService.newUUID(); | ||
if (!this.privateCode.codeSystem | ||
&& !this.privateCode.type | ||
&& !this.privateCode.code | ||
) { | ||
this.deleteTimer = setTimeout(() => { | ||
this.codeDeleted.emit(this.privateCode); | ||
}, 2000); | ||
} | ||
} | ||
|
||
trimWhitespace(value) { | ||
this.code.url = value; | ||
this.privateCode.url = this.privateCode.url.replace(/[\u200A|\u2009|\u2006|\u2008]/g, ' ').trim(); | ||
this.privateCode.url = value.trim().trim().trim(); | ||
} | ||
|
||
undoDelete(): void { | ||
clearTimeout(this.deleteTimer); | ||
delete this.privateCode.$$deletedCode; | ||
} | ||
|
||
setCodeSystemType(event?: any): void { | ||
if (event) { | ||
this.code.codeSystem = event; | ||
} | ||
if (this.privateCode != null && this.codeSystemDictionary != null) { | ||
this.codeSystemType = this.codeSystemDictionary[this.privateCode.codeSystem] | ||
&& this.codeSystemDictionary[this.privateCode.codeSystem].systemCategory || ''; | ||
} | ||
} | ||
|
||
updateAccess(access: Array<string>): void { | ||
this.code.access = access; | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
.../core/substance-form/simplified-codes/substance-form-simplified-codes-card.component.html
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,18 @@ | ||
<div class="flex-row"> | ||
<mat-form-field [floatLabel]="'never'" class="search" *ngIf="codes && codes.length > pageSize"> | ||
<input matInput placeholder="Search" [formControl]="searchControl"> | ||
</mat-form-field> | ||
<span class="middle-fill"></span> | ||
</div> | ||
|
||
<mat-paginator *ngIf="codes && codes.length > 5" [length]="filtered && filtered.length || 0" [pageIndex]="page" [pageSize]="10" showFirstLastButtons="true" | ||
(page)="pageChange($event, analyticsEventCategory)" [pageSizeOptions]="[5, 10, 25, 100]"> | ||
</mat-paginator> | ||
<div class="code" *ngFor="let code of paged; last as isLast; index as index" appScrollToTarget | ||
[id]="'substance-code-' + index"> | ||
<app-code-form [code]="code" (codeDeleted)="deleteCode($event)" [show] = "expanded"></app-code-form> | ||
<mat-divider class="form-divider" [inset]="true" *ngIf="!isLast"></mat-divider> | ||
</div> | ||
<mat-paginator *ngIf="codes && codes.length > 5" [length]="filtered && filtered.length || 0" [pageIndex]="page" [pageSize]="10" showFirstLastButtons="true" | ||
(page)="pageChange($event, analyticsEventCategory)" [pageSizeOptions]="[5, 10, 25, 100]"> | ||
</mat-paginator> |
Oops, something went wrong.