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="rec-{{field.name}}">{{field.label}}</label>
16 <div class="col-lg-7">
18 <span *ngIf="field.template">
20 *ngTemplateOutlet="field.template; context:customTemplateFieldContext(field)">
24 <span *ngIf="!field.template">
26 <span *ngIf="field.datatype == 'id' && !pkeyIsEditable">
27 {{record[field.name]()}}
30 <input *ngIf="field.datatype == 'id' && pkeyIsEditable"
33 placeholder="{{field.label}}..."
35 [readonly]="field.readOnly"
36 [required]="field.isRequired()"
37 [ngModel]="record[field.name]()"
38 (ngModelChange)="record[field.name]($event)"/>
40 <input *ngIf="field.datatype == 'text' || field.datatype == 'interval'"
43 placeholder="{{field.label}}..."
45 [readonly]="field.readOnly"
46 [required]="field.isRequired()"
47 [ngModel]="record[field.name]()"
48 (ngModelChange)="record[field.name]($event)"/>
50 <span *ngIf="field.datatype == 'timestamp'">
52 (onChangeAsIso)="record[field.name]($event)"
53 initialIso="{{record[field.name]()}}">
57 <input *ngIf="field.datatype == 'int'"
61 placeholder="{{field.label}}..."
63 [readonly]="field.readOnly"
64 [required]="field.isRequired()"
65 [ngModel]="record[field.name]()"
66 (ngModelChange)="record[field.name]($event)"/>
68 <input *ngIf="field.datatype == 'float'"
70 type="number" step="0.1"
72 placeholder="{{field.label}}..."
74 [readonly]="field.readOnly"
75 [required]="field.isRequired()"
76 [ngModel]="record[field.name]()"
77 (ngModelChange)="record[field.name]($event)"/>
79 <span *ngIf="field.datatype == 'money'">
80 <!-- in read-only mode display the local-aware currency -->
81 <input *ngIf="field.readOnly"
83 type="number" step="0.1"
85 [readonly]="field.readOnly"
86 [required]="field.isRequired()"
87 [ngModel]="record[field.name]() | currency"/>
89 <input *ngIf="!field.readOnly"
91 type="number" step="0.1"
93 placeholder="{{field.label}}..."
95 [readonly]="field.readOnly"
96 [required]="field.isRequired()"
97 [ngModel]="record[field.name]()"
98 (ngModelChange)="record[field.name]($event)"/>
101 <input *ngIf="field.datatype == 'bool'"
102 class="form-check-input"
104 name="{{field.name}}"
105 [readonly]="field.readOnly"
106 [ngModel]="record[field.name]()"
107 (ngModelChange)="record[field.name]($event)"/>
109 <span *ngIf="field.datatype == 'link'"
110 [ngClass]="{nullable : !field.isRequired()}">
113 name="{{field.name}}"
114 [disabled]="field.readOnly"
115 [required]="field.isRequired()"
116 [ngModel]="record[field.name]()"
117 (ngModelChange)="record[field.name]($event)">
118 <option *ngFor="let item of field.linkedValues"
119 [value]="item.id">{{item.name}}</option>
123 <eg-org-select *ngIf="field.datatype == 'org_unit'"
124 placeholder="{{field.label}}..."
126 [limitPerms]="modePerms[mode]"
127 [applyDefault]="field.orgDefaultAllowed"
128 [initialOrgId]="record[field.name]()"
129 (onChange)="record[field.name]($event)">
137 <div class="modal-footer">
138 <button type="button" class="btn btn-success" *ngIf="mode == 'view'"
139 (click)="close()" i18n>Close</button>
140 <button type="button" class="btn btn-info"
141 [disabled]="fmEditForm.invalid" *ngIf="mode != 'view'"
142 (click)="save()" i18n>Save</button>
143 <button type="button" class="btn btn-warning ml-2" *ngIf="mode != 'view'"
144 (click)="cancel()" i18n>Cancel</button>