<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <template id="cart_delivery" name="Delivery Costs" inherit_id="website_sale.total">
        <xpath expr="//tr[@id='order_total_taxes']" position="after">
            <tr class="text-muted" id="order_delivery">
                <td><abbr title="Delivery will be updated after choosing a new delivery method">Delivery:</abbr></td>
                <td class="text-right">
                    <span t-field="website_sale_order.amount_delivery" t-field-options='{
                        "widget": "monetary",
                        "display_currency": "website.pricelist_id.currency_id"
                    }'/>
                </td>
            </tr>
        </xpath>
    </template>

    <template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop">
      <xpath expr="." position="inside">
        <script type="text/javascript" src="/website_sale_delivery/static/src/js/website_sale_delivery.js"></script>
      </xpath>
    </template>

    <template id="payment_delivery" name="Delivery Costs" inherit_id="website_sale.payment">
        <xpath expr="//div[@id='payment_method']" position="before">
            <div t-if="deliveries" class="row" id="delivery_carrier">
                <div class="col-lg-5 col-sm-6">
                <h4>Choose your Delivery Method</h4>
                    <ul class="list-unstyled">
                        <li t-foreach="deliveries" t-as="delivery">
                            <t t-if="delivery.available">
                                <label>
                                    <input t-att-value="delivery.id" type="radio" name="delivery_type"
                                        t-att-checked="order.carrier_id and order.carrier_id.id == delivery.id and 'checked' or False"/>
                                    <span t-field="delivery.name"/>
                                    <span class="badge" t-field="delivery.price"
                                        t-field-options='{
                                            "widget": "monetary",
                                            "display_currency": "website.pricelist_id.currency_id"
                                        }'/>
                                    <div t-field="delivery.website_description" class="text-muted"/>
                                </label>
                            </t>
                        </li>
                    </ul>
                </div>
            </div>
        </xpath>
    </template>

</data>
</openerp>
