0% found this document useful (0 votes)
53 views33 pages

Cod

The document contains code for displaying pending health certificate requests on an admin page. It retrieves pending requests from a database, then displays the details of each request including name, age, nationality, appointment, and more in a table. Admins can then print certificates from this page.

Uploaded by

lashopee0211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views33 pages

Cod

The document contains code for displaying pending health certificate requests on an admin page. It retrieves pending requests from a database, then displays the details of each request including name, age, nationality, appointment, and more in a table. Admins can then print certificates from this page.

Uploaded by

lashopee0211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

print_old

<td><button type="button" class="btn btn-info print_old" id="<?= $id ?>" data-bs-


toggle="modal" data-bs-target="#or-stub-modal"><i class="mdi mdi-eye me-1"></i>
<span>PRINT</span> </button></td>

<?php
require '../config/config.php';
require CL_SESSION_PATH;
require CONNECT_PATH;
require DOMAIN_PATH . '/call_func/islogin.php';
require DOMAIN_PATH . '/call_func/global_func.php';
include DOMAIN_PATH . "/include/admin_link.php";

if (USER_ROLE != "admin") {
// header("Location: ".BASE_URL."admin_login/login.php");
include ERROR_401;
exit();
}

?>

<style>
.dropify-wrapper .dropify-message p {
margin: 5px 0 0 0;
font-size: 15px;
}
</style>

<body class="loading" data-layout-


config='{"leftSideBarTheme":"dark","layoutBoxed":false,
"leftSidebarCondensed":false, "leftSidebarScrollable":false,"darkMode":false,
"showRightSidebarOnStart": true}'>
<!-- Begin page -->
<div class="wrapper">
<!-- ========== Left Sidebar Start ========== -->
<?php
include DOMAIN_PATH . "/include/admin_sidebar.php";
?>
<!-- Left Sidebar End -->

<!-- ============================================================== -->


<!-- Start Page Content here -->
<!-- ============================================================== -->

<div class="content-page">
<div class="content">
<!-- Topbar Start -->
<?php
include DOMAIN_PATH . "/include/admin_top.php";
?>

<!-- end Topbar -->

<!-- Start Content-->


<div class="container-fluid">

<!-- start page title -->


<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=
BASE_URL ?>admin-page/index.php">Home</a></li>
<li class="breadcrumb-item active">Health
Transaction</li>
</ol>
</div>
<h4 class="page-title">Health Transaction</h4>
</div>
</div>
</div>
<!-- end page title -->

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<!-- Transac Process Steps -->
<ul class="nav nav-pills bg-nav-pills nav-
justified mb-3">

<li class="nav-item">
<a href="#processing-information" data-
bs-toggle="tab" aria-expanded="false" class="nav-link rounded-0 active">
<i class="mdi mdi-account-circle
font-18"></i>
<span class="d-none d-lg-
block">Pending Certificate</span>
</a>
</li>
<li class="nav-item">
<a href="#print-information" data-bs-
toggle="tab" aria-expanded="false" class="nav-link rounded-0">
<i class="mdi mdi-cash-multiple
font-18"></i>
<span class="d-none d-lg-
block">Print Certificate</span>
</a>
</li>
<li class="nav-item">
<a href="#health-certificate-record-
information" data-bs-toggle="tab" aria-expanded="false" class="nav-link rounded-0">
<i class="mdi mdi-cash-multiple
font-18"></i>
<span class="d-none d-lg-
block">Health Certificate Record</span>
</a>
</li>
</ul>

<div class="tab-content">
<div class="tab-pane show active"
id="processing-information">

<div class="table-responsive">
<table class="table table-centered
w-100 dt-responsive nowrap" id="customer_order_table">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Status</th>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Nationality</th>
<th>Work Type</th>
<th>Appointment</th>
<th style="width:
125px;">Remark</th>
</tr>
</thead>
<tbody>
<?php

