function get_review_html(review) {
let username = review.username || review.user || __("Anonymous");
let image_html = review.user_image
? `
`
: `${frappe.get_abbr(username)}
`
let edit_html = review.own
? `
${'data.delete'}
${'data.edit'}
`
: '';
let rating_html = get_rating_html(review.rating);
return get_timeline_item(review, image_html, edit_html, rating_html);
}
function get_timeline_item(data, image_html, edit_html, rating_html) {
return `
${image_html}
${edit_html}
${rating_html}
${data.subject}
${data.content}
`;
}
function get_rating_html(rating) {
let rating_html = ``;
for (var i = 0; i < 5; i++) {
let star_class = 'fa-star';
if (i >= rating) star_class = 'fa-star-o';
rating_html += ``;
}
return rating_html;
}
export {
get_review_html,
get_rating_html
}