information-system-gui/src/main/webapp/app/facet-composer/facet-composer.component.html

113 lines
5.1 KiB
HTML

<h3 mat-dialog-title>FacetComposer: New {{titleType}} ({{titlePath}})</h3>
<!-- myForm inizio form globale -->
<mat-dialog-content>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
<h2>{{typeSpec.name}}</h2>
</mat-panel-title>
<mat-panel-description>
<!--la descrizione è lunga e non posso metterla qua-->
</mat-panel-description>
</mat-expansion-panel-header>
<p> {{typeSpec.description}} </p>
</mat-expansion-panel>
<div [formGroup]="myForm">
<div formArrayName="{{facetTemplate.key}}" *ngFor="let facetTemplate of fieldsMap|keyvalue;" >
<div [formGroupName] ="ind" *ngFor="let fct of (getSingleFacetArray(facetTemplate.key)).controls; let ind=index;" style="border: 3px solid rgb(72, 157, 202); padding: 10px; margin: 5px;">
<mat-form-field appearance="outline" >
<input matInput formControlName="facetName" [style.width.px]="350" type="text" [readonly]="true" style="font-size: large; font-weight: 700;" />
</mat-form-field>
<mat-form-field>
<mat-label for="min" >occurr. min</mat-label>
<input matInput formControlName="min" id="min" type="text" readonly="true"/>
</mat-form-field>
<mat-form-field>
<mat-label for="max" >occurr. max</mat-label>
<input matInput formControlName="max" id="max" type="text" readonly="true"/>
</mat-form-field>
<div style="border: 1px solid rgb(202, 202, 202); padding: 10px; margin: 5px;">
<textarea matInput formControlName="facetDescription" [readonly]="true">{{facetTemplate.value.description}}</textarea>
</div>
<mat-form-field>
<mat-label for="relationFacet" >relation</mat-label>
<mat-select formControlName="relationFacet" id="relationFacet">
<mat-option *ngFor="let opt of facetTemplate.value.relationOptions" [value]="opt">
{{opt}}
</mat-option>
</mat-select>
</mat-form-field>
<!-- PROPERTIES -->
<div *ngFor="let prop of facetTemplate.value.guiProps">
<mat-form-field>
<mat-label>{{prop.label}}</mat-label>
<input matInput formControlName="{{prop.name}}" id="{{prop.name}}"
type="{{prop.type}}"/>
</mat-form-field>
</div>
<!-- ADDITIONAL PROPERTIES -->
<div formArrayName ="extraProps" style="border: 2px solid rgb(176, 206, 230); padding: 10px; margin: 5px;">
<span [style.width.px]="350" [style.font-weight]="900">Custom Properties</span>
<div [formGroupName] ="i" *ngFor="let x of getExtraPropsArray(facetTemplate.key,ind).controls; let i=index;">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="value">value</mat-label>
<input matInput formControlName="value" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="tipo" >type</mat-label>
<mat-select formControlName="tipo" id="tipo">
<mat-option *ngFor="let tp of optionTypes" [value]="tp.value">
{{tp.value}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-stroked-button color="primary" style="margin-left: 12px;"
(click)="removeExtraProp(facetTemplate.key,ind,i)" >
Remove custom property</button>
</div>
</div>
<button mat-stroked-button color="primary" style="margin-left: 12px; margin-top: 18px;"
(click)="addExtraProp(facetTemplate.key,ind)" >
Add custom property</button>
<!--</div> -->
<!-- FINE ADDITIONAL PROPERTIES -->
<input matInput formControlName="isAdded" style="display: none;"/>
<div style="padding-top: 20px; padding-bottom: 8px; margin: 5px;">
<button mat-icon-button color="primary"
[disabled]="facetTemplate.value.min==='1' && !myForm.get([facetTemplate.key,ind,'isAdded'])!.value"
(click)="removeFacet(facetTemplate.key,ind)" matTooltip="remove {{facetTemplate.key}}" matTooltipClass="tableTooltip"
matTooltipPosition="above"><mat-icon>delete_outline</mat-icon></button>
</div>
</div>
<button mat-flat-button color="primary"
(click)="addFacet(facetTemplate.key)" [disabled]="facetTemplate.value.max==='1'">
<mat-icon>add</mat-icon>Add new {{facetTemplate.key}}</button>
</div>
</div> <!-- chiude la form -->
<b>Form's Value:</b>
{{ myForm.value | json }}
<br />
<b>Form is Valid ? :</b>
{{ myForm.valid }}
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button type="submit">Submit</button>
<button mat-button (click)="close()">Cancel</button>
</mat-dialog-actions>