<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">Marketplace - Parts</h3>
                </div>

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

            <!--LEFT COLUMN ADVERTISEMENTS PLACEHOLDER FOR REVISION2 -->            
<!--            <div class="panel panel-default">       
                <div class="panel-body">
                    ADD PLACEHOLDER
                </div>                
            </div>  -->

        </div>


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

                    <p>IAEA incorporated the component trade on the same e-commerce cloud to integrate every aspect of the trade in the aircraft engine industry. Similar to engine marketplace, the asking price and component’s paperwork have been included to eliminate placeholders and advocate online trading. The IAEA’s Marketplace will eliminate 100s of phone calls, email and fax communications for component transactions to take place and provide visibility to market pricing like a stock market. Sellers can upload their inventories using an upload template while buyers can post their inquiries for a better response especially in case of AOG. The advantage of the IAEA’s Marketplace is that it brings a focus to engine components that have longer trading value and life than airframe components.</p>

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

        <div class="col-md-10">
            <div class="panel panel-default">
                <div class="panel-heading">Parts

                </div>

                <?php
                $attributes = array(
                    'class' => 'form-horizontal',
                    'id' => 'submit'
                );
                ?>

                <?php echo form_open('', $attributes); ?>

                <!--Mid panel body-->        
                <div class="panel-body">

                    <div id="response"></div>

                    <?php echo validation_errors('<p class="alert alert-dismissable alert-danger">'); ?>

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


                    <table style="font-size: 13px;" class="table table-bordered table-hover table-condensed">
                        <thead>
                            <tr>
                                <th <?php if ($sort_by == 'part_number') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/part_number/" .
                                            (($sort_order == 'asc' && $sort_by == 'part_number') ? 'desc' : 'asc'), 'Part Number: ');
                                    ?></th>
                                <th <?php if ($sort_by == 'part_description') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/part_description/" .
                                            (($sort_order == 'asc' && $sort_by == 'part_description') ? 'desc' : 'asc'), 'Part Description: ');
                                    ?></th>
                                <th <?php if ($sort_by == 'part_condition') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/part_condition/" .
                                            (($sort_order == 'asc' && $sort_by == 'part_condition') ? 'desc' : 'asc'), 'Part Condition: ');
                                    ?></th>
                                <th <?php if ($sort_by == 'enginep_model') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/enginep_model/" .
                                            (($sort_order == 'asc' && $sort_by == 'enginep_model') ? 'desc' : 'asc'), 'Engine Model: ');
                                    ?></th>
                                <th <?php if ($sort_by == 'tag') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/tag/" .
                                            (($sort_order == 'asc' && $sort_by == 'tag') ? 'desc' : 'asc'), 'Tag: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'quantity') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/quantity/" .
                                            (($sort_order == 'asc' && $sort_by == 'quantity') ? 'desc' : 'asc'), 'Quantity: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'lister') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/lister/" .
                                            (($sort_order == 'asc' && $sort_by == 'lister') ? 'desc' : 'asc'), 'Lister: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'transaction') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/transaction/" .
                                            (($sort_order == 'asc' && $sort_by == 'transaction') ? 'desc' : 'asc'), 'Transaction: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'asking_price') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/asking_price/" .
                                            (($sort_order == 'asc' && $sort_by == 'asking_price') ? 'desc' : 'asc'), 'Asking Price: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'available_date') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/available_date/" .
                                            (($sort_order == 'asc' && $sort_by == 'available_date') ? 'desc' : 'asc'), 'Available Date: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'contact_name') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/contact_name/" .
                                            (($sort_order == 'asc' && $sort_by == 'contact_name') ? 'desc' : 'asc'), 'Contact Name: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'email') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/email/" .
                                            (($sort_order == 'asc' && $sort_by == 'email') ? 'desc' : 'asc'), 'Email: ');
                                    ?></th>
                                <th class="hidden-xs" <?php if ($sort_by == 'phone') echo "id=\"sort_$sort_order\"" ?>><?php
                                    echo anchor("epc_listings/market_listings/p_listings/phone/" .
                                            (($sort_order == 'asc' && $sort_by == 'phone') ? 'desc' : 'asc'), 'Phone: ');
                                    ?></th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if (!empty($plistings)) { ?> 
                                <?php foreach ($plistings as $plist) : ?>
                                    <tr>
                                        <td><a href="<?php echo base_url(); ?>epc_listings/market_listings/display_plisting/<?php echo $plist->list_id; ?>"><?php echo $plist->part_number; ?></a></td>
                                        <td><?php echo substr($plist->part_description, 0, 25); ?></td>
                                        <td><?php echo $plist->part_condition; ?></td>
                                        <td><?php echo $plist->enginep_model; ?></td>
                                        <td><?php echo $plist->tag; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->quantity; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->lister; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->transaction; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->asking_price; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->available_date; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->first_name ." ".$plist->last_name; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->email; ?></td>
                                        <td class="hidden-xs"><?php echo $plist->phone; ?></td>

                                        <td>
                                            <a href="<?php echo $plist->list_id; ?>" data-va="<?php echo $plist->email; ?>" data-id="<?php echo $plist->list_id; ?>"><i class="glyphicon glyphicon-envelope"></i></a>
                                        </td>         
                                    </tr>

                                <?php endforeach; ?>
                            <?php } ?>

                        </tbody>
                    </table>         
                </div>

                <?php echo form_close(); ?>


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

                            <?php if (!empty($pstart) && !empty($pend)) { ?>

                                Showing: <span id="label" class="label"><?php echo $pstart; ?> to <?php echo $pend; ?> of <?php echo $p_results_total; ?> entries</span>

                            <?php } ?>
                        </div> 
                        <div class="col-md-7 pull-right">
                            <div id ="pgcol" class="pgPaginate" id="paginateInfo">
                                <?php if (!empty($plinks)): ?>

                                    <?php echo $plinks; ?>

                                <?php endif; ?>

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

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