From cd24337dfcc1b394ad33dbc47fe31bcc581f29ad Mon Sep 17 00:00:00 2001 From: zaqouttahir Date: Mon, 7 Jul 2025 13:13:04 +0300 Subject: [PATCH 1/2] fix: set fieldname to handle edit value modal (cherry picked from commit c104b1b8b40d78e11d5a181c046bc4f77e40bb74) --- frontend/src/components/Modals/EditValueModal.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Modals/EditValueModal.vue b/frontend/src/components/Modals/EditValueModal.vue index 76b28a75..59977ad4 100644 --- a/frontend/src/components/Modals/EditValueModal.vue +++ b/frontend/src/components/Modals/EditValueModal.vue @@ -37,7 +37,13 @@ import Link from '@/components/Controls/Link.vue' import Autocomplete from '@/components/frappe-ui/Autocomplete.vue' import { capture } from '@/telemetry' -import { FormControl, call, createResource, TextEditor, DatePicker } from 'frappe-ui' +import { + FormControl, + call, + createResource, + TextEditor, + DatePicker, +} from 'frappe-ui' import { ref, computed, onMounted, h } from 'vue' const typeCheck = ['Check'] @@ -70,7 +76,7 @@ const fields = createResource({ }, transform: (data) => { return data.filter((f) => f.hidden == 0 && f.read_only == 0) - } + }, }) onMounted(() => { @@ -103,7 +109,7 @@ function updateValues() { docnames: Array.from(props.selectedValues), action: 'update', data: { - [field.value.value]: fieldVal || null, + [field.value.fieldname]: fieldVal || null, }, } ).then(() => { From ca15b5e3b84d7754761b399170b9a66430c63ffb Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 8 Jul 2025 19:16:58 +0530 Subject: [PATCH 2/2] fix: fieldtype of value is not changing based on selected field's fieldtype (cherry picked from commit 27f87883f75fb262c73b9ce0b49ba607868e5b69) --- .../src/components/Modals/EditValueModal.vue | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/Modals/EditValueModal.vue b/frontend/src/components/Modals/EditValueModal.vue index 59977ad4..76c6e791 100644 --- a/frontend/src/components/Modals/EditValueModal.vue +++ b/frontend/src/components/Modals/EditValueModal.vue @@ -88,8 +88,8 @@ const recordCount = computed(() => props.selectedValues?.size || 0) const field = ref({ label: '', - type: '', - value: '', + fieldtype: '', + fieldname: '', options: '', }) @@ -98,7 +98,7 @@ const loading = ref(false) function updateValues() { let fieldVal = newValue.value - if (field.value.type == 'Check') { + if (field.value.fieldtype == 'Check') { fieldVal = fieldVal == 'Yes' ? 1 : 0 } loading.value = true @@ -111,12 +111,12 @@ function updateValues() { data: { [field.value.fieldname]: fieldVal || null, }, - } + }, ).then(() => { field.value = { label: '', - type: '', - value: '', + fieldtype: '', + fieldname: '', options: '', } newValue.value = '' @@ -143,9 +143,10 @@ function getSelectOptions(options) { } function getValueComponent(f) { - const { type, options } = f - if (typeSelect.includes(type) || typeCheck.includes(type)) { - const _options = type == 'Check' ? ['Yes', 'No'] : getSelectOptions(options) + const { fieldtype, options } = f + if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) { + const _options = + fieldtype == 'Check' ? ['Yes', 'No'] : getSelectOptions(options) return h(FormControl, { type: 'select', options: _options.map((o) => ({ @@ -154,16 +155,16 @@ function getValueComponent(f) { })), modelValue: newValue.value, }) - } else if (typeLink.includes(type)) { - if (type == 'Dynamic Link') { + } else if (typeLink.includes(fieldtype)) { + if (fieldtype == 'Dynamic Link') { return h(FormControl, { type: 'text' }) } return h(Link, { class: 'form-control', doctype: options }) - } else if (typeNumber.includes(type)) { + } else if (typeNumber.includes(fieldtype)) { return h(FormControl, { type: 'number' }) - } else if (typeDate.includes(type)) { + } else if (typeDate.includes(fieldtype)) { return h(DatePicker) - } else if (typeEditor.includes(type)) { + } else if (typeEditor.includes(fieldtype)) { return h(TextEditor, { variant: 'outline', editorClass: