fix: render tabs in settings page
This commit is contained in:
parent
1622ce3d5f
commit
a871f2e4e4
@ -76,7 +76,6 @@ const data = createDocumentResource({
|
|||||||
doctype: props.doctype,
|
doctype: props.doctype,
|
||||||
name: props.doctype,
|
name: props.doctype,
|
||||||
fields: ['*'],
|
fields: ['*'],
|
||||||
cache: props.doctype,
|
|
||||||
auto: true,
|
auto: true,
|
||||||
setValue: {
|
setValue: {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@ -101,19 +100,38 @@ const data = createDocumentResource({
|
|||||||
|
|
||||||
const tabs = computed(() => {
|
const tabs = computed(() => {
|
||||||
if (!fields.data) return []
|
if (!fields.data) return []
|
||||||
let _sections = []
|
let _tabs = []
|
||||||
let fieldsData = fields.data
|
let fieldsData = fields.data
|
||||||
|
|
||||||
if (fieldsData[0].type !== 'Section Break') {
|
if (fieldsData[0].type != 'Tab Break') {
|
||||||
_sections.push({
|
let _sections = []
|
||||||
label: 'General',
|
if (fieldsData[0].type != 'Section Break') {
|
||||||
hideLabel: true,
|
_sections.push({
|
||||||
columns: 1,
|
hideLabel: true,
|
||||||
fields: [],
|
columns: 1,
|
||||||
|
fields: [],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_tabs.push({
|
||||||
|
no_tabs: true,
|
||||||
|
sections: _sections,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsData.forEach((field) => {
|
fieldsData.forEach((field) => {
|
||||||
if (field.type === 'Section Break') {
|
let _sections = _tabs.length ? _tabs[_tabs.length - 1].sections : []
|
||||||
|
if (field.type === 'Tab Break') {
|
||||||
|
_tabs.push({
|
||||||
|
label: field.label,
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
hideLabel: true,
|
||||||
|
columns: 1,
|
||||||
|
fields: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
} else if (field.type === 'Section Break') {
|
||||||
_sections.push({
|
_sections.push({
|
||||||
label: field.value,
|
label: field.value,
|
||||||
hideLabel: true,
|
hideLabel: true,
|
||||||
@ -139,7 +157,7 @@ const tabs = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return [{ no_tabs: true, sections: _sections }]
|
return _tabs
|
||||||
})
|
})
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user