From f7e5648365c6f5c2fee902100b45953ce0fc1fd3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 29 Aug 2013 17:46:40 +0530 Subject: [PATCH 01/50] [minor] customer login start --- config.json | 9 ++- public/build.json | 3 +- selling/doctype/sales_order/sales_order.py | 36 +--------- website/helpers/transaction.py | 63 +++++++++++++++++ website/templates/html/outer.html | 3 +- website/templates/pages/account.html | 23 ++++-- website/templates/pages/address.html | 4 +- website/templates/pages/addresses.html | 4 +- website/templates/pages/order.html | 4 +- website/templates/pages/orders.html | 70 ------------------- website/templates/pages/profile.html | 8 +-- website/templates/pages/ticket.html | 10 +-- website/templates/pages/tickets.html | 4 +- website/templates/pages/transaction_list.html | 69 ++++++++++++++++++ 14 files changed, 173 insertions(+), 137 deletions(-) create mode 100644 website/helpers/transaction.py delete mode 100644 website/templates/pages/orders.html create mode 100644 website/templates/pages/transaction_list.html diff --git a/config.json b/config.json index 5412b017b2..f9c71b4b19 100644 --- a/config.json +++ b/config.json @@ -106,8 +106,13 @@ }, "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/transaction_list", + "args_method": "website.helpers.transaction.order_list_args" + }, + "invoices": { + "no_cache": true, + "template": "app/website/templates/pages/transaction_list", + "args_method": "website.helpers.transaction.invoice_list_args" }, "product_search": { "template": "app/website/templates/pages/product_search" diff --git a/public/build.json b/public/build.json index 24abde20b2..b8d7dd4452 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/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py index 8e3ed701ff..604c5eb7c9 100644 --- a/selling/doctype/sales_order/sales_order.py +++ b/selling/doctype/sales_order/sales_order.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import webnotes import webnotes.utils -import json from webnotes.utils import cstr, flt, getdate from webnotes.model.bean import getlist @@ -287,31 +286,6 @@ class DocType(SellingController): def on_update(self): pass -@webnotes.whitelist() -def get_orders(): - # find customer id - customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, - "customer") - - if customer: - orders = webnotes.conn.sql("""select - name, creation, currency from `tabSales Order` - where customer=%s - and docstatus=1 - order by creation desc - limit 20 - """, customer, as_dict=1) - for order in orders: - order.items = webnotes.conn.sql("""select - item_name, qty, export_rate, export_amount, delivered_qty, stock_uom - from `tabSales Order Item` - where parent=%s - order by idx""", order.name, as_dict=1) - - return orders - else: - return [] - def get_website_args(): customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, "customer") @@ -325,17 +299,9 @@ def get_website_args(): "doc": bean.doc, "doclist": bean.doclist, "webnotes": webnotes, - "utils": webnotes.utils + "utils": webnotes.utils, } -def get_currency_and_number_format(): - return { - "global_number_format": webnotes.conn.get_default("number_format") or "#,###.##", - "currency": webnotes.conn.get_default("currency"), - "currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol - from tabCurrency where ifnull(enabled,0)=1"""))) - } - def set_missing_values(source, target): bean = webnotes.bean(target) bean.run_method("onload_post_render") diff --git a/website/helpers/transaction.py b/website/helpers/transaction.py new file mode 100644 index 0000000000..336be2a1e2 --- /dev/null +++ b/website/helpers/transaction.py @@ -0,0 +1,63 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes +from webnotes.utils import cint, formatdate +import json + +def get_transaction_list(doctype, start): + # find customer id + customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, + "customer") + + if customer: + transactions = webnotes.conn.sql("""select name, creation, currency, grand_total_export + from `tab%s` where customer=%s and docstatus=1 + order by creation desc + limit %s, 20""" % (doctype, "%s", "%s"), (customer, cint(start)), as_dict=1) + for doc in transactions: + doc.items = ", ".join(webnotes.conn.sql_list("""select item_name + from `tab%s Item` where parent=%s limit 5""" % (doctype, "%s"), doc.name)) + doc.creation = formatdate(doc.creation) + return transactions + else: + return [] + +def get_common_args(): + return { + "global_number_format": webnotes.conn.get_default("number_format") or "#,###.##", + "currency": webnotes.conn.get_default("currency"), + "currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol + from tabCurrency where ifnull(enabled,0)=1"""))) + } + +@webnotes.whitelist() +def get_orders(start=0): + return get_transaction_list("Sales Order", start) + +def order_list_args(): + args = get_common_args() + args.update({ + "title": "My Orders", + "method": "website.helpers.transaction.get_orders", + "icon": "icon-list", + "empty_list_message": "No Orders Yet", + "page": "order", + }) + return args + +@webnotes.whitelist() +def get_invoices(start=0): + return get_transaction_list("Sales Invoice", start) + +def invoice_list_args(): + args = get_common_args() + args.update({ + "title": "Invoices", + "method": "website.helpers.transaction.get_invoices", + "icon": "icon-file-text", + "empty_list_message": "No Invoices Found", + "page": "invoice" + }) + return args \ No newline at end of file diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html index 0f0f4002ea..8e26f0962f 100644 --- a/website/templates/html/outer.html +++ b/website/templates/html/outer.html @@ -10,8 +10,7 @@ Login
- | - My Account | + | {% if shopping_cart_enabled -%} | diff --git a/website/templates/pages/account.html b/website/templates/pages/account.html index 539e014ae2..6dcc497a56 100644 --- a/website/templates/pages/account.html +++ b/website/templates/pages/account.html @@ -8,12 +8,23 @@
  • Home
  • My Account
  • -

    My Account

    -

    Change my name, password

    -

    My Addresses

    -

    My Orders

    -

    My Tickets

    -

    Logout

    + +
    {% endblock %} \ No newline at end of file diff --git a/website/templates/pages/address.html b/website/templates/pages/address.html index faf7bb04ec..6544b1225d 100644 --- a/website/templates/pages/address.html +++ b/website/templates/pages/address.html @@ -42,9 +42,9 @@
  • Home
  • My Account
  • My Addresses
  • -
  • {{ title }}
  • +
  • {{ title }}
  • -

    {{ title }}

    +

    {{ title }}

    diff --git a/website/templates/pages/addresses.html b/website/templates/pages/addresses.html index 90d0d13845..04fc47ba73 100644 --- a/website/templates/pages/addresses.html +++ b/website/templates/pages/addresses.html @@ -7,10 +7,8 @@ -

    My Addresses

    -

    New Address


    diff --git a/website/templates/pages/order.html b/website/templates/pages/order.html index 1893575358..c70dcb1124 100644 --- a/website/templates/pages/order.html +++ b/website/templates/pages/order.html @@ -8,9 +8,9 @@
  • Home
  • My Account
  • My Orders
  • -
  • {{ doc.name }}
  • +
  • {{ doc.name }}
  • -

    {{ doc.name }}

    +

    {{ doc.name }}


    {%- if doc.status -%}
    diff --git a/website/templates/pages/orders.html b/website/templates/pages/orders.html deleted file mode 100644 index e0bf4d7ad8..0000000000 --- a/website/templates/pages/orders.html +++ /dev/null @@ -1,70 +0,0 @@ -{% extends "app/website/templates/html/page.html" %} - -{% set title="My Orders" %} - -{% block content %} - -
    - -

    My Orders

    -
    -
    -
    -
    -
    -
    -
    - -{% endblock %} \ No newline at end of file diff --git a/website/templates/pages/profile.html b/website/templates/pages/profile.html index ea2433bae5..4c03b400b9 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/ticket.html b/website/templates/pages/ticket.html index 1ae2e88dbb..2f85ac0bbc 100644 --- a/website/templates/pages/ticket.html +++ b/website/templates/pages/ticket.html @@ -5,12 +5,12 @@ {% block content %}
    -

    {{ doc.name }}

    +

    {{ doc.name }}


    {%- if doc.status -%}
    diff --git a/website/templates/pages/tickets.html b/website/templates/pages/tickets.html index 3d5cf21d5d..9c476ffa00 100644 --- a/website/templates/pages/tickets.html +++ b/website/templates/pages/tickets.html @@ -7,10 +7,8 @@ -

    My Tickets

    -
    diff --git a/website/templates/pages/transaction_list.html b/website/templates/pages/transaction_list.html new file mode 100644 index 0000000000..e92764a5ff --- /dev/null +++ b/website/templates/pages/transaction_list.html @@ -0,0 +1,69 @@ +{% extends "app/website/templates/html/page.html" %} + +{% block content %} +
    + +
    +
    +
    +
    +
    +
    + + +{% endblock %} \ No newline at end of file From c8e39b09659728e5a452f9e7b26077f509c1d865 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Aug 2013 18:22:58 +0530 Subject: [PATCH 02/50] [fix] [minor] use prop instead of attr to disable a field --- accounts/doctype/sales_invoice/pos.js | 2 +- public/js/website_utils.js | 4 ++-- stock/page/stock_ledger/stock_ledger.js | 4 ++-- stock/page/stock_level/stock_level.js | 4 ++-- utilities/demo/demo-login.js | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index 1bd6de1030..b5a781cd09 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/public/js/website_utils.js b/public/js/website_utils.js index 95cae1bbc6..d22d7655fc 100644 --- a/public/js/website_utils.js +++ b/public/js/website_utils.js @@ -18,7 +18,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 +51,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) { diff --git a/stock/page/stock_ledger/stock_ledger.js b/stock/page/stock_ledger/stock_ledger.js index dacd78c21e..c83fc0ec12 100644 --- a/stock/page/stock_ledger/stock_ledger.js +++ b/stock/page/stock_ledger/stock_ledger.js @@ -100,11 +100,11 @@ erpnext.StockLedger = erpnext.StockGridReport.extend({ toggle_enable_brand: function() { if(!this.filter_inputs.item_code.val()) { - this.filter_inputs.brand.removeAttr("disabled"); + this.filter_inputs.brand.prop("disabled", false); } else { this.filter_inputs.brand .val(this.filter_inputs.brand.get(0).opts.default_value) - .attr("disabled", "disabled"); + .prop("disabled", true); } }, diff --git a/stock/page/stock_level/stock_level.js b/stock/page/stock_level/stock_level.js index 0699b7d7cd..df7c8c5d4d 100644 --- a/stock/page/stock_level/stock_level.js +++ b/stock/page/stock_level/stock_level.js @@ -115,11 +115,11 @@ erpnext.StockLevel = erpnext.StockGridReport.extend({ toggle_enable_brand: function() { if(!this.filter_inputs.item_code.val()) { - this.filter_inputs.brand.removeAttr("disabled"); + this.filter_inputs.brand.prop("disabled", false); } else { this.filter_inputs.brand .val(this.filter_inputs.brand.get(0).opts.default_value) - .attr("disabled", "disabled"); + .prop("disabled", true); } }, diff --git a/utilities/demo/demo-login.js b/utilities/demo/demo-login.js index 229d1690e5..509057b9ef 100644 --- a/utilities/demo/demo-login.js +++ b/utilities/demo/demo-login.js @@ -3,7 +3,7 @@ $(document).ready(function() { $("#login_btn").click(function() { var me = this; - $(this).html("Logging In...").attr("disabled", "disabled"); + $(this).html("Logging In...").prop("disabled", true); wn.call({ "method": "login", args: { @@ -12,7 +12,7 @@ $(document).ready(function() { lead_email: $("#lead-email").val(), }, callback: function(r) { - $(me).attr("disabled", false); + $(me).prop("disabled", false); if(r.exc) { alert("Error, please contact support@erpnext.com"); } else { @@ -23,5 +23,5 @@ $(document).ready(function() { }) return false; }) - .attr("disabled", false); + .prop("disabled", false); }) \ No newline at end of file From 6c8ef7729f5d249709245bacf1f92f24c38d35bb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Aug 2013 18:23:50 +0530 Subject: [PATCH 03/50] [customer login] [minor] commonified listing of orders, invoices, shipments, tickets and messages --- config.json | 17 +++- public/js/website_utils.js | 19 ++++- .../doctype/support_ticket/support_ticket.py | 11 --- website/css/website.css | 17 +++- website/helpers/transaction.py | 60 +++++++++++++- website/templates/html/transactions.html | 59 +++++++++++++ website/templates/pages/account.html | 6 +- website/templates/pages/messages.html | 31 +++++++ .../templates/pages/sales_transactions.html | 25 ++++++ website/templates/pages/tickets.html | 82 ++++++++----------- website/templates/pages/transaction_list.html | 69 ---------------- 11 files changed, 252 insertions(+), 144 deletions(-) create mode 100644 website/templates/html/transactions.html create mode 100644 website/templates/pages/messages.html create mode 100644 website/templates/pages/sales_transactions.html delete mode 100644 website/templates/pages/transaction_list.html diff --git a/config.json b/config.json index f9c71b4b19..6656ed37de 100644 --- a/config.json +++ b/config.json @@ -106,14 +106,24 @@ }, "orders": { "no_cache": true, - "template": "app/website/templates/pages/transaction_list", + "template": "app/website/templates/pages/sales_transactions", "args_method": "website.helpers.transaction.order_list_args" }, "invoices": { "no_cache": true, - "template": "app/website/templates/pages/transaction_list", + "template": "app/website/templates/pages/sales_transactions", "args_method": "website.helpers.transaction.invoice_list_args" }, + "shipments": { + "no_cache": true, + "template": "app/website/templates/pages/sales_transactions", + "args_method": "website.helpers.transaction.shipment_list_args" + }, + "messages": { + "no_cache": true, + "template": "app/website/templates/pages/messages", + "args_method": "website.helpers.transaction.message_list_args" + }, "product_search": { "template": "app/website/templates/pages/product_search" }, @@ -123,7 +133,8 @@ "args_method": "support.doctype.support_ticket.support_ticket.get_website_args" }, "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/js/website_utils.js b/public/js/website_utils.js index d22d7655fc..1b7f0f728d 100644 --- a/public/js/website_utils.js +++ b/public/js/website_utils.js @@ -2,8 +2,8 @@ // 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 @@ -229,4 +229,17 @@ $.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(" -{% 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('\ +
    \ +
    \ +
    %(name)s
    \ +
    %(subject)s
    \ +
    \ +
    \ +
    \ + %(status)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 deleted file mode 100644 index e92764a5ff..0000000000 --- a/website/templates/pages/transaction_list.html +++ /dev/null @@ -1,69 +0,0 @@ -{% extends "app/website/templates/html/page.html" %} - -{% block content %} -
    - -
    -
    -
    -
    -
    -
    - - -{% endblock %} \ No newline at end of file From d5c18d46d00a2964d195c00a86599d9e89218ba1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 4 Sep 2013 15:07:00 +0530 Subject: [PATCH 04/50] [minor] [customer login] renamed order template to sale and use it for order, invoice and delivery note --- config.json | 20 ++++- selling/doctype/sales_order/sales_order.py | 16 ---- website/helpers/transaction.py | 26 ++++++ website/templates/pages/invoice.html | 88 +++++++++++++++++++ .../templates/pages/{order.html => sale.html} | 0 5 files changed, 131 insertions(+), 19 deletions(-) create mode 100644 website/templates/pages/invoice.html rename website/templates/pages/{order.html => sale.html} (100%) diff --git a/config.json b/config.json index 61df211d01..396905c590 100644 --- a/config.json +++ b/config.json @@ -101,19 +101,32 @@ }, "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", + "for_doctype": "Sales Order" }, "orders": { "no_cache": true, "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", + "for_doctype": "Sales Invoice" + }, "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", + "for_doctype": "Delivery Note" + }, "shipments": { "no_cache": true, "template": "app/website/templates/pages/sales_transactions", @@ -130,7 +143,8 @@ "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", + "for_doctype": "Support Ticket" }, "tickets": { "template": "app/website/templates/pages/tickets", diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py index 604c5eb7c9..03530dce48 100644 --- a/selling/doctype/sales_order/sales_order.py +++ b/selling/doctype/sales_order/sales_order.py @@ -286,22 +286,6 @@ class DocType(SellingController): def on_update(self): pass -def get_website_args(): - customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, - "customer") - bean = webnotes.bean("Sales Order", webnotes.form_dict.name) - if bean.doc.customer != customer: - return { - "doc": {"name": "Not Allowed"} - } - else: - return { - "doc": bean.doc, - "doclist": bean.doclist, - "webnotes": webnotes, - "utils": webnotes.utils, - } - def set_missing_values(source, target): bean = webnotes.bean(target) bean.run_method("onload_post_render") diff --git a/website/helpers/transaction.py b/website/helpers/transaction.py index 1aded2efc5..900956b6f1 100644 --- a/website/helpers/transaction.py +++ b/website/helpers/transaction.py @@ -117,3 +117,29 @@ def message_list_args(): "icon": "icon-comments", "empty_list_message": "No Messages Found", } + +def get_transaction_args(doctype, name): + customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, + "customer") + + bean = webnotes.bean(doctype, name) + if bean.doc.customer != customer: + return { + "doc": {"name": "Not Allowed"} + } + else: + return { + "doc": bean.doc, + "doclist": bean.doclist, + "webnotes": webnotes, + "utils": webnotes.utils + } + +def get_order_args(): + return get_transaction_args("Sales Order", webnotes.form_dict.name) + +def get_invoice_args(): + return get_transaction_args("Sales Invoice", webnotes.form_dict.name) + +def get_shipment_args(): + return get_transaction_args("Delivery Note", webnotes.form_dict.name) diff --git a/website/templates/pages/invoice.html b/website/templates/pages/invoice.html new file mode 100644 index 0000000000..26ddea43d2 --- /dev/null +++ b/website/templates/pages/invoice.html @@ -0,0 +1,88 @@ +{% extends "app/website/templates/html/page.html" %} + +{% set title=doc.name %} + +{% block content %} +
    + +

    {{ doc.name }}

    +
    + {%- if doc.status -%} +
    +
    +
    +
    {{ doc.status }}
    +
    +
    + {{ utils.formatdate(doc.transaction_date) }} +
    +
    +
    +
    +
    + + + + + + + + + + + + {%- for row in doclist.get({"doctype":"Sales Order 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/order.html b/website/templates/pages/sale.html similarity index 100% rename from website/templates/pages/order.html rename to website/templates/pages/sale.html From 85ef50274586c54363ef812c8e8286c4220d69d3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 4 Sep 2013 16:46:08 +0530 Subject: [PATCH 05/50] [minor] [customer login] removed messages, fixes in sale, ticket --- config.json | 5 ---- website/css/website.css | 4 +++ website/helpers/transaction.py | 42 ++++++++++++---------------- website/templates/pages/account.html | 1 - website/templates/pages/sale.html | 16 +++++------ website/templates/pages/ticket.html | 31 ++++++++++++++------ website/templates/pages/tickets.html | 12 +++----- 7 files changed, 55 insertions(+), 56 deletions(-) diff --git a/config.json b/config.json index 396905c590..d30c6976e0 100644 --- a/config.json +++ b/config.json @@ -132,11 +132,6 @@ "template": "app/website/templates/pages/sales_transactions", "args_method": "website.helpers.transaction.shipment_list_args" }, - "messages": { - "no_cache": true, - "template": "app/website/templates/pages/messages", - "args_method": "website.helpers.transaction.message_list_args" - }, "product_search": { "template": "app/website/templates/pages/product_search" }, diff --git a/website/css/website.css b/website/css/website.css index 47a969c046..4cd7ac7735 100644 --- a/website/css/website.css +++ b/website/css/website.css @@ -198,3 +198,7 @@ fieldset[disabled] .btn-default.active { background-color: #a7a9aa; border-color: #a7a9aa; } + +.label { + padding-top: 0.3em; +} \ No newline at end of file diff --git a/website/helpers/transaction.py b/website/helpers/transaction.py index 900956b6f1..8943575c6c 100644 --- a/website/helpers/transaction.py +++ b/website/helpers/transaction.py @@ -96,27 +96,6 @@ def ticket_list_args(): "empty_list_message": "No Tickets Raised", "page": "ticket" } - -@webnotes.whitelist() -def get_messages(start=0): - search_term = "%%%s%%" % webnotes.session.user - messages = webnotes.conn.sql("""select name, subject, creation, - sender, recipients, content - from `tabCommunication` where sender like %s or recipients like %s - order by creation desc - limit %s, 20""", (search_term, search_term, cint(start)), as_dict=True) - for m in messages: - m.creation = formatdate(m.creation) - - return messages - -def message_list_args(): - return { - "title": "Messages", - "method": "website.helpers.transaction.get_messages", - "icon": "icon-comments", - "empty_list_message": "No Messages Found", - } def get_transaction_args(doctype, name): customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, @@ -136,10 +115,25 @@ def get_transaction_args(doctype, name): } def get_order_args(): - return get_transaction_args("Sales Order", webnotes.form_dict.name) + args = get_transaction_args("Sales Order", webnotes.form_dict.name) + args.update({ + "parent_link": "orders", + "parent_title": "My Orders" + }) + return args def get_invoice_args(): - return get_transaction_args("Sales Invoice", webnotes.form_dict.name) + args = get_transaction_args("Sales Invoice", webnotes.form_dict.name) + args.update({ + "parent_link": "invoices", + "parent_title": "Invoices" + }) + return args def get_shipment_args(): - return get_transaction_args("Delivery Note", webnotes.form_dict.name) + args = get_transaction_args("Delivery Note", webnotes.form_dict.name) + args.update({ + "parent_link": "shipments", + "parent_title": "Shipments" + }) + return args diff --git a/website/templates/pages/account.html b/website/templates/pages/account.html index 9d29589ec8..2a5acf67e3 100644 --- a/website/templates/pages/account.html +++ b/website/templates/pages/account.html @@ -19,7 +19,6 @@
  • Invoices
  • Shipments
  • -
  • Messages
  • Logout
  • diff --git a/website/templates/pages/sale.html b/website/templates/pages/sale.html index c70dcb1124..669a3807f8 100644 --- a/website/templates/pages/sale.html +++ b/website/templates/pages/sale.html @@ -7,19 +7,18 @@

    {{ doc.name }}


    - {%- if doc.status -%} -
    +
    -
    -
    {{ doc.status }}
    +
    + {% if doc.status -%}
    {{ doc.status }}
    {%- endif %}
    -
    - {{ utils.formatdate(doc.transaction_date) }} +
    + {{ utils.formatdate(doc.posting_date or doc.transaction_date) }}

    @@ -36,7 +35,7 @@ Basic Rate Amount - {%- for row in doclist.get({"doctype":"Sales Order Item"}) %} + {%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %} {{ row.idx }} {{ row.item_name }} @@ -83,6 +82,5 @@
    - {%- endif -%}
    {% endblock %} \ No newline at end of file diff --git a/website/templates/pages/ticket.html b/website/templates/pages/ticket.html index 2f85ac0bbc..eeb485a064 100644 --- a/website/templates/pages/ticket.html +++ b/website/templates/pages/ticket.html @@ -2,6 +2,12 @@ {% set title=doc.name %} +{% set status_label = { + "Open": "label-success", + "To Reply": "label-danger", + "Closed": "label-default" +} %} + {% block content %}