| 1 |
<?xml version="1.0" encoding="UTF-8" ?> |
| 2 |
<templates xml:space="preserve"> |
| 3 |
|
| 4 |
<t t-name="web.NavBar"> |
| 5 |
<header class="o_navbar" t-ref="root"> |
| 6 |
<nav |
| 7 |
class="o_main_navbar d-print-none" |
| 8 |
data-command-category="disabled" |
| 9 |
> |
| 10 |
|
| 11 |
<t t-call="web.NavBar.AppsMenu"> |
| 12 |
<t t-set="apps" t-value="menuService.getApps()" /> |
| 13 |
</t> |
| 14 |
|
| 15 |
|
| 16 |
<DropdownItem |
| 17 |
t-if="!env.isSmall and currentApp" |
| 18 |
t-esc="currentApp.name" |
| 19 |
class="'o_menu_brand d-flex'" |
| 20 |
onSelected="() => this.onNavBarDropdownItemSelection(currentApp)" |
| 21 |
attrs="{ href: getMenuItemHref(currentApp), 'data-menu-xmlid': currentApp.xmlid, 'data-section': currentApp.id }" |
| 22 |
/> |
| 23 |
|
| 24 |
<div class="o_navbar_breadcrumbs d-contents"/> |
| 25 |
|
| 26 |
<t t-if="!env.isSmall"> |
| 27 |
|
| 28 |
<t t-if="currentAppSections.length" t-call="web.NavBar.SectionsMenu"> |
| 29 |
<t t-set="sections" t-value="currentAppSections" /> |
| 30 |
</t> |
| 31 |
</t> |
| 32 |
|
| 33 |
|
| 34 |
<div class="o_menu_systray d-flex flex-shrink-0 ms-auto bg-inherit" role="menu"> |
| 35 |
<t t-foreach="systrayItems" t-as="item" t-key="item.key"> |
| 36 |
|
| 37 |
<div t-att-data-index="item.index"/> |
| 38 |
<ErrorHandler onError="error => this.handleItemError(error, item)"> |
| 39 |
<t t-component="item.Component" t-props="item.props"/> |
| 40 |
</ErrorHandler> |
| 41 |
</t> |
| 42 |
</div> |
| 43 |
</nav> |
| 44 |
</header> |
| 45 |
</t> |
| 46 |
|
| 47 |
<t t-name="web.SectionMenu"> |
| 48 |
<li class="px-3" t-if="section.childrenTree.length"> |
| 49 |
<div class="bg-transparent" |
| 50 |
t-att-class="{ |
| 51 |
'fw-bolder text-900 pt-3 pb-2': !isNested, |
| 52 |
'border-top': !isNested && subMenu_index != 0, |
| 53 |
'py-2': isNested, |
| 54 |
}" |
| 55 |
t-att-data-menu-xmlid="section.xmlid" t-esc="section.name"/> |
| 56 |
<ul class="list-unstyled ps-0"> |
| 57 |
<t t-foreach="section.childrenTree" t-as="subSection" t-key="subSection_index"> |
| 58 |
<t t-call="web.SectionMenu"> |
| 59 |
<t t-set="section" t-value="subSection"/> |
| 60 |
<t t-set="isNested" t-value="true"/> |
| 61 |
</t> |
| 62 |
</t> |
| 63 |
</ul> |
| 64 |
</li> |
| 65 |
<li t-else="" t-on-click="() => this._onMenuClicked(section)" t-att-data-menu-xmlid="section.xmlid" |
| 66 |
t-att-class="{ |
| 67 |
'fw-bold text-900 py-3': !isNested, |
| 68 |
'border-top': !isNested && subMenu_index != 0, |
| 69 |
'py-2': isNested, |
| 70 |
}"> |
| 71 |
<t t-esc="section.name"/> |
| 72 |
</li> |
| 73 |
</t> |
| 74 |
|
| 75 |
<t t-name="web.NavBar.AppsMenu"> |
| 76 |
<t t-if="env.isSmall"> |
| 77 |
<a href="/odoo" class="o_menu_toggle border-0" t-att-class="{'hasImage': currentApp?.webIconData}" accesskey="h" t-ref="menuApps" t-on-click.prevent="_openAppMenuSidebar"> |
| 78 |
<t t-call="web.NavBar.AppsMenu.Sidebar"/> |
| 79 |
</a> |
| 80 |
</t> |
| 81 |
<t t-else=""> |
| 82 |
<div t-if="!isScopedApp" class="o_navbar_apps_menu"> |
| 83 |
<Dropdown> |
| 84 |
<button data-hotkey="h" title="Home Menu"> |
| 85 |
<i class="oi oi-apps" /> |
| 86 |
</button> |
| 87 |
<t t-set-slot="content"> |
| 88 |
<DropdownItem |
| 89 |
t-foreach="apps" |
| 90 |
t-as="app" |
| 91 |
t-key="app.id" |
| 92 |
class="{ 'o_app': true, focus: menuService.getCurrentApp() === app }" |
| 93 |
onSelected="() => this.onNavBarDropdownItemSelection(app)" |
| 94 |
t-esc="app.name" |
| 95 |
attrs="{ href: getMenuItemHref(app), 'data-menu-xmlid': app.xmlid, 'data-section': app.id }" |
| 96 |
/> |
| 97 |
</t> |
| 98 |
</Dropdown> |
| 99 |
</div> |
| 100 |
<div t-else="" class="mx-2"/> |
| 101 |
</t> |
| 102 |
</t> |
| 103 |
|
| 104 |
<t t-name="web.NavBar.AppsMenu.Sidebar"> |
| 105 |
<i class="fa fa-bars" aria-hidden="true"/> |
| 106 |
<t t-portal="'body'"> |
| 107 |
<Transition name="'o-app-menu-sidebar'" visible="state.isAppMenuSidebarOpened" leaveDuration="200" t-slot-scope="transition"> |
| 108 |
<div class="o_app_menu_sidebar position-fixed top-0 bottom-0 end-100 d-flex flex-column flex-nowrap" t-att-class="transition.className" t-on-touchstart.stop="_onSwipeStart" t-on-touchend.stop="_onSwipeEnd"> |
| 109 |
<div class="o_sidebar_topbar d-flex align-items-center justify-content-between flex-shrink-0 py-0 fs-4"> |
| 110 |
<small class="d-flex align-items-center justify-content-between ms-2"> |
| 111 |
<a href="/odoo" class="btn btn-primary" t-on-click.prevent="onAllAppsBtnClick"><i class="oi oi-apps"></i><span class="px-2">All Apps</span></a> |
| 112 |
</small> |
| 113 |
<button class="o_sidebar_close oi oi-close btn d-flex align-items-center h-100 bg-transparent border-0 fs-2 text-reset" aria-label="Close menu" title="Close menu" t-on-click.stop="_closeAppMenuSidebar"/> |
| 114 |
</div> |
| 115 |
<nav class="o_burger_menu_content flex-grow-1 flex-shrink-1 overflow-auto o_burger_menu_app"> |
| 116 |
<div t-if="!state.isAllAppsMenuOpened and currentApp" class="d-flex align-items-center m-3 mb-0"> |
| 117 |
<img style="height: 2em;" t-if="currentApp.webIconData" class="o_app_icon me-2" t-attf-src="{{currentApp.webIconData}}"/> |
| 118 |
<span class="fs-4 fw-bolder"><t t-esc="currentApp.name"/></span> |
| 119 |
</div> |
| 120 |
<ul class="list-unstyled py-2 ps-0 mb-0"> |
| 121 |
<t t-if="!state.isAllAppsMenuOpened"> |
| 122 |
<t t-foreach="currentAppSections" t-as="subMenu" t-key="subMenu_index"> |
| 123 |
<t t-call="web.SectionMenu"> |
| 124 |
<t t-set="section" t-value="subMenu" /> |
| 125 |
</t> |
| 126 |
</t> |
| 127 |
</t> |
| 128 |
|
| 129 |
<t t-else=""> |
| 130 |
<t t-foreach="apps" t-as="app" t-key="app_index"> |
| 131 |
<li t-att-data-menu-xmlid="app.xmlid" class="o_app fw-bolder py-2" t-att-class="{'bg-primary-subtle': menuService.getCurrentApp() === app}" t-on-click="() => {this.onNavBarDropdownItemSelection(app); this._closeAppMenuSidebar();}"> |
| 132 |
<div class="d-flex align-items-center"> |
| 133 |
<img style="height: 3em;" t-if="app.webIconData" class="o_app_icon me-2" t-attf-src="{{app.webIconData}}"/> |
| 134 |
<t t-esc="app.name"/> |
| 135 |
</div> |
| 136 |
</li> |
| 137 |
</t> |
| 138 |
</t> |
| 139 |
</ul> |
| 140 |
</nav> |
| 141 |
</div> |
| 142 |
</Transition> |
| 143 |
<div t-if="state.isAppMenuSidebarOpened" class="modal-backdrop show d-block d-md-none" t-on-click.stop="_closeAppMenuSidebar" t-on-touchstart.stop="_onSwipeStart" t-on-touchend.stop="_onSwipeEnd" /> |
| 144 |
</t> |
| 145 |
</t> |
| 146 |
|
| 147 |
<t t-name="web.NavBar.SectionsMenu"> |
| 148 |
<div class="o_menu_sections d-flex flex-grow-1 flex-shrink-1 w-0" t-ref="appSubMenus" role="menu"> |
| 149 |
<t t-if="!env.isSmall"> |
| 150 |
<DropdownGroup> |
| 151 |
<t t-foreach="sections" t-as="section" t-key="section.id"> |
| 152 |
<t |
| 153 |
t-set="sectionsVisibleCount" |
| 154 |
t-value="(sections.length - currentAppSectionsExtra.length)" |
| 155 |
/> |
| 156 |
|
| 157 |
<t t-if="section_index lt Math.min(10, sectionsVisibleCount)"> |
| 158 |
<t t-set="hotkey" t-value="((section_index + 1) % 10).toString()" /> |
| 159 |
</t> |
| 160 |
<t t-else=""> |
| 161 |
<t t-set="hotkey" t-value="undefined" /> |
| 162 |
</t> |
| 163 |
|
| 164 |
<t t-if="!section.childrenTree.length"> |
| 165 |
<DropdownItem |
| 166 |
class="'o_nav_entry'" |
| 167 |
onSelected="() => this.onNavBarDropdownItemSelection(section)" |
| 168 |
t-esc="section.name" |
| 169 |
attrs="{ |
| 170 |
href: getMenuItemHref(section), |
| 171 |
'data-hotkey': hotkey, |
| 172 |
'data-menu-xmlid': section.xmlid, |
| 173 |
'data-section': section.id, |
| 174 |
}" |
| 175 |
/> |
| 176 |
</t> |
| 177 |
<t t-else=""> |
| 178 |
<Dropdown> |
| 179 |
<button t-att-data-hotkey="hotkey" t-att-data-menu-xmlid="section.xmlid"> |
| 180 |
<span t-esc="section.name" t-att-data-section="section.id" /> |
| 181 |
</button> |
| 182 |
<t t-set-slot="content"> |
| 183 |
<t t-call="web.NavBar.SectionsMenu.Dropdown.MenuSlot"> |
| 184 |
<t t-set="items" t-value="section.childrenTree" /> |
| 185 |
<t t-set="decalage" t-value="20" /> |
| 186 |
</t> |
| 187 |
</t> |
| 188 |
</Dropdown> |
| 189 |
</t> |
| 190 |
</t> |
| 191 |
|
| 192 |
<t t-if="currentAppSectionsExtra.length" t-call="web.NavBar.SectionsMenu.MoreDropdown"> |
| 193 |
<t t-set="sections" t-value="currentAppSectionsExtra" /> |
| 194 |
<t t-if="sectionsVisibleCount lt 10"> |
| 195 |
<t t-set="hotkey" t-value="(sectionsVisibleCount + 1 % 10).toString()" /> |
| 196 |
</t> |
| 197 |
</t> |
| 198 |
</DropdownGroup> |
| 199 |
</t> |
| 200 |
</div> |
| 201 |
</t> |
| 202 |
|
| 203 |
<t t-name="web.NavBar.DropdownItem" t-inherit="web.DropdownItem" t-inherit-mode="primary"> |
| 204 |
<xpath expr="//t[@t-tag]" position="attributes"> |
| 205 |
<attribute name="t-att-style">props.style</attribute> |
| 206 |
</xpath> |
| 207 |
</t> |
| 208 |
|
| 209 |
<t t-name="web.NavBar.SectionsMenu.Dropdown.MenuSlot"> |
| 210 |
<t t-set="style" t-value="`padding-left: ${decalage}px;`" /> |
| 211 |
<t t-foreach="items" t-as="item" t-key="item.id"> |
| 212 |
<DropdownItem |
| 213 |
t-if="!item.childrenTree.length" |
| 214 |
class="{ |
| 215 |
'dropdown-item': true, |
| 216 |
o_dropdown_menu_group_entry: decalage gt 20 |
| 217 |
}" |
| 218 |
t-esc="item.name" |
| 219 |
onSelected="() => this.onNavBarDropdownItemSelection(item)" |
| 220 |
attrs="{ style: style, href: getMenuItemHref(item), 'data-menu-xmlid': item.xmlid, 'data-section': item.id }" |
| 221 |
/> |
| 222 |
|
| 223 |
<t t-else=""> |
| 224 |
<div class="dropdown-menu_group dropdown-header" t-att-style="style" t-esc="item.name" /> |
| 225 |
<t t-call="web.NavBar.SectionsMenu.Dropdown.MenuSlot"> |
| 226 |
<t t-set="items" t-value="item.childrenTree" /> |
| 227 |
<t t-set="decalage" t-value="decalage + 12" /> |
| 228 |
</t> |
| 229 |
</t> |
| 230 |
</t> |
| 231 |
</t> |
| 232 |
|
| 233 |
<t t-name="web.NavBar.SectionsMenu.MoreDropdown"> |
| 234 |
<div class="o_menu_sections_more"> |
| 235 |
<Dropdown> |
| 236 |
<button title="More Menu" t-att-data-hotkey="hotkey"> |
| 237 |
<i class="fa fa-plus"/> |
| 238 |
</button> |
| 239 |
|
| 240 |
<t t-set-slot="content"> |
| 241 |
<t t-foreach="sections" t-as="section" t-key="section.id"> |
| 242 |
<t t-if="!section.childrenTree.length"> |
| 243 |
<DropdownItem |
| 244 |
class="'o_more_dropdown_section'" |
| 245 |
onSelected="() => this.onNavBarDropdownItemSelection(section)" |
| 246 |
t-esc="section.name" |
| 247 |
attrs="{ href: getMenuItemHref(section), 'data-menu-xmlid': section.xmlid, 'data-section': section.id }" |
| 248 |
/> |
| 249 |
</t> |
| 250 |
<t t-else=""> |
| 251 |
<div |
| 252 |
class="o_more_dropdown_section o_more_dropdown_section_group dropdown-header bg-100" |
| 253 |
t-esc="section.name" |
| 254 |
/> |
| 255 |
<t t-call="web.NavBar.SectionsMenu.Dropdown.MenuSlot"> |
| 256 |
<t t-set="items" t-value="section.childrenTree" /> |
| 257 |
<t t-set="decalage" t-value="20" /> |
| 258 |
</t> |
| 259 |
</t> |
| 260 |
</t> |
| 261 |
</t> |
| 262 |
</Dropdown> |
| 263 |
</div> |
| 264 |
</t> |
| 265 |
|
| 266 |
</templates> |