Added possibility to create multible new tickets tasks.

This commit is contained in:
Martin Edenhofer 2013-05-24 23:29:20 +02:00
parent d85565ef9e
commit 7e37dbd9a0
2 changed files with 28 additions and 9 deletions

View file

@ -40,7 +40,7 @@ class App.TicketCreate extends App.Controller
@navigate '#ticket_create/' + default_type @navigate '#ticket_create/' + default_type
# update navbar highlighting # update navbar highlighting
@navupdate '#ticket_create/' + @type @navupdate '#ticket_create/' + @type + '/id/' + @id
@fetch(params) @fetch(params)
@ -57,7 +57,7 @@ class App.TicketCreate extends App.Controller
id: @type id: @type
url: => url: =>
'#ticket_create/' + @type '#ticket_create/' + @type + '/id/' + @id
activate: => activate: =>
@navupdate '#' @navupdate '#'
@ -168,7 +168,7 @@ class App.TicketCreate extends App.Controller
form_id: @form_id form_id: @form_id
model: model:
configure_attributes: configure_attributes configure_attributes: configure_attributes
className: 'create_' + @type className: 'create_' + @type + '_' + @id
autofocus: true autofocus: true
form_data: @edit_form form_data: @edit_form
) )
@ -199,7 +199,10 @@ class App.TicketCreate extends App.Controller
@formDefault = @formParam( @el.find('.ticket-create') ) @formDefault = @formParam( @el.find('.ticket-create') )
localUserInfo: (params) => localUserInfo: (params) =>
@userInfo( user_id: params.customer_id ) @userInfo(
user_id: params.customer_id
el: @el.find('[data-id="customer_info"]')
)
userNew: (e) => userNew: (e) =>
e.preventDefault() e.preventDefault()
@ -340,8 +343,8 @@ class UserNew extends App.ControllerModal
# force to reload object # force to reload object
callbackReload = (user) -> callbackReload = (user) ->
realname = user.displayName() realname = user.displayName()
$('#create_' + ui.type + '_customer_id').val( user.id ) $('#create_' + ui.type + '_' + ui.id + '_customer_id').val( user.id )
$('#create_' + ui.type + '_customer_id_autocompletion').val( realname ) $('#create_' + ui.type + '_' + ui.id + '_customer_id_autocompletion').val( realname )
# start customer info controller # start customer info controller
ui.userInfo( user_id: user.id ) ui.userInfo( user_id: user.id )
@ -356,18 +359,31 @@ class TicketCreateRouter extends App.ControllerPermanent
constructor: (params) -> constructor: (params) ->
super super
@log 'create router', params @log 'create router', params
# create new uniq form id
if !params['id']
id = Math.floor( Math.random() * 99999 )
@navigate "#ticket_create/#{params['type']}/id/#{id}"
return
# cleanup params # cleanup params
clean_params = clean_params =
ticket_id: params.ticket_id ticket_id: params.ticket_id
article_id: params.article_id article_id: params.article_id
type: params.type type: params.type
id: params.id
App.TaskManager.add( 'TicketCreateScreen', params['type'], 'TicketCreate', clean_params ) App.TaskManager.add( 'TicketCreateScreen', params['type'] + '-' + params['id'], 'TicketCreate', clean_params )
App.Config.set( 'ticket_create', TicketCreateRouter, 'Routes' ) # split ticket
App.Config.set( 'ticket_create/:ticket_id/:article_id', TicketCreateRouter, 'Routes' ) App.Config.set( 'ticket_create/:ticket_id/:article_id', TicketCreateRouter, 'Routes' )
App.Config.set( 'ticket_create/:type', TicketCreateRouter, 'Routes' )
# create new ticket routs/controller
App.Config.set( 'ticket_create', TicketCreateRouter, 'Routes' )
App.Config.set( 'ticket_create/:type', TicketCreateRouter, 'Routes' )
App.Config.set( 'ticket_create/:type/id/:id', TicketCreateRouter, 'Routes' )
# set new task actions
App.Config.set( 'TicketNewCallOutbound', { prio: 8001, name: 'Call Outbound', target: '#ticket_create/call_outbound', role: ['Agent'] }, 'TaskActions' ) App.Config.set( 'TicketNewCallOutbound', { prio: 8001, name: 'Call Outbound', target: '#ticket_create/call_outbound', role: ['Agent'] }, 'TaskActions' )
App.Config.set( 'TicketNewCallInbound', { prio: 8002, name: 'Call Inbound', target: '#ticket_create/call_inbound', role: ['Agent'] }, 'TaskActions' ) App.Config.set( 'TicketNewCallInbound', { prio: 8002, name: 'Call Inbound', target: '#ticket_create/call_inbound', role: ['Agent'] }, 'TaskActions' )
App.Config.set( 'TicketNewEmail', { prio: 8003, name: 'Email', target: '#ticket_create/email', role: ['Agent'] }, 'TaskActions' ) App.Config.set( 'TicketNewEmail', { prio: 8003, name: 'Email', target: '#ticket_create/email', role: ['Agent'] }, 'TaskActions' )

View file

@ -14,4 +14,7 @@
<tr> <tr>
<td colspan="2"><%- @P( @ticket.owner ) %></td> <td colspan="2"><%- @P( @ticket.owner ) %></td>
</tr> </tr>
<tr>
<td colspan="2"><%- @P( @ticket.customer ) %></td>
</tr>
</table> </table>