<?php
require_once('../include/Session.php');
require_once('../include/Functions.php');
require_once('../include/Crud.php');
require_once("../include/Controller.php");
$Controller = new Controller();

$user_id = $_SESSION['user_id'];
$current_form_number = 8;

$form_check_result = $Controller->fmCheckOd($_SESSION['user_id']);

// Check if $form_check_result is not null and if it has at least one element
if ($form_check_result !== null && isset($form_check_result[0]['form_check'])) {
    $form_check = $form_check_result[0]['form_check'];

    // Cast $form_check to an integer
    $form_check = (int)$form_check;

    // var_dump($form_check); 
    if ($form_check === $current_form_number) {
        // Set JavaScript variable to indicate completion
        echo "<script>var formCompleted = true;</script>";
    }
}
?>




<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>Homepage | Staff Portal</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no" />
    <meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
    <meta content="" name="author" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!-- App favicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico" />
    <!-- App css -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/jquery-ui.min.css" rel="stylesheet" />
    <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />
    <link href="../plugins/daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />
</head>

<body class="dark-sidenav">
    <!-- Left Sidenav -->
    <?php
    include_once("../components/sidenav.php");
    ?>
    <!-- end left-sidenav-->
    <div class="page-wrapper">
        <!-- Top Bar Start -->
        <?php
        include_once("../components/topbar.php");
        ?>
        <!-- Top Bar End --><!-- Page Content-->
        <div class="page-content">
            <div class="container-fluid">
                <!-- Page-Title -->
                <div class="row">
                    <div class="col-sm-12">
                        <div class="page-title-box">
                            <div class="row">
                                <div class="col">
                                    <h4 class="page-title">Staff Portal</h4>
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item">
                                            <a href="javascript:void(0);">Staff Portal</a>
                                        </li>
                                        <li class="breadcrumb-item">
                                            <a href="javascript:void(0);">Welcome</a>
                                        </li>
                                    </ol>
                                </div>
                                <!--end col-->
                               
                                <!--end col-->
                            </div>
                            <!--end row-->
                        </div>
                        <!--end page-title-box-->
                    </div>
                    <!--end col-->
                </div>
                <!--end row--><!-- end page title end breadcrumb -->
                <div class="row">
                    <div class="col-lg-12">
                        <table class="body-wrap" style="
                  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
                  box-sizing: border-box;
                  font-size: 14px;
                  width: 100%;
                  background-color: transparent;
                  margin: 0;
                " bgcolor="transparent">
                            <tr style="
                    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
                    box-sizing: border-box;
                    font-size: 14px;
                    margin: 0;
                  ">
                                <td style="
                      font-family: 'Helvetica Neue', Helvetica, Arial,
                        sans-serif;
                      box-sizing: border-box;
                      font-size: 14px;
                      vertical-align: top;
                      margin: 0;
                    " valign="top"></td>
                                <td class="container" width="600" style="
                      font-family: 'Helvetica Neue', Helvetica, Arial,
                        sans-serif;
                      box-sizing: border-box;
                      font-size: 14px;
                      vertical-align: top;
                      display: block !important;
                      max-width: 600px !important;
                      clear: both !important;
                      margin: 0 auto;
                    " valign="top">
                                    <div class="content" style="
                        font-family: 'Helvetica Neue', Helvetica, Arial,
                          sans-serif;
                        box-sizing: border-box;
                        font-size: 14px;
                        max-width: 600px;
                        display: block;
                        margin: 0 auto;
                        padding: 20px;
                      ">
                                        <table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope="" itemtype="http://schema.org/ConfirmAction" style="
                          font-family: 'Helvetica Neue', Helvetica, Arial,
                            sans-serif;
                          box-sizing: border-box;
                          font-size: 14px;
                          border-radius: 3px;
                          background-color: transparent;
                          margin: 0;
                          border: 1px dashed #4d79f6;
                        " bgcolor="#fff">
                                            <tr style="
                            font-family: 'Helvetica Neue', Helvetica, Arial,
                              sans-serif;
                            box-sizing: border-box;
                            font-size: 14px;
                            margin: 0;
                          ">
                                                <td class="content-wrap" style="
                              font-family: 'Helvetica Neue', Helvetica, Arial,
                                sans-serif;
                              box-sizing: border-box;
                              font-size: 14px;
                              vertical-align: top;
                              margin: 0;
                              padding: 20px;
                            " valign="top">
                                                    <meta itemprop="name" content="Confirm Email" style="
                                font-family: 'Helvetica Neue', Helvetica, Arial,
                                  sans-serif;
                                box-sizing: border-box;
                                font-size: 14px;
                                margin: 0;
                              " />
                                                    <table width="100%" cellpadding="0" cellspacing="0" style="
                                font-family: 'Helvetica Neue', Helvetica, Arial,
                                  sans-serif;
                                box-sizing: border-box;
                                font-size: 14px;
                                margin: 0;
                              ">
                                                        <tr>
                                                            <td>
                                                                <a href="#"><img src="https://enterthehealingschool.org/hsnew/imgs/logo/logo-blue.png" alt="" style="
                                        margin-left: auto;
                                        margin-right: auto;
                                        display: block;
                                        margin-bottom: 10px;
                                        height: 40px;
                                      " /></a>
                                                            </td>
                                                        </tr>
                                                        <tr style="
                                  font-family: 'Helvetica Neue', Helvetica,
                                    Arial, sans-serif;
                                  box-sizing: border-box;
                                  font-size: 14px;
                                  margin: 0;
                                ">
                                                            <td class="content-block" style="
                                    font-family: 'Helvetica Neue', Helvetica,
                                      Arial, sans-serif;
                                    box-sizing: border-box;
                                    color: #4d79f6;
                                    font-size: 24px;
                                    font-weight: 700;
                                    text-align: center;
                                    vertical-align: top;
                                    margin: 0;
                                    padding: 0 0 10px;
                                  " valign="top">
                                                                WelCome To The Healing School Staff Portal
                                                            </td>
                                                        </tr>
                                                        <tr style="
                                  font-family: 'Helvetica Neue', Helvetica,
                                    Arial, sans-serif;
                                  box-sizing: border-box;
                                  font-size: 14px;
                                  margin: 0;
                                ">

                                                        </tr>
                                                        <tr style="
                                  font-family: 'Helvetica Neue', Helvetica,
                                    Arial, sans-serif;
                                  box-sizing: border-box;
                                  font-size: 14px;
                                  margin: 0;
                                ">
                                                            <td class="content-block" style="
                                    font-family: 'Helvetica Neue', Helvetica,
                                      Arial, sans-serif;
                                    box-sizing: border-box;
                                    font-size: 14px;
                                    vertical-align: top;
                                    margin: 0;
                                    padding: 10px 10px;
                                  " valign="top">
                                                                We're delighted to have you onboard. To ensure we have all the necessary information to support you effectively, please take a moment to fill out the form.
                                                            </td>
                                                        </tr>
                                                        <tr style="
                                  font-family: 'Helvetica Neue', Helvetica,
                                    Arial, sans-serif;
                                  box-sizing: border-box;
                                  font-size: 14px;
                                  margin: 0;
                                ">
                                                            <td class="content-block" itemprop="handler" itemscope="" itemtype="http://schema.org/HttpActionHandler" style="
                                    font-family: 'Helvetica Neue', Helvetica,
                                      Arial, sans-serif;
                                    box-sizing: border-box;
                                    font-size: 14px;
                                    vertical-align: top;
                                    margin: 0;
                                    padding: 10px 10px;
                                  " valign="top">
                                    <a href="./sd.php" id="completionButton" class="btn-primary" style="
                                      font-size: 14px;
                                      text-decoration: none;
                                      line-height: 2em;
                                      font-weight: bold;
                                      text-align: center;
                                      cursor: pointer;
                                      display: block;
                                      border-radius: 5px;
                                      text-transform: capitalize;
                                      border: none;
                                      padding: 10px 20px;
                                    ">Start</a>
                                                            </td>
                                                        </tr>
                                                        <tr style="
                                  font-family: 'Helvetica Neue', Helvetica,
                                    Arial, sans-serif;
                                  box-sizing: border-box;
                                  font-size: 14px;
                                  margin: 0;
                                ">
