Improved customer panel.
This commit is contained in:
parent
1584b2f43c
commit
4499d5958f
9 changed files with 69 additions and 38 deletions
|
@ -98,7 +98,7 @@ class Index extends App.Controller
|
|||
edit = true
|
||||
if @isRole('Customer')
|
||||
checkbox = false
|
||||
edit = false
|
||||
edit = false
|
||||
view_modes = [
|
||||
{
|
||||
name: 'S'
|
||||
|
@ -106,8 +106,8 @@ class Index extends App.Controller
|
|||
class: 'active' if @view_mode is 's'
|
||||
},
|
||||
{
|
||||
name: 'M'
|
||||
type: 'm'
|
||||
name: 'M'
|
||||
type: 'm'
|
||||
class: 'active' if @view_mode is 'm'
|
||||
}
|
||||
]
|
||||
|
@ -116,7 +116,7 @@ class Index extends App.Controller
|
|||
view_modes: view_modes
|
||||
pages_total: pages_total
|
||||
start_page: @start_page
|
||||
checkbox: true
|
||||
checkbox: checkbox
|
||||
edit: edit
|
||||
)
|
||||
html = $(html)
|
||||
|
@ -125,7 +125,6 @@ class Index extends App.Controller
|
|||
@html html
|
||||
|
||||
# create table/overview
|
||||
checkbox = true
|
||||
table = ''
|
||||
if @view_mode is 'm'
|
||||
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/: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: '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 = []
|
||||
@el.html('')
|
||||
else
|
||||
if !@access()
|
||||
@messageLog = []
|
||||
@el.html('')
|
||||
return
|
||||
@start()
|
||||
|
||||
if !_.isEmpty( @Session.all() )
|
||||
if @access()
|
||||
@start()
|
||||
|
||||
access: ->
|
||||
return false if _.isEmpty( @Session.all() )
|
||||
return true if @isRole('Agent')
|
||||
return true if @isRole('Admin')
|
||||
return false
|
||||
|
||||
start: =>
|
||||
@focus = false
|
||||
@isShown = false
|
||||
|
|
|
@ -28,4 +28,4 @@ class Index extends App.Controller
|
|||
|
||||
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' )
|
||||
|
|
|
@ -62,7 +62,7 @@ class App.Navigation extends App.Controller
|
|||
|
||||
getItems: (data) ->
|
||||
navbar = _.values(data.navbar)
|
||||
|
||||
|
||||
level1 = []
|
||||
dropdown = {}
|
||||
|
||||
|
@ -75,17 +75,19 @@ class App.Navigation extends App.Controller
|
|||
item[key] = value
|
||||
if !item.parent
|
||||
match = 0
|
||||
if !roles
|
||||
if !item.role
|
||||
match = 1
|
||||
if !roles && item.role
|
||||
match = _.include( item.role, 'Anybody' )
|
||||
if roles
|
||||
roles.forEach( (role) =>
|
||||
if !match
|
||||
match = _.include(item.role, role.name)
|
||||
)
|
||||
|
||||
|
||||
if match
|
||||
level1.push item
|
||||
|
||||
|
||||
for item in navbar
|
||||
if item.parent && !dropdown[ item.parent ]
|
||||
dropdown[ item.parent ] = []
|
||||
|
@ -94,23 +96,25 @@ class App.Navigation extends App.Controller
|
|||
for itemSub in navbar
|
||||
if itemSub.parent is item.parent
|
||||
match = 0
|
||||
if !itemSub.role
|
||||
match = 1
|
||||
if !roles
|
||||
match = _.include( itemSub.role, 'Anybody' )
|
||||
if roles
|
||||
roles.forEach( (role) =>
|
||||
if !match
|
||||
match = _.include(itemSub.role, role.name)
|
||||
match = _.include( itemSub.role, role.name )
|
||||
)
|
||||
|
||||
|
||||
if match
|
||||
dropdown[ item.parent ].push itemSub
|
||||
|
||||
# find parent
|
||||
for itemLevel1 in level1
|
||||
if itemLevel1.target is item.parent
|
||||
sub = @getOrder(dropdown[ item.parent ])
|
||||
sub = @getOrder( dropdown[ item.parent ] )
|
||||
itemLevel1.child = sub
|
||||
|
||||
|
||||
nav = @getOrder(level1)
|
||||
return nav
|
||||
|
||||
|
@ -131,16 +135,16 @@ class App.Navigation extends App.Controller
|
|||
for num in inorder
|
||||
inordervalue.push newlist[ num ]
|
||||
return inordervalue
|
||||
|
||||
|
||||
sortit: (a,b) ->
|
||||
return(a-b)
|
||||
|
||||
|
||||
addPrioCount: (newlist, item) ->
|
||||
if newlist[ item['prio'] ]
|
||||
item['prio']++
|
||||
if newlist[ item['prio'] ]
|
||||
@addPrioCount newlist, item
|
||||
|
||||
|
||||
update: (url) =>
|
||||
@el.find('li').removeClass('active')
|
||||
@el.find("[href=\"#{url}\"]").parents('li').addClass('active')
|
||||
|
@ -163,7 +167,7 @@ class App.Navigation extends App.Controller
|
|||
name: item.name,
|
||||
count: item.count,
|
||||
target: '#ticket_view/' + item.url,
|
||||
role: ['Agent'],
|
||||
# role: ['Agent', 'Customer'],
|
||||
}
|
||||
|
||||
@Config.set( 'NavBar', NavBar )
|
||||
|
@ -203,7 +207,7 @@ class App.Navigation extends App.Controller
|
|||
parent: '#current_user',
|
||||
name: item.history_object.name + ' (' + ticket.title + ')',
|
||||
target: '#ticket/zoom/' + ticket.id,
|
||||
role: ['Agent'],
|
||||
# role: ['Agent', 'Customer'],
|
||||
divider: divider,
|
||||
navheader: navheader
|
||||
}
|
||||
|
|
|
@ -10,18 +10,18 @@ class Index extends App.Controller
|
|||
new App.ControllerGenericIndex(
|
||||
el: @el,
|
||||
id: @id,
|
||||
genericObject: 'TextModule',
|
||||
genericObject: 'Overview',
|
||||
pageData: {
|
||||
title: 'TextModules',
|
||||
home: 'text_modules',
|
||||
object: 'TextModule',
|
||||
objects: 'TextModules',
|
||||
navupdate: '#text_modules',
|
||||
title: 'Overviews',
|
||||
home: 'overviews',
|
||||
object: 'Overview',
|
||||
objects: 'Overviews',
|
||||
navupdate: '#overviews',
|
||||
notes: [
|
||||
'TextModules are ...'
|
||||
'Overview are ...'
|
||||
],
|
||||
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'
|
||||
@extend Spine.Model.Ajax
|
||||
@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
|
||||
def create
|
||||
@ticket = Ticket.new(params[:ticket])
|
||||
@ticket.updated_by_id = current_user.id
|
||||
@ticket.created_by_id = current_user.id
|
||||
|
||||
# check if article is given
|
||||
|
@ -39,6 +40,7 @@ class TicketsController < ApplicationController
|
|||
if params[:article]
|
||||
@article = Ticket::Article.new(params[:article])
|
||||
@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
|
||||
|
||||
# find attachments in upload cache
|
||||
|
|
|
@ -148,14 +148,15 @@ class CreateTicket < ActiveRecord::Migration
|
|||
create_table :overviews do |t|
|
||||
t.references :user, :null => true
|
||||
t.references :role, :null => false
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :meta, :string, :limit => 1000, :null => false
|
||||
t.column :condition, :string, :limit => 2500, :null => false
|
||||
t.column :order, :string, :limit => 2500, :null => false
|
||||
t.column :group_by, :string, :limit => 250, :null => true
|
||||
t.column :view, :string, :limit => 1000, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :meta, :string, :limit => 1000, :null => false
|
||||
t.column :condition, :string, :limit => 2500, :null => false
|
||||
t.column :order, :string, :limit => 2500, :null => false
|
||||
t.column :group_by, :string, :limit => 250, :null => true
|
||||
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 :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :overviews, [:user_id]
|
||||
|
|
|
@ -1429,7 +1429,7 @@ Overview.create(
|
|||
|
||||
overview_role = Role.where( :name => 'Customer' ).first
|
||||
Overview.create(
|
||||
:name => 'My Tickets',
|
||||
:name => 'my_tickets',
|
||||
:role_id => overview_role.id,
|
||||
:condition => {
|
||||
:customer_id => 'current_user.id',
|
||||
|
|
Loading…
Reference in a new issue