Re-enabled old bulk feature to see functionality.
This commit is contained in:
parent
d7ae9e0da3
commit
b80d98a2f9
2 changed files with 60 additions and 16 deletions
|
@ -297,26 +297,34 @@ class Table extends App.ControllerContent
|
|||
@fetch()
|
||||
@render()
|
||||
|
||||
articleTypeFilter = (items) =>
|
||||
for item in items
|
||||
if item.name is 'note'
|
||||
return [item]
|
||||
items
|
||||
|
||||
bulk_form: =>
|
||||
@configure_attributes_ticket = [
|
||||
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: '', item_class: '' },
|
||||
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: '', item_class: '' },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @bulk, nulloption: true, class: '', item_class: '' },
|
||||
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @bulk, nulloption: true, class: '', item_class: '' },
|
||||
{ name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: articleTypeFilter, default: '9', translate: true, class: 'medium' },
|
||||
{ name: 'internal', display: 'Visibility', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
|
||||
{ name: 'body', display: 'Text', tag: 'textarea', rows: 8, null: true, upload: false },
|
||||
]
|
||||
|
||||
# render init page
|
||||
html = $( App.view('agent_ticket_view/bulk')() )
|
||||
# new App.ControllerForm(
|
||||
# el: html.find('#form-ticket-bulk'),
|
||||
# model: {
|
||||
# configure_attributes: @configure_attributes_ticket,
|
||||
# className: 'create'
|
||||
# },
|
||||
# form_data: @bulk,
|
||||
# no_fieldset: true
|
||||
# )
|
||||
# html.delegate('.bulk-action-form', 'submit', (e) =>
|
||||
new App.ControllerForm(
|
||||
el: html.find('#form-ticket-bulk')
|
||||
model:
|
||||
configure_attributes: @configure_attributes_ticket
|
||||
className: 'create'
|
||||
form_data: @bulk
|
||||
no_fieldset: true
|
||||
)
|
||||
#html.delegate('.bulk-action-form', 'submit', (e) =>
|
||||
html.bind('submit', (e) =>
|
||||
e.preventDefault()
|
||||
@bulk_submit(e)
|
||||
|
@ -356,11 +364,40 @@ class Table extends App.ControllerContent
|
|||
|
||||
# @log 'notice', 'update', params, ticket_update, ticket
|
||||
|
||||
# validate article
|
||||
if params['body']
|
||||
article = new App.TicketArticle
|
||||
params.from = @Session.get( 'firstname' ) + ' ' + @Session.get( 'lastname' )
|
||||
params.ticket_id = ticket.id
|
||||
params.form_id = @form_id
|
||||
|
||||
sender = App.TicketArticleSender.findByAttribute( 'name', 'Agent' )
|
||||
type = App.TicketArticleType.find( params['type_id'] )
|
||||
params.sender_id = sender.id
|
||||
|
||||
if !params['internal']
|
||||
params['internal'] = false
|
||||
|
||||
@log 'notice', 'update article', params, sender
|
||||
article.load(params)
|
||||
errors = article.validate()
|
||||
if errors
|
||||
@log 'error', 'update article', errors
|
||||
@formEnable(e)
|
||||
return
|
||||
|
||||
ticket.load(ticket_update)
|
||||
ticket.save(
|
||||
done: (r) =>
|
||||
@bulk_count_index++
|
||||
|
||||
# reset form after save
|
||||
if article
|
||||
article.save(
|
||||
fail: (r) =>
|
||||
@log 'error', 'update article', r
|
||||
)
|
||||
|
||||
# refresh view after all tickets are proceeded
|
||||
if @bulk_count_index == @bulk_count
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
<form class="form-stacked pull-left update-box bulk-action-form">
|
||||
<div id="form-ticket-bulk"></div>
|
||||
<input type="submit" class="btn primary submit" value="update">
|
||||
</form>
|
||||
<!--
|
||||
<form class="form-inline update-box bulk-action-form" role="form">
|
||||
<div id="form-ticket-bulk" class="horizontal">
|
||||
<div class="form-group">
|
||||
|
@ -20,13 +25,14 @@
|
|||
<option value="2">2 normal</option>
|
||||
<option value="3">3 hoch</option>
|
||||
</select>
|
||||
<!--
|
||||
|
||||
|
||||
there can't be any other elements in .input-group
|
||||
-->
|
||||
<!--
|
||||
|
||||
<span class="help-inline"></span>
|
||||
<span class="help-block"></span>
|
||||
-->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="create_group_id" class="input-group-addon">Gruppe</label>
|
||||
|
@ -53,3 +59,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
-->
|
Loading…
Reference in a new issue