@extends('admin.layouts.app')

@section('contentSection')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <div class="pull-left"><i class="fa fa-table"></i> Agents (<span id="module_total_count"></span>)
                    </div>
                    <div class="pull-right">
                        <button type="button" data-toggle="modal" data-target="#addAgentModal" class="btn btn-primary">
                            <i
                                class="fa fa-plus"></i> Add Agent
                        </button>
                    </div>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="agentListTable" class="table table-bordered" style="width: 100%"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop
@section('pageSpecificScripts')
    @include('admin.agents.agentListTemplate')
    @include('admin.agents.profileDetailsTemplate')
    @include('admin.agents.modals.profileModal')
    @include('admin.agents.modals.addAgentModal')
    @include('admin.agents.modals.editAgentModal')
    <script src="{{ asset('back_assets/assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js')}}"></script>
    <script src="{{ asset('back_assets/assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js')}}"></script>
    <script src="{{asset('back_assets/assets/plugins/alerts-boxes/js/sweetalert.min.js')}}"></script>
    <script src="{{ asset('back_assets/assets/js/app/agentsScript.js')}}?{{ app_version()}} "></script>
    @if (Session::has('aerrors'))
        <script type="text/javascript">
            swal({
                html: "true",
                title: "",
                text: "<ul style='text-align: left;list-style: disc;margin-left: 0;'>@foreach (Session::get('aerrors') as $error) <li>{{ $error }}</li> @endforeach</ul>",
                type: "error"
            }, function () {
                $("#addUserModal").modal('show');
            });
        </script>
    @endif
    @if (Session::has('asuccess'))
        <script type="text/javascript">
            swal({
                title: "",
                text: '{{Session::get('asuccess')}}',
                type: "success"
            });
        </script>
    @endif
    @if (Session::has('berrors'))
        <script type="text/javascript">
            swal({
                html: "true",
                title: "",
                text: "<ul style='text-align: left;list-style: disc;margin-left: 0;'>@foreach (Session::get('berrors') as $error) <li>{{ $error }}</li> @endforeach</ul>",
                type: "error"
            });
        </script>
    @endif
    @if (Session::has('bsuccess'))
        <script type="text/javascript">
            swal({
                title: "",
                text: '{{Session::get('bsuccess')}}',
                type: "success"
            });
        </script>
    @endif
@stop
