mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Add Settings Page with autosave
This commit is contained in:
parent
935d5a340f
commit
40d82bf5fd
@ -14,7 +14,8 @@ module.exports = {
|
|||||||
label: "Company Name",
|
label: "Company Name",
|
||||||
fieldname: "companyName",
|
fieldname: "companyName",
|
||||||
fieldtype: "Data",
|
fieldtype: "Data",
|
||||||
required: 1
|
required: 1,
|
||||||
|
disabled: 1
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"frappejs": "github:frappe/frappejs",
|
"frappejs": "github:frappe/frappejs",
|
||||||
"popper.js": "^1.14.4"
|
"popper.js": "^1.14.4",
|
||||||
|
"vue-toasted": "^1.1.25"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,4 +45,9 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "styles/index.scss";
|
@import "styles/index.scss";
|
||||||
|
.page-container {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -13,6 +13,7 @@ import Vue from 'vue';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import frappeVue from 'frappejs/ui/plugins/frappeVue';
|
import frappeVue from 'frappejs/ui/plugins/frappeVue';
|
||||||
|
import Toasted from 'vue-toasted';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
frappe.isServer = true;
|
frappe.isServer = true;
|
||||||
@ -79,6 +80,10 @@ import frappeVue from 'frappejs/ui/plugins/frappeVue';
|
|||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.use(frappeVue);
|
Vue.use(frappeVue);
|
||||||
|
Vue.use(Toasted, {
|
||||||
|
position: 'bottom-right',
|
||||||
|
duration : 3000
|
||||||
|
});
|
||||||
|
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
new Vue({
|
new Vue({
|
||||||
|
37
src/pages/Settings/SettingSection.vue
Normal file
37
src/pages/Settings/SettingSection.vue
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="doc">
|
||||||
|
<h4 class="mb-3">{{ doctype }}</h4>
|
||||||
|
<form-layout
|
||||||
|
:doc="doc"
|
||||||
|
:fields="fields"
|
||||||
|
@updateDoc="saveDoc"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import FormLayout from 'frappejs/ui/components/Form/FormLayout';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SettingSection',
|
||||||
|
props: ['doctype'],
|
||||||
|
components: {
|
||||||
|
FormLayout
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
doc: null,
|
||||||
|
fields: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
this.doc = await frappe.getDoc(this.doctype);
|
||||||
|
this.fields = frappe.getMeta(this.doctype).fields;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
saveDoc() {
|
||||||
|
this.doc.update();
|
||||||
|
this.$toasted.show('Saved');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
24
src/pages/Settings/Settings.vue
Normal file
24
src/pages/Settings/Settings.vue
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<page-header title="Settings" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8 bg-white mt-4 mx-auto border p-5">
|
||||||
|
<setting-section doctype="AccountingSettings" />
|
||||||
|
<hr class="mt-4">
|
||||||
|
<setting-section doctype="SystemSettings" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import PageHeader from '@/components/PageHeader';
|
||||||
|
import SettingSection from './SettingSection';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Settings',
|
||||||
|
components: {
|
||||||
|
PageHeader,
|
||||||
|
SettingSection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -10,6 +10,8 @@ import reportViewConfig from '../../reports/view';
|
|||||||
|
|
||||||
import DataImport from '../pages/DataImport';
|
import DataImport from '../pages/DataImport';
|
||||||
|
|
||||||
|
import Settings from '../pages/Settings/Settings';
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
@ -48,6 +50,11 @@ const routes = [
|
|||||||
path: '/data-import',
|
path: '/data-import',
|
||||||
name: 'Data Import',
|
name: 'Data Import',
|
||||||
component: DataImport
|
component: DataImport
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/settings',
|
||||||
|
name: 'Settings',
|
||||||
|
component: Settings
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user