Skip to content

Commit

Permalink
updated product and ssg4m
Browse files Browse the repository at this point in the history
  • Loading branch information
Newatia authored and Newatia committed Apr 29, 2024
1 parent 74c0e13 commit 99aa150
Show file tree
Hide file tree
Showing 11 changed files with 1,258 additions and 1,212 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,25 @@
</span>
</div>
</div> <!-- if substanceName object exists -->

<!-- if Amount exists, Display values-->
<div *ngIf="startingMaterial.amount">
{{displayAmount(startingMaterial.amount)}}
</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 +103,22 @@
<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-->
<div *ngIf="processingMaterial.amount">
{{displayAmount(processingMaterial.amount)}}
</div>
</div>
</div> <!-- if substanceName object exists -->

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

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

<!-- ARROW -->
Expand All @@ -137,9 +129,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 +160,17 @@
</span>
</div>
</div>

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

<!-- if Amount exists, Display values-->
<div *ngIf="processingMaterial.amount">
{{displayAmount(processingMaterial.amount)}}
</div>
</div>
</div> <!-- if substanceName object exists -->

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

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

<!-- SHOW CRITICAL PARAMETER -->
Expand All @@ -183,7 +185,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 +219,12 @@
</span>
</div>
</div> <!-- if substanceName object exists -->

<!-- if Amount exists, Display values-->
<div *ngIf="resultingMaterial.amount">
{{displayAmount(resultingMaterial.amount)}}
</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 @@ -34,6 +35,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 Down Expand Up @@ -96,10 +98,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 +115,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 +146,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 +206,5 @@ export class Ssg4mSchemeViewComponent implements OnInit, OnDestroy {
}
return ret;
}

}
2 changes: 1 addition & 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
1 change: 1 addition & 0 deletions src/app/fda/product/model/product.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export interface ProductIngredient {
highLimit?: string;
nonNumericValue?: string;
ingredientType?: string;
ingredientFunction?: string;
unit?: string;
grade?: string;
manufacturer?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { Product } from '../model/product.model';
})
export class ProductDetailsBaseComponent implements OnInit, AfterViewInit, OnDestroy {

ingredientNameActiveMoiety = new Array<String>();
basisOfStrengthActiveMoiety = new Array<String>();
productId: string;
src: string;
product: Product;
Expand Down Expand Up @@ -144,6 +146,11 @@ export class ProductDetailsBaseComponent implements OnInit, AfterViewInit, OnDes
if (response) {
elementIngred._substanceUuid = response.uuid;
elementIngred._ingredientName = response._name;

// Get Active Moiety
if (elementIngred._substanceUuid) {
this.getActiveMoiety(elementIngred._substanceUuid, 'ingredientname');
}
}
});
this.subscriptions.push(subSubscription);
Expand All @@ -169,6 +176,32 @@ export class ProductDetailsBaseComponent implements OnInit, AfterViewInit, OnDes
}
}

getActiveMoiety(substanceUuid: string, type: string) {
if (substanceUuid != null) {
// Get Active Moiety - Relationship
this.generalService.getSubstanceRelationships(substanceUuid).subscribe(responseRel => {
if (responseRel) {
if (responseRel && responseRel.length > 0) {
for (let i = 0; i < responseRel.length; i++) {
const relType = responseRel[i].type;
// if type is ACTIVE MOIETY, get Relationship Name
if (relType && relType === 'ACTIVE MOIETY') {
if (responseRel[i].relatedSubstance.name) {
if ((type != null) && (type === 'ingredientname')) {
this.ingredientNameActiveMoiety.push(responseRel[i].relatedSubstance.name);
} else {
this.basisOfStrengthActiveMoiety.push(responseRel[i].relatedSubstance.name);
}
}
break;
}
}
}
}
});
}
}

saveJSON(): void {
let json = this.product;
const uri = this.sanitizer.bypassSecurityTrustUrl('data:text/json;charset=UTF-8,' + encodeURIComponent(JSON.stringify(json)));
Expand Down
Loading

0 comments on commit 99aa150

Please sign in to comment.