<?php $__env->startSection("content"); ?>
<div style="clear:both;height:100px;">
  <h3>Dashboard</h3>
</div>
<div style="width:24%;float:left;"> <a href="<?php echo e(URL::asset('/')); ?>expenses?department=all&status=Pending&period=all&page=" style="text-decoration: none;" >
  <div data-type="false" data-theme="blue" class="departs-under custom-border-colors1 departs">
    <h4>Pending Expense</h4>
    <break>
    <h2 style="display:block;">
      <?php  echo $Pending; ?>
    </h2>
    <p style="display:block;">Request</p>
  </div>
  </a> </div>
<div style="width:24%;float:left;margin-left:1%;"> <a href="<?php echo e(URL::asset('/')); ?>expenses?department=all&status=Approved&period=all&page=" style="text-decoration: none;" >
  <div data-type="false" data-theme="green" class="departs-under custom-border-colors2 departs">
    <h4>Approved Expense</h4>
    <h2 style="display:block;"><?php echo $Approved; ?></h2>
    <p style="display:block;">Request</p>
  </div>
  </a> </div>
<div style="width:24%;float:left;margin-left:1%;"> <a href="<?php echo e(URL::asset('/')); ?>expenses?department=all&status=Overdue&period=all&page=" style="text-decoration: none;" >
  <div data-type="false" data-theme="red" class="departs-under custom-border-colors3 departs">
    <h4>Overdue Expense</h4>
    <h2 style="display:block;"><?php echo $Overdue; ?></h2>
    <p style="display:block;">Request</p>
  </div>
  </a> </div>
<div style="width:24%;float:right;"> <a href="<?php echo e(URL::asset('/')); ?>expenses?department=all&status=Closed&period=all&page=" style="text-decoration: none;" >
  <div data-type="false" data-theme="black" class="departs-under custom-border-colors4 departs">
    <h4>Closed Expense</h4>
    <h2 style="display:block;"><?php echo $Closed; ?></h2>
    <p style="display:block;">Request</p>
  </div>
  </a> </div>
<div style="clear:both;height:20px;"></div>
<!-- #########################################################################################-->
<div class="expense-table expense-table-home tbl-border">
  <h3> Pending expenses list for approval</h3>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th Class="tbl-heading">Requests</th>
		<?php foreach($currency_symbol as $row){ ?>
        <th Class="tbl-heading" style="text-align: center;"><?php echo $row->symbol; ?></th>
		<?php } ?>
        <!-- <th Class="tbl-heading">Approvers</th>  -->
        <th Class="tbl-heading">Details</th>
      </tr>
    </thead>
    <tbody>
      <!--     <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">-->
    <?php if(count($expenses)>0): ?>
    <?php $i=0; ?>
    <?php foreach($expenses as $row): ?>
    
    <?php if($row->status=="Pending"): ?>
    <?php
                  $color = "purple";
                  if($row->status=="Pending"){ 
				  $color = "yellow"; 
				  }
             
				?>
    <tr class="border-<?php echo e($color); ?>">
      <td class="requests"><h5><a href="<?php echo e(URL::asset('/')); ?>expenses/show/<?php echo e($row->id); ?>" style="text-decoration:none; color:inherit !important;"><?php echo e($row->item); ?></a></h5>
        
        <p>From: <span><?php echo e($row->user); ?></span> </p>
        <p>
        <h5><?php echo e($row->category); ?></h5>
        </p>
        <?php if($row->comments != ''): ?>
        <p><strong>Comments: </strong><?php echo e($row->comments); ?></p>
        <?php endif; ?>
        <div style="clear:both;height:5px;"></div>
        <div class="" id="comments_box_<?php echo e($row->id); ?>" style="display:none;">
          <div style="float:left;margin-top:8px;"><strong>Comments: </strong></div>
          <textarea name="comments[<?php echo e($row->id); ?>]" id="comments_<?php echo e($row->id); ?>" style="width:320px;height:42px;margin-left:10px;"></textarea>
        </div></td>
        <td class="amount" style="text-align: center;">
		<p ><span><?php echo e(\App\Providers\Common::format_currency($row->price)); ?></span> requested</p>
        
        <a href="<?php echo e(URL::asset('/')); ?>expenses/show/<?php echo e($row->id); ?>" style="text-decoration:none; color:inherit !important;"><span class="overdue bg-<?php echo e($color); ?>"><?php echo e($row->status); ?></span></a></td>
      
        <td class="details"><p class="green"><span><?php echo e(\App\Providers\Common::format_currency($row->budget-$row->price)); ?></span> Left</p>
        <p class="priority"><strong>Priority: </strong><?php echo e($row->priority); ?></p></td>
    </tr>
    <?php if($i==count($colors)-1){$i=-1;} $i++; ?>
    <?php endif; ?>
    <?php endforeach; ?>
    <?php endif; ?>
      </tbody>
    
  </table>
