diff --git a/accounts/doctype/sales_invoice/templates/pages/invoice.py b/accounts/doctype/sales_invoice/templates/pages/invoice.py index 7196a3039bf..200727c44ee 100644 --- a/accounts/doctype/sales_invoice/templates/pages/invoice.py +++ b/accounts/doctype/sales_invoice/templates/pages/invoice.py @@ -7,7 +7,7 @@ import webnotes no_cache = True def get_context(): - from portal.website_transactions import get_transaction_context + from portal.utils import get_transaction_context context = get_transaction_context("Sales Invoice", webnotes.form_dict.name) context.update({ "parent_link": "invoices", diff --git a/accounts/doctype/sales_invoice/templates/pages/invoices.py b/accounts/doctype/sales_invoice/templates/pages/invoices.py index c72903ba124..ec957f3a785 100644 --- a/accounts/doctype/sales_invoice/templates/pages/invoices.py +++ b/accounts/doctype/sales_invoice/templates/pages/invoices.py @@ -7,7 +7,7 @@ import webnotes no_cache = True def get_context(): - from portal.website_transactions import get_currency_context + from portal.utils import get_currency_context context = get_currency_context() context.update({ "title": "Invoices", @@ -20,5 +20,5 @@ def get_context(): @webnotes.whitelist() def get_invoices(start=0): - from portal.website_transactions import get_transaction_list + from portal.utils import get_transaction_list return get_transaction_list("Sales Invoice", start) \ No newline at end of file diff --git a/portal/templates/includes/transactions.html b/portal/templates/includes/transactions.html index 65651ca5c58..036a77c1818 100644 --- a/portal/templates/includes/transactions.html +++ b/portal/templates/includes/transactions.html @@ -6,6 +6,8 @@
- {{ comm.sender }} on {{ utils.formatdate(doc.modified) }}+ {{ comm.sender }} on {{ utils.formatdate(comm.creation) }}{{ webnotes.utils.is_html(comm.content) and comm.content or
comm.content.replace("\n", " \
+ \
+ \
+ ').insertBefore(".transaction-list");
+ }
+
+ window.$new_ticket.find("#new-ticket").on("click", function() {
+ $(this).addClass("hide");
+ $(window.$new_ticket).find("#new-ticket-send").removeClass("hide");
+ $('\
+ \
+ \
+ ')
+ .insertAfter(window.$new_ticket);
+ });
+
+ window.$new_ticket.find("#new-ticket-send").on("click", function() {
+ var subject = $("#ticket-editor").find('[data-fieldname="subject"]').val().trim();
+ var message = $("#ticket-editor").find('[data-fieldname="message"]').val().trim();
+ if(!(subject && message)) {
+ msgprint("Please write something in subject and message!");
+ } else {
+ wn.call({
+ type: "POST",
+ method: "support.doctype.support_ticket.templates.pages.tickets.make_new_ticket",
+ btn: this,
+ args: { subject: subject, message: message },
+ callback: function(r) {
+ if(r.exc) {
+ msgprint(r._server_messages
+ ? JSON.parse(r._server_messages).join("") + : "Something went wrong!"); + } else { + window.location.href = "ticket?name=" + encodeURIComponent(r.message); + } + } + }) + } + }); + }); + + var msgprint = function(txt) { + if(txt) $("#msgprint-alert").html(txt).toggle(true); + } {%- endblock %} \ No newline at end of file diff --git a/support/doctype/support_ticket/templates/pages/tickets.py b/support/doctype/support_ticket/templates/pages/tickets.py index f434746b708..dd2e52e5553 100644 --- a/support/doctype/support_ticket/templates/pages/tickets.py +++ b/support/doctype/support_ticket/templates/pages/tickets.py @@ -25,4 +25,14 @@ def get_tickets(start=0): for t in tickets: t.creation = formatdate(t.creation) - return tickets \ No newline at end of file + return tickets + +@webnotes.whitelist() +def make_new_ticket(subject, message): + if not (subject and message): + raise webnotes.throw(_("Please write something in subject and message!")) + + from support.doctype.support_ticket.get_support_mails import add_support_communication + ticket = add_support_communication(subject, message, webnotes.session.user) + + return ticket.doc.name \ No newline at end of file diff --git a/support/doctype/support_ticket/templates/ticket.html b/support/doctype/support_ticket/templates/ticket.html deleted file mode 100644 index b7d2f2b9923..00000000000 --- a/support/doctype/support_ticket/templates/ticket.html +++ /dev/null @@ -1,66 +0,0 @@ -{% extends base_template %} - -{% set title=doc.name %} - -{% set status_label = { - "Open": "label-success", - "To Reply": "label-danger", - "Closed": "label-default" -} %} - -{% block content %} -
-
-
-{% endblock %}
\ No newline at end of file
{{ 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 -%} -
-
-
- {{ status }}
-
-
-
- {{ doc.subject }}
-
- {{ utils.formatdate(doc.creation) }}
-
- - Messages- {%- if doclist.get({"doctype":"Communication"}) -%} -
-
- {%- else -%}
-
No messages
- {%- endif -%}
- {%- endif -%}
- {% endif -%}
- |