function get_item_card_html(item) {
if (item.recent_message) {
return get_item_message_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;
// Subtitle
let subtitle = [comment_when(item.creation)];
const rating = item.average_rating;
if (rating > 0) {
subtitle.push(rating + ``)
}
subtitle.push(company_name);
let dot_spacer = ' · ';
subtitle = subtitle.join(dot_spacer);
// route
if (!item.route) {
item.route = `marketplace/item/${item.hub_item_code}`
}
const item_html = `
`;
return item_html;
}
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 = `
`;
return item_html;
}
function get_item_message_card_html(item) {
const item_name = item.item_name || item.name;
const title = strip_html(item_name);
const message = item.recent_message
const sender = message.sender === frappe.session.user ? 'You' : message.sender
const content = strip_html(message.content)
// route
if (!item.route) {
item.route = `marketplace/item/${item.hub_item_code}`
}
const item_html = `
${comment_when(message.creation, true)}
${item_name}
${sender}:
${content}
`;
return item_html;
}
export {
get_item_card_html,
get_local_item_card_html
}