Improved shown information.
This commit is contained in:
parent
cbbf34c271
commit
405be36647
2 changed files with 28 additions and 48 deletions
|
@ -11,56 +11,37 @@ class Index extends App.Controller
|
||||||
render: =>
|
render: =>
|
||||||
|
|
||||||
# matrix
|
# matrix
|
||||||
config = {}
|
config =
|
||||||
config['matrix'] = {}
|
group_ids: []
|
||||||
config['matrix']['create'] = {}
|
matrix:
|
||||||
config['matrix']['create']['name'] = 'new Ticket'
|
create:
|
||||||
config['matrix']['create']['criteria'] = {}
|
name: 'new Ticket'
|
||||||
config['matrix']['create']['criteria']['owned_by_me'] = true
|
update:
|
||||||
config['matrix']['create']['criteria']['owned_by_nobody'] = true
|
name: 'Ticket update'
|
||||||
config['matrix']['create']['criteria']['no'] = false
|
reminder_reached:
|
||||||
config['matrix']['create']['channel'] = {}
|
name: 'Ticket reminder reached'
|
||||||
config['matrix']['create']['channel']['email'] = true
|
escalation:
|
||||||
config['matrix']['create']['channel']['online'] = false
|
name: 'Ticket escalation'
|
||||||
config['matrix']['update'] = {}
|
|
||||||
config['matrix']['update']['name'] = 'Ticket update'
|
|
||||||
config['matrix']['update']['criteria'] = {}
|
|
||||||
config['matrix']['update']['criteria']['owned_by_me'] = true
|
|
||||||
config['matrix']['update']['criteria']['owned_by_nobody'] = false
|
|
||||||
config['matrix']['update']['criteria']['no'] = false
|
|
||||||
config['matrix']['update']['channel'] = {}
|
|
||||||
config['matrix']['update']['channel']['email'] = true
|
|
||||||
config['matrix']['update']['channel']['online'] = false
|
|
||||||
config['matrix']['move_into'] = {}
|
|
||||||
config['matrix']['move_into']['name'] = 'Ticket moved into my group'
|
|
||||||
config['matrix']['move_into']['criteria'] = {}
|
|
||||||
config['matrix']['move_into']['criteria']['owned_by_me'] = true
|
|
||||||
config['matrix']['move_into']['criteria']['owned_by_nobody'] = true
|
|
||||||
config['matrix']['move_into']['criteria']['no'] = false
|
|
||||||
config['matrix']['move_into']['channel'] = {}
|
|
||||||
config['matrix']['move_into']['channel']['email'] = true
|
|
||||||
config['matrix']['move_into']['channel']['online'] = false
|
|
||||||
config['matrix']['escalation'] = {}
|
|
||||||
config['matrix']['escalation']['name'] = 'Ticket escalation'
|
|
||||||
config['matrix']['escalation']['criteria'] = {}
|
|
||||||
config['matrix']['escalation']['criteria']['owned_by_me'] = true
|
|
||||||
config['matrix']['escalation']['criteria']['owned_by_nobody'] = true
|
|
||||||
config['matrix']['escalation']['criteria']['no'] = false
|
|
||||||
config['matrix']['escalation']['channel'] = {}
|
|
||||||
config['matrix']['escalation']['channel']['email'] = true
|
|
||||||
config['matrix']['escalation']['channel']['online'] = false
|
|
||||||
|
|
||||||
user_config = @Session.get('preferences').notification_config
|
user_config = @Session.get('preferences').notification_config
|
||||||
if user_config
|
if user_config
|
||||||
config = $.extend(true, {}, config, user_config)
|
config = $.extend(true, {}, config, user_config)
|
||||||
console.log('oo', config)
|
|
||||||
# groups
|
# groups
|
||||||
|
user_group_config = true
|
||||||
|
if !user_config || !user_config['group_ids'] || _.isEmpty(user_config['group_ids']) || user_config['group_ids'][0] is '-'
|
||||||
|
user_group_config = false
|
||||||
|
|
||||||
groups = []
|
groups = []
|
||||||
group_ids = @Session.get('group_ids')
|
group_ids = @Session.get('group_ids')
|
||||||
if group_ids
|
if group_ids
|
||||||
for group_id in group_ids
|
for group_id in group_ids
|
||||||
group = App.Group.find(group_id)
|
group = App.Group.find(group_id)
|
||||||
groups.push group
|
groups.push group
|
||||||
|
if !user_group_config
|
||||||
|
if !config['group_ids']
|
||||||
|
config['group_ids'] = []
|
||||||
|
config['group_ids'].push group_id.toString()
|
||||||
|
|
||||||
@html App.view('profile/notification')( groups: groups, config: config )
|
@html App.view('profile/notification')( groups: groups, config: config )
|
||||||
|
|
||||||
|
@ -72,7 +53,6 @@ class Index extends App.Controller
|
||||||
params.notification_config = {}
|
params.notification_config = {}
|
||||||
|
|
||||||
form_params = @formParam(e.target)
|
form_params = @formParam(e.target)
|
||||||
console.log('P',form_params)
|
|
||||||
for key, value of form_params
|
for key, value of form_params
|
||||||
if key is 'group_ids'
|
if key is 'group_ids'
|
||||||
if typeof value isnt 'object'
|
if typeof value isnt 'object'
|
||||||
|
@ -110,8 +90,8 @@ class Index extends App.Controller
|
||||||
email: true
|
email: true
|
||||||
online: false
|
online: false
|
||||||
}
|
}
|
||||||
console.log('P2',params)
|
if !params.notification_config.group_ids || _.isEmpty(params.notification_config.group_ids)
|
||||||
|
params.notification_config.group_ids = ['-']
|
||||||
@formDisable(e)
|
@formDisable(e)
|
||||||
|
|
||||||
# get data
|
# get data
|
||||||
|
@ -127,12 +107,12 @@ class Index extends App.Controller
|
||||||
|
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
App.User.full(
|
App.User.full(
|
||||||
App.Session.get( 'id' ),
|
App.Session.get('id'),
|
||||||
=>
|
=>
|
||||||
App.Event.trigger( 'ui:rerender' )
|
App.Event.trigger('ui:rerender')
|
||||||
@notify(
|
@notify(
|
||||||
type: 'success'
|
type: 'success'
|
||||||
msg: App.i18n.translateContent( 'Successfully!' )
|
msg: App.i18n.translateContent('Successfully!')
|
||||||
)
|
)
|
||||||
,
|
,
|
||||||
true
|
true
|
||||||
|
@ -140,10 +120,10 @@ class Index extends App.Controller
|
||||||
|
|
||||||
error: (xhr, status, error) =>
|
error: (xhr, status, error) =>
|
||||||
@render()
|
@render()
|
||||||
data = JSON.parse( xhr.responseText )
|
data = JSON.parse(xhr.responseText)
|
||||||
@notify(
|
@notify(
|
||||||
type: 'error'
|
type: 'error'
|
||||||
msg: App.i18n.translateContent( data.message )
|
msg: App.i18n.translateContent(data.message)
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'Notifications', { prio: 2600, name: 'Notifications', parent: '#profile', target: '#profile/notifications', role: ['Agent'], controller: Index }, 'NavBarProfile' )
|
App.Config.set( 'Notifications', { prio: 2600, name: 'Notifications', parent: '#profile', target: '#profile/notifications', role: ['Agent'], controller: Index }, 'NavBarProfile' )
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
<h3><%- @T( 'Groups' ) %></h3>
|
<h3><%- @T( 'Groups' ) %></h3>
|
||||||
|
<%- @T('For "owned by nobody" and "no criteria" only notify about tickets in theres groups.') %>
|
||||||
<div class="settings-entry">
|
<div class="settings-entry">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<% if @groups: %>
|
<% if @groups: %>
|
||||||
|
|
Loading…
Reference in a new issue