diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index 1bd6de10303..b5a781cd090 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -395,7 +395,7 @@ erpnext.POS = Class.extend({ }); dialog.show(); - dialog.get_input("total_amount").attr("disabled", "disabled"); + dialog.get_input("total_amount").prop("disabled", true); dialog.fields_dict.pay.input.onclick = function() { cur_frm.set_value("mode_of_payment", dialog.get_values().mode_of_payment); diff --git a/config.json b/config.json index ef5a1644008..e0f98d8daaa 100644 --- a/config.json +++ b/config.json @@ -101,13 +101,51 @@ }, "order": { "no_cache": true, - "template": "app/website/templates/pages/order", - "args_method": "selling.doctype.sales_order.sales_order.get_website_args" + "template": "app/website/templates/pages/sale", + "args_method": "website.helpers.transaction.get_order_args", + "portal": { + "doctype": "Sales Order", + "conditions": { + "docstatus": 1 + } + } }, "orders": { "no_cache": true, - "template": "app/website/templates/pages/orders", - "args_method": "selling.doctype.sales_order.sales_order.get_currency_and_number_format" + "template": "app/website/templates/pages/sales_transactions", + "args_method": "website.helpers.transaction.order_list_args" + }, + "invoice": { + "no_cache": true, + "template": "app/website/templates/pages/sale", + "args_method": "website.helpers.transaction.get_invoice_args", + "portal": { + "doctype": "Sales Invoice", + "conditions": { + "docstatus": 1 + } + } + }, + "invoices": { + "no_cache": true, + "template": "app/website/templates/pages/sales_transactions", + "args_method": "website.helpers.transaction.invoice_list_args" + }, + "shipment": { + "no_cache": true, + "template": "app/website/templates/pages/sale", + "args_method": "website.helpers.transaction.get_shipment_args", + "portal": { + "doctype": "Delivery Note", + "conditions": { + "docstatus": 1 + } + } + }, + "shipments": { + "no_cache": true, + "template": "app/website/templates/pages/sales_transactions", + "args_method": "website.helpers.transaction.shipment_list_args" }, "product_search": { "template": "app/website/templates/pages/product_search" @@ -115,10 +153,14 @@ "ticket": { "no_cache": true, "template": "app/website/templates/pages/ticket", - "args_method": "support.doctype.support_ticket.support_ticket.get_website_args" + "args_method": "support.doctype.support_ticket.support_ticket.get_website_args", + "portal": { + "doctype": "Support Ticket" + } }, "tickets": { - "template": "app/website/templates/pages/tickets" + "template": "app/website/templates/pages/tickets", + "args_method": "website.helpers.transaction.ticket_list_args" }, "address": { "no_cache": true, diff --git a/public/build.json b/public/build.json index 24abde20b2b..b8d7dd44525 100644 --- a/public/build.json +++ b/public/build.json @@ -7,8 +7,7 @@ "app/public/js/startup.css" ], "public/js/all-web.min.js": [ - "app/public/js/website_utils.js", - "lib/public/js/wn/misc/number_format.js" + "app/public/js/website_utils.js" ], "public/js/all-app.min.js": [ "app/public/js/startup.js", diff --git a/public/js/website_utils.js b/public/js/website_utils.js index 95cae1bbc61..9b7832678a5 100644 --- a/public/js/website_utils.js +++ b/public/js/website_utils.js @@ -1,9 +1,8 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. // License: GNU General Public License v3. See license.txt - -var erpnext = {}; -var wn = {}; +if(!window.erpnext) erpnext = {}; +if(!window.wn) wn = {}; // Add / update a new Lead / Communication // subject, sender, description @@ -18,7 +17,7 @@ erpnext.send_message = function(opts) { wn.call = function(opts) { if(opts.btn) { - $(opts.btn).attr("disabled", "disabled"); + $(opts.btn).prop("disabled", true); } if(opts.msg) { @@ -51,7 +50,7 @@ wn.call = function(opts) { dataType: "json", success: function(data) { if(opts.btn) { - $(opts.btn).attr("disabled", false); + $(opts.btn).prop("disabled", false); } if(data.exc) { if(opts.btn) { @@ -200,7 +199,7 @@ $.extend(wn.cart, { update_cart: function(opts) { if(!full_name) { if(localStorage) { - localStorage.setItem("last_visited", window.location.pathname.slice(1)); + localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]); localStorage.setItem("pending_add_to_cart", opts.item_code); } window.location.href = "login"; @@ -229,4 +228,26 @@ $.extend(wn.cart, { if(cart_count) $(".cart-count").html("( "+ cart_count +" )") } -}); \ No newline at end of file +}); + +function remove_script_and_style(txt) { + return (!txt || (txt.indexOf(" -
- -

My Orders

-
-
-
-
-
-
-
- -{% endblock %} \ No newline at end of file diff --git a/website/templates/pages/profile.html b/website/templates/pages/profile.html index ea2433bae57..4c03b400b9b 100644 --- a/website/templates/pages/profile.html +++ b/website/templates/pages/profile.html @@ -5,12 +5,10 @@ {% block content %}
-

My Profile

-
diff --git a/website/templates/pages/sale.html b/website/templates/pages/sale.html new file mode 100644 index 00000000000..1c03da261a2 --- /dev/null +++ b/website/templates/pages/sale.html @@ -0,0 +1,90 @@ +{% extends "app/website/templates/html/page.html" %} + +{% set title=doc.name %} + +{% block content %} +
+ +

{{ doc.name }}

+ {% if doc.name == "Not Allowed" -%} + + {% else %} +
+
+
+
+ {% if doc.status -%}
{{ doc.status }}
{%- endif %} +
+
+ {{ utils.formatdate(doc.posting_date or doc.transaction_date) }} +
+
+
+
+
+ + + + + + + + + + + + {%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %} + + + + + + + + + + {% endfor -%} + +
SrItem NameDescriptionQtyUoMBasic RateAmount
{{ row.idx }}{{ row.item_name }}{{ row.description }}{{ row.qty }}{{ row.stock_uom }}{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}
+
+
+
+
+
+ + + + + + + {%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%} + {%- if not charge.included_in_print_rate -%} + + + + + {%- endif -%} + {%- endfor -%} + + + + + + + + + +
Net Total{{ + utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency) + }}
{{ charge.description }}{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}
Grand Total{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}
Rounded Total{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}
+
+
+
+ {%- endif %} +
+{% endblock %} \ No newline at end of file diff --git a/website/templates/pages/sales_transactions.html b/website/templates/pages/sales_transactions.html new file mode 100644 index 00000000000..7215339c0dc --- /dev/null +++ b/website/templates/pages/sales_transactions.html @@ -0,0 +1,25 @@ +{% extends "app/website/templates/html/transactions.html" %} + +{% block javascript -%} +global_number_format = "{{ global_number_format }}"; +currency = "{{ currency }}"; +wn.currency_symbols = {{ currency_symbols }}; + +{{ super() }} + +var render = function(doc) { + doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency); + + $(repl('\ +
\ +
\ +
%(name)s
\ +
%(items)s...
\ +
\ +
%(grand_total_export)s
\ +
%(creation)s
\ +
\ +
', doc)).appendTo($list); +}; + +{%- endblock %} \ No newline at end of file diff --git a/website/templates/pages/ticket.html b/website/templates/pages/ticket.html index 1ae2e88dbb6..6622ed15894 100644 --- a/website/templates/pages/ticket.html +++ b/website/templates/pages/ticket.html @@ -2,39 +2,56 @@ {% set title=doc.name %} +{% set status_label = { + "Open": "label-success", + "To Reply": "label-danger", + "Closed": "label-default" +} %} + {% block content %}
-

{{ doc.name }}

+

{{ doc.name }}

+ {% if doc.name == "Not Allowed" -%} + + {% else %}
{%- if doc.status -%} + {% if doc.status == "Waiting for Customer" -%} + {% set status = "To Reply" %} + {% else %} + {% set status = doc.status %} + {%- endif -%}
-
-
{{ doc.status }}
+
+ {{ status }}
-
- {{ doc.subject }} +
+
{{ doc.subject }}
-
- {{ utils.formatdate(doc.transaction_date) }} +
+ {{ utils.formatdate(doc.creation) }}

Messages

{%- if doclist.get({"doctype":"Communication"}) -%} -
+
{%- for comm in doclist.get({"doctype":"Communication"}) %} {% endfor -%} @@ -45,5 +62,6 @@
No messages
{%- endif -%} {%- endif -%} + {% endif -%} {% endblock %} \ No newline at end of file diff --git a/website/templates/pages/tickets.html b/website/templates/pages/tickets.html index 3d5cf21d5dd..166dbcd4d44 100644 --- a/website/templates/pages/tickets.html +++ b/website/templates/pages/tickets.html @@ -1,53 +1,31 @@ -{% extends "app/website/templates/html/page.html" %} +{% extends "app/website/templates/html/transactions.html" %} -{% set title="My Tickets" %} +{% block javascript -%} +{{ super() }} -{% block content %} -
- -

My Tickets

-
-
-
-
-
-
-
- -{% endblock %} \ No newline at end of file +var status_label = { + "Open": "label-success", + "Waiting for Customer": "label-danger", + "Closed": "label-default" +} + +var render = function(doc) { + doc.status = doc.status.trim(); + doc.label_class = status_label[doc.status] || "label-default"; + if(doc.status==="Waiting for Customer") doc.status = "To Reply"; + + $(repl('\ +
\ +
\ + %(status)s
\ +
\ +
%(name)s
\ +
%(subject)s
\ +
\ +
\ + %(creation)s\ +
\ +
\ +
', doc)).appendTo($list); +}; +{%- endblock %} \ No newline at end of file diff --git a/website/templates/pages/transaction_list.html b/website/templates/pages/transaction_list.html new file mode 100644 index 00000000000..967a6a83244 --- /dev/null +++ b/website/templates/pages/transaction_list.html @@ -0,0 +1,77 @@ +{% extends "app/website/templates/html/page.html" %} + +{% block content %} +
+ +
+
+
+
+
+
+
+
+{% endblock %} + +{% block javascript %} +global_number_format = "{{ global_number_format }}"; +currency = "{{ currency }}"; +wn.currency_symbols = {{ currency_symbols }}; + +$(document).ready(function() { + var start = 0; + var $list = $(".transaction-list"); + + var $show_more = $(".btn-show-more").on("click", function() { + get_transactions(this); + }); + + var get_transactions = function(btn) { + wn.call({ + method: "{{ method }}", + args: { start: start }, + btn: btn, + callback: function(r) { + $list.find(".progress").remove(); + $show_more.toggle(!(r.message && r.message.length===20)); + + if(!(r.message && r.message.length)) { + console.log("empty"); + if(!$list.html().trim()) { + $list.html("
\ + {{ empty_list_message }}
"); + } + return; + } + + start += r.message.length; + + $.each(r.message, function(i, doc) { + render(doc); + }); + } + }) + }; + + var render = function(doc) { + doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency); + + var $row = $(repl('\ +
\ +
\ +
%(name)s
\ +
%(items)s...
\ +
\ +
%(grand_total_export)s
\ +
%(creation)s
\ +
\ +
', doc)).appendTo($list); + }; + + get_transactions(); +}); +{% endblock %} \ No newline at end of file
-
{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}
-

{{ comm.content }}

+
+ {{ comm.sender }} on {{ utils.formatdate(doc.modified) }}
+
+

{{ webnotes.utils.is_html(comm.content) and comm.content or + comm.content.replace("\n", "
")}}