|
@@ -77,10 +77,6 @@ class App.Controller extends Spine.Controller
|
|
|
if @ajaxCalls
|
|
|
for callId in @ajaxCalls
|
|
|
App.Ajax.abort(callId)
|
|
|
- @userTicketPopupsDestroy()
|
|
|
- @ticketPopupsDestroy()
|
|
|
- @userPopupsDestroy()
|
|
|
- @organizationPopupsDestroy()
|
|
|
|
|
|
release: ->
|
|
|
# release custom bindings after it got removed from dom
|
|
@@ -295,228 +291,6 @@ class App.Controller extends Spine.Controller
|
|
|
item.attr('title', App.i18n.translateTimestamp(timestamp))
|
|
|
item.html(time)
|
|
|
|
|
|
- ticketPopups: (position = 'right') ->
|
|
|
-
|
|
|
- # open ticket in new task if curent user agent
|
|
|
- if @permissionCheck('ticket.agent')
|
|
|
- @$('div.ticket-popover, span.ticket-popover').bind('click', (e) =>
|
|
|
- id = $(e.target).data('id')
|
|
|
- return if !id
|
|
|
- ticket = App.Ticket.findNative(id)
|
|
|
- @navigate ticket.uiUrl()
|
|
|
- )
|
|
|
-
|
|
|
- @ticketPopupsDestroy()
|
|
|
-
|
|
|
- # show ticket popup
|
|
|
- ui = @
|
|
|
- @ticketPopupsList = @el.find('.ticket-popover').popover(
|
|
|
- trigger: 'hover'
|
|
|
- container: 'body'
|
|
|
- html: true
|
|
|
- animation: false
|
|
|
- delay: 100
|
|
|
- placement: position
|
|
|
- title: ->
|
|
|
- ticketId = $(@).data('id')
|
|
|
- ticket = App.Ticket.find(ticketId)
|
|
|
- App.Utils.htmlEscape(ticket.title)
|
|
|
- content: ->
|
|
|
- ticketId = $(@).data('id')
|
|
|
- ticket = App.Ticket.fullLocal(ticketId)
|
|
|
- html = $(App.view('popover/ticket')(
|
|
|
- ticket: ticket
|
|
|
- ))
|
|
|
- html.find('.humanTimeFromNow').each(->
|
|
|
- ui.frontendTimeUpdateItem($(@))
|
|
|
- )
|
|
|
- html
|
|
|
- )
|
|
|
-
|
|
|
- ticketPopupsDestroy: =>
|
|
|
- if @ticketPopupsList
|
|
|
- @ticketPopupsList.popover('destroy')
|
|
|
-
|
|
|
- userPopups: (position = 'right') ->
|
|
|
-
|
|
|
- # open user in new task if current user is agent
|
|
|
- return if !@permissionCheck('ticket.agent')
|
|
|
- @$('div.user-popover, span.user-popover').bind('click', (e) =>
|
|
|
- id = $(e.target).data('id')
|
|
|
- return if !id
|
|
|
- user = App.User.findNative(id)
|
|
|
- @navigate user.uiUrl()
|
|
|
- )
|
|
|
-
|
|
|
- @userPopupsDestroy()
|
|
|
-
|
|
|
- # show user popup
|
|
|
- @userPopupsList = @el.find('.user-popover').popover(
|
|
|
- trigger: 'hover'
|
|
|
- container: 'body'
|
|
|
- html: true
|
|
|
- animation: false
|
|
|
- delay: 100
|
|
|
- placement: "auto #{position}"
|
|
|
- title: ->
|
|
|
- userId = $(@).data('id')
|
|
|
- user = App.User.find(userId)
|
|
|
- headline = App.Utils.htmlEscape(user.displayName())
|
|
|
- if user.isOutOfOffice()
|
|
|
- headline += " (#{App.Utils.htmlEscape(user.outOfOfficeText())})"
|
|
|
- headline
|
|
|
- content: ->
|
|
|
- userId = $(@).data('id')
|
|
|
- user = App.User.fullLocal(userId)
|
|
|
-
|
|
|
- # get display data
|
|
|
- userData = []
|
|
|
- for attributeName, attributeConfig of App.User.attributesGet('view')
|
|
|
-
|
|
|
- # check if value for _id exists
|
|
|
- name = attributeName
|
|
|
- nameNew = name.substr(0, name.length - 3)
|
|
|
- if nameNew of user
|
|
|
- name = nameNew
|
|
|
-
|
|
|
- # add to show if value exists
|
|
|
- if user[name] && attributeConfig.shown
|
|
|
-
|
|
|
- # do not show firstname and lastname / already show via diplayName()
|
|
|
- if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization'
|
|
|
- userData.push attributeConfig
|
|
|
-
|
|
|
- # insert data
|
|
|
- App.view('popover/user')(
|
|
|
- user: user
|
|
|
- userData: userData
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- userPopupsDestroy: =>
|
|
|
- if @userPopupsList
|
|
|
- @userPopupsList.popover('destroy')
|
|
|
-
|
|
|
- organizationPopups: (position = 'right') ->
|
|
|
-
|
|
|
- # open org in new task if current user agent
|
|
|
- return if !@permissionCheck('ticket.agent')
|
|
|
-
|
|
|
- @$('div.organization-popover, span.organization-popover').bind('click', (e) =>
|
|
|
- id = $(e.target).data('id')
|
|
|
- return if !id
|
|
|
- organization = App.Organization.find(id)
|
|
|
- @navigate organization.uiUrl()
|
|
|
- )
|
|
|
-
|
|
|
- @organizationPopupsDestroy()
|
|
|
-
|
|
|
- # show organization popup
|
|
|
- @organizationPopupsList = @el.find('.organization-popover').popover(
|
|
|
- trigger: 'hover'
|
|
|
- container: 'body'
|
|
|
- html: true
|
|
|
- animation: false
|
|
|
- delay: 100
|
|
|
- placement: "auto #{position}"
|
|
|
- title: ->
|
|
|
- organization_id = $(@).data('id')
|
|
|
- organization = App.Organization.find(organization_id)
|
|
|
- App.Utils.htmlEscape(organization.name)
|
|
|
- content: ->
|
|
|
- organization_id = $(@).data('id')
|
|
|
- organization = App.Organization.fullLocal(organization_id)
|
|
|
-
|
|
|
- # get display data
|
|
|
- organizationData = []
|
|
|
- for attributeName, attributeConfig of App.Organization.attributesGet('view')
|
|
|
-
|
|
|
- # check if value for _id exists
|
|
|
- name = attributeName
|
|
|
- nameNew = name.substr(0, name.length - 3)
|
|
|
- if nameNew of organization
|
|
|
- name = nameNew
|
|
|
-
|
|
|
- # add to show if value exists
|
|
|
- if organization[name] && attributeConfig.shown
|
|
|
-
|
|
|
- # do not show firstname and lastname / already show via diplayName()
|
|
|
- if name isnt 'name'
|
|
|
- organizationData.push attributeConfig
|
|
|
-
|
|
|
- # insert data
|
|
|
- App.view('popover/organization')(
|
|
|
- organization: organization,
|
|
|
- organizationData: organizationData,
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- organizationPopupsDestroy: =>
|
|
|
- if @organizationPopupsList
|
|
|
- @organizationPopupsList.popover('destroy')
|
|
|
-
|
|
|
- userTicketPopups: (params) ->
|
|
|
-
|
|
|
- show = (data, ticket_list) =>
|
|
|
-
|
|
|
- if !data.position
|
|
|
- data.position = 'left'
|
|
|
-
|
|
|
- @userTicketPopupsDestroy()
|
|
|
-
|
|
|
- # show user popup
|
|
|
- ui = @
|
|
|
- @userTicketPopupsList = @el.find(data.selector).popover(
|
|
|
- trigger: 'hover'
|
|
|
- container: 'body'
|
|
|
- html: true
|
|
|
- animation: false
|
|
|
- delay: 100
|
|
|
- placement: "auto #{data.position}"
|
|
|
- title: ->
|
|
|
- $(@).find('[title="*"]').val()
|
|
|
-
|
|
|
- content: ->
|
|
|
- type = $(@).filter('[data-type]').data('type')
|
|
|
- tickets = []
|
|
|
- if ticket_list[type]
|
|
|
- for ticketId in ticket_list[type]
|
|
|
- tickets.push App.Ticket.fullLocal(ticketId)
|
|
|
-
|
|
|
- # insert data
|
|
|
- html = $(App.view('popover/user_ticket_list')(
|
|
|
- tickets: tickets
|
|
|
- ))
|
|
|
- html.find('.humanTimeFromNow').each( ->
|
|
|
- ui.frontendTimeUpdateItem($(@))
|
|
|
- )
|
|
|
- html
|
|
|
- )
|
|
|
-
|
|
|
- fetch = (params) =>
|
|
|
- @ajax(
|
|
|
- type: 'GET'
|
|
|
- url: "#{@Config.get('api_path')}/ticket_customer"
|
|
|
- data:
|
|
|
- customer_id: params.user_id
|
|
|
- processData: true
|
|
|
- success: (data, status, xhr) ->
|
|
|
- App.Collection.loadAssets(data.assets)
|
|
|
- show(params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed })
|
|
|
- )
|
|
|
-
|
|
|
- # get data
|
|
|
- fetch(params)
|
|
|
-
|
|
|
- userTicketPopupsDestroy: =>
|
|
|
- if @userTicketPopupsList
|
|
|
- @userTicketPopupsList.popover('destroy')
|
|
|
-
|
|
|
- anyPopoversDestroy: ->
|
|
|
-
|
|
|
- # do not remove permanent .popover--notifications widget
|
|
|
- $('.popover:not(.popover--notifications)').remove()
|
|
|
-
|
|
|
recentView: (object, o_id) =>
|
|
|
params =
|
|
|
object: object
|