2
0
mirror of https://github.com/frappe/books.git synced 2025-01-10 18:24:40 +00:00
books/src/pages/ListView/index.vue

48 lines
1011 B
Vue
Raw Normal View History

<template>
<div class="bg-light">
<page-header :title="meta.label || meta.name" />
<div class="px-4 py-3">
<list-toolbar
:doctype="doctype"
@newClick="openNewForm"
@filterList="keyword => filterList(keyword)"
class="mb-4"
/>
<list
:doctype="doctype"
/>
</div>
</div>
</template>
<script>
import frappe from 'frappejs';
import Observable from 'frappejs/utils/observable';
import PageHeader from '@/components/PageHeader';
import ListToolbar from './ListToolbar';
import List from './List';
export default {
name: 'ListView',
props: ['doctype'],
components: {
PageHeader,
ListToolbar,
List
},
computed: {
meta() {
return frappe.getMeta(this.doctype);
}
},
created() {
frappe.listView = new Observable();
},
methods: {
async openNewForm() {
const doc = await frappe.getNewDoc(this.doctype);
this.$router.push(`/edit/${this.doctype}/${doc.name}`);
}
}
}
</script>