[minor] [customer login] removed messages, fixes in sale, ticket

This commit is contained in:
Anand Doshi 2013-09-04 16:46:08 +05:30
parent 36cd22bf71
commit 85ef502745
7 changed files with 55 additions and 56 deletions

View File

@ -132,11 +132,6 @@
"template": "app/website/templates/pages/sales_transactions", "template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.shipment_list_args" "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": { "product_search": {
"template": "app/website/templates/pages/product_search" "template": "app/website/templates/pages/product_search"
}, },

View File

@ -198,3 +198,7 @@ fieldset[disabled] .btn-default.active {
background-color: #a7a9aa; background-color: #a7a9aa;
border-color: #a7a9aa; border-color: #a7a9aa;
} }
.label {
padding-top: 0.3em;
}

View File

@ -96,27 +96,6 @@ def ticket_list_args():
"empty_list_message": "No Tickets Raised", "empty_list_message": "No Tickets Raised",
"page": "ticket" "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): def get_transaction_args(doctype, name):
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, 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(): 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(): 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(): 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

View File

@ -19,7 +19,6 @@
<li style="border-top: 1px solid #ddd"></li> <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="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="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 style="border-top: 1px solid #ddd"></li>
<li><a href="server.py?cmd=web_logout"><i class="icon-signout icon-fixed-width"></i> <li><a href="server.py?cmd=web_logout"><i class="icon-signout icon-fixed-width"></i>
Logout</a></li> Logout</a></li>

View File

@ -7,19 +7,18 @@
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="index">Home</a></li> <li><a href="index">Home</a></li>
<li><a href="account">My Account</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> <li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
</ul> </ul>
<h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3> <h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
<hr> <hr>
{%- if doc.status -%} <div>
<div style="font-size: 13px;">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-xs-6">
<div class="label">{{ doc.status }}</div> {% if doc.status -%}<div class="label label-default">{{ doc.status }}</div>{%- endif %}
</div> </div>
<div class="col-md-4"> <div class="col-xs-6">
{{ utils.formatdate(doc.transaction_date) }} <span class="pull-right">{{ utils.formatdate(doc.posting_date or doc.transaction_date) }}</span>
</div> </div>
</div> </div>
<br> <br>
@ -36,7 +35,7 @@
<th>Basic Rate</th> <th>Basic Rate</th>
<th>Amount</th> <th>Amount</th>
</tr> </tr>
{%- for row in doclist.get({"doctype":"Sales Order Item"}) %} {%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %}
<tr> <tr>
<td style="width: 3%;">{{ row.idx }}</td> <td style="width: 3%;">{{ row.idx }}</td>
<td style="width: 20%;">{{ row.item_name }}</td> <td style="width: 20%;">{{ row.item_name }}</td>
@ -83,6 +82,5 @@
</div> </div>
</div> </div>
</div> </div>
{%- endif -%}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,12 @@
{% set title=doc.name %} {% set title=doc.name %}
{% set status_label = {
"Open": "label-success",
"To Reply": "label-danger",
"Closed": "label-default"
} %}
{% block content %} {% block content %}
<div class="col-md-12"> <div class="col-md-12">
<ul class="breadcrumb"> <ul class="breadcrumb">
@ -13,28 +19,35 @@
<h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3> <h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3>
<hr> <hr>
{%- if doc.status -%} {%- if doc.status -%}
{% if doc.status == "Waiting for Customer" -%}
{% set status = "To Reply" %}
{% else %}
{% set status = doc.status %}
{%- endif -%}
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2" style="margin-bottom: 7px;">
<div class="label">{{ doc.status }}</div> <span class="label {{ status_label.get(status) or 'label-default' }}">{{ status }}</span>
</div> </div>
<div class="col-md-7"> <div class="col-md-8">
{{ doc.subject }} <div class="row col-md-12">{{ doc.subject }}</div>
</div> </div>
<div class="col-md-3"> <div class="col-md-2 pull-right">
{{ utils.formatdate(doc.transaction_date) }} <span class="text-muted">{{ utils.formatdate(doc.creation) }}</span>
</div> </div>
</div> </div>
<br> <br>
<h4>Messages</h4> <h4>Messages</h4>
{%- if doclist.get({"doctype":"Communication"}) -%} {%- if doclist.get({"doctype":"Communication"}) -%}
<div style="font-size: 13px;"> <div>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<tbody> <tbody>
{%- for comm in doclist.get({"doctype":"Communication"}) %} {%- for comm in doclist.get({"doctype":"Communication"}) %}
<tr> <tr>
<td> <td>
<h5>{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5> <h5 style="text-transform: none">
<p>{{ comm.content }}</p> {{ 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> </td>
</tr> </tr>
{% endfor -%} {% endfor -%}

View File

@ -16,18 +16,14 @@ var render = function(doc) {
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\ $(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
<div class="row">\ <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="col-md-8">\
<div class="row col-md-12">%(name)s</div>\ <div class="row col-md-12">%(name)s</div>\
<div class="row col-md-12 text-muted">%(subject)s</div>\ <div class="row col-md-12 text-muted">%(subject)s</div>\
</div>\ </div>\
<div class="col-md-4">\ <div class="col-md-2 pull-right">\
<div class="pull-left">\ <span class="text-muted">%(creation)s</span>\
<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>\ </div>\
</div>\ </div>\
</a>', doc)).appendTo($list); </a>', doc)).appendTo($list);