[minor] [customer login] removed messages, fixes in sale, ticket
diff --git a/config.json b/config.json
index 396905c..d30c697 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 47a969c..4cd7ac7 100644
--- a/website/css/website.css
+++ b/website/css/website.css
@@ -198,3 +198,7 @@
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 900956b..8943575 100644
--- a/website/helpers/transaction.py
+++ b/website/helpers/transaction.py
@@ -96,27 +96,6 @@
"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_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 9d29589..2a5acf6 100644
--- a/website/templates/pages/account.html
+++ b/website/templates/pages/account.html
@@ -19,7 +19,6 @@
<li style="border-top: 1px solid #ddd"></li>
<li><a href="invoices"><i class="icon-file-text icon-fixed-width"></i> Invoices</a></li>
<li><a href="shipments"><i class="icon-truck icon-fixed-width"></i> Shipments</a></li>
- <li><a href="messages"><i class="icon-comments icon-fixed-width"></i> Messages</a></li>
<li style="border-top: 1px solid #ddd"></li>
<li><a href="server.py?cmd=web_logout"><i class="icon-signout icon-fixed-width"></i>
Logout</a></li>
diff --git a/website/templates/pages/sale.html b/website/templates/pages/sale.html
index c70dcb1..669a380 100644
--- a/website/templates/pages/sale.html
+++ b/website/templates/pages/sale.html
@@ -7,19 +7,18 @@
<ul class="breadcrumb">
<li><a href="index">Home</a></li>
<li><a href="account">My Account</a></li>
- <li><a href="orders">My Orders</a></li>
+ <li><a href="{{ parent_link }}">{{ parent_title }}</a></li>
<li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
</ul>
<h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
<hr>
- {%- if doc.status -%}
- <div style="font-size: 13px;">
+ <div>
<div class="row">
- <div class="col-md-2">
- <div class="label">{{ doc.status }}</div>
+ <div class="col-xs-6">
+ {% if doc.status -%}<div class="label label-default">{{ doc.status }}</div>{%- endif %}
</div>
- <div class="col-md-4">
- {{ utils.formatdate(doc.transaction_date) }}
+ <div class="col-xs-6">
+ <span class="pull-right">{{ utils.formatdate(doc.posting_date or doc.transaction_date) }}</span>
</div>
</div>
<br>
@@ -36,7 +35,7 @@
<th>Basic Rate</th>
<th>Amount</th>
</tr>
- {%- for row in doclist.get({"doctype":"Sales Order Item"}) %}
+ {%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %}
<tr>
<td style="width: 3%;">{{ row.idx }}</td>
<td style="width: 20%;">{{ row.item_name }}</td>
@@ -83,6 +82,5 @@
</div>
</div>
</div>
- {%- endif -%}
</div>
{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/ticket.html b/website/templates/pages/ticket.html
index 2f85ac0..eeb485a 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 %}
<div class="col-md-12">
<ul class="breadcrumb">
@@ -13,28 +19,35 @@
<h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3>
<hr>
{%- if doc.status -%}
+ {% if doc.status == "Waiting for Customer" -%}
+ {% set status = "To Reply" %}
+ {% else %}
+ {% set status = doc.status %}
+ {%- endif -%}
<div class="row">
- <div class="col-md-2">
- <div class="label">{{ doc.status }}</div>
+ <div class="col-md-2" style="margin-bottom: 7px;">
+ <span class="label {{ status_label.get(status) or 'label-default' }}">{{ status }}</span>
</div>
- <div class="col-md-7">
- {{ doc.subject }}
+ <div class="col-md-8">
+ <div class="row col-md-12">{{ doc.subject }}</div>
</div>
- <div class="col-md-3">
- {{ utils.formatdate(doc.transaction_date) }}
+ <div class="col-md-2 pull-right">
+ <span class="text-muted">{{ utils.formatdate(doc.creation) }}</span>
</div>
</div>
<br>
<h4>Messages</h4>
{%- if doclist.get({"doctype":"Communication"}) -%}
- <div style="font-size: 13px;">
+ <div>
<table class="table table-bordered table-striped">
<tbody>
{%- for comm in doclist.get({"doctype":"Communication"}) %}
<tr>
<td>
- <h5>{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5>
- <p>{{ comm.content }}</p>
+ <h5 style="text-transform: none">
+ {{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5>
+ <p>{{ webnotes.utils.is_html(comm.content) and comm.content or
+ comm.content.replace("\n", "<br>")}}</p>
</td>
</tr>
{% endfor -%}
diff --git a/website/templates/pages/tickets.html b/website/templates/pages/tickets.html
index 248384d..166dbcd 100644
--- a/website/templates/pages/tickets.html
+++ b/website/templates/pages/tickets.html
@@ -16,18 +16,14 @@
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
<div class="row">\
+ <div class="col-md-2" style="margin-bottom: 7px;"><span class="label %(label_class)s">\
+ %(status)s</span></div>\
<div class="col-md-8">\
<div class="row col-md-12">%(name)s</div>\
<div class="row col-md-12 text-muted">%(subject)s</div>\
</div>\
- <div class="col-md-4">\
- <div class="pull-left">\
- <span class="label %(label_class)s" \
- style="padding-top: 0.3em; margin-right: 5px;">%(status)s</span>\
- </div>\
- <div class="pull-right">\
- <span class="text-muted">%(creation)s</span>\
- </div>\
+ <div class="col-md-2 pull-right">\
+ <span class="text-muted">%(creation)s</span>\
</div>\
</div>\
</a>', doc)).appendTo($list);