diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index f4682ad80..de43df318 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -211,7 +211,7 @@ class App.TicketCreate extends App.Controller render: (template = {}) -> # get params - params = {} + params = @prefilledParams || {} if template && !_.isEmpty(template.options) params = template.options else if App.TaskManager.get(@task_key) && !_.isEmpty(App.TaskManager.get(@task_key).state) diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index 091c771b2..6d2481f31 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -163,9 +163,10 @@ class App.CustomerChat extends App.Controller @title 'Customer Chat', true @navupdate '#customer_chat' - if params.session_id && App.ChatSession.exists(params.session_id) - session = App.ChatSession.find(params.session_id) - @addChat(session) + if params.session_id + callback = (session) => + @addChat(session) + App.ChatSession.full(params.session_id, callback) @navigate '#customer_chat' active: (state) => @@ -342,6 +343,7 @@ class ChatWindow extends App.Controller 'click .js-disconnect': 'disconnect' 'click .js-scrollHint': 'onScrollHintClick' 'click .js-info': 'toggleMeta' + 'click .js-createTicket': 'ticketCreate' 'submit .js-metaForm': 'sendMetaForm' elements: @@ -764,6 +766,28 @@ class ChatWindow extends App.Controller else if showHint @showScrollHint() + ticketCreate: (e) => + e.preventDefault() + + id = Math.floor( Math.random() * 99999 ) + @navigate "#ticket/create/id/#{id}" + + # cleanup params + fqdn = App.Config.get('fqdn') + http_type = App.Config.get('http_type') + clean_params = + id: id + prefilledParams: + body: "#{http_type}://#{fqdn}#{@session.uiUrl()}" + title: 'Chat' + + App.TaskManager.execute( + key: "TicketCreateScreen-#{id}" + controller: 'TicketCreate' + params: clean_params + show: true + ) + class Setting extends App.ControllerModal buttonClose: true buttonCancel: true diff --git a/app/assets/javascripts/app/views/customer_chat/chat_footer.jst.eco b/app/assets/javascripts/app/views/customer_chat/chat_footer.jst.eco index 9a66a4ee3..351904cca 100644 --- a/app/assets/javascripts/app/views/customer_chat/chat_footer.jst.eco +++ b/app/assets/javascripts/app/views/customer_chat/chat_footer.jst.eco @@ -1,5 +1,3 @@ - \ No newline at end of file +