From 9685d7c37a984a9d3eeb10e9484ddd7716a8c07e Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 26 Jul 2018 01:12:00 +0530 Subject: [PATCH] [hub] registered vs read-only views --- erpnext/public/js/hub/hub_listing.js | 47 ++++++++++++++++------------ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/erpnext/public/js/hub/hub_listing.js b/erpnext/public/js/hub/hub_listing.js index 856d538dd2..9061ae62d3 100644 --- a/erpnext/public/js/hub/hub_listing.js +++ b/erpnext/public/js/hub/hub_listing.js @@ -8,7 +8,8 @@ erpnext.hub.Marketplace = class Marketplace { frappe.db.get_doc('Hub Settings') .then(doc => { this.hub_settings = doc; - + this.registered = doc.registered; + this.setup_header(); this.make_sidebar(); this.make_body(); @@ -26,7 +27,7 @@ erpnext.hub.Marketplace = class Marketplace { const $target = $(e.currentTarget); const route = $target.data().route; frappe.set_route(route); - + e.stopPropagation(); }); } @@ -34,6 +35,18 @@ erpnext.hub.Marketplace = class Marketplace { make_sidebar() { this.$sidebar = this.$parent.find('.layout-side-section').addClass('hidden-xs'); + const user_specific_items_html = this.registered + ? `
  • + ${__('Your Profile')} +
  • +
  • + ${__('Publish Products')} +
  • ` + + : `
  • + ${__('Become a seller')} +
  • `; + this.$sidebar.append(` `); @@ -68,9 +73,11 @@ erpnext.hub.Marketplace = class Marketplace { `
  • ${__('All')}
  • `, - `
  • - ${__('Your Products')} -
  • `, + ...(this.registered + ? [`
  • + ${__('Your Products')} +
  • `] + : []), ...categories.map(category => `
  • ${__(category)} @@ -480,7 +487,7 @@ erpnext.hub.Register = class Register extends SubPage { .appendTo(this.$wrapper); this.$form_container = $('
    ') .appendTo(this.$wrapper); - + // const title = __('Become a Seller'); // this.$register_container.append($(`
    ${title}
    `)); } @@ -493,7 +500,7 @@ erpnext.hub.Register = class Register extends SubPage { // make_input() { // // // } - + render() { this.make_field_group(); } @@ -583,11 +590,11 @@ erpnext.hub.Publish = class Publish extends SubPage { render(items) { const html = get_item_card_container_html( - items, + items, __('Select Products to Publish'), - __(`Only products with an image and description can be published. + __(`Only products with an image and description can be published. Please update them if an item in your inventory does not appear.`), `
    @@ -648,13 +655,13 @@ function get_item_card_html(item) { // Decide item link const isLocal = item.source_type === "local"; - const route = !isLocal + const route = !isLocal ? `marketplace/item/${item.hub_item_code}` : `Form/Item/${item.item_name}`; const card_route = isLocal ? '' : `data-route='${route}'`; - const show_local_item_button = isLocal + const show_local_item_button = isLocal ? `