Create ticket with customer (#514)

Create new tickets from user profile.
This commit is contained in:
Timo Göllner 2017-01-09 15:52:14 +01:00 committed by Martin Edenhofer
parent 6c88a24d9c
commit 6b58d58f37
2 changed files with 13 additions and 6 deletions

View file

@ -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')

View file

@ -7,8 +7,9 @@
<% if @user.organization: %>
<div class="profile-organization js-organization"></div>
<% end %>
<a href="#ticket/create/customer/<%= @user.id %>"><%- @T('New Ticket') %><a>
</div>
<div class="profile-section js-object-container"></div>
<div class="profile-section js-ticket-stats"></div>
</div>
</div>
</div>