2021-04-20 16:24:52 +00:00
|
|
|
{% from "erpnext/templates/includes/macros.html" import attribute_filter_section, field_filter_section, discount_range_filters %}
|
2019-03-19 06:18:32 +00:00
|
|
|
{% extends "templates/web.html" %}
|
2021-04-20 16:24:52 +00:00
|
|
|
|
2019-03-19 06:18:32 +00:00
|
|
|
{% block title %}{{ _('Products') }}{% endblock %}
|
|
|
|
{% block header %}
|
2020-12-24 06:10:33 +00:00
|
|
|
<div class="mb-6">{{ _('Products') }}</div>
|
2019-03-19 06:18:32 +00:00
|
|
|
{% endblock header %}
|
|
|
|
|
|
|
|
{% block page_content %}
|
2020-12-24 06:10:33 +00:00
|
|
|
<div class="row" style="display: none;">
|
2019-03-19 06:18:32 +00:00
|
|
|
<div class="col-8">
|
|
|
|
<div class="input-group input-group-sm mb-3">
|
|
|
|
<input type="search" class="form-control" placeholder="{{_('Search')}}"
|
|
|
|
aria-label="{{_('Product Search')}}" aria-describedby="product-search"
|
2020-05-26 12:51:11 +00:00
|
|
|
value="{{ frappe.sanitize_html(frappe.form_dict.search) or '' }}"
|
2019-03-19 06:18:32 +00:00
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-4 pl-0">
|
|
|
|
<button class="btn btn-light btn-sm btn-block d-md-none"
|
|
|
|
type="button"
|
|
|
|
data-toggle="collapse"
|
|
|
|
data-target="#product-filters"
|
|
|
|
aria-expanded="false"
|
|
|
|
aria-controls="product-filters"
|
|
|
|
style="white-space: nowrap;"
|
|
|
|
>
|
|
|
|
{{ _('Toggle Filters') }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
2020-12-24 06:10:33 +00:00
|
|
|
<div class="col-12 order-2 col-md-9 order-md-2 item-card-group-section">
|
2020-12-30 07:30:35 +00:00
|
|
|
<div class="row products-list">
|
2020-12-24 06:10:33 +00:00
|
|
|
{% 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>
|
2019-03-19 06:18:32 +00:00
|
|
|
</div>
|
2020-12-24 06:10:33 +00:00
|
|
|
<div class="col-12 order-1 col-md-3 order-md-1">
|
2019-03-19 06:18:32 +00:00
|
|
|
|
2019-06-14 12:46:14 +00:00
|
|
|
{% if frappe.form_dict.start or frappe.form_dict.field_filters or frappe.form_dict.attribute_filters or frappe.form_dict.search %}
|
2020-12-24 06:10:33 +00:00
|
|
|
|
|
|
|
|
2019-03-19 06:18:32 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2020-12-24 06:10:33 +00:00
|
|
|
<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>
|
2021-04-20 16:24:52 +00:00
|
|
|
<!-- field filters -->
|
2021-02-19 10:26:52 +00:00
|
|
|
{% if field_filters %}
|
2021-04-20 16:24:52 +00:00
|
|
|
{{ field_filter_section(field_filters) }}
|
2021-02-19 10:26:52 +00:00
|
|
|
{% endif %}
|
2019-03-19 06:18:32 +00:00
|
|
|
|
2021-04-20 16:24:52 +00:00
|
|
|
<!-- attribute filters -->
|
2021-02-19 10:26:52 +00:00
|
|
|
{% if attribute_filters %}
|
2021-04-20 16:24:52 +00:00
|
|
|
{{ attribute_filter_section(attribute_filters) }}
|
|
|
|
{% endif %}
|
2019-03-19 06:18:32 +00:00
|
|
|
|
2021-04-20 16:24:52 +00:00
|
|
|
<!-- discount filters -->
|
|
|
|
{% if discount_filters %}
|
|
|
|
{{ discount_range_filters(discount_filters) }}
|
2021-02-19 10:26:52 +00:00
|
|
|
{% endif %}
|
2019-03-19 06:18:32 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
frappe.ready(() => {
|
|
|
|
$('.product-filter-filter').on('keydown', frappe.utils.debounce((e) => {
|
|
|
|
const $input = $(e.target);
|
|
|
|
const keyword = ($input.val() || '').toLowerCase();
|
|
|
|
const $filter_options = $input.next('.filter-options');
|
|
|
|
|
|
|
|
$filter_options.find('.custom-control').show();
|
|
|
|
$filter_options.find('.custom-control').each((i, el) => {
|
|
|
|
const $el = $(el);
|
|
|
|
const value = $el.data('value').toLowerCase();
|
|
|
|
if (!value.includes(keyword)) {
|
|
|
|
$el.hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 300));
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-20 12:22:54 +00:00
|
|
|
<div class="row product-paging-area mt-5">
|
|
|
|
<div class="col-3">
|
|
|
|
</div>
|
|
|
|
<div class="col-9 text-right">
|
2019-03-19 06:18:32 +00:00
|
|
|
{% if frappe.form_dict.start|int > 0 %}
|
2021-01-20 12:22:54 +00:00
|
|
|
<button class="btn btn-default btn-prev" data-start="{{ frappe.form_dict.start|int - page_length }}">{{ _("Prev") }}</button>
|
2019-03-19 06:18:32 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if items|length >= page_length %}
|
2021-01-20 12:22:54 +00:00
|
|
|
<button class="btn btn-default btn-next" data-start="{{ frappe.form_dict.start|int + page_length }}">{{ _("Next") }}</button>
|
2019-03-19 06:18:32 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
frappe.ready(() => {
|
|
|
|
$('.btn-prev, .btn-next').click((e) => {
|
|
|
|
const $btn = $(e.target);
|
|
|
|
$btn.prop('disabled', true);
|
|
|
|
const start = $btn.data('start');
|
|
|
|
let query_params = frappe.utils.get_query_params();
|
|
|
|
query_params.start = start;
|
|
|
|
let path = window.location.pathname + '?' + frappe.utils.get_url_from_dict(query_params);
|
|
|
|
window.location.href = path;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-12-24 06:10:33 +00:00
|
|
|
{% endblock %}
|