2015-02-24 12:20:44 +00:00
|
|
|
{% macro product_image_square(website_image, css_class="") %}
|
2016-11-14 07:43:53 +00:00
|
|
|
<div class="product-image product-image-square
|
|
|
|
{% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
|
|
|
|
{% if website_image -%}
|
|
|
|
style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');"
|
|
|
|
{%- endif %}>
|
2015-02-24 12:20:44 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2021-02-01 14:31:37 +00:00
|
|
|
{% macro product_image(website_image, css_class="product-image", alt="") %}
|
2020-12-30 10:21:50 +00:00
|
|
|
<div class="border text-center rounded {{ css_class }}" style="overflow: hidden;">
|
2020-08-07 09:04:54 +00:00
|
|
|
<img itemprop="image" class="website-image h-100 w-100" alt="{{ alt }}" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
|
2020-12-24 06:10:33 +00:00
|
|
|
</div>
|
2015-09-11 13:19:59 +00:00
|
|
|
{% endmacro %}
|
2017-02-13 16:22:43 +00:00
|
|
|
|
|
|
|
{% macro media_image(website_image, name, css_class="") %}
|
2017-02-14 11:02:48 +00:00
|
|
|
<div class="product-image sidebar-image-wrapper {{ css_class }}">
|
|
|
|
{% if not website_image -%}
|
|
|
|
<div class="sidebar-standard-image"> <div class="standard-image" style="background-color: rgb(250, 251, 252);">{{name}}</div> </div>
|
|
|
|
{%- endif %}
|
2020-12-24 06:10:33 +00:00
|
|
|
{% if website_image -%}
|
2017-02-13 16:22:43 +00:00
|
|
|
<a href="{{ frappe.utils.quoted(website_image) }}">
|
2017-02-14 11:02:48 +00:00
|
|
|
<img itemprop="image" src="{{ frappe.utils.quoted(website_image) | abs_url }}"
|
|
|
|
class="img-responsive img-thumbnail sidebar-image" style="min-height:100%; min-width:100%;">
|
2017-02-13 16:22:43 +00:00
|
|
|
</a>
|
2020-12-24 06:10:33 +00:00
|
|
|
{%- endif %}
|
|
|
|
</div>
|
2017-02-13 16:22:43 +00:00
|
|
|
{% endmacro %}
|
2019-03-19 06:18:32 +00:00
|
|
|
|
|
|
|
{% macro render_homepage_section(section) %}
|
|
|
|
|
|
|
|
{% if section.section_based_on == 'Custom HTML' and section.section_html %}
|
|
|
|
{{ section.section_html }}
|
|
|
|
{% elif section.section_based_on == 'Cards' %}
|
|
|
|
<section class="container my-5">
|
|
|
|
<h3>{{ section.name }}</h3>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
{% for card in section.section_cards %}
|
|
|
|
<div class="col-md-{{ section.column_value }} mb-4">
|
|
|
|
<div class="card h-100 justify-content-between">
|
|
|
|
{% if card.image %}
|
2021-01-28 07:02:13 +00:00
|
|
|
<div class="website-image-lazy" data-class="card-img-top h-75" data-src="{{ card.image }}" data-alt="{{ card.title }}"></div>
|
2019-03-19 06:18:32 +00:00
|
|
|
{% endif %}
|
|
|
|
<div class="card-body">
|
|
|
|
<h5 class="card-title">{{ card.title }}</h5>
|
|
|
|
<p class="card-subtitle mb-2 text-muted">{{ card.subtitle or '' }}</p>
|
2019-06-01 15:26:37 +00:00
|
|
|
<p class="card-text">{{ card.content or '' | truncate(140, True) }}</p>
|
2019-03-19 06:18:32 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-body flex-grow-0">
|
|
|
|
<a href="{{ card.route }}" class="card-link">{{ _('More details') }}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-12-24 06:10:33 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
2021-05-17 15:14:41 +00:00
|
|
|
{%- macro item_card(item, is_featured=False, is_full_width=False, align="Left") -%}
|
2020-12-24 06:10:33 +00:00
|
|
|
{%- set align_items_class = resolve_class({
|
|
|
|
'align-items-end': align == 'Right',
|
|
|
|
'align-items-center': align == 'Center',
|
|
|
|
'align-items-start': align == 'Left',
|
|
|
|
}) -%}
|
|
|
|
{%- set col_size = 3 if is_full_width else 4 -%}
|
2021-05-12 19:52:05 +00:00
|
|
|
{%- set title = item.web_item_name or item.item_name or item.item_code -%}
|
|
|
|
{%- set title = title[:50] + "..." if title|len > 50 else title -%}
|
2021-03-11 15:54:47 +00:00
|
|
|
{%- set image = item.website_image or item.image -%}
|
|
|
|
{%- set description = item.website_description or item.description-%}
|
|
|
|
|
2020-12-24 06:10:33 +00:00
|
|
|
{% if is_featured %}
|
|
|
|
<div class="col-sm-{{ col_size*2 }} item-card">
|
2021-05-24 20:05:22 +00:00
|
|
|
<div class="card featured-item {{ align_items_class }}" style="height: 360px;">
|
2020-12-24 06:10:33 +00:00
|
|
|
{% if image %}
|
|
|
|
<div class="row no-gutters">
|
2021-05-24 20:05:22 +00:00
|
|
|
<div class="col-md-5 ml-4">
|
2020-12-24 06:10:33 +00:00
|
|
|
<img class="card-img" src="{{ image }}" alt="{{ title }}">
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
2021-05-17 15:14:41 +00:00
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 06:10:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col-md-12">
|
2021-05-17 15:14:41 +00:00
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 06:10:33 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col-sm-{{ col_size }} item-card">
|
2021-05-24 20:05:22 +00:00
|
|
|
<div class="card {{ align_items_class }}" style="height: 360px;">
|
2020-12-24 06:10:33 +00:00
|
|
|
{% if image %}
|
2021-03-11 05:26:00 +00:00
|
|
|
<div class="card-img-container">
|
2021-03-11 15:54:47 +00:00
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
2021-03-11 05:26:00 +00:00
|
|
|
<img class="card-img" src="{{ image }}" alt="{{ title }}">
|
|
|
|
</a>
|
|
|
|
</div>
|
2021-01-20 12:22:54 +00:00
|
|
|
{% else %}
|
2021-03-11 15:54:47 +00:00
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
2021-03-11 05:26:00 +00:00
|
|
|
<div class="card-img-top no-image">
|
|
|
|
{{ frappe.utils.get_abbr(title) }}
|
|
|
|
</div>
|
|
|
|
</a>
|
2020-12-24 06:10:33 +00:00
|
|
|
{% endif %}
|
2021-05-17 15:14:41 +00:00
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 06:10:33 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
2021-05-17 15:14:41 +00:00
|
|
|
{%- macro item_card_body(title, description, item, is_featured, align) -%}
|
2020-12-24 06:10:33 +00:00
|
|
|
{%- set align_class = resolve_class({
|
|
|
|
'text-right': align == 'Right',
|
|
|
|
'text-center': align == 'Center' and not is_featured,
|
|
|
|
'text-left': align == 'Left' or is_featured,
|
|
|
|
}) -%}
|
2021-03-11 05:26:00 +00:00
|
|
|
<div class="card-body {{ align_class }}" style="width:100%">
|
2021-05-24 20:05:22 +00:00
|
|
|
<div class="mt-4">
|
2021-03-11 15:54:47 +00:00
|
|
|
<a href="/{{ item.route or '#' }}">
|
2021-05-12 19:52:05 +00:00
|
|
|
<div class="product-title">
|
|
|
|
{{ title or '' }}
|
|
|
|
</div>
|
2021-03-11 05:26:00 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
2020-12-24 06:10:33 +00:00
|
|
|
{% if is_featured %}
|
2021-05-24 20:05:22 +00:00
|
|
|
<div class="product-description ellipsis text-muted" style="white-space: normal;">
|
|
|
|
{{ description or '' }}
|
|
|
|
</div>
|
2020-12-24 06:10:33 +00:00
|
|
|
{% else %}
|
2021-04-12 19:09:26 +00:00
|
|
|
<div class="product-category">{{ item.item_group or '' }}</div>
|
2020-12-24 06:10:33 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
2021-03-15 18:35:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
{%- macro wishlist_card(item, settings) %}
|
2021-04-12 19:09:26 +00:00
|
|
|
<div class="col-sm-3 wishlist-card">
|
|
|
|
<div class="card text-center" style="max-height: 390px;">
|
2021-03-15 18:35:53 +00:00
|
|
|
{% if item.image %}
|
|
|
|
<div class="card-img-container">
|
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
|
|
|
<img class="card-img" src="{{ item.image }}" alt="{{ title }}">
|
|
|
|
</a>
|
2021-03-22 10:47:59 +00:00
|
|
|
<div class="remove-wish" data-item-code="{{ item.item_code }}">
|
2021-03-15 18:35:53 +00:00
|
|
|
<span style="padding-bottom: 2px;">
|
|
|
|
<svg class="icon sm remove-wish-icon" style="margin-bottom: 4px; margin-left: 0.5px;">
|
|
|
|
<use class="close" href="#icon-close"></use>
|
|
|
|
</svg>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
|
|
|
<div class="card-img-top no-image">
|
|
|
|
{{ frappe.utils.get_abbr(title) }}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{{ wishlist_card_body(item, settings) }}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
|
|
{%- macro wishlist_card_body(item, settings) %}
|
2021-03-22 10:47:59 +00:00
|
|
|
<div class="card-body text-center" style="width: 100%;">
|
2021-03-15 18:35:53 +00:00
|
|
|
<div style="margin-top: 16px;">
|
|
|
|
<div class="product-title">{{ item.item_name or item.item_code or ''}}</div>
|
|
|
|
</div>
|
2021-04-12 19:09:26 +00:00
|
|
|
<div class="product-price">
|
|
|
|
{{ item.formatted_price or '' }}
|
|
|
|
|
|
|
|
{% if item.get("formatted_mrp") %}
|
|
|
|
<small class="ml-1 text-muted">
|
|
|
|
<s>{{ item.formatted_mrp }}</s>
|
|
|
|
</small>
|
|
|
|
<small class="ml-1" style="color: #F47A7A; font-weight: 500;">
|
|
|
|
{{ item.discount }} OFF
|
|
|
|
</small>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2021-03-15 18:35:53 +00:00
|
|
|
|
|
|
|
{% if (item.available and settings.show_stock_availability) or (not settings.show_stock_availability) %}
|
2021-04-12 19:09:26 +00:00
|
|
|
<!-- Show move to cart button if in stock or if showing stock availability is disabled -->
|
|
|
|
<button data-item-code="{{ item.item_code}}" class="btn btn-add-to-cart w-100 wishlist-cart-not-added mt-2">
|
|
|
|
<span class="mr-2">
|
|
|
|
<svg class="icon icon-md">
|
|
|
|
<use href="#icon-assets"></use>
|
|
|
|
</svg>
|
|
|
|
</span>
|
|
|
|
{{ _("Move to Cart") }}
|
|
|
|
</button>
|
2021-03-15 18:35:53 +00:00
|
|
|
{% else %}
|
2021-04-12 19:09:26 +00:00
|
|
|
<div class="mt-4" style="color: #F47A7A; width: 100%;">
|
|
|
|
{{ _("Not in Stock") }}
|
|
|
|
</div>
|
2021-03-15 18:35:53 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
2021-03-25 06:22:50 +00:00
|
|
|
|
|
|
|
{%- macro ratings_with_title(avg_rating, title, size, rating_header_class) -%}
|
|
|
|
<div style="display: flex;">
|
|
|
|
<div class="rating">
|
|
|
|
{% for i in range(1,6) %}
|
|
|
|
{% set fill_class = 'star-click' if i <= avg_rating else '' %}
|
|
|
|
<svg class="icon icon-{{ size }} {{ fill_class }}">
|
|
|
|
<use href="#icon-star"></use>
|
|
|
|
</svg>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
<p class="ml-4 {{ rating_header_class }}">
|
|
|
|
<span>{{ title }}</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
2021-04-07 18:19:04 +00:00
|
|
|
|
|
|
|
{%- macro ratings_summary(reviews, reviews_per_rating, average_rating, average_whole_rating)-%}
|
|
|
|
<!-- Ratings Summary -->
|
|
|
|
<h2 class="reviews-header">
|
|
|
|
{{ _("Customer Ratings") }}
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
{% if reviews %}
|
|
|
|
{% set rating_title = frappe.utils.cstr(average_rating) + " " + _("out of 5") %}
|
|
|
|
{{ ratings_with_title(average_whole_rating, rating_title, "lg", "rating-summary-title") }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<!-- Rating Progress Bars -->
|
|
|
|
<div class="rating-progress-bar-section">
|
|
|
|
{% for percent in reviews_per_rating %}
|
|
|
|
<div class="mt-4 col-sm-4 small rating-bar-title">
|
|
|
|
{{ loop.index }} star
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-7">
|
|
|
|
<div class="progress rating-progress-bar" title="{{ percent }} % of reviews are {{ loop.index }} star">
|
|
|
|
<div class="progress-bar" role="progressbar"
|
|
|
|
aria-valuenow="{{ percent }}"
|
|
|
|
aria-valuemin="0" aria-valuemax="100"
|
|
|
|
style="width: {{ percent }}%; background-color: var(--text-on-green);">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-1 small">
|
|
|
|
{{ percent }}%
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
|
|
{%- macro user_review(reviews)-%}
|
|
|
|
<!-- User Reviews -->
|
|
|
|
<div class="user-reviews">
|
|
|
|
{% for review in reviews %}
|
|
|
|
<div class="mb-3 review">
|
|
|
|
{{ ratings_with_title(review.rating, _(review.review_title), "md", "user-review-title") }}
|
|
|
|
|
|
|
|
<div class="review-signature">
|
|
|
|
<span class="reviewer">{{ _(review.customer) }}</span>
|
|
|
|
<span>{{ review.published_on }}</span>
|
|
|
|
</div>
|
|
|
|
<div class="product-description mb-4 mt-4">
|
|
|
|
<p>
|
|
|
|
{{ _(review.comment) }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
2021-04-20 16:24:52 +00:00
|
|
|
|
|
|
|
{%- macro field_filter_section(filters)-%}
|
|
|
|
{% for field_filter in filters %}
|
|
|
|
{%- set item_field = field_filter[0] %}
|
|
|
|
{%- set values = field_filter[1] %}
|
|
|
|
<div class="mb-4 filter-block pb-5">
|
|
|
|
<div class="filter-label mb-3">{{ item_field.label }}</div>
|
|
|
|
|
|
|
|
{% if values | len > 20 %}
|
|
|
|
<!-- show inline filter if values more than 20 -->
|
|
|
|
<input type="text" class="form-control form-control-sm mb-2 product-filter-filter"/>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if values %}
|
|
|
|
<div class="filter-options">
|
|
|
|
{% for value in values %}
|
|
|
|
<div class="checkbox" data-value="{{ value }}">
|
|
|
|
<label for="{{value}}">
|
|
|
|
<input type="checkbox"
|
|
|
|
class="product-filter field-filter"
|
|
|
|
id="{{value}}"
|
|
|
|
data-filter-name="{{ item_field.fieldname }}"
|
2021-04-21 07:01:15 +00:00
|
|
|
data-filter-value="{{ value }}">
|
2021-04-20 16:24:52 +00:00
|
|
|
<span class="label-area">{{ value }}</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<i class="text-muted">{{ _('No values') }}</i>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
|
|
{%- macro attribute_filter_section(filters)-%}
|
|
|
|
{% for attribute in filters %}
|
|
|
|
<div class="mb-4 filter-block pb-5">
|
|
|
|
<div class="filter-label mb-3">{{ attribute.name}}</div>
|
|
|
|
{% if values | len > 20 %}
|
|
|
|
<!-- show inline filter if values more than 20 -->
|
|
|
|
<input type="text" class="form-control form-control-sm mb-2 product-filter-filter"/>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if attribute.item_attribute_values %}
|
|
|
|
<div class="filter-options">
|
|
|
|
{% for attr_value in attribute.item_attribute_values %}
|
|
|
|
<div class="checkbox">
|
2021-05-12 19:52:05 +00:00
|
|
|
<label data-value="{{ attr_value }}">
|
2021-04-20 16:24:52 +00:00
|
|
|
<input type="checkbox"
|
|
|
|
class="product-filter attribute-filter"
|
|
|
|
id="{{attr_value.name}}"
|
|
|
|
data-attribute-name="{{ attribute.name }}"
|
|
|
|
data-attribute-value="{{ attr_value.attribute_value }}"
|
|
|
|
{% if attr_value.checked %} checked {% endif %}>
|
|
|
|
<span class="label-area">{{ attr_value.attribute_value }}</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<i class="text-muted">{{ _('No values') }}</i>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{%- endmacro -%}
|