Replace hub_item_code -> hub_item_name
This commit is contained in:
parent
f089dad7c7
commit
dc7e8e6a26
@ -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 = `
|
||||
<div class="col-md-7">
|
||||
@ -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 = '';
|
||||
|
@ -47,8 +47,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)
|
||||
@ -68,21 +68,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];
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,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.`)
|
||||
@ -55,8 +55,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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
page_name: frappe.get_route()[1],
|
||||
item_id_fieldname: 'hub_item_code',
|
||||
item_id_fieldname: 'name',
|
||||
search_value: '',
|
||||
|
||||
sections: [],
|
||||
@ -87,8 +87,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() {
|
||||
|
@ -28,7 +28,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'),
|
||||
@ -51,8 +51,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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,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'),
|
||||
@ -54,23 +54,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(__(`<span>${hub_item_code} removed.
|
||||
alert = frappe.show_alert(__(`<span>${hub_item_name} removed.
|
||||
<a href="#" data-action="undo-remove"><b>Undo</b></a></span>`),
|
||||
grace_period/1000,
|
||||
{
|
||||
@ -78,19 +78,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(() => {
|
||||
@ -102,9 +102,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;
|
||||
|
@ -38,7 +38,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 ...'),
|
||||
@ -68,8 +68,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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
|
||||
profile: null,
|
||||
items:[],
|
||||
item_id_fieldname: 'hub_item_code',
|
||||
item_id_fieldname: 'name',
|
||||
|
||||
title: null,
|
||||
subtitles: [],
|
||||
@ -89,8 +89,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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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(() => {});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user