/
tickets.html.erb
107 lines (98 loc) · 4.21 KB
/
tickets.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Suite</title>
<%= javascript_include_tag "jquery", "jquery-ui" %>
<%= javascript_include_tag "jquery.metadata", "quicksilver", "jquery.quickselect", "jquery.url" %>
<%= javascript_include_tag "common", "tickets" %>
<%= stylesheet_link_tag "blueprint/screen", "jquery-theme", "common", "tickets", :media => "screen", :cache => "tickets-css-combined" %>
<%= stylesheet_link_tag "blueprint/print", "print", :media => "print", :cache => "print-css-combined" %>
<!--[if IE]><link rel="stylesheet" href="/stylesheets/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
</head>
<body class="container">
<div id="header">
<h1 class="hide">Opportunity Tickets</h1>
<ul>
<li><a href="/clients">Clients</a></li>
<li><a href="/tickets">Tickets</a></li>
<li><a href="/devices">Devices</a></li>
<li><a href="/settings">Settings</a></li>
<li><a href="/reports">Reports</a></li>
</ul>
</div>
<div id="sidebar">
<h2>Tickets</h2>
<ul class="m">
<li><a href="/tickets/?status=open" class="open">Open</a><%= totals_helper(:open) %></li>
<li><a href="/tickets/?status=scheduled" class="scheduled">Scheduled</a><%= totals_helper(:scheduled) %></li>
<li><a href="/tickets/?status=completed" class="completed">Completed</a><%= totals_helper(:completed) %></li>
<li><a href="/tickets/?status=all&scope=all" class="all">All</a><%= totals_helper(:all) %></li>
<li><a href="/tickets/?status=archived" class="archived">Archived</a></li>
</ul>
</div>
<div id="center">
<div id="content_search">
<div id="applesearch"><form action="/tickets/search"><span class="sbox_l"></span><span class="sbox"><input type="search" id="srch_fld" name="q" placeholder="Search..." autosave="applestyle_srch" results="5" onkeyup="" /></span><span class="sbox_r" id="srch_clear"></span> <input id="srch_button" name="commit" type="submit" value="Search" onclick="" /></form></div>
<% @users = User.find(:all).collect {|c| [c.name, c.id]} %>
<div id="user_select"></div>
</div>
<%= yield %>
</div>
<div id="footer">
<div class="col1">
<%= link_to "New", "/tickets/new" %>
</div>
<div class="col2"></div>
<div class="col3">
<%= link_to "Logout?", "/logout" %>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function() {
// Put select box there as long as this isn't a search results or ticket show page
if($.url.segment(1)){
}else{
$('div#user_select').append("<select></select>");
};
// setup my select box for the technician we're viewing
var technicians = new Array();
var row = ""
var tech_id = ""
var tech_name = ""
<% User.find(:all, :order => 'updated_at desc').each do |technician| %>
tech_id = "<%= technician.id %>"
tech_name = "<%= technician.name %>"
technicians[tech_id] = tech_name;
row = '<option value='+tech_id+'>'+tech_name+'</option>'
$('div#user_select select').append(row);
<% end %>
row = '<option value="all">All</option>'
$('div#user_select select').append(row);
// Get the scope, set the select box to the correct value
var scope = $.url.param("scope");
if(scope*1){
$("div#user_select select").val(scope);
}else if(scope == 'all'){
$("div#user_select select").val(scope);
}else{
$("div#user_select select").val(<% current_user.id %>);
};
// Update page based on selection
var url = $.url.attr("source");
url = url.replace(/\/tickets(.*)$/, "/")
if($.url.param("status")){
var status = $.url.param("status");
}else{
var status = "open";
};
$('div#user_select select').change(function(){
scope = $(this).val()
url = url+"tickets/?status="+status+"&scope="+scope
window.location.replace(url);
})
});
</script>