<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

    <t t-name="project.ProjectTaskControlPanel" t-inherit="web.ControlPanel">
        <xpath expr="//button[@name='embedded_actions']" position="replace">
            <t t-if="showTaskOptions and !env.isSmall or env.isSmall and !state.embeddedInfos.embeddedActions?.length">
                <Dropdown>
                    <button class="btn btn-secondary" t-att-title="taskOptionsTitle">
                        <i class="fa fa-sliders"/>
                    </button>
                    <t t-set-slot="content">
                        <DropdownItem onSelected="() => this.onClickShowSubtasks()" class="state.showSubtasks ? 'selected' : ''">
                            Show Sub-Tasks
                        </DropdownItem>
                        <DropdownItem t-if="state.embeddedInfos.embeddedActions?.length and !env.isSmall"
                            class="state.embeddedInfos.showEmbedded ? 'selected' : ''"
                            onSelected="() => this.onClickShowEmbedded()"
                        >
                            Top Menu
                        </DropdownItem>
                    </t>
                </Dropdown>
            </t>
        </xpath>
         <xpath expr="//t[@t-if='state.embeddedInfos.embeddedActions?.length and env.isSmall']" position="replace">
            <t t-call="project.MobileCombinedActionsDropdown"/>
        </xpath>
    </t>

   <t t-name="project.MobileCombinedActionsDropdown">
        <t t-if="env.isSmall and state.embeddedInfos.embeddedActions?.length">
            <Dropdown menuClass="'o_combined_mobile_dropdown'">
                <button class="btn btn-secondary">
                    <i class="fa fa-sliders" />
                </button>
                <t t-set-slot="content">
                    <DropdownItem
                        onSelected="() => this.onClickShowSubtasks()"
                        class="state.showSubtasks ? 'selected' : ''"
                    >
                        Show Sub-Tasks
                    </DropdownItem>
                    <div role="separator" class="dropdown-divider"/>
                    <t t-if="state.embeddedInfos.embeddedActions?.length">
                        <t t-foreach="state.embeddedInfos.embeddedActions" t-as="action" t-key="action.id">
                            <DropdownItem
                                class="this.getDropdownClass(action)"
                                onSelected="() => this.onEmbeddedActionClick(action)"
                            >
                                <span t-out="action.name" />
                            </DropdownItem>
                        </t>
                    </t>
                </t>
            </Dropdown>
        </t>
    </t>

</templates>
