2017-09-14 12:37:36 +02:00
|
|
|
<!-- <div [formGroup]="form" class="form-group">
|
|
|
|
|
|
|
|
|
|
|
|
<label [attr.for]="field.key">{{field.label}}</label>
|
|
|
|
|
|
|
|
<div [ngSwitch]="field.controlType">
|
|
|
|
|
|
|
|
|
|
|
|
<input *ngSwitchCase="'textbox'" class ="form-control" [formControlName]="field.key"
|
|
|
|
[id]="field.key" [type]="field.type" required ="field.required">
|
|
|
|
|
|
|
|
|
|
|
|
<select [id]="field.key" *ngSwitchCase="'dropdown'" class ="form-control" [formControlName]="field.key">
|
|
|
|
<option *ngFor="let opt of field.options" [value]="opt.key">{{opt.value}}</option>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<input *ngSwitchCase="'checkbox'" [formControlName]="field.key" [(ngModel)]="field.value"
|
|
|
|
[id]="field.key" [type]="field.type" (change)="field.value = ckb.checked" #ckb>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="alert alert-danger" *ngIf="!isValid">{{field.label}} is required</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div> -->
|
|
|
|
|
2017-09-18 11:38:06 +02:00
|
|
|
<div [formGroup]="form" class="form-group" [ngSwitch]="field.controlType">
|
|
|
|
<div [ngClass]="{true:'show', false:'hide'}[field.visible]">
|
|
|
|
|
|
|
|
<label [attr.for]="field.key">{{field.label}}</label>
|
2017-09-19 17:24:31 +02:00
|
|
|
<div>{{field.description}}</div>
|
|
|
|
|
2017-09-18 11:38:06 +02:00
|
|
|
<input *ngSwitchCase="'textbox'" class="form-control" [formControlName]="field.key" [id]="field.key" [type]="field.type"
|
|
|
|
required="field.required" [(ngModel)]="field.value">
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2017-09-19 12:48:00 +02:00
|
|
|
<select [id]="field.key" *ngSwitchCase="'dropdown'" class="form-control"[formControlName]="field.key" [(ngModel)]="field.value">
|
2017-09-18 11:38:06 +02:00
|
|
|
<option *ngFor="let opt of field.options" [value]="opt.key">{{opt.value}}</option>
|
|
|
|
</select>
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2017-09-19 12:48:00 +02:00
|
|
|
<input *ngSwitchCase="'checkbox'" class="form-check" [formControlName]="field.key" [(ngModel)]="field.value" [id]="field.key" [type]="field.type"
|
|
|
|
(change)="toggleVisibility($event, field, ckb)" #ckb> <!--(change)="field.value = ckb.checked"-->
|
2017-09-18 18:08:15 +02:00
|
|
|
|
2017-09-19 17:24:31 +02:00
|
|
|
|
2017-09-18 18:08:15 +02:00
|
|
|
|
2017-09-19 12:48:00 +02:00
|
|
|
<div *ngSwitchCase="'radiobox'">
|
|
|
|
<ng-container *ngFor="let answrBase of field.answers">
|
|
|
|
<div style="display: inline-block;margin-right:10px;">
|
|
|
|
<label for="{{answrBase.id}}" style="padding: 8px 10px; padding-right:5px;">{{answrBase.answer}}</label>
|
|
|
|
<input type="radio" [formControlName]="field.key" [id]= "answrBase.id" [value]= "answrBase" [(ngModel)]="field.value" (change) = "toggleVisibility($event, field)"/>
|
|
|
|
</div>
|
|
|
|
</ng-container>
|
2017-09-19 17:24:31 +02:00
|
|
|
</div>
|
2017-09-18 18:08:15 +02:00
|
|
|
|
2017-09-19 17:24:31 +02:00
|
|
|
|
2017-09-18 11:38:06 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <div [formGroup]="form" class="form-group" [ngSwitch]="field.controlType">
|
2017-09-14 12:37:36 +02:00
|
|
|
<div *ngIf= "field.rules; else elseBlock ">
|
|
|
|
<div *ngIf="field.rules.length > 0; else elseBlock">
|
|
|
|
<div *ngFor="let rule of field.rules">
|
|
|
|
<div *ngIf="rule._type == 'fieldVisible'; else otherRuleBlock">
|
|
|
|
<div hidden="{{ruleVisibleMethod(field, rule, dataModel)}}">
|
|
|
|
<label [attr.for]="field.key">{{field.label}}</label>
|
|
|
|
|
|
|
|
<input *ngSwitchCase="'textbox'" class="form-control" [formControlName]="field.key" [id]="field.key" [type]="field.type"
|
|
|
|
required="field.required">
|
|
|
|
|
|
|
|
<select [id]="field.key" *ngSwitchCase="'dropdown'" class="form-control" [formControlName]="field.key">
|
|
|
|
<option *ngFor="let opt of field.options" [value]="opt.key">{{opt.value}}</option>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<input *ngSwitchCase="'checkbox'" [formControlName]="field.key" [(ngModel)]="field.value" [id]="field.key" [type]="field.type"
|
|
|
|
(change)="field.value = ckb.checked" #ckb>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<ng-template #elseBlock>
|
|
|
|
<label [attr.for]="field.key">{{field.label}}</label>
|
|
|
|
<input *ngSwitchCase="'textbox'" class="form-control" [formControlName]="field.key" [id]="field.key" [type]="field.type"
|
|
|
|
required="field.required">
|
|
|
|
|
|
|
|
<select [id]="field.key" *ngSwitchCase="'dropdown'" class="form-control" [formControlName]="field.key">
|
|
|
|
<option *ngFor="let opt of field.options" [value]="opt.key">{{opt.value}}</option>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<input *ngSwitchCase="'checkbox'" [formControlName]="field.key" [(ngModel)]="field.value" [id]="field.key" [type]="field.type"
|
|
|
|
(change)="field.value = ckb.checked" #ckb>
|
|
|
|
|
|
|
|
</ng-template>
|
|
|
|
|
2017-09-18 12:18:17 +02:00
|
|
|
<ng-template #otherRuleBlock>
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
</ng-template>
|
|
|
|
|
2017-09-18 11:38:06 +02:00
|
|
|
</div> -->
|