2018-08-01 10:27:13 +00:00
|
|
|
import SubPage from './subpage';
|
2018-08-13 16:06:07 +00:00
|
|
|
import { get_item_card_container_html } from '../components/items_container';
|
2018-08-01 08:39:07 +00:00
|
|
|
|
|
|
|
erpnext.hub.Category = class Category extends SubPage {
|
|
|
|
refresh() {
|
|
|
|
this.category = frappe.get_route()[2];
|
|
|
|
this.get_items_for_category(this.category)
|
2018-08-07 07:26:56 +00:00
|
|
|
.then(items => {
|
|
|
|
this.render(items);
|
2018-08-01 08:39:07 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
get_items_for_category(category) {
|
2018-08-17 08:59:22 +00:00
|
|
|
this.$wrapper.find('.hub-items-container').empty();
|
2018-08-07 07:26:56 +00:00
|
|
|
return hub.call('get_items', {
|
2018-08-01 08:39:07 +00:00
|
|
|
filters: {
|
|
|
|
hub_category: category
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
render(items) {
|
|
|
|
const html = get_item_card_container_html(items, __(this.category));
|
|
|
|
this.$wrapper.append(html)
|
|
|
|
}
|
2018-08-01 11:08:39 +00:00
|
|
|
}
|