2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

Added date filter for a quater, added download path setup

This commit is contained in:
Piyush Singhania 2021-12-09 00:13:19 +05:30 committed by Alan
parent b7980c6a56
commit 482f7875bb
2 changed files with 37 additions and 3 deletions

View File

@ -1,10 +1,22 @@
const title = 'GSTR 1'; const title = 'GSTR 1';
import baseConfig from './BaseViewConfig'; import baseConfig from './BaseViewConfig';
import { DateTime } from 'luxon';
const filterFields = baseConfig.filterFields;
filterFields.forEach((field) => {
if (field.fieldname === 'toDate') {
field.default = DateTime.local().toISODate();
}
else if(field.fieldname === 'fromDate') {
field.default = DateTime.local().minus({months: 3}).toISODate();
}
});
export default { export default {
title: title, title: title,
method: 'gstr-1', method: 'gstr-1',
filterFields: baseConfig.filterFields, filterFields,
linkFields: baseConfig.linkFields, linkFields: baseConfig.linkFields,
getColumns: baseConfig.getColumns getColumns: baseConfig.getColumns,
}; };

View File

@ -102,6 +102,8 @@ import Row from '@/components/Row';
import WithScroll from '@/components/WithScroll'; import WithScroll from '@/components/WithScroll';
import FormControl from '@/components/Controls/FormControl'; import FormControl from '@/components/Controls/FormControl';
import reportViewConfig from '@/../reports/view'; import reportViewConfig from '@/../reports/view';
import { ipcRenderer } from 'electron';
import { IPC_ACTIONS } from '@/messages';
export default { export default {
name: 'Report', name: 'Report',
@ -271,9 +273,29 @@ export default {
this.loading ? 'text-gray-100' : 'text-gray-900', this.loading ? 'text-gray-100' : 'text-gray-900',
]; ];
}, },
downloadAsJson() { async downloadAsJson() {
const savePath = await this.getSavePath();
console.log('download complete'); console.log('download complete');
}, },
async getSavePath() {
const options = {
title: this._('Select folder'),
defaultPath: `${this.reportName}.json`,
};
let { filePath } = await ipcRenderer.invoke(
IPC_ACTIONS.GET_SAVE_FILEPATH,
options
);
if (filePath) {
if (!filePath.endsWith('.json')) {
filePath = filePath + '.json';
}
}
return filePath;
},
}, },
computed: { computed: {
columns() { columns() {