<div class="content">
<?php
// Account Opening Request
$request_sql = "SELECT COUNT(*) as total_request FROM `account_info` WHERE `status` IS NULL";
$request_sql_result = $conn->query($request_sql);
$request_row = $request_sql_result->fetch_assoc();
$total_request_pending = $request_row['total_request'];
// Account Opened but not informed
$open_notInform_sql = "SELECT COUNT(*) as total_opened FROM `account_info` WHERE `status` = 'Approved' AND `inform` IS NULL";
$open_notInform_sql_result = $conn->query($open_notInform_sql);
$open_notInform_row = $open_notInform_sql_result->fetch_assoc();
$total_open_notInform = $open_notInform_row['total_opened'];
// Account Opened but not informed
$completed_sql = "SELECT COUNT(*) as total_completed FROM `account_info` WHERE `inform` = 'yes'";
$completed_sql_result = $conn->query($completed_sql);
$completed_row = $completed_sql_result->fetch_assoc();
$total_completed = $completed_row['total_completed'];
?>
<h1>Dashboard Overview</h1>
<div class="d-flex justify-content-start">
<div class="">
<div class="card" id="requestCard">
<div class="card-body d-flex justify-content-around align-items-center">
<div class="left">
<p class="card-focus"><?= $total_request_pending; ?></p>
<p class="card-title">Account Request</p>
<p class="card-subtitle text-info">(Not Opened)</p>
</div>
<div class="right">
<img src="icon/request.png" alt="">
</div>
</div>
</div>
</div>
<div class="">
<div class="card" id="openedCard">
<div class="card-body d-flex justify-content-around align-items-center">
<div class="left">
<p class="card-focus"><?= $total_open_notInform; ?></p>
<p class="card-title">Account Opened</p>
<p class="card-subtitle text-primary">(Not Informed)</p>
</div>
<div class="right">
<img src="icon/add-account.png" alt="">
</div>
</div>
</div>
</div>
<div class="">
<div class="card" id="completedCard">
<div class="card-body d-flex justify-content-around align-items-center">
<div class="left">
<p class="card-focus"><?= $total_completed; ?></p>
<p class="card-title">Completed Account</p>
<p class="card-subtitle text-success">(Informed)</p>
</div>
<div class="right">
<img src="icon/completed-task.png" alt="">
</div>
</div>
</div>
</div>
</div>
<div class="user-table" id="requestTable">
<div class="table-container">
<h3>Account Request List</h3>
<table id="table0" class="celled table table-hover table-striped table-bordered dt-responsive" style="width:100%">
<thead class="">
<tr>
<th>SL</th>
<th>Applicant Name</th>
<th>Father Name</th>
<th>Mother Name</th>
<th>Date Of Birth</th>
<th>Status</th>
<th>Informed</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$results = $conn->query("SELECT * FROM `account_info` WHERE `status` IS NULL ORDER BY `id` ASC");
$sl = 1;
while ($rows = $results->fetch_assoc()) {
?>
<tr>
<td><?= $sl; ?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['father_name']; ?></td>
<td><?php echo $rows['mother_name']; ?></td>
<td><?php echo $rows['dob']; ?></td>
<td class="text-center"><?php echo $rows['status']; ?></td>
<td class="text-center"><?php echo $rows['inform']; ?></td>
<td class="text-center"><?php if (!empty($rows['inform'])) { ?>
<a href="account_details_show.php?id=<?php echo $rows['id']; ?>"
target="_blank"><input type="submit" class="btn btn-success" value="View"
name="view_details" id="view_details"></a>
<?php } else { ?>
<a href="account_details.php?id=<?php echo $rows['id']; ?>"
target="_blank"><input type="submit" class="btn btn-primary" value="Open"
name="acc_details" id="acc_details"></a>
<!-- <form action="" method="post">
<input type="hidden" name="row_id" value="<?php echo $rows['id']; ?>">
<input type="submit" class="btn btn-info" value="Open"
name="acc_details" id="acc_details"></a>
</form> -->
<?php } ?>
</td>
</tr>
<?php $sl++;
} ?>
</tbody>
</table>
</div>
</div>
<div class="user-table" id="openedTable">
<div class="table-container">
<h3>Account Opened List</h3>
<table id="table1" class="celled table table-hover table-striped table-bordered dt-responsive" style="width:100%">
<thead class="">
<tr>
<th>SL</th>
<th>Applicant Name</th>
<th>Father Name</th>
<th>Mother Name</th>
<th>Date Of Birth</th>
<th>Status</th>
<th>Informed</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$result = $conn->query("SELECT * FROM `account_info` WHERE `status` = 'Approved' AND `inform` IS NULL ORDER BY `id` ASC");
$sl = 1;
while ($rows = $result->fetch_assoc()) {
?>
<tr>
<td><?= $sl; ?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['father_name']; ?></td>
<td><?php echo $rows['mother_name']; ?></td>
<td><?php echo $rows['dob']; ?></td>
<td class="text-center"><?php echo $rows['status']; ?></td>
<td class="text-center"><?php echo $rows['inform']; ?></td>
<td class="text-center"><?php if (!empty($rows['inform'])) { ?>
<a href="account_details_show.php?id=<?php echo $rows['id']; ?>"
target="_blank"><input type="submit" class="btn btn-success" value="View"
name="acc_details_show" id="acc_details_show"></a>
<?php } else { ?>
<form action="" method="post">
<input type="hidden" name="row_id" value="<?php echo $rows['id']; ?>">
<input type="submit" class="btn btn-primary" value="Inform"
name="acc_details" id="inform_details"></a>
</form>
<!-- <a href="account_details.php?id=<?php echo $rows['id']; ?>"
target="_blank"><input type="submit" class="btn btn-primary" value="Inform"
name="account_details" id="inform_details"></a> -->
<?php } ?>
</td>
</tr>
<?php $sl++;
} ?>
</tbody>
</table>
</div>
</div>
<div class="user-table" id="completedTable">
<div class="table-container mt-4">
<h3>Account Completed List</h3>
<table id="table2" class="celled table table-hover table-striped table-bordered dt-responsive" style="width:100%">
<thead class="">
<tr>
<th rowspan="2">Sl</th>
<th rowspan="2">Applicant Name</th>
<th rowspan="2">Father Name</th>
<th rowspan="2">Mother Name</th>
<th rowspan="2">Date Of Birth</th>
<th rowspan="2">Status</th>
<th colspan="2">Verified</th>
<th rowspan="2">Informed</th>
<th rowspan="2">Details</th>
</tr>
<tr>
<th>Nid</th>
<th>Face</th>
</tr>
</thead>
<tbody>
<?php
$result = $conn->query("SELECT * FROM `account_info` WHERE `inform` = 'yes' ORDER BY `id` ASC");
$sl = 1;
while ($rows = $result->fetch_assoc()) {
?>
<tr>
<td><?= $sl; ?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['father_name']; ?></td>
<td><?php echo $rows['mother_name']; ?></td>
<td><?php echo $rows['dob']; ?></td>
<td class="text-center"><?php echo $rows['status']; ?></td>
<td class="text-center"><?php echo $rows['nid_verified']; ?></td>
<td class="text-center"><?php echo $rows['face_verified']; ?></td>
<td class="text-center"><?php echo $rows['inform']; ?></td>
<td class="text-center"><?php if (!empty($rows['inform'])) { ?>
<form action="" method="post">
<input type="hidden" name="row_id" value="<?php echo $rows['id']; ?>">
<input type="submit" class="btn btn-success" value="View"
name="view_details" id="view_details"></a>
</form>
<?php } else { ?>
<a href="account_details.php?id=<?php echo $rows['id']; ?>"
target="_blank"><input type="submit" class="btn btn-primary" value="open"
name="acc_details" id="acc_details"></a>
<?php } ?>
</td>
</tr>
<?php $sl++;
} ?>
</tbody>
</table>
</div>
</div>
</div>