date_default_timezone_set('Asia/Manila');
$created_date = date("F d,
Y");
$current_time = date("h:i:s
A");
$sel_health_cert_pending =
"SELECT * FROM health_request WHERE status = 'pending'";
$health_cert_pending_query
= mysqli_query($db_connect, $sel_health_cert_pending);
$type_work_array = array();
// Array to store type_work entries
if
($health_cert_pending_query) {
if
(mysqli_num_rows($health_cert_pending_query) > 0) {
while ($row_record
= mysqli_fetch_array($health_cert_pending_query)) {
$id = !
empty($row_record['id']) ? trim($row_record['id']) : '';
$no_id = !
empty($row_record['no_id']) ? trim($row_record['no_id']) : 'Awaiting Transaction';

$transaction_number = !empty($row_record['transaction_number']) ?
trim($row_record['transaction_number']) : 'Awaiting Transaction';

$reference_number = !empty($row_record['reference_number']) ?
trim($row_record['reference_number']) : 'Awaiting Transaction';
$name = !
empty($row_record['name']) ? trim($row_record['name']) : '';
$age = !
empty($row_record['age']) ? trim($row_record['age']) : '';
$sex = !
empty($row_record['sex']) ? trim($row_record['sex']) : '';
$date_expired =
!empty($row_record['date_expired']) ? trim($row_record['date_expired']) : '';
$nationality
= !empty($row_record['nationality']) ? trim($row_record['nationality']) : '';
$type_work = !
empty($row_record['type_work']) ? trim($row_record['type_work']) : '';
$start_time = !
empty($row_record['start_time']) ? trim($row_record['start_time']) : '';
$payment = !
empty($row_record['payment']) ? trim($row_record['payment']) : '';
$end_time = !
empty($row_record['end_time']) ? trim($row_record['end_time']) : '';
$time_end =
date("h:i:s A", strtotime($end_time));
$time_start =
date("h:i:s A", strtotime($start_time));

$appointment_format = date("F d, Y", strtotime($start_time)) . " / " .


$time_start . " to " . $time_end;
$status = !
empty($row_record['status']) ? trim($row_record['status']) : '';
$remarks = !
empty($row_record['remarks']) ? trim($row_record['remarks']) : '';
$date_issued
= !empty($row_record['date_issued']) ? trim($row_record['date_issued']) : 'Awaiting
Transaction';
$exp_id = !
empty($row_record['exp_id']) ? trim($row_record['exp_id']) : 'Awaiting
Transaction';

if
($created_date == date("F d, Y", strtotime($end_time)) and $created_date !=
$date_expired) {
if
((strtotime($current_time) >= strtotime($time_start) && strtotime($current_time) <=
strtotime($time_end))) {

$skipRow = false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);


if
(mysqli_num_rows($close_date_query) > 0) {

while ($row_close = mysqli_fetch_array($close_date_query)) {

$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';

if (strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=


strtotime($close_end)) {

$skipRow = true;

break; // No need to check further if we already need to skip the row

}
}
}
if (!
$skipRow) {
?>

<tr>

<td><button type="button" class="btn btn-info view_cert_button " id="<?= $id ?>"><i


class="mdi mdi-eye me-1"></i> <span>View Details</span> </button></td>

<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>

</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>

<td><?= $nationality ?></td>

<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>

<td><?= $remarks ?></td>

</tr>

<?
php }
} else {

$currentTime = date("F d, Y h:i:s A");

$isAppointmentActive = (strtotime($currentTime) < strtotime($end_time));

if
($isAppointmentActive) {

$skipRow = false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);

if
(mysqli_num_rows($close_date_query) > 0) {

while ($row_close = mysqli_fetch_array($close_date_query)) {


$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';

if (strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=


strtotime($close_end)) {

$skipRow = true;

break; // No need to check further if we already need to skip the row

}
}

if
(!$skipRow) {

?>

<tr>

<td>

<button type="button" class="btn btn-info view_cert_button disabled" id="<?= $id ?


>">

<i class="mdi mdi-eye me-1"></i> <span>View Details</span>

</button>

</td>

<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;">

<?= $status ?>

</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>

<td><?= $nationality ?></td>

<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>


<td><?= $remarks ?></td>

</tr>

<?php
}
}
}
} else if
(date("F d, Y", strtotime($end_time)) >= $created_date) {

$skipRow =
false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);


if
(mysqli_num_rows($close_date_query) > 0) {
while
($row_close = mysqli_fetch_array($close_date_query)) {

$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';


if
(strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=
strtotime($close_end)) {

$skipRow = true;

break; // No need to check further if we already need to skip the row


}
}
}
if (!
$skipRow) {

?>
<tr>

<td><button type="button" class="btn btn-info view_cert_button disabled" id="<?=


$id ?>"><i class="mdi mdi-eye me-1"></i> <span>View Details</span> </button></td>

<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>

</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>


<td><?= $nationality ?></td>

<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>

<td><?= $remarks ?></td>


</tr>
<?php }
}
}
}
}

?>
</tbody>
</table>
</div>

</div>

<div class="tab-pane " id="print-


information">

<div class="row">
<div class="col-sm-12 text-end mb-
2">
<button type="button"
class="btn btn-success" data-bs-toggle="modal" data-bs-target="#payment-stub-
modal"> <i class="mdi mdi-cash-multiple "></i><span class="mx-1">PAYMENT
STUB</span></button>
</div>
</div>

<div class="table-responsive">
<table class="table table-centered
w-100 dt-responsive nowrap" id="issue_cert_table">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Status</th>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Nationality</th>
<th>Work Type</th>
<th>Appointment</th>
<th style="width:
125px;">Remark</th>
</tr>
</thead>
<tbody>
<?php

