Merge branch 'develop' of https://github.com/0Pranav/erpnext into scheduling-ui-rewrite

This commit is contained in:
0Pranav
2019-11-01 12:40:08 +05:30
156 changed files with 7423 additions and 5760 deletions

View File

@@ -20,6 +20,7 @@ $.extend(shopping_cart, {
shopping_cart.bind_change_qty();
shopping_cart.bind_change_notes();
shopping_cart.bind_dropdown_cart_buttons();
shopping_cart.bind_coupon_code();
},
bind_address_select: function() {
@@ -193,6 +194,29 @@ $.extend(shopping_cart, {
}
}
});
},
bind_coupon_code: function() {
$(".bt-coupon").on("click", function() {
shopping_cart.apply_coupon_code(this);
});
},
apply_coupon_code: function(btn) {
return frappe.call({
type: "POST",
method: "erpnext.shopping_cart.cart.apply_coupon_code",
btn: btn,
args : {
applied_code : $('.txtcoupon').val(),
applied_referral_sales_partner: $('.txtreferral_sales_partner').val()
},
callback: function(r) {
if (r && r.message){
location.reload();
}
}
});
}
});

View File

@@ -4,6 +4,16 @@
{% set select_address = True %}
{% endif %}
{% set show_coupon_code = frappe.db.get_single_value('Shopping Cart Settings', 'show_apply_coupon_code_in_website') %}
{% if show_coupon_code == 1%}
<div class="mb-3">
<div class="row no-gutters">
<input type="text" class="txtcoupon form-control mr-3 w-25" placeholder="Enter Coupon Code" name="txtcouponcode" ></input>
<button class="btn btn-primary btn-sm bt-coupon">{{ _("Apply Coupon Code") }}</button>
<input type="hidden" class="txtreferral_sales_partner" placeholder="Enter Sales Partner" name="txtreferral_sales_partner" type="text"></input>
</div>
</div>
{% endif %}
<div class="mb-3" data-section="shipping-address">
<h6 class="text-uppercase">{{ _("Shipping Address") }}</h6>
<div class="row no-gutters" data-fieldname="shipping_address_name">
@@ -94,7 +104,7 @@ frappe.ready(() => {
{
label: __('Country'),
fieldname: 'country',
fieldtype: 'Data',
fieldtype: 'Link',
reqd: 1
},
],

View File

@@ -22,6 +22,71 @@
{% endif %}
{% endfor %}
{% if doc.doctype == 'Quotation' %}
{% if doc.coupon_code %}
<tr>
<th class="text-right" colspan="2">
{{ _("Discount") }}
</th>
<th class="text-right tot_quotation_discount">
{% set tot_quotation_discount = [] %}
{%- for item in doc.items -%}
{% if tot_quotation_discount.append((((item.price_list_rate * item.qty)
* item.discount_percentage) / 100)) %}{% endif %}
{% endfor %}
{{ frappe.utils.fmt_money((tot_quotation_discount | sum),currency=doc.currency) }}
</th>
</tr>
{% endif %}
{% endif %}
{% if doc.doctype == 'Sales Order' %}
{% if doc.coupon_code %}
<tr>
<th class="text-right" colspan="2">
{{ _("Total Amount") }}
</th>
<th class="text-right">
<span>
{% set total_amount = [] %}
{%- for item in doc.items -%}
{% if total_amount.append((item.price_list_rate * item.qty)) %}{% endif %}
{% endfor %}
{{ frappe.utils.fmt_money((total_amount | sum),currency=doc.currency) }}
</span>
</th>
</tr>
<tr>
<th class="text-right" colspan="2">
{{ _("Applied Coupon Code") }}
</th>
<th class="text-right">
<span>
{%- for row in frappe.get_all(doctype="Coupon Code",
fields=["coupon_code"], filters={ "name":doc.coupon_code}) -%}
<span>{{ row.coupon_code }}</span>
{% endfor %}
</span>
</th>
</tr>
<tr>
<th class="text-right" colspan="2">
{{ _("Discount") }}
</th>
<th class="text-right">
<span>
{% set tot_SO_discount = [] %}
{%- for item in doc.items -%}
{% if tot_SO_discount.append((((item.price_list_rate * item.qty)
* item.discount_percentage) / 100)) %}{% endif %}
{% endfor %}
{{ frappe.utils.fmt_money((tot_SO_discount | sum),currency=doc.currency) }}
</span>
</th>
</tr>
{% endif %}
{% endif %}
<tr>
<th class="text-right" colspan="2">
{{ _("Grand Total") }}

View File

@@ -3,13 +3,13 @@
{% for d in doc.items %}
<div class="rfq-item">
<div class="row">
<div class="col-sm-5 col-xs-12" style="margin-bottom: 10px;margin-top: 5px;">
<div class="col-sm-5 col-12" style="margin-bottom: 10px;margin-top: 5px;">
{{ item_name_and_description(d, doc) }}
</div>
<!-- <div class="col-sm-2 col-xs-2" style="margin-bottom: 10px;">
<!-- <div class="col-sm-2 col-2" style="margin-bottom: 10px;">
<textarea type="text" style="margin-top: 5px;" class="input-with-feedback form-control rfq-offer_detail" ></textarea>
</div> -->
<div class="col-sm-2 col-xs-4 text-right">
<div class="col-sm-2 col-4 text-right">
<input type="text" class="form-control text-right rfq-qty" style="margin-top: 5px;display: inline-block"
value = "{{ d.get_formatted('qty') }}"
data-idx="{{ d.idx }}">
@@ -17,14 +17,14 @@
{{_("UOM") + ":"+ d.uom}}
</p>
</div>
<div class="col-sm-2 col-xs-4 text-right">
<div class="col-sm-2 col-4 text-right">
<input type="text" class="form-control text-right rfq-rate"
style="margin-top: 5px;display: inline-block" value="0.00"
data-idx="{{ d.idx }}">
</div>
<div class="col-sm-3 col-xs-4 text-right" style="padding-top: 9px;">
<div class="col-sm-3 col-4 text-right" style="padding-top: 9px;">
{{doc.currency_symbol}} <span class="rfq-amount" data-idx="{{ d.idx }}">0.00</span>
</div>
</div>
</div>
{% endfor %}
{% endfor %}

View File

@@ -1,13 +1,11 @@
{% from "erpnext/templates/includes/macros.html" import product_image_square %}
{% from "erpnext/templates/includes/macros.html" import product_image_square, product_image %}
{% macro item_name_and_description(d, doc) %}
<div class="row">
<div class="col-xs-4 col-sm-2 order-image-col">
<div class="order-image">
{{ product_image_square(d.image) }}
</div>
<div class="col-3">
{{ product_image(d.image) }}
</div>
<div class="col-xs-8 col-sm-10">
<div class="col-9">
{{ d.item_code }}
<p class="text-muted small">{{ d.description }}</p>
{% set supplier_part_no = frappe.db.get_value("Item Supplier", {'parent': d.item_code, 'supplier': doc.supplier}, "supplier_part_no") %}

View File

@@ -1,22 +1,21 @@
<div class="web-list-item transaction-list-item">
<a href="/{{ pathname }}/{{ doc.name }}">
<div class="row">
<div class="col-sm-4" style='margin-top: -3px;'>
<span class="indicator small {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{{ doc.name }}</span>
<div class="small text-muted transaction-time"
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}">
{{ frappe.utils.global_date_format(doc.modified) }}
</div>
</div>
<div class="col-sm-5">
<div class="small text-muted items-preview ellipsis ellipsis-width">
{{ doc.items_preview }}
</div>
</div>
<div class="col-sm-3 text-right bold">
{{ doc.get_formatted("grand_total") }}
<div class="row">
<div class="col-sm-4">
<span class="indicator small {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{{ doc.name }}</span>
<div class="small text-muted transaction-time"
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}">
{{ frappe.utils.global_date_format(doc.modified) }}
</div>
</div>
</a>
<div class="col-sm-5">
<div class="small text-muted items-preview ellipsis ellipsis-width">
{{ doc.items_preview }}
</div>
</div>
<div class="col-sm-3 text-right bold">
{{ doc.get_formatted("grand_total") }}
</div>
</div>
<a class="transaction-item-link" href="/{{ pathname }}/{{ doc.name }}">Link</a>
</div>

