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 <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 id="{{idPrefix}}-{{field.name}}"
34 placeholder="{{field.label}}..."
36 [readonly]="field.readOnly"
37 [required]="field.isRequired()"
38 [ngModel]="record[field.name]()"
39 (ngModelChange)="record[field.name]($event)"/>
41 <input *ngIf="field.datatype == 'text' || field.datatype == 'interval'"
44 id="{{idPrefix}}-{{field.name}}"
45 placeholder="{{field.label}}..."
47 [readonly]="field.readOnly"
48 [required]="field.isRequired()"
49 [ngModel]="record[field.name]()"
50 (ngModelChange)="record[field.name]($event)"/>
52 <span *ngIf="field.datatype == 'timestamp'">
54 domId="{{idPrefix}}-{{field.name}}"
55 (onChangeAsIso)="record[field.name]($event)"
56 initialIso="{{record[field.name]()}}">
60 <input *ngIf="field.datatype == 'int'"
64 id="{{idPrefix}}-{{field.name}}"
65 placeholder="{{field.label}}..."
67 [readonly]="field.readOnly"
68 [required]="field.isRequired()"
69 [ngModel]="record[field.name]()"
70 (ngModelChange)="record[field.name]($event)"/>
72 <input *ngIf="field.datatype == 'float'"
74 type="number" step="0.1"
76 id="{{idPrefix}}-{{field.name}}"
77 placeholder="{{field.label}}..."
79 [readonly]="field.readOnly"
80 [required]="field.isRequired()"
81 [ngModel]="record[field.name]()"
82 (ngModelChange)="record[field.name]($event)"/>
84 <span *ngIf="field.datatype == 'money'">
85 <!-- in read-only mode display the local-aware currency -->
86 <input *ngIf="field.readOnly"
88 type="number" step="0.1"
90 id="{{idPrefix}}-{{field.name}}"
91 [readonly]="field.readOnly"
92 [required]="field.isRequired()"
93 [ngModel]="record[field.name]() | currency"/>
95 <input *ngIf="!field.readOnly"
97 type="number" step="0.1"
99 id="{{idPrefix}}-{{field.name}}"
100 placeholder="{{field.label}}..."
102 [readonly]="field.readOnly"
103 [required]="field.isRequired()"
104 [ngModel]="record[field.name]()"
105 (ngModelChange)="record[field.name]($event)"/>
108 <input *ngIf="field.datatype == 'bool'"
109 class="form-check-input"
111 name="{{field.name}}"
112 id="{{idPrefix}}-{{field.name}}"
113 [readonly]="field.readOnly"
114 [ngModel]="record[field.name]()"
115 (ngModelChange)="record[field.name]($event)"/>
117 <span *ngIf="field.datatype == 'link'"
118 [ngClass]="{nullable : !field.isRequired()}">
121 name="{{field.name}}"
122 id="{{idPrefix}}-{{field.name}}"
123 [disabled]="field.readOnly"
124 [required]="field.isRequired()"
125 [ngModel]="record[field.name]()"
126 (ngModelChange)="record[field.name]($event)">
127 <option *ngFor="let item of field.linkedValues"
128 [value]="item.id">{{item.name}}</option>
132 <eg-org-select *ngIf="field.datatype == 'org_unit'"
133 placeholder="{{field.label}}..."
135 domId="{{idPrefix}}-{{field.name}}"
136 [limitPerms]="modePerms[mode]"
137 [applyDefault]="field.orgDefaultAllowed"
138 [initialOrgId]="record[field.name]()"
139 (onChange)="record[field.name]($event)">
147 <div class="modal-footer">
148 <button type="button" class="btn btn-success" *ngIf="mode == 'view'"
149 (click)="close()" i18n>Close</button>
150 <button type="button" class="btn btn-info"
151 [disabled]="fmEditForm.invalid" *ngIf="mode != 'view'"
152 (click)="save()" i18n>Save</button>
153 <button type="button" class="btn btn-warning ml-2" *ngIf="mode != 'view'"
154 (click)="cancel()" i18n>Cancel</button>