2
0
mirror of https://github.com/frappe/books.git synced 2025-02-02 12:08:27 +00:00

fix: get listview to render

This commit is contained in:
18alantom 2022-04-27 17:32:43 +05:30
parent 22609711bc
commit fba81e5b22
28 changed files with 175 additions and 232 deletions

View File

@ -74,7 +74,7 @@ export async function getLastInserted(schemaName: string, fyo: Fyo) {
const lastInserted = await fyo.db.getAll(schemaName, { const lastInserted = await fyo.db.getAll(schemaName, {
fields: ['name'], fields: ['name'],
limit: 1, limit: 1,
orderBy: 'creation', orderBy: 'created',
order: 'desc', order: 'desc',
}); });
return lastInserted && lastInserted.length ? lastInserted[0] : null; return lastInserted && lastInserted.length ? lastInserted[0] : null;

View File

@ -1,10 +1,10 @@
import { Fyo } from 'fyo'; import { Fyo, t } from 'fyo';
import { Doc } from 'fyo/model/doc'; import { Doc } from 'fyo/model/doc';
import { import {
Action, Action,
DefaultMap, DefaultMap,
FiltersMap, FiltersMap,
ListViewSettings, ListViewSettings
} from 'fyo/model/types'; } from 'fyo/model/types';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { getLedgerLinkAction } from 'models/helpers'; import { getLedgerLinkAction } from 'models/helpers';
@ -56,13 +56,13 @@ export class JournalEntry extends Doc {
return [getLedgerLinkAction(fyo)]; return [getLedgerLinkAction(fyo)];
} }
static getListViewSettings(fyo: Fyo): ListViewSettings { static getListViewSettings(): ListViewSettings {
return { return {
formRoute: (name) => `/edit/JournalEntry/${name}`, formRoute: (name) => `/edit/JournalEntry/${name}`,
columns: [ columns: [
'date', 'date',
{ {
label: fyo.t`Status`, label: t`Status`,
fieldtype: 'Select', fieldtype: 'Select',
size: 'small', size: 'small',
render(doc) { render(doc) {
@ -84,7 +84,7 @@ export class JournalEntry extends Doc {
}, },
}, },
{ {
label: fyo.t`Entry ID`, label: t`Entry ID`,
fieldtype: 'Data', fieldtype: 'Data',
fieldname: 'name', fieldname: 'name',
getValue(doc) { getValue(doc) {

View File

@ -1,4 +1,4 @@
import { Fyo } from 'fyo'; import { Fyo, t } from 'fyo';
import { DocValue } from 'fyo/core/types'; import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc'; import { Doc } from 'fyo/model/doc';
import { import {
@ -374,7 +374,7 @@ export class Payment extends Doc {
columns: [ columns: [
'party', 'party',
{ {
label: fyo.t`Status`, label: t`Status`,
fieldname: 'status', fieldname: 'status',
fieldtype: 'Select', fieldtype: 'Select',
size: 'small', size: 'small',

View File

@ -117,8 +117,7 @@ export default {
if (hideGetStarted || onboardingComplete) { if (hideGetStarted || onboardingComplete) {
routeTo('/'); routeTo('/');
} else { } else {
// routeTo('/get-started'); routeTo('/get-started');
routeTo('/settings');
} }
}, },
async changeDbFile() { async changeDbFile() {

View File

@ -8,7 +8,17 @@
/> />
<div <div
v-else v-else
class="bg-gray-500 flex h-full items-center justify-center text-white w-full text-base uppercase" class="
bg-gray-500
flex
h-full
items-center
justify-center
text-white
w-full
text-base
uppercase
"
> >
{{ label && label[0] }} {{ label && label[0] }}
</div> </div>
@ -22,17 +32,17 @@ export default {
imageURL: String, imageURL: String,
label: String, label: String,
size: { size: {
default: 'md' default: 'md',
} },
}, },
computed: { computed: {
sizeClasses() { sizeClasses() {
return { return {
sm: 'w-5 h-5', sm: 'w-5 h-5',
md: 'w-7 h-7', md: 'w-7 h-7',
lg: 'w-9 h-9' lg: 'w-9 h-9',
}[this.size]; }[this.size];
} },
} },
}; };
</script> </script>

View File

@ -1,4 +1,4 @@
<template #title> <template>
<a <a
class="cursor-pointer font-semibold flex items-center" class="cursor-pointer font-semibold flex items-center"
@click="$router.back()" @click="$router.back()"
@ -7,3 +7,4 @@
<span class="ml-1">{{ t`Back` }}</span> <span class="ml-1">{{ t`Back` }}</span>
</a> </a>
</template> </template>
<script></script>

View File

@ -1,10 +1,25 @@
<template> <template>
<div class="my-4 mx-4 flex justify-between window-drag"> <div class="my-4 mx-4 flex justify-between window-drag">
<div class="window-no-drag"> <h1 class="text-2xl font-bold select-none" v-if="title && !backLink">
<slot name="title" /> {{ title }}
</div> </h1>
<BackLink v-if="backLink" />
<div class="flex items-stretch window-no-drag"> <div class="flex items-stretch window-no-drag">
<slot name="actions" /> <slot name="actions" />
<SearchBar v-show="!hideSearch" class="ml-2" />
</div> </div>
</div> </div>
</template> </template>
<script>
import BackLink from './BackLink.vue';
import SearchBar from './SearchBar.vue';
export default {
props: {
title: { type: String, default: '' },
backLink: { type: Boolean, default: false },
hideSearch: { type: Boolean, default: false },
},
components: { SearchBar, BackLink },
};
</script>

View File

@ -13,11 +13,11 @@
class="rounded-md relative flex items-center overflow-hidden h-full" class="rounded-md relative flex items-center overflow-hidden h-full"
> >
<div class="absolute flex justify-center w-8"> <div class="absolute flex justify-center w-8">
<feather-icon name="search" class="w-3 h-3 text-gray-800" /> <feather-icon name="search" class="w-3 h-3 text-gray-700" />
</div> </div>
<input <input
type="search" type="search"
class="bg-gray-200 text-sm pl-8 focus:outline-none h-full w-56" class="bg-gray-200 text-sm pl-8 focus:outline-none h-full w-56 placeholder-gray-700"
:placeholder="t`Search...`" :placeholder="t`Search...`"
autocomplete="off" autocomplete="off"
spellcheck="false" spellcheck="false"
@ -47,7 +47,6 @@ import Dropdown from 'src/components/Dropdown';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { routeTo } from 'src/utils/ui'; import { routeTo } from 'src/utils/ui';
export default { export default {
data() { data() {
return { return {
@ -79,11 +78,11 @@ export default {
this.$emit('change', null); this.$emit('change', null);
}, },
async makeSearchList() { async makeSearchList() {
const doctypes = this.getDoctypes(); const schemas = this.getSearchableSchemas();
const reports = this.getReports(); const reports = this.getReports();
const views = this.getViews(); const views = this.getViews();
let searchList = [...doctypes, ...reports, ...views]; let searchList = [...schemas, ...reports, ...views];
this.searchList = searchList.map((d) => { this.searchList = searchList.map((d) => {
if (d.route) { if (d.route) {
d.action = () => routeTo(d.route); d.action = () => routeTo(d.route);
@ -92,19 +91,14 @@ export default {
return d; return d;
}); });
}, },
getDoctypes() { getSearchableSchemas() {
let doctypes = Object.keys(fyo.models).sort(); return Object.values(fyo.schemaMap)
let doctypeMetas = doctypes.map((doctype) => fyo.getMeta(doctype)); .filter((s) => !s.isChild && !s.isSingle)
let searchableDoctypes = doctypeMetas.filter((meta) => { .map((s) => ({
return !meta.isSingle && !meta.isChild; label: s.label,
}); route: `/list/${s.name}`,
return searchableDoctypes.map((meta) => {
return {
label: meta.label || meta.name,
route: `/list/${meta.name}`,
group: 'List', group: 'List',
}; }));
});
}, },
getReports() { getReports() {
return Object.values(reports).map((report) => { return Object.values(reports).map((report) => {
@ -120,7 +114,17 @@ export default {
{ {
label: t`Chart of Accounts`, label: t`Chart of Accounts`,
route: '/chartOfAccounts', route: '/chartOfAccounts',
group: 'List', group: 'Setup',
},
{
label: t`Data Import`,
route: '/data_import',
group: 'Setup',
},
{
label: t`Settings`,
route: '/settings',
group: 'Setup',
}, },
]; ];
}, },

View File

@ -91,7 +91,7 @@ export default {
[partyField]: this.doc.name, [partyField]: this.doc.name,
}, },
limit: 3, limit: 3,
orderBy: 'creation', orderBy: 'created',
}); });
window.pendingInvoices = this.pendingInvoices; window.pendingInvoices = this.pendingInvoices;
}, },

View File

@ -1,15 +1,6 @@
<template> <template>
<div class="flex flex-col overflow-y-hidden"> <div class="flex flex-col overflow-y-hidden">
<PageHeader> <PageHeader :title="t`Chart of Accounts`" />
<template #title>
<h1 class="text-2xl font-bold">
{{ t`Chart of Accounts` }}
</h1>
</template>
<template #actions>
<SearchBar class="ml-2" />
</template>
</PageHeader>
<div class="flex-1 flex px-8 overflow-y-auto"> <div class="flex-1 flex px-8 overflow-y-auto">
<div class="flex-1" v-if="root"> <div class="flex-1" v-if="root">
<div v-for="account in allAccounts" :key="account.name"> <div v-for="account in allAccounts" :key="account.name">
@ -130,7 +121,6 @@
</template> </template>
<script> <script>
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import SearchBar from 'src/components/SearchBar';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { openQuickEdit } from 'src/utils'; import { openQuickEdit } from 'src/utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
@ -139,7 +129,6 @@ import { handleErrorWithDialog } from '../errorHandling';
export default { export default {
components: { components: {
PageHeader, PageHeader,
SearchBar,
}, },
data() { data() {
return { return {

View File

@ -1,14 +1,6 @@
<template> <template>
<div class="flex flex-col"> <div class="flex flex-col">
<PageHeader> <PageHeader :title="t`Dashboard`" />
<template #title>
<h1 class="text-2xl font-bold">{{ t`Dashboard` }}</h1>
</template>
<template #actions>
<SearchBar class="ml-2" />
</template>
</PageHeader>
<hr class="border-t mx-4" />
<div class="mx-4 overflow-y-scroll no-scrollbar"> <div class="mx-4 overflow-y-scroll no-scrollbar">
<Cashflow class="mt-5" /> <Cashflow class="mt-5" />
<hr class="border-t mt-10" /> <hr class="border-t mt-10" />
@ -24,7 +16,6 @@
<script> <script>
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import SearchBar from 'src/components/SearchBar';
import Cashflow from './Cashflow'; import Cashflow from './Cashflow';
import Expenses from './Expenses'; import Expenses from './Expenses';
import ProfitAndLoss from './ProfitAndLoss'; import ProfitAndLoss from './ProfitAndLoss';
@ -34,7 +25,6 @@ export default {
name: 'Dashboard', name: 'Dashboard',
components: { components: {
PageHeader, PageHeader,
SearchBar,
Cashflow, Cashflow,
UnpaidInvoices, UnpaidInvoices,
ProfitAndLoss, ProfitAndLoss,

View File

@ -1,11 +1,6 @@
<template> <template>
<div class="flex flex-col overflow-hidden w-full"> <div class="flex flex-col overflow-hidden w-full">
<PageHeader> <PageHeader :title="t`Data Import`">
<template #title>
<h1 class="text-2xl font-bold">
{{ t`Data Import` }}
</h1>
</template>
<template #actions> <template #actions>
<DropdownWithActions <DropdownWithActions
class="ml-2" class="ml-2"
@ -37,7 +32,7 @@
/> />
<p <p
class="text-base text-base ml-2" class="text-base ml-2"
:class="fileName ? 'text-gray-900 font-semibold' : 'text-gray-700'" :class="fileName ? 'text-gray-900 font-semibold' : 'text-gray-700'"
> >
<span v-if="fileName" class="font-normal" <span v-if="fileName" class="font-normal"
@ -57,8 +52,6 @@
<div <div
v-if="file && isSubmittable" v-if="file && isSubmittable"
class=" class="
justify-center
items-center
gap-2 gap-2
flex flex
justify-between justify-between
@ -87,12 +80,7 @@
flex flex-row flex flex-row
justify-center justify-center
items-center items-center
justify-center
items-center
gap-2 gap-2
flex
justify-between
items-center
bg-gray-100 bg-gray-100
pl-2 pl-2
rounded rounded

View File

@ -1,17 +1,8 @@
<template> <template>
<div class="flex flex-col overflow-y-hidden"> <div class="flex flex-col overflow-y-hidden">
<PageHeader> <PageHeader :title="t`Setup Your Workspace`" />
<template #title> <div class="flex-1 mx-4 overflow-y-auto">
<h1 class="text-2xl font-bold"> <div class="my-4" v-for="section in sections" :key="section.label">
{{ t`Setup your workspace` }}
</h1>
</template>
</PageHeader>
<div class="px-8">
<div class="border-t"></div>
</div>
<div class="flex-1 px-8 overflow-y-auto">
<div class="my-6" v-for="section in sections" :key="section.label">
<h2 class="font-medium">{{ section.label }}</h2> <h2 class="font-medium">{{ section.label }}</h2>
<div class="flex mt-4 -mx-2"> <div class="flex mt-4 -mx-2">
<div <div

View File

@ -1,9 +1,6 @@
<template> <template>
<div class="flex flex-col" v-if="doc"> <div class="flex flex-col" v-if="doc">
<PageHeader> <PageHeader :backLink="true">
<template #title>
<BackLink />
</template>
<template #actions> <template #actions>
<StatusBadge :status="status" /> <StatusBadge :status="status" />
<Button <Button
@ -199,7 +196,6 @@
</template> </template>
<script> <script>
import { getInvoiceStatus } from 'models/helpers'; import { getInvoiceStatus } from 'models/helpers';
import BackLink from 'src/components/BackLink';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import FormControl from 'src/components/Controls/FormControl.vue'; import FormControl from 'src/components/Controls/FormControl.vue';
import DropdownWithActions from 'src/components/DropdownWithActions'; import DropdownWithActions from 'src/components/DropdownWithActions';
@ -223,7 +219,6 @@ export default {
Button, Button,
FormControl, FormControl,
DropdownWithActions, DropdownWithActions,
BackLink,
}, },
provide() { provide() {
return { return {
@ -273,9 +268,7 @@ export default {
this.handleError(error); this.handleError(error);
} }
this.printSettings = await fyo.getSingle('PrintSettings'); this.printSettings = await fyo.getSingle('PrintSettings');
this.companyName = ( this.companyName = (await fyo.getSingle('AccountingSettings')).companyName;
await fyo.getSingle('AccountingSettings')
).companyName;
let query = this.$route.query; let query = this.$route.query;
if (query.values && query.doctype === this.doctype) { if (query.values && query.doctype === this.doctype) {

View File

@ -1,9 +1,6 @@
<template> <template>
<div class="flex flex-col"> <div class="flex flex-col">
<PageHeader> <PageHeader :backLink="true">
<template #title>
<BackLink />
</template>
<template #actions v-if="doc"> <template #actions v-if="doc">
<StatusBadge :status="status" /> <StatusBadge :status="status" />
<DropdownWithActions class="ml-2" :actions="actions" /> <DropdownWithActions class="ml-2" :actions="actions" />
@ -128,7 +125,6 @@
</div> </div>
</template> </template>
<script> <script>
import BackLink from 'src/components/BackLink';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import FormControl from 'src/components/Controls/FormControl.vue'; import FormControl from 'src/components/Controls/FormControl.vue';
import DropdownWithActions from 'src/components/DropdownWithActions'; import DropdownWithActions from 'src/components/DropdownWithActions';
@ -147,7 +143,6 @@ export default {
DropdownWithActions, DropdownWithActions,
StatusBadge, StatusBadge,
FormControl, FormControl,
BackLink,
}, },
provide() { provide() {
return { return {

View File

@ -1,7 +1,10 @@
<template> <template>
<div class="px-5 pb-16 text-base flex flex-col overflow-y-hidden"> <div class="mx-4 pb-16 text-base flex flex-col overflow-y-hidden">
<div class="flex px-3"> <!-- Title Row -->
<div class="py-4 mr-3 w-7" v-if="hasImage"></div> <div class="flex">
<div class="py-4 mr-3 w-7 border-b" v-if="hasImage">
<p class="text-gray-700">Img</p>
</div>
<Row <Row
class="flex-1 text-gray-700" class="flex-1 text-gray-700"
:columnCount="columns.length" :columnCount="columns.length"
@ -19,6 +22,8 @@
</div> </div>
</Row> </Row>
</div> </div>
<!-- Data Rows -->
<div class="overflow-y-auto" v-if="data.length !== 0"> <div class="overflow-y-auto" v-if="data.length !== 0">
<div <div
class="px-3 flex hover:bg-gray-100 rounded-md" class="px-3 flex hover:bg-gray-100 rounded-md"
@ -46,6 +51,8 @@
</Row> </Row>
</div> </div>
</div> </div>
<!-- Empty State -->
<div v-else class="flex flex-col items-center justify-center my-auto"> <div v-else class="flex flex-col items-center justify-center my-auto">
<img src="@/assets/img/list-empty-state.svg" alt="" class="w-24" /> <img src="@/assets/img/list-empty-state.svg" alt="" class="w-24" />
<p class="my-3 text-gray-800">{{ t`No entries found` }}</p> <p class="my-3 text-gray-800">{{ t`No entries found` }}</p>
@ -65,7 +72,7 @@ import ListCell from './ListCell';
export default { export default {
name: 'List', name: 'List',
props: ['listConfig', 'filters'], props: { listConfig: Object, filters: Object, schemaName: String },
emits: ['makeNewDoc'], emits: ['makeNewDoc'],
components: { components: {
Row, Row,
@ -74,10 +81,12 @@ export default {
Button, Button,
}, },
watch: { watch: {
listConfig(oldValue, newValue) { schemaName(oldValue, newValue) {
if (oldValue.doctype !== newValue.doctype) { if (oldValue === newValue) {
this.setupColumnsAndData(); return;
} }
this.updateData();
}, },
}, },
data() { data() {
@ -87,63 +96,46 @@ export default {
}, },
computed: { computed: {
columns() { columns() {
return this.prepareColumns(); const columns = this.listConfig?.columns ?? [];
}, return columns
meta() { .map((fieldname) => fyo.getField(this.schemaName, fieldname))
return fyo.getMeta(this.listConfig.doctype); .filter(Boolean);
}, },
hasImage() { hasImage() {
return this.meta.hasField('image'); return !!fyo.getField(this.schemaName, 'image');
}, },
}, },
async mounted() { async mounted() {
await this.setupColumnsAndData(); await this.updateData();
fyo.db.on(`change:${this.listConfig.doctype}`, () => { /*
TODO: need to set callback incase that schema has data changes
fyo.db.on(`change:${this.schemaName}`, () => {
this.updateData(); this.updateData();
}); });
*/
}, },
methods: { methods: {
async setupColumnsAndData() {
this.doctype = this.listConfig.doctype;
await this.updateData();
},
openForm(doc) { openForm(doc) {
if (this.listConfig.formRoute) { if (this.listConfig.formRoute) {
routeTo(this.listConfig.formRoute(doc.name)); routeTo(this.listConfig.formRoute(doc.name));
return; return;
} }
openQuickEdit({ openQuickEdit({
doctype: this.doctype, schemaName: this.schemaName,
name: doc.name, name: doc.name,
}); });
}, },
async updateData(filters) { async updateData(filters) {
if (!filters) filters = this.getFilters(); if (!filters) {
this.data = await fyo.db.getAll({ filters = { ...this.filters };
doctype: this.doctype, }
this.data = await fyo.db.getAll(this.schemaName, {
fields: ['*'], fields: ['*'],
filters, filters,
orderBy: 'creation', orderBy: 'created',
}); });
}, },
getFilters() {
let filters = {};
Object.assign(filters, this.listConfig.filters || {});
Object.assign(filters, this.filters);
return filters;
},
prepareColumns() {
return this.listConfig.columns
.map((col) => {
if (typeof col === 'string') {
const field = this.meta.getField(col);
if (!field) return null;
return field;
}
return col;
})
.filter(Boolean);
},
}, },
}; };
</script> </script>

View File

@ -1,26 +1,21 @@
<template> <template>
<div class="flex flex-col"> <div class="flex flex-col">
<PageHeader> <PageHeader :title="title">
<template #title>
<h1 class="text-2xl font-bold" v-if="title">
{{ title }}
</h1>
</template>
<template #actions> <template #actions>
<FilterDropdown <FilterDropdown
ref="filterDropdown" ref="filterDropdown"
@change="applyFilter" @change="applyFilter"
:fields="meta.fields" :fields="fields"
/> />
<Button class="ml-2" :icon="true" type="primary" @click="makeNewDoc"> <Button class="ml-2" :icon="true" type="primary" @click="makeNewDoc">
<feather-icon name="plus" class="w-4 h-4 text-white" /> <feather-icon name="plus" class="w-4 h-4 text-white" />
</Button> </Button>
<SearchBar class="ml-2" />
</template> </template>
</PageHeader> </PageHeader>
<div class="flex-1 flex h-full"> <div class="flex-1 flex h-full">
<List <List
ref="list" ref="list"
:schemaName="schemaName"
:listConfig="listConfig" :listConfig="listConfig"
:filters="filters" :filters="filters"
class="flex-1" class="flex-1"
@ -33,47 +28,36 @@
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import FilterDropdown from 'src/components/FilterDropdown'; import FilterDropdown from 'src/components/FilterDropdown';
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import SearchBar from 'src/components/SearchBar';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { routeTo } from 'src/utils';
import List from './List'; import List from './List';
export default { export default {
name: 'ListView', name: 'ListView',
props: ['doctype', 'filters'], props: ['schemaName', 'filters'],
components: { components: {
PageHeader, PageHeader,
List, List,
Button, Button,
SearchBar,
FilterDropdown, FilterDropdown,
}, },
data() { data() {
return { listConfigs: undefined }; return { listConfig: undefined };
}, },
async activated() { async activated() {
if (typeof this.filters === 'object') { if (typeof this.filters === 'object') {
this.$refs.filterDropdown.setFilter(this.filters); this.$refs.filterDropdown.setFilter(this.filters);
} }
if (this.listConfigs === undefined) { this.listConfig = getListConfig(this.schemaName);
this.listConfigs = (await import('./listConfig')).default;
}
}, },
methods: { methods: {
async makeNewDoc() { async makeNewDoc() {
const doctype = this.listConfig.doctype; const doc = await fyo.doc.getNewDoc(this.schemaName, this.filters ?? {});
const doc = await fyo.doc.getNewDoc(doctype); const path = this.getFormPath(doc.name);
if (this.listConfig.filters) {
doc.set(this.listConfig.filters);
}
if (this.filters) {
doc.set(this.filters);
}
let path = this.getFormPath(doc.name);
routeTo(path); routeTo(path);
doc.on('afterSync', () => { doc.on('afterSync', () => {
let path = this.getFormPath(doc.name); const path = this.getFormPath(doc.name);
this.$router.replace(path); this.$router.replace(path);
}); });
}, },
@ -82,10 +66,10 @@ export default {
}, },
getFormPath(name) { getFormPath(name) {
let path = { let path = {
path: `/list/${this.doctype}`, path: `/list/${this.schemaName}`,
query: { query: {
edit: 1, edit: 1,
doctype: this.doctype, schemaName: this.schemaName,
name, name,
}, },
}; };
@ -104,20 +88,22 @@ export default {
}, },
}, },
computed: { computed: {
listConfig() {
if (this?.listConfigs?.[this?.doctype]) {
return this.listConfigs[this.doctype];
} else {
return {
title: this.doctype,
doctype: this.doctype,
columns: fyo.schemaMap[this.doctype].keywordFields ?? ['name'],
};
}
},
title() { title() {
return this.listConfig.title || this.doctype; return fyo.schemaMap[this.schemaName].label;
},
fields() {
return fyo.schemaMap[this.schemaName].fields;
}, },
}, },
}; };
function getListConfig(schemaName) {
const listConfig = fyo.models[schemaName]?.getListViewSettings?.(fyo);
if (listConfig?.columns === undefined) {
return {
columns: fyo.schemaMap[schemaName].keywordFields ?? ['name'],
};
}
return listConfig;
}
</script> </script>

View File

@ -1,10 +1,7 @@
<template> <template>
<div class="flex"> <div class="flex">
<div class="flex flex-col flex-1"> <div class="flex flex-col flex-1">
<PageHeader class="bg-white z-10"> <PageHeader :backLink="true" class="bg-white z-10">
<template #title>
<BackLink />
</template>
<template #actions> <template #actions>
<Button <Button
class="text-gray-900 text-xs ml-2" class="text-gray-900 text-xs ml-2"
@ -53,7 +50,6 @@
<script> <script>
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import { Verb } from 'fyo/telemetry/types'; import { Verb } from 'fyo/telemetry/types';
import BackLink from 'src/components/BackLink';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import SearchBar from 'src/components/SearchBar'; import SearchBar from 'src/components/SearchBar';
@ -68,7 +64,6 @@ export default {
PageHeader, PageHeader,
SearchBar, SearchBar,
Button, Button,
BackLink,
TwoColumnForm, TwoColumnForm,
}, },
data() { data() {

View File

@ -1,9 +1,6 @@
<template> <template>
<div class="flex flex-col max-w-full"> <div class="flex flex-col max-w-full">
<PageHeader> <PageHeader :title="report.title">
<template #title>
<h1 class="text-2xl font-bold">{{ report.title }}</h1>
</template>
<template #actions> <template #actions>
<DropdownWithActions <DropdownWithActions
v-for="group of actionGroups" v-for="group of actionGroups"
@ -15,7 +12,6 @@
{{ group.label }} {{ group.label }}
</DropdownWithActions> </DropdownWithActions>
<DropdownWithActions class="ml-2" :actions="actions" /> <DropdownWithActions class="ml-2" :actions="actions" />
<SearchBar class="ml-2" />
</template> </template>
</PageHeader> </PageHeader>
<div class="flex px-8 mt-2 text-base" v-if="report.filterFields"> <div class="flex px-8 mt-2 text-base" v-if="report.filterFields">
@ -144,7 +140,6 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue';
import FeatherIcon from 'src/components/FeatherIcon.vue'; import FeatherIcon from 'src/components/FeatherIcon.vue';
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import Row from 'src/components/Row'; import Row from 'src/components/Row';
import SearchBar from 'src/components/SearchBar';
import WithScroll from 'src/components/WithScroll'; import WithScroll from 'src/components/WithScroll';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { h, markRaw } from 'vue'; import { h, markRaw } from 'vue';
@ -155,7 +150,6 @@ export default {
components: { components: {
PageHeader, PageHeader,
Button, Button,
SearchBar,
Row, Row,
FormControl, FormControl,
WithScroll, WithScroll,
@ -196,7 +190,7 @@ export default {
}); });
}, },
async fetchReportData() { async fetchReportData() {
let data = await getReportData(this.report.method, this.filters) let data = await getReportData(this.report.method, this.filters);
let rows; let rows;
if (data.rows) { if (data.rows) {
@ -345,7 +339,7 @@ export default {
} else if (this.usePagination) { } else if (this.usePagination) {
return 'calc(100vh - 13rem)'; return 'calc(100vh - 13rem)';
} }
return 'calc(100vh - 12rem)'; return 'calc(100vh - 12rem)';
}, },
sliceIndex() { sliceIndex() {

View File

@ -1,12 +1,6 @@
<template> <template>
<div class="flex flex-col overflow-hidden"> <div class="flex flex-col overflow-hidden">
<PageHeader> <PageHeader :title="t`Settings`" />
<template #title>
<h1 class="text-2xl font-bold">
{{ t`Settings` }}
</h1>
</template>
</PageHeader>
<div class="flex justify-center flex-1 mb-8 mt-2"> <div class="flex justify-center flex-1 mb-8 mt-2">
<div <div
class="border rounded-lg shadow h-full flex flex-col justify-between" class="border rounded-lg shadow h-full flex flex-col justify-between"

View File

@ -5,9 +5,9 @@ import GetStarted from 'src/pages/GetStarted.vue';
// import DataImport from 'src/pages/DataImport.vue'; // import DataImport from 'src/pages/DataImport.vue';
// import InvoiceForm from 'src/pages/InvoiceForm.vue'; // import InvoiceForm from 'src/pages/InvoiceForm.vue';
// import JournalEntryForm from 'src/pages/JournalEntryForm.vue'; // import JournalEntryForm from 'src/pages/JournalEntryForm.vue';
// import ListView from 'src/pages/ListView/ListView.vue'; import ListView from 'src/pages/ListView/ListView.vue';
// import PrintView from 'src/pages/PrintView/PrintView.vue'; // import PrintView from 'src/pages/PrintView/PrintView.vue';
// import QuickEditForm from 'src/pages/QuickEditForm.vue'; import QuickEditForm from 'src/pages/QuickEditForm.vue';
// import Report from 'src/pages/Report.vue'; // import Report from 'src/pages/Report.vue';
import Settings from 'src/pages/Settings/Settings.vue'; import Settings from 'src/pages/Settings/Settings.vue';
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
@ -54,8 +54,9 @@ const routes: RouteRecordRaw[] = [
edit: (route) => route.query, edit: (route) => route.query,
}, },
}, },
*/
{ {
path: '/list/:doctype/:fieldname?/:value?', path: '/list/:schemaName/:fieldname?/:value?',
name: 'ListView', name: 'ListView',
components: { components: {
default: ListView, default: ListView,
@ -63,7 +64,7 @@ const routes: RouteRecordRaw[] = [
}, },
props: { props: {
default: (route) => { default: (route) => {
const { doctype, fieldname, value } = route.params; const { schemaName, fieldname, value } = route.params;
let { filters } = route.params; let { filters } = route.params;
if (filters === undefined && fieldname && value) { if (filters === undefined && fieldname && value) {
@ -72,13 +73,14 @@ const routes: RouteRecordRaw[] = [
} }
return { return {
doctype, schemaName,
filters, filters,
}; };
}, },
edit: (route) => route.query, edit: (route) => route.query,
}, },
}, },
/*
{ {
path: '/print/:doctype/:name', path: '/print/:doctype/:name',
name: 'PrintView', name: 'PrintView',
@ -108,8 +110,7 @@ const routes: RouteRecordRaw[] = [
name: 'Data Import', name: 'Data Import',
component: DataImport, component: DataImport,
}, },
*/ */ {
{
path: '/settings', path: '/settings',
name: 'Settings', name: 'Settings',
component: Settings, component: Settings,

View File

@ -52,25 +52,25 @@ function getCompleteSidebar(): SidebarConfig {
label: t`Sales Invoices`, label: t`Sales Invoices`,
name: 'sales-invoices', name: 'sales-invoices',
route: '/list/SalesInvoice', route: '/list/SalesInvoice',
doctype: 'SalesInvoice', schemaName: 'SalesInvoice',
}, },
{ {
label: t`Payments`, label: t`Payments`,
name: 'payments', name: 'payments',
route: '/list/Payment/paymentType/Receive', route: '/list/Payment/paymentType/Receive',
doctype: 'Payment', schemaName: 'Payment',
}, },
{ {
label: t`Customers`, label: t`Customers`,
name: 'customers', name: 'customers',
route: '/list/Customer', route: '/list/Party/role/Customer',
doctype: 'Customer', schemaName: 'Party',
}, },
{ {
label: t`Sales Items`, label: t`Sales Items`,
name: 'sales-items', name: 'sales-items',
route: '/list/Item/for/sales', route: '/list/Item/for/sales',
doctype: 'Item', schemaName: 'Item',
}, },
], ],
}, },
@ -84,25 +84,25 @@ function getCompleteSidebar(): SidebarConfig {
label: t`Purchase Invoices`, label: t`Purchase Invoices`,
name: 'purchase-invoices', name: 'purchase-invoices',
route: '/list/PurchaseInvoice', route: '/list/PurchaseInvoice',
doctype: 'PurchaseInvoice', schemaName: 'PurchaseInvoice',
}, },
{ {
label: t`Payments`, label: t`Payments`,
name: 'payments', name: 'payments',
route: '/list/Payment/paymentType/Pay', route: '/list/Payment/paymentType/Pay',
doctype: 'Payment', schemaName: 'Payment',
}, },
{ {
label: t`Suppliers`, label: t`Suppliers`,
name: 'suppliers', name: 'suppliers',
route: '/list/Supplier', route: '/list/Party/role/Supplier',
doctype: 'Supplier', schemaName: 'Party',
}, },
{ {
label: t`Purchase Items`, label: t`Purchase Items`,
name: 'purchase-items', name: 'purchase-items',
route: '/list/Item/for/purchases', route: '/list/Item/for/purchases',
doctype: 'Item', schemaName: 'Item',
}, },
], ],
}, },
@ -116,13 +116,19 @@ function getCompleteSidebar(): SidebarConfig {
label: t`Journal Entry`, label: t`Journal Entry`,
name: 'journal-entry', name: 'journal-entry',
route: '/list/JournalEntry', route: '/list/JournalEntry',
doctype: 'JournalEntry', schemaName: 'JournalEntry',
}, },
{ {
label: t`Common Items`, label: t`Common Items`,
name: 'common-items', name: 'common-items',
route: '/list/Item/for/both', route: '/list/Item/for/both',
doctype: 'Item', schemaName: 'Item',
},
{
label: t`Party`,
name: 'party',
route: '/list/Party/role/Both',
schemaName: 'Party',
}, },
], ],
}, },
@ -181,7 +187,7 @@ function getCompleteSidebar(): SidebarConfig {
label: t`Taxes`, label: t`Taxes`,
name: 'taxes', name: 'taxes',
route: '/list/Tax', route: '/list/Tax',
doctype: 'Tax', schemaName: 'Tax',
}, },
{ {
label: t`Data Import`, label: t`Data Import`,

View File

@ -44,6 +44,6 @@ export interface SidebarItem {
label: string; label: string;
name: string; name: string;
route: string; route: string;
doctype?: string; schemaName?: string;
hidden?: () => boolean; hidden?: () => boolean;
} }

View File

@ -445,7 +445,7 @@
`Setup Complete`,`اكتمل الإعداد` `Setup Complete`,`اكتمل الإعداد`
`Setup Wizard`,`معالج الإعداد` `Setup Wizard`,`معالج الإعداد`
`Setup your organization`,`إعداد منظمتك` `Setup your organization`,`إعداد منظمتك`
`Setup your workspace`,`إعداد مساحة العمل الخاصة بك` `Setup Your Workspace`,`إعداد مساحة العمل الخاصة بك`
`Show Me`,`أرني` `Show Me`,`أرني`
`Smallest Currency Fraction Value`,`أصغر قيمة لكسر العملة` `Smallest Currency Fraction Value`,`أصغر قيمة لكسر العملة`
`Softwares`,`البرامج` `Softwares`,`البرامج`

Can't render this file because it has a wrong number of fields in line 62.

View File

@ -491,7 +491,7 @@
`Setup your opening balances before performing any accounting entries`,`Configureu els saldos d'obertura abans de realitzar qualsevol entrada comptable` `Setup your opening balances before performing any accounting entries`,`Configureu els saldos d'obertura abans de realitzar qualsevol entrada comptable`
`Setup your organization`,`Configura la teva empresa` `Setup your organization`,`Configura la teva empresa`
`Setup your tax templates for your sales or purchase transactions`,`Configura les plantilles de taxes per a les vendes o compres` `Setup your tax templates for your sales or purchase transactions`,`Configura les plantilles de taxes per a les vendes o compres`
`Setup your workspace`,`Configura el teu espai de treball` `Setup Your Workspace`,`Configura el teu espai de treball`
`Show Me`,`Mostra'm` `Show Me`,`Mostra'm`
`Smallest Currency Fraction Value`,`Valor de fracció de la divisa més petit` `Smallest Currency Fraction Value`,`Valor de fracció de la divisa més petit`
`Softwares`,`Programari` `Softwares`,`Programari`

Can't render this file because it has a wrong number of fields in line 432.

View File

@ -397,7 +397,7 @@
`Setup Complete`,`Einrichtung abgeschlossen` `Setup Complete`,`Einrichtung abgeschlossen`
`Setup Wizard`,`Einrichtungsassistent` `Setup Wizard`,`Einrichtungsassistent`
`Setup your organization`,`Einrichtung Ihrer Organisation` `Setup your organization`,`Einrichtung Ihrer Organisation`
`Setup your workspace`,`Einrichten Ihres Arbeitsbereichs` `Setup Your Workspace`,`Einrichten Ihres Arbeitsbereichs`
`Smallest Currency Fraction Value`,`Kleinster Wert eines Währungsbruchteils` `Smallest Currency Fraction Value`,`Kleinster Wert eines Währungsbruchteils`
`Softwares`,`Software` `Softwares`,`Software`
`Something has gone terribly wrong. Please check the console and raise an issue.`,`Etwas ist furchtbar schief gelaufen. Bitte prüfen Sie die Konsole und melden Sie ein Problem.` `Something has gone terribly wrong. Please check the console and raise an issue.`,`Etwas ist furchtbar schief gelaufen. Bitte prüfen Sie die Konsole und melden Sie ein Problem.`

Can't render this file because it has a wrong number of fields in line 33.

View File

@ -397,7 +397,7 @@
`Setup Complete`,`Configuration terminée` `Setup Complete`,`Configuration terminée`
`Setup Wizard`,`Assistant de configuration` `Setup Wizard`,`Assistant de configuration`
`Setup your organization`,`Configurer votre organisation` `Setup your organization`,`Configurer votre organisation`
`Setup your workspace`,`Configurez votre espace de travail` `Setup Your Workspace`,`Configurez votre espace de travail`
`Smallest Currency Fraction Value`,`Valeur de la plus petite fraction de la monnaie` `Smallest Currency Fraction Value`,`Valeur de la plus petite fraction de la monnaie`
`Softwares`,`Logiciels` `Softwares`,`Logiciels`
`Something has gone terribly wrong. Please check the console and raise an issue.`,`Quelque chose s'est terriblement mal passé. Veuillez vérifier la console et soulever un problème.` `Something has gone terribly wrong. Please check the console and raise an issue.`,`Quelque chose s'est terriblement mal passé. Veuillez vérifier la console et soulever un problème.`

Can't render this file because it has a wrong number of fields in line 57.

View File

@ -397,7 +397,7 @@
`Setup Complete`,`Configuração Completa` `Setup Complete`,`Configuração Completa`
`Setup Wizard`,`Assistente de Configuração` `Setup Wizard`,`Assistente de Configuração`
`Setup your organization`,`Configure a sua organização` `Setup your organization`,`Configure a sua organização`
`Setup your workspace`,`Configure o seu espaço de trabalho` `Setup Your Workspace`,`Configure o seu espaço de trabalho`
`Smallest Currency Fraction Value`,`Menor valor de fracção da moeda` `Smallest Currency Fraction Value`,`Menor valor de fracção da moeda`
`Softwares`,`Aplicações informáticas` `Softwares`,`Aplicações informáticas`
`Something has gone terribly wrong. Please check the console and raise an issue.`,`Algo correu terrivelmente mal. Por favor, verifique a consola e levante um problema.` `Something has gone terribly wrong. Please check the console and raise an issue.`,`Algo correu terrivelmente mal. Por favor, verifique a consola e levante um problema.`

Can't render this file because it has a wrong number of fields in line 57.