<div class="panel panel-default">
    <div class="panel-heading">
        Commandes
    </div>
    <div class="panel-body">
        <table v-if="ordersUpdateArray && ordersUpdateArray.length > 0" class="table table-bordered">
            <thead>
            <tr>
                <th>Date</th>
                <th v-if="taxRateProducer != 0">Montant (TTC)</th>
                <th v-else>Montant</th>
                <th v-if="document.status == 'draft'"></th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="order in ordersUpdateArray">
                <td>{{ order.name }}</td>
                <td>{{ formatPrice(order.amount_with_tax) }}</td>
                <td v-if="document.status == 'draft'">
                    <a class="btn btn-default" href="javascript:void(0);" @click="deleteOrderFromDocument"
                       :data-id="order.id">
                        <span class="glyphicon glyphicon-trash"></span>
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
        <div v-else class="alert alert-warning">Aucune commande associée.</div>

        <div v-if="document.status == 'draft'" id="order-add">
            <div class="col-md-8">
                <select class="form-control" v-model="orderAddId">
                    <option value="0" selected="selected">--</option>
                    <option v-for="order in ordersCreateArray" :value="order.id">
                        {{ order.name }}
                    </option>
                </select>
            </div>
            <div class="col-md-4">
                <button class="btn btn-primary" value="Ajouter" @click="submitOrderAddToDocument">Ajouter</button>
                <button class="btn btn-danger" value="Ignorer" @click="submitOrderIgnoreWhenInvoicing">Ignorer</button>
            </div>
        </div>
    </div>
</div>