@extends('Layout.master')

@section('title', 'Employees')

@section('header-include')
    <style>
        #import_file{
            -webkit-appearance:none;
            position:absolute;
            top:0;
            left:0;
            opacity:0;
            width: 100%;
            height: 100%;
        }
    </style>
@endsection

@section('content')

    <section id="content">
        <section class="vbox">
            <section class="scrollable padder">
                <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
                    <li><a href="."><i class="fa fa-home"></i>Home</a></li>
                    <li class="active">Employees</li>
                </ul>
                @include('Layout.errors')
                <section class="panel panel-default">
                    <header class="panel-heading font-bold clearfix">
                        Employees
                    </header>
                    <div class="table-responsive">
                        <table class="table table-striped m-b-sm datagrid">
                            <thead>
                            <tr>
                                <th colspan="6">
                                    <div class="row clearfix">
                                        <div class="col-sm-4 m-t-xs m-b-xs">
                                            <div class="input-group search datagrid-search">
                                                <input type="text" class="input-sm form-control" placeholder="Search">
                                                <div class="input-group-btn">
                                                    <button class="btn btn-default btn-sm"><i class="fa fa-search"></i></button>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="pull-right" style="margin:5px 10px 0 0;">
                                            <a href="/allowances/create" class="btn btn-info btn-sm"><i class="fa fa-plus"></i>Create</a>
                                            <a href="/allowances" class="btn btn-info btn-sm"><i class="fa fa-refresh"></i>Refresh</a>
                                        </div>
                                    </div>
                                </th>
                            </tr>
                            <tr>
                                <th class="sortable">Code</th>
                                <th class="sortable">Name</th>
                                <th class="sortable">Income type</th>
                                <th class="sortable">Tabulation type</th>
                                <th class="sortable">Tax option</th>
                                <th class="sortable">Action</th>
                            </tr>
                            </thead>
                            <tbody>
                            {{--@if(count($allowances) > 0)
                                @foreach($allowances as $allowance)
                                    <tr id="">
                                        <td></td>
                                        <td></td>
                                        <td>

                                        </td>
                                        <td>

                                        </td>
                                        <td>

                                        </td>
                                        <td>
                                            <a href=""><span class="btn btn-default btn-sm"><i class="fa fa-plus no-margin"></i></span></a>
                                            <a href=""><span class="btn btn-default btn-sm"><i class="fa fa-eye no-margin"></i></span></a>
                                            <a href=""><span class="btn btn-default btn-sm"><i class="fa fa-edit no-margin"></i></span></a>
                                            <a href="javascript:void(0)"><span class="btn btn-danger btn-sm" ><i class="fa fa-trash no-margin"></i></span></a>
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr>
                                    <td colspan="6" class="text-center">
                                        Create a new allowance by clicking &apos;Create&apos;
                                    </td>
                                </tr>
                            @endif--}}
                            </tbody>
                            <tfoot>
                            <tr>
                                <th class="row">
                                    <div class="datagrid-footer-left col-sm-6 text-center-xs m-l-n" style="display:none;">
                                        <div class="grid-controls m-t-sm">
                                                <span>
                                                    <span class="grid-start"></span> -
                                                    <span class="grid-end"></span> of
                                                    <span class="grid-count"></span>
                                                </span>
                                            <div class="select grid-pagesize dropup" data-resize="auto">
                                                <button data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle">
                                                    <span class="dropdown-label"></span>
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu">
                                                    <li data-value="5"><a href="#">5</a></li>
                                                    <li data-value="10"><a href="#">10</a></li>
                                                    <li data-value="20" data-selected="true"><a href="#">20</a></li>
                                                    <li data-value="50"><a href="#">50</a></li>
                                                    <li data-value="100"><a href="#">100</a></li>
                                                </ul>
                                            </div>
                                            <span>Per Page</span>
                                        </div>
                                    </div>
                                    <div class="datagrid-footer-right col-sm-6 text-right text-center-xs" style="display:none;">
                                        <div class="grid-pager m-r-n">
                                            <button type="button" class="btn btn-sm btn-default grid-prevpage"><i class="fa fa-chevron-left"></i></button>
                                            <span>Page</span>
                                            <div class="inline">
                                                <div class="input-group dropdown combobox">
                                                    <input class="input-sm form-control" type="text">
                                                    <div class="input-group-btn dropup">
                                                        <button class="btn btn-sm btn-default" data-toggle="dropdown"><i class="caret"></i></button>
                                                        <ul class="dropdown-menu pull-right"></ul>
                                                    </div>
                                                </div>
                                            </div>
                                            <span>of <span class="grid-pages"></span></span>
                                            <button type="button" class="btn btn-sm btn-default grid-nextpage"><i class="fa fa-chevron-right"></i></button>
                                        </div>
                                    </div>
                                </th>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </section>
            </section>
        </section>
        <a href="#" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen, open" data-target="#nav,html"></a>
    </section>
    <aside class="bg-light lter b-l aside-md hide" id="notes">
        <div class="wrapper">Notification</div>
    </aside>

