<?php
$data = $sites[0];
$siteid = $data['siteid'];
$accountname = $data['accountname'];
$sitename = $data['sitename'];
$marketing = $data['marketing'];
$initial = $data['initial'];
if ($initial != null) {
	$initial = "(" . $initial . ")";
} else {
	$initial = "";
}
$createdate = date('d-m-Y', strtotime($data['createdate']));
$data_log = $sites_log;
?>
<div class="modal-header">
	<h4 class="modal-title" id="tooltipmodel">Site Detail</h4>
	<button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
	<div class='row'>
		<div class='col-3'>Site ID</div>	<div class='col-9'>: <?=$siteid;?></div>
	</div>
	<div class='row'>
		<div class='col-3'>Account Name</div> <div class='col-9'>: <?=$accountname;?> <?=$initial;?></div>
	</div>
	<div class='row'>
		<div class='col-3'>Site Name</div> <div class='col-9'>: <?=$sitename;?></div>
	</div>
	<div class='row'>
		<div class='col-3'>Marketing</div> <div class='col-9'>: <?=$marketing;?></div>
	</div>
	<div class='row'>
		<div class='col-3'>Create Date</div> <div class='col-9'>: <?=$createdate;?></div>
	</div>
</div>
<div class="modal-header">
	<h4 class="modal-title" id="tooltipmodel">History</h4>
</div>
<div class="modal-body">
	<div class="table-responsive">
		<table class="table display table-striped border">
			<thead>
				<tr> <th>Marketing</th> <th>Start Date</th> <th>End Date</th> <th>Action</th> </tr>
			</thead>
			<tbody>
				<?php foreach($sites_log as $data) { $sitelogid=$data['sitelogid'];?>
					<tr> 
						<td><?=$data['user'];?></td> <td><?=$data['userstartdate'];?></td> <td><?=$data['userenddate'];?></td> 
						<td><a class='btn btn-warning btn-sm' href='sites/log/edit/<?=$sitelogid;?>' 
								onclick="window.open(this.href, 'Site Log Editor','width=900,height=600,toolbar=1,resizable=0'); return false;">
								<i class="fas fa-pencil-alt"></i> Edit
							</a>
							<a class='btn btn-danger btn-sm' href='sites/log/delete/<?=$sitelogid;?>' onclick="return confirm('Are you sure?')" > <i class="fas fa-trash-alt"></i> Delete </a></td> 
					</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
</div>
<div class="modal-footer">
	<button type="button" class="btn btn-info waves-effect text-white" data-bs-dismiss="modal">Close</button>
</div>

