From 32a21486519254620ff68895666ccbd5ef14ebb2 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 2 Aug 2018 01:42:23 +0530 Subject: [PATCH] [hub] Company (Seller) page --- erpnext/public/js/hub/marketplace.js | 5 ++ erpnext/public/js/hub/pages/seller.js | 85 +++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 erpnext/public/js/hub/pages/seller.js diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js index e29ae6fc23..18a1bb0629 100644 --- a/erpnext/public/js/hub/marketplace.js +++ b/erpnext/public/js/hub/marketplace.js @@ -4,6 +4,7 @@ import './pages/favourites'; import './pages/search'; import './pages/category'; import './pages/item'; +import './pages/seller'; import './pages/register'; import './pages/profile'; import './pages/publish'; @@ -164,6 +165,10 @@ erpnext.hub.Marketplace = class Marketplace { this.subpages.item = new erpnext.hub.Item(this.$body); } + if (route[1] === 'seller' && !this.subpages['seller']) { + this.subpages['seller'] = new erpnext.hub.Seller(this.$body); + } + if (route[1] === 'register' && !this.subpages.register) { if (this.registered) { frappe.set_route('marketplace', 'home'); diff --git a/erpnext/public/js/hub/pages/seller.js b/erpnext/public/js/hub/pages/seller.js new file mode 100644 index 0000000000..94e83414c7 --- /dev/null +++ b/erpnext/public/js/hub/pages/seller.js @@ -0,0 +1,85 @@ +import SubPage from './subpage'; + +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() { + return hub.call('get_hub_seller_profile', { company: this.company }); + } + + // get_hub_seller_items(profile) { + // this.profile = profile; + // console.log(profile); + // return hub.call('get_items', { hub_seller: profile.user }); + // } + + show_skeleton() { + const skeleton = `
+
+
+
+
+
+

Name

+
+

Details

+

Ratings

+
+
+
+

Desc

+

Desc

+
+
+
+
`; + + this.$wrapper.html(skeleton); + } + + render(profile) { + const p = profile; + + const profile_html = `
+
+
+ +
+
+
+
+
+ +
+
+
+

${p.company}

+
+

${p.country}

+

${p.site_name}

+

${__(`Joined ${comment_when(p.creation)}`)}

+
+
+
+ ${'description' + ? `

${p.company_description}

` + : `

__('No description') +

+
+ +
`; + + this.$wrapper.html(profile_html); + } +}