<?php
if (
    !isset($permissions['customers']['customers-menu']['customers-last-payments'])
    || isset($permissions['customers']['customers-menu']['customers-last-payments'])
    && $permissions['customers']['customers-menu']['customers-last-payments'] == 0
) redirect('admin/dashboard');
?>
<!-- PAGE RELATED PLUGIN(S) -->
<script src="<?php echo site_url(); ?>assets/js/plugin/datatables1_10_7/jquery.dataTables.min.js"></script>
<script src="<?php echo site_url(); ?>assets/js/plugin/datatables/dataTables.colReorder.min.js"></script>
<script src="<?php echo site_url(); ?>assets/js/plugin/datatables/dataTables.colVis.min.js"></script>
<script src="<?php echo site_url(); ?>assets/js/plugin/datatables/dataTables.tableTools.min.js"></script>
<script src="<?php echo site_url(); ?>assets/js/plugin/datatables/dataTables.bootstrap.min.js"></script>
<script src="<?php echo site_url(); ?>assets/js/plugin/datatable-responsive/datatables.responsive.min.js"></script>

<script src="//cdn.datatables.net/buttons/1.6.1/js/dataTables.buttons.min.js" crossorigin="anonymous"></script>
<script src="//cdn.datatables.net/buttons/1.6.1/js/buttons.flash.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" crossorigin="anonymous"></script>
<script src="//cdn.datatables.net/buttons/1.6.1/js/buttons.html5.min.js" crossorigin="anonymous"></script>
<script src="//cdn.datatables.net/buttons/1.6.1/js/buttons.print.min.js" crossorigin="anonymous"></script>
<script src="//cdn.datatables.net/buttons/1.6.1/js/buttons.colVis.min.js" crossorigin="anonymous"></script>


<!-- MAIN PANEL -->
<div id="main" role="main">

    <!-- MAIN CONTENT -->
    <div id="content">

        <div class="row">
            <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
                <h1 class="page-title txt-color-blueDark">
                    <i class="fa fa-group fa-fw "></i>
                    <?php echo $this->lang->line('customers'); ?>
                    <span>>
                        <?php echo $this->lang->line('all_customers'); ?>
                    </span>
                </h1>
            </div>
            <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right">
                <a class="btn btn-default header-btn" href="<?php print site_url(); ?>admin/customers/customerForm"><i class="fa fa-user"></i> <?php echo $this->lang->line('new_customer'); ?></a>
            </div>
        </div>

        <?php if ($this->session->flashdata('flashMsgType') == 'Success') : ?>
            <div class="alert alert-success fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-check"></i>
                <strong><?php print $this->session->flashdata('flashMsgType') ?></strong> <?php print $this->session->flashdata('flashMsg') ?>
            </div>
        <?php elseif ($this->session->flashdata('flashMsgType') == 'Error') : ?>
            <div class="alert alert-danger fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-times"></i>
                <strong><?php print $this->session->flashdata('flashMsgType') ?></strong> <?php print $this->session->flashdata('flashMsg') ?>
            </div>
        <?php endif; ?>

        <!-- widget grid -->
        <section id="widget-grid" class="">

            <!-- row -->
            <div class="row">

                <!-- NEW WIDGET START -->
                <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

                    <!-- Widget ID (each widget will need unique ID)-->
                    <div class="jarviswidget jarviswidget-color-darken" id="wid-id-0" data-widget-editbutton="false" data-widget-editbutton="false" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false">
                        <!-- widget options:
						usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

						data-widget-colorbutton="false"
						data-widget-editbutton="false"
						data-widget-togglebutton="false"
						data-widget-deletebutton="false"
						data-widget-fullscreenbutton="false"
						data-widget-custombutton="false"
						data-widget-collapsed="true"
						data-widget-sortable="false"

						-->
                        <header>
                            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
                            <span class="widget-icon"> <i class="fa fa-group"></i> </span>
                            <h2> <?php echo $this->lang->line('all_customers'); ?></h2>

                        </header>

                        <!-- widget div-->
                        <div class="table-responsive">

                            <!-- widget edit box -->
                            <div class="jarviswidget-editbox">
                                <!-- This area used as dropdown edit box -->

                            </div>
                            <!-- end widget edit box -->

                            <!-- widget content -->
                            <div class="widget-body no-padding">
                                <div class="widget-body-toolbar">

                                </div>


                            </div>
                            <!-- end widget content -->

                        </div>
                        <!-- end widget div -->

                    </div>
                    <!-- end widget -->

                </article>
                <!-- WIDGET END -->

                <article class="col-sm-2 col-md-2 col-lg-2" style="display:none !important;">

                    <!-- Widget ID (each widget will need unique ID)-->
                    <div class="jarviswidget jarviswidget-color-purple" id="wid-id-1" data-widget-editbutton="false" data-widget-colorbutton="false" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-fullscreenbutton="false" data-widget-custombutton="false" data-widget-sortable="false">

                        <header>
                            <span class="widget-icon"> <i class="fa fa-lg fa-wrench"></i> </span>
                            <h2><?php echo $this->lang->line('actions'); ?> </h2>

                        </header>

                        <!-- widget div-->
                        <div>

                            <!-- widget edit box -->
                            <div class="jarviswidget-editbox">
                                <!-- This area used as dropdown edit box -->

                            </div>
                            <!-- end widget edit box -->

                            <!-- widget content -->
                            <div class="widget-body">
                                <a class="btn btn-primary btn-block" id="changeTaskStatus"><?php echo $this->lang->line('change_password'); ?></a>
                                <a class="btn btn-success btn-block header-btn" id="sendSmsBulk"><i class="fa fa-envelope-o"></i> <?php echo $this->lang->line('Sending'); ?> SMS </a>
                                <a class="btn btn-default btn-block selectAllCB"><?php echo $this->lang->line('cursor_all'); ?></a>
                                <a class="btn btn-default btn-block unselectAllCB"><?php echo $this->lang->line('choice_remove'); ?></a>
                                <hr />
                                <a class="btn btn-danger btn-block" id="deleteCustomer"><i class="fa fa-trash-o"></i> <?php echo $this->lang->line('erasure'); ?></a>
                            </div>
                            <!-- end widget content -->

                        </div>
                        <!-- end widget div -->

                    </div>
                    <!-- end widget -->

                </article>

            </div>
            <!-- end row -->

        </section>
        <!-- end widget grid -->

    </div>
    <!-- END MAIN CONTENT -->