View File

@@ -12,7 +12,22 @@
{% endblock %}
{% block header_actions %}
<a href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}' target="_blank" rel="noopener noreferrer">{{ _("Print") }}</a>
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span>{{ _('Actions') }}</span>
<b class="caret"></b>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
{% if doc.doctype == 'Purchase Order' %}
<a class="dropdown-item" href="/api/method/erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice_from_portal?purchase_order_name={{ doc.name }}" data-action="make_purchase_invoice">{{ _("Make Purchase Invoice") }}</a>
{% endif %}
<a class="dropdown-item" href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}'
target="_blank" rel="noopener noreferrer">
{{ _("Print") }}
</a>
</ul>
</div>
{% endblock %}
{% block page_content %}
@@ -34,7 +49,7 @@
</div>
<p class="small my-3">
{%- set party_name = doc.supplier_name if doc.doctype == 'Supplier Quotation' else doc.customer_name %}
{%- set party_name = doc.supplier_name if doc.doctype in ['Supplier Quotation', 'Purchase Invoice', 'Purchase Order'] else doc.customer_name %}
<b>{{ party_name }}</b>
{% if doc.contact_display and doc.contact_display != party_name %}
@@ -172,4 +187,4 @@
currency: '{{ doc.currency }}'
}
</script>
{% endblock %}
{% endblock %}

