Files
Autoparts-DB/pos/static/js/sidebar.min.js
consultoria-as b803950fae chore(assets): regenerate minified JS bundles
- customers.min.js, fleet.min.js, inventory.min.js, pos-utils.min.js,
  sidebar.min.js, virtual-scroll.min.js
2026-04-29 06:31:25 +00:00

1 line
7.5 KiB
JavaScript

!function(){"use strict";var e="function"==typeof window.t?window.t:function(e){return e},t=window.POS_USER||{},n=t.name||"Usuario",a=t.roleLabel||"",i=t.initials||"?",o=window.location.pathname,s=localStorage.getItem("pos_theme")||"industrial",r=localStorage.getItem("pos_lang")||"es",l=[{label:e("nav_main"),items:[{name:e("dashboard"),href:"/pos/dashboard",icon:'<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>'},{name:e("pos"),href:"/pos/sale",icon:'<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/>'},{name:e("catalog"),href:"/pos/catalog",icon:'<path d="M4 6h16M4 10h16M4 14h16M4 18h16"/>'},{name:e("inventory"),href:"/pos/inventory",icon:'<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'}]},{label:e("nav_management"),items:[{name:e("customers"),href:"/pos/customers",icon:'<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"/>'},{name:"Cotizaciones",href:"/pos/quotations",icon:'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="9" y1="15" x2="15" y2="15"/><line x1="12" y1="12" x2="12" y2="18"/>'},{name:"Marketplace",href:"/pos/marketplace",icon:'<circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/>'},{name:e("invoicing"),href:"/pos/invoicing",icon:'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/>'},{name:e("accounting"),href:"/pos/accounting",icon:'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>'},{name:e("reports"),href:"/pos/reports",icon:'<line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/>'},{name:e("fleet"),href:"/pos/fleet",icon:'<path d="M1 13h22M1 13l2-6h6l2 6M9 7h6l2 6M15 13l2-6M5 17a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM19 17a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/>'},{name:e("whatsapp"),href:"/pos/whatsapp",icon:'<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>'}]},{label:e("nav_system"),items:[{name:e("config"),href:"/pos/config",icon:'<circle cx="12" cy="12" r="3"/><path d="M19.07 4.93a10 10 0 0 1 0 14.14M4.93 4.93a10 10 0 0 0 0 14.14"/>'}]}];var c="";l.forEach((function(e){c+='<div class="nav-section-label">'+e.label+"</div>",e.items.forEach((function(e){var t=o===e.href;c+='<a class="nav-item'+(t?" is-active":"")+'" href="'+e.href+'"'+(t?' aria-current="page"':"")+">"+('<svg class="nav-item__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">'+e.icon+"</svg><span>")+e.name+"</span></a>"}))}));var d='<div class="sidebar__theme-toggle"><button class="theme-toggle-btn'+("industrial"===s?" is-active":"")+'" onclick="posSetTheme(\'industrial\');updateThemeButtons()" title="'+e("dark_theme")+'"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg></button><button class="theme-toggle-btn'+("modern"===s?" is-active":"")+'" onclick="posSetTheme(\'modern\');updateThemeButtons()" title="'+e("light_theme")+'"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></button></div>',h='<div class="sidebar__lang-toggle"><button class="lang-toggle-btn'+("es"===r?" is-active":"")+'" onclick="setLang(\'es\')" title="Espanol"><span class="lang-flag">MX</span> ES</button><button class="lang-toggle-btn'+("en"===r?" is-active":"")+'" onclick="setLang(\'en\')" title="English"><span class="lang-flag">US</span> EN</button></div>';window.updateThemeButtons=function(){var e=localStorage.getItem("pos_theme")||"industrial";document.querySelectorAll(".theme-toggle-btn").forEach((function(t,n){t.classList.toggle("is-active",0===n?"industrial"===e:"modern"===e)}))};var p='<div class="sidebar__brand"> <div class="brand-logo">NA</div> <div class="brand-name"> <span class="brand-name__primary">Nexus</span> <span class="brand-name__sub">Autoparts POS</span> </div></div><nav class="sidebar__nav">'+c+"</nav>"+d+h+'<div class="sidebar__footer"> <div class="sidebar__user-avatar">'+i+'</div> <div class="sidebar__user-info"> <div class="sidebar__user-name">'+n+'</div> <div class="sidebar__user-role">'+a+'</div> </div> <button class="sidebar__logout-btn" onclick="posLogout()" title="'+e("logout")+'"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg> </button></div>',m=document.querySelector("aside.sidebar, .sidebar, #sidebar");if(m)m.className="pos-sidebar",m.innerHTML=p,m.removeAttribute("style");else{var u=document.createElement("aside");u.className="pos-sidebar",u.innerHTML=p,document.body.insertBefore(u,document.body.firstChild)}var v=document.querySelector("main, .main-content, #mainContent, .main, .page-content");v&&v.classList.add("pos-main-offset");var g=document.querySelector(".pos-sidebar, .sidebar, #sidebar"),y=document.getElementById("sidebar-overlay");!y&&g&&((y=document.createElement("div")).id="sidebar-overlay",y.className="sidebar-overlay",y.addEventListener("click",(function(){f()})),g.parentNode.insertBefore(y,g));var b=document.getElementById("hamburger-btn");function x(){if(g){var e=g.classList.contains("open");g.classList.toggle("open",!e),y&&y.classList.toggle("open",!e),document.body.style.overflow=e?"":"hidden"}}function f(){g&&g.classList.remove("open"),y&&y.classList.remove("open"),document.body.style.overflow=""}b||((b=document.createElement("button")).id="hamburger-btn",b.className="hamburger-btn",b.setAttribute("aria-label","Menú"),b.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>',b.style.cssText="display:none;position:fixed;top:10px;left:10px;z-index:"+(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--z-modal")||1050)+2)+";background:var(--glass-bg-strong);backdrop-filter:blur(12px);border:1px solid var(--glass-border);border-radius:var(--radius-md);padding:8px;cursor:pointer;color:var(--color-text-primary);box-shadow:0 2px 8px rgba(0,0,0,0.2);",b.addEventListener("click",(function(){x()})),document.body.appendChild(b)),window.addEventListener("resize",(function(){window.innerWidth>=1024&&f()})),window.toggleSidebar=x,window.closeSidebar=f}();