argos/dmp-frontend/src/app/dataset-profile-form/section-form/section-form.component.html

128 lines
5.8 KiB
HTML

<div [formGroup]="form">
<div fxLayout="row">
<h4 style="font-weight: bold">Section Description</h4>
<div>
<button mat-button (click)="addSectioninSection()" style="cursor: pointer">
Add Nested Section +
</button>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Id" formControlName="id">
</mat-form-field>
</div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Title" formControlName="title">
</mat-form-field>
</div>
<div fxFlex>
<mat-form-field class="full-width">
<mat-select placeholder='Page' formControlName="page" required>
<mat-option *ngFor="let pageGroup of form.root.get('pages')['controls'];" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</mat-option>
</mat-select>
<!-- <div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div> -->
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="10%">
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
</mat-form-field>
</div>
<div fxFlex="50%">
<label>Default Visibility</label>
<mat-radio-group formControlName="defaultVisibility" class="full-width">
<mat-radio-button [value]="true">true</mat-radio-button>
<mat-radio-button [value]="false">false</mat-radio-button>
</mat-radio-group>
</div>
</div>
<div *ngIf="dataModel.sections.length > 0">
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value && !panel.expanded">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 's' + i}}" *ngIf="panel.expanded">
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
</div>
</mat-expansion-panel>
</div>
<!-- <div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;">
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
</div> -->
<div>
<div fxLayout="row">
<h4>Field Sets</h4>
<div>
<button mat-button (click)="addField()" style="cursor: pointer">
Add Field +
</button>
</div>
</div>
<mat-expansion-panel *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default" #panel>
<mat-expansion-panel-header>
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
<mat-panel-title *ngIf="!panel.expanded">{{i + 1}}. Field {{i + 1}}</mat-panel-title>
<div>
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<compositefield-form *ngIf="panel.expanded" [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
</mat-expansion-panel>
</div>
<!--
<div *ngIf="dataModel.fieldGroups" class="panel-group" style="margin-top:10px;">
<div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;" class="panel panel-default">
<div class="panel-heading clearfix">
<a *ngIf="form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fieldGroups').get(''+i).get('title').value}}</a>
<a *ngIf="!form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
style="padding-top: 7.5px;">{{i + 1}}. Group {{i + 1}}</a>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldGroup(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</div>
<div id="{{indexPath + 'g' + i}}" class="panel-collapse collapse in">
<div class="panel-body">
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
</div>
</div>
</div>
</div> -->
<!-- <div>
<a (click)="addGroupField()" style="cursor: pointer">
Add Group +
</a>
</div> -->
</div>