feat: store home page and product page

This commit is contained in:
prssanna
2020-12-24 11:40:33 +05:30
parent 7a38f41350
commit eb0e596d43
15 changed files with 459 additions and 269 deletions

View File

@@ -1,12 +1,11 @@
{% extends "templates/web.html" %}
{% block title %}{{ _('Products') }}{% endblock %}
{% block header %}
<h1>{{ _('Products') }}</h1>
<div class="mb-6">{{ _('Products') }}</div>
{% endblock header %}
{% block page_content %}
<div class="row">
<div class="row" style="display: none;">
<div class="col-8">
<div class="input-group input-group-sm mb-3">
<input type="search" class="form-control" placeholder="{{_('Search')}}"
@@ -31,27 +30,34 @@
</div>
<div class="row">
<div class="col-12 order-2 col-md-8 order-md-1 products-list">
{% if items %}
{% for item in items %}
{% include "erpnext/www/all-products/item_row.html" %}
{% endfor %}
{% else %}
{% include "erpnext/www/all-products/not_found.html" %}
{% endif %}
<div class="col-12 order-2 col-md-9 order-md-2 item-card-group-section">
<div class="row">
{% if items %}
{% for item in items %}
{% include "erpnext/www/all-products/item_row.html" %}
{% endfor %}
{% else %}
{% include "erpnext/www/all-products/not_found.html" %}
{% endif %}
</div>
</div>
<div class="col-12 order-1 col-md-4 order-md-2">
<div class="col-12 order-1 col-md-3 order-md-1">
{% if frappe.form_dict.start or frappe.form_dict.field_filters or frappe.form_dict.attribute_filters or frappe.form_dict.search %}
<a class="mb-3 d-inline-block" href="/all-products">{{ _('Clear filters') }}</a>
{% endif %}
<div class="collapse d-md-block" id="product-filters">
<div class="collapse d-md-block mr-4 filters-section" id="product-filters">
<div class="d-flex justify-content-between align-items-center mb-5 title-section">
<div class="mb-4 filters-title" > {{ _('Filters') }} </div>
<a class="mb-4 clear-filters" href="/all-products">{{ _('Clear All') }}</a>
</div>
{% for field_filter in field_filters %}
{%- set item_field = field_filter[0] %}
{%- set values = field_filter[1] %}
<div class="mb-4">
<h6>{{ item_field.label }}</h6>
<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 -->
@@ -61,15 +67,15 @@
{% if values %}
<div class="filter-options">
{% for value in values %}
<div class="custom-control custom-checkbox" data-value="{{ value }}">
<input type="checkbox"
class="product-filter field-filter custom-control-input"
id="{{value}}"
data-filter-name="{{ item_field.fieldname }}"
data-filter-value="{{ value }}"
>
<label class="custom-control-label" for="{{value}}">
{{ value }}
<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 }}"
data-filter-value="{{ value }}"
>
<span class="label-area">{{ value }}</span>
</label>
</div>
{% endfor %}
@@ -81,9 +87,8 @@
{% endfor %}
{% for attribute in attribute_filters %}
<div class="mb-4">
<h6>{{ attribute.name }}</h6>
<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"/>
@@ -92,16 +97,15 @@
{% if attribute.item_attribute_values %}
<div class="filter-options">
{% for attr_value in attribute.item_attribute_values %}
<div class="custom-control custom-checkbox" data-value="{{ value }}">
<input type="checkbox"
class="product-filter attribute-filter custom-control-input"
id="{{attr_value.name}}"
data-attribute-name="{{ attribute.name }}"
data-attribute-value="{{ attr_value.attribute_value }}"
{% if attr_value.checked %} checked {% endif %}
>
<label class="custom-control-label" for="{{attr_value.name}}">
{{ attr_value.attribute_value }}
<div class="checkbox">
<label data-value="{{ value }}">
<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 %}
@@ -158,6 +162,4 @@
});
</script>
{% endblock %}
{% endblock %}

View File

@@ -1,24 +1,7 @@
<div class="card mb-3">
<div class="row no-gutters">
<div class="col-md-3">
<div class="card-body">
<a class="no-underline" href="/{{ item.route }}">
<img class="website-image" src="{{ item.website_image or item.image or 'no-image.jpg' }}" alt="{{ item.item_name }}">
</a>
</div>
</div>
<div class="col-md-9">
<div class="card-body">
<h5 class="card-title">
<a class="text-dark" href="/{{ item.route }}">
{{ item.item_name or item.name }}
</a>
</h5>
<p class="card-text">
{{ item.website_description or item.description or '<i class="text-muted">No description</i>' }}
</p>
<a href="/{{ item.route }}" class="btn btn-sm btn-light">{{ _('More details') }}</a>
</div>
</div>
</div>
</div>
{% from "erpnext/templates/includes/macros.html" import item_card, item_card_body %}
{{ item_card(
item.item_name or item.name, item.website_image or item.image, item.route, item.website_description or item.description,
item.standard_rate, item.item_group
) }}