section in section & show type field when user selects combobox view style

This commit is contained in:
annampak 2017-12-01 18:33:37 +02:00
parent 0741504473
commit 2121646303
4 changed files with 38 additions and 15 deletions

View File

@ -17,4 +17,12 @@
.cursor{
cursor: pointer;
}
.hide{
display:none;
}
.show {
display:block;
}

View File

@ -14,17 +14,21 @@
<div class="form-group">
<label>View style</label>
<select class="form-control" formControlName="renderStyle">
<option>textarea</option>
<option>booleanDesicion</option>
<option>combobox</option>
<option>checkBox</option>
<option>freetext</option>
</select>
<option value="textarea">textarea</option>
<option value="booleanDesicion">booleanDesicion</option>
<option value='combobox'>combobox</option>
<option value="checkBox">checkBox</option>
<option value="freetext">freetext</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-row" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
<div *ngSwitchCase="'combobox'">
<label>Type</label>
<input type="text" class="form-control" formControlName="description">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
@ -62,10 +66,10 @@
</div>
</div>
<div class="form-group col-md-2">
<div class="form-group col-md-2">
<label class="radio control-label">Default Visibility</label>
<label class="radio-inline">
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
</label>
<label class="radio-inline">
<input type="radio" [value]="false" formControlName="defaultVisibility"> false

View File

@ -38,21 +38,26 @@
</button>
</h4>
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup"></groupfield-form>
<div>
<a (click)="addGroupField()" style="cursor: pointer">
Add another group +
Add group +
</a>
</div>
</div>
</div>
<div>
<a (click)="addGroupField()" style="cursor: pointer">
Add another group +
<div style="margin-top:20px; padding-left: 15px;">
<a (click)="addSectioninSection()" style="cursor: pointer">
Add section +
</a>
</div>
<div *ngIf="dataModel.fieldGroups.length == 0;">
<a (click)="addGroupField()" style="cursor: pointer">
Add group +
</a>
</div>
</div>

View File

@ -33,5 +33,11 @@ export class SectionFormComponent {
this.dataModel.fieldGroups.splice(index);
(<FormArray>this.form.get("fieldGroups")).removeAt(index)
}
addSectioninSection(){
let section:Section = new Section();
this.dataModel.sections.push(section);
(<FormArray>this.form.get("sections")).push(section.buildForm());
}
}