View File

@@ -5,7 +5,9 @@ frappe.ready(function(){
var loyalty_points_input = document.getElementById("loyalty-point-to-redeem");
var loyalty_points_status = document.getElementById("loyalty-points-status");
loyalty_points_input.onblur = apply_loyalty_points;
if (loyalty_points_input) {
loyalty_points_input.onblur = apply_loyalty_points;
}
function apply_loyalty_points() {
var loyalty_points = parseInt(loyalty_points_input.value);
@@ -37,4 +39,4 @@ frappe.ready(function(){
});
}
}
})
})

View File

@@ -22,10 +22,10 @@
{% block page_content %}
<div class="row">
<div class="col-xs-6">
<div class="col-6">
<div class="rfq-supplier">{{ doc.supplier }}</div>
</div>
<div class="col-xs-6 text-muted text-right h6">
<div class="col-6 text-muted text-right h6">
{{ doc.get_formatted("transaction_date") }}
</div>
</div>
@@ -33,16 +33,16 @@
<div id="order-container">
<div id="rfq-items">
<div class="row cart-item-header">
<div class="col-sm-5 col-xs-12">
<div class="col-sm-5 col-12">
{{ _("Items") }}
</div>
<div class="col-sm-2 col-xs-4 text-right">
<div class="col-sm-2 col-4 text-right">
{{ _("Qty") }}
</div>
<div class="col-sm-2 col-xs-4 text-right">
<div class="col-sm-2 col-4 text-right">
{{ _("Rate") }}
</div>
<div class="col-sm-3 col-xs-4 text-right">
<div class="col-sm-3 col-4 text-right">
{{ _("Amount") }}
</div>
</div>
@@ -55,30 +55,29 @@
</div>
{% if doc.items %}
<div class="row grand-total-row">
<div class="col-xs-9 text-right">{{ _("Grand Total") }}</div>
<div class="col-xs-3 text-right">
<div class="col-9 text-right">{{ _("Grand Total") }}</div>
<div class="col-3 text-right">
{{doc.currency_symbol}} <span class="tax-grand-total">0.0</span>
</div>
</div>
{% endif %}
<div class="row terms">
<div class="col-xs-6">
<div class="col-6">
<br><br>
<p class="text-muted small">{{ _("Notes: ") }}</p>
<textarea class="form-control terms-feedback" style="height: 100px;"></textarea>
</div>
</div>
<hr>
<div class="row">
<div class="result">
<div class="col-xs-12">
<p class="text-muted small">{{ _("Quotations: ") }}</p>
{% if doc.rfq_links %}
<div class="row mt-5">
<div class="col-12">
<p class="text-muted small">{{ _("Quotations: ") }}</p>
{% if doc.rfq_links %}
<div class="result">
{% for d in doc.rfq_links %}
<div class="web-list-item transaction-list-item quotations" idx="{{d.name}}">
<div class="row">
<div class="col-sm-6">
<span class="indicator darkgrey"><a href="/quotations/{{d.name}}">{{d.name}}</a></span>
<span class="indicator darkgrey">{{d.name}}</span>
</div>
<div class="col-sm-3">
<span class="small darkgrey">{{d.status}}</span>
@@ -87,10 +86,11 @@
<span class="small darkgrey">{{d.transaction_date}}</span>
</div>
</div>
<a class="transaction-item-link" href="/quotations/{{d.name}}">Link</a>
</div>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
</div>