<?php echo $this->render_table_name(); ?>
<?php if ($this->is_create or $this->is_csv or $this->is_print): ?>
        
    <div class="xcrud-top-actions">
        
        <?php if ($this->tabulator_active): ?>
            <div class="dropdown pull-right">
                <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <i class="material-icons">print</i> Print/Download 
                </button>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                    <a class="dropdown-item" href="javascript:void(0);" id="print-table">Print Table</a>
                    <a class="dropdown-item" href="javascript:void(0);" id="download-csv">Download CSV</a>
                    <a class="dropdown-item" href="javascript:void(0);" id="download-json">Download JSON</a>
                    <a class="dropdown-item" href="javascript:void(0);" id="download-xlsx">Download XLSX</a>
                    <a class="dropdown-item" href="javascript:void(0);" id="download-pdf">Download PDF</a>
                    <a class="dropdown-item" href="javascript:void(0);" id="download-html">Download HTML</a>
                </div>
            </div>
        <?php else: ?>
            <div class="btn-group pull-right">
                <?php if ($this->advanced_search_active): ?>
                    <a class="xcrud-advanced-search-toggle mdl-button mdl-js-button mdl-button--raised mdl-button--accent" href="javascript:;">
                        <i class="material-icons">search</i>
                        Advanced Search
                    </a>
                <?php endif; ?>
                
                <?php 
                    echo $this->refresh_button('mdl-button mdl-js-button mdl-button--raised mdl-button--primary', 'material-icons refresh');
                    echo $this->print_button('mdl-button mdl-js-button mdl-button--raised mdl-button--primary', 'material-icons print');
                    echo $this->csv_button('mdl-button mdl-js-button mdl-button--raised mdl-button--primary', 'material-icons file_download');
                ?>
            </div>            
        <?php endif; ?>
        
        <?php echo $this->add_button('mdl-button mdl-js-button mdl-button--raised mdl-button--primary', 'material-icons add'); ?>
        <div class="clearfix"></div>
    </div>

    <?php if ($this->advanced_search_position == "top"): ?>
        <?php echo $this->render_advanced_filter(); ?>
    <?php endif; ?>

    <div class="row" style="margin: 0!important;overflow-x: scroll;">
        <?php if ($this->advanced_search_position == "left"): ?>
            <div class="col-sm-3">
                <?php echo $this->render_advanced_filter(); ?>
            </div>
        <?php endif; ?>

        <div class="xcrud-list-container <?php if ($this->is_edit_side) { echo 'col-sm-12'; } if ($this->advanced_search_position == "left" && $this->advanced_search_opened == true) { echo 'col-sm-9'; } ?>">
            <?php if (!$this->tabulator_active): ?>
                <?php if ($this->panel_view): ?>
                    <table class="xcrud-list mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                        <thead>
                            <?php echo $this->render_grid_head('div', 'span'); ?>
                        </thead>
                        <tbody>
                            <?php echo $this->render_grid_body_panels('div', 'span'); ?>
                        </tbody>
                        <tfoot>
                            <?php echo $this->render_grid_footer('div', 'span'); ?>
                        </tfoot>
                    </table>
                <?php else: ?>
                    <table class="xcrud-list mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                        <thead>
                            <?php echo $this->render_grid_head('tr', 'th'); ?>
                        </thead>
                        <tbody>
                            <?php echo $this->render_grid_body('tr', 'td'); ?>
                        </tbody>
                        <tfoot>
                            <?php echo $this->render_grid_footer('tr', 'td'); ?>
                        </tfoot>
                    </table>
                <?php endif; ?>
            <?php else: ?>
                <table class="xcrud-list-2 mdl-data-table mdl-js-data-table mdl-shadow--2dp">
                    <thead>
                        <!-- Content will be populated by Tabulator -->
                    </thead>
                </table>   
                <table class="xcrud-list mdl-data-table mdl-js-data-table mdl-shadow--2dp" style="width:100%;">
                    <!-- Content will be populated by Tabulator -->
                </table>
            <?php endif; ?>
        </div>

        <!-- Side Edit Mode -->
        <?php if ($this->is_edit_side): ?>
            <div class="col-sm-5 edit_side_panel"></div>
        <?php endif; ?>

        <div class="xcrud-nav mdl-grid">
            <?php echo $this->render_limitlist(true); ?>
            <?php echo $this->render_pagination(); ?>
            <?php echo !$this->tabulator_active ? $this->render_search() : $this->render_search_tabulator(); ?>
            <?php echo $this->render_benchmark(); ?>
        </div>  

        <?php if ($this->tabulator_active): ?>
            <?php include("xcrud_tabulator.php"); ?>
        <?php endif; ?>
    </div>         
<?php endif; ?>
