mirror of
https://github.com/frappe/books.git
synced 2024-12-22 19:09:01 +00:00
incr: small fixes
This commit is contained in:
parent
986d4da23e
commit
37dc3e911f
@ -86,6 +86,10 @@ export class Doc extends Observable<DocValue | Doc[]> {
|
||||
return this._notInserted;
|
||||
}
|
||||
|
||||
get inserted(): boolean {
|
||||
return !this._notInserted;
|
||||
}
|
||||
|
||||
get tableFields(): TargetField[] {
|
||||
return this.schema.fields.filter(
|
||||
(f) => f.fieldtype === FieldTypeEnum.Table
|
||||
|
6
main.ts
6
main.ts
@ -84,7 +84,7 @@ export class Main {
|
||||
.ELECTRON_NODE_INTEGRATION as unknown as boolean,
|
||||
},
|
||||
frame: this.isLinux,
|
||||
resizable: true,
|
||||
resizable: false,
|
||||
};
|
||||
if (this.isDevelopment || this.isLinux) {
|
||||
Object.assign(options, { icon: this.icon });
|
||||
@ -139,6 +139,10 @@ export class Main {
|
||||
this.mainWindow = null;
|
||||
});
|
||||
|
||||
this.mainWindow.on('will-resize', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
this.mainWindow.webContents.on('did-finish-load', () => {
|
||||
if (this.mainWindow === null) {
|
||||
return;
|
||||
|
@ -13,6 +13,7 @@ import { getMapFromList } from 'utils';
|
||||
export class BalanceSheet extends AccountReport {
|
||||
static title = t`Balance Sheet`;
|
||||
static reportName = 'balance-sheet';
|
||||
loading: boolean = false;
|
||||
|
||||
get rootTypes(): AccountRootType[] {
|
||||
return [
|
||||
@ -23,6 +24,7 @@ export class BalanceSheet extends AccountReport {
|
||||
}
|
||||
|
||||
async setReportData(filter?: string) {
|
||||
this.loading = true;
|
||||
if (filter !== 'hideGroupAmounts') {
|
||||
await this._setRawData();
|
||||
}
|
||||
@ -55,6 +57,7 @@ export class BalanceSheet extends AccountReport {
|
||||
this.reportData = await this.getReportDataFromRows(
|
||||
getMapFromList(rootTypeRows, 'rootType')
|
||||
);
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
async getReportDataFromRows(
|
||||
|
@ -23,6 +23,7 @@ export class GeneralLedger extends LedgerReport {
|
||||
static title = t`General Ledger`;
|
||||
static reportName = 'general-ledger';
|
||||
usePagination: boolean = true;
|
||||
loading: boolean = false;
|
||||
|
||||
ascending: boolean = false;
|
||||
reverted: boolean = false;
|
||||
@ -42,6 +43,7 @@ export class GeneralLedger extends LedgerReport {
|
||||
}
|
||||
|
||||
async setReportData(filter?: string) {
|
||||
this.loading = true;
|
||||
let sort = true;
|
||||
if (filter !== 'grouped' || this._rawData.length === 0) {
|
||||
await this._setRawData();
|
||||
@ -78,6 +80,7 @@ export class GeneralLedger extends LedgerReport {
|
||||
});
|
||||
|
||||
this.reportData = this._convertEntriesToReportData(consolidated);
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
_setIndexOnEntries(map: GroupedMap) {
|
||||
|
@ -19,6 +19,7 @@ export abstract class BaseGSTR extends Report {
|
||||
transferType?: TransferType;
|
||||
usePagination: boolean = true;
|
||||
gstrRows?: GSTRRow[];
|
||||
loading: boolean = false;
|
||||
|
||||
abstract gstrType: GSTRType;
|
||||
|
||||
@ -46,10 +47,12 @@ export abstract class BaseGSTR extends Report {
|
||||
}
|
||||
|
||||
async setReportData(): Promise<void> {
|
||||
this.loading = true;
|
||||
const gstrRows = await this.getGstrRows();
|
||||
const filteredRows = this.filterGstrRows(gstrRows);
|
||||
this.gstrRows = filteredRows;
|
||||
this.reportData = this.getReportDataFromGSTRRows(filteredRows);
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
getReportDataFromGSTRRows(gstrRows: GSTRRow[]): ReportData {
|
||||
|
@ -17,12 +17,14 @@ import {
|
||||
export class ProfitAndLoss extends AccountReport {
|
||||
static title = t`Profit And Loss`;
|
||||
static reportName = 'profit-and-loss';
|
||||
loading: boolean = false;
|
||||
|
||||
get rootTypes(): AccountRootType[] {
|
||||
return [AccountRootTypeEnum.Income, AccountRootTypeEnum.Expense];
|
||||
}
|
||||
|
||||
async setReportData(filter?: string) {
|
||||
this.loading = true;
|
||||
if (filter !== 'hideGroupAmounts') {
|
||||
await this._setRawData();
|
||||
}
|
||||
@ -66,6 +68,7 @@ export class ProfitAndLoss extends AccountReport {
|
||||
incomeRoot,
|
||||
expenseRoot
|
||||
);
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
async getReportDataFromRows(
|
||||
|
@ -14,6 +14,7 @@ export abstract class Report extends Observable<RawValue> {
|
||||
filters: Field[] = [];
|
||||
reportData: ReportData;
|
||||
usePagination: boolean = false;
|
||||
abstract loading: boolean;
|
||||
|
||||
constructor(fyo: Fyo) {
|
||||
super();
|
||||
|
@ -36,6 +36,7 @@ export class TrialBalance extends AccountReport {
|
||||
fromDate?: string;
|
||||
toDate?: string;
|
||||
hideGroupAmounts: boolean = false;
|
||||
loading: boolean = false;
|
||||
|
||||
_rawData: LedgerEntry[] = [];
|
||||
_dateRanges?: DateRange[];
|
||||
@ -53,6 +54,7 @@ export class TrialBalance extends AccountReport {
|
||||
}
|
||||
|
||||
async setReportData(filter?: string) {
|
||||
this.loading = true;
|
||||
if (filter !== 'hideGroupAmounts') {
|
||||
await this._setRawData();
|
||||
}
|
||||
@ -74,6 +76,7 @@ export class TrialBalance extends AccountReport {
|
||||
.filter((row) => !!row.rootNode);
|
||||
|
||||
this.reportData = await this.getReportDataFromRows(rootTypeRows);
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
async getReportDataFromRows(
|
||||
|
@ -161,10 +161,10 @@ export default {
|
||||
format: { type: Function, default: (n) => n.toFixed(1) },
|
||||
formatY: { type: Function, default: prefixFormat },
|
||||
formatX: { type: Function, default: (v) => v },
|
||||
fontSize: { type: Number, default: 25 },
|
||||
fontSize: { type: Number, default: 22 },
|
||||
fontColor: { type: String, default: '#415668' },
|
||||
bottom: { type: Number, default: 0 },
|
||||
width: { type: Number, default: 34 },
|
||||
width: { type: Number, default: 28 },
|
||||
left: { type: Number, default: 65 },
|
||||
radius: { type: Number, default: 17 },
|
||||
extendGridX: { type: Number, default: -20 },
|
||||
|
@ -160,7 +160,7 @@ export default {
|
||||
format: { type: Function, default: (n) => n.toFixed(1) },
|
||||
formatY: { type: Function, default: prefixFormat },
|
||||
formatX: { type: Function, default: (v) => v },
|
||||
fontSize: { type: Number, default: 18 },
|
||||
fontSize: { type: Number, default: 20 },
|
||||
fontColor: { type: String, default: '#415668' },
|
||||
bottom: { type: Number, default: 0 },
|
||||
left: { type: Number, default: 55 },
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="overflow-hidden flex flex-col h-full">
|
||||
<!-- Report Outer Container -->
|
||||
<div class="overflow-hidden">
|
||||
<div class="overflow-hidden" v-if="dataSlice.length">
|
||||
<!--Title Row -->
|
||||
<div
|
||||
class="w-full overflow-x-hidden flex items-center border-b"
|
||||
@ -61,6 +61,9 @@
|
||||
</WithScroll>
|
||||
<!-- Report Rows Container -->
|
||||
</div>
|
||||
<p v-else class="w-full text-center mt-20 text-gray-800 text-base">
|
||||
{{ report.loading ? t`Loading Report...` : t`No Values to be Displayed` }}
|
||||
</p>
|
||||
|
||||
<!-- Pagination Footer -->
|
||||
<div class="mt-auto flex-shrink-0" v-if="report.usePagination">
|
||||
|
@ -179,7 +179,7 @@ export default {
|
||||
}
|
||||
|
||||
// handle rename
|
||||
if (this.autosave && df.fieldname === 'name' && !this.doc.notInserted) {
|
||||
if (this.autosave && df.fieldname === 'name' && this.doc.inserted) {
|
||||
return this.doc.rename(value);
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ export default {
|
||||
async onChangeCommon(df, value, oldValue) {
|
||||
let isSet = false;
|
||||
try {
|
||||
isSet = this.doc.set(df.fieldname, value);
|
||||
isSet = await this.doc.set(df.fieldname, value);
|
||||
} catch (err) {
|
||||
this.errors[df.fieldname] = getErrorMessage(err, this.doc);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Pagination Footer -->
|
||||
<div class="mt-auto">
|
||||
<div class="mt-auto" v-if="data?.length">
|
||||
<hr />
|
||||
<Paginator :item-count="data.length" @index-change="setPageIndices" />
|
||||
</div>
|
||||
|
@ -58,6 +58,7 @@
|
||||
v-if="titleField"
|
||||
:df="titleField"
|
||||
:value="doc[titleField.fieldname]"
|
||||
:read-only="doc.inserted"
|
||||
@change="(value) => valueChange(titleField, value)"
|
||||
@input="setTitleSize"
|
||||
/>
|
||||
|
@ -7,7 +7,7 @@ export function getSidebarConfig(): SidebarConfig {
|
||||
return getFilteredSidebar(sideBar);
|
||||
}
|
||||
|
||||
export function getFilteredSidebar(sideBar: SidebarConfig): SidebarConfig {
|
||||
function getFilteredSidebar(sideBar: SidebarConfig): SidebarConfig {
|
||||
return sideBar.filter((root) => {
|
||||
root.items = root.items?.filter((item) => {
|
||||
if (item.hidden !== undefined) {
|
||||
|
@ -283,7 +283,7 @@ function getDeleteAction(doc: Doc): Action {
|
||||
async action() {
|
||||
const res = await deleteDocWithPrompt(doc);
|
||||
if (res) {
|
||||
routeTo(`/list/${doc.schemaName}`);
|
||||
router.back();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user