<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record id="view_send_to_mod_wizard_form" model="ir.ui.view">
        <field name="name">fusion_claims.send.to.mod.wizard.form</field>
        <field name="model">fusion_claims.send.to.mod.wizard</field>
        <field name="arch" type="xml">
            <form string="Send to March of Dimes">
                <field name="send_mode" invisible="1"/>
                <field name="sale_order_id" invisible="1"/>

                <!-- Mode banners -->
                <div class="alert alert-info mb-3" invisible="send_mode != 'drawing'">
                    <i class="fa fa-pencil-square-o"/>
                    Attach drawing and photos, preview the quotation, then send to the client.
                </div>
                <div class="alert alert-info mb-3" invisible="send_mode != 'quotation'">
                    <i class="fa fa-paper-plane"/> Re-send quotation documents.
                </div>
                <div class="alert alert-success mb-3" invisible="send_mode != 'completion'">
                    <i class="fa fa-camera"/>
                    Attach completion photos and proof of delivery, then send to the case worker.
                </div>

                <!-- Recipients -->
                <group>
                    <field name="recipient_ids" widget="many2many_tags"
                           string="To"
                           options="{'no_create': False, 'no_quick_create': False}"
                           placeholder="Select recipients..."/>
                    <field name="cc_ids" widget="many2many_tags"
                           string="CC"
                           options="{'no_create': False, 'no_quick_create': False}"
                           placeholder="Select CC contacts..."/>
                </group>

                <separator string="Documents"/>

                <!-- DRAWING MODE -->
                <group invisible="send_mode != 'drawing'" col="2">
                    <group string="Drawing (required)">
                        <field name="drawing_file" filename="drawing_filename"
                               required="send_mode == 'drawing'" string="File"/>
                        <field name="drawing_filename" invisible="1"/>
                    </group>
                    <group string="Initial Photos">
                        <field name="initial_photos_file" filename="initial_photos_filename"
                               string="File"/>
                        <field name="initial_photos_filename" invisible="1"/>
                    </group>
                </group>

                <!-- QUOTATION MODE -->
                <group invisible="send_mode != 'quotation'" col="4">
                    <field name="include_quotation" widget="boolean_toggle"/>
                    <field name="include_drawing" widget="boolean_toggle"/>
                    <field name="include_initial_photos" widget="boolean_toggle"/>
                </group>

                <!-- COMPLETION MODE -->
                <group invisible="send_mode != 'completion'" col="2">
                    <group string="Completion Photos (required)">
                        <field name="completion_photos_file" filename="completion_photos_filename"
                               required="send_mode == 'completion'" string="File"/>
                        <field name="completion_photos_filename" invisible="1"/>
                    </group>
                    <group string="Proof of Delivery (required)">
                        <field name="pod_file" filename="pod_filename"
                               required="send_mode == 'completion'" string="File"/>
                        <field name="pod_filename" invisible="1"/>
                    </group>
                </group>

                <group>
                    <field name="additional_notes" placeholder="Optional notes..."/>
                </group>

                <footer>
                    <button name="action_preview_quotation" type="object"
                            class="btn-secondary" icon="fa-eye"
                            string="Preview Quotation"
                            invisible="send_mode == 'completion'"/>
                    <button name="action_send" type="object"
                            class="btn-primary" icon="fa-paper-plane">
                        <span invisible="send_mode != 'drawing'">Send Quotation</span>
                        <span invisible="send_mode != 'quotation'">Send</span>
                        <span invisible="send_mode != 'completion'">Submit POD</span>
                    </button>
                    <button string="Cancel" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>

    <record id="action_send_to_mod_wizard" model="ir.actions.act_window">
        <field name="name">Send to March of Dimes</field>
        <field name="res_model">fusion_claims.send.to.mod.wizard</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>
</odoo>
