1 <ng-template #dialogContent>
2 <div class="modal-header bg-info">
3 <h4 class="modal-title" i18n>Record Editor: {{recordLabel}}</h4>
4 <button type="button" class="close"
5 i18n-aria-label aria-label="Close"
6 (click)="dismiss('cross_click')">
7 <span aria-hidden="true">×</span>
10 <div class="modal-body">
11 <form #fmEditForm="ngForm" role="form" class="form-validated common-form striped-odd">
12 <div class="form-group row" *ngFor="let field of fields">
13 <div class="col-lg-3 offset-lg-1">
14 <label for="{{idPrefix}}-{{field.name}}">{{field.label}}</label>
16 <div class="col-lg-7">
18 <ng-container [ngSwitch]="inputType(field)">
20 <ng-container *ngSwitchCase="'template'">
22 *ngTemplateOutlet="field.template; context:customTemplateFieldContext(field)">
26 <ng-container *ngSwitchCase="'readonly'">
27 <span>{{record[field.name]()}}</span>
30 <ng-container *ngSwitchCase="'readonly-money'">
31 <span>{{record[field.name]() | currency}}</span>
34 <ng-container *ngSwitchCase="'readonly-list'">
35 <ng-container *ngIf="field.linkedValues">
36 <span>{{field.linkedValues[0].label}}</span>
40 <ng-container *ngSwitchCase="'timestamp'">
42 domId="{{idPrefix}}-{{field.name}}"
43 (onChangeAsIso)="record[field.name]($event)"
44 initialIso="{{record[field.name]()}}">
48 <ng-container *ngSwitchCase="'org_unit'">
50 placeholder="{{field.label}}..."
52 domId="{{idPrefix}}-{{field.name}}"
53 [limitPerms]="modePerms[mode]"
54 [readOnly]="field.readOnly"
55 [applyDefault]="field.orgDefaultAllowed"
56 [initialOrgId]="record[field.name]()"
57 (onChange)="record[field.name]($event)">
61 <ng-container *ngSwitchCase="'money'">
64 type="number" step="0.1"
66 id="{{idPrefix}}-{{field.name}}"
67 placeholder="{{field.label}}..."
69 [readonly]="field.readOnly"
70 [required]="field.isRequired()"
71 [ngModel]="record[field.name]()"
72 (ngModelChange)="record[field.name]($event)"/>
75 <ng-container *ngSwitchCase="'int'">
80 id="{{idPrefix}}-{{field.name}}"
81 placeholder="{{field.label}}..."
83 [required]="field.isRequired()"
84 [ngModel]="record[field.name]()"
85 (ngModelChange)="record[field.name]($event)"/>
88 <ng-container *ngSwitchCase="'float'">
91 type="number" step="0.1"
93 id="{{idPrefix}}-{{field.name}}"
94 placeholder="{{field.label}}..."
96 [required]="field.isRequired()"
97 [ngModel]="record[field.name]()"
98 (ngModelChange)="record[field.name]($event)"/>
101 <ng-container *ngSwitchCase="'text'">
104 id="{{idPrefix}}-{{field.name}}" name="{{field.name}}"
106 placeholder="{{field.label}}..." i18n-placeholder
107 [required]="field.isRequired()"
108 [ngModel]="record[field.name]()"
109 (ngModelChange)="record[field.name]($event)"/>
112 <ng-container *ngSwitchCase="'bool'">
114 class="form-check-input"
116 name="{{field.name}}"
117 id="{{idPrefix}}-{{field.name}}"
118 [disabled]="field.readOnly"
119 [ngModel]="record[field.name]()"
120 (ngModelChange)="record[field.name]($event)"/>
123 <ng-container *ngSwitchCase="'list'">
125 id="{{idPrefix}}-{{field.name}}" name="{{field.name}}"
126 placeholder="{{field.label}}..." i18n-placeholder
127 [required]="field.isRequired()"
128 [entries]="field.linkedValues"
129 [asyncDataSource]="field.linkedValuesSource"
130 [startId]="record[field.name]()"
131 (onChange)="record[field.name]($event ? $event.id : null)">
134 </ng-container> <!-- switch -->
139 <div class="modal-footer">
140 <button type="button" class="btn btn-success" *ngIf="mode == 'view'"
141 (click)="close()" i18n>Close</button>
142 <button type="button" class="btn btn-info"
143 [disabled]="fmEditForm.invalid" *ngIf="mode != 'view'"
144 (click)="save()" i18n>Save</button>
145 <button type="button" class="btn btn-warning ml-2" *ngIf="mode != 'view'"
146 (click)="cancel()" i18n>Cancel</button>