diff --git a/models/doctype/Party/Customer.js b/models/doctype/Party/Customer.js
index ba76bac8..d7dadb7d 100644
--- a/models/doctype/Party/Customer.js
+++ b/models/doctype/Party/Customer.js
@@ -24,9 +24,18 @@ module.exports = {
});
}
},
- // {
- // label: _('View Invoices'),
- // action: console.log
- // }
+ {
+ label: _('View Invoices'),
+ action: customer => {
+ router.push({
+ path: `/list/SalesInvoice`,
+ query: {
+ filters: {
+ customer: customer.name
+ }
+ }
+ });
+ }
+ }
]
};
diff --git a/src/components/FilterDropdown.vue b/src/components/FilterDropdown.vue
new file mode 100644
index 00000000..60cac279
--- /dev/null
+++ b/src/components/FilterDropdown.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+ (filter.fieldname = value)"
+ />
+
+
+ (filter.condition = value)"
+ />
+
+
+ (filter.value = value)"
+ />
+
+
+
+
+
+
+
+
+ {{
+ _('No filters selected')
+ }}
+
+
+
+
+ {{ _('Add a filter') }}
+
+
+
+
+
+
diff --git a/src/components/Icons/12/filter.vue b/src/components/Icons/12/filter.vue
index 55168706..7a5ecfe0 100644
--- a/src/components/Icons/12/filter.vue
+++ b/src/components/Icons/12/filter.vue
@@ -4,7 +4,7 @@
stroke-linecap="round"
stroke-linejoin="round"
d="M11.2 1.5L.8 1.5M3 5.75L9 5.75M5 10.5L7 10.5"
- transform="translate(0 -1)"
+ transform="translate(0 -2)"
/>
diff --git a/src/components/Popover.vue b/src/components/Popover.vue
new file mode 100644
index 00000000..2777049d
--- /dev/null
+++ b/src/components/Popover.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
diff --git a/src/pages/ListView/List.vue b/src/pages/ListView/List.vue
index 21d943b2..dedd49b2 100644
--- a/src/pages/ListView/List.vue
+++ b/src/pages/ListView/List.vue
@@ -104,7 +104,6 @@ export default {
frappe.db.on(`change:${this.listConfig.doctype}`, obj => {
this.updateData();
});
- frappe.listView.on('filterList', this.updateData.bind(this));
},
methods: {
async setupColumnsAndData() {
@@ -127,8 +126,6 @@ export default {
},
async updateData(filters) {
if (!filters) filters = this.getFilters();
- // since passing filters as URL params which is String
- filters = this.formatFilters(filters);
this.data = await frappe.db.getAll({
doctype: this.doctype,
fields: ['*'],
diff --git a/src/pages/ListView/ListFilters.vue b/src/pages/ListView/ListFilters.vue
index 2e9b021b..5bc1e2d5 100644
--- a/src/pages/ListView/ListFilters.vue
+++ b/src/pages/ListView/ListFilters.vue
@@ -34,7 +34,6 @@ export default {
methods: {
removeFilter(filter) {
delete this.currentFilters[filter];
- frappe.listView.trigger('filterList', this.currentFilters);
this.usedToReRender += 1;
}
}
diff --git a/src/pages/ListView/ListView.vue b/src/pages/ListView/ListView.vue
index a8d1016d..85d92538 100644
--- a/src/pages/ListView/ListView.vue
+++ b/src/pages/ListView/ListView.vue
@@ -3,14 +3,24 @@
{{ title }}
-
-
+
@@ -22,6 +32,8 @@ import Button from '@/components/Button';
import SearchBar from '@/components/SearchBar';
import List from './List';
import listConfigs from './listConfig';
+import Icon from '@/components/Icon';
+import FilterDropdown from '@/components/FilterDropdown';
export default {
name: 'ListView',
@@ -30,10 +42,14 @@ export default {
PageHeader,
List,
Button,
- SearchBar
+ SearchBar,
+ Icon,
+ FilterDropdown
},
- created() {
- frappe.listView = new Observable();
+ mounted() {
+ if (typeof this.filters === 'object') {
+ this.$refs.filterDropdown.setFilter(this.filters);
+ }
},
methods: {
async makeNewDoc() {
@@ -52,6 +68,9 @@ export default {
this.$router.replace(path);
});
},
+ applyFilter(filters) {
+ this.$refs.list.updateData(filters);
+ },
getFormPath(name) {
if (this.listConfig.formRoute) {
let path = this.listConfig.formRoute(name);
@@ -68,6 +87,9 @@ export default {
}
},
computed: {
+ meta() {
+ return frappe.getMeta(this.doctype);
+ },
listConfig() {
if (listConfigs[this.doctype]) {
return listConfigs[this.doctype];
@@ -75,17 +97,12 @@ export default {
return {
title: this.doctype,
doctype: this.doctype,
- columns: frappe.getMeta(this.doctype).getKeywordFields()
+ columns: this.meta.getKeywordFields()
};
}
},
title() {
- if (this.listConfig) {
- return typeof this.listConfig.title === 'function'
- ? this.listConfig.title(this.filters)
- : this.listConfig.title;
- }
- return this.doctype;
+ return this.listConfig.title || this.doctype;
}
}
};