feat: added continue-shopping button on cart

This commit is contained in:
Anupam
2021-02-05 16:17:20 +05:30
557 changed files with 22047 additions and 12421 deletions

View File

@@ -2,7 +2,7 @@
{% block title %} {{ _("Shopping Cart") }} {% endblock %}
{% block header %}<h1>{{ _("Shopping Cart") }}</h1>{% endblock %}
{% block header %}<h3 class="shopping-cart-header mt-2 mb-6">{{ _("Shopping Cart") }}</h1>{% endblock %}
<!--
{% block script %}
@@ -18,97 +18,122 @@
{% from "templates/includes/macros.html" import item_name_and_description %}
{% if doc.items %}
<div class="cart-container">
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
<div class="row m-0">
<div class="col-md-8 frappe-card p-5">
<div>
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
<div class="cart-items-header">
{{ _('Items') }}
</div>
<table class="table mt-3 cart-table">
<thead>
<tr>
<th width="60%">{{ _('Item') }}</th>
<th width="20%">{{ _('Quantity') }}</th>
{% if cart_settings.enable_checkout %}
<th width="20%" class="text-right">{{ _('Subtotal') }}</th>
{% endif %}
</tr>
</thead>
<tbody class="cart-items">
{% include "templates/includes/cart/cart_items.html" %}
</tbody>
{% if cart_settings.enable_checkout %}
<tfoot class="cart-tax-items">
{% include "templates/includes/order/order_taxes.html" %}
</tfoot>
{% endif %}
</table>
</div>
<div class="row">
<div class="col-4">
{% if cart_settings.enable_checkout %}
<a class="btn btn-outline-primary" href="/orders">
{{ _('See past orders') }}
</a>
{% else %}
<a class="btn btn-outline-primary" href="/quotations">
{{ _('See past quotations') }}
</a>
{% endif %}
</div>
<div class="col-8">
{% if doc.items %}
<div class="place-order-container">
<a class="btn btn-primary-light mr-2" href="/all-products">
{{ _("Continue Shopping") }}
</a>
{% if cart_settings.enable_checkout %}
<button class="btn btn-primary btn-place-order" type="button">
{{ _("Place Order") }}
</button>
{% else %}
<button class="btn btn-primary btn-request-for-quotation" type="button">
{{ _("Request for Quotation") }}
</button>
{% endif %}
</div>
{% endif %}
</div>
</div>
{% if doc.items %}
<table class="table table-bordered mt-3">
<thead>
<tr>
<th width="60%">{{ _('Item') }}</th>
<th width="20%" class="text-right">{{ _('Quantity') }}</th>
{% if cart_settings.enable_checkout %}
<th width="20%" class="text-right">{{ _('Subtotal') }}</th>
{% endif %}
</tr>
</thead>
<tbody class="cart-items">
{% include "templates/includes/cart/cart_items.html" %}
</tbody>
{% if cart_settings.enable_checkout %}
<tfoot class="cart-tax-items">
{% include "templates/includes/order/order_taxes.html" %}
</tfoot>
{% endif %}
</table>
{% else %}
<p class="text-muted">{{ _('Your cart is Empty') }}</p>
{% endif %}
{% if doc.items %}
<div class="place-order-container">
<a class="btn btn-primary-light mr-2" href="/all-products">
{{ _("Continue Shopping") }}
</a>
{% if cart_settings.enable_checkout %}
<button class="btn btn-primary btn-place-order" type="button">
{{ _("Place Order") }}
</button>
{% else %}
<button class="btn btn-primary btn-request-for-quotation" type="button">
{{ _("Request for Quotation") }}
</button>
{% if doc.items %}
{% if doc.tc_name %}
<div class="terms-and-conditions-link">
<a href class="link-terms-and-conditions" data-terms-name="{{ doc.tc_name }}">
{{ _("Terms and Conditions") }}
</a>
<script>
frappe.ready(() => {
$('.link-terms-and-conditions').click((e) => {
e.preventDefault();
const $link = $(e.target);
const terms_name = $link.attr('data-terms-name');
show_terms_and_conditions(terms_name);
})
});
function show_terms_and_conditions(terms_name) {
frappe.call('erpnext.shopping_cart.cart.get_terms_and_conditions', { terms_name })
.then(r => {
frappe.msgprint({
title: terms_name,
message: r.message
});
});
}
</script>
</div>
{% endif %}
</div>
{% endif %}
{% if doc.items %}
{% if doc.tc_name %}
<div class="terms-and-conditions-link">
<a href class="link-terms-and-conditions" data-terms-name="{{ doc.tc_name }}">
{{ _("Terms and Conditions") }}
</a>
<script>
frappe.ready(() => {
$('.link-terms-and-conditions').click((e) => {
e.preventDefault();
const $link = $(e.target);
const terms_name = $link.attr('data-terms-name');
show_terms_and_conditions(terms_name);
})
});
function show_terms_and_conditions(terms_name) {
frappe.call('erpnext.shopping_cart.cart.get_terms_and_conditions', { terms_name })
.then(r => {
frappe.msgprint({
title: terms_name,
message: r.message
});
});
}
</script>
<div class="col-md-4">
<div class="cart-addresses">
{% include "templates/includes/cart/cart_address.html" %}
</div>
</div>
{% endif %}
<div class="cart-addresses mt-5">
{% include "templates/includes/cart/cart_address.html" %}
{% endif %}
</div>
{% endif %}
</div>
<div class="row mt-5">
<div class="col-12">
{% if cart_settings.enable_checkout %}
<a href="/orders">
{% else %}
<div class="cart-empty frappe-card">
<div class="cart-empty-state">
<img src="/assets/erpnext/images/ui-states/cart-empty-state.png" alt="Empty State">
</div>
<div class="cart-empty-message mt-4">{{ _('Your cart is Empty') }}</p>
{% if cart_settings.enable_checkout %}
<a class="btn btn-outline-primary" href="/orders">
{{ _('See past orders') }}
</a>
{% else %}
<a href="/quotations">
<a class="btn btn-outline-primary" href="/quotations">
{{ _('See past quotations') }}
</a>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}

