Improved customer panel.
This commit is contained in:
parent
1584b2f43c
commit
4499d5958f
9 changed files with 69 additions and 38 deletions
|
@ -116,7 +116,7 @@ class Index extends App.Controller
|
||||||
view_modes: view_modes
|
view_modes: view_modes
|
||||||
pages_total: pages_total
|
pages_total: pages_total
|
||||||
start_page: @start_page
|
start_page: @start_page
|
||||||
checkbox: true
|
checkbox: checkbox
|
||||||
edit: edit
|
edit: edit
|
||||||
)
|
)
|
||||||
html = $(html)
|
html = $(html)
|
||||||
|
@ -125,7 +125,6 @@ class Index extends App.Controller
|
||||||
@html html
|
@html html
|
||||||
|
|
||||||
# create table/overview
|
# create table/overview
|
||||||
checkbox = true
|
|
||||||
table = ''
|
table = ''
|
||||||
if @view_mode is 'm'
|
if @view_mode is 'm'
|
||||||
table = App.view('agent_ticket_view/detail')(
|
table = App.view('agent_ticket_view/detail')(
|
||||||
|
@ -510,6 +509,8 @@ class Router extends App.Controller
|
||||||
App.Config.set( 'ticket_view/:view', Index, 'Routes' )
|
App.Config.set( 'ticket_view/:view', Index, 'Routes' )
|
||||||
App.Config.set( 'ticket_view/:view/:position/:direction', Router, 'Routes' )
|
App.Config.set( 'ticket_view/:view/:position/:direction', Router, 'Routes' )
|
||||||
|
|
||||||
App.Config.set( 'TicketOverview', { prio: 1000, parent: '', name: 'Overviews', target: '#ticket_view', role: ['Agent'] }, 'NavBar' )
|
App.Config.set( 'TicketOverview', { prio: 1000, parent: '', name: 'Overviews', target: '#ticket_view', role: ['Agent', 'Customer'] }, 'NavBar' )
|
||||||
#App.Config.set( '', { prio: 1000, parent: '#ticket_view', name: 'My assigned Tickets (51)', target: '#ticket_view/my_assigned', role: ['Agent'] }
|
#App.Config.set( '', { prio: 1000, parent: '#ticket_view', name: 'My assigned Tickets (51)', target: '#ticket_view/my_assigned', role: ['Agent'] }
|
||||||
#App.Config.set( '', { prio: 1000, parent: '#ticket_view', name: 'Unassigned Tickets (133)', target: '#ticket_view/all_unassigned', role: ['Agent'] }
|
#App.Config.set( '', { prio: 1000, parent: '#ticket_view', name: 'Unassigned Tickets (133)', target: '#ticket_view/all_unassigned', role: ['Agent'] }
|
||||||
|
|
||||||
|
#App.Config.set( 'TicketOverview', { prio: 1700, parent: '', name: 'Overviews', target: '#ticket_view', role: ['Customer'] }, 'NavBar' )
|
||||||
|
|
|
@ -18,11 +18,21 @@ class App.ChatWidget extends App.Controller
|
||||||
@messageLog = []
|
@messageLog = []
|
||||||
@el.html('')
|
@el.html('')
|
||||||
else
|
else
|
||||||
|
if !@access()
|
||||||
|
@messageLog = []
|
||||||
|
@el.html('')
|
||||||
|
return
|
||||||
@start()
|
@start()
|
||||||
|
|
||||||
if !_.isEmpty( @Session.all() )
|
if @access()
|
||||||
@start()
|
@start()
|
||||||
|
|
||||||
|
access: ->
|
||||||
|
return false if _.isEmpty( @Session.all() )
|
||||||
|
return true if @isRole('Agent')
|
||||||
|
return true if @isRole('Admin')
|
||||||
|
return false
|
||||||
|
|
||||||
start: =>
|
start: =>
|
||||||
@focus = false
|
@focus = false
|
||||||
@isShown = false
|
@isShown = false
|
||||||
|
|
|
@ -28,4 +28,4 @@ class Index extends App.Controller
|
||||||
|
|
||||||
App.Config.set( 'customer_tickets', Index, 'Routes' )
|
App.Config.set( 'customer_tickets', Index, 'Routes' )
|
||||||
|
|
||||||
App.Config.set( 'CustomerTickets', { prio: 1700, parent: '', name: 'My Tickets', target: '#ticket_view/my_tickets', role: ['Customer'] }, 'NavBar' )
|
#App.Config.set( 'CustomerTickets', { prio: 1700, parent: '', name: 'My Tickets', target: '#ticket_view/my_tickets', role: ['Customer'] }, 'NavBar' )
|
||||||
|
|
|
@ -75,7 +75,9 @@ class App.Navigation extends App.Controller
|
||||||
item[key] = value
|
item[key] = value
|
||||||
if !item.parent
|
if !item.parent
|
||||||
match = 0
|
match = 0
|
||||||
if !roles
|
if !item.role
|
||||||
|
match = 1
|
||||||
|
if !roles && item.role
|
||||||
match = _.include( item.role, 'Anybody' )
|
match = _.include( item.role, 'Anybody' )
|
||||||
if roles
|
if roles
|
||||||
roles.forEach( (role) =>
|
roles.forEach( (role) =>
|
||||||
|
@ -94,6 +96,8 @@ class App.Navigation extends App.Controller
|
||||||
for itemSub in navbar
|
for itemSub in navbar
|
||||||
if itemSub.parent is item.parent
|
if itemSub.parent is item.parent
|
||||||
match = 0
|
match = 0
|
||||||
|
if !itemSub.role
|
||||||
|
match = 1
|
||||||
if !roles
|
if !roles
|
||||||
match = _.include( itemSub.role, 'Anybody' )
|
match = _.include( itemSub.role, 'Anybody' )
|
||||||
if roles
|
if roles
|
||||||
|
@ -163,7 +167,7 @@ class App.Navigation extends App.Controller
|
||||||
name: item.name,
|
name: item.name,
|
||||||
count: item.count,
|
count: item.count,
|
||||||
target: '#ticket_view/' + item.url,
|
target: '#ticket_view/' + item.url,
|
||||||
role: ['Agent'],
|
# role: ['Agent', 'Customer'],
|
||||||
}
|
}
|
||||||
|
|
||||||
@Config.set( 'NavBar', NavBar )
|
@Config.set( 'NavBar', NavBar )
|
||||||
|
@ -203,7 +207,7 @@ class App.Navigation extends App.Controller
|
||||||
parent: '#current_user',
|
parent: '#current_user',
|
||||||
name: item.history_object.name + ' (' + ticket.title + ')',
|
name: item.history_object.name + ' (' + ticket.title + ')',
|
||||||
target: '#ticket/zoom/' + ticket.id,
|
target: '#ticket/zoom/' + ticket.id,
|
||||||
role: ['Agent'],
|
# role: ['Agent', 'Customer'],
|
||||||
divider: divider,
|
divider: divider,
|
||||||
navheader: navheader
|
navheader: navheader
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,18 @@ class Index extends App.Controller
|
||||||
new App.ControllerGenericIndex(
|
new App.ControllerGenericIndex(
|
||||||
el: @el,
|
el: @el,
|
||||||
id: @id,
|
id: @id,
|
||||||
genericObject: 'TextModule',
|
genericObject: 'Overview',
|
||||||
pageData: {
|
pageData: {
|
||||||
title: 'TextModules',
|
title: 'Overviews',
|
||||||
home: 'text_modules',
|
home: 'overviews',
|
||||||
object: 'TextModule',
|
object: 'Overview',
|
||||||
objects: 'TextModules',
|
objects: 'Overviews',
|
||||||
navupdate: '#text_modules',
|
navupdate: '#overviews',
|
||||||
notes: [
|
notes: [
|
||||||
'TextModules are ...'
|
'Overview are ...'
|
||||||
],
|
],
|
||||||
buttons: [
|
buttons: [
|
||||||
{ name: 'New TextModule', 'data-type': 'new', class: 'primary' },
|
{ name: 'New Overview', 'data-type': 'new', class: 'primary' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,3 +2,16 @@ class App.Overview extends Spine.Model
|
||||||
@configure 'Overview', 'name', 'meta', 'condition', 'order', 'group_by', 'view', 'user_id', 'group_ids'
|
@configure 'Overview', 'name', 'meta', 'condition', 'order', 'group_by', 'view', 'user_id', 'group_ids'
|
||||||
@extend Spine.Model.Ajax
|
@extend Spine.Model.Ajax
|
||||||
@url: '/api/overviews'
|
@url: '/api/overviews'
|
||||||
|
@configure_attributes = [
|
||||||
|
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
|
||||||
|
{ name: 'role_id', display: 'Role', tag: 'select', multiple: false, nulloption: true, null: false, relation: 'Role', class: 'span4' },
|
||||||
|
{ name: 'user_id', display: 'User', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'User', class: 'span4' },
|
||||||
|
# { name: 'content', display: 'Content', tag: 'textarea', limit: 250, 'null': false, 'class': 'span4' },
|
||||||
|
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
||||||
|
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||||
|
]
|
||||||
|
@configure_overview = [
|
||||||
|
'name',
|
||||||
|
'role',
|
||||||
|
'active',
|
||||||
|
]
|
|
@ -21,6 +21,7 @@ class TicketsController < ApplicationController
|
||||||
# POST /tickets
|
# POST /tickets
|
||||||
def create
|
def create
|
||||||
@ticket = Ticket.new(params[:ticket])
|
@ticket = Ticket.new(params[:ticket])
|
||||||
|
@ticket.updated_by_id = current_user.id
|
||||||
@ticket.created_by_id = current_user.id
|
@ticket.created_by_id = current_user.id
|
||||||
|
|
||||||
# check if article is given
|
# check if article is given
|
||||||
|
@ -39,6 +40,7 @@ class TicketsController < ApplicationController
|
||||||
if params[:article]
|
if params[:article]
|
||||||
@article = Ticket::Article.new(params[:article])
|
@article = Ticket::Article.new(params[:article])
|
||||||
@article.created_by_id = params[:article][:created_by_id] || current_user.id
|
@article.created_by_id = params[:article][:created_by_id] || current_user.id
|
||||||
|
@article.updated_by_id = params[:article][:updated_by_id] || current_user.id
|
||||||
@article.ticket_id = @ticket.id
|
@article.ticket_id = @ticket.id
|
||||||
|
|
||||||
# find attachments in upload cache
|
# find attachments in upload cache
|
||||||
|
|
|
@ -154,6 +154,7 @@ class CreateTicket < ActiveRecord::Migration
|
||||||
t.column :order, :string, :limit => 2500, :null => false
|
t.column :order, :string, :limit => 2500, :null => false
|
||||||
t.column :group_by, :string, :limit => 250, :null => true
|
t.column :group_by, :string, :limit => 250, :null => true
|
||||||
t.column :view, :string, :limit => 1000, :null => false
|
t.column :view, :string, :limit => 1000, :null => false
|
||||||
|
t.column :active, :boolean, :null => false, :default => true
|
||||||
t.column :updated_by_id, :integer, :null => false
|
t.column :updated_by_id, :integer, :null => false
|
||||||
t.column :created_by_id, :integer, :null => false
|
t.column :created_by_id, :integer, :null => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ Overview.create(
|
||||||
|
|
||||||
overview_role = Role.where( :name => 'Customer' ).first
|
overview_role = Role.where( :name => 'Customer' ).first
|
||||||
Overview.create(
|
Overview.create(
|
||||||
:name => 'My Tickets',
|
:name => 'my_tickets',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
:customer_id => 'current_user.id',
|
:customer_id => 'current_user.id',
|
||||||
|
|
Loading…
Reference in a new issue