<script>
    // Check if formCompleted variable is defined and true
    if (typeof formCompleted !== 'undefined' && formCompleted) {
        // Change button text to "Completed"
        document.getElementById("completionButton").innerText = "Completed";
        // Disable the button
        document.getElementById("completionButton").disabled = true;
    }
</script>

                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                        <!--end table-->
                                    </div>
                                    <!--end content-->
                                </td>
                                <td style="
                      font-family: 'Helvetica Neue', Helvetica, Arial,
                        sans-serif;
                      box-sizing: border-box;
                      font-size: 14px;
                      vertical-align: top;
                      margin: 0;
                    " valign="top"></td>
                            </tr>
                        </table>
                        <!--end table-->
                    </div>
                    <!--end col-->
                </div>
                <!--end row-->
            </div>
            <!-- container -->
            <?php include_once('../components/footer.php') ?>

            <!--end footer-->
        </div>
        <!-- end page content -->
    </div>
    <!-- end page-wrapper --><!-- jQuery  -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/metismenu.min.js"></script>
    <script src="assets/js/waves.js"></script>
    <script src="assets/js/feather.min.js"></script>
    <script src="assets/js/simplebar.min.js"></script>
    <script src="assets/js/jquery-ui.min.js"></script>
    <script src="assets/js/moment.js"></script>
    <script src="../plugins/daterangepicker/daterangepicker.js"></script>
    <!-- App js -->
    <script src="assets/js/app.js"></script>
</body>

</html>