fix: save edited dashboard
This commit is contained in:
parent
37c2d3a2b0
commit
d2e65feaa6
@ -34,6 +34,7 @@
|
|||||||
v-if="editing"
|
v-if="editing"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
:label="__('Save')"
|
:label="__('Save')"
|
||||||
|
:loading="saveDashboard.loading"
|
||||||
@click="save"
|
@click="save"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -252,6 +253,28 @@ function cancel() {
|
|||||||
dashboardItems.reload()
|
dashboardItems.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const saveDashboard = createResource({
|
||||||
|
url: 'frappe.client.set_value',
|
||||||
|
method: 'POST',
|
||||||
|
onSuccess: () => {
|
||||||
|
dashboardItems.reload()
|
||||||
|
editing.value = false
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
const dashboardItemsCopy = JSON.parse(JSON.stringify(dashboardItems.data))
|
||||||
|
dashboardItemsCopy.forEach((item: any) => {
|
||||||
|
delete item.data
|
||||||
|
})
|
||||||
|
saveDashboard.submit({
|
||||||
|
doctype: 'CRM Dashboard',
|
||||||
|
name: 'Manager Dashboard',
|
||||||
|
fieldname: 'layout',
|
||||||
|
value: JSON.stringify(dashboardItemsCopy),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
usePageMeta(() => {
|
usePageMeta(() => {
|
||||||
return { title: __('CRM Dashboard') }
|
return { title: __('CRM Dashboard') }
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user