2018-08-01 20:12:23 +00:00
|
|
|
import SubPage from './subpage';
|
2018-08-13 16:06:07 +00:00
|
|
|
import { get_profile_html } from '../components/detail_view';
|
|
|
|
import { get_item_card_container_html } from '../components/items_container';
|
|
|
|
import { get_detail_skeleton_html } from '../components/skeleton_state';
|
2018-08-01 20:12:23 +00:00
|
|
|
|
|
|
|
erpnext.hub.Seller = class Seller extends SubPage {
|
|
|
|
make_wrapper() {
|
|
|
|
super.make_wrapper();
|
|
|
|
}
|
|
|
|
|
|
|
|
refresh() {
|
|
|
|
this.show_skeleton();
|
|
|
|
this.company = frappe.get_route()[2];
|
|
|
|
this.get_hub_seller_profile()
|
|
|
|
.then(this.render.bind(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
get_hub_seller_profile() {
|
2018-08-07 06:32:14 +00:00
|
|
|
return hub.call('get_hub_seller_page_info', { company: this.company });
|
2018-08-01 20:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
show_skeleton() {
|
2018-08-13 16:06:07 +00:00
|
|
|
this.$wrapper.html(get_detail_skeleton_html());
|
2018-08-01 20:12:23 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 06:32:14 +00:00
|
|
|
render(data) {
|
2018-08-13 16:06:07 +00:00
|
|
|
this.$wrapper.html(get_profile_html(data.profile));
|
2018-08-07 06:32:14 +00:00
|
|
|
|
|
|
|
let html = get_item_card_container_html(data.items, __('Products by ' + p.company));
|
|
|
|
this.$wrapper.append(html);
|
2018-08-01 20:12:23 +00:00
|
|
|
}
|
|
|
|
}
|