<?php
$check_install='install/index.php';
if (file_exists($check_install)) {
header ('Location: install/index.php');
}
include('modules/header.php');
include('modules/sidebar.php');
include('modules/nav.php');
$_SESSION['current_page'] = "Dashboard";
include('modules/help-module.php');
$tasks_overdue =file_get_contents(''.$config['URL'].'/api/get_tasks_overdue.php');
$tasks_due_today =file_get_contents(''.$config['URL'].'/api/get_tasks_due_today.php');
$tasks_due_five =file_get_contents(''.$config['URL'].'/api/get_tasks_due_5.php');
$tasks_due_ten =file_get_contents(''.$config['URL'].'/api/get_tasks_due_10.php');
?>
<!--<div class="btn-floating" id="help-actions">
  <div class="btn-bg"></div>
  <button type="button" class="btn btn-default btn-toggle" data-toggle="toggle" data-target="#help-actions">
    <i class="icon fa fa-support"></i>
    <span class="help-text">Shortcut</span>
  </button>
  <div class="toggle-content">
    <ul class="actions">
      <li><a href="https://intranet.rcig.net">Intra</a></li>
      <li><a href="http://mission.hostirian.com">SOP</a></li>
      <li><a href="https://tickets.hostirian.com/admin/">Tickets</a></li>
      <li><a href="http://npg.rcnpg.com">Monitoring</a></li>
      <li><a href="https://datavault.hostirian.com">Data Vault</a></li>
    </ul>
  </div>
</div>-->

<!--<div class="row">
  <div class="col-xs-12">
    <div class="card card-banner card-chart card-green no-br">
      <div class="card-header">
        <div class="card-title">
          <div class="title">Top Sale Today</div>
        </div>
        <ul class="card-action">
          <li>
            <a href="/">
              <i class="fa fa-refresh"></i>
            </a>
          </li>
        </ul>
      </div>
      <div class="card-body">
        <div class="ct-chart-sale"></div>
      </div>
    </div>
  </div>
</div>-->
<?php
if ($tasks_overdue == 0 ){
?>
<div class="row">
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-green-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-check fa-4x"></i>
    <div class="content">
      <div class="title">Tasks OverDue</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_overdue;?></div>
    </div>
  </div>
</a>

  </div>
<!--</div>-->
<?php
}

else{
?>
<div class="row">
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-orange-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-warning fa-4x"></i>
    <div class="content">
      <div class="title">Tasks OverDue</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_overdue;?></div>
    </div>
  </div>
</a>

  </div>
<!--</div>-->
<?php
} 
if ($tasks_due_today == 0 ){
	?>
<!--<div class="row">-->
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-green-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-check fa-4x"></i>
    <div class="content">
      <div class="title">Tasks Due Today</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_due_today;?></div>
    </div>
  </div>
</a>

  </div>
<?php
}

else{
?>
<!--<div class="row">-->
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-orange-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-warning fa-4x"></i>
    <div class="content">
      <div class="title">Tasks Due Today</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_due_today;?></div>
    </div>
  </div>
</a>

  </div>
<?php
}

if ($tasks_due_five == 0){
?>
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-green-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-check fa-3x"></i>
    <div class="content">
      <div class="title">Tasks Due in Next 5 Days</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_due_five; ?></div>
    </div>
  </div>
</a>

  </div>
<?php
}
else{
?>
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-yellow-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-warning fa-4x"></i>
    <div class="content">
      <div class="title">Tasks Due in Next 5 Days</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_due_five; ?></div>
    </div>
  </div>
</a>

  </div>
<?php
}
?>
<div class="row">
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-green-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-check fa-4x"></i>
    <div class="content">
      <div class="title">Tasks Due in the Next 10 Days</div>
      <div class="value"><span class="sign"></span><?php echo $tasks_due_ten;?></div>
    </div>
  </div>
</a>

  </div>
</div>
  <div class="col-lg-3 col-md-5 col-sm-5 col-xs-11">
      <a class="card card-banner card-green-light" href="<?php echo $config['URL'];?>/tasks.php">
  <div class="card-body">
    <i class="icon fa fa-desktop fa-4x"></i>
    <div class="content">
      <div class="title">Total Assets Active</div>
      <div class="value"><span class="sign"></span><?php $total_devices=file_get_contents(''.$config['URL'].'/api/get_count_devices.php'); echo $total_devices;?></div>
    </div>
  </div>
</a>

  </div>
</div>

<?php
include('modules/view-all-devices-module.php');
?>
<!--<div class="row">
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <div class="card card-mini">
      <div class="card-header">
        <div class="card-title">Device Stats</div>
        <ul class="card-action">
          <li>
            <a href="/">
              <i class="fa fa-refresh"></i>
            </a>
          </li>
        </ul>
      </div>
      <div class="card-body no-padding table-responsive">
        <table class="table card-table">
          <thead>
            <tr>
              <th>Device</th>
              <th class="right"># of Tasks</th>
              <th>Status</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>vm39.vps1.hostirian.com</td>
              <td class="right">12</td>
              <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span> 1 Task Complete</span></span></td>
            </tr>
            <tr>
              <td>s1.hostirian.com</td>
              <td class="right">55</td>
              <td><span class="badge badge-danger badge-icon"><i class="fa fa-clock-o" aria-hidden="true"></i><span>1 Task Over Due</span></span></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>-->
<?php 
include('modules/footer.php');
?>
