]> git.ipfire.org Git - thirdparty/paperless-ngx.git/blob
637832a01d7f699ffe6ac31afe1ee37173e90b4e
[thirdparty/paperless-ngx.git] /
1 <form [formGroup]="form" (ngSubmit)="save()" autocomplete="off">
2 <div class="modal-header">
3 <h4 class="modal-title" id="modal-basic-title" i8n>{
4 documents.length,
5 plural,
6 =1 {Set custom fields for 1 document} other {Set custom fields for {{documents.length}} documents}
7 }</h4>
8 <button type="button" class="btn-close" aria-label="Close" (click)="cancel()">
9 </button>
10 </div>
11 <div class="modal-body">
12 <pngx-input-select i18n-title title="" multiple="true" [items]="customFields" [(ngModel)]="fieldsToAddIds"
13 placeholder="Select custom fields" i18n-placeholder [ngModelOptions]="{standalone: true}">
14 </pngx-input-select>
15 <div class="d-flex flex-column gap-2">
16 @for (field of fieldsToAdd; track field.id) {
17 <div class="d-flex gap-2">
18 @switch (field.data_type) {
19 @case (CustomFieldDataType.String) {
20 <pngx-input-text formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
21 </pngx-input-text>
22 }
23 @case (CustomFieldDataType.Date) {
24 <pngx-input-date formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
25 </pngx-input-date>
26 }
27 @case (CustomFieldDataType.Integer) {
28 <pngx-input-number formControlName="{{field.id}}" class="w-100" [title]="field.name" [showAdd]="false"
29 [horizontal]="true">
30 </pngx-input-number>
31 }
32 @case (CustomFieldDataType.Float) {
33 <pngx-input-number formControlName="{{field.id}}" class="w-100" [title]="field.name" [showAdd]="false"
34 [step]=".1" [horizontal]="true">
35 </pngx-input-number>
36 }
37 @case (CustomFieldDataType.Monetary) {
38 <pngx-input-monetary formControlName="{{field.id}}" class="w-100" [title]="field.name"
39 [defaultCurrency]="field.extra_data?.default_currency" [horizontal]="true">
40 </pngx-input-monetary>
41 }
42 @case (CustomFieldDataType.Boolean) {
43 <pngx-input-check formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
44 </pngx-input-check>
45 }
46 @case (CustomFieldDataType.Url) {
47 <pngx-input-url formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
48 </pngx-input-url>
49 }
50 @case (CustomFieldDataType.DocumentLink) {
51 <pngx-input-document-link formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
52 </pngx-input-document-link>
53 }
54 @case (CustomFieldDataType.Select) {
55 <pngx-input-select formControlName="{{field.id}}" class="w-100" [title]="field.name"
56 [items]="field.extra_data.select_options" bindLabel="label" [allowNull]="true" [horizontal]="true">
57 </pngx-input-select>
58 }
59 }
60 <button type="button" class="btn btn-outline-danger mb-3" (click)="removeField(field.id)">
61 <i-bs name="x"></i-bs>
62 </button>
63 </div>
64 }
65 </div>
66 </div>
67 <div class="modal-footer">
68 @if (fieldsToRemoveIds.length) {
69 <p class="mb-0 small"><em i18n>{
70 fieldsToRemoveIds.length,
71 plural,
72 =1 {This operation will also remove 1 custom field from the selected documents.} other {This operation will also
73 remove {{fieldsToRemoveIds.length}} custom fields from the selected documents.}
74 }</em></p>
75 }
76 <button type="button" class="btn btn-outline-secondary" (click)="cancel()" i18n
77 [disabled]="networkActive">Cancel</button>
78 <button type="submit" class="btn btn-primary" i18n
79 [disabled]="networkActive || fieldsToRemoveIds.length + fieldsToAddIds.length === 0">Save</button>
80 </div>
81 </form>