<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-01-23
 * Time: 19:22
 */


//dashboard
if ($fPage == "home") {
    $home = true;
}
if ($fPage == "patients" || $fPage == "edit-patient" || $fPage == "about-patient") {
    $patients = true;
}
if ($fPage == "add-patient") {
    $addpatients = true;
}
if ($fPage == "search-patient") {
    $searchpatients = true;
}
if ($fPage == "payments" || $fPage == "add-payment" || $fPage == "about-payment") {
    $payments = true;
}
if ($fPage == "reports") {
    $reports = true;
}
if ($fPage == "revenue") {
    $revenues = true;
}
if ($fPage == "configurations") {
    $configurations = true;
}
if ($fPage == "manage-users") {
    $manageusers = true;
}


?>


<?php

if ($_SESSION['YUZA_ROLE_LOCATION'] == "users/") {

    ?>
  <!-- Menu -->
  <div class="container menu-nav">
    <nav class="navbar navbar-expand-lg proclinic-bg text-white">
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
              aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="ti-menu text-white"></span>
      </button>

      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item dropdown <?php if ($home == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>home" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-home"></span> Dashboard</a>
          </li>
          <li class="nav-item dropdown <?php if ($patients == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>patients" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-user"></span> All Patients</a>
          </li>
          <li class="nav-item dropdown <?php if ($addpatients == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>add-patient" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-plus"></span> Add Patient</a>
          </li>
          <li class="nav-item dropdown <?php if ($searchpatients == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>search-patient" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-search"></span> Search Patient</a>
          </li>
          <li class="nav-item dropdown <?php if ($reports == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>reports" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-pencil-alt"></span> Report</a>
          </li>
        </ul>
      </div>
    </nav>
  </div>
  <!-- /Menu -->

    <?php

}
if ($_SESSION['YUZA_ROLE_LOCATION'] == "admin/") {

    ?>
  <!-- Menu -->
  <div class="container menu-nav">
    <nav class="navbar navbar-expand-lg proclinic-bg text-white">
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
              aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="ti-menu text-white"></span>
      </button>

      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item dropdown <?php if ($home == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>home" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-home"></span> Dashboard</a>
          </li>
          <li class="nav-item dropdown <?php if ($manageusers == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>manage-users" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-user"></span> Manage Users</a>
          </li>
          <li class="nav-item dropdown <?php if ($configurations == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>configurations" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-settings"></span> Configurations</a>
          </li>
          <li class="nav-item dropdown <?php if ($revenues == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="#" data-toggle="modal" data-target="#exampleModal" aria-haspopup="true"
               aria-expanded="false"><span class="ti-money"></span> Revenues</a>
          </li>
          <li class="nav-item dropdown <?php if ($reports == true) {
              echo "active";
          } else {
              echo "";
          } ?>">
            <a class="nav-link " href="<?php echo path(); ?>reports" role="button" aria-haspopup="true"
               aria-expanded="false"><span class="ti-pencil-alt"></span> Reports</a>
          </li>

        </ul>
      </div>
    </nav>
  </div>
  <!-- /Menu -->

    <?php

}
?>


<!-- Modal Popup-->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Generate Revenue Report</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="row justify-content-center">
          <form method="POST" action="<?php echo path() ?>revenues">
            <div class="form-row">
              <div class="form-group col-md-6">
                <label for="month">Month</label>
                <select class="form-control" id="month" name="month">
                    <?php
                    for ($i = 1; $i <= 12; $i++) {
                        print("<option>" . str_pad($i, "2", "0", STR_PAD_LEFT) . "</option>");
                    }
                    ?>
                </select>
              </div>
              <div class="form-group col-md-6">
                <label for="year">Year</label>
                <select class="form-control" id="year" name="year">
                    <?php
                    $i = date("Y");
                    do {
                        print("<option>" . str_pad($i, "4", "0", STR_PAD_LEFT) . "</option>");
                        $i--;
                    } while ($i >= date("Y") - 10)
                    ?>
                </select>
              </div>
              <div class="form-group col-md-12">
                <button type="submit" class="btn btn-success">
                  Generate
                </button>
              </div>
            </div>
          </form>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
      </div>
    </div>
  </div>
</div>
<!-- /Modal Popup-->