<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

    <template id="reason" name="UI for Providing Unsubscription Reasons">
        <div
            id="custom_div_feedback"
            t-attf-class="alert alert-success mt-4 #{extra_class or ''}"
            role="status"
        >
            <p>We would appreciate if you provide feedback about why you updated<br
                />your subscriptions
            </p>
            <div class="col-md-12 mb16">
                <t t-foreach="reasons" 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"
                                required="required"
                            />
                            <t t-esc="reason.display_name" />
                        </label>
                    </div>
                </t>
            </div>
            <textarea class="form-control" name="details" cols="60" rows="3" />
        </div>
    </template>

    <template id="reason_form" name="Unsubscription Reason Form">
        <t t-call="mass_mailing.layout">
            <div class="container o_unsubscribe_form">
                <div class="row">
                    <form
                        id="reason_form"
                        t-attf-action="/mail/mailing/#{mailing_id}/unsubscribe?token=#{token}"
                        method="post"
                        class="col-lg-6 offset-lg-3 mt-4"
                    >
                        <input
                            type="hidden"
                            name="csrf_token"
                            t-att-value="request.csrf_token()"
                        />
                        <input type="hidden" name="email" t-att-value="email" />
                        <input
                            type="hidden"
                            name="mailing_id"
                            t-att-value="mailing_id"
                        />
                        <input type="hidden" name="res_id" t-att-value="res_id" />
                        <t t-call="mass_mailing_custom_unsubscribe.reason" />
                        <div class="form-group mb16 mt16">
                            <button type="submit" class="btn btn-danger">
                                Unsubscribe now
                            </button>
                            <p class="form-text text-muted">Thank you!</p>
                        </div>
                    </form>
                </div>
            </div>
        </t>
    </template>

</odoo>
