<div id="bids-view">
    <div class="row bids-fitlers">
        <div class="col-lg-3">
            Search: <input ng-model="searchText" ng-change="filterBids('search')"/>
        </div>
        <div class="col-lg-5">
            Bid type:
            <select ng-change="filterBids(bidType)" ng-model="bidType">
                <option value='all'>All</option>
                <option value='available'>Available</option>
                <option value='used'>Used</option>
                <option value='expired'>Expired</option>
            </select>
        </div>
    </div>
    <div class="row bids-list">
        <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12" ng-repeat="bid in filteredBids">
            <div class="bid-item {{bid.status}}">
                <div class="bid-number">
                    <h4 class="col-lg-12">Bid: {{bid.bidNumber}} <span class="bid-date">( {{bid.startDate}} - {{bid.endDate}} )</span></h4>
                </div>
                <div class="bid-reference">
                    <div class="{{HEADER_COL}}">
                        Package:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.packageName}}
                    </div>

                    <div class="{{HEADER_COL}}">
                        Sold by:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.commercialLead}}
                    </div>

                    <div class="{{HEADER_COL}}">
                        Customer:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.customer}}
                    </div>
                </div>
                <div class="bid-pay-type">
                    <div class="{{HEADER_COL}}">
                        Pay Type:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.payType}}
                    </div>
                </div>
                <div class="bid-price">
                    <div class="{{HEADER_COL}}">
                        Fixed:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.fixedPrice}}
                        <span ng-if="isCommercialLead">+ {{bid.fixedExtra}} = {{(bid.fixedPrice + bid.fixedExtra).toFixed(2)}}</span>
                    </div>

                    <div class="{{HEADER_COL}}">
                        Recurrent:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.recurrentPrice}}
                        <span ng-if="isCommercialLead">+ {{bid.recurrentExtra}} = {{(bid.recurrentPrice + bid.recurrentExtra).toFixed(2)}}</span>
                    </div>

                    <div class="{{HEADER_COL}}">
                        Services:
                    </div>
                    <div class="{{LABEL_COL}}">
                        {{bid.servicesPrice}}
                        <span ng-if="isCommercialLead">+ {{bid.servicesExtra}} = {{(bid.servicesPrice + bid.servicesExtra).toFixed(2)}}</span>
                    </div>
                </div>
                <div class="bid-status">
                    <div class="{{HEADER_COL}} {{bid.status}}-status">
                        Status:
                    </div>
                    <div class="{{LABEL_COL}} {{bid.status}}-status">
                        {{bid.status}}
                    </div>
                </div>
                <div class="supplier-bids">
                    <div class="{{HEADER_COL}}">
                        Supplier Bids:
                    </div>
                    <div class="{{LABEL_COL}}">
                        <div ng-if="bid.supplierBids.length === 0">-</div>
                        <div
                            ng-repeat="supllierBid in bid.supplierBids">
                            {{supllierBid.bidNumber}} {{supllierBid.supplier}} {{supllierBid.productName}},
                        </div>
                    </div>
                </div>
                <?php
                    if($user->getUserType() === USER_TYPES['COMMERCIAL_LEAD']){
                        include('BidsAddMarginButton.php');
                    }
                ?>
                <?php
                    if($user->getUserType() === USER_TYPES['BROKER']){
                        include('BidsRemoveButton.php');
                    }
                ?>
            </div>
        </div>
    </div>
</div>
