From 6b58d58f37be86f9592feb7670d00af3969f4f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20G=C3=B6llner?= Date: Mon, 9 Jan 2017 15:52:14 +0100 Subject: [PATCH] Create ticket with customer (#514) Create new tickets from user profile. --- .../app/controllers/agent_ticket_create.coffee | 16 +++++++++++----- .../app/views/user_profile/index.jst.eco | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 67e011135..f540416e9 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -159,7 +159,7 @@ class App.TicketCreate extends App.Controller buildScreen: (params) => if !params.ticket_id && !params.article_id - @render() + @render(options: { customer_id: params.customer_id }) return # fetch split ticket data @@ -614,16 +614,20 @@ class Router extends App.ControllerPermanent if params['ticket_id'] && params['article_id'] split = "/#{params['ticket_id']}/#{params['article_id']}" + if params.customer_id + split = "/customer/#{params.customer_id}" + id = Math.floor( Math.random() * 99999 ) @navigate "#ticket/create/id/#{id}#{split}" return # cleanup params clean_params = - ticket_id: params.ticket_id - article_id: params.article_id - type: params.type - id: params.id + ticket_id: params.ticket_id + article_id: params.article_id + type: params.type + customer_id: params.customer_id + id: params.id App.TaskManager.execute( key: "TicketCreateScreen-#{params['id']}" @@ -636,6 +640,8 @@ class Router extends App.ControllerPermanent App.Config.set('ticket/create', Router, 'Routes') App.Config.set('ticket/create/', Router, 'Routes') App.Config.set('ticket/create/id/:id', Router, 'Routes') +App.Config.set('ticket/create/customer/:customer_id', Router, 'Routes') +App.Config.set('ticket/create/id/:id/customer/:customer_id', Router, 'Routes') # split ticket App.Config.set('ticket/create/:ticket_id/:article_id', Router, 'Routes') diff --git a/app/assets/javascripts/app/views/user_profile/index.jst.eco b/app/assets/javascripts/app/views/user_profile/index.jst.eco index 7b7c8d101..73e80a476 100644 --- a/app/assets/javascripts/app/views/user_profile/index.jst.eco +++ b/app/assets/javascripts/app/views/user_profile/index.jst.eco @@ -7,8 +7,9 @@ <% if @user.organization: %>
<% end %> + <%- @T('New Ticket') %>
- \ No newline at end of file +