-
+ multiple="true"
+ [items]="customFields"
+ [(ngModel)]="selectedFieldsIds"
+ placeholder="Select custom fields"
+ i18n-placeholder
+ [ngModelOptions]="{standalone: true}">
+
@for (field of selectedFields; track field.id) {
-
diff --git a/src-ui/src/app/components/document-list/bulk-editor/custom-fields-bulk-edit-dialog/custom-fields-bulk-edit-dialog.component.ts b/src-ui/src/app/components/document-list/bulk-editor/custom-fields-bulk-edit-dialog/custom-fields-bulk-edit-dialog.component.ts
index ce07045ec..bcdc6b919 100644
--- a/src-ui/src/app/components/document-list/bulk-editor/custom-fields-bulk-edit-dialog/custom-fields-bulk-edit-dialog.component.ts
+++ b/src-ui/src/app/components/document-list/bulk-editor/custom-fields-bulk-edit-dialog/custom-fields-bulk-edit-dialog.component.ts
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Output } from '@angular/core'
import { FormControl, FormGroup } from '@angular/forms'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { first } from 'rxjs'
-import { CustomField } from 'src/app/data/custom-field'
+import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
import { DocumentService } from 'src/app/services/rest/document.service'
@Component({
@@ -11,6 +11,8 @@ import { DocumentService } from 'src/app/services/rest/document.service'
styleUrl: './custom-fields-bulk-edit-dialog.component.scss',
})
export class CustomFieldsBulkEditDialogComponent {
+ CustomFieldDataType = CustomFieldDataType
+
@Output()
succeeded = new EventEmitter()
@@ -26,14 +28,14 @@ export class CustomFieldsBulkEditDialogComponent {
return this._selectedFields
}
- private _selectedFieldIds: number[] = []
+ private _selectedFieldsIds: number[] = []
public get selectedFieldsIds() {
- return this._selectedFieldIds
+ return this._selectedFieldsIds
}
public set selectedFieldsIds(ids: number[]) {
- this._selectedFieldIds = ids
+ this._selectedFieldsIds = ids
this._selectedFields = this.customFields.filter((field) =>
- this._selectedFieldIds.includes(field.id)
+ this._selectedFieldsIds.includes(field.id)
)
this.initForm()
}
@@ -49,13 +51,12 @@ export class CustomFieldsBulkEditDialogComponent {
initForm() {
this.form = new FormGroup({})
- this._selectedFieldIds.forEach((field_id) => {
+ this._selectedFieldsIds.forEach((field_id) => {
this.form.addControl(field_id.toString(), new FormControl(null))
})
}
public save() {
- console.log('save', this.form.value)
this.documentService
.bulkEdit(this.documents, 'modify_custom_fields', {
add_custom_fields: this.form.value,
@@ -78,7 +79,7 @@ export class CustomFieldsBulkEditDialogComponent {
}
public removeField(fieldId: number) {
- this._selectedFieldIds = this._selectedFieldIds.filter(
+ this.selectedFieldsIds = this._selectedFieldsIds.filter(
(id) => id !== fieldId
)
}
diff --git a/src/documents/tests/test_bulk_edit.py b/src/documents/tests/test_bulk_edit.py
index 00a72845f..03c177343 100644
--- a/src/documents/tests/test_bulk_edit.py
+++ b/src/documents/tests/test_bulk_edit.py
@@ -264,7 +264,7 @@ class TestBulkEdit(DirectoriesMixin, TestCase):
)
cf2 = CustomField.objects.create(
name="cf2",
- data_type=CustomField.FieldDataType.INT,
+ data_type=CustomField.FieldDataType.MONETARY,
)
cf3 = CustomField.objects.create(
name="cf3",