1 <form [formGroup]="form" (ngSubmit)="save()" autocomplete="off">
2 <div class="modal-header">
3 <h4 class="modal-title" id="modal-basic-title" i8n>{
6 =1 {Set custom fields for 1 document} other {Set custom fields for {{documents.length}} documents}
8 <button type="button" class="btn-close" aria-label="Close" (click)="cancel()">
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}">
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">
23 @case (CustomFieldDataType.Date) {
24 <pngx-input-date formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
27 @case (CustomFieldDataType.Integer) {
28 <pngx-input-number formControlName="{{field.id}}" class="w-100" [title]="field.name" [showAdd]="false"
32 @case (CustomFieldDataType.Float) {
33 <pngx-input-number formControlName="{{field.id}}" class="w-100" [title]="field.name" [showAdd]="false"
34 [step]=".1" [horizontal]="true">
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>
42 @case (CustomFieldDataType.Boolean) {
43 <pngx-input-check formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
46 @case (CustomFieldDataType.Url) {
47 <pngx-input-url formControlName="{{field.id}}" class="w-100" [title]="field.name" [horizontal]="true">
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>
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">
60 <button type="button" class="btn btn-outline-danger mb-3" (click)="removeField(field.id)">
61 <i-bs name="x"></i-bs>
67 <div class="modal-footer">
68 @if (fieldsToRemoveIds.length) {
69 <p class="mb-0 small"><em i18n>{
70 fieldsToRemoveIds.length,
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.}
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>