diff --git a/erpnext/public/js/hub/pages/item.js b/erpnext/public/js/hub/pages/item.js
index dabddeaab72..b3c63c85f28 100644
--- a/erpnext/public/js/hub/pages/item.js
+++ b/erpnext/public/js/hub/pages/item.js
@@ -1,4 +1,4 @@
-import SubPage from './base_page';
+import SubPage from './subpage';
import { get_rating_html } from '../helpers';
erpnext.hub.Item = class Item extends SubPage {
@@ -90,20 +90,23 @@ erpnext.hub.Item = class Item extends SubPage {
const rating_html = get_rating_html(item.average_rating);
const rating_count = item.no_of_ratings > 0 ? `${item.no_of_ratings} reviews` : __('No reviews yet');
- let edit_buttons_html = '';
+ let menu_items = '';
if(this.own_item) {
- edit_buttons_html = `
-
-
-
`;
+ menu_items = `
+ ${__('Edit Details')}
+ ${__('Unpublish')}`;
+ } else {
+ menu_items = `
+ ${__('Report this item')}
+ `;
}
const html = `
-
+
@@ -126,7 +129,6 @@ erpnext.hub.Item = class Item extends SubPage {
` : `
${__('No description')}
`
}
- ${edit_buttons_html}
@@ -134,8 +136,7 @@ erpnext.hub.Item = class Item extends SubPage {
@@ -173,10 +174,6 @@ erpnext.hub.Item = class Item extends SubPage {
this.$wrapper.html(html);
- if(this.own_item) {
- this.bind_edit_buttons();
- }
-
this.make_review_area();
this.get_reviews()
@@ -186,21 +183,17 @@ erpnext.hub.Item = class Item extends SubPage {
});
}
- bind_edit_buttons() {
- this.edit_dialog = new frappe.ui.Dialog({
- title: "Edit Your Product",
- fields: []
- });
-
- this.$wrapper.find('.edit-item').on('click', this.on_edit.bind(this));
- this.$wrapper.find('.unpublish').on('click', this.on_unpublish.bind(this));
- }
-
- on_edit() {
+ edit_details() {
+ if (!this.edit_dialog) {
+ this.edit_dialog = new frappe.ui.Dialog({
+ title: "Edit Your Product",
+ fields: []
+ });
+ }
this.edit_dialog.show();
}
- on_unpublish() {
+ unpublish_item() {
if(!this.unpublish_dialog) {
this.unpublish_dialog = new frappe.ui.Dialog({
title: "Edit Your Product",