2018-10-23 12:42:36 +00:00
|
|
|
<template>
|
2019-11-19 17:49:45 +00:00
|
|
|
<div class="px-12 py-10 flex-1 bg-white window-drag">
|
2019-12-16 11:34:22 +00:00
|
|
|
<h1 class="text-2xl font-semibold">
|
2020-01-02 17:36:00 +00:00
|
|
|
{{ _('Welcome to Frappe Books') }}
|
2019-12-16 11:34:22 +00:00
|
|
|
</h1>
|
|
|
|
<p class="text-gray-600">
|
2019-12-23 08:24:18 +00:00
|
|
|
{{ _('Create a new file or load an existing one from your computer') }}
|
2019-12-16 11:34:22 +00:00
|
|
|
</p>
|
|
|
|
<div class="flex mt-10 window-no-drag">
|
2019-10-13 12:03:01 +00:00
|
|
|
<div
|
|
|
|
@click="newDatabase"
|
2019-12-11 09:38:20 +00:00
|
|
|
class="w-1/2 border rounded-xl flex flex-col items-center py-8 px-5 cursor-pointer hover:shadow"
|
2019-10-13 12:03:01 +00:00
|
|
|
>
|
2019-12-11 09:09:16 +00:00
|
|
|
<div class="w-14 h-14 rounded-full bg-blue-200 relative flex-center">
|
|
|
|
<div class="w-12 h-12 absolute rounded-full bg-blue-500 flex-center">
|
2019-12-16 11:34:22 +00:00
|
|
|
<feather-icon name="plus" class="text-white w-5 h-5" />
|
2019-10-13 12:03:01 +00:00
|
|
|
</div>
|
2018-10-23 12:42:36 +00:00
|
|
|
</div>
|
2019-12-23 08:24:18 +00:00
|
|
|
<div class="mt-5 font-medium">{{ _('New File') }}</div>
|
2019-12-16 11:34:22 +00:00
|
|
|
<div class="mt-2 text-sm text-gray-600 text-center">
|
2019-12-23 08:24:18 +00:00
|
|
|
{{ _('Create a new file and store it in your computer.') }}
|
2019-12-16 11:34:22 +00:00
|
|
|
</div>
|
2019-10-13 12:03:01 +00:00
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
@click="existingDatabase"
|
2019-12-11 09:38:20 +00:00
|
|
|
class="ml-6 w-1/2 border rounded-xl flex flex-col items-center py-8 px-5 cursor-pointer hover:shadow"
|
2019-10-13 12:03:01 +00:00
|
|
|
>
|
2019-12-11 09:09:16 +00:00
|
|
|
<div class="w-14 h-14 rounded-full bg-green-200 relative flex-center">
|
|
|
|
<div class="w-12 h-12 rounded-full bg-green-500 flex-center">
|
2019-12-16 11:34:22 +00:00
|
|
|
<feather-icon name="upload" class="w-4 h-4 text-white" />
|
2019-10-13 12:03:01 +00:00
|
|
|
</div>
|
2018-10-23 12:42:36 +00:00
|
|
|
</div>
|
2019-12-23 08:24:18 +00:00
|
|
|
<div class="mt-5 font-medium">{{ _('Existing File') }}</div>
|
2019-12-16 11:34:22 +00:00
|
|
|
<div class="mt-2 text-sm text-gray-600 text-center">
|
|
|
|
{{ _('Load an existing .db file from your computer.') }}
|
|
|
|
</div>
|
2018-10-23 12:42:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-23 08:24:18 +00:00
|
|
|
<p class="mt-4 flex-center text-sm text-gray-600">
|
|
|
|
<feather-icon name="info" class="-ml-8 mr-1 w-4 h-4 inline" />
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
{{ _('This file will be used as a database to store data like Customers, Invoices and Settings.') }}
|
|
|
|
</p>
|
2018-10-23 12:42:36 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-01-01 08:11:57 +00:00
|
|
|
import {
|
|
|
|
createNewDatabase,
|
|
|
|
loadExistingDatabase,
|
|
|
|
connectToLocalDatabase
|
|
|
|
} from '@/utils';
|
2018-10-23 12:42:36 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'DatabaseSelector',
|
|
|
|
methods: {
|
2019-10-26 14:46:04 +00:00
|
|
|
async newDatabase() {
|
|
|
|
let filePath = await createNewDatabase();
|
2020-01-01 08:11:57 +00:00
|
|
|
this.connectToDatabase(filePath);
|
2018-10-23 12:42:36 +00:00
|
|
|
},
|
2019-10-26 14:46:04 +00:00
|
|
|
async existingDatabase() {
|
|
|
|
let filePath = await loadExistingDatabase();
|
2020-01-01 08:11:57 +00:00
|
|
|
this.connectToDatabase(filePath);
|
|
|
|
},
|
|
|
|
async connectToDatabase(filePath) {
|
|
|
|
await connectToLocalDatabase(filePath);
|
|
|
|
this.$emit('database-connect');
|
2018-10-23 12:42:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-10-13 12:03:01 +00:00
|
|
|
</script>
|