diff --git a/erpnext/public/js/hub/components/item_card.js b/erpnext/public/js/hub/components/item_card.js index a2c855389fc..e6471c6d89c 100644 --- a/erpnext/public/js/hub/components/item_card.js +++ b/erpnext/public/js/hub/components/item_card.js @@ -1,6 +1,10 @@ function get_item_card_html(item) { if (item.recent_message) { - return get_item_message_card_html(item); + return get_buying_item_message_card_html(item); + } + + if (item.recent_messages) { + return get_selling_item_message_card_html(item); } const item_name = item.item_name || item.name; @@ -52,7 +56,62 @@ function get_item_card_html(item) { return item_html; } -function get_item_message_card_html(item) { +function get_local_item_card_html(item) { + const item_name = item.item_name || item.name; + const title = strip_html(item_name); + const img_url = item.image; + const company_name = item.company; + + const is_active = item.publish_in_hub; + const id = item.hub_item_code || item.item_code; + + // Subtitle + let subtitle = [comment_when(item.creation)]; + const rating = item.average_rating; + + if (rating > 0) { + subtitle.push(rating + ``) + } + + if (company_name) { + subtitle.push(company_name); + } + + let dot_spacer = ''; + subtitle = subtitle.join(dot_spacer); + + const edit_item_button = `
`; + + const item_html = ` +