diff --git a/erpnext/public/js/hub/hub_listing.js b/erpnext/public/js/hub/hub_listing.js index 368c723e5b..7a82a9153c 100644 --- a/erpnext/public/js/hub/hub_listing.js +++ b/erpnext/public/js/hub/hub_listing.js @@ -1,3 +1,848 @@ +frappe.provide('hub'); +frappe.provide('erpnext.hub'); + +erpnext.hub.Marketplace = class Marketplace { + constructor({ parent }) { + this.$parent = $(parent); + this.page = parent.page; + + 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(); + this.setup_events(); + this.refresh(); + }); + } + + setup_header() { + this.page.set_title(__('Marketplace')); + } + + setup_events() { + this.$parent.on('click', '[data-route]', (e) => { + const $target = $(e.currentTarget); + const route = $target.data().route; + frappe.set_route(route); + + e.stopPropagation(); + }); + } + + make_sidebar() { + this.$sidebar = this.$parent.find('.layout-side-section').addClass('hidden-xs'); + + this.make_sidebar_nav_buttons(); + this.make_sidebar_categories(); + } + + make_sidebar_nav_buttons() { + let $nav_group = this.$sidebar.find('[data-nav-buttons]'); + if (!$nav_group.length) { + $nav_group = $('
${where}${dot_spacer}${when}
+${rating_html}${rating_count}
+${description}
+ ` : __('No description') + } ++ ${rating_html} +
++ ${data.content} +
+${__("Status decided by the 'Publish in Hub' field in Item.")}
`; + const subtitle_html = ` ++ ${__(`Only products with an image, description and category can be published. + Please update them if an item in your inventory does not appear.`)} +
`; + const publish_button_html = ``; + + const select_all_button = ``; + const deselect_all_button = ``; + + const search_html = `