mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
Merge branch 'master' of https://github.com/frappe/books
This commit is contained in:
commit
307083d7fe
@ -4,7 +4,7 @@
|
|||||||
class="h-screen flex flex-col font-sans overflow-hidden antialiased"
|
class="h-screen flex flex-col font-sans overflow-hidden antialiased"
|
||||||
>
|
>
|
||||||
<WindowsTitleBar
|
<WindowsTitleBar
|
||||||
v-if="['Windows', 'Linux'].includes(platform)"
|
v-if="platform === 'Windows'"
|
||||||
@close="reloadMainWindowOnSettingsClose"
|
@close="reloadMainWindowOnSettingsClose"
|
||||||
/>
|
/>
|
||||||
<Desk class="flex-1" v-if="activeScreen === 'Desk'" />
|
<Desk class="flex-1" v-if="activeScreen === 'Desk'" />
|
||||||
|
@ -11,6 +11,7 @@ import { getMainWindowSize } from './screenSize';
|
|||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
const isMac = process.platform === 'darwin';
|
const isMac = process.platform === 'darwin';
|
||||||
|
const isLinux = process.platform === 'linux';
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
@ -35,7 +36,7 @@ function createWindow() {
|
|||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true
|
nodeIntegration: true
|
||||||
},
|
},
|
||||||
frame: false,
|
frame: isLinux,
|
||||||
resizable: true
|
resizable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ function createWindow() {
|
|||||||
function createSettingsWindow(tab = 'General') {
|
function createSettingsWindow(tab = 'General') {
|
||||||
let settingsWindow = new BrowserWindow({
|
let settingsWindow = new BrowserWindow({
|
||||||
parent: mainWindow,
|
parent: mainWindow,
|
||||||
frame: false,
|
frame: isLinux,
|
||||||
width: 460,
|
width: 460,
|
||||||
height: 577,
|
height: 577,
|
||||||
backgroundColor: theme.backgroundColor.gray['200'],
|
backgroundColor: theme.backgroundColor.gray['200'],
|
||||||
|
@ -58,7 +58,7 @@ export default {
|
|||||||
'px-2 py-1': this.size === 'small',
|
'px-2 py-1': this.size === 'small',
|
||||||
'bg-gray-100': this.background
|
'bg-gray-100': this.background
|
||||||
},
|
},
|
||||||
'focus:outline-none focus:bg-gray-200 rounded w-full text-gray-900'
|
'focus:outline-none focus:bg-gray-200 rounded w-full text-gray-900 placeholder-gray-400'
|
||||||
];
|
];
|
||||||
|
|
||||||
return this.getInputClassesFromProp(classes);
|
return this.getInputClassesFromProp(classes);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div
|
<div
|
||||||
class="absolute left-0 pl-2 text-gray-600 pointer-events-none"
|
class="absolute left-0 pl-2 text-gray-400 pointer-events-none"
|
||||||
v-if="!value"
|
v-if="!value"
|
||||||
>
|
>
|
||||||
{{ inputPlaceholder }}
|
{{ inputPlaceholder }}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<span v-if="value">
|
<span v-if="value">
|
||||||
{{ formatValue ? formatValue(value) : value }}
|
{{ formatValue ? formatValue(value) : value }}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-gray-600" v-else>
|
<span class="text-gray-400" v-else>
|
||||||
<template v-if="placeholder">
|
<template v-if="placeholder">
|
||||||
{{ placeholder }}
|
{{ placeholder }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="py-10 flex-1 bg-white window-drag">
|
<div
|
||||||
|
class="py-10 flex-1 bg-white window-drag"
|
||||||
|
:class="{ 'pointer-events-none': loadingDatabase }"
|
||||||
|
>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="px-12">
|
<div class="px-12">
|
||||||
<h1 class="text-2xl font-semibold">
|
<h1 class="text-2xl font-semibold">
|
||||||
@ -29,7 +32,16 @@
|
|||||||
<feather-icon name="plus" class="text-white w-5 h-5" />
|
<feather-icon name="plus" class="text-white w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5 font-medium">{{ _('New File') }}</div>
|
<div class="mt-5 font-medium">
|
||||||
|
<template
|
||||||
|
v-if="loadingDatabase && fileSelectedFrom === 'New File'"
|
||||||
|
>
|
||||||
|
{{ _('Loading...') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ _('New File') }}
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
<div class="mt-2 text-sm text-gray-600 text-center">
|
<div class="mt-2 text-sm text-gray-600 text-center">
|
||||||
{{ _('Create a new file and store it in your computer.') }}
|
{{ _('Create a new file and store it in your computer.') }}
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +57,16 @@
|
|||||||
<feather-icon name="upload" class="w-4 h-4 text-white" />
|
<feather-icon name="upload" class="w-4 h-4 text-white" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5 font-medium">{{ _('Existing File') }}</div>
|
<div class="mt-5 font-medium">
|
||||||
|
<template
|
||||||
|
v-if="loadingDatabase && fileSelectedFrom === 'Existing File'"
|
||||||
|
>
|
||||||
|
{{ _('Loading...') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ _('Existing File') }}
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
<div class="mt-2 text-sm text-gray-600 text-center">
|
<div class="mt-2 text-sm text-gray-600 text-center">
|
||||||
{{ _('Load an existing .db file from your computer.') }}
|
{{ _('Load an existing .db file from your computer.') }}
|
||||||
</div>
|
</div>
|
||||||
@ -67,11 +88,16 @@
|
|||||||
:class="{ 'border-t': i === 0 }"
|
:class="{ 'border-t': i === 0 }"
|
||||||
v-for="(file, i) in files"
|
v-for="(file, i) in files"
|
||||||
:key="file.filePath"
|
:key="file.filePath"
|
||||||
@click="connectToDatabase(file.filePath)"
|
@click="selectFile(file)"
|
||||||
>
|
>
|
||||||
<div class="flex items-baseline">
|
<div class="flex items-baseline">
|
||||||
<span>
|
<span>
|
||||||
|
<template v-if="loadingDatabase && fileSelectedFrom === file">
|
||||||
|
{{ _('Loading...') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
{{ file.companyName }}
|
{{ file.companyName }}
|
||||||
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-gray-700">
|
<div class="text-gray-700">
|
||||||
@ -106,6 +132,8 @@ export default {
|
|||||||
name: 'DatabaseSelector',
|
name: 'DatabaseSelector',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loadingDatabase: false,
|
||||||
|
fileSelectedFrom: null,
|
||||||
showFiles: false,
|
showFiles: false,
|
||||||
files: []
|
files: []
|
||||||
};
|
};
|
||||||
@ -116,15 +144,23 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async newDatabase() {
|
async newDatabase() {
|
||||||
|
this.fileSelectedFrom = 'New File';
|
||||||
let filePath = await createNewDatabase();
|
let filePath = await createNewDatabase();
|
||||||
this.connectToDatabase(filePath);
|
this.connectToDatabase(filePath);
|
||||||
},
|
},
|
||||||
async existingDatabase() {
|
async existingDatabase() {
|
||||||
|
this.fileSelectedFrom = 'Existing File';
|
||||||
let filePath = await loadExistingDatabase();
|
let filePath = await loadExistingDatabase();
|
||||||
this.connectToDatabase(filePath);
|
this.connectToDatabase(filePath);
|
||||||
},
|
},
|
||||||
|
async selectFile(file) {
|
||||||
|
this.fileSelectedFrom = file;
|
||||||
|
await this.connectToDatabase(file.filePath);
|
||||||
|
},
|
||||||
async connectToDatabase(filePath) {
|
async connectToDatabase(filePath) {
|
||||||
|
this.loadingDatabase = true;
|
||||||
await connectToLocalDatabase(filePath);
|
await connectToLocalDatabase(filePath);
|
||||||
|
this.loadingDatabase = false;
|
||||||
this.$emit('database-connect');
|
this.$emit('database-connect');
|
||||||
},
|
},
|
||||||
getFileLastModified(filePath) {
|
getFileLastModified(filePath) {
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
<div class="flex flex-col flex-1 overflow-hidden">
|
<div class="flex flex-col flex-1 overflow-hidden">
|
||||||
<div class="bg-gray-200 window-drag pb-2">
|
<div class="bg-gray-200 window-drag pb-2">
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<WindowControls
|
<WindowControls v-if="platform === 'Mac'" :buttons="['close']" />
|
||||||
v-if="platform === 'Mac'"
|
|
||||||
@close="frappe.events.trigger('reload-main-window')"
|
|
||||||
:buttons="['close']"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<Row
|
<Row
|
||||||
:columnCount="5"
|
:columnCount="5"
|
||||||
@ -31,6 +27,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import frappe from 'frappejs';
|
||||||
|
import { remote } from 'electron';
|
||||||
import { _ } from 'frappejs/utils';
|
import { _ } from 'frappejs/utils';
|
||||||
import WindowControls from '@/components/WindowControls';
|
import WindowControls from '@/components/WindowControls';
|
||||||
import TabGeneral from './TabGeneral.vue';
|
import TabGeneral from './TabGeneral.vue';
|
||||||
@ -82,6 +80,11 @@ export default {
|
|||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.activeTab = index;
|
this.activeTab = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let currentWindow = remote.getCurrentWindow();
|
||||||
|
currentWindow.on('close', () => {
|
||||||
|
frappe.events.trigger('reload-main-window');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getIconComponent(tab) {
|
getIconComponent(tab) {
|
||||||
|
Loading…
Reference in New Issue
Block a user