date_default_timezone_set('Asia/Manila');
$created_date = date("F d,
Y");
$current_time = date("h:i:s
A");
$sel_health_cert_pending =
"SELECT * FROM health_request WHERE status = 'Payment Pending'";
$health_cert_pending_query
= mysqli_query($db_connect, $sel_health_cert_pending);
$type_work_array = array();
// Array to store type_work entries
if
($health_cert_pending_query) {
if
(mysqli_num_rows($health_cert_pending_query) > 0) {
while ($row_record
= mysqli_fetch_array($health_cert_pending_query)) {
$id = !
empty($row_record['id']) ? trim($row_record['id']) : '';
$no_id = !
empty($row_record['no_id']) ? trim($row_record['no_id']) : 'Awaiting Transaction';

$transaction_number = !empty($row_record['transaction_number']) ?
trim($row_record['transaction_number']) : 'Awaiting Transaction';

$reference_number = !empty($row_record['reference_number']) ?
trim($row_record['reference_number']) : 'Awaiting Transaction';
$name = !
empty($row_record['name']) ? trim($row_record['name']) : '';
$age = !
empty($row_record['age']) ? trim($row_record['age']) : '';
$sex = !
empty($row_record['sex']) ? trim($row_record['sex']) : '';
$date_expired =
!empty($row_record['date_expired']) ? trim($row_record['date_expired']) : '';
$nationality
= !empty($row_record['nationality']) ? trim($row_record['nationality']) : '';
$type_work = !
empty($row_record['type_work']) ? trim($row_record['type_work']) : '';
$start_time = !
empty($row_record['start_time']) ? trim($row_record['start_time']) : '';
$payment = !
empty($row_record['payment']) ? trim($row_record['payment']) : '';
$end_time = !
empty($row_record['end_time']) ? trim($row_record['end_time']) : '';
$time_end =
date("h:i:s A", strtotime($end_time));
$time_start =
date("h:i:s A", strtotime($start_time));

$appointment_format = date("F d, Y", strtotime($start_time)) . " / " .


$time_start . " to " . $time_end;
$status = !
empty($row_record['status']) ? trim($row_record['status']) : '';
$remarks = !
empty($row_record['remarks']) ? trim($row_record['remarks']) : '';
$date_issued
= !empty($row_record['date_issued']) ? trim($row_record['date_issued']) : 'Awaiting
Transaction';
$exp_id = !
empty($row_record['exp_id']) ? trim($row_record['exp_id']) : 'Awaiting
Transaction';
if
($created_date == date("F d, Y", strtotime($end_time)) and $created_date !=
$date_expired) {
if
((strtotime($current_time) >= strtotime($time_start) && strtotime($current_time) <=
strtotime($time_end))) {

$skipRow = false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);


if
(mysqli_num_rows($close_date_query) > 0) {

while ($row_close = mysqli_fetch_array($close_date_query)) {

$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';

if (strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=


strtotime($close_end)) {

$skipRow = true;

break; // No need to check further if we already need to skip the row

}
}
}
if (!
$skipRow) {
?>

<tr>

<td><button type="button" class="btn btn-info" id="<?= $id ?>" data-bs-


toggle="modal" data-bs-target="#or-stub-modal"><i class="mdi mdi-eye me-1"></i>
<span>VIEW</span> </button></td>

<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>

</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>

<td><?= $nationality ?></td>


<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>

<td><?= $remarks ?></td>

</tr>

<?
php }
} else {

$currentTime = date("F d, Y h:i:s A");

$isAppointmentExpired = (strtotime($currentTime) > date("F d, Y h:i:s A",


strtotime($end_time)));
if
($isAppointmentExpired) {

$skipRow = false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);


if
(mysqli_num_rows($close_date_query) > 0) {

while ($row_close = mysqli_fetch_array($close_date_query)) {

$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';

if (strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=


strtotime($close_end)) {

$skipRow = true;

continue; // No need to check further if we already need to skip the row

}
}
if
(!$skipRow) {

?>

<tr>

<td><button type="button" class="btn btn-info view_cert_button disabled" id="<?=


$id ?>"><i class="mdi mdi-eye me-1"></i> <span>View Details</span> </button></td>

<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>


</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>

<td><?= $nationality ?></td>

<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>

<td><?= $remarks ?></td>

</tr>
<?php }
}
}
} else if
(date("F d, Y", strtotime($end_time)) >= $created_date) {
$skipRow =
false;

$sel_close_date = "SELECT * FROM close_date";

$close_date_query = mysqli_query($db_connect, $sel_close_date);


if
(mysqli_num_rows($close_date_query) > 0) {
while
($row_close = mysqli_fetch_array($close_date_query)) {

$close_start = !empty($row_close['close_start']) ?
trim($row_close['close_start']) : '';

$close_end = !empty($row_close['close_end']) ? trim($row_close['close_end']) : '';


if
(strtotime($start_time) >= strtotime($close_start) && strtotime($end_time) <=
strtotime($close_end)) {

$skipRow = true;

continue; // No need to check further if we already need to skip the row


}
}
}
if (!
$skipRow) {

?>
<tr>

<td><button type="button" class="btn btn-info view_cert_button disabled" id="<?=


$id ?>"><i class="mdi mdi-eye me-1"></i> <span>View Details</span> </button></td>
<td>

<span class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>

</span>

</td>

<td><?= ucfirst($name) ?></td>

<td><?= $age ?></td>

<td><?= $sex ?></td>

<td><?= $nationality ?></td>

<td><?= $type_work ?></td>

<td><?= $start_time . " to " . $end_time ?></td>

<td><?= $remarks ?></td>


</tr>
<?php }
}
}
}
}

?>
</tbody>
</table>
</div>
</div>
<div class="tab-pane " id="health-
certificate-record-information">

<div class="row">
<div class="col-12 m-2 text-end pe-
4">
<!-- <button class="btn btn-
info fw-bold" data-bs-toggle="modal" data-bs-target="#old_health_cert_modal">OLD
Health Certificate ID</button> -->
<!--<a href="<?= BASE_URL ?
>admin-page/old_health_certificate_report.php" class="btn btn-info fw-bold">Print
Old Health Certificate ID</a>-->
</div>
</div>

<div class="table-responsive">
<table class="table table-centered
w-100 dt-responsive nowrap" id="health_cert_record_table">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Status</th>
<th>Prepared By</th>
<th>No. ID</th>
<th>Reference No.</th>
<th>Transaction
No.</th>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Nationality</th>
<th>Work Type</th>
<th>Remark</th>
</tr>
</thead>
<tbody>
<?php
$sel_health_cert_pending =
"SELECT * FROM health_request WHERE status = 'completed'";
$health_cert_pending_query
= mysqli_query($db_connect, $sel_health_cert_pending);
if
($health_cert_pending_query) {
if
(mysqli_num_rows($health_cert_pending_query) > 0) {
while ($row_pending
= mysqli_fetch_array($health_cert_pending_query)) {
$id = !
empty($row_pending['id']) ? trim($row_pending['id']) : '';
$creator_by = !
empty($row_pending['creator']) ? trim($row_pending['creator']) : '';

$no_id = !
empty($row_pending['no_id']) ? trim($row_pending['no_id']) : '';

$transaction_number = !empty($row_pending['transaction_number']) ?
trim($row_pending['transaction_number']) : '';

$reference_number = !empty($row_pending['reference_number']) ?
trim($row_pending['reference_number']) : '';

$name = !
empty($row_pending['name']) ? trim($row_pending['name']) : '';
$age = !
empty($row_pending['age']) ? trim($row_pending['age']) : '';
$sex = !
empty($row_pending['sex']) ? trim($row_pending['sex']) : '';
$nationality
= !empty($row_pending['nationality']) ? trim($row_pending['nationality']) : '';
$type_work = !
empty($row_pending['type_work']) ? trim($row_pending['type_work']) : '';
$start_time = !
empty($row_pending['start_time']) ? trim($row_pending['start_time']) : '';
$end_time = !
empty($row_pending['end_time']) ? trim($row_pending['end_time']) : '';
$status = !
empty($row_pending['status']) ? trim($row_pending['status']) : '';
$remarks = !
empty($row_pending['remarks']) ? trim($row_pending['remarks']) : '';
$date_issued
= !empty($row_pending['date_issued']) ? trim($row_pending['date_issued']) : '';
$date_expired =
!empty($row_pending['date_expired']) ? trim($row_pending['date_expired']) : '';
$created_date =
date("F d, Y");
?>
<tr>

<?php
if
(strtotime($created_date) < strtotime($date_expired)) {
?>
<td>

<button type="button" class="btn btn-info view_cert_record_button" id="<?= $id ?


>"><i class="mdi mdi-eye me-1"></i> <span>VIEW</span> </button>

<button type="button" class="btn btn-success certificate_print" id="<?= $id ?>"><i


class="mdi mdi-eye me-1"></i> <span>PRINT NEW</span> </button>

<button type="button" class="btn btn-secondary print_old" id="<?= $id ?>"><i


class="mdi mdi-eye me-1"></i> <span>PRINT OLD</span> </button>
</td>
<td>

<span class="badge badge-success-lighten" style="font-size: 15px;"> Health


Certificate Released

</span>
</td>
<?php }
if
(strtotime($created_date) >= strtotime($date_expired)) {
?>

<td></td>
<td>

<span class="badge badge-danger-lighten" style="font-size: 15px;"> Expired Date

</span>
</td>
<?php } ?>
<td class="
fw-bold"><?= mb_strtoupper($creator_by) ?></td>
<td
class="text-danger fw-bold"><?= $no_id ?></td>
<td
class="text-danger fw-bold"><?= $reference_number ?></td>
<td
class="text-danger fw-bold"><?= $transaction_number ?></td>
<td><?=
ucfirst($name) ?></td>
<td><?=
$age ?></td>
<td><?=
$sex ?></td>
<td><?=
$nationality ?></td>
<td><?=
$type_work ?></td>
<?php
if
($created_date < $date_expired) {
?>

<td>
The
Health Certificate ID will remain valid until <?= $date_expired ?>.
</td>
<?php }
if
($created_date >= $date_expired) {
?>

<td>

Today, the Health Certificate ID expires on <?= $date_expired ?>.


</td>
<?php } ?>

</tr>
<?php }
}
}

?>
</tbody>
</table>
</div>

</div>

</div>

</div> <!-- end card-body-->


</div> <!-- end card-->
</div> <!-- end col -->
</div>
<!-- end row -->

<!-- View -->


<div id="view_cert_modal" class="modal fade" tabindex="-1"
role="dialog" data-bs-backdrop="static" aria-labelledby="view_cert_modalLabel"
aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header modal-colored-header bg-
success">
<h4 class="modal-title"
id="view_cert_modalLabel">Health Certificate Information</h4>
<button type="button" class="btn-close" data-
bs-dismiss="modal" aria-hidden="true"></button>
</div>
<form id="view_cert_form">
<div id="view_cert_get">

</div>

</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- View -->


<div id="view_cert_record_modal" class="modal fade" tabindex="-
1" role="dialog" data-bs-backdrop="static" aria-
labelledby="view_cert_record_modalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header modal-colored-header bg-
success">
<h4 class="modal-title"
id="view_cert_record_modalLabel">Health Certificate Information</h4>
<button type="button" class="btn-close" data-
bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<div id="view_cert_record_get"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light"
data-bs-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- View -->


<div id="payment-stub-modal" class="modal fade" tabindex="-1"
role="dialog" data-bs-backdrop="static" aria-labelledby="payment-stub-modalLabel"
aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header modal-colored-header bg-
success">
<h4 class="modal-title" id="payment-stub-
modalLabel">Health Certificate | Payment Stub</h4>
<button type="button" class="btn-close" data-
bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table table-centered w-100
dt-responsive nowrap" id="payment_pending_exist_table">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Status</th>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Nationality</th>
<th>Work Type</th>
<th style="width:
125px;">Remark</th>
</tr>
</thead>
<tbody>
<?php
$sel_health_cert_pending = "SELECT
* FROM health_request WHERE status = 'Payment Pending' ";
$health_cert_pending_query =
mysqli_query($db_connect, $sel_health_cert_pending);
if ($health_cert_pending_query) {
if
(mysqli_num_rows($health_cert_pending_query) > 0) {
while ($row_pending =
mysqli_fetch_array($health_cert_pending_query)) {
$id = !
empty($row_pending['id']) ? trim($row_pending['id']) : '';

$no_id = !
empty($row_pending['no_id']) ? trim($row_pending['no_id']) : 'Awaiting
Transaction';
$transaction_number = !
empty($row_pending['transaction_number']) ?
trim($row_pending['transaction_number']) : 'Awaiting Transaction';
$reference_number = !
empty($row_pending['reference_number']) ? trim($row_pending['reference_number']) :
'Awaiting Transaction';

$name = !
empty($row_pending['name']) ? trim($row_pending['name']) : '';
$age = !
empty($row_pending['age']) ? trim($row_pending['age']) : '';
$sex = !
empty($row_pending['sex']) ? trim($row_pending['sex']) : '';
$nationality = !
empty($row_pending['nationality']) ? trim($row_pending['nationality']) : '';
$type_work = !
empty($row_pending['type_work']) ? trim($row_pending['type_work']) : '';
$start_time = !
empty($row_pending['start_time']) ? trim($row_pending['start_time']) : '';
$end_time = !
empty($row_pending['end_time']) ? trim($row_pending['end_time']) : '';
$status = !
empty($row_pending['status']) ? trim($row_pending['status']) : '';
$remarks = !
empty($row_pending['remarks']) ? trim($row_pending['remarks']) : '';
$date_issued = !
empty($row_pending['date_issued']) ? trim($row_pending['date_issued']) : '';

$created_date = date("F
d, Y");
if ($created_date <=
date("F d, Y", strtotime($end_time))) {
$created_time =
date("h:i:s A");
if ($created_date
>= date("h:i:s A", strtotime($end_time))) {
?>
<tr>
<td><a
type="button" class="btn btn-info" href="<?= BASE_URL
?>admin-page/health_certificate_transaction_payment.php?id=<?= base64_encode($id) ?
>"><i class="mdi mdi-eye me-1"></i> <span>PRINT</span> </a></td>
<td>
<span
class="badge badge-warning-lighten" style="font-size: 15px;"> <?= $status ?>
</span>

</td>
<td><?=
ucfirst($name) ?></td>
<td><?=
$age ?></td>
<td><?=
$sex ?></td>
<td><?=
$nationality ?></td>
<td><?=
$type_work ?></td>

<td><?=
$remarks ?></td>
</tr>
<?php }
}
}
}
}
?>
</tbody>
</table>
</div>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-light"
data-bs-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- or -->
<div id="or-stub-modal" class="modal fade"
tabindex="-1" role="dialog" data-bs-backdrop="static" aria-labelledby="payment-
stub-modalLabel" aria-hidden="true">
<div class="modal-dialog modal-l">
<div class="modal-content">
<div class="modal-header modal-colored-header bg-
success">
<h4 class="modal-title" id="or-stub-
modalLabel">Official Reciept Number | Payment Stub</h4>
<button type="button" class="btn-close" data-
bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<div class="col-lg-9 mb-9">
<label>Insert Official Reciept Number<b
class="text-danger">*</b></label>
<input type="number" name="orn" id="orn"
class="form-control" placeholder="Input Official Reciept Number">
<div class="text-danger"
id="orn_error"></div>
</div>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-light"
data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-info
print_old" id="<?= $id ?>" data-bs-toggle="modal" data-bs-target="#or-stub-
modal"><i class="mdi mdi-eye me-1"></i> <span>PRINT</span> </button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div id="old_health_cert_modal" class="modal fade" tabindex="-


1" role="dialog" aria-labelledby="old_health_cert_modalLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen">
<div class="modal-content">
<div class="modal-header modal-colored-header bg-
success">
<h4 class="modal-title"
id="old_health_cert_modalLabel">OLD Health Certificate ID</h4>
<button type="button" class="btn-close" data-
bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">

<div class="m-2">
<div class="table-responsive">
<table class="table table-centered w-
100 dt-responsive nowrap" id="old_health_table">
<thead class="table-light">
<tr>
<th>No. ID</th>
<th>Reference No.</th>
<th>Transaction No.</th>
<th>Work Type</th>
<th>Amount Paid</th>
<th>Payment Date</th>
<th>Appointment Date</th>
<th>Remark</th>
<th>Date Issued</th>
<th>Date Expired</th>
</tr>
</thead>
<tbody>
<?php

date_default_timezone_set('Asia/Manila');
$created_date = date("F d, Y");
$current_time = date("h:i:s
A");
$sel_health_cert_pending =
"SELECT * FROM health_request_expired WHERE user_id = '" .
string_escape($user_id) . "'";
$health_cert_pending_query =
mysqli_query($db_connect, $sel_health_cert_pending);
$type_work_array = array(); //
Array to store type_work entries
if ($health_cert_pending_query)
{
if
(mysqli_num_rows($health_cert_pending_query) > 0) {
while ($row_record =
mysqli_fetch_array($health_cert_pending_query)) {
$id = !
empty($row_record['id']) ? trim($row_record['id']) : '';
$no_id = !
empty($row_record['no_id']) ? trim($row_record['no_id']) : 'Awaiting Transaction';
$transaction_number
= !empty($row_record['transaction_number']) ?
trim($row_record['transaction_number']) : 'Awaiting Transaction';
$reference_number =
!empty($row_record['reference_number']) ? trim($row_record['reference_number']) :
'Awaiting Transaction';

$age = !
empty($row_record['age']) ? trim($row_record['age']) : '';
$sex = !
empty($row_record['sex']) ? trim($row_record['sex']) : '';
$date_expired = !
empty($row_record['date_expired']) ? trim($row_record['date_expired']) : '';
$nationality = !
empty($row_record['nationality']) ? trim($row_record['nationality']) : '';
$type_work = !
empty($row_record['type_work']) ? trim($row_record['type_work']) : '';
$start_time = !
empty($row_record['start_time']) ? trim($row_record['start_time']) : '';
$payment = !
empty($row_record['payment']) ? trim($row_record['payment']) : '';
$end_time = !
empty($row_record['end_time']) ? trim($row_record['end_time']) : '';
$time_end =
date("h:i:s A", strtotime($end_time));
$time_start =
date("h:i:s A", strtotime($start_time));

$appointment_format
= date("F d, Y", strtotime($start_time)) . " / " . $time_start . " to " .
$time_end;
$status = !
empty($row_record['status']) ? trim($row_record['status']) : '';
$remarks = !
empty($row_record['remarks']) ? trim($row_record['remarks']) : '';
$date_issued = !
empty($row_record['date_issued']) ? trim($row_record['date_issued']) : 'Awaiting
Transaction';
$exp_id = !
empty($row_record['exp_id']) ? trim($row_record['exp_id']) : 'Awaiting
Transaction';
?>
<tr>
<td
class="text-danger fw-bold"><?= $no_id ?></td>
<td
class="text-danger fw-bold"><?= $reference_number ?></td>
<td
class="text-danger fw-bold"><?= $transaction_number ?></td>
<td><?=
$type_work ?></td>
<td>&#8369;<?=
number_format((float)($payment), 2, '.', ',') ?></td>
<td><?= !
empty(date("F d, Y | h:i:s A", strtotime($date_issued))) ? trim($date_issued) :
'' ?></td>
<td><?=
$appointment_format ?></td>
<td>This date
was closed.</td>
<td><?=
$date_issued ?></td>
<td><?=
$date_expired ?></td>
</tr>

<?php }
}
}

?>
</tbody>
</table>
</div>

</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger"
data-bs-dismiss="modal">Close</button>
<!-- <button type="button" class="btn btn-
success">Save changes</button> -->
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

</div> <!-- container -->

</div> <!-- content -->

<!-- Footer Start -->


<?php
include DOMAIN_PATH . "/include/admin_footer.php";
?>
<!-- end Footer -->

</div>

<!-- ============================================================== -->


<!-- End Page content -->
<!-- ============================================================== -->

</div>
<!-- END wrapper -->

<!-- script and the end body and html tag start-->
<?php
include DOMAIN_PATH . "/include/admin_script.php";
include DOMAIN_PATH . "/global/admin_notification.php";
// include DOMAIN_PATH . "/global/admin_notification.php";
?>
<!-- script and the end body and html tag end-->

<script>
// Delete
$(document).ready(function() {
$(document).on('click', '.decline_health', function() {
var decline_id = $(this).attr('id');
Swal.fire({
title: 'Are you Sure You want to decline this Health
Certificate?',
// text: "You won't be able to recover this Banner
Announcement!",
// showDenyButton: true,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#bb2d3b',
confirmButtonText: 'Yes',
cancelButtonText: 'No',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: 'POST',
url: 'health_decline_process.php',
data: {
decline_id: decline_id
},
success: function(response) {
var res = jQuery.parseJSON(response);
if (res.status == 400) {
Swal.fire({
icon: 'warning',
title: 'Something Went Wrong.',
text: res.msg,
timer: 3000
})
} else if (res.status == 200) {
Swal.fire({
icon: 'success',
title: 'SUCCESS',
text: res.msg,
timer: 2000
}).then(function() {
location.reload();
});
}
}
})
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '',
'info').then(function() {
location.reload();
});
}
})
});
});

