<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->

    <!-- Main content -->
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-green">
                    <div class="inner">
                        <h3><?php echo $total_cats[0]['count'] ?></h3>

                        <p>Total Categories</p>
                    </div>
                    <div class="icon">
                        <i class="fa fa-bookmark-o"></i>
                    </div>
                    <a href="<?php echo BASE_URL . "categories/getAll"; ?>" class="small-box-footer">More info <i
                                class="fa fa-arrow-circle-right"></i></a>
                </div>
            </div>
            <!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3><?php echo $total_branches[0]['count'] ?></h3>

                        <p>Total Branches</p>
                    </div>
                    <div class="icon">
                        <i class="fa fa-university"></i>
                    </div>
                    <a href="<?php echo BASE_URL . "branches/getAll"; ?>" class="small-box-footer">More info <i
                                class="fa fa-arrow-circle-right"></i></a>
                </div>
            </div>
            <!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-yellow">
                    <div class="inner">
                        <h3><?php echo ($total_employees[0]['count'] !== NULL) ? $total_employees[0]['count'] : 0; ?></h3>

                        <p>Total Employee</p>
                    </div>
                    <div class="icon">
                        <i class="fa fa-user-secret"></i>
                    </div>
                    <a href="<?php echo BASE_URL . "employee/getAll"; ?>" class="small-box-footer">More info <i
                                class="fa fa-arrow-circle-right"></i></a>
                </div>
            </div>
            <!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-red">
                    <div class="inner">
                        <h3><?php echo ($total_messages[0]['count'] !== NULL) ? $total_messages[0]['count'] : 0; ?></h3>

                        <p>Total Message</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-chatboxes"></i>
                    </div>
                    <a href="<?php echo BASE_URL . "messages/getAll"; ?>" class="small-box-footer">More info <i
                                class="fa fa-arrow-circle-right"></i></a>
                </div>
            </div>
            <!-- ./col -->
        </div>
        <!-- /.row -->

        <!-- start row for companies -->
        <div class="row">

            <div class="col-md-6">
                <!-- Application buttons -->
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">Information </h3>
                    </div>
                    <div class="box-body">

                        <a href="<?php echo BASE_URL . "categories/getAll"; ?>" class="btn btn-app">
                            <span class="badge bg-yellow"><?php echo $total_cats[0]['count'] ?></span>
                            <i class="fa fa-bookmark-o"></i> Categories
                        </a>
                        <a href="<?php echo BASE_URL . "branches/getAll"; ?>" class="btn btn-app">
                            <span class="badge bg-yellow"><?php echo $total_branches[0]['count'] ?></span>
                            <i class="fa fa-university"></i> Branches
                        </a>


                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>

            <div class="col-md-6">
                <!-- Application buttons -->
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">Information </h3>
                    </div>
                    <div class="box-body">

                        <a href="<?php echo BASE_URL . "employee/getAll"; ?>" class="btn btn-app">
                            <span class="badge bg-yellow"><?php echo $total_employees[0]['count'] ?></span>
                            <i class="fa fa-user-secret"></i> Employees
                        </a>



                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>

        </div>
        <!-- /.row -->
        <!-- end row for companies -->


        <!-- start row for shortcuts -->
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <i class="fa fa-gift"></i>

                        <h3 class="box-title">Shortcuts</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i
                                        class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i
                                        class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body">

                        <!-- Small boxes (Stat box) -->
                        <div class="row divs_for_data">

                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "slider/add" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "slider.png" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "slider/add" ?>">Add
                                                Slider</a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->

                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "categories/add" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "agent.png" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "categories/add" ?>">Add
                                                Category</a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->
                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "offer/add" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "dolly-512.png" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "offer/add" ?>">Add
                                                Product</a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->
                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "employee/add" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "download.png" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "employee/add" ?>">Add
                                                Employee</a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->
                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "messages/getAll" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "Circle-icons-creditcard.svg.png" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "messages/getAll" ?>">Messages
                                                </a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->
                            <!-- start col -->
                            <div class="col-lg-2 col-xs-6">
                                <!-- small box -->
                                <div class="small-box shortcut_div">
                                    <div class="inner">
                                        <div class="text-center shortcut_img">
                                            <a href="<?php echo BASE_URL . "setting/edit" ?>"><img
                                                        src="<?php echo IMAGES_BACK_END_LINK . "setting.jpg" ?>"
                                                        class="img-responsive"/></a>
                                        </div>
                                        <h3 class="text-center"><a href="<?php echo BASE_URL . "setting/edit" ?>">Edit
                                                Setting</a></h3>
                                    </div>
                                </div>
                            </div>
                            <!-- end col -->


                        </div>
                        <!-- /.row -->
                    </div>
                    <!-- /.box-body-->
                </div>
                <!-- /.box -->
            </div>

        </div>
        <!-- /.row -->
        <!-- end row for shortcuts -->

        <div class="row">
            <div class="col-lg-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title ">Show Last 5 Messages</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="adminform">
                        <div class="text-center">
                            <span onclick="exportToexcel('#all_data')" class="btn btn-success export-btn">Export To Excel</span>
                        </div>

                        <!-- form start -->
                        <table id="all_data"
                               class="table table_for_data table-striped table-bordered dt-responsive nowrap tableData"
                               cellspacing="0" width="100%">
                            <thead>
                            <tr>
                                <th>Id</th>
                                <th>User Name</th>
                                <th>User Email</th>
                                <th>action</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php
                            if (isset($sum_messages) && is_array($sum_messages)) {
                                foreach ($sum_messages as $key => $data) {
                                    echo '<tr id="row' . $data['id'] . '">
                                              <td>' . $data['id'] . '</td>
                                              <td>' . $data['name'] . '</td>
                                              <td>' . $data['mail'] . '</td>
                                           ';

                                    echo '</td>
                                              <td>
                                                  <ul class="actions">
                                                   <li><a href="' . BASE_URL . "messages/show_selected/" . $data['id'] . '" class="" id="' . $data['id'] . '"  title="View"><i class="fa fa-eye" aria-hidden="true"></i></a></li>
                                                  </ul>
                                              </td>
                                            </tr>';
                                }
                            } else {
                                echo '<tr><td colspan="4">No Data Found</td></tr>';
                            }
                            ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>


    </section><!-- /.content -->
