mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-02 13:08:27 +00:00
[website] [minor] moving to framework
This commit is contained in:
@@ -72,18 +72,4 @@ class DocType(TransactionBase):
|
||||
def set_status(name, status):
|
||||
st = webnotes.bean("Support Ticket", name)
|
||||
st.doc.status = status
|
||||
st.save()
|
||||
|
||||
def get_website_args():
|
||||
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
st.save()
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
19
support/doctype/support_ticket/templates/pages/ticket.py
Normal file
19
support/doctype/support_ticket/templates/pages/ticket.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
33
support/doctype/support_ticket/templates/pages/tickets.html
Normal file
33
support/doctype/support_ticket/templates/pages/tickets.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends "app/portal/templates/includes/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
{{ super() }}
|
||||
|
||||
<script>
|
||||
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('<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-2 pull-right">\
|
||||
<span class="text-muted">%(creation)s</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
</script>
|
||||
{%- endblock %}
|
||||
26
support/doctype/support_ticket/templates/pages/tickets.py
Normal file
26
support/doctype/support_ticket/templates/pages/tickets.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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
|
||||
|
||||
def get_context():
|
||||
return {
|
||||
"title": "My Tickets",
|
||||
"method": "support.doctype.support_ticket.templates.pages.tickets.get_tickets",
|
||||
"icon": "icon-ticket",
|
||||
"empty_list_message": "No Tickets Raised",
|
||||
"page": "ticket"
|
||||
}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_tickets(start=0):
|
||||
tickets = webnotes.conn.sql("""select name, subject, status, creation
|
||||
from `tabSupport Ticket` where raised_by=%s
|
||||
order by modified desc
|
||||
limit %s, 20""", (webnotes.session.user, cint(start)), as_dict=True)
|
||||
for t in tickets:
|
||||
t.creation = formatdate(t.creation)
|
||||
|
||||
return tickets
|
||||
@@ -1,31 +0,0 @@
|
||||
{% extends "app/website/templates/html/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
{{ super() }}
|
||||
|
||||
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('<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-2 pull-right">\
|
||||
<span class="text-muted">%(creation)s</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
{%- endblock %}
|
||||
Reference in New Issue
Block a user