@extends('adminlte::page')
@section('content')
    <?php Fun::lang() ?>
    <div class="title-page">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                <li><a href="#">Agency</a></li>
                <li><a href="#">View Commission Group</a></li>
            </ul>
        </div>
    </div>

    <div class="page">

        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3>View Commission Group</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body table-responsive">
            <table id="datatable_commission_list" class="table table-striped table-bordered table-hover nowrap">
                <thead>
                <tr>
                    <th>No</th>
                    <th>Client Name</th>
                    <th>Agency Name</th>
                    <th>Commission</th>
                    <th>Commission Receive</th>
                </tr>
                </thead>
                <tbody>
                <?php $total_sum = 0; ?>
                <?php $total_sum_re = 0; ?>
                <?php $i = 1; ?>

                <?php foreach ($data as $row): ?>

                <tr>
                    <td><?php echo $i; ?></td>
                    <td><?php echo $row->client_name; ?></td>
                    <td><?php echo $row->agency_name; ?></td>
                    <td><?php echo '$ '. number_format($row->amount, 2); ?></td>
                    <td><?php echo '$ '. number_format($row->receive, 2); ?></td>
                </tr>
                <?php $i++; ?>
                <?php $total_sum += $row->amount; ?>
                <?php $total_sum_re += $row->receive; ?>

                <?php endforeach; ?>
                </tbody>
                <tfoot>

                <tr>

                    <td colspan="3" align="right">Total:</td>
                    <td>
                        <?php echo '$ '. number_format($total_sum, 2); ?>
                    </td>
                    <td>
                        <?php echo '$ '. number_format($total_sum_re, 2); ?>
                    </td>
                </tr>

                </tfoot>
            </table>
        </div>
    </div>
@endsection