@extends('admin.layouts.master')

@section('title')
    Cash Advance Balance
@stop

@section('style')

@stop

@section('content')
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <span class="fa fa-trello"></span> Managers Cash Advance Balance
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-users"></i> Admin Panel</a></li>
                <li class="active">Cash Advance Balance</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content" style=" padding-bottom: 100%;">
            <div class="page-header">
                {{--<a href="{{route('advances.new')}}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> New Cash Advance</a>--}}
            </div>

            <table class="table table-hover" id="user_table" width="100%">
                <thead>
                <tr style="background: grey ;color:#fff; font-weight: bold">
                    <td>ID</td>
                    <td>Unit Manager</td>
                    <td>C/A Amount</td>
                    <td>C/A Payment</td>
                    <td>Balance</td>
                    <td>Actions</td>
                </tr>
                </thead>
                @foreach($cas as $ca)
                    <tr >
                        <td>{{$ca->umanager_id}}</td>
                        {{--<td width="12%">{{date("d-M-Y", strtotime($ca->ca_date))}}</td>--}}
                        <td width="35%">{{$ca->fullname}}</td>
                        <td style="text-align: right">{{number_format($ca->ca_amount,2)}}</td>
                        <td style="text-align: right">{{number_format($ca->ttl_payment_adv,2)}}</td>
                        <td style="text-align: right">{{number_format($ca->bal_,2)}}</td>
                        <td class="btn btn-default ">
                            <a href="#" class="btn btn-primary btn-xs"><i class="fa fa-eye"></i> View </a>
                        </td>
                    </tr>
                    @endforeach
            </table>
            @if(Session('info'))
                <div class="row">
                    <div class="col-md-6 col-md-offset-3 text-center">
                        <div class="tem alert alert-success navbar-fixed-bottom"><span class="glyphicon glyphicon-ok-circle"></span> {{Session('info')}}</div>
                    </div>
                </div>
            @endif
        </section>

    </div>
@stop

@section('script')
<script>
        $(document).ready(function() {
            $('#user_table').DataTable( {
                "bDestroy": true,
                /*searching: true,
                paging: true,
                lengthChange: true,
                pageLength: 10,
                info: true,
                orderable: true,*/
                "order": [[ 0, "desc" ]]
            } );
        } );

        /*$("#btnAdd").on("click", function(){
            $('#addModal').modal('toggle');
        });*/
    </script>
@stop