</div><!-- /.content-wrapper -->


<script>

    $(function () {
        /*
         * payments CHART
         * ---------
         */

        var bar_data = {
            data: [['<?php echo $before3Day ?>', <?php echo ($before3DayCalls[0]['call'] == NULL) ? 0 : $before3DayCalls[0]['call'];  ?>], ['<?php echo $before2Day ?>', <?php echo ($before2DayCalls[0]['call'] == NULL) ? 0 : $before2DayCalls[0]['call'];  ?>],
                ['<?php echo $before1Day ?>', <?php echo ($before1DayCalls[0]['call'] == NULL) ? 0 : $before1DayCalls[0]['call'];  ?>], ['<?php echo $today_date ?>', <?php echo ($today_calls_count[0]['call'] == NULL) ? 0 : $today_calls_count[0]['call'];  ?>],
            ],
            color: '#3c8dbc'
        }
        $.plot('#bar-chart', [bar_data], {
            grid: {
                borderWidth: 1,
                borderColor: '#f3f3f3',
                tickColor: '#f3f3f3'
            },
            series: {
                bars: {
                    show: true,
                    barWidth: 0.5,
                    align: 'center'
                }
            },
            xaxis: {
                mode: 'categories',
                tickLength: 0
            }
        })

        /* END Orders CHART */
        /*
         * DONUT CHART
         * -----------
         */

        var donutData = [
            {label: ' Active', data: <?php echo $activeUsersCount ?>, color: '#3c8dbc'},
            {label: 'Not Active', data: <?php echo $unActiveUsersCount ?>, color: '#0073b7'},
        ]
        $.plot('#donut-chart', donutData, {
            series: {
                pie: {
                    show: true,
                    radius: 1,
                    innerRadius: 0.5,
                    label: {
                        show: true,
                        radius: 2 / 3,
                        formatter: labelFormatter,
                        threshold: 0.1
                    }

                }
            },
            legend: {
                show: false
            }
        })

        /*
         * END DONUT CHART
         */

        /*
         * Orders CHART
         * ---------
         */


        function labelFormatter(label, series) {
            return '<div style="font-size:13px; text-align:center; padding:2px; color: #fff; font-weight: 600;">'
                + label
                + '<br>'
                + Math.round(series.percent) + '%</div>'
        }

    })

</script>
