fix: allow updating view label

This commit is contained in:
Shariq Ansari 2024-01-01 00:00:04 +05:30
parent 1e3e898a97
commit cf619a658e
2 changed files with 12 additions and 2 deletions

View File

@ -58,6 +58,7 @@ def update(view):
rows = remove_duplicates(rows) rows = remove_duplicates(rows)
doc = frappe.get_doc("CRM View Settings", view.name) doc = frappe.get_doc("CRM View Settings", view.name)
doc.label = view.label
doc.default_columns = default_columns doc.default_columns = default_columns
doc.filters = json.dumps(filters) doc.filters = json.dumps(filters)
doc.order_by = view.order_by doc.order_by = view.order_by

View File

@ -20,7 +20,10 @@
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<div v-if="viewUpdated" class="flex items-center gap-2 border-r pr-2"> <div v-if="viewUpdated" class="flex items-center gap-2 border-r pr-2">
<Button label="Cancel" @click="cancelChanges" /> <Button label="Cancel" @click="cancelChanges" />
<Button label="Save Changes" @click="saveView" /> <Button
:label="view?.name ? 'Save Changes' : 'Create View'"
@click="saveView"
/>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Filter v-model="list" :doctype="doctype" @update="updateFilter" /> <Filter v-model="list" :doctype="doctype" @update="updateFilter" />
@ -48,7 +51,13 @@
viewUpdated = false viewUpdated = false
router.push({ name: route.name, query: { view: v.name } }) router.push({ name: route.name, query: { view: v.name } })
}, },
afterUpdate: () => (viewUpdated = false), afterUpdate: (v) => {
viewUpdated = false
currentView = {
label: v.label,
icon: v.icon || 'list',
}
},
}" }"
v-model="showViewModal" v-model="showViewModal"
/> />