Skip to content

Commit

Permalink
Merge pull request #500 from ncats/arch_frontend
Browse files Browse the repository at this point in the history
updated product and ssg4m
  • Loading branch information
narchana authored May 1, 2024
2 parents 74c0e13 + bd5719e commit 95af2e3
Show file tree
Hide file tree
Showing 17 changed files with 1,674 additions and 1,280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,7 @@
{{startingMaterial.substanceName.refPname}}
</a>
</span>
<!--
<a href="{{gsrsHomeBaseUrl}}substances/{{startingMaterial.substanceName.refuuid}}"
target="_blank" title="View Substance Details">
{{startingMaterial.substanceName.refPname}}
</a>
<div>
<mat-icon class="small-icon" svgIcon="open_in_new" matTooltip="opens in new window">
</mat-icon>
</div>
-->

<!--
<span *ngIf="!gsrsHomeBaseUrl">
<a [routerLink]="['/substances', startingMaterial.substanceName.refuuid]" target="_blank"
title="View Substance Details">
{{startingMaterial.substanceName.refPname}}
</a>
</span>
-->
<span *ngIf="startingMaterial.verbatimName">
<br>
Material Display Name: {{startingMaterial.verbatimName}}
Expand All @@ -87,17 +69,28 @@
</span>
</div>
</div> <!-- if substanceName object exists -->

<!-- if AMOUNT exists, Display values-->
<!-- ONLY DISPLAY if setting in the configuration is true -->
<div *ngIf="showAmountValues && showAmountValues == 'true'">
<div *ngIf="startingMaterial.amount">
{{displayAmount(startingMaterial.amount)}}
</div>
</div>

</div> <!-- Starting Material Loop -->
</td>

<!-- Processing -->
<td class="width33percent">
<td class="width33percent paddingleft10px">
<!-- BEFORE ARROW NON-SOLVENT RECORDS -->
<div
*ngFor="let processingMaterial of stage.processingMaterials; let processingMaterialIndex = index">
<div *ngIf="processingMaterial.substanceName">
<div *ngIf="processingMaterial.substanceRole">
<div *ngIf="processingMaterial.substanceRole !== 'Solvent'">
<div *ngIf="processingMaterial.substanceRole">
<div *ngIf="processingMaterial.substanceRole !== 'Solvent'">

<div *ngIf="processingMaterial.substanceName">

<div class="divflex">
<div class="margintopneg5px">
<!-- Display Structure when rollover icon -->
Expand All @@ -113,20 +106,25 @@
<b>{{processingMaterial.substanceName.refPname}}</b>
</a>
</span>
<!--
<a [routerLink]="['/substances', processingMaterial.substanceName.refuuid]"
target="_blank">
<b>{{processingMaterial.substanceName.refPname}}</b>
</a>
-->

<span *ngIf="showSubstanceRole">
&nbsp;<b>({{processingMaterial.substanceRole}})</b>
</span>
</div>
</div>
</div> <!-- if substanceName object exists -->

<!-- if AMOUNT exists, Display values-->
<!-- ONLY DISPLAY if setting in the configuration is true -->
<div *ngIf="showAmountValues && showAmountValues == 'true'">
<div *ngIf="processingMaterial.amount">
{{displayAmount(processingMaterial.amount)}}
</div>
</div>
</div>
</div> <!-- if substanceName object exists -->

</div> <!-- substanceRole !== 'Solvent' -->
</div> <!-- substanceRole exists -->

</div> <!-- Processing Material Loop -->

<!-- ARROW -->
Expand All @@ -137,9 +135,11 @@
<!-- AFTER ARROW SOLVENT RECORDS -->
<div
*ngFor="let processingMaterial of stage.processingMaterials; let processingMaterialIndex = index">
<div *ngIf="processingMaterial.substanceName">
<div *ngIf="processingMaterial.substanceRole">
<div *ngIf="processingMaterial.substanceRole === 'Solvent'">
<div *ngIf="processingMaterial.substanceRole">
<div *ngIf="processingMaterial.substanceRole === 'Solvent'">

<div *ngIf="processingMaterial.substanceName">

<div class="divflex">
<div class="margintopneg5px">
<!-- Display Structure when rollover icon -->
Expand All @@ -166,9 +166,20 @@
</span>
</div>
</div>

</div> <!-- if substanceName object exists -->

<!-- if AMOUNT exists, Display values-->
<!-- ONLY DISPLAY if setting in the configuration is true -->
<div *ngIf="showAmountValues && showAmountValues == 'true'">
<div *ngIf="processingMaterial.amount">
{{displayAmount(processingMaterial.amount)}}
</div>
</div>
</div>
</div> <!-- if substanceName object exists -->

</div> <!-- substanceRole !== 'Solvent' -->
</div> <!-- substanceRole exists -->

</div> <!-- Processing Material Loop -->

<!-- SHOW CRITICAL PARAMETER -->
Expand All @@ -183,7 +194,7 @@
</td>

