diff --git a/erpnext/public/js/hub/components/item_card.js b/erpnext/public/js/hub/components/item_card.js index fdf2690be8..41ab33aaf9 100644 --- a/erpnext/public/js/hub/components/item_card.js +++ b/erpnext/public/js/hub/components/item_card.js @@ -7,7 +7,7 @@ function get_buying_item_message_card_html(item) { const content = strip_html(message.content) // route - item.route = `marketplace/buying/${item.hub_item_code}` + item.route = `marketplace/buying/${item.name}` const item_html = `
@@ -38,7 +38,7 @@ function get_selling_item_message_card_html(item) { // route if (!item.route) { - item.route = `marketplace/item/${item.hub_item_code}` + item.route = `marketplace/item/${item.name}` } let received_messages = ''; diff --git a/erpnext/public/js/hub/pages/BuyingMessages.vue b/erpnext/public/js/hub/pages/BuyingMessages.vue index 448c24aa94..49a665639f 100644 --- a/erpnext/public/js/hub/pages/BuyingMessages.vue +++ b/erpnext/public/js/hub/pages/BuyingMessages.vue @@ -45,8 +45,8 @@ export default { } }, created() { - const hub_item_code = this.get_hub_item_code(); - this.get_item_details(hub_item_code) + const hub_item_name = this.get_hub_item_name(); + this.get_item_details(hub_item_name) .then(item_details => { this.item_details = item_details; this.get_messages(item_details) @@ -66,21 +66,21 @@ export default { hub.call('send_message', { from_seller: hub.settings.company_email, to_seller: this.item_details.hub_seller, - hub_item: this.item_details.hub_item_code, + hub_item: this.item_details.name, message }); }, - get_item_details(hub_item_code) { - return hub.call('get_item_details', { hub_item_code }) + get_item_details(hub_item_name) { + return hub.call('get_item_details', { hub_item_name }) }, get_messages() { if (!this.item_details) return []; return hub.call('get_messages', { against_seller: this.item_details.hub_seller, - against_item: this.item_details.hub_item_code + against_item: this.item_details.name }); }, - get_hub_item_code() { + get_hub_item_name() { return frappe.get_route()[2]; } } diff --git a/erpnext/public/js/hub/pages/Category.vue b/erpnext/public/js/hub/pages/Category.vue index 5a23870ec2..2ffbcf3d21 100644 --- a/erpnext/public/js/hub/pages/Category.vue +++ b/erpnext/public/js/hub/pages/Category.vue @@ -24,7 +24,7 @@ export default { page_name: frappe.get_route()[1], category: frappe.get_route()[2], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants empty_state_message: __(`No products in this category yet.`) @@ -50,8 +50,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/Home.vue b/erpnext/public/js/hub/pages/Home.vue index 7019a6234e..bba2e1d577 100644 --- a/erpnext/public/js/hub/pages/Home.vue +++ b/erpnext/public/js/hub/pages/Home.vue @@ -32,7 +32,7 @@ export default { data() { return { page_name: frappe.get_route()[1], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', search_value: '', sections: [], @@ -78,8 +78,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); }, set_search_route() { diff --git a/erpnext/public/js/hub/pages/PublishedProducts.vue b/erpnext/public/js/hub/pages/PublishedProducts.vue index 80fe8c0a72..561dab2daf 100644 --- a/erpnext/public/js/hub/pages/PublishedProducts.vue +++ b/erpnext/public/js/hub/pages/PublishedProducts.vue @@ -23,7 +23,7 @@ export default { return { page_name: frappe.get_route()[1], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants page_title: __('Published Products'), @@ -46,8 +46,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/SavedProducts.vue b/erpnext/public/js/hub/pages/SavedProducts.vue index dd8b026d81..d55e9dc591 100644 --- a/erpnext/public/js/hub/pages/SavedProducts.vue +++ b/erpnext/public/js/hub/pages/SavedProducts.vue @@ -25,7 +25,7 @@ export default { return { page_name: frappe.get_route()[1], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants page_title: __('Saved Products'), @@ -49,23 +49,23 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); }, - on_item_remove(hub_item_code) { + on_item_remove(hub_item_name) { const grace_period = 5000; let reverted = false; let alert; const undo_remove = () => { - this.toggle_item(hub_item_code);; + this.toggle_item(hub_item_name);; reverted = true; alert.hide(); return false; } - alert = frappe.show_alert(__(`${hub_item_code} removed. + alert = frappe.show_alert(__(`${hub_item_name} removed. Undo`), grace_period/1000, { @@ -73,19 +73,19 @@ export default { } ); - this.toggle_item(hub_item_code, false); + this.toggle_item(hub_item_name, false); setTimeout(() => { if(!reverted) { - this.remove_item_from_saved_products(hub_item_code); + this.remove_item_from_saved_products(hub_item_name); } }, grace_period); }, - remove_item_from_saved_products(hub_item_code) { + remove_item_from_saved_products(hub_item_name) { erpnext.hub.trigger('action:item_favourite'); hub.call('remove_item_from_seller_favourites', { - hub_item_code, + hub_item_name, hub_seller: hub.settings.company_email }) .then(() => { @@ -97,9 +97,9 @@ export default { }, // By default show - toggle_item(hub_item_code, show=true) { + toggle_item(hub_item_name, show=true) { this.items = this.items.map(item => { - if(item.hub_item_code === hub_item_code) { + if(item.name === hub_item_name) { item.seen = show; } return item; diff --git a/erpnext/public/js/hub/pages/Search.vue b/erpnext/public/js/hub/pages/Search.vue index fc4aff8028..809f8c2ffd 100644 --- a/erpnext/public/js/hub/pages/Search.vue +++ b/erpnext/public/js/hub/pages/Search.vue @@ -31,7 +31,7 @@ export default { page_name: frappe.get_route()[1], items: [], search_value: frappe.get_route()[2], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants search_placeholder: __('Search for anything ...'), @@ -61,8 +61,8 @@ export default { this.get_items(); }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/Seller.vue b/erpnext/public/js/hub/pages/Seller.vue index 9fa20428ae..86d75b89ad 100644 --- a/erpnext/public/js/hub/pages/Seller.vue +++ b/erpnext/public/js/hub/pages/Seller.vue @@ -45,7 +45,7 @@ export default { profile: null, items:[], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', title: null, image: null, @@ -94,8 +94,8 @@ export default { }); }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/item.js b/erpnext/public/js/hub/pages/item.js index f15d1be635..c77f57bad1 100644 --- a/erpnext/public/js/hub/pages/item.js +++ b/erpnext/public/js/hub/pages/item.js @@ -6,11 +6,11 @@ import { get_review_html } from '../components/reviews'; erpnext.hub.Item = class Item extends SubPage { refresh() { this.show_skeleton(); - this.hub_item_code = frappe.get_route()[2]; + this.hub_item_name = frappe.get_route()[2]; this.own_item = false; - this.get_item(this.hub_item_code) + this.get_item(this.hub_item_name) .then(item => { this.own_item = item.hub_seller === hub.settings.company_email; this.item = item; @@ -24,9 +24,9 @@ erpnext.hub.Item = class Item extends SubPage { } - get_item(hub_item_code) { + get_item(hub_item_name) { return hub.call('get_item_details', { - hub_item_code + hub_item_name }); } @@ -72,7 +72,7 @@ erpnext.hub.Item = class Item extends SubPage { $(favourite_button).addClass('disabled'); hub.call('add_item_to_seller_favourites', { - hub_item_code: this.hub_item_code, + hub_item_name: this.hub_item_name, hub_seller: hub.settings.company_email }) .then(() => { @@ -108,12 +108,12 @@ erpnext.hub.Item = class Item extends SubPage { hub.call('send_message', { from_seller: hub.settings.company_email, to_seller: this.item.hub_seller, - hub_item: this.item.hub_item_code, + hub_item: this.item.hub_item_name, message }) .then(() => { d.hide(); - frappe.set_route('marketplace', 'buy', this.item.hub_item_code); + frappe.set_route('marketplace', 'buy', this.item.hub_item_name); erpnext.hub.trigger('action:send_message') }); } @@ -145,7 +145,7 @@ erpnext.hub.Item = class Item extends SubPage { values.username = frappe.session.user_fullname; hub.call('add_item_review', { - hub_item_code: this.hub_item_code, + hub_item_name: this.hub_item_name, review: JSON.stringify(values) }) .then(this.push_review_in_review_area.bind(this)); @@ -162,7 +162,7 @@ erpnext.hub.Item = class Item extends SubPage { get_reviews() { - return hub.call('get_item_reviews', { hub_item_code: this.hub_item_code }).catch(() => {}); + return hub.call('get_item_reviews', { hub_item_name: this.hub_item_name }).catch(() => {}); }