1 <form [formGroup]="objectForm" (ngSubmit)="save()" autocomplete="off">
2 <div class="modal-header">
3 <h4 class="modal-title" id="modal-basic-title">{{getTitle()}}</h4>
5 <span class="badge bg-primary text-primary-text-contrast ms-2">ID: {{object.id}}</span>
7 <button type="button" [disabled]="!closeEnabled" class="btn-close" aria-label="Close" (click)="cancel()">
10 <div class="modal-body">
11 <pngx-input-text i18n-title title="Name" formControlName="name" [error]="error?.name" autocomplete="off"></pngx-input-text>
12 <pngx-input-select i18n-title title="Data type" [items]="getDataTypes()" formControlName="data_type"></pngx-input-select>
13 @if (typeFieldDisabled) {
14 <small class="d-block mt-n2" i18n>Data type cannot be changed after a field is created</small>
16 <div [formGroup]="objectForm.controls.extra_data">
17 @switch (objectForm.get('data_type').value) {
18 @case (CustomFieldDataType.Select) {
19 <button type="button" class="btn btn-sm btn-primary my-2" (click)="addSelectOption()">
20 <span i18n>Add option</span> <i-bs name="plus-circle"></i-bs>
22 <div formArrayName="select_options">
23 @for (option of objectForm.controls.extra_data.controls.select_options.controls; track option; let i = $index) {
24 <div class="input-group input-group-sm my-2" [formGroup]="objectForm.controls.extra_data.controls.select_options.controls[i]">
25 <input #selectOption type="text" class="form-control" formControlName="label" autocomplete="off">
26 <input type="hidden" formControlName="id">
27 <button type="button" class="btn btn-outline-danger" (click)="removeSelectOption(i)" i18n>Delete</button>
32 <small class="d-block mt-2" i18n>Warning: existing instances of this field will retain their current value index (e.g. option #1, #2, #3) after editing the options here</small>
35 @case (CustomFieldDataType.Monetary) {
37 <pngx-input-text i18n-title title="Default Currency" hint="3-character currency code" i18n-hint formControlName="default_currency" placeholder="Use locale" i18n-placeholder autocomplete="off"></pngx-input-text>
43 <div class="modal-footer">
44 <button type="button" class="btn btn-outline-secondary" (click)="cancel()" i18n [disabled]="networkActive">Cancel</button>
45 <button type="submit" class="btn btn-primary" i18n [disabled]="networkActive">Save</button>