Added task support for ticket creation. Improvement for issue #57.
This commit is contained in:
parent
d3b92a2206
commit
ef739b138f
11 changed files with 90 additions and 22 deletions
|
@ -164,7 +164,7 @@ class App.Controller extends Spine.Controller
|
|||
return string
|
||||
|
||||
userInfo: (data) =>
|
||||
el = data.el || $('#customer_info')
|
||||
el = data.el || $('[data-id="customer_info"]')
|
||||
el.unbind()
|
||||
|
||||
# start customer info controller
|
||||
|
|
|
@ -374,8 +374,11 @@ class App.ControllerForm extends App.Controller
|
|||
)
|
||||
siteUpdate(true)
|
||||
|
||||
@delay( a, 80 )
|
||||
# update box size
|
||||
App.Event.bind 'ui:rerender:content', =>
|
||||
siteUpdate(true)
|
||||
|
||||
@delay( a, 80 )
|
||||
|
||||
# autocompletion
|
||||
else if attribute.tag is 'autocompletion'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Index extends App.ControllerContent
|
||||
class App.TicketCreate extends App.Controller
|
||||
events:
|
||||
'click .customer_new': 'userNew'
|
||||
'submit form': 'submit'
|
||||
|
@ -50,6 +50,24 @@ class Index extends App.ControllerContent
|
|||
@log 'AgentTicketPhone', 'error', defaults
|
||||
@render(defaults)
|
||||
|
||||
meta: =>
|
||||
meta =
|
||||
url: @url()
|
||||
head: App.i18n.translateInline( @article_attributes['title'] )
|
||||
title: App.i18n.translateInline( @article_attributes['title'] )
|
||||
id: @type
|
||||
|
||||
url: =>
|
||||
'#ticket_create/' + @type
|
||||
|
||||
activate: =>
|
||||
@navupdate '#'
|
||||
# @title 'Ticket Create ' + @ticket.number
|
||||
|
||||
release: =>
|
||||
# @clearInterval( @key, 'ticket_zoom' )
|
||||
@el.remove()
|
||||
|
||||
# get data / in case also ticket data for split
|
||||
fetch: (params) ->
|
||||
|
||||
|
@ -141,11 +159,11 @@ class Index extends App.ControllerContent
|
|||
)
|
||||
|
||||
new App.ControllerForm(
|
||||
el: @el.find('#form_create')
|
||||
el: @el.find('.ticket_create')
|
||||
form_id: @form_id
|
||||
model:
|
||||
configure_attributes: configure_attributes
|
||||
className: 'create'
|
||||
className: 'create_' + @type
|
||||
autofocus: true
|
||||
form_data: @edit_form
|
||||
)
|
||||
|
@ -164,13 +182,13 @@ class Index extends App.ControllerContent
|
|||
|
||||
# show template UI
|
||||
new App.TemplateUI(
|
||||
el: @el.find('#ticket_template'),
|
||||
el: @el.find('[data-id="ticket_template"]'),
|
||||
template_id: template['id'],
|
||||
)
|
||||
|
||||
# show text module UI
|
||||
new App.TextModuleUI(
|
||||
el: @el.find('#text_module'),
|
||||
el: @el.find('[data-id="text_module"]'),
|
||||
)
|
||||
|
||||
localUserInfo: (params) =>
|
||||
|
@ -252,11 +270,14 @@ class Index extends App.ControllerContent
|
|||
timeout: 12000,
|
||||
|
||||
# create new create screen
|
||||
ui.render()
|
||||
# ui.render()
|
||||
App.TaskManager.remove( ui.task_key )
|
||||
|
||||
# scroll to top
|
||||
ui.scrollTo()
|
||||
|
||||
ui.navigate "#ticket/zoom/#{@id}"
|
||||
|
||||
error: ->
|
||||
ui.log 'save failed!'
|
||||
ui.formEnable(e)
|
||||
|
@ -324,9 +345,21 @@ class UserNew extends App.ControllerModal
|
|||
ui.modalHide()
|
||||
)
|
||||
|
||||
App.Config.set( 'ticket_create', Index, 'Routes' )
|
||||
App.Config.set( 'ticket_create/:ticket_id/:article_id', Index, 'Routes' )
|
||||
App.Config.set( 'ticket_create/:type', Index, 'Routes' )
|
||||
class TicketCreateRouter extends App.ControllerPermanent
|
||||
constructor: (params) ->
|
||||
super
|
||||
@log 'create router', params
|
||||
# cleanup params
|
||||
clean_params =
|
||||
ticket_id: params.ticket_id
|
||||
article_id: params.article_id
|
||||
type: params.type
|
||||
|
||||
App.TaskManager.add( 'TicketCreateScreen', params['type'], 'TicketCreate', clean_params )
|
||||
|
||||
App.Config.set( 'ticket_create', TicketCreateRouter, 'Routes' )
|
||||
App.Config.set( 'ticket_create/:ticket_id/:article_id', TicketCreateRouter, 'Routes' )
|
||||
App.Config.set( 'ticket_create/:type', TicketCreateRouter, 'Routes' )
|
||||
|
||||
App.Config.set( 'New', { prio: 8000, parent: '', name: 'New', target: '#new', role: ['Agent'] }, 'NavBarRight' )
|
||||
App.Config.set( 'TicketNewCallOutbound', { prio: 8001, parent: '#new', name: 'Call Outbound', target: '#ticket_create/call_outbound', role: ['Agent'] }, 'NavBarRight' )
|
||||
|
|
|
@ -34,6 +34,14 @@ class App.TicketZoom extends App.Controller
|
|||
@fetch( @ticket_id, false)
|
||||
@interval( update, 30000, @key, 'ticket_zoom' )
|
||||
|
||||
meta: =>
|
||||
return if !@ticket
|
||||
meta =
|
||||
url: @url()
|
||||
head: @ticket.title
|
||||
title: @ticket.number + ' ' + @ticket.title
|
||||
id: @ticket.id
|
||||
|
||||
url: =>
|
||||
'#ticket/zoom/' + @ticket.id
|
||||
|
||||
|
@ -115,6 +123,8 @@ class App.TicketZoom extends App.Controller
|
|||
article = App.Collection.find( 'TicketArticle', article_id )
|
||||
@articles.push article
|
||||
|
||||
App.Event.trigger 'ui:rerender'
|
||||
|
||||
# rework articles
|
||||
for article in @articles
|
||||
new Article( article: article )
|
||||
|
@ -163,7 +173,7 @@ class App.TicketZoom extends App.Controller
|
|||
form_id: @form_id
|
||||
model:
|
||||
configure_attributes: @configure_attributes_ticket
|
||||
className: 'create'
|
||||
className: 'update_ticket_' + @ticket.id
|
||||
params: @ticket
|
||||
form_data: @edit_form
|
||||
)
|
||||
|
@ -173,6 +183,7 @@ class App.TicketZoom extends App.Controller
|
|||
form_id: @form_id
|
||||
model:
|
||||
configure_attributes: @configure_attributes_article
|
||||
className: 'update_ticket_' + @ticket.id
|
||||
form_data: @edit_form
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
$ = jQuery.sub()
|
||||
|
||||
class App.TagWidget extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
@load()
|
||||
|
||||
# update box size
|
||||
App.Event.bind 'ui:rerender:content', =>
|
||||
@siteUpdate()
|
||||
|
||||
load: =>
|
||||
@attribute_id = 'tags_' + @object.id + '_' + @object_type
|
||||
App.Com.ajax(
|
||||
|
@ -33,7 +35,7 @@ class App.TagWidget extends App.Controller
|
|||
onRemoveTag: @onRemoveTag
|
||||
# height: '65px'
|
||||
)
|
||||
@delay @siteUpdate, 200
|
||||
@delay @siteUpdate, 250
|
||||
|
||||
# @el.find('#tags').elastic()
|
||||
|
||||
|
@ -64,7 +66,7 @@ class App.TagWidget extends App.Controller
|
|||
)
|
||||
|
||||
siteUpdate: (reorder) =>
|
||||
container = document.getElementById(@attribute_id + '_tagsinput')
|
||||
container = document.getElementById( @attribute_id + '_tagsinput' )
|
||||
if reorder
|
||||
$('#' + @attribute_id + '_tagsinput').height( 20 )
|
||||
height = container.scrollHeight
|
||||
|
|
|
@ -30,10 +30,21 @@ class App.TaskWidget extends App.Controller
|
|||
tasks = App.TaskManager.all()
|
||||
item_list = []
|
||||
for key, task of tasks
|
||||
data =
|
||||
url: '#'
|
||||
id: false
|
||||
title: '?'
|
||||
head: '?'
|
||||
if task.worker
|
||||
meta = task.worker.meta()
|
||||
if meta
|
||||
data = meta
|
||||
data.title = App.i18n.escape( data.title )
|
||||
data.head = App.i18n.escape( data.head )
|
||||
item = {}
|
||||
item.key = key
|
||||
item.task = task
|
||||
item.data = App[task.type].find( task.type_id )
|
||||
item.data = data
|
||||
item_list.push item
|
||||
|
||||
@html App.view('task_widget')(
|
||||
|
|
|
@ -29,6 +29,11 @@ class App.i18n
|
|||
_instance ?= new _Singleton( args )
|
||||
_instance.set( args )
|
||||
|
||||
@escape: ( args ) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton( args )
|
||||
_instance.escape( args )
|
||||
|
||||
class _Singleton extends Spine.Module
|
||||
@include App.Log
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ class _Singleton extends App.Controller
|
|||
else
|
||||
task.active = true
|
||||
App.Event.trigger 'ui:rerender'
|
||||
App.Event.trigger 'ui:rerender:content'
|
||||
return key
|
||||
|
||||
@task_count++
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<form class="form-horizontal">
|
||||
<input type="hidden" value="" name="article_type"/>
|
||||
<div class="row">
|
||||
<div class="span9" id="form_create"></div>
|
||||
<div class="span9 ticket_create"></div>
|
||||
<div class="span3">
|
||||
<div id="customer_info"></div>
|
||||
<div id="ticket_template"></div>
|
||||
<div id="text_module"></div>
|
||||
<div data-id="customer_info"></div>
|
||||
<div data-id="ticket_template"></div>
|
||||
<div data-id="text_module"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="well taskbar">
|
||||
<% for item in @item_list: %>
|
||||
<span class="label <% if item.task.active: %>label-success<% else: %>label-info<% end %>" data-id="<%- item.key %>"><span class="task"><a href="#ticket/zoom/<%- item.data.id %>" title="<%= item.data.title %>"><%= item.data.title %></a></span><a href="#" data-type="close" class="icon-remove-circle" title="<%- @T('close') %>"></a></span>
|
||||
<span class="label <% if item.task.active: %>label-success<% else: %>label-info<% end %>" data-id="<%- item.key %>"><span class="task"><a href="<%- item.data.url %>" title="<%= item.data.title %>"><%- item.data.head %></a></span><a href="#" data-type="close" class="icon-remove-circle" title="<%- @T('close') %>"></a></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1789,6 +1789,8 @@ Translation.create_if_not_exists( :locale => 'de', :source => "Change your langu
|
|||
Translation.create_if_not_exists( :locale => 'de', :source => "Successfully!", :target => "Erfolgreich!" )
|
||||
Translation.create_if_not_exists( :locale => 'de', :source => "Remove", :target => "Entfernen" )
|
||||
Translation.create_if_not_exists( :locale => 'de', :source => "Add", :target => "Hinzufügen" )
|
||||
Translation.create_if_not_exists( :locale => 'de', :source => "Call Outbound", :target => "Anruf ausgehend" )
|
||||
Translation.create_if_not_exists( :locale => 'de', :source => "Call Inbound", :target => "Anruf eingehend" )
|
||||
|
||||
#Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )
|
||||
|
||||
|
|
Loading…
Reference in a new issue