Added change customer dialog.

This commit is contained in:
Martin Edenhofer 2012-07-19 22:53:52 +02:00
parent be0887611c
commit 9715383b65
4 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,33 @@
class App.TicketCustomer extends App.ControllerModal
constructor: ->
super
@render()
render: ->
configure_attributes = [
# { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span7', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">&raquo;</a>', callback: @userInfo },
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', },
]
@html App.view('agent_ticket_customer')(
# head: 'New User',
form: @formGen( model: { configure_attributes: configure_attributes, className: 'update' } ),
)
@modalShow()
submit: (e) =>
e.preventDefault()
params = @formParam(e.target)
# update ticket
ticket = App.Ticket.find(@ticket_id)
ticket.updateAttributes(
customer_id: params['customer_id']
)
# close modal
@modalHide()
# reload zoom view
@zoom.render()

View file

@ -9,6 +9,7 @@ class Index extends App.Controller
'click [data-type=internal]': 'public_internal', 'click [data-type=internal]': 'public_internal',
'click [data-type=history]': 'history_dialog', 'click [data-type=history]': 'history_dialog',
'click [data-type=merge]': 'merge_dialog', 'click [data-type=merge]': 'merge_dialog',
'click [data-type=customer]': 'customer_dialog',
'change [name="ticket_article_type_id"]': 'form_update', 'change [name="ticket_article_type_id"]': 'form_update',
'click .show_toogle': 'show_toogle', 'click .show_toogle': 'show_toogle',
@ -234,6 +235,10 @@ class Index extends App.Controller
e.preventDefault() e.preventDefault()
new App.TicketMerge( ticket_id: @ticket_id ) new App.TicketMerge( ticket_id: @ticket_id )
customer_dialog: (e) ->
e.preventDefault()
new App.TicketCustomer( ticket_id: @ticket_id, zoom: @ )
public_internal: (e) -> public_internal: (e) ->
e.preventDefault() e.preventDefault()
article_id = $(e.target).parents('[data-id]').data('id') article_id = $(e.target).parents('[data-id]').data('id')

View file

@ -0,0 +1,12 @@
<form class="form-horizontal">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3><%- T('Change Customer') %></h3>
</div>
<div class="modal-body">
<%- @form %>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary"><%- T('Submit') %></button>
</div>
</form>

View file

@ -90,6 +90,7 @@
<ul> <ul>
<li><a href="#" data-type="history"><%- T('History') %></a></li> <li><a href="#" data-type="history"><%- T('History') %></a></li>
<li><a href="#" data-type="merge"><%- T('Merge') %></a></li> <li><a href="#" data-type="merge"><%- T('Merge') %></a></li>
<li><a href="#" data-type="customer"><%- T('Change Customer') %></a></li>
</ul> </ul>
</div> </div>
</div> </div>