-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathview_tickets.php
150 lines (122 loc) · 4.31 KB
/
view_tickets.php
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if (!isset(($_SESSION['id']))){
header('LOCATION:Login.html');
die ();
}
require ("db_config.php");
$dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR
die('Coul not connect MySQL: ' . mysqli_connect_error () );
//set encoding
mysqli_set_charset($dbc, 'utf8');
$output = '';
$where ='';
if (isset ($_POST['query'])){
$where = $_POST['query'];
}
$query = "select * from Vtickets $where order by created_at desc";
$result = mysqli_query ($dbc, $query);
if (!$result){
echo "no data found";
die();
}
?>
<div class="container-xl">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-4">
<h2>Ticket Details</h2>
</div>
</div>
</div>
<div class="table-filter">
<div class="row">
<div class="col-sm-6">
<div class="filter-group">
<button type="button" id="search_ticket_button" class="btn btn-primary"><i class="fa fa-search"></i></button>
<label>Name</label>
<input type="text" id="search_ticket_name" class="form-control">
</div>
</div>
<div class="col-sm-3">
<div class="filter-group">
<label>Status</label>
<select name="ticket_status" id="ticket_status" class="form-control">
<option value="Any" >Any</option>
<option value="New">New</option>
<?php echo "<option value='".$_SESSION['id']."'>My Tickets</option> ";?>
<option value="Work_In _Progress">Work In Progress</option>
<option value="On_Hold">On Hold</option>
<option value="Completed">Completed</option>
<option value="Canceled">Canceled</option>
</select>
</div>
<span class="filter-icon"><i class="fa fa-filter"></i></span>
</div>
<div class="col-sm-2 float-right">
<button data-dismiss="modal" data-toggle="modal" data-target="#insertTicket" type="button" class="btn btn-warning" style="background-color:#C95C54; color: white;" >Ticket <i class="fa fa-plus pr-2" aria-hidden="true"></i></button>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>#</th>
<th style="width:20%">Customer</th>
<th>Subject</th>
<th style="width:15%">Status</th>
<th style="width:10%">Cost</th>
<th style="width:10%">Scheduled</th>
<th>Action</th>
</tr>
</thead>
<tbody id="ticket_body">
<?php
$res='';
while($row = mysqli_fetch_array($result)){
if (!empty($row['ticket_number'])){
$ticket_num = $row['ticket_number'] ;
}
else {
$ticket_num = $row['ticket_id'] ;
}
echo ' <tr>
<td>'. $ticket_num .' </td>
<td>'. $row['name'] .'</td>
<td>' . $row['subject'] . '</td>';
if ($row['status'] == "New"){
$res = "info";
}
else if ($row['status'] == "Work_In _Progress"){
$res = "info";
}
else if ($row['status'] == "On_Hold"){
$res = "warning";
}
else if ($row['status'] == "Completed"){
$res = "success";
}
else if ($row['status'] == "Canceled"){
$res = "danger";
}
else {
$res = "null";
}
echo '
<td><span class="status text-'.$res.'">•</span>'.str_replace('_', ' ', $row['status']) . '</td>
<td>$'. $row['cost'] .'</td>
<td>'. $row['scheduled'] .'</td>
<td><a href="#" id='. $row["ticket_id"] .' class="view view_data" title="View Details" data-toggle="tooltip"><i class="material-icons"></i></a></td>
</tr>';
}
echo '</tbody>
</table>
<div class="clearfix">
</div>
</div>
</div> ';
?>