mirror of
https://github.com/frappe/books.git
synced 2025-01-22 14:48:25 +00:00
fix: get listview to render
This commit is contained in:
parent
22609711bc
commit
fba81e5b22
@ -74,7 +74,7 @@ export async function getLastInserted(schemaName: string, fyo: Fyo) {
|
||||
const lastInserted = await fyo.db.getAll(schemaName, {
|
||||
fields: ['name'],
|
||||
limit: 1,
|
||||
orderBy: 'creation',
|
||||
orderBy: 'created',
|
||||
order: 'desc',
|
||||
});
|
||||
return lastInserted && lastInserted.length ? lastInserted[0] : null;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Fyo } from 'fyo';
|
||||
import { Fyo, t } from 'fyo';
|
||||
import { Doc } from 'fyo/model/doc';
|
||||
import {
|
||||
Action,
|
||||
DefaultMap,
|
||||
FiltersMap,
|
||||
ListViewSettings,
|
||||
ListViewSettings
|
||||
} from 'fyo/model/types';
|
||||
import { DateTime } from 'luxon';
|
||||
import { getLedgerLinkAction } from 'models/helpers';
|
||||
@ -56,13 +56,13 @@ export class JournalEntry extends Doc {
|
||||
return [getLedgerLinkAction(fyo)];
|
||||
}
|
||||
|
||||
static getListViewSettings(fyo: Fyo): ListViewSettings {
|
||||
static getListViewSettings(): ListViewSettings {
|
||||
return {
|
||||
formRoute: (name) => `/edit/JournalEntry/${name}`,
|
||||
columns: [
|
||||
'date',
|
||||
{
|
||||
label: fyo.t`Status`,
|
||||
label: t`Status`,
|
||||
fieldtype: 'Select',
|
||||
size: 'small',
|
||||
render(doc) {
|
||||
@ -84,7 +84,7 @@ export class JournalEntry extends Doc {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: fyo.t`Entry ID`,
|
||||
label: t`Entry ID`,
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'name',
|
||||
getValue(doc) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Fyo } from 'fyo';
|
||||
import { Fyo, t } from 'fyo';
|
||||
import { DocValue } from 'fyo/core/types';
|
||||
import { Doc } from 'fyo/model/doc';
|
||||
import {
|
||||
@ -374,7 +374,7 @@ export class Payment extends Doc {
|
||||
columns: [
|
||||
'party',
|
||||
{
|
||||
label: fyo.t`Status`,
|
||||
label: t`Status`,
|
||||
fieldname: 'status',
|
||||
fieldtype: 'Select',
|
||||
size: 'small',
|
||||
|
@ -117,8 +117,7 @@ export default {
|
||||
if (hideGetStarted || onboardingComplete) {
|
||||
routeTo('/');
|
||||
} else {
|
||||
// routeTo('/get-started');
|
||||
routeTo('/settings');
|
||||
routeTo('/get-started');
|
||||
}
|
||||
},
|
||||
async changeDbFile() {
|
||||
|
@ -8,7 +8,17 @@
|
||||
/>
|
||||
<div
|
||||
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] }}
|
||||
</div>
|
||||
@ -22,17 +32,17 @@ export default {
|
||||
imageURL: String,
|
||||
label: String,
|
||||
size: {
|
||||
default: 'md'
|
||||
}
|
||||
default: 'md',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
sizeClasses() {
|
||||
return {
|
||||
sm: 'w-5 h-5',
|
||||
md: 'w-7 h-7',
|
||||
lg: 'w-9 h-9'
|
||||
lg: 'w-9 h-9',
|
||||
}[this.size];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<template #title>
|
||||
<template>
|
||||
<a
|
||||
class="cursor-pointer font-semibold flex items-center"
|
||||
@click="$router.back()"
|
||||
@ -7,3 +7,4 @@
|
||||
<span class="ml-1">{{ t`Back` }}</span>
|
||||
</a>
|
||||
</template>
|
||||
<script></script>
|
||||
|
@ -1,10 +1,25 @@
|
||||
<template>
|
||||
<div class="my-4 mx-4 flex justify-between window-drag">
|
||||
<div class="window-no-drag">
|
||||
<slot name="title" />
|
||||
</div>
|
||||
<h1 class="text-2xl font-bold select-none" v-if="title && !backLink">
|
||||
{{ title }}
|
||||
</h1>
|
||||
<BackLink v-if="backLink" />
|
||||
<div class="flex items-stretch window-no-drag">
|
||||
<slot name="actions" />
|
||||
<SearchBar v-show="!hideSearch" class="ml-2" />
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
|
@ -13,11 +13,11 @@
|
||||
class="rounded-md relative flex items-center overflow-hidden h-full"
|
||||
>
|
||||
<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>
|
||||
<input
|
||||
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...`"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
@ -47,7 +47,6 @@ import Dropdown from 'src/components/Dropdown';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { routeTo } from 'src/utils/ui';
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -79,11 +78,11 @@ export default {
|
||||
this.$emit('change', null);
|
||||
},
|
||||
async makeSearchList() {
|
||||
const doctypes = this.getDoctypes();
|
||||
const schemas = this.getSearchableSchemas();
|
||||
const reports = this.getReports();
|
||||
const views = this.getViews();
|
||||
|
||||
let searchList = [...doctypes, ...reports, ...views];
|
||||
let searchList = [...schemas, ...reports, ...views];
|
||||
this.searchList = searchList.map((d) => {
|
||||
if (d.route) {
|
||||
d.action = () => routeTo(d.route);
|
||||
@ -92,19 +91,14 @@ export default {
|
||||
return d;
|
||||
});
|
||||
},
|
||||
getDoctypes() {
|
||||
let doctypes = Object.keys(fyo.models).sort();
|
||||
let doctypeMetas = doctypes.map((doctype) => fyo.getMeta(doctype));
|
||||
let searchableDoctypes = doctypeMetas.filter((meta) => {
|
||||
return !meta.isSingle && !meta.isChild;
|
||||
});
|
||||
return searchableDoctypes.map((meta) => {
|
||||
return {
|
||||
label: meta.label || meta.name,
|
||||
route: `/list/${meta.name}`,
|
||||
getSearchableSchemas() {
|
||||
return Object.values(fyo.schemaMap)
|
||||
.filter((s) => !s.isChild && !s.isSingle)
|
||||
.map((s) => ({
|
||||
label: s.label,
|
||||
route: `/list/${s.name}`,
|
||||
group: 'List',
|
||||
};
|
||||
});
|
||||
}));
|
||||
},
|
||||
getReports() {
|
||||
return Object.values(reports).map((report) => {
|
||||
@ -120,7 +114,17 @@ export default {
|
||||
{
|
||||
label: t`Chart of Accounts`,
|
||||
route: '/chartOfAccounts',
|
||||
group: 'List',
|
||||
group: 'Setup',
|
||||
},
|
||||
{
|
||||
label: t`Data Import`,
|
||||
route: '/data_import',
|
||||
group: 'Setup',
|
||||
},
|
||||
{
|
||||
label: t`Settings`,
|
||||
route: '/settings',
|
||||
group: 'Setup',
|
||||
},
|
||||
];
|
||||
},
|
||||
|
@ -91,7 +91,7 @@ export default {
|
||||
[partyField]: this.doc.name,
|
||||
},
|
||||
limit: 3,
|
||||
orderBy: 'creation',
|
||||
orderBy: 'created',
|
||||
});
|
||||
window.pendingInvoices = this.pendingInvoices;
|
||||
},
|
||||
|
@ -1,15 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col overflow-y-hidden">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold">
|
||||
{{ t`Chart of Accounts` }}
|
||||
</h1>
|
||||
</template>
|
||||
<template #actions>
|
||||
<SearchBar class="ml-2" />
|
||||
</template>
|
||||
</PageHeader>
|
||||
<PageHeader :title="t`Chart of Accounts`" />
|
||||
<div class="flex-1 flex px-8 overflow-y-auto">
|
||||
<div class="flex-1" v-if="root">
|
||||
<div v-for="account in allAccounts" :key="account.name">
|
||||
@ -130,7 +121,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import PageHeader from 'src/components/PageHeader';
|
||||
import SearchBar from 'src/components/SearchBar';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { openQuickEdit } from 'src/utils';
|
||||
import { nextTick } from 'vue';
|
||||
@ -139,7 +129,6 @@ import { handleErrorWithDialog } from '../errorHandling';
|
||||
export default {
|
||||
components: {
|
||||
PageHeader,
|
||||
SearchBar,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -1,14 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col">
|
||||
<PageHeader>
|
||||
<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" />
|
||||
<PageHeader :title="t`Dashboard`" />
|
||||
<div class="mx-4 overflow-y-scroll no-scrollbar">
|
||||
<Cashflow class="mt-5" />
|
||||
<hr class="border-t mt-10" />
|
||||
@ -24,7 +16,6 @@
|
||||
|
||||
<script>
|
||||
import PageHeader from 'src/components/PageHeader';
|
||||
import SearchBar from 'src/components/SearchBar';
|
||||
import Cashflow from './Cashflow';
|
||||
import Expenses from './Expenses';
|
||||
import ProfitAndLoss from './ProfitAndLoss';
|
||||
@ -34,7 +25,6 @@ export default {
|
||||
name: 'Dashboard',
|
||||
components: {
|
||||
PageHeader,
|
||||
SearchBar,
|
||||
Cashflow,
|
||||
UnpaidInvoices,
|
||||
ProfitAndLoss,
|
||||
|
@ -1,11 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col overflow-hidden w-full">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold">
|
||||
{{ t`Data Import` }}
|
||||
</h1>
|
||||
</template>
|
||||
<PageHeader :title="t`Data Import`">
|
||||
<template #actions>
|
||||
<DropdownWithActions
|
||||
class="ml-2"
|
||||
@ -37,7 +32,7 @@
|
||||
/>
|
||||
|
||||
<p
|
||||
class="text-base text-base ml-2"
|
||||
class="text-base ml-2"
|
||||
:class="fileName ? 'text-gray-900 font-semibold' : 'text-gray-700'"
|
||||
>
|
||||
<span v-if="fileName" class="font-normal"
|
||||
@ -57,8 +52,6 @@
|
||||
<div
|
||||
v-if="file && isSubmittable"
|
||||
class="
|
||||
justify-center
|
||||
items-center
|
||||
gap-2
|
||||
flex
|
||||
justify-between
|
||||
@ -87,12 +80,7 @@
|
||||
flex flex-row
|
||||
justify-center
|
||||
items-center
|
||||
justify-center
|
||||
items-center
|
||||
gap-2
|
||||
flex
|
||||
justify-between
|
||||
items-center
|
||||
bg-gray-100
|
||||
pl-2
|
||||
rounded
|
||||
|
@ -1,17 +1,8 @@
|
||||
<template>
|
||||
<div class="flex flex-col overflow-y-hidden">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold">
|
||||
{{ 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">
|
||||
<PageHeader :title="t`Setup Your Workspace`" />
|
||||
<div class="flex-1 mx-4 overflow-y-auto">
|
||||
<div class="my-4" v-for="section in sections" :key="section.label">
|
||||
<h2 class="font-medium">{{ section.label }}</h2>
|
||||
<div class="flex mt-4 -mx-2">
|
||||
<div
|
||||
|
@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col" v-if="doc">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<BackLink />
|
||||
</template>
|
||||
<PageHeader :backLink="true">
|
||||
<template #actions>
|
||||
<StatusBadge :status="status" />
|
||||
<Button
|
||||
@ -199,7 +196,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import { getInvoiceStatus } from 'models/helpers';
|
||||
import BackLink from 'src/components/BackLink';
|
||||
import Button from 'src/components/Button';
|
||||
import FormControl from 'src/components/Controls/FormControl.vue';
|
||||
import DropdownWithActions from 'src/components/DropdownWithActions';
|
||||
@ -223,7 +219,6 @@ export default {
|
||||
Button,
|
||||
FormControl,
|
||||
DropdownWithActions,
|
||||
BackLink,
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
@ -273,9 +268,7 @@ export default {
|
||||
this.handleError(error);
|
||||
}
|
||||
this.printSettings = await fyo.getSingle('PrintSettings');
|
||||
this.companyName = (
|
||||
await fyo.getSingle('AccountingSettings')
|
||||
).companyName;
|
||||
this.companyName = (await fyo.getSingle('AccountingSettings')).companyName;
|
||||
|
||||
let query = this.$route.query;
|
||||
if (query.values && query.doctype === this.doctype) {
|
||||
|
@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<BackLink />
|
||||
</template>
|
||||
<PageHeader :backLink="true">
|
||||
<template #actions v-if="doc">
|
||||
<StatusBadge :status="status" />
|
||||
<DropdownWithActions class="ml-2" :actions="actions" />
|
||||
@ -128,7 +125,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import BackLink from 'src/components/BackLink';
|
||||
import Button from 'src/components/Button';
|
||||
import FormControl from 'src/components/Controls/FormControl.vue';
|
||||
import DropdownWithActions from 'src/components/DropdownWithActions';
|
||||
@ -147,7 +143,6 @@ export default {
|
||||
DropdownWithActions,
|
||||
StatusBadge,
|
||||
FormControl,
|
||||
BackLink,
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<div class="px-5 pb-16 text-base flex flex-col overflow-y-hidden">
|
||||
<div class="flex px-3">
|
||||
<div class="py-4 mr-3 w-7" v-if="hasImage"></div>
|
||||
<div class="mx-4 pb-16 text-base flex flex-col overflow-y-hidden">
|
||||
<!-- Title Row -->
|
||||
<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
|
||||
class="flex-1 text-gray-700"
|
||||
:columnCount="columns.length"
|
||||
@ -19,6 +22,8 @@
|
||||
</div>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<!-- Data Rows -->
|
||||
<div class="overflow-y-auto" v-if="data.length !== 0">
|
||||
<div
|
||||
class="px-3 flex hover:bg-gray-100 rounded-md"
|
||||
@ -46,6 +51,8 @@
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<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" />
|
||||
<p class="my-3 text-gray-800">{{ t`No entries found` }}</p>
|
||||
@ -65,7 +72,7 @@ import ListCell from './ListCell';
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
props: ['listConfig', 'filters'],
|
||||
props: { listConfig: Object, filters: Object, schemaName: String },
|
||||
emits: ['makeNewDoc'],
|
||||
components: {
|
||||
Row,
|
||||
@ -74,10 +81,12 @@ export default {
|
||||
Button,
|
||||
},
|
||||
watch: {
|
||||
listConfig(oldValue, newValue) {
|
||||
if (oldValue.doctype !== newValue.doctype) {
|
||||
this.setupColumnsAndData();
|
||||
schemaName(oldValue, newValue) {
|
||||
if (oldValue === newValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateData();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
@ -87,63 +96,46 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
columns() {
|
||||
return this.prepareColumns();
|
||||
},
|
||||
meta() {
|
||||
return fyo.getMeta(this.listConfig.doctype);
|
||||
const columns = this.listConfig?.columns ?? [];
|
||||
return columns
|
||||
.map((fieldname) => fyo.getField(this.schemaName, fieldname))
|
||||
.filter(Boolean);
|
||||
},
|
||||
hasImage() {
|
||||
return this.meta.hasField('image');
|
||||
return !!fyo.getField(this.schemaName, 'image');
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
await this.setupColumnsAndData();
|
||||
fyo.db.on(`change:${this.listConfig.doctype}`, () => {
|
||||
await this.updateData();
|
||||
/*
|
||||
TODO: need to set callback incase that schema has data changes
|
||||
fyo.db.on(`change:${this.schemaName}`, () => {
|
||||
this.updateData();
|
||||
});
|
||||
*/
|
||||
},
|
||||
methods: {
|
||||
async setupColumnsAndData() {
|
||||
this.doctype = this.listConfig.doctype;
|
||||
await this.updateData();
|
||||
},
|
||||
openForm(doc) {
|
||||
if (this.listConfig.formRoute) {
|
||||
routeTo(this.listConfig.formRoute(doc.name));
|
||||
return;
|
||||
}
|
||||
openQuickEdit({
|
||||
doctype: this.doctype,
|
||||
schemaName: this.schemaName,
|
||||
name: doc.name,
|
||||
});
|
||||
},
|
||||
async updateData(filters) {
|
||||
if (!filters) filters = this.getFilters();
|
||||
this.data = await fyo.db.getAll({
|
||||
doctype: this.doctype,
|
||||
if (!filters) {
|
||||
filters = { ...this.filters };
|
||||
}
|
||||
|
||||
this.data = await fyo.db.getAll(this.schemaName, {
|
||||
fields: ['*'],
|
||||
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>
|
||||
|
@ -1,26 +1,21 @@
|
||||
<template>
|
||||
<div class="flex flex-col">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold" v-if="title">
|
||||
{{ title }}
|
||||
</h1>
|
||||
</template>
|
||||
<PageHeader :title="title">
|
||||
<template #actions>
|
||||
<FilterDropdown
|
||||
ref="filterDropdown"
|
||||
@change="applyFilter"
|
||||
:fields="meta.fields"
|
||||
:fields="fields"
|
||||
/>
|
||||
<Button class="ml-2" :icon="true" type="primary" @click="makeNewDoc">
|
||||
<feather-icon name="plus" class="w-4 h-4 text-white" />
|
||||
</Button>
|
||||
<SearchBar class="ml-2" />
|
||||
</template>
|
||||
</PageHeader>
|
||||
<div class="flex-1 flex h-full">
|
||||
<List
|
||||
ref="list"
|
||||
:schemaName="schemaName"
|
||||
:listConfig="listConfig"
|
||||
:filters="filters"
|
||||
class="flex-1"
|
||||
@ -33,47 +28,36 @@
|
||||
import Button from 'src/components/Button';
|
||||
import FilterDropdown from 'src/components/FilterDropdown';
|
||||
import PageHeader from 'src/components/PageHeader';
|
||||
import SearchBar from 'src/components/SearchBar';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { routeTo } from 'src/utils';
|
||||
import List from './List';
|
||||
|
||||
export default {
|
||||
name: 'ListView',
|
||||
props: ['doctype', 'filters'],
|
||||
props: ['schemaName', 'filters'],
|
||||
components: {
|
||||
PageHeader,
|
||||
List,
|
||||
Button,
|
||||
SearchBar,
|
||||
FilterDropdown,
|
||||
},
|
||||
data() {
|
||||
return { listConfigs: undefined };
|
||||
return { listConfig: undefined };
|
||||
},
|
||||
async activated() {
|
||||
if (typeof this.filters === 'object') {
|
||||
this.$refs.filterDropdown.setFilter(this.filters);
|
||||
}
|
||||
|
||||
if (this.listConfigs === undefined) {
|
||||
this.listConfigs = (await import('./listConfig')).default;
|
||||
}
|
||||
this.listConfig = getListConfig(this.schemaName);
|
||||
},
|
||||
methods: {
|
||||
async makeNewDoc() {
|
||||
const doctype = this.listConfig.doctype;
|
||||
const doc = await fyo.doc.getNewDoc(doctype);
|
||||
if (this.listConfig.filters) {
|
||||
doc.set(this.listConfig.filters);
|
||||
}
|
||||
if (this.filters) {
|
||||
doc.set(this.filters);
|
||||
}
|
||||
let path = this.getFormPath(doc.name);
|
||||
const doc = await fyo.doc.getNewDoc(this.schemaName, this.filters ?? {});
|
||||
const path = this.getFormPath(doc.name);
|
||||
|
||||
routeTo(path);
|
||||
doc.on('afterSync', () => {
|
||||
let path = this.getFormPath(doc.name);
|
||||
const path = this.getFormPath(doc.name);
|
||||
this.$router.replace(path);
|
||||
});
|
||||
},
|
||||
@ -82,10 +66,10 @@ export default {
|
||||
},
|
||||
getFormPath(name) {
|
||||
let path = {
|
||||
path: `/list/${this.doctype}`,
|
||||
path: `/list/${this.schemaName}`,
|
||||
query: {
|
||||
edit: 1,
|
||||
doctype: this.doctype,
|
||||
schemaName: this.schemaName,
|
||||
name,
|
||||
},
|
||||
};
|
||||
@ -104,20 +88,22 @@ export default {
|
||||
},
|
||||
},
|
||||
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() {
|
||||
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>
|
||||
|
@ -1,10 +1,7 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<div class="flex flex-col flex-1">
|
||||
<PageHeader class="bg-white z-10">
|
||||
<template #title>
|
||||
<BackLink />
|
||||
</template>
|
||||
<PageHeader :backLink="true" class="bg-white z-10">
|
||||
<template #actions>
|
||||
<Button
|
||||
class="text-gray-900 text-xs ml-2"
|
||||
@ -53,7 +50,6 @@
|
||||
<script>
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { Verb } from 'fyo/telemetry/types';
|
||||
import BackLink from 'src/components/BackLink';
|
||||
import Button from 'src/components/Button';
|
||||
import PageHeader from 'src/components/PageHeader';
|
||||
import SearchBar from 'src/components/SearchBar';
|
||||
@ -68,7 +64,6 @@ export default {
|
||||
PageHeader,
|
||||
SearchBar,
|
||||
Button,
|
||||
BackLink,
|
||||
TwoColumnForm,
|
||||
},
|
||||
data() {
|
||||
|
@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col max-w-full">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold">{{ report.title }}</h1>
|
||||
</template>
|
||||
<PageHeader :title="report.title">
|
||||
<template #actions>
|
||||
<DropdownWithActions
|
||||
v-for="group of actionGroups"
|
||||
@ -15,7 +12,6 @@
|
||||
{{ group.label }}
|
||||
</DropdownWithActions>
|
||||
<DropdownWithActions class="ml-2" :actions="actions" />
|
||||
<SearchBar class="ml-2" />
|
||||
</template>
|
||||
</PageHeader>
|
||||
<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 PageHeader from 'src/components/PageHeader';
|
||||
import Row from 'src/components/Row';
|
||||
import SearchBar from 'src/components/SearchBar';
|
||||
import WithScroll from 'src/components/WithScroll';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { h, markRaw } from 'vue';
|
||||
@ -155,7 +150,6 @@ export default {
|
||||
components: {
|
||||
PageHeader,
|
||||
Button,
|
||||
SearchBar,
|
||||
Row,
|
||||
FormControl,
|
||||
WithScroll,
|
||||
@ -196,7 +190,7 @@ export default {
|
||||
});
|
||||
},
|
||||
async fetchReportData() {
|
||||
let data = await getReportData(this.report.method, this.filters)
|
||||
let data = await getReportData(this.report.method, this.filters);
|
||||
|
||||
let rows;
|
||||
if (data.rows) {
|
||||
@ -345,7 +339,7 @@ export default {
|
||||
} else if (this.usePagination) {
|
||||
return 'calc(100vh - 13rem)';
|
||||
}
|
||||
|
||||
|
||||
return 'calc(100vh - 12rem)';
|
||||
},
|
||||
sliceIndex() {
|
||||
|
@ -1,12 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-col overflow-hidden">
|
||||
<PageHeader>
|
||||
<template #title>
|
||||
<h1 class="text-2xl font-bold">
|
||||
{{ t`Settings` }}
|
||||
</h1>
|
||||
</template>
|
||||
</PageHeader>
|
||||
<PageHeader :title="t`Settings`" />
|
||||
<div class="flex justify-center flex-1 mb-8 mt-2">
|
||||
<div
|
||||
class="border rounded-lg shadow h-full flex flex-col justify-between"
|
||||
|
@ -5,9 +5,9 @@ import GetStarted from 'src/pages/GetStarted.vue';
|
||||
// import DataImport from 'src/pages/DataImport.vue';
|
||||
// import InvoiceForm from 'src/pages/InvoiceForm.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 QuickEditForm from 'src/pages/QuickEditForm.vue';
|
||||
import QuickEditForm from 'src/pages/QuickEditForm.vue';
|
||||
// import Report from 'src/pages/Report.vue';
|
||||
import Settings from 'src/pages/Settings/Settings.vue';
|
||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||
@ -54,8 +54,9 @@ const routes: RouteRecordRaw[] = [
|
||||
edit: (route) => route.query,
|
||||
},
|
||||
},
|
||||
*/
|
||||
{
|
||||
path: '/list/:doctype/:fieldname?/:value?',
|
||||
path: '/list/:schemaName/:fieldname?/:value?',
|
||||
name: 'ListView',
|
||||
components: {
|
||||
default: ListView,
|
||||
@ -63,7 +64,7 @@ const routes: RouteRecordRaw[] = [
|
||||
},
|
||||
props: {
|
||||
default: (route) => {
|
||||
const { doctype, fieldname, value } = route.params;
|
||||
const { schemaName, fieldname, value } = route.params;
|
||||
let { filters } = route.params;
|
||||
|
||||
if (filters === undefined && fieldname && value) {
|
||||
@ -72,13 +73,14 @@ const routes: RouteRecordRaw[] = [
|
||||
}
|
||||
|
||||
return {
|
||||
doctype,
|
||||
schemaName,
|
||||
filters,
|
||||
};
|
||||
},
|
||||
edit: (route) => route.query,
|
||||
},
|
||||
},
|
||||
/*
|
||||
{
|
||||
path: '/print/:doctype/:name',
|
||||
name: 'PrintView',
|
||||
@ -108,8 +110,7 @@ const routes: RouteRecordRaw[] = [
|
||||
name: 'Data Import',
|
||||
component: DataImport,
|
||||
},
|
||||
*/
|
||||
{
|
||||
*/ {
|
||||
path: '/settings',
|
||||
name: 'Settings',
|
||||
component: Settings,
|
||||
|
@ -52,25 +52,25 @@ function getCompleteSidebar(): SidebarConfig {
|
||||
label: t`Sales Invoices`,
|
||||
name: 'sales-invoices',
|
||||
route: '/list/SalesInvoice',
|
||||
doctype: 'SalesInvoice',
|
||||
schemaName: 'SalesInvoice',
|
||||
},
|
||||
{
|
||||
label: t`Payments`,
|
||||
name: 'payments',
|
||||
route: '/list/Payment/paymentType/Receive',
|
||||
doctype: 'Payment',
|
||||
schemaName: 'Payment',
|
||||
},
|
||||
{
|
||||
label: t`Customers`,
|
||||
name: 'customers',
|
||||
route: '/list/Customer',
|
||||
doctype: 'Customer',
|
||||
route: '/list/Party/role/Customer',
|
||||
schemaName: 'Party',
|
||||
},
|
||||
{
|
||||
label: t`Sales Items`,
|
||||
name: 'sales-items',
|
||||
route: '/list/Item/for/sales',
|
||||
doctype: 'Item',
|
||||
schemaName: 'Item',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -84,25 +84,25 @@ function getCompleteSidebar(): SidebarConfig {
|
||||
label: t`Purchase Invoices`,
|
||||
name: 'purchase-invoices',
|
||||
route: '/list/PurchaseInvoice',
|
||||
doctype: 'PurchaseInvoice',
|
||||
schemaName: 'PurchaseInvoice',
|
||||
},
|
||||
{
|
||||
label: t`Payments`,
|
||||
name: 'payments',
|
||||
route: '/list/Payment/paymentType/Pay',
|
||||
doctype: 'Payment',
|
||||
schemaName: 'Payment',
|
||||
},
|
||||
{
|
||||
label: t`Suppliers`,
|
||||
name: 'suppliers',
|
||||
route: '/list/Supplier',
|
||||
doctype: 'Supplier',
|
||||
route: '/list/Party/role/Supplier',
|
||||
schemaName: 'Party',
|
||||
},
|
||||
{
|
||||
label: t`Purchase Items`,
|
||||
name: 'purchase-items',
|
||||
route: '/list/Item/for/purchases',
|
||||
doctype: 'Item',
|
||||
schemaName: 'Item',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -116,13 +116,19 @@ function getCompleteSidebar(): SidebarConfig {
|
||||
label: t`Journal Entry`,
|
||||
name: 'journal-entry',
|
||||
route: '/list/JournalEntry',
|
||||
doctype: 'JournalEntry',
|
||||
schemaName: 'JournalEntry',
|
||||
},
|
||||
{
|
||||
label: t`Common Items`,
|
||||
name: 'common-items',
|
||||
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`,
|
||||
name: 'taxes',
|
||||
route: '/list/Tax',
|
||||
doctype: 'Tax',
|
||||
schemaName: 'Tax',
|
||||
},
|
||||
{
|
||||
label: t`Data Import`,
|
||||
|
@ -44,6 +44,6 @@ export interface SidebarItem {
|
||||
label: string;
|
||||
name: string;
|
||||
route: string;
|
||||
doctype?: string;
|
||||
schemaName?: string;
|
||||
hidden?: () => boolean;
|
||||
}
|
||||
|
@ -445,7 +445,7 @@
|
||||
`Setup Complete`,`اكتمل الإعداد`
|
||||
`Setup Wizard`,`معالج الإعداد`
|
||||
`Setup your organization`,`إعداد منظمتك`
|
||||
`Setup your workspace`,`إعداد مساحة العمل الخاصة بك`
|
||||
`Setup Your Workspace`,`إعداد مساحة العمل الخاصة بك`
|
||||
`Show Me`,`أرني`
|
||||
`Smallest Currency Fraction Value`,`أصغر قيمة لكسر العملة`
|
||||
`Softwares`,`البرامج`
|
||||
|
Can't render this file because it has a wrong number of fields in line 62.
|
@ -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 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 workspace`,`Configura el teu espai de treball`
|
||||
`Setup Your Workspace`,`Configura el teu espai de treball`
|
||||
`Show Me`,`Mostra'm`
|
||||
`Smallest Currency Fraction Value`,`Valor de fracció de la divisa més petit`
|
||||
`Softwares`,`Programari`
|
||||
|
Can't render this file because it has a wrong number of fields in line 432.
|
@ -397,7 +397,7 @@
|
||||
`Setup Complete`,`Einrichtung abgeschlossen`
|
||||
`Setup Wizard`,`Einrichtungsassistent`
|
||||
`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`
|
||||
`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.`
|
||||
|
Can't render this file because it has a wrong number of fields in line 33.
|
@ -397,7 +397,7 @@
|
||||
`Setup Complete`,`Configuration terminée`
|
||||
`Setup Wizard`,`Assistant de configuration`
|
||||
`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`
|
||||
`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.`
|
||||
|
Can't render this file because it has a wrong number of fields in line 57.
|
@ -397,7 +397,7 @@
|
||||
`Setup Complete`,`Configuração Completa`
|
||||
`Setup Wizard`,`Assistente de Configuraçã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`
|
||||
`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.`
|
||||
|
Can't render this file because it has a wrong number of fields in line 57.
|
Loading…
x
Reference in New Issue
Block a user