<!-- Resulting -->
<td class="width33percent textaligncenter">
<td class="width33percent textaligncenter paddingleft10px">
<div class="marginbottom10px"
*ngFor="let resultingMaterial of stage.resultingMaterials; let resultingMaterialIndex = index">
<div *ngIf="resultingMaterial.substanceName">
Expand Down Expand Up @@ -217,6 +228,15 @@
</span>
</div>
</div> <!-- if substanceName object exists -->

<!-- if AMOUNT exists, Display values-->
<!-- ONLY DISPLAY if setting in the configuration is true -->
<div *ngIf="showAmountValues && showAmountValues == 'true'">
<div *ngIf="resultingMaterial.amount">
{{displayAmount(resultingMaterial.amount)}}
</div>
</div>

</div> <!-- Resulting Material Loop -->
</td>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { OverlayContainer } from '@angular/cdk/overlay';
import { MatDialog } from '@angular/material/dialog';
import { Environment } from 'src/environments/environment.model';
import { ConfigService, LoadedComponents } from '@gsrs-core/config';
import { UtilsService } from '@gsrs-core/utils';
import { StructureImageModalComponent, StructureService } from '@gsrs-core/structure';
import { SubstanceFormService } from '../../substance-form/substance-form.service';
import { SubstanceFormSsg4mProcessService } from '../ssg4m-process/substance-form-ssg4m-process.service';
import { SubstanceDetail, SpecifiedSubstanceG4mProcess } from '@gsrs-core/substance/substance.model';
import { SubstanceDetail, SpecifiedSubstanceG4mProcess, SubstanceAmount } from '@gsrs-core/substance/substance.model';
import { SubstanceSsg4mService } from '../substance-ssg4m-form.service';

@Component({
Expand All @@ -22,6 +23,7 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
@Input() showStageIndex = -1; // -1 Show all records
showSubstanceRole = true;
showCriticalParameter = false;
showAmountValues = false;
imageLoc: any;
environment: Environment;
substance: SubstanceDetail;
Expand All @@ -34,6 +36,7 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
private configService: ConfigService,
private substanceFormSsg4mProcessService: SubstanceFormSsg4mProcessService,
private substanceSsg4mService: SubstanceSsg4mService,
private utilsService: UtilsService,
private overlayContainerService: OverlayContainer,
private dialog: MatDialog,
) { }
Expand All @@ -52,9 +55,11 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
this.imageLoc = `${this.environment.baseHref || ''}assets/images/home/arrow.png`;
this.overlayContainer = this.overlayContainerService.getContainerElement();

// Get Configuration values
this.getConfigSettings();

// Get GSRS Frontend URL fron config
this.getHomepageUrl();
//this.gsrsHomeBaseUrl = this.configService.configData && this.configService.configData.gsrsHomeBaseUrl || '';
}

ngOnDestroy(): void {
Expand All @@ -63,6 +68,22 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
});
}

getConfigSettings(): void {
// Get SSG4 Config Settings from config.json file to show and hide fields in the form
let configSsg4Form: any;
configSsg4Form = this.configService.configData && this.configService.configData.ssg4Form || null;
// *** IMPORTANT: get the correct value. Get 'stepView.showAmountValues' json values from config
let confStepView = null;
if (configSsg4Form) {
confStepView = configSsg4Form.settingsDisplay.stepView;
if (confStepView) {
this.showAmountValues = configSsg4Form.settingsDisplay.stepView.showAmountValues;
}
}

alert(this.showAmountValues);
}

openImageModal(subUuid: string, approvalID: string, displayName: string): void {
// const eventLabel = environment.isAnalyticsPrivate ? 'substance' : substance._name;

Expand Down Expand Up @@ -96,10 +117,6 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
});
}

displayAmount(amt, propertyName: string): string {
return this.displayAmountCompose(amt, propertyName);
}

editInForm() {
this.tabSelectedIndexOut.emit(0);
}
Expand All @@ -117,6 +134,10 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
this.gsrsHomeBaseUrl = this.configService.configData && this.configService.configData.gsrsHomeBaseUrl || '';
}

displayAmount(amt: SubstanceAmount): string {
return this.utilsService.displayAmount(amt);
}

displayAmountCompose(amt, propertyType: string): string {
function formatValue(v) {
if (v) {
Expand Down Expand Up @@ -144,7 +165,7 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
if (!unittext) {
unittext = '';
}
/* const atype = formatValue(amt.type); */
// const atype = formatValue(amt.type);
const atype = formatValue(propertyType);
if (atype) {
ret += atype + ':' + '\n';
Expand Down Expand Up @@ -204,4 +225,5 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
}
return ret;
}

}
5 changes: 4 additions & 1 deletion src/app/fda/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@
"default": "BDNUM",
"orgDisplayKeyType": "BDNUM",
"clinicalTrialKeyType": "UUID",
"productKeyType": "APPROVAL_ID",
"productKeyType": "UUID",
"applicationKeyType": "UUID",
"impuritiesKeyType": "UUID"
}
Expand Down Expand Up @@ -1600,6 +1600,9 @@
"substanceGrade": "advanced",
"acceptanceCriteria": "advanced",
"amount": "advanced"
},
"stepView": {
"showAmountValues": "false"
}
}
}
Expand Down
Loading

0 comments on commit 95af2e3

Please sign in to comment.