$(document).ready(function() {
$('#old_health_table').DataTable({
"paging": true, // Enable pagination
"lengthChange": true, // Enable the "Show [X] entries" dropdown
"searching": true, // Enable the search bar
// Additional DataTables options can be configured here
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10
});

$('#customer_order_table').DataTable({
"paging": true, // Enable pagination
"lengthChange": true, // Enable the "Show [X] entries" dropdown
"searching": true, // Enable the search bar
// Additional DataTables options can be configured here
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10
});

$('#payment_pending_exist_table').DataTable({
"paging": true, // Enable pagination
"lengthChange": true, // Enable the "Show [X] entries" dropdown
"searching": true, // Enable the search bar
// Additional DataTables options can be configured here
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10
});
$('#issue_cert_table').DataTable({
"paging": true, // Enable pagination
"lengthChange": true, // Enable the "Show [X] entries" dropdown
"searching": true, // Enable the search bar
// Additional DataTables options can be configured here
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10
});

$('#health_cert_record_table').DataTable({
"paging": true, // Enable pagination
"lengthChange": true, // Enable the "Show [X] entries" dropdown
"searching": true, // Enable the search bar
// Additional DataTables options can be configured here
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10
});

});
</script>
<script>
//get data to Update

$(document).ready(function() {
// Initialize Select2 outside the click event handler

// Attach click event handler to the button


$(document).on('click', '.view_cert_button', function() {
var view_id = $(this).attr('id');

// Open the modal


$('#view_cert_modal').modal('toggle');

// Make your AJAX request


$.ajax({
url: "health_certificate_transaction_view.php",
type: "post",
data: {
view_id: view_id
},
success: function(data) {
$('#view_cert_get').html(data);
}
});
});

// Attach click event handler to the button


$(document).on('click', '.view_cert_record_button', function() {
var view_id = $(this).attr('id');

// Open the modal


$('#view_cert_record_modal').modal('toggle');

// Make your AJAX request


$.ajax({
url: "health_certificate_transaction_record_view.php",
type: "post",
data: {
view_id: view_id
},
success: function(data) {
$('#view_cert_record_get').html(data);
}
});
});
});

