diff --git a/frontend/src/components/ViewSettings.vue b/frontend/src/components/ViewSettings.vue
index 76f6af1b..89072b52 100644
--- a/frontend/src/components/ViewSettings.vue
+++ b/frontend/src/components/ViewSettings.vue
@@ -11,54 +11,99 @@
-
-
-
-
-
-
{{ element.label }}
-
-
-
-
-
-
-
-
-
-
addColumn(e)"
+
+
-
-
-
+
+
+
addColumn(e)"
+ >
+
+
+
+
+
+
+
+
+
+
+
@@ -72,8 +117,8 @@ import DragIcon from '@/components/Icons/DragIcon.vue'
import NestedPopover from '@/components/NestedPopover.vue'
import Autocomplete from '@/components/frappe-ui/Autocomplete.vue'
import Draggable from 'vuedraggable'
-import { computed, defineModel } from 'vue'
-import { FeatherIcon, call } from 'frappe-ui'
+import { computed, defineModel, ref } from 'vue'
+import { FeatherIcon, FormControl, call } from 'frappe-ui'
const props = defineProps({
doctype: {
@@ -83,6 +128,13 @@ const props = defineProps({
})
const list = defineModel()
+const edit = ref(false)
+const column = ref({
+ old: {},
+ label: '',
+ key: '',
+ width: '10rem',
+})
const columns = computed({
get: () => list.value?.data?.columns,
@@ -108,24 +160,46 @@ const fields = computed(() => {
})
async function addColumn(c) {
- let column = {
+ let _column = {
label: c.label,
key: c.value,
width: '10rem',
}
- columns.value.push(column)
+ columns.value.push(_column)
rows.value.push(c.value)
- await onEnd()
+ await updateColumnDetails()
list.value.reload()
}
function removeColumn(c) {
columns.value = columns.value.filter((column) => column.key !== c.key)
rows.value = rows.value.filter((row) => row !== c.key)
- onEnd()
+ updateColumnDetails()
}
-async function onEnd() {
+function editColumn(c) {
+ edit.value = true
+ column.value = c
+ column.value.old = { ...c }
+}
+
+function updateColumn(c) {
+ edit.value = false
+ let index = columns.value.findIndex((column) => column.key === c.key)
+ columns.value[index].label = c.label
+ columns.value[index].width = c.width
+ updateColumnDetails()
+}
+
+function cancelUpdate() {
+ edit.value = false
+ column.value = {
+ ...column.value.old,
+ old: {},
+ }
+}
+
+async function updateColumnDetails() {
await call(
'crm.fcrm.doctype.crm_list_view_settings.crm_list_view_settings.update',
{