Implemented issue #422 - Convert Chat into Ticket.
This commit is contained in:
parent
5fb6bfed7d
commit
724879c6c8
6 changed files with 46 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<!--
|
||||
<div class="chat-footer">
|
||||
<div class="btn btn--primary js-createTicket">Turn chat into ticket</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="btn btn--primary js-createTicket"><%- @T('Turn chat into ticket') %></div>
|
||||
</div>
|
10
app/controllers/chat_sessions_controller.rb
Normal file
10
app/controllers/chat_sessions_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
class ChatSessionsController < ApplicationController
|
||||
prepend_before_action { authentication_check(permission: 'chat.agent') }
|
||||
|
||||
def show
|
||||
model_show_render(Chat::Session, params)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,7 +1,6 @@
|
|||
Zammad::Application.routes.draw do
|
||||
api_path = Rails.configuration.api_path
|
||||
|
||||
# groups
|
||||
match api_path + '/chats', to: 'chats#index', via: :get
|
||||
match api_path + '/chats/:id', to: 'chats#show', via: :get
|
||||
match api_path + '/chats', to: 'chats#create', via: :post
|
||||
|
|
6
config/routes/chat_session.rb
Normal file
6
config/routes/chat_session.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
Zammad::Application.routes.draw do
|
||||
api_path = Rails.configuration.api_path
|
||||
|
||||
match api_path + '/chat_sessions/:id', to: 'chat_sessions#show', via: :get
|
||||
|
||||
end
|
Loading…
Reference in a new issue