@endsection

{{--@section('content')
    <section id="content">    
            <section class="scrollable padder">
                <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
                    <li><a href="."><i class="fa fa-home"></i> Home</a></li>
                    <li class="active">Employees</li>
                </ul>              
               
                @if ( session('success') )
                    <div class="alert alert-success alert-dismissible" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span>
                            <span class="sr-only">Close</span>
                        </button>
                        <strong>{{ session('success') }}</strong>
                    </div>
                @endif
 
                @if (session('error'))
                    <div class="alert alert-danger alert-dismissible" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span>
                            <span class="sr-only">Close</span>
                        </button>
                        <strong>{{ session('error') }}</strong>
                    </div>
                @endif
 
    @if (count($errors) > 0)
        <div class="alert alert-danger">
        <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
        <div>
    @foreach ($errors->all() as $error)
        <p>{{ $error }}</p>
    @endforeach
    </div>
</div>
@endif
<div class=container-fluid>
    <div class=row style="float:right;position:relative">
    <div class=col-md-3 style=width:49.5%>
        <a href="{{ route('export') }}"><button class="btn btn-success">Download Excel xls</button></a>
    </div>
    <div class=col-md-3 style=width:49.5%>
        <form action="{{ route('import') }}" method="POST" enctype="multipart/form-data" id="importForm">
            {{ csrf_field() }}            
            <input type="file" name="file" class="form-control" id="import_file" >        
            <input type="submit" class="btn btn-success" value="Import File" >
        </form>
    </div> 
    </div> 
    <div class=row>
    <legend style="padding:25px 5px 5px 10px">Employees</legend>
    <div class="pull-right" style="margin:5px 20px 5px 10px;">
                <a href="/employees/add" class="btn btn-info btn-sm"><i class="fa fa-plus"></i>Add Employee</a>
              </div>
              </div>
              <div class=row style="padding:0px 5px 5px 10px">
              <div class="table-responsive" style="padding:0px 5px 5px 10px">
                <table class="table table-striped m-b-sm datagrid">
                <thead>
                   <tr>
                      <th>Action</th>
                      <th>First Name</th>
                      <th>Last Name</th>
                      <th>Email</th>
                      <th>Phone No.</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td>
                        <a href=""><span class="btn btn-default btn-sm"><i class="fa fa-eye no-margin"></i></span></a>
                        <a href=""><span class="btn btn-default btn-sm"><i class="fa fa-edit no-margin"></i></span></a>
                        
                    </td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>                               
                  <tr>
                    <td colspan="5" class="text-center">Nothing to display</td>
                  </tr>
                </tbody>
                </table>
              </div>                
    </div>
</div>
</section>
@endsection--}}



@section('footer-include')
    <!-- fuelux -->
    <script src="/js/libs/underscore-min.js"></script>
    <script src="/js/fuelux/fuelux.js"></script>
    {{--<script src="js/fuelux/demo.datagrid.js"></script>--}}
    <!-- select2 -->
@endsection

@section('j-script')
    <!-- Jquery -->
    <script>
        $(document).on('ready', function(){
            var form = document.getElementById('importForm');
            var input = document.getElementById('import_file');
            var change_running = false;
            input.addEventListener('change', function(){
                if(!change_running){
                    setTimeout(function(){
                        change_running = true;
                        form.submit();
                        change_running = false;
                    }, 300);
                }
            });
        });
       
    </script>
@endsection