@extends('layouts.app')

<head>
  
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
  
</head>

@section('breadcrumb')
   @parent
   <li>report penjualan</li>
@endsection


@section('content')

<div class="container-fluid">
    <div class="card">
        <div class="card-block">

<!--form method="post" id="form-report"-->


<form class="form-horizontal" data-toggle="validator" method="post" id="form-report">
{{ csrf_field() }} {{ method_field('POST') }}

    <center><h5>Laporan Pemasukan Kas</h5></center>
    <br>
    
    <div class="row" style="padding:5px 20px;">
        
        <div class="form-group">
     		<div class="col-md-3">
    		    <label>Tgl. Awal</label>
    			<input id="awal" type="date" class="form-control" name="awal" autofocus required>
    		</div>
    		<div class="col-md-3">
    		    <label>Tgl. Akhir</label>
    			<input id="akhir" type="date" class="form-control" name="akhir" autofocus required>
    		</div>
        </div>

        <div class="col-md-12">
            <div class="form-group">
                <br>
                <label>Project Perumahan</label>
                <select id="prj" name="prj" type="text" class="form-control" autofocus required>
                    <option value=""> --- Pilih Project --- </option>
                    @foreach($prj as $dt)
                    <option value="{{ $dt->id }}">{{ $dt->project_name.' ['.$dt->initial.']' }}</option>
                    @endforeach
                </select>
            </div>
        </div>


        <div class="col-md-12 text-center">	
        	<br>
    		<button type="submit" class="btn btn-primary btn-sm" onclick="viewReport()"><i class="fa fa-table"></i> View Report </button>
    		<button type="submit" class="btn btn-success btn-sm" onclick="exportExcell()"><i class="fa fa-file-excel-o"></i> Export to Excell </button>
    		
        	<a href="{{ route('home') }}" class="btn btn-warning btn-sm"><i class="fa fa-home"></i> Home </a>
            <br>
        </div>
    	
    </div>
        
</form>

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

@endsection

@section('script')

<script type="text/javascript">

var table, tgl1, tgl2, cus, tbl_report;

$(document).ready(function(){

})

function viewReport(){
    $('#form-report').attr('action', "{{ DIR_APP }}report/viewreportpemasukan").submit();       //--> open new windows
    //location.reload();
}


function exportExcell(){
    //alert('fitur belum siap'); 
    //return false;
    $('#form-report').attr('action', "{{ DIR_APP }}report/exportkasmasuk").submit();       //--> open new windows
    location.reload();
}


</script>

@endsection