/* ============================================================
   KODILA — Admin panel
   Zbirno mesto za module, vezane izključno na administratorja.
   Nov admin modul: dodaj vnos v ADMIN_MODULES + ustrezen primer spodaj.
   ============================================================ */

const ADMIN_MODULES = [
  { id: 'uporabniki', label: 'Uporabniki' },
  { id: 'postavitve', label: 'Temeljne postavitve' },
  { id: 'pravice', label: 'Pravice' },
];

function AdminPanel({ currentUser }) {
  const [tab, setTab] = useState(ADMIN_MODULES[0].id);

  return (
    <div className="page">
      <div className="page-head">
        <div className="grow">
          <div className="crumbs">
            <span>Intranet</span>
            <span className="sep" dangerouslySetInnerHTML={{ __html: I('chevright', 13) }} />
            <span>Admin panel</span>
          </div>
          <h1 className="h-page">Admin panel</h1>
        </div>
      </div>

      <div className="seg" style={{ marginBottom: 16 }}>
        {ADMIN_MODULES.map(m => (
          <button key={m.id} className={tab === m.id ? 'active' : ''} onClick={() => setTab(m.id)}>{m.label}</button>
        ))}
      </div>

      {tab === 'uporabniki' && <Uporabniki currentUser={currentUser} />}
      {tab === 'postavitve' && <TemeljnePostavitve />}
      {tab === 'pravice' && <Pravice currentUser={currentUser} />}
    </div>
  );
}
Object.assign(window, { AdminPanel });
