function get_buying_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
item.route = `marketplace/buying/${item.name}`
const item_html = `
${item_name}
${sender}:
${content}
${comment_when(message.creation, true)}
`;
return item_html;
}
function get_selling_item_message_card_html(item) {
const item_name = item.item_name || item.name;
const title = strip_html(item_name);
// route
if (!item.route) {
item.route = `marketplace/item/${item.name}`
}
let received_messages = '';
item.received_messages.forEach(message => {
const sender = message.sender === frappe.session.user ? 'You' : message.sender
const content = strip_html(message.content)
received_messages += `
${comment_when(message.creation, true)}
${sender}:
${content}
`
});
const item_html = `
${item_name}
${received_messages}
`;
return item_html;
}
export {
get_item_card_html,
get_local_item_card_html,
get_buying_item_message_card_html,
get_selling_item_message_card_html
}