import { get_rating_html } from './reviews'; function get_detail_view_html(item, allow_edit) { const title = item.item_name || item.name; const seller = item.company; const who = __('Posted By {0}', [seller]); const when = comment_when(item.creation); const city = item.city ? item.city + ', ' : ''; const country = item.country ? item.country : ''; const where = `${city}${country}`; const dot_spacer = ''; const description = item.description || ''; let stats = __('No views yet'); if(item.view_count) { const views_message = __(`${item.view_count} Views`); const rating_html = get_rating_html(item.average_rating); const rating_count = item.no_of_ratings > 0 ? `${item.no_of_ratings} reviews` : __('No reviews yet'); stats = `${views_message}${dot_spacer}${rating_html} (${rating_count})`; } let favourite_button = '' if (hub.settings.registered) { favourite_button = !item.favourited ? `` : ``; } const contact_seller_button = item.hub_seller !== hub.settings.company_email ? `` : ''; let menu_items = ''; if(allow_edit) { menu_items = `
  • ${__('Edit Details')}
  • ${__('Unpublish')}
  • `; } else { menu_items = `
  • ${__('Report this item')}
  • `; } const html = `

    ${title}

    ${where}${dot_spacer}${when}

    ${stats}

    ${favourite_button} ${contact_seller_button}
    Product Description

    ${description ? description : __('No details')}

    Seller Information
    `; return html; } export { get_detail_view_html, get_profile_html }