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

<template name="Unsubscription worked"
          id="success"
          page="True">
    <t t-call="website.layout">
        <div id="wrap" class="oe_structure oe_empty">
            <section class="jumbotron mt16 mb16">
                <div class="container">
                    <h1>
                        You were successfully unsubscribed from our
                        mailing list.
                    </h1>
                    <h3 class="text-muted">
                        It's sad to see you go, but if you love
                        something, let it go.
                    </h3>
                    <p>
                        Is there anything else you want to tell us?
                    </p>
                    <p>
                        <a class="btn btn-primary btn-lg"
                           href="/page/contactus">Contact us</a>
                    </p>
                </div>
            </section>
        </div>
    </t>
</template>

<template name="Unsubscription failed"
          id="failure"
          page="True">
    <t t-call="website.layout">
        <div id="wrap" class="oe_structure oe_empty">
            <section class="jumbotron mt16 mb16">
                <div class="container">
                    <h1>
                        There was an error processing your unsubscription
                        request.
                    </h1>
                    <p>
                        We apologize for the inconvenience. You can contact us
                        and we will handle your unsubscription manually.
                    </p>
                    <p>Thanks for your patience.</p>
                    <p>
                        <a class="btn btn-primary btn-lg"
                           href="/page/contactus">Contact us</a>
                    </p>
                </div>
            </section>
        </div>
    </t>
</template>

<template id="reason_form"
          name="Unsubscription Reason Form">
    <t t-call="website.layout">
        <div id="wrap" class="oe_structure oe_empty">
            <section class="mt16 mb16">
                <form
                    id="reason_form"
                    class="container"
                    t-attf-action="/mail/mailing/#{mailing_id.id}/unsubscribe"
                    method="post">
                    <div class="row">
                        <div class="col-md-12 text-center mt16 mb32">
                            <h2>
                                Hello,
                                <t t-esc="contact_name"/>
                            </h2>
                            <h3 class="text-muted">
                                You are trying to unsubscribe from all massive mailings
                                <t t-if="origin_name">
                                    sent to followers of
                                    <br/>
                                    <br/>
                                    <i><span>"</span><t t-esc="origin_name"/><span>"</span></i>
                                </t>
                            </h3>
                        </div>
                        <div t-if="additional_contact_ids"
                             class="col-md-12 mt16">
                            Is there any other mailing list you want to leave?
                            <t t-foreach="additional_contact_ids"
                               t-as="contact">
                                <div class="checkbox">
                                    <label>
                                        <input
                                            t-attf-name="list_id,#{contact.list_id.id}"
                                            type="checkbox"
                                            t-att-value="contact.id"/>
                                        <t t-esc="contact.list_id.display_name"/>
                                    </label>
                                </div>
                            </t>
                        </div>
                        <div class="col-md-12 mt16">
                            But before continuing, could you please tell us why do you want to unsubscribe?
                        </div>
                        <div class="col-md-12 mb16">
                            <input
                                type="hidden"
                                name="db"
                                t-att-value="env.cr.dbname"/>
                            <input
                                type="hidden"
                                name="res_id"
                                t-att-value="res_id"/>
                            <input
                                type="hidden"
                                name="email"
                                t-att-value="email"/>
                            <input
                                type="hidden"
                                name="token"
                                t-att-value="token"/>
                            <t t-foreach="reason_ids" t-as="reason">
                                <div class="radio">
                                    <label>
                                        <input
                                            type="radio"
                                            name="reason_id"
                                            t-att-data-details-required="reason.details_required"
                                            t-att-value="reason.id"/>
                                        <t t-esc="reason.display_name"/>
                                    </label>
                                </div>
                            </t>
                            <div t-attf-class="form-group #{error_details_required and 'has-error' or ''}">
                                <textarea
                                    name="details"
                                    class="form-control"
                                    placeholder="Anything else you want to say before you leave?"
                                    rows="3"/>
                            </div>
                            <div class="form-group mb16 mt16">
                                <button type="submit" class="btn btn-danger">
                                    Unsubscribe now
                                </button>
                                <p class="help-block">Thank you!</p>
                            </div>
                        </div>
                    </div>
                </form>
            </section>
        </div>
    </t>
</template>

</data>
</openerp>
