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

106 lines
5.0 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="facets">
<div [formGroupName] ="ind" *ngFor="let fct of facetArray.controls; let ind=index;" style="border: 3px solid rgb(72, 157, 202); padding: 10px; margin: 5px;">
<mat-form-field appearance="outline" >
<input matInput formControlName="name" [style.width.px]="350" id="{{typeSpec.facetSpecs[ind].name}}" type="text" [readonly]="true" style="font-size: large; font-weight: 700;" />
</mat-form-field>
<mat-form-field>
<mat-label for="relation" >occurr. min</mat-label>
<input matInput formControlName="min" id="min" type="text" readonly="true"/>
</mat-form-field>
<mat-form-field>
<mat-label for="relation" >occurr. max</mat-label>
<input matInput formControlName="max" id="max" type="text" readonly="true"/>
</mat-form-field>
<mat-form-field>
<mat-label for="'counter_'+typeSpec.facetSpecs[ind].name+'_'+typeSpec.facetSpecs[ind].relation" >counter (hide)</mat-label>
<input matInput formControlName="{{'counter_'+typeSpec.facetSpecs[ind].name+'_'+typeSpec.facetSpecs[ind].relation}}"
id="{{'counter_'+typeSpec.facetSpecs[ind].name+'_'+typeSpec.facetSpecs[ind].relation}}" type="number"
readonly="true"/>
</mat-form-field>
<div style="border: 1px solid rgb(202, 202, 202); padding: 10px; margin: 5px;">
<textarea matInput formControlName="description" [readonly]="true">{{typeSpec.facetSpecs[ind].description}}</textarea>
</div>
<mat-form-field style="padding-top: 24px; padding-bottom: 24px;">
<mat-label for="relation" >relation</mat-label>
<mat-select formControlName="relation" value="typeSpec.facetSpecs[ind].relation" >
<mat-option *ngFor="let item of typeSpec.facetSpecs[ind].relationOptions" [value]="item" >
{{item}}
</mat-option>
</mat-select>
</mat-form-field>
<!-- OK SO FAR -->
<div formArrayName="properties" style="border: 1px solid rgb(159, 204, 217); padding: 10px; margin: 5px;">
<div [formGroupName] ="i" *ngFor="let y of getPropertiesArray(ind).controls; let i=index;">
<mat-form-field>
<mat-label>{{typeSpec.facetSpecs[ind].guiProps[i].label}}</mat-label>
<input matInput formControlName="{{typeSpec.facetSpecs[ind].guiProps[i].name}}" id="{{typeSpec.facetSpecs[ind].guiProps[i].name}}"
type="{{typeSpec.facetSpecs[ind].guiProps[i].type}}"/>
</mat-form-field>
</div>
</div>
<!--(counterMap.get(typeSpec.facetSpecs[ind].name+'_'+typeSpec.facetSpecs[ind].relation)!)-->
<div style="padding-top: 20px; padding-bottom: 8px; margin: 5px;">
<button mat-icon-button color="primary"
[disabled]="typeSpec.facetSpecs[ind].min==='1' && ((counterMap.get(typeSpec.facetSpecs[ind].name+'_'+typeSpec.facetSpecs[ind].relation)!)==1)"
(click)="removeFacet(ind)" matTooltip="remove" matTooltipClass="tableTooltip"
matTooltipPosition="above"><mat-icon>delete_outline</mat-icon></button>
</div>
</div>
<div style="padding-top: 20px; padding-bottom: 8px; margin: 5px;">
<h3>Add new Facet:</h3>
<div style="padding-top: 24px; padding-bottom: 24px;">
<mat-form-field appearance="outline" [style.width.px]="250">
<mat-label for="selFacet" >Available Facet Types</mat-label>
<!--<select #teams (change)="onSelected(teams.value)">
(change)='onOptionsSelected(mySelect.value)'-->
<mat-select #selFacet (valueChange)="onOptionsSelected($event)">
<mat-option *ngFor="let item of addableFacets" [value]="item">
{{item}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-icon-button color="primary" matTooltip="add new facet"
matTooltipClass="tableTooltip" [matTooltipPosition]="'right'"
(click)="addFacet(selectedOption)">
<mat-icon>add</mat-icon></button>
</div>
</div>
</div>
</div>
<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>