forked from itflow-org/itflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
campaign_details.php
321 lines (269 loc) · 11.3 KB
/
campaign_details.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php include("config.php"); ?>
<?php include("header.php"); ?>
<?php
if(isset($_GET['ticket_id'])){
$ticket_id = intval($_GET['ticket_id']);
$sql = mysqli_query($mysqli,"SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id LEFT JOIN contacts ON ticket_contact_id = contact_id LEFT JOIN users ON ticket_assigned_to = user_id LEFT JOIN locations ON ticket_location_id = location_id WHERE ticket_id = $ticket_id AND tickets.company_id = $session_company_id");
if(mysqli_num_rows($sql) == 0){
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
include("footer.php");
}else{
$row = mysqli_fetch_array($sql);
$client_id = $row['client_id'];
$client_name = $row['client_name'];
$client_type = $row['client_type'];
$client_website = $row['client_website'];
$client_net_terms = $row['client_net_terms'];
if($client_net_terms == 0){
$client_net_terms = $config_default_net_terms;
}
$ticket_prefix = $row['ticket_prefix'];
$ticket_number = $row['ticket_number'];
$ticket_category = $row['ticket_category'];
$ticket_subject = $row['ticket_subject'];
$ticket_details = $row['ticket_details'];
$ticket_priority = $row['ticket_priority'];
$ticket_status = $row['ticket_status'];
$ticket_created_at = $row['ticket_created_at'];
$ticket_updated_at = $row['ticket_updated_at'];
$ticket_closed_at = $row['ticket_closed_at'];
$ticket_created_by = $row['ticket_created_by'];
if($ticket_status == "Open"){
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
}elseif($ticket_status == "Working"){
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
}else{
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
}
if($ticket_priority == "High"){
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
}elseif($ticket_priority == "Medium"){
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
}elseif($ticket_priority == "Low"){
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
}else{
$ticket_priority_display = "-";
}
$contact_id = $row['contact_id'];
$contact_name = $row['contact_name'];
$contact_title = $row['contact_title'];
$contact_email = $row['contact_email'];
$contact_phone = formatPhoneNumber($row['contact_phone']);
$contact_extension = $row['contact_extension'];
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
$location_name = $row['location_name'];
$location_address = $row['location_address'];
$location_city = $row['location_city'];
$location_state = $row['location_state'];
$location_zip = $row['location_zip'];
$location_phone = formatPhoneNumber($row['location_phone']);
$ticket_assigned_to = $row['ticket_assigned_to'];
if(empty($ticket_assigned_to)){
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
}else{
$ticket_assigned_to_display = $row['user_name'];
}
?>
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="tickets.php">Tickets</a>
</li>
<li class="breadcrumb-item">
<a href="client.php?client_id=<?php echo $client_id; ?>&tab=tickets"><?php echo $client_name; ?></a>
</li>
<li class="breadcrumb-item active">Ticket Details</li>
</ol>
<div class="row mb-3">
<div class="col-9">
<h3>Ticket <?php echo "$ticket_prefix$ticket_number"; ?> <?php echo $ticket_status_display; ?></h3>
</div>
<div class="col-3">
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown">
<i class="fas fa-fw fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketModal<?php echo $ticket_id; ?>">Edit</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_client=<?php echo $client_id; ?>">Delete</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-9">
<div class="card card-outline card-primary mb-3">
<div class="card-header">
<h3 class="card-title"><?php echo $ticket_subject; ?></h3>
</div>
<div class="card-body">
<?php echo $ticket_details; ?>
</div>
</div>
<form class="mb-3" action="post.php" method="post" autocomplete="off">
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
<div class="form-group">
<textarea class="form-control summernote" name="ticket_reply"></textarea>
</div>
<div class="form-row">
<div class="col-md-3">
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
</div>
<select class="form-control select2" name="status" required>
<option <?php if($ticket_status == 'Open'){ echo "selected"; } ?> >Open</option>
<option <?php if($ticket_status == 'Working'){ echo "selected"; } ?> >Working</option>
<option <?php if($ticket_status == 'On Hold'){ echo "selected"; } ?> >On Hold</option>
<option <?php if($ticket_status == 'Closed'){ echo "selected"; } ?> >Closed</option>
</select>
</div>
</div>
</div>
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
<div class="col-md-2">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_reply" value="1" checked>
<label class="custom-control-label" for="customControlAutosizing">Email update to client</label>
</div>
</div>
</div>
<?php } ?>
<div class="col-md-1">
<button type="submit" name="add_ticket_reply" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> Save</button>
</div>
<?php
if($ticket_status !== "Closed"){
?>
<div class="col-md-2">
<a href="post.php?close_ticket=<?php echo $ticket_id; ?>" class="btn btn-outline-danger btn-block">Close Ticket</a>
</div>
<?php
}
?>
</div>
</form>
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL ORDER BY ticket_reply_id DESC");
while($row = mysqli_fetch_array($sql)){;
$ticket_reply_id = $row['ticket_reply_id'];
$ticket_reply = $row['ticket_reply'];
$ticket_reply_created_at = $row['ticket_reply_created_at'];
$ticket_reply_by = $row['ticket_reply_by'];
$ticket_reply_by_display = $row['user_name'];
$user_id = $row['user_id'];
$user_avatar = $row['user_avatar'];
$user_initials = initials($user_name);
?>
<div class="card mb-3">
<div class="card-header">
<h3 class="card-title">
<div class="media">
<?php if(!empty($user_avatar)){ ?>
<img src="<?php echo "uploads/users/$user_id/$user_avatar"; ?>" alt="User Avatar" class="img-size-50 mr-3 img-circle">
<?php }else{ ?>
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $user_initials; ?></span>
</span>
<?php
}
?>
<div class="media-body">
<?php echo $ticket_reply_by_display; ?>
<br>
<small class="text-muted"><?php echo $ticket_reply_created_at; ?></small>
</div>
</div>
</h3>
<div class="card-tools">
<div class="dropdown dropleft">
<button class="btn btn-tool" type="button" id="dropdownMenuButton" data-toggle="dropdown">
<i class="fas fa-fw fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketReplyModal<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-edit text-secondary"></i> Edit</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_ticket_reply=<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-trash text-danger"></i> Delete</a>
</div>
</div>
</div>
</div>
<div class="card-body">
<?php echo $ticket_reply; ?>
</div>
</div>
<?php
include("edit_ticket_reply_modal.php");
}
?>
</div>
<div class="col-md-3">
<div class="card mb-3">
<div class="card-body">
<div>
<h4 class="text-secondary">Client</h4>
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_name; ?>
</div>
</div>
</div>
<?php if(!empty($contact_id)){ ?>
<div class="card mb-3">
<div class="card-body">
<div>
<h4 class="text-secondary">Contact</h4>
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_name; ?>
<br>
<?php
if(!empty($location_name)){
?>
<i class="fa fa-fw fa-map-marker-alt text-secondary ml-1 mr-2 mb-2"></i> <?php echo $location_name; ?>
<br>
<?php
}
?>
<?php
if(!empty($contact_email)){
?>
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i> <a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a>
<br>
<?php
}
?>
<?php
if(!empty($contact_phone)){
?>
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_phone; ?>
<br>
<?php
}
?>
<?php
if(!empty($contact_mobile)){
?>
<i class="fa fa-fw fa-mobile text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_mobile; ?>
<br>
<?php
}
?>
</div>
</div>
</div>
<?php } ?>
<div class="card card-body mb-3">
<h4 class="text-secondary">Details</h4>
<div class="ml-1"><i class="fa fa-fw fa-thermometer-half text-secondary mr-2 mb-2"></i> <?php echo $ticket_priority_display; ?></div>
<div class="ml-1"><i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i> <?php echo $ticket_assigned_to_display; ?></div>
<div class="ml-1"><i class="fa fa-fw fa-clock text-secondary mr-2 mb-2"></i> <?php echo $ticket_created_at; ?></div>
</div>
</div>
</div>
<?php include("edit_ticket_modal.php"); ?>
<?php
}
}
?>
<?php include("footer.php");