<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-01-22
 * Time: 07:29
 */
if (isset($_SESSION['YUZA_ID'])) {
    if (file_exists("pages/" . $URL[0] . ".php")) {
        require $_SESSION['YUZA_ROLE_LOCATION'] . $URL[0] . ".php";
    } else {
        require $_SESSION['YUZA_ROLE_LOCATION'] . "home.php";
    }
} else {

    ?>

  <!DOCTYPE html>
  <html>


  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>UDUTH PPP Partners Login Page</title>
    <!-- Fav  Icon Link -->
    <link rel="shortcut icon" type="image/png" href="<?php echo imgPATH; ?>fav.png">
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="<?php echo cssPATH; ?>bootstrap.min.css">
    <!-- themify icons CSS -->
    <link rel="stylesheet" href="<?php echo cssPATH; ?>themify-icons.css">
    <!-- Main CSS -->
    <link rel="stylesheet" href="<?php echo cssPATH; ?>styles.css">
    <link rel="stylesheet" href="<?php echo cssPATH; ?>green.css" id="style_theme">
    <link rel="stylesheet" href="<?php echo cssPATH; ?>responsive.css">

    <script src="<?php echo jsPATH; ?>modernizr.min.js"></script>
  </head>

<body class="auth-bg">
  <!-- Pre Loader -->
  <div class="loading">
    <div class="spinner">
      <div class="double-bounce1"></div>
      <div class="double-bounce2"></div>
    </div>
  </div>
  <!--/Pre Loader -->
  <!-- Main Content -->
<div class="container">
  <div class="row">
  <!-- Widget Item -->
  <div class="col-md-12">
  <div class="widget-area-2 proclinic-box-shadow">
  <div class="row justify-content-center">
  <div class="col-md-10">
  <h5 align='center'>Success!</h5>
    <?php

    require_once getcwd() . "/../functions/db.class.php";
    require_once getcwd() . "/../functions/form.data.php";
    require_once getcwd() . "/../functions/robot.php";
    require_once getcwd() . "/../functions/config.php";
    require_once getcwd() . "/../functions/curl.php";

    if (isset($_SESSION['YUZA_ID'])) {
        ?>
      <div class="alert alert-success"><?php include "sync/sync-patients.php"; ?></div><?php
        ?>
      <div class="alert alert-success"><?php include "sync/sync-reports.php"; ?></div><?php
    }
    include "sync/sync-all.php";

    ?>


      <div style="height:20px"></div>

      <h1 align="center">
        <button onclick="closeBtn();"  id="close-btn">Close</button>
      </h1>

      <div style="height:100px"></div>

      </div>
      </div>
      </div>
      </div>
      </div>
      </div>

    <?php


    ?>

      <script language='javascript'>
          alert('Synced successfully.');

          function closeBtn() {
              window.close();
          }
      </script>

      <!-- Jquery Library-->
      <script src="<?php echo jsPATH; ?>jquery-3.2.1.min.js"></script>
      <!-- Popper Library-->
      <script src="<?php echo jsPATH; ?>popper.min.js"></script>
      <!-- Bootstrap Library-->
      <script src="<?php echo jsPATH; ?>bootstrap.min.js"></script>
      <!-- Custom Script-->
      <script src="<?php echo jsPATH; ?>custom.js"></script>
      </body>

      </html>


        <?php
    }
    ?>