diff --git a/models/doctype/PrintSettings/PrintSettings.js b/models/doctype/PrintSettings/PrintSettings.js new file mode 100644 index 00000000..4f2da28e --- /dev/null +++ b/models/doctype/PrintSettings/PrintSettings.js @@ -0,0 +1,64 @@ +module.exports = { + name: 'PrintSettings', + label: 'Print Settings', + isSingle: 1, + isChild: 0, + fields: [ + { + fieldname: 'logo', + label: 'Logo', + fieldtype: 'AttachImage' + }, + { + fieldname: 'companyName', + label: 'Company Name', + fieldtype: 'Data' + }, + { + fieldname: 'email', + label: 'Email', + fieldtype: 'Data' + }, + { + fieldname: 'displayLogo', + label: 'Display Logo in Invoice', + fieldtype: 'Check' + }, + { + fieldname: 'phone', + label: 'Phone', + fieldtype: 'Data' + }, + { + fieldname: 'address', + label: 'Address', + fieldtype: 'Link', + target: 'Address', + inline: true + }, + { + fieldname: 'gstin', + label: 'GSTIN', + fieldtype: 'Data' + }, + { + fieldname: 'template', + label: 'Template', + fieldtype: 'Select', + options: ['Basic', 'Modern'], + default: 'Basic' + }, + { + fieldname: 'color', + label: 'Theme Color', + fieldtype: 'Data' + }, + { + fieldname: 'font', + label: 'Font', + fieldtype: 'Select', + options: ['Inter', 'Roboto'], + default: 'Inter' + } + ] +}; diff --git a/models/index.js b/models/index.js index 012556a2..7fd67096 100644 --- a/models/index.js +++ b/models/index.js @@ -65,6 +65,8 @@ module.exports = { EventSettings: require('./doctype/EventSettings/EventSettings'), Email: require('./doctype/Email/Email'), - EmailAccount: require('./doctype/EmailAccount/EmailAccount') + EmailAccount: require('./doctype/EmailAccount/EmailAccount'), + + PrintSettings: require('./doctype/PrintSettings/PrintSettings') } }; diff --git a/src-electron/main.js b/src-electron/main.js index ae7a5b9d..5ca37895 100644 --- a/src-electron/main.js +++ b/src-electron/main.js @@ -1,5 +1,6 @@ const { app, BrowserWindow, ipcMain } = require('electron'); const setupMenu = require('./menu'); +const theme = require('../src/theme'); let mainWindow; let winURL; @@ -48,6 +49,26 @@ function createWindow() { setupMenu(); } +function createSettingsWindow(tab = 'General') { + let settingsWindow = new BrowserWindow({ + parent: mainWindow, + frame: false, + width: 460, + height: 577, + backgroundColor: theme.backgroundColor.gray['200'], + webPreferences: { + webSecurity: false, + nodeIntegration: true + } + }); + + settingsWindow.loadURL(`${winURL}/#/settings/${tab}`); +} + +ipcMain.on('open-settings-window', tab => { + createSettingsWindow(tab); +}); + ipcMain.on('reload-main-window', () => { mainWindow.reload(); }); diff --git a/src/components/WindowControls.vue b/src/components/WindowControls.vue index 0076d1a4..368af1fa 100644 --- a/src/components/WindowControls.vue +++ b/src/components/WindowControls.vue @@ -1,29 +1,55 @@ diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue deleted file mode 100644 index 577e5503..00000000 --- a/src/pages/Settings.vue +++ /dev/null @@ -1,102 +0,0 @@ - - diff --git a/src/pages/Settings/SettingSection.vue b/src/pages/Settings/SettingSection.vue deleted file mode 100644 index 2ac40c00..00000000 --- a/src/pages/Settings/SettingSection.vue +++ /dev/null @@ -1,40 +0,0 @@ - - diff --git a/src/pages/Settings/Settings.vue b/src/pages/Settings/Settings.vue index 4b338708..d1888f07 100644 --- a/src/pages/Settings/Settings.vue +++ b/src/pages/Settings/Settings.vue @@ -1,32 +1,102 @@ diff --git a/src/pages/TabGeneral.vue b/src/pages/Settings/TabGeneral.vue similarity index 87% rename from src/pages/TabGeneral.vue rename to src/pages/Settings/TabGeneral.vue index fcb57653..35a76b67 100644 --- a/src/pages/TabGeneral.vue +++ b/src/pages/Settings/TabGeneral.vue @@ -1,6 +1,6 @@ @@ -45,6 +45,7 @@ export default { fields() { let meta = frappe.getMeta('AccountingSettings'); return [ + 'companyName', 'country', 'bankName', 'currency', diff --git a/src/pages/Settings/TabInvoice.vue b/src/pages/Settings/TabInvoice.vue new file mode 100644 index 00000000..d3e98e07 --- /dev/null +++ b/src/pages/Settings/TabInvoice.vue @@ -0,0 +1,104 @@ + + diff --git a/src/pages/TabSystem.vue b/src/pages/Settings/TabSystem.vue similarity index 100% rename from src/pages/TabSystem.vue rename to src/pages/Settings/TabSystem.vue diff --git a/src/pages/Settings/utils.js b/src/pages/Settings/utils.js new file mode 100644 index 00000000..38e85397 --- /dev/null +++ b/src/pages/Settings/utils.js @@ -0,0 +1,5 @@ +import { ipcRenderer } from 'electron'; + +export function openSettings(tab = 'General') { + ipcRenderer.send('open-settings-window', tab); +}