<?php
	include('views/_header.tpl.php');
?>

<style>
	body { background:#f9f9f9; }
	.spacer { padding-top:45px; }
	#mmen { display:none; }
    .form-profile { padding:20px; }
    table { background:#fff; }
    p, td { font-weight:200; }
    table td { padding: 5px; } 
    
	.admintable td,
	.admintable th {
		padding: 10px;
		border: solid #eee 1px;
		text-align: center;
		font-size:17px;
	}
	
	.btn,
	.btn a,
	.btn a:active,
	.btn a:visited {
		background:#aaa; 
		color:#fff;
		border-radius: 50px;
		-moz-border-radius: 50px;
		-webkit-border-radius: 50px;
		font-size: 14px !important;
		font-weight: 300 !important;
		height: 30px !important;
		line-height: 30px !important;
		min-width: 60px;
		width:auto;
		padding: 5px 20px !important;
	}

	a.btn:hover {
		background:#006ab7;
	}	
	
	input.btn-small { 
		background:#aaa; 
		color:#fff;
		border-radius: 50px;
		-moz-border-radius: 50px;
		-webkit-border-radius: 50px;
		font-size: 12px !important;
		font-weight: 300 !important;
		height: 30px !important;
		min-width: 60px;
		width:auto;
		padding:0 15px;
	 }
	input.btn-small:hover { 
		background:#bbb;
	}
	
	input[type="submit"], .submit { border:0px; }
	input[type="submit"]:hover { background:#006ab7; }
	
	/* label, select, button, input[type="button"], input[type="reset"], input[type="submit"], input[type="radio"], input[type="checkbox"]	*/

	.btn-red {
		font-size: 14px; 
		border-radius: 50px;
		-moz-border-radius: 50px;
		-webkit-border-radius: 50px;
	}

	.btn-blue {
		background: #005493;
		border-radius: 50px;
		-moz-border-radius: 50px;
		-webkit-border-radius: 50px;
	}
	
	.delete-admin {
		background: #cd1000;
	}

	.adminred {
		background: #cd1000;
		color: #fff;
	}

	.nonadmin {
		background: #ddd;
		color: #aaa;
	}

	.pagination {
		list-style-type: none;
		padding: 10px 0;
		display: inline-flex;
		justify-content: space-between;
		box-sizing: border-box;
	}

	.pagination li {
		box-sizing: border-box;
		padding-right: 10px;
	}

	.pagination li a {
		box-sizing: border-box;
		background-color: #e2e6e6;
		padding: 8px;
		text-decoration: none;
		font-size: 12px;
		font-weight: bold;
		color: #616872;
		background: #005493;
		border-radius: 4px;
		-moz-border-radius: 4px;
		-webkit-border-radius: 4px;		
	}

	.pagination li a:hover {
		background-color: #d4dada;
	}

	.pagination .next a,
	.pagination .prev a {
		text-transform: uppercase;
		font-size: 12px;
	}

	.pagination .currentpage a {
		background-color: #518acb;
		color: #fff;
	}

	.pagination .currentpage a:hover {
		background-color: #518acb;
	}

	.searching {
		display: flex;
		flex-direction: row;
		margin: 10px 0px;
		justify-content: start;
		gap: 10px;
		align-items: center;
	}

	.search {
		padding: 10px;
	}

	.submit {
		background-color: #005493;
	}
	.ut-header{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}	
	
	.blockit, .blockithalf, .blockitlabel { float:left; display:inline-block; width: 200px; padding-right:10px; }
	.viewall { margin-left:15px; }
	
	a.lilbtn {
		background: #eee; 
		padding:4px 10px;
		border-radius: 50px;
		-moz-border-radius: 50px;
		-webkit-border-radius: 50px;		
		min-width:70px !important;
		width:70px !important;
	}
	
/* ######################################################### */
/*                        MOBILE STYLES                      */
/* ######################################################### */

/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) {
        .form-profile {
            padding: 20px 0px;
            width: 85%;
        }        
}

/* Landscape phone to portrait tablet */
@media (max-width: 767px) {

}

/* Landscape phones and down */
@media (max-width: 586px) {
	.spacer { padding-top:55px; }
	.form-profile { padding-top:0px; }	
	.tablescroll { height: 500px; overflow-x:scroll; }
	.blockit { width:100%; display:block; background:none;  text-align:center; margin-bottom:10px; }
	.blockithalf { float:left; width:50%; display:inline-block; background:none; text-align:center; margin-bottom:10px; 
	-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }	
	.right { padding-right:0px; }
	.viewall { margin-left:0px; }
}

/* Landscape phones and down */
@media (max-width: 480px) {
	.spacer { padding-top:15px; }
	.form-profile { padding-top:0px; }
	.tablescroll { height: 500px; overflow-x:scroll; }
	.blockit { width:100%; display:block; background:none; text-align:center; margin-bottom:10px; }	
	.blockithalf { float:left; width:50%; display:inline-block; background:none; text-align:center; margin-bottom:10px; 
	-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
	.right { padding-right:0px; }
	.viewall { margin-left:0px; }
}    

@media (max-width: 320px) {
	.tablescroll { height: 300px; overflow-x:scroll; }
}    
</style>

<!-- ########################## -->
<!--   MANAGE SUPPORT TICKETS   -->
<!-- ########################## -->

<div class="form form-profile aif" style='width:auto'>

	<h1 style="text-align:center;">
		<a href="/admin/dash"><i class="fa fa-sliders" aria-hidden="true" style=""></i></a>&nbsp; Support Tickets
		<a href="/admin/promocodes"><img src="/static/client/scroll_hands.png" style="height:30px;" alt="<>" /></a>		
	</h1>

	<!--<div class="tab-pane accordion-content<?= $active_tickets ?>" style="padding:10px;">-->
	<div class="tablescroll" style="background:#fff;">

		<table class="admintable" style="margin:0px; width:98%;">
			<tr>
				<th width="50" style="text-align: left;">TID#</th>
				<th width="100" style="text-align: left;">Client/Project</th>
				<th width="150" style="text-align: left;">Full Name</th>
				<th width="150" style="text-align: center;">Related To</th>
				<th width="100">Date</th>
				<th width="100">Status</th>
				<!--<th width="50">Image</th>-->
				<th width="150">Actions</th>
			</tr>

			<?php
			foreach ($tickets as $sub) {
				if ($sub['is_verified'] == "0") {
					$test_style = "#999999";
					$verified_text = "New Ticket";
					$status_style = "background:#999999;";
				} else if ($sub['is_verified'] == "1") {
					$test_style = "#dd1000";
					$verified_text = "In Process";
					$status_style = "background:#cd1000;";
				} else {
					$test_style = "#00c000"; // 00b600
					$verified_text = "Resolved";
					$status_style = "background:#00c000;";
				}
				$pretty_date = date("h:iA m/d/Y",strtotime($sub['timestamp_posted']));
				if (empty($sub['employer_school'])) {
					$clientproject = "Not Provided";
				} else {
					$clientproject = $sub['employer_school'];
				}
				// IMG https://ihp.sqdash.co/api/webservices/api/{$sub['main_img']}
				echo "<tr>
						<td style='padding:10px; max-width:50px; overflow:hidden;'>{$sub['id']}</td>
						<td style='padding:10px; max-width:150px; overflow:hidden;'>{$clientproject}</td>
						<td style='padding:10px; max-width:150px; overflow:hidden;'>{$sub['first_name']} {$sub['last_name']}</td>
						<td style='padding:10px; text-align:center;'>{$sub['vaccine_type']}</td>
						<td style='padding:10px; text-align:center;'>{$pretty_date}</td>
						<td style='padding:10px; text-align:center; color:#fff; {$status_style}'>{$verified_text}</td>

						<td style='display:none; padding:10px; text-align:center;'><img src='/static/images/placeholder.jpg' alt='Support Ticket Img'
						style='height:50px; width:auto;' /></td>

						<td style='padding:10px; text-align:center;'>
							<a href='/admin/?ticket&edit={$sub['id']}' class='lilbtn' style='font-size:15px; width:70px !important'>edit ticket</a> 
							<a href='/admin/?ticket&del={$sub['id']}' class='confirm lilbtn' style='font-size:15px;'><img src='/static/images/icons/delete_icon.png' alt='Delete!' style='height:15px; width:15px'> delete</a>
						</td>
					</tr>";
			}
			?>
		</table>

		<div style="margin:10px;">
			<a href='/admin/?ticket&add' class="btn btn-blue">+ Add New Ticket &raquo;</a>
		</div>

	</div><!--end: .tab-pane (Support Tickets) -->
	<br /><br /><br /><br /><br /><br />
	
</div><!-- SUPPORT TICKETS TAB ENDS HERE --> 

<style>
	.admintable td,
	.admintable th {
		padding: 3px;
		border: solid #eee 1px;
	}
</style>

<?php
	include 'views/_footer.tpl.php';
?>