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
|
||||
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' )
|
||||
|
|
|
@ -75,7 +75,9 @@ 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) =>
|
||||
|
@ -94,6 +96,8 @@ 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
|
||||
|
@ -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
|
||||
|
|
|
@ -154,6 +154,7 @@ class CreateTicket < ActiveRecord::Migration
|
|||
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
|
||||
|
|
|
@ -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