mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 10:57:56 +00:00
feat: Offer Display
- Added offers section in website item - Added more roles to website item - Fixed attachment limit issue in website item - Created Website Offer child doctype - Added offers listing in Item full page view - style fixes
This commit is contained in:
@@ -44,6 +44,33 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Offers -->
|
||||
<br>
|
||||
<h3>Offers</h3>
|
||||
<div class="offer-container">
|
||||
{% for offer in doc.offers %}
|
||||
<div class="mt-2" style="display: flex;">
|
||||
<div class="mr-2" >
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" stroke="var(--yellow-500)" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 15.6213C19 15.2235 19.158 14.842 19.4393 14.5607L20.9393 13.0607C21.5251 12.4749 21.5251 11.5251 20.9393 10.9393L19.4393 9.43934C19.158 9.15804 19 8.7765 19 8.37868V6.5C19 5.67157 18.3284 5 17.5 5H15.6213C15.2235 5 14.842 4.84196 14.5607 4.56066L13.0607 3.06066C12.4749 2.47487 11.5251 2.47487 10.9393 3.06066L9.43934 4.56066C9.15804 4.84196 8.7765 5 8.37868 5H6.5C5.67157 5 5 5.67157 5 6.5V8.37868C5 8.7765 4.84196 9.15804 4.56066 9.43934L3.06066 10.9393C2.47487 11.5251 2.47487 12.4749 3.06066 13.0607L4.56066 14.5607C4.84196 14.842 5 15.2235 5 15.6213V17.5C5 18.3284 5.67157 19 6.5 19H8.37868C8.7765 19 9.15804 19.158 9.43934 19.4393L10.9393 20.9393C11.5251 21.5251 12.4749 21.5251 13.0607 20.9393L14.5607 19.4393C14.842 19.158 15.2235 19 15.6213 19H17.5C18.3284 19 19 18.3284 19 17.5V15.6213Z" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M15 9L9 15" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M10.5 9.5C10.5 10.0523 10.0523 10.5 9.5 10.5C8.94772 10.5 8.5 10.0523 8.5 9.5C8.5 8.94772 8.94772 8.5 9.5 8.5C10.0523 8.5 10.5 8.94772 10.5 9.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M15.5 14.5C15.5 15.0523 15.0523 15.5 14.5 15.5C13.9477 15.5 13.5 15.0523 13.5 14.5C13.5 13.9477 13.9477 13.5 14.5 13.5C15.0523 13.5 15.5 13.9477 15.5 14.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="mr-1">
|
||||
<strong>{{ _(offer.offer_title) }}:</strong>
|
||||
{{ _(offer.offer_subtitle) }}
|
||||
<a class="offer-details" href="#"
|
||||
data-offer-title="{{ offer.offer_title }}" data-offer-id="{{ offer.name }}"
|
||||
role="button">
|
||||
{{ _("More") }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Add to Cart / View in Cart, Contact Us -->
|
||||
<div class="mt-5 mb-5">
|
||||
<div style="display: flex;" class="mb-4">
|
||||
@@ -147,7 +174,42 @@
|
||||
};
|
||||
erpnext.wishlist.add_remove_from_wishlist("add", args, success_action, failure_action);
|
||||
});
|
||||
|
||||
$('.page_content').on('click', '.offer-details', (e) => {
|
||||
// Bind action on More link in Offers
|
||||
const $btn = $(e.currentTarget);
|
||||
$btn.prop('disabled', true);
|
||||
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __($btn.data('offer-title')),
|
||||
fields: [
|
||||
{
|
||||
fieldname: 'offer_details',
|
||||
fieldtype: 'HTML'
|
||||
},
|
||||
{
|
||||
fieldname: 'section_break',
|
||||
fieldtype: 'Section Break'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
frappe.call({
|
||||
method: 'erpnext.e_commerce.doctype.website_offer.website_offer.get_offer_details',
|
||||
args: {
|
||||
offer_id: $btn.data('offer-id')
|
||||
},
|
||||
callback: (value) => {
|
||||
d.set_value("offer_details", value.message);
|
||||
d.show();
|
||||
$btn.prop('disabled', false);
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="col-md-7 product-details {{ width_class }}">
|
||||
<!-- title -->
|
||||
<h1 class="product-title" itemprop="name">
|
||||
{{ item_name }}
|
||||
{{ doc.web_item_name }}
|
||||
</h1>
|
||||
<p class="product-code">
|
||||
<span>{{ _("Item Code") }}:</span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% from "erpnext/templates/includes/macros.html" import user_review, ratings_summary %}
|
||||
|
||||
<div class="mt-8 ratings-reviews-section" style="display: flex;">
|
||||
<div class="mt-12 ratings-reviews-section" style="display: flex;">
|
||||
<div class="col-md-4 order-md-1 mt-8" style="max-width: 300px;">
|
||||
{{ ratings_summary(reviews, reviews_per_rating, average_rating, average_whole_rating) }}
|
||||
|
||||
|
||||
@@ -42,4 +42,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block base_scripts %}
|
||||
<!-- js should be loaded in body! -->
|
||||
<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/js/frappe-web.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/js/control.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/js/dialog.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/js/bootstrap-4-web.min.js"></script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user