mirror of
https://github.com/frappe/books.git
synced 2025-01-11 02:36:14 +00:00
Merge branch 'move-to-vue' of https://github.com/frappe/accounting into move-to-vue
This commit is contained in:
commit
904baba237
@ -2,7 +2,15 @@
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-import": {
|
||||
resolve(id) {
|
||||
// sass imports that start with ~ (which refers node_modules) should be supported
|
||||
if (id.startsWith('~')) {
|
||||
return id.slice(1);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {}
|
||||
|
@ -6,21 +6,21 @@ const homedir = os.homedir();
|
||||
const configFilePath = path.join(homedir, '.config', 'frappe-accounting', 'settings.json');
|
||||
|
||||
function getSettings() {
|
||||
let settings;
|
||||
try {
|
||||
settings = require(configFilePath);
|
||||
} catch (e) {
|
||||
settings = {}
|
||||
}
|
||||
let settings;
|
||||
try {
|
||||
settings = require(configFilePath);
|
||||
} catch (e) {
|
||||
settings = {};
|
||||
}
|
||||
|
||||
return settings;
|
||||
return settings;
|
||||
}
|
||||
|
||||
async function saveSettings(settings) {
|
||||
await writeFile(configFilePath, JSON.stringify(settings));
|
||||
await writeFile(configFilePath, JSON.stringify(settings));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSettings,
|
||||
saveSettings
|
||||
}
|
||||
getSettings,
|
||||
saveSettings
|
||||
};
|
||||
|
40
src/main.js
40
src/main.js
@ -5,25 +5,15 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App';
|
||||
import router from './router';
|
||||
import frappeVue from 'frappejs/ui/plugins/frappeVue';
|
||||
|
||||
// frappejs imports
|
||||
import io from 'socket.io-client';
|
||||
import frappe from 'frappejs';
|
||||
import io from 'socket.io-client';
|
||||
import HTTPClient from 'frappejs/backends/http';
|
||||
import Observable from 'frappejs/utils/observable';
|
||||
import common from 'frappejs/common';
|
||||
import coreModels from 'frappejs/models';
|
||||
import models from '../models';
|
||||
import { _ } from 'frappejs/utils';
|
||||
|
||||
// vue components
|
||||
import NotFound from 'frappejs/ui/components/NotFound';
|
||||
import FeatherIcon from 'frappejs/ui/components/FeatherIcon';
|
||||
import FrappeControl from 'frappejs/ui/components/controls/FrappeControl';
|
||||
import Button from 'frappejs/ui/components/Button';
|
||||
import Indicator from 'frappejs/ui/components/Indicator';
|
||||
import modalPlugin from 'frappejs/ui/components/Modal/plugin';
|
||||
import formModalPlugin from 'frappejs/ui/plugins/formModal';
|
||||
import registerReportMethods from '../reports';
|
||||
|
||||
frappe.init();
|
||||
@ -35,8 +25,6 @@ frappe.fetch = window.fetch.bind();
|
||||
frappe.db = new HTTPClient({ server });
|
||||
const socket = io.connect(`http://${server}`);
|
||||
frappe.db.bindSocketClient(socket);
|
||||
frappe.registerModels(models);
|
||||
frappe.docs = new Observable();
|
||||
frappe.getSingle('SystemSettings');
|
||||
registerReportMethods();
|
||||
|
||||
@ -54,29 +42,7 @@ frappe.getSingle('AccountingSettings')
|
||||
window.frappe = frappe;
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.component('not-found', NotFound);
|
||||
Vue.component('feather-icon', FeatherIcon);
|
||||
Vue.component('frappe-control', FrappeControl);
|
||||
Vue.component('f-button', Button);
|
||||
Vue.component('indicator', Indicator);
|
||||
|
||||
Vue.use(modalPlugin);
|
||||
Vue.use(formModalPlugin);
|
||||
|
||||
Vue.mixin({
|
||||
computed: {
|
||||
frappe() {
|
||||
return frappe;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// global translation function in every component
|
||||
_(...args) {
|
||||
return _(...args);
|
||||
}
|
||||
}
|
||||
});
|
||||
Vue.use(frappeVue);
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
|
@ -1,36 +1,36 @@
|
||||
<template>
|
||||
<div class="setup-wizard d-flex justify-content-center">
|
||||
<div class="col-4 border rounded shadow-sm p-4 mt-5">
|
||||
<h4 class="text-center">Setup your account</h4>
|
||||
<div class="progress-indicator d-flex justify-content-center p-4">
|
||||
<indicator class="mr-1" :color="indicatorColor(index)" v-for="(section, index) in layout.sections" :key="index" />
|
||||
</div>
|
||||
<form-layout
|
||||
:doc="doc"
|
||||
:fields="fields"
|
||||
:layout="layout"
|
||||
:currentSection="currentSection"
|
||||
/>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<f-button secondary v-if="currentSection > 0"
|
||||
@click="prevSection">
|
||||
Prev
|
||||
</f-button>
|
||||
</div>
|
||||
<div>
|
||||
<f-button primary v-if="currentSection < layout.sections.length - 1"
|
||||
@click="nextSection">
|
||||
Next
|
||||
</f-button>
|
||||
<f-button primary v-if="currentSection === layout.sections.length - 1"
|
||||
@click="submit">
|
||||
Complete
|
||||
</f-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setup-wizard d-flex justify-content-center">
|
||||
<div class="col-4 border rounded shadow-sm p-4 mt-5">
|
||||
<h4 class="text-center">Setup your account</h4>
|
||||
<div class="progress-indicator d-flex justify-content-center p-4">
|
||||
<indicator class="mr-1" :color="indicatorColor(index)" v-for="(section, index) in layout.sections" :key="index" />
|
||||
</div>
|
||||
<form-layout
|
||||
:doc="doc"
|
||||
:fields="fields"
|
||||
:layout="layout"
|
||||
:currentSection="currentSection"
|
||||
/>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<f-button secondary v-if="currentSection > 0"
|
||||
@click="prevSection">
|
||||
Prev
|
||||
</f-button>
|
||||
</div>
|
||||
<div>
|
||||
<f-button primary v-if="currentSection < layout.sections.length - 1"
|
||||
@click="nextSection">
|
||||
Next
|
||||
</f-button>
|
||||
<f-button primary v-if="currentSection === layout.sections.length - 1"
|
||||
@click="submit">
|
||||
Complete
|
||||
</f-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import frappe from 'frappejs';
|
||||
@ -40,61 +40,64 @@ import indicatorColor from 'frappejs/ui/constants/indicators';
|
||||
import setupConfig from './config';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentSection: 0
|
||||
}
|
||||
},
|
||||
components: {
|
||||
FormLayout
|
||||
},
|
||||
created() {
|
||||
this.doc = new Observable();
|
||||
},
|
||||
methods: {
|
||||
async submit() {
|
||||
const {
|
||||
companyName,
|
||||
country,
|
||||
name,
|
||||
email,
|
||||
abbreviation,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
} = this.doc;
|
||||
name: 'SetupWizard',
|
||||
data() {
|
||||
return {
|
||||
currentSection: 0
|
||||
};
|
||||
},
|
||||
components: {
|
||||
FormLayout
|
||||
},
|
||||
created() {
|
||||
this.doc = new Observable();
|
||||
},
|
||||
methods: {
|
||||
async submit() {
|
||||
const {
|
||||
companyName,
|
||||
country,
|
||||
name,
|
||||
email,
|
||||
abbreviation,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
} = this.doc;
|
||||
|
||||
const doc = await frappe.getSingle('AccountingSettings');
|
||||
await doc.set({
|
||||
companyName,
|
||||
country,
|
||||
fullname: name,
|
||||
email,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
});
|
||||
await doc.update();
|
||||
const doc = await frappe.getSingle('AccountingSettings');
|
||||
await doc.set({
|
||||
companyName,
|
||||
country,
|
||||
fullname: name,
|
||||
email,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
});
|
||||
await doc.update();
|
||||
|
||||
this.$router.push('/list/ToDo');
|
||||
},
|
||||
nextSection() {
|
||||
this.currentSection += 1;
|
||||
},
|
||||
prevSection() {
|
||||
this.currentSection -= 1;
|
||||
},
|
||||
indicatorColor(i) {
|
||||
return i === this.currentSection ? indicatorColor.BLUE : '';
|
||||
}
|
||||
this.$router.push('/list/ToDo');
|
||||
},
|
||||
computed: {
|
||||
fields() {
|
||||
return setupConfig.fields;
|
||||
},
|
||||
layout() {
|
||||
return setupConfig.layout;
|
||||
}
|
||||
nextSection() {
|
||||
this.currentSection += 1;
|
||||
},
|
||||
prevSection() {
|
||||
this.currentSection -= 1;
|
||||
},
|
||||
indicatorColor(i) {
|
||||
return i === this.currentSection
|
||||
? indicatorColor.BLUE
|
||||
: indicatorColor.GREY;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fields() {
|
||||
return setupConfig.fields;
|
||||
},
|
||||
layout() {
|
||||
return setupConfig.layout;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user