$(document).on('submit', '#view_cert_form', function(e) {


e.preventDefault();
var formData = new FormData(this);
formData.append("is_accept_cert", true);
var formHasErrors = false;

// Regular expression pattern for letters only


var letterPattern = /^[A-Za-z\s.]+$/;
// Regular expression pattern for a valid email address with @gmail
domain
// Regular expression pattern for a valid 11-digit phone number
var phonePattern = /^\d{11}$/;
var numberPattern = /^[0-9]+$/;

var pattern = /^09/;


var name = $('#name').val();
var age = $('#age').val();
var occupation = $('#occupation').val();
var sex = $('#sex').val();
var type_work = $('#type_work').val();
var place_work = $('#place_work').val();
// var payment = $('#payment').val();

// checkbox
// var result_xray = $('#result_xray').prop('checked');
// var result_urine = $('#result_urine').prop('checked');
// var result_stool = $('#result_stool').prop('checked');
// var result_hepa = $('#result_hepa').prop('checked');
// var result_drugtest = $('#result_drugtest').prop('checked');
// var result_cbc = $('#result_cbc').prop('checked');

// date
var date_xray = $('#date_xray').val();
var date_urine = $('#date_urine').val();
var date_stool = $('#date_stool').val();
var date_hepa = $('#date_hepa').val();
var date_drugtest = $('#date_drugtest').val();
var date_cbc = $('#date_cbc').val();
if (name === '') {
$('#name_error').text('Full Name is empty. Please enter a value.');
formHasErrors = true;
} else if (!letterPattern.test(name)) {
$('#name_error').text('Full Name should only contain letters.');
formHasErrors = true;
} else if (name.length < 5) {
$('#name_error').text('Full Name should only not less than 2
characters');
formHasErrors = true;
} else if (name.length > 50) {
$('#name_error').text('Full Name should only not greater than 15
characters');
formHasErrors = true;
} else {
$('#name_error').text(''); // Clear the error message
}

if (age === '') {


$('#age_error').text('Age is empty. Please enter a value.');
formHasErrors = true;
} else if (!numberPattern.test(age)) {
$('#age_error').text('Age should only contain letters.');
formHasErrors = true;
} else if (age < 18) {
$('#age_error').text('Age should only not less than 18.');
formHasErrors = true;
} else if (age > 120) {
$('#age_error').text('Age should only not greater than 120.');
formHasErrors = true;
} else {
$('#age_error').text(''); // Clear the error message
}

// if (payment === '') {


// $('#payment_error').text('Payment is empty. Please enter a
value.');
// formHasErrors = true;
// } else if (!numberPattern.test(payment)) {
// $('#payment_error').text('Payment should only contain
letters.');
// formHasErrors = true;
// } else if (payment < 1) {
// $('#payment_error').text('Payment should only not less than
1.');
// formHasErrors = true;
// } else {
// $('#payment_error').text(''); // Clear the error message
// }

if (occupation === '') {


$('#occupation_error').text('Occupation is empty. Please enter a
value.');
formHasErrors = true;
} else if (!letterPattern.test(occupation)) {
$('#occupation_error').text('Occupation should only contain
letters.');
formHasErrors = true;
} else if (occupation.length < 4) {
$('#occupation_error').text('Occupation should only not less than 4
characters');
formHasErrors = true;
} else if (occupation.length > 150) {
$('#occupation_error').text('Occupation should only not greater
than 150 characters');
formHasErrors = true;
} else {
$('#occupation_error').text(''); // Clear the error message
}

if (sex === '') {


$('#sex_error').text('Sex is empty. Please select one item.');
formHasErrors = true;
} else {
$('#sex_error').text(''); // Clear the error message
}
if (type_work === '') {
$('#type_work_error').text('Type of Work is empty. Please select
one item.');
formHasErrors = true;
} else {
$('#type_work_error').text(''); // Clear the error message
}
if (place_work === '') {
$('#place_work_error').text('Place of Work is empty. Please select
one item.');
formHasErrors = true;
} else {
$('#place_work_error').text(''); // Clear the error message
}

// if (!result_xray) {
// $('#result_xray_error').text('Chest X-ray is unchecked. Kindly
check this checkbox.');
// formHasErrors = true;
// } else {
// $('#result_xray_error').text(''); // Clear the error message
// }
// if (!result_urine) {
// $('#result_urine_error').text('Urine is unchecked. Kindly check
this checkbox.');
// formHasErrors = true;
// } else {
// $('#result_urine_error').text(''); // Clear the error message
// }
// if (!result_stool) {
// $('#result_stool_error').text('Stool is unchecked. Kindly check
this checkbox.');
// formHasErrors = true;
// } else {
// $('#result_stool_error').text(''); // Clear the error message
// }
// if (!result_hepa) {
// $('#result_hepa_error').text('Hepa A/B is unchecked. Kindly
check this checkbox.');
// formHasErrors = true;
// } else {
// $('#result_hepa_error').text(''); // Clear the error message
// }
// if (!result_drugtest) {
// $('#result_drugtest_error').text('Drug Test is unchecked. Kindly
check this checkbox.');
// formHasErrors = true;
// } else {
// $('#result_drugtest_error').text(''); // Clear the error message
// }
// if (!result_cbc) {
// $('#result_cbc_error').text('CBC is unchecked. Kindly check this
checkbox.');
// formHasErrors = true;
// } else {
// $('#result_cbc_error').text(''); // Clear the error message
// }

if (date_xray == '') {
$('#date_xray_error').text('Chest X-ray date unselected. Kindly
Select medical Date.');
formHasErrors = true;
} else {
$('#date_xray_error').text(''); // Clear the error message
}
if (date_urine === '') {
$('#date_urine_error').text('Urine date unselected. Kindly Select
medical Date.');
formHasErrors = true;
} else {
$('#date_urine_error').text(''); // Clear the error message
}
if (date_stool === '') {
$('#date_stool_error').text('Stool date unselected. Kindly Select
medical Date.');
formHasErrors = true;
} else {
$('#date_stool_error').text(''); // Clear the error message
}
if (date_hepa === '') {
$('#date_hepa_error').text('Hepa A/B date unselected. Kindly Select
medical Date.');
formHasErrors = true;
} else {
$('#date_hepa_error').text(''); // Clear the error message
}
if (date_drugtest === '') {
$('#date_drugtest_error').text('Drug Test date unselected. Kindly
Select medical Date.');
formHasErrors = true;
} else {
$('#date_drugtest_error').text(''); // Clear the error message
}
if (date_cbc === '') {
$('#date_cbc_error').text('CBC date unselected. Kindly Select
medical Date.');
formHasErrors = true;
} else {
$('#date_cbc_error').text(''); // Clear the error message
}
if (formHasErrors) {
// Display a general error message if there are any form errors
document.getElementById('form_error_message').innerHTML = `
<div class="bg-danger text-white fw-bold text-center p-1"
style="font-size:20px;">
Please fix the errors found in the provided form.
</div>
`;
return;
}

{
Swal.fire({
title: 'Please review carefully before submitting the Health
Certificate. Are you sure you want to submit this Health Certificate?',
showDenyButton: false,
showCancelButton: true,
confirmButtonText: 'ACCEPT',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "health_certificate_transaction_process.php",
//action
data: formData,
processData: false,
contentType: false,
success: function(response) {
var res = jQuery.parseJSON(response);
if (res.status == 400) {
Swal.fire({
icon: 'warning',
title: 'Something Went Wrong.',
text: res.msg,
timer: 3000
})
} else if (res.status == 500) {
Swal.fire({
icon: 'warning',
title: 'Something Went Wrong.',
text: res.msg,
timer: 3000
})
} else if (res.status == 200) {
Swal.fire({
icon: 'success',
title: 'SUCCESS',
text: res.msg,
timer: 2000
}).then(function() {

window.location.href = '<?= BASE_URL ?


>admin-page/health_certificate_transaction_payment.php?id=' + res.id + '';

});
}
}
})
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '',
'info').then(function() {
location.reload();
});
}
})

}
});

$(document).ready(function() {
$(document).on('click', '.certificate_print', function() {
var cert_id = $(this).attr('id');
Swal.fire({
title: 'Are you Sure You want to Print this Health
Certificate?',
// showDenyButton: true,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: 'rgb(26 138 14)',
confirmButtonText: 'PRINT',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: 'POST',
url: 'health_certificate_transaction_process.php',
data: {
cert_id: cert_id
},
success: function(response) {
var res = jQuery.parseJSON(response);
if (res.status == 400) {
Swal.fire({
icon: 'warning',
title: 'Something Went Wrong.',
text: res.msg,
timer: 3000
})
} else if (res.status == 200) {
Swal.fire({
icon: 'success',
title: 'SUCCESS',
text: res.msg,
timer: 2000
}).then(function() {
if (res.type_work == "Food Worker") {
window.location.href = '<?= BASE_URL ?
>admin-page/health_certificate_transaction_food_worker_print.php?id=' + res.id +
'';
} else if (res.type_work == "Non-Food
Worker") {
window.location.href = '<?= BASE_URL ?
>admin-page/health_certificate_transaction_non_food_worker_print.php?id=' + res.id
+ '';
}
});
}
}
})
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '',
'info').then(function() {
location.reload();
});
}
})
});
});

$(document).ready(function() {
$(document).on('click', '.print_old', function() {
var cert_id = $(this).attr('id');
Swal.fire({
title: 'Are you Sure You want to Print this Old Health
Certificate?',
// showDenyButton: true,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: 'rgb(26 138 14)',
confirmButtonText: 'PRINT',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: 'POST',
url: 'health_certificate_transaction_process.php',
data: {
cert_id: cert_id
},
success: function(response) {
var res = jQuery.parseJSON(response);
if (res.status == 400) {
Swal.fire({
icon: 'warning',
title: 'Something Went Wrong.',
text: res.msg,
timer: 3000
})
} else if (res.status == 200) {
Swal.fire({
icon: 'success',
title: 'SUCCESS',
text: res.msg,
timer: 2000
}).then(function() {
if (res.type_work == "Food Worker") {
window.location.href = '<?= BASE_URL ?
>admin-page/health_certificate_transaction_food_worker_print_old.php?id=' + res.id
+ '';
} else if (res.type_work == "Non-Food
Worker") {
window.location.href = '<?= BASE_URL ?
>admin-page/health_certificate_transaction_non_food_worker_print_old.php?id=' +
res.id + '';
}
});
}
}
})
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '',
'info').then(function() {
location.reload();
});
}
})
});
});
</script>

You might also like