</div>
<?php if($Pending===0)
			   { ?>
<h4 align="center">No Item Found.</h4>
<?php } ?>

<!-- #########################################################################################--> 
<!-- start chart --> 

<br>
<br>
<style> 
.body{background-color:#900 }
</style>
<h3> Expense Vs. Budget Graph</h3>
<br>
<br>




<?php
		$Array='';
		foreach($chart_data as $row){
			$Array .= "['".$row->name."',".(int)$row->budget.",".(float)$row->expense."],";
		}
		$Array = rtrim($Array,',');
		
		
		?>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div class="container" style="border: 1px solid rgb(204, 204, 204); padding: 20px;">
<div>
  
  <div style="float:right;">
    <form name="dep_form" >
      <div class="dropdown">
        <select class="form-control chosen-select" style="width:110%;" placeholder="Choose Department" name="department_id" >
          <option> </option>
          <option value="0" <?php  if(isset($_GET['department_id'])){  if($_GET['department_id']==0){ echo 'selected="selected"'; }}?> selected="selected" >All dapartments </option>
          <?php foreach($category_names as $row){  ?>
          <option value="<?php echo $row->id ?>" <?php if(isset($_GET['department_id'])){  if($_GET['department_id']==$row->id){ echo 'selected="selected"'; }}?>>
          <?php  echo $row->name ?>
          </option>
          <?php  }; ?>
        </select>
        <select class="form-control chosen-select-2" placeholder="Choose Periods" name="periods[]" multiple="multiple">
          <option> </option>
          <?php foreach($periods as $row){  ?>
          <option value="<?php  echo $row->id; ?>" <?php  if(isset($requestperiod)){  if(in_array($row->id, $requestperiod)){ echo 'selected="selected"'; }}?>>
          <?php  echo $row->name; ?>
          </option>
          <?php  }; ?>
        </select>
        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
        <input class="btn btn-default"  type="submit" name="submit" value="submit" />
      </div>
    </form>
  </div>
</div>
<br>
<br>
<br>
<br>
<div class="row">
  <div class="clearfix"></div>
  <div class="col-md-6">
    <div id="dual_x_div" style="width: 100%;min-height: 450px;"></div>
  </div>
</div>
<script>
          google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable([['Periods', 'Budget', 'Expense'],<?php echo $Array; ?>]);
		

        var options = {
          width: 800,
          chart: {
            title: 'Budget Vs. Expense Analysis',
            subtitle: ''
          },
          bars:'vertical', // Required for Material Bar Charts.
		 
          series: {
            0: { axis: 'Budget' }, // Bind series 0 to an axis named 'distance'.
            1: { axis: 'Expense' } // Bind series 1 to an axis named 'brightness'.
          },
          axes: {
            x: {
              distance: {label: 'parsecs'}, // Bottom x-axis.
              brightness: {side: 'top', label: 'apparent magnitude'} // Top x-axis.
            }
          }
        };

      var chart = new google.charts.Bar(document.getElementById('dual_x_div'));
      chart.draw(data, options);
    };
        						
</script>
</div>
<div style="clear:both;height:20px;"></div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make("app", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>