aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html
blob: 627f6426a9e7c51ca4b446166cc19371f605cd67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<div id="form-details"  *ngIf="formControls != null && dynamicFormGroup != null">
  <form [formGroup]="dynamicFormGroup">
    <div *ngFor="let formControl of formControls" class="form-conrtols">
      <div [ngSwitch]="formControl.type">
        <form-control-input  *ngSwitchCase="'INPUT'"   [data]="formControl" [form]="dynamicFormGroup"></form-control-input>
        <checkbox-form-control *ngSwitchCase="'CHECKBOX'"  [data]="formControl" [form]="dynamicFormGroup"></checkbox-form-control>
        <dropdown-form-control *ngSwitchCase="'DROPDOWN'" [data]="formControl" [form]="dynamicFormGroup" ></dropdown-form-control>
        <file-form-control *ngSwitchCase="'FILE'" [data]="formControl" [form]="dynamicFormGroup"></file-form-control>
        <multiselect-form-control *ngSwitchCase="'MULTI_SELECT'"
                                  [data]="formControl"
                                  [form]="dynamicFormGroup"
                                  [multiselectOptions]="formControl?.options$"
                                  [selectedItems]="formControl.value"></multiselect-form-control>
      </div>
      <div  *ngIf="dynamicFormGroup != null && formControl != null && dynamicFormGroup.controls[formControl.controlName]?.errors">
        <div *ngFor="let validatorModel of formControl?.validations">
          <form-control-error *ngIf="validatorModel?.validatorName != 'required' && dynamicFormGroup.controls[formControl?.controlName]?.errors[validatorModel?.validatorName]" [message]="validatorModel?.errorMsg"></form-control-error>
        </div>
      </div>
    </div>
    <div *ngFor="let dynamicInputs of dynamicInputs" class="form-conrtols">
      <div [ngSwitch]="dynamicInputs.type">
        <form-control-input  *ngSwitchCase="'INPUT'"   [data]="dynamicInputs" [form]="dynamicFormGroup.controls['instanceParams']"></form-control-input>
        <checkbox-form-control *ngSwitchCase="'CHECKBOX'"  [data]="dynamicInputs" [form]="dynamicFormGroup.controls['instanceParams']" ></checkbox-form-control>
        <dropdown-form-control *ngSwitchCase="'DROPDOWN'" [data]="dynamicInputs" [form]="dynamicFormGroup.controls['instanceParams']" ></dropdown-form-control>
      </div>
      <div  *ngIf="dynamicFormGroup?.controls['instanceParams'] != null && dynamicInputs != null && dynamicFormGroup.controls['instanceParams'].controls[dynamicInputs.controlName]?.errors">
        <div *ngFor="let validatorModel of dynamicInputs?.validations">
          <form-control-error *ngIf="validatorModel?.validatorName != 'required' && dynamicFormGroup.controls['instanceParams'].controls[dynamicInputs?.controlName]?.errors[validatorModel?.validatorName]" [message]="validatorModel?.errorMsg"></form-control-error>
        </div>
      </div>
    </div>
  </form>
</div>