ESH/communication_details_dashboard_card.php
2024-10-23 18:28:06 +05:30

69 lines
2.7 KiB
PHP

<table class="table m-0">
<thead >
<tr style="color:black;">
<th style="background-color:white" width="5%"><strong>Sr.</strong></th>
<th style="background-color:white" width="65%"><strong>Details</strong></th>
<th style="background-color:white" width="5%"><strong>Status</strong></th>
<th style="background-color:white" width="255%"><strong>Remarks</strong></th>
</tr>
</thead>
<tbody>
<?php
date_default_timezone_set('Asia/Kolkata');
$current_date= date('Y-m-d');
$sql="select cd.*,DATE(comm_date),c.com_item from communication c left join communication_details cd on c.communication_id = cd.communication_id WHERE comm_date LIKE '$current_date%' ;";
$result = @mysqli_query($conn,$sql);
$total = mysqli_num_rows($result);
$i=1;
$current_date = date("Y-m-d H:i:s");
$timestamp1 = strtotime($current_date);
if($total != 0 ){
while($row=@mysqli_fetch_array($result)){
$timestamp2 = strtotime($row['comm_date']);
$tim_diff = round(($timestamp1-$timestamp2)/3600,1);
if($tim_diff<=24){
?>
<tr>
<td><?php echo $i++;?></td>
<td><b><?php echo mb_strimwidth($row['com_item'].' ', 0, 70, '...'); ?></b></td>
<td>
<?php if($row['status'] == 1){ ?> <span class="badge badge-info" style="padding-top:4px">YES</span><?php } else { ?><span class="badge badge-gray" style="padding-top:4px">NO</span> <?php } ?>
</td>
<td><?php echo ($row['details'] == '')?("None"):($row['details'])?></td>
</tr>
<?php
if($i>9){
break;
}
}
}
}else{
$sql="select * from communication c ORDER BY communication_id ;";
$result = @mysqli_query($conn,$sql);
$i=1;
while($row=@mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $i++;?></td>
<td><b><?php echo mb_strimwidth($row['com_item'].' ', 0, 70, '...'); ?></b></td>
<td><?php if($row['status'] == 1){ ?> <span class="badge badge-info" style="padding-top:4px">YES</span><?php } else { ?><span class="badge badge-gray" style="padding-top:4px">NO</span> <?php } ?></td>
<td><?php echo ($row['details'] == '')?("None"):($row['details'])?></td>
</tr>
<?php
if($i>8){
break;
}
}
}
?>
</tbody>
</table>
<!-- /.table-responsive -->
<!-- /.card-body -->
<!-- </div> -->