From fa12e0f1d66eaca31f3cb9d647d89b6452c48a4a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 11 Oct 2018 00:21:03 +0530 Subject: [PATCH] Initialize new theme and pages from scratch - Add ListView and FormView --- models/doctype/Invoice/Invoice.js | 20 +++++++++ src/App.vue | 40 ++++------------- src/components/PageHeader.vue | 10 +++++ src/components/SearchInput.vue | 3 ++ src/components/Sidebar.vue | 70 ++++++++++++++++++++++++++++++ src/pages/FormView/index.vue | 50 +++++++++++++++++++++ src/pages/ListView/List.vue | 67 ++++++++++++++++++++++++++++ src/pages/ListView/ListCell.vue | 10 +++++ src/pages/ListView/ListRow.vue | 21 +++++++++ src/pages/ListView/ListToolbar.vue | 28 ++++++++++++ src/pages/ListView/index.vue | 42 ++++++++++++++++++ src/router/index.js | 34 +++++---------- src/styles/index.scss | 6 +++ src/styles/variables.scss | 5 ++- 14 files changed, 352 insertions(+), 54 deletions(-) create mode 100644 src/components/PageHeader.vue create mode 100644 src/components/SearchInput.vue create mode 100644 src/components/Sidebar.vue create mode 100644 src/pages/FormView/index.vue create mode 100644 src/pages/ListView/List.vue create mode 100644 src/pages/ListView/ListCell.vue create mode 100644 src/pages/ListView/ListRow.vue create mode 100644 src/pages/ListView/ListToolbar.vue create mode 100644 src/pages/ListView/index.vue create mode 100644 src/styles/index.scss diff --git a/models/doctype/Invoice/Invoice.js b/models/doctype/Invoice/Invoice.js index a2252381..f47a7833 100644 --- a/models/doctype/Invoice/Invoice.js +++ b/models/doctype/Invoice/Invoice.js @@ -151,5 +151,25 @@ module.exports = {
${data.customer}
${frappe.format(data.grandTotal, 'Currency')}
`; } + }, + + listView: { + columns: [ + 'customer', + { + label: 'Status', + getValue(doc) { + return doc.submitted ? 'Paid' : 'Pending'; + } + }, + 'grandTotal', + 'date', + { + label: 'INV #', + getValue(doc) { + return doc.name; + } + } + ] } }; diff --git a/src/App.vue b/src/App.vue index 4a4d9c67..a72b4a57 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,46 +1,24 @@ - diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue new file mode 100644 index 00000000..53020995 --- /dev/null +++ b/src/components/PageHeader.vue @@ -0,0 +1,10 @@ + + diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue new file mode 100644 index 00000000..bfb52050 --- /dev/null +++ b/src/components/SearchInput.vue @@ -0,0 +1,3 @@ + diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue new file mode 100644 index 00000000..8d5868a4 --- /dev/null +++ b/src/components/Sidebar.vue @@ -0,0 +1,70 @@ + + + + diff --git a/src/pages/FormView/index.vue b/src/pages/FormView/index.vue new file mode 100644 index 00000000..9ceecfb8 --- /dev/null +++ b/src/pages/FormView/index.vue @@ -0,0 +1,50 @@ + + + diff --git a/src/pages/ListView/List.vue b/src/pages/ListView/List.vue new file mode 100644 index 00000000..ef770925 --- /dev/null +++ b/src/pages/ListView/List.vue @@ -0,0 +1,67 @@ + + diff --git a/src/pages/ListView/ListCell.vue b/src/pages/ListView/ListCell.vue new file mode 100644 index 00000000..2a42a91c --- /dev/null +++ b/src/pages/ListView/ListCell.vue @@ -0,0 +1,10 @@ + + diff --git a/src/pages/ListView/ListRow.vue b/src/pages/ListView/ListRow.vue new file mode 100644 index 00000000..b037a10c --- /dev/null +++ b/src/pages/ListView/ListRow.vue @@ -0,0 +1,21 @@ + + diff --git a/src/pages/ListView/ListToolbar.vue b/src/pages/ListView/ListToolbar.vue new file mode 100644 index 00000000..50b0c830 --- /dev/null +++ b/src/pages/ListView/ListToolbar.vue @@ -0,0 +1,28 @@ + + diff --git a/src/pages/ListView/index.vue b/src/pages/ListView/index.vue new file mode 100644 index 00000000..159aa0b6 --- /dev/null +++ b/src/pages/ListView/index.vue @@ -0,0 +1,42 @@ + + diff --git a/src/router/index.js b/src/router/index.js index f190e2c0..8b2f0787 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,34 +1,24 @@ import Vue from 'vue'; import Router from 'vue-router'; -import coreRoutes from 'frappejs/ui/routes'; -import SetupWizard from '../pages/SetupWizard'; -import Report from 'frappejs/ui/pages/Report'; -import reportViewConfig from '../../reports/view'; +import ListView from '../pages/ListView'; +import FormView from '../pages/FormView'; Vue.use(Router); -const routes = [].concat(coreRoutes, [ +const routes = [ { - path: '/setup-wizard', - name: 'SetupWizard', - components: { - setup: SetupWizard - } + path: '/list/:doctype', + name: 'ListView', + component: ListView, + props: true }, { - path: '/report/:reportName', - name: 'Report', - component: Report, - props: (route) => { - const { reportName } = route.params; - return { - reportName, - reportConfig: reportViewConfig[reportName] || null, - filters: route.query - }; - } + path: '/edit/:doctype/:name', + name: 'FormView', + component: FormView, + props: true } -]); +]; export default new Router({ routes }); diff --git a/src/styles/index.scss b/src/styles/index.scss new file mode 100644 index 00000000..48ec2515 --- /dev/null +++ b/src/styles/index.scss @@ -0,0 +1,6 @@ +@import "variables.scss"; +@import "~bootstrap/scss/bootstrap"; + +html { + font-size: 14px; +} \ No newline at end of file diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 367009b9..f9c673a5 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,2 +1,5 @@ @import "~bootstrap/scss/functions"; -@import "~bootstrap/scss/variables"; \ No newline at end of file +@import "~bootstrap/scss/variables"; + +$dark: #252529; +$blue: #1665D8; \ No newline at end of file