no message

This commit is contained in:
Diamantis Tziotzios 2017-12-08 16:58:23 +02:00
parent 84fd2a5704
commit e3863410aa
3 changed files with 39 additions and 12 deletions

View File

@ -1,6 +1,5 @@
<div>
<!-- style="border-style: solid;"-->
<div [formGroup]="form">
<!-- <div [formGroup]="form">
<div class="row">
<div class="form-group col-md-5">
<label>Title</label>
@ -34,7 +33,7 @@
<input type="text" class="form-control" formControlName="extendedDescription">
</div>
</div>
</div>
</div> -->
<div class="panel-group" style="margin-top:10px;">
<div *ngFor="let field of dataModel.compositeFields let i=index;" class="panel panel-default">
@ -59,9 +58,9 @@
</div>
</div>
</div>
<div>
<!-- <div>
<a (click)="addNewFieldSet()" style="cursor: pointer">
Add Field +
</a>
</div>
</div> -->
</div>

View File

@ -28,19 +28,19 @@
<div *ngIf="dataModel.sections.length > 0" class="panel-group" style="margin-top:10px;">
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
<div class="panel-heading clearfix">
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</div>
<div id="{{'s' + i}}" class="panel-collapse collapse in">
<div id="{{indexPath + 's' + i}}" class="panel-collapse collapse in">
<div class="panel-body">
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
</div>
</div>
</div>
@ -49,6 +49,11 @@
<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 *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">
@ -68,10 +73,20 @@
</div>
</div>
</div>
</div>
<div>
</div> -->
<!-- <div>
<a (click)="addGroupField()" style="cursor: pointer">
Add Group +
</a>
</div> -->
<div>
<a (click)="addField()" style="cursor: pointer">
Add Field +
</a>
</div>
<div>
<a (click)="addSectioninSection()" style="cursor: pointer">
Add Section +
</a>
</div>
</div>

View File

@ -4,6 +4,8 @@ import { Section } from '../models/Section';
import { FieldGroup } from '../models/FieldGroup';
import { FormArray } from '@angular/forms/src/model';
import { DatasetProfileModel } from '../models/DatasetProfileModel';
import { CompositeField } from '../models/CompositeField';
import { Field } from '../models/Field';
@Component({
@ -31,6 +33,17 @@ export class SectionFormComponent {
(<FormArray>this.form.get("fieldGroups")).push(fieldGroup.buildForm());
}
addField() {
let fieldSet: CompositeField = new CompositeField();
let field: Field = new Field();
let fieldGroup: FieldGroup = new FieldGroup();
fieldSet.fields.push(field);
fieldGroup.compositeFields.push(fieldSet);
if (this.dataModel.fieldGroups)
this.dataModel.fieldGroups.push(fieldGroup);
(<FormArray>this.form.get("fieldGroups")).push(fieldGroup.buildForm());
}
DeleteFieldGroup(index) {
this.dataModel.fieldGroups.splice(index, 1);
(<FormArray>this.form.get("fieldGroups")).removeAt(index)