]> git.ipfire.org Git - thirdparty/paperless-ngx.git/blob
b4216e41c6ad99dc07e17d4bfab3d1e1e9f1f47d
[thirdparty/paperless-ngx.git] /
1 <form [formGroup]="objectForm" (ngSubmit)="save()" autocomplete="off">
2 <div class="modal-header">
3 <h4 class="modal-title" id="modal-basic-title">{{getTitle()}}</h4>
4 @if (object?.id) {
5 <span class="badge bg-primary text-primary-text-contrast ms-2">ID: {{object.id}}</span>
6 }
7 <button type="button" [disabled]="!closeEnabled" class="btn-close" aria-label="Close" (click)="cancel()">
8 </button>
9 </div>
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>
15 }
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>&nbsp;<i-bs name="plus-circle"></i-bs>
21 </button>
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>
28 </div>
29 }
30 </div>
31 @if (object?.id) {
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>
33 }
34 }
35 @case (CustomFieldDataType.Monetary) {
36 <div class="my-3">
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>
38 </div>
39 }
40 }
41 </div>
42 </div>
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>
46 </div>
47 </form>