<div class="container">
    <div class="row">
        <div class="col-md-2">
            <div class="panel panel-default">

                <!--Left panel heading-->
                <div class="panel-heading">
                    <h3 class="panel-title">My Listings</h3>
                </div>

                <!--Left panel body-->
                <div class="panel-body">
                    <ul class="nav nav-pills nav-stacked">
                        <li class="active"><a href="<?php echo base_url(); ?>epc_listings/listings/my_engines_list">
                                <span class="badge pull-right"><?php echo $total; ?></span>
                                Total Engines</a></li>
                        <li><a href="<?php echo base_url(); ?>epc_listings/listings/my_engine_parts_list">
                                <span class="badge pull-right"><?php echo $ptotal; ?></span>
                                Total Parts</a></li>
                    </ul>


                    <div class="panel-group" id="accordion">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
                                        Export to PDF
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseOne" class="panel-collapse collapse">
                                <div class="panel-body">

                                    <?php echo form_open('epc_listings/exporter/create_pdf_engines'); ?>

                                    <div class="form-group">
                                        <label class="radio-inline">
                                            <input id="inlineradio1" name="sampleinlineradio" type="radio" value="Monthly" <?php echo set_radio('sampleinlineradio', 'Monthly', TRUE); ?>>
                                            Monthly</label>
                                    </div>
                                    <div class="form-group">
                                        <label class="radio-inline">
                                            <input id="inlineradio2" name="sampleinlineradio" type="radio" value="Weekly" <?php echo set_radio('sampleinlineradio', 'Weekly'); ?>>
                                            Weekly</label>
                                    </div>

                                    <div class="form-group">
                                        <div  id="btnMrgn" class="col-sm-8">
                                            <button type="submit" class="btn btn-primary btn-xs">Export 
                                                <i class="glyphicon glyphicon-download"></i></button>
                                        </div>
                                    </div>

                                    <?php echo form_close(); ?>

                                </div>
                            </div>
                        </div>
                    </div>



                </div>
            </div>          
        </div>

        <!--Mid panel heading-->
        <div class="col-md-10">
            <div class="panel panel-default">
                <div class="panel-heading">Engines

                    <div class="pull-right">
                        <a href="<?php echo base_url(); ?>epc_listings/listings/add_listing"><button type="button" class="btn btn-primary btn-xs">Add New Engine 
                                <i class="glyphicon glyphicon-log-in"></i></button></a>
                    </div>
                </div>

                <!--Mid panel body-->        
                <div class="panel-body">
                    
                    <?php if ($this->session->flashdata('engine_added')) : ?>
                    <p class="alert alert-dismissable alert-success"><?php echo $this->session->flashdata('engine_added'); ?></p>
                    <?php endif; ?>
                    <?php if ($this->session->flashdata('engine_updated')) : ?>
                        <p class="alert alert-dismissable alert-success"><?php echo $this->session->flashdata('engine_updated'); ?></p>
                    <?php endif; ?>

                    <?php if ($this->session->flashdata('engine_deleted')) : ?>
                        <p class="alert alert-dismissable alert-success"><?php echo $this->session->flashdata('engine_deleted'); ?></p>
                    <?php endif; ?>

                    <table  style="font-size: 13px;" class="table-responsive table-bordered table-hover table-condensed">
                        <thead>
                            <tr>
                                <th class="col-md-2" <?php if ($sort_by == 'manufacturer') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/manufacturer/" .
                                            (($sort_order == 'asc' && $sort_by == 'manufacturer') ? 'desc' : 'asc'), 'Manufacturer: ');
                                    ?></th>
                                <th class="col-md-1" <?php if ($sort_by == 'engine_model') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/engine_model/" .
                                            (($sort_order == 'asc' && $sort_by == 'engine_model') ? 'desc' : 'asc'), 'Engine Model: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'esn') echo "id=\"sort_$sort_order\"" ?>><?php
                                echo anchor("epc_listings/listings/my_engines_list/esn/" .
                                        (($sort_order == 'asc' && $sort_by == 'esn') ? 'desc' : 'asc'), 'ESN: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'lister') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/lister/" .
                                            (($sort_order == 'asc' && $sort_by == 'lister') ? 'desc' : 'asc'), 'Lister: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'transaction') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/transaction/" .
                                            (($sort_order == 'asc' && $sort_by == 'transaction') ? 'desc' : 'asc'), 'Transaction: ');
                                    ?></th>
                                <th class="hidden-xs col-md-2" <?php if ($sort_by == 'location') echo "id=\"sort_$sort_order\"" ?>><?php
                                echo anchor("epc_listings/listings/my_engines_list/location/" .
                                        (($sort_order == 'asc' && $sort_by == 'location') ? 'desc' : 'asc'), 'Location: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'asking_price') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/asking_price/" .
                                            (($sort_order == 'asc' && $sort_by == 'asking_price') ? 'desc' : 'asc'), 'Asking Price: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'monthly_rent') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/monthly_rent/" .
                                            (($sort_order == 'asc' && $sort_by == 'monthly_rent') ? 'desc' : 'asc'), 'Monthly Rent: ');
                                    ?></th>
                                <th class="hidden-xs col-md-1" <?php if ($sort_by == 'available_date') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/listings/my_engines_list/available_date/" .
                                (($sort_order == 'asc' && $sort_by == 'available_date') ? 'desc' : 'asc'), 'Available Date: ');
                                    ?></th>
                                <th colspan="2"></th>
                            </tr>
                        </thead>
                        <tbody>
<?php if (!empty($listings)) { ?> 
    <?php foreach ($listings as $list) : ?>
                                    <tr>
                                        <td><a href="<?php echo base_url(); ?>epc_listings/listings/display_listing/<?php echo $list->list_id; ?>"><?php echo $list->manufacturer; ?></a></td>
                                        <td><?php echo $list->engine_model; ?></td>
                                        <td class="hidden-xs"><?php echo $list->esn; ?></td>
                                        <td class="hidden-xs"><?php echo $list->lister; ?></td>
                                        <td class="hidden-xs"><?php echo $list->transaction; ?></td>
                                        <td class="hidden-xs"><?php echo $list->location; ?></td>
                                        <td class="hidden-xs"><?php echo $list->asking_price; ?></td>
                                        <td class="hidden-xs"><?php echo $list->monthly_rent; ?></td>
                                        <td class="hidden-xs"><?php echo $list->available_date; ?></td>
                                        <td>
                                            <a href="<?php echo base_url(); ?>epc_listings/listings/edit_listing/<?php echo $list->list_id; ?>"><i class="glyphicon glyphicon-edit"></i></a>
                                        </td>
                                        <td>
                                            <a data-confirm="Are you sure you want to delete?" href="<?php echo base_url(); ?>epc_listings/listings/delete_listing/<?php echo $list->list_id; ?>"><i style="left: 0px" class="glyphicon glyphicon-trash"></i></a>    
                                        </td>
                                    </tr>
    <?php endforeach; ?>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>

                <!--Mid panel footer-->
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-md-4">

<?php if (!empty($start) && !empty($end)) { ?>

                                Showing: <span id="label" class="label"><?php echo $start; ?> - <?php echo $end; ?> of <?php echo $total; ?> entries</span>

<?php } ?>
                        </div> 
                        <div class="col-md-7 pull-right">
                            <div id ="pgcol" class="pgPaginate" id="paginateInfo"> 
<?php echo $links; ?>
                            </div>
                        </div>
                    </div>  
                </div>


            </div>
        </div>
    </div>
</div>