View File

@@ -20,7 +20,7 @@
<div class="row transaction-subheading">
<div class="col-xs-6">
<span class="indicator {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
<span class="indicator {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "gray") }}">
{{ _(doc.get('indicator_title')) or _(doc.status) or _("Submitted") }}
</span>
</div>

View File

@@ -8,7 +8,7 @@
{% block title %}{{ doc.name }}{% endblock %}
{% block header %}
<h1 class="m-0">{{ doc.name }}</h1>
<h2 class="m-0">{{ doc.name }}</h2>
{% endblock %}
{% block header_actions %}
@@ -33,7 +33,7 @@
<div class="row transaction-subheading">
<div class="col-6">
<span class="indicator {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
<span class="indicator-pill {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{% if doc.doctype == "Quotation" and not doc.docstatus %}
{{ _("Pending") }}
{% else %}
@@ -41,7 +41,7 @@
{% endif %}
</span>
</div>
<div class="col-6 text-muted text-right small">
<div class="col-6 text-muted text-right small pt-3">
{{ frappe.utils.format_date(doc.transaction_date, 'medium') }}
{% if doc.valid_till %}
<p>
@@ -66,38 +66,39 @@
{% endif %}
<div class="order-container">
<!-- items -->
<div class="order-item-table">
<div class="row order-items order-item-header text-muted">
<div class="col-sm-6 col-6 h6 text-uppercase">
<table class="order-item-table w-100 table">
<thead class="order-items order-item-header">
<th width="60%">
{{ _("Item") }}
</div>
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
</th>
<th width="20%" class="text-right">
{{ _("Quantity") }}
</div>
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
</th>
<th width="20%" class="text-right">
{{ _("Amount") }}
</div>
</div>
</th>
</thead>
<tbody>
{% for d in doc.items %}
<div class="row order-items">
<div class="col-sm-6 col-6">
<tr class="order-items">
<td>
{{ item_name_and_description(d) }}
</div>
<div class="col-sm-3 col-xs-3 text-right">
</td>
<td class="text-right">
{{ d.qty }}
{% if d.delivered_qty is defined and d.delivered_qty != None %}
<p class="text-muted small">{{ _("Delivered") }}&nbsp;{{ d.delivered_qty }}</p>
{% endif %}
</div>
<div class="col-sm-3 col-xs-3 text-right">
</td>
<td class="text-right">
{{ d.get_formatted("amount") }}
<p class="text-muted small">{{ _("Rate:") }}&nbsp;{{ d.get_formatted("rate") }}</p>
</div>
</div>
</td>
</tr>
{% endfor %}
</div>
</tbody>
</table>
<!-- taxes -->
<div class="order-taxes d-flex justify-content-end">
<table>

View File

@@ -77,13 +77,13 @@
<div class="web-list-item transaction-list-item quotations" idx="{{d.name}}">
<div class="row">
<div class="col-sm-6">
<span class="indicator darkgrey">{{d.name}}</span>
<span class="indicator gray">{{d.name}}</span>
</div>
<div class="col-sm-3">
<span class="small darkgrey">{{d.status}}</span>
<span class="small gray">{{d.status}}</span>
</div>
<div class="col-sm-3">
<span class="small darkgrey">{{d.transaction_date}}</span>
<span class="small gray">{{d.transaction_date}}</span>
</div>
</div>
<a class="transaction-item-link" href="/quotations/{{d.name}}">Link</a>