top_bar.xml 8.12 KB
Newer Older
Arturo Jasso Origel committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">

    <t t-inherit="web.NavBar" t-inherit-mode="extension" owl="1">
        <xpath expr="//nav[hasclass('o_main_navbar')]" position="replace">
      <nav class="o_main_navbar d-flex justify-content-between"
           t-on-dropdown-item-selected="onNavBarDropdownItemSelection"
           data-command-category="navbar">
          <div class="d-flex">
              <div class="top_heading">
                <!-- Apps Menu -->
                  <t t-call="web.NavBar.AppsMenu">
                 <t t-set="apps" t-value="menuService.getApps()"/>
                </t>
                  <!-- App Brand -->
                  <MenuItem t-if="currentApp"
                            href="getMenuItemHref(currentApp)"
                            payload="currentApp"
                            t-esc="currentApp.name"
                            class="o_menu_brand"
                            t-ref="menuBrand"
                  />
              </div>

              <!-- Current App Sections -->
              <div class="d-none d-md-block">
                  <t t-if="currentAppSections.length"
                     t-call="web.NavBar.SectionsMenu">
                    <t t-set="sections" t-value="currentAppSections"/>
                  </t>
              </div>
              <div class="d-xs-block d-sm-block  d-md-none">
                  <t t-call="web.NavBar.SectionsMenu.MoreDropdown">
                      <t t-set="sections" t-value="currentAppSections"/>
                  </t>
              </div>
        </div>
          <!-- Systray -->
          <div class="o_menu_systray" role="menu">
          <t t-foreach="systrayItems" t-as="item" t-key="item_index">
            <NotUpdatable>
                <ErrorHandler onError="error => handleItemError(error, item)">
                    <t t-component="item.Component" t-props="item.props"/>
                </ErrorHandler>
            </NotUpdatable>
          </t>
        </div>
      </nav>
            <div class="sidebar_panel" id="sidebar_panel">
                <div class="sidebar">
                    <div class="sidebar_close">
                        <a id="closeSidebar" style="cursor: pointer;">
                            <img src="/code_backend_theme/static/src/img/icons/close.png"/>
                        </a>
                    </div>
56
                    
Arturo Jasso Origel committed
57 58 59
                    <h6 class="sidebar_head">MENU</h6>
                    <ul class="sidebar_menu">
                        <t t-foreach="menuService.getApps()" t-as="app">
60
                            <t t-if="app.name == 'Mesa de ayuda' or app.name == 'Ajustes'">
61 62 63 64 65 66 67 68 69 70 71 72 73 74
                                <li data-toggle="tooltip" data-placement="right" t-att-title="app.name">
                                    <a role="menuitem"
                                        t-attf-href="#menu_id={{app.id}}"
                                        class="nav-link"
                                        
                                        >
                                        <img class="sidebar_img"
                                            t-attf-src="data:image/png;base64,{{app.webIconData}}"/>
                                        <span class="sidebar_app_name">
                                            <t t-esc="app.name"/>
                                        </span>
                                        
                                    </a>
                                </li>
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
                            </t>
                            <t t-else="">
                                <li data-toggle="tooltip" data-placement="right" t-att-title="app.name" groups="vista_backend_theme.show_all_apps">
                                    <a role="menuitem"
                                        t-attf-href="#menu_id={{app.id}}"
                                        class="nav-link"
                                        
                                        >
                                        <img class="sidebar_img"
                                            t-attf-src="data:image/png;base64,{{app.webIconData}}"/>
                                        <span class="sidebar_app_name">
                                            <t t-esc="app.name"/>
                                        </span>
                                        
                                    </a>
                                </li>
                            </t>
Arturo Jasso Origel committed
92 93 94
                        </t>
                    </ul>
                </div>
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
                <script>
                    
                   
                    odoo.define('vista_backend_theme.user', function(require) {
                        "use strict";
                    
                        var session = require('web.session');
                        var rpc = require('web.rpc');
                        var user_id = session.uid;
                        
                        console.log('El ID de usuario actual es:', user_id);


                        rpc.query({
                            model: 'res.users',
                            method: 'apps_permission',
                            args: [user_id],
                        }).then(function(resultado) {
                            if (resultado != 'show'){
                                $('.sidebar_menu li').each(function() {
                                    var titulo = $(this).attr('title');
                                    if (titulo == 'Mesa de ayuda' || titulo == 'Ajustes' || titulo == 'Aplicaciones'){
                                        console.log(titulo);
                                    }else{
                                    $(this).addClass('d-none');
                                    }
                            
                                });
                            }
                            
                            
                        });

                        
                        if (user_id != 2){
                            $('.sidebar_menu li').each(function() {
                                var titulo = $(this).attr('title');
                                if (titulo == 'Mesa de ayuda' || titulo == 'Ajustes' || titulo == 'Aplicaciones'){
                                    console.log(titulo);
                                }else{
                                $(this).addClass('d-none');
                                }
                        
                            });
                        }
                    });
                    


                    /**/
                        
                        

                    
                </script>
Arturo Jasso Origel committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
    </div>
    </xpath>
  </t>
    <t t-inherit="web.NavBar.AppsMenu" t-inherit-mode="extension" owl="1">
            <xpath expr="//Dropdown[hasclass('o_navbar_apps_menu')]"
                   position="replace">
                <li class="dropdown">
                    <a id="openSidebar"
                       style="display: block; cursor: pointer;">
                        <div class="c_sidebar_active">
                            <div class="c_dots_menu"/>
                        </div>
                    </a>
                    <a id="closeSidebar"
                       style="display: none; cursor: pointer;">
                        <div class="c_sidebar_passive">
                             <div class="c_dots_menu_toggled "/>
                        </div>
                    </a>
                </li>
            </xpath>
        </t>
        <t t-inherit="mail.MessagingMenu" t-inherit-mode="extension" owl="1">
        <xpath expr="//i[hasclass('o_MessagingMenu_icon')]" position="replace">
             <img src="/vista_backend_theme/static/src/img/icons/speech-bubble.png" width="22" height="22" aria-label="Messages"/>
        </xpath>
        </t>

        <t t-inherit="mail.systray.ActivityMenu" t-inherit-mode="extension" owl="1">
            <xpath expr="//i[hasclass('fa-clock-o')]" position="replace">
                <img src="/vista_backend_theme/static/src/img/icons/bell.png" width="22" height="22" aria-label="Activities"/>
            </xpath>
        </t>

</templates>