From d7dc08a45d83915552fd96ee1bc33698cf92477d Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 24 Oct 2019 16:09:57 +0530 Subject: [PATCH] feat: Settings - TabGeneral --- .../AccountingSettings/AccountingSettings.js | 15 +++-- src/App.vue | 10 ++-- src/components/TwoColumnForm.vue | 40 +++++++++++++ src/pages/Settings.vue | 31 +++++++--- src/pages/TabGeneral.vue | 58 +++++++++++++++++++ src/router.js | 1 - src/sidebarConfig.js | 15 ++++- src/theme.js | 4 ++ tailwind.config.js | 3 +- 9 files changed, 159 insertions(+), 18 deletions(-) create mode 100644 src/components/TwoColumnForm.vue create mode 100644 src/pages/TabGeneral.vue create mode 100644 src/theme.js diff --git a/models/doctype/AccountingSettings/AccountingSettings.js b/models/doctype/AccountingSettings/AccountingSettings.js index 1b71ac59..66677ab5 100644 --- a/models/doctype/AccountingSettings/AccountingSettings.js +++ b/models/doctype/AccountingSettings/AccountingSettings.js @@ -1,6 +1,4 @@ -const countryList = Object.keys( - require('../../../fixtures/countryInfo.json') -).sort(); +const countryList = Object.keys(require('../../../fixtures/countryInfo.json')).sort(); module.exports = { name: 'AccountingSettings', @@ -29,7 +27,7 @@ module.exports = { { fieldname: 'country', label: 'Country', - fieldtype: 'Autocomplete', + fieldtype: 'AutoComplete', required: 1, getList: () => countryList }, @@ -85,5 +83,14 @@ module.exports = { fieldtype: 'Date', required: 1 } + ], + quickEditFields: [ + 'fullname', + 'email', + 'companyName', + 'country', + 'currency', + 'fiscalYearStart', + 'fiscalYearEnd', ] }; diff --git a/src/App.vue b/src/App.vue index 2964ffc3..fcea67d9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -55,9 +55,7 @@ export default { Settings }, mounted() { - if (this.$route.path === '/settings') { - this.showSettings = true; - } else if (!localStorage.dbPath) { + if (!localStorage.dbPath) { this.showDatabaseSelector = true; } else { frappe.events.trigger('connect-database', localStorage.dbPath); @@ -70,7 +68,11 @@ export default { }); frappe.events.on('show-desk', () => { - this.showDesk = true; + if (this.$route.path === '/settings') { + this.showSettings = true; + } else { + this.showDesk = true; + } this.showSetupWizard = false; this.showDatabaseSelector = false; }); diff --git a/src/components/TwoColumnForm.vue b/src/components/TwoColumnForm.vue new file mode 100644 index 00000000..c6f08ead --- /dev/null +++ b/src/components/TwoColumnForm.vue @@ -0,0 +1,40 @@ + + diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 8d098214..5849e0b3 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -1,32 +1,43 @@ + diff --git a/src/router.js b/src/router.js index 9f37f937..0600c073 100644 --- a/src/router.js +++ b/src/router.js @@ -109,6 +109,5 @@ const routes = [ ]; let router = new Router({ routes }); -router.replace('/list/Item'); export default router; diff --git a/src/sidebarConfig.js b/src/sidebarConfig.js index 4f1f8fe5..3fbfeb9b 100644 --- a/src/sidebarConfig.js +++ b/src/sidebarConfig.js @@ -1,10 +1,12 @@ import frappe from 'frappejs'; +import { remote } from 'electron'; import { _ } from 'frappejs/utils'; import DashboardIcon from './components/Icons/Dashboard'; import SalesIcon from './components/Icons/Sales'; import PurchasesIcon from './components/Icons/Purchases'; import ReportsIcon from './components/Icons/Reports'; import SettingsIcon from './components/Icons/Settings'; +import theme from '@/theme'; const config = { getTitle: async () => { @@ -105,7 +107,18 @@ const config = { title: _('Settings'), icon: SettingsIcon, action() { - window.open('/index.html#/settings'); + let child = new remote.BrowserWindow({ + parent: remote.getCurrentWindow(), + frame: false, + width: 460, + height: 577, + backgroundColor: theme.backgroundColor.gray['200'], + webPreferences: { + webSecurity: false, + nodeIntegration: true + } + }); + child.loadURL('http://localhost:8000/#/settings'); } } ] diff --git a/src/theme.js b/src/theme.js new file mode 100644 index 00000000..32d4ca18 --- /dev/null +++ b/src/theme.js @@ -0,0 +1,4 @@ +import resolveConfig from 'tailwindcss/resolveConfig'; +import tailwindConfig from '../tailwind.config'; + +export default resolveConfig(tailwindConfig).theme; diff --git a/tailwind.config.js b/tailwind.config.js index 70a4e53b..6659825b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -40,7 +40,8 @@ module.exports = { } }, variants: { - margin: ['responsive', 'first', 'hover', 'focus'] + margin: ['responsive', 'first', 'hover', 'focus'], + backgroundColor: ['responsive', 'first', 'hover', 'focus', 'focus-within'], }, plugins: [] };