Improved changing customers.
This commit is contained in:
parent
17ca8d375a
commit
6be0e97a48
5 changed files with 29 additions and 26 deletions
|
@ -9,7 +9,7 @@ class App.TicketMerge extends App.ControllerModal
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'ticket_merge_list'
|
id: 'ticket_merge_list'
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
url: @apiPath + '/ticket_merge_list/' + @ticket_id
|
url: @apiPath + '/ticket_merge_list/' + @ticket.id
|
||||||
processData: true,
|
processData: true,
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class App.TicketMerge extends App.ControllerModal
|
||||||
|
|
||||||
list = []
|
list = []
|
||||||
for ticket_id in @ticket_ids_by_customer
|
for ticket_id in @ticket_ids_by_customer
|
||||||
if ticket_id isnt @ticket_id
|
if ticket_id isnt @ticket.id
|
||||||
ticketItem = App.Ticket.retrieve( ticket_id )
|
ticketItem = App.Ticket.retrieve( ticket_id )
|
||||||
list.push ticketItem
|
list.push ticketItem
|
||||||
new App.ControllerTable(
|
new App.ControllerTable(
|
||||||
|
@ -55,7 +55,7 @@ class App.TicketMerge extends App.ControllerModal
|
||||||
|
|
||||||
list = []
|
list = []
|
||||||
for ticket_id in @ticket_ids_recent_viewed
|
for ticket_id in @ticket_ids_recent_viewed
|
||||||
if ticket_id isnt @ticket_id
|
if ticket_id isnt @ticket.id
|
||||||
ticketItem = App.Ticket.retrieve( ticket_id )
|
ticketItem = App.Ticket.retrieve( ticket_id )
|
||||||
list.push ticketItem
|
list.push ticketItem
|
||||||
new App.ControllerTable(
|
new App.ControllerTable(
|
||||||
|
@ -105,7 +105,7 @@ class App.TicketMerge extends App.ControllerModal
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'ticket_merge',
|
id: 'ticket_merge',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: @apiPath + '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
|
url: @apiPath + '/ticket_merge/' + @ticket.id + '/' + params['master_ticket_number'],
|
||||||
data: {
|
data: {
|
||||||
# view: @view
|
# view: @view
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,19 +25,17 @@ class App.TicketCustomer extends App.ControllerModal
|
||||||
|
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
|
|
||||||
# update ticket
|
@customer_id = params['customer_id']
|
||||||
ticket = App.Ticket.find(@ticket_id)
|
|
||||||
ticket.updateAttributes(
|
|
||||||
customer_id: params['customer_id']
|
|
||||||
)
|
|
||||||
|
|
||||||
callback = =>
|
callback = =>
|
||||||
|
|
||||||
# close modal
|
# close modal
|
||||||
@modalHide()
|
@modalHide()
|
||||||
|
|
||||||
# reload zoom view
|
# update ticket
|
||||||
@ui.render()
|
@ticket.updateAttributes(
|
||||||
|
customer_id: @customer_id
|
||||||
|
)
|
||||||
|
|
||||||
# load user if not already exists
|
# load user if not already exists
|
||||||
App.User.retrieve( params['customer_id'], callback )
|
App.User.retrieve( @customer_id, callback )
|
||||||
|
|
|
@ -9,7 +9,7 @@ class App.TicketHistory extends App.GenericHistory
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'ticket_history',
|
id: 'ticket_history',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: @apiPath + '/ticket_history/' + @ticket_id,
|
url: @apiPath + '/ticket_history/' + @ticket.id,
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
|
||||||
# load assets
|
# load assets
|
||||||
|
|
|
@ -28,8 +28,8 @@ class App.TicketZoom extends App.Controller
|
||||||
update = =>
|
update = =>
|
||||||
if data.id.toString() is @ticket_id.toString()
|
if data.id.toString() is @ticket_id.toString()
|
||||||
ticket = App.Ticket.find( @ticket_id )
|
ticket = App.Ticket.find( @ticket_id )
|
||||||
@log 'notice', 'TRY', data.updated_at, ticket.updated_at
|
@log 'notice', 'TRY', Date(data.updated_at), Date(ticket.updated_at)
|
||||||
if data.updated_at isnt ticket.updated_at
|
if Date(data.updated_at) isnt Date(ticket.updated_at)
|
||||||
@fetch( @ticket_id, false )
|
@fetch( @ticket_id, false )
|
||||||
@delay( update, 1800, 'ticket-zoom-' + @ticket_id )
|
@delay( update, 1800, 'ticket-zoom-' + @ticket_id )
|
||||||
)
|
)
|
||||||
|
@ -282,15 +282,17 @@ class TicketInfo extends App.ControllerDrox
|
||||||
class Widgets extends App.Controller
|
class Widgets extends App.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
@render()
|
|
||||||
|
|
||||||
render: ->
|
@subscribeId = @ticket.subscribe(@render)
|
||||||
|
@render(@ticket)
|
||||||
|
|
||||||
|
render: (ticket) =>
|
||||||
|
|
||||||
@html App.view('ticket_zoom/widgets')()
|
@html App.view('ticket_zoom/widgets')()
|
||||||
|
|
||||||
# show ticket info
|
# show ticket info
|
||||||
new TicketInfo(
|
new TicketInfo(
|
||||||
ticket: @ticket
|
ticket: ticket
|
||||||
el: @el.find('.ticket_info')
|
el: @el.find('.ticket_info')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -298,8 +300,8 @@ class Widgets extends App.Controller
|
||||||
if !@isRole('Customer')
|
if !@isRole('Customer')
|
||||||
new App.WidgetUser(
|
new App.WidgetUser(
|
||||||
el: @el.find('.customer_info')
|
el: @el.find('.customer_info')
|
||||||
user_id: @ticket.customer_id
|
user_id: ticket.customer_id
|
||||||
ticket: @ticket
|
ticket: ticket
|
||||||
)
|
)
|
||||||
|
|
||||||
# start link info controller
|
# start link info controller
|
||||||
|
@ -307,9 +309,12 @@ class Widgets extends App.Controller
|
||||||
new App.WidgetLink(
|
new App.WidgetLink(
|
||||||
el: @el.find('.link_info')
|
el: @el.find('.link_info')
|
||||||
object_type: 'Ticket'
|
object_type: 'Ticket'
|
||||||
object: @ticket
|
object: ticket
|
||||||
)
|
)
|
||||||
|
|
||||||
|
release: =>
|
||||||
|
App.Ticket.unsubscribe( @subscribeId )
|
||||||
|
|
||||||
class Edit extends App.Controller
|
class Edit extends App.Controller
|
||||||
events:
|
events:
|
||||||
'click .submit': 'update'
|
'click .submit': 'update'
|
||||||
|
@ -802,15 +807,15 @@ class ActionRow extends App.Controller
|
||||||
|
|
||||||
history_dialog: (e) ->
|
history_dialog: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new App.TicketHistory( ticket_id: @ticket.id )
|
new App.TicketHistory( ticket: @ticket )
|
||||||
|
|
||||||
merge_dialog: (e) ->
|
merge_dialog: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new App.TicketMerge( ticket_id: @ticket.id, task_key: @ui.task_key )
|
new App.TicketMerge( ticket: @ticket, task_key: @ui.task_key )
|
||||||
|
|
||||||
customer_dialog: (e) ->
|
customer_dialog: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new App.TicketCustomer( ticket_id: @ticket.id, ui: @ui )
|
new App.TicketCustomer( ticket: @ticket )
|
||||||
|
|
||||||
class TicketZoomRouter extends App.ControllerPermanent
|
class TicketZoomRouter extends App.ControllerPermanent
|
||||||
constructor: (params) ->
|
constructor: (params) ->
|
||||||
|
|
|
@ -92,11 +92,11 @@ class ActionRow extends App.Controller
|
||||||
|
|
||||||
merge_dialog: (e) ->
|
merge_dialog: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new App.TicketMerge( ticket_id: @ticket.id, task_key: @ui.task_key )
|
new App.TicketMerge( ticket: @ticket, task_key: @ui.task_key )
|
||||||
|
|
||||||
customer_dialog: (e) ->
|
customer_dialog: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new App.TicketCustomer( ticket_id: @ticket.id, ui: @ui )
|
new App.TicketCustomer( ticket: @ticket, ui: @ui )
|
||||||
|
|
||||||
|
|
||||||
class Router extends App.ControllerPermanent
|
class Router extends App.ControllerPermanent
|
||||||
|
|
Loading…
Reference in a new issue