</div>

<style>
    .dt-buttons {
        float: left;
        text-align: right;
    }

    .dt-button {
        background: transparent;
        border: 1px solid #a90329;
        padding: 5px;
        padding-right: 20px;
        padding-left: 20px;
        font-weight: bold;
        border-radius: 25px;
        color: #a90329;
    }

    .dt-button-collection .dt-button {
        background: #ffffff;
        float: right;
        opacity: 0.5;
    }

    .dt-button-collection {
        margin-top: 7px;
        position: absolute;
        z-index: 9999;
        background: #0000007a;
        width: 140%;
        right: 100px;
        padding: 7px;
        border-radius: 25px;
    }

    button.dt-button.buttons-columnVisibility.active {
        background: white;
        opacity: 1;
    }
</style>
<script>
    <?php
    $url = '';
    if ($this->session->userdata('site_lang') == 'hebrew') {
        $url = '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Hebrew.json';
    } else if ($this->session->userdata('site_lang') == 'arabic') {
        $url = '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Arabic.json';
    } else if ($this->session->userdata('site_lang') == 'english') {
        $url = '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/English.json';
    } else {
        $url = '//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Hebrew.json';
    }
    ?>
    $(document).ready(function() {

        var oTbl1 = $('#dt_basic44').DataTable({
            dom: 'Bfrtip',
            buttons: ['copyHtml5', 'excelHtml5', 'csvHtml5', 'colvis'],
            "sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6'f><'dt-buttons col-sm-6 col-xs-12 hidden-xs'l>r>" +
                "t" +
                "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>",
            "processing": true,
            //"serverSide": true,
            //"ajax": root + 'admin/ajax/getDataForTable',
            "bStateSave": true,
            "fnStateSave": function(oSettings, oData) {
                localStorage.setItem('DataTables_' + window.location.pathname, JSON.stringify(oData));
            },
            "fnStateLoad": function(oSettings, oData) {
                return JSON.parse(localStorage.getItem('DataTables_' + window.location.pathname));
            },
            "pagingType": "full_numbers",
            "lengthMenu": [
                [10, 25, 50, -1],
                [10, 25, 50, "<?php echo $this->lang->line('Everything'); ?>"]
            ],
            "pageLength": 20,
            "sPaginationType": "full_numbers",
            "iDisplayLength": 10,
            "language": {
                "url": "<?php echo $url; ?>"
            },
            orderCellsTop: true,
            fixedHeader: true
        });

        oTbl1.buttons().container()
            .appendTo('.dataTables_filter');

        $('input[aria-controls="dt_basic2"]').attr('placeholder', '<?php echo $this->lang->line('search1'); ?>...');

        $('#dt_basic2_info').css('float', 'left').parent().css('float', 'left');
        $('.dataTables_paginate ').parent().css('float', 'right');
        $('.dataTables_paginate ').css('text-align', 'right');

        $('#dt_basic_wrapper').addClass("table-responsive");
        $('#dt_basic').css("z-index", "9999");

    });
</script>