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()
|
@fetch()
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
|
articleTypeFilter = (items) =>
|
||||||
|
for item in items
|
||||||
|
if item.name is 'note'
|
||||||
|
return [item]
|
||||||
|
items
|
||||||
|
|
||||||
bulk_form: =>
|
bulk_form: =>
|
||||||
@configure_attributes_ticket = [
|
@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: '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: '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: '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: '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
|
# render init page
|
||||||
html = $( App.view('agent_ticket_view/bulk')() )
|
html = $( App.view('agent_ticket_view/bulk')() )
|
||||||
# new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
# el: html.find('#form-ticket-bulk'),
|
el: html.find('#form-ticket-bulk')
|
||||||
# model: {
|
model:
|
||||||
# configure_attributes: @configure_attributes_ticket,
|
configure_attributes: @configure_attributes_ticket
|
||||||
# className: 'create'
|
className: 'create'
|
||||||
# },
|
form_data: @bulk
|
||||||
# form_data: @bulk,
|
no_fieldset: true
|
||||||
# no_fieldset: true
|
)
|
||||||
# )
|
#html.delegate('.bulk-action-form', 'submit', (e) =>
|
||||||
# html.delegate('.bulk-action-form', 'submit', (e) =>
|
|
||||||
html.bind('submit', (e) =>
|
html.bind('submit', (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@bulk_submit(e)
|
@bulk_submit(e)
|
||||||
|
@ -356,11 +364,40 @@ class Table extends App.ControllerContent
|
||||||
|
|
||||||
# @log 'notice', 'update', params, ticket_update, ticket
|
# @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.load(ticket_update)
|
||||||
ticket.save(
|
ticket.save(
|
||||||
done: (r) =>
|
done: (r) =>
|
||||||
@bulk_count_index++
|
@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
|
# refresh view after all tickets are proceeded
|
||||||
if @bulk_count_index == @bulk_count
|
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">
|
<form class="form-inline update-box bulk-action-form" role="form">
|
||||||
<div id="form-ticket-bulk" class="horizontal">
|
<div id="form-ticket-bulk" class="horizontal">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -19,14 +24,15 @@
|
||||||
<option value="1">1 niedrig</option>
|
<option value="1">1 niedrig</option>
|
||||||
<option value="2">2 normal</option>
|
<option value="2">2 normal</option>
|
||||||
<option value="3">3 hoch</option>
|
<option value="3">3 hoch</option>
|
||||||
</select>
|
</select>
|
||||||
<!--
|
|
||||||
|
|
||||||
there can't be any other elements in .input-group
|
there can't be any other elements in .input-group
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
<span class="help-inline"></span>
|
<span class="help-inline"></span>
|
||||||
<span class="help-block"></span>
|
<span class="help-block"></span>
|
||||||
-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="create_group_id" class="input-group-addon">Gruppe</label>
|
<label for="create_group_id" class="input-group-addon">Gruppe</label>
|
||||||
|
@ -52,4 +58,5 @@
|
||||||
<input type="submit" class="btn primary submit" value="update">
|
<input type="submit" class="btn primary submit" value="update">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
-->
|
Loading…
Reference in a new issue