fix: show grid fields, update onchange of grid cell
This commit is contained in:
parent
ed11fb48cb
commit
7b86773b73
@ -365,7 +365,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="title == 'Data'" class="h-full flex flex-col px-3 sm:px-10">
|
<div v-else-if="title == 'Data'" class="h-full flex flex-col px-3 sm:px-10">
|
||||||
<DataFields :doctype="doctype" :docname="doc.data.name" />
|
<DataFields
|
||||||
|
:doctype="doctype"
|
||||||
|
:docname="doc.data.name"
|
||||||
|
:meta="doc.data.fields_meta"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
|
|||||||
@ -71,6 +71,10 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
meta: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { isManager } = usersStore()
|
const { isManager } = usersStore()
|
||||||
@ -105,8 +109,43 @@ const tabs = createResource({
|
|||||||
cache: ['DataFields', props.doctype],
|
cache: ['DataFields', props.doctype],
|
||||||
params: { doctype: props.doctype, type: 'Data Fields' },
|
params: { doctype: props.doctype, type: 'Data Fields' },
|
||||||
auto: true,
|
auto: true,
|
||||||
|
transform: (_tabs) => parseTabs(_tabs),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function parseTabs(_tabs) {
|
||||||
|
_tabs.forEach((tab) => {
|
||||||
|
tab.sections.forEach((section) => {
|
||||||
|
section.fields.forEach((field) => {
|
||||||
|
if (field.type === 'Table') {
|
||||||
|
let name = props.meta[field.name].df.fieldname
|
||||||
|
let fields = props.meta[field.name].fields
|
||||||
|
field.fields = fields.map((field) => {
|
||||||
|
return {
|
||||||
|
...getFieldObj(field),
|
||||||
|
onChange: (value, index) => {
|
||||||
|
data.doc[name][index][field.fieldname] = value
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
field.gridFields = field.fields.filter((field) => field.in_list_view)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return _tabs
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFieldObj(field) {
|
||||||
|
return {
|
||||||
|
label: field.label,
|
||||||
|
fieldname: field.fieldname,
|
||||||
|
fieldtype: field.fieldtype,
|
||||||
|
options: field.options,
|
||||||
|
in_list_view: field.in_list_view,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function saveChanges() {
|
function saveChanges() {
|
||||||
data.save.submit()
|
data.save.submit()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,6 +76,12 @@
|
|||||||
v-model="data[field.name]"
|
v-model="data[field.name]"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
|
<Grid
|
||||||
|
v-else-if="field.type === 'Table'"
|
||||||
|
v-model="data[field.name]"
|
||||||
|
:fields="field.fields"
|
||||||
|
:gridFields="field.gridFields"
|
||||||
|
/>
|
||||||
<FormControl
|
<FormControl
|
||||||
v-else-if="field.type === 'Select'"
|
v-else-if="field.type === 'Select'"
|
||||||
type="select"
|
type="select"
|
||||||
@ -237,7 +243,8 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
|
|||||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
import Link from '@/components/Controls/Link.vue'
|
import Link from '@/components/Controls/Link.vue'
|
||||||
import { getMeta } from '../stores/meta'
|
import Grid from '@/components/Controls/Grid.vue'
|
||||||
|
import { getMeta } from '@/stores/meta'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { getFormat } from '@/utils'
|
import { getFormat } from '@/utils'
|
||||||
import { flt } from '@/utils/numberFormat.js'
|
import { flt } from '@/utils/numberFormat.js'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user