93 lines
2.5 KiB
JavaScript
93 lines
2.5 KiB
JavaScript
import React from 'react';
|
|
import { __ } from '@wordpress/i18n';
|
|
import { intersection } from 'ramda';
|
|
|
|
// store
|
|
import { useStore } from '../../../../store';
|
|
|
|
// components
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
const AppSidebar = () => {
|
|
const permissions = useStore().main.getPermissions();
|
|
|
|
const items = [
|
|
{
|
|
label: __('Riepilogo', 'gepafin'),
|
|
icon: 'pi pi-objects-column',
|
|
href: '/',
|
|
id: 1,
|
|
enable: true
|
|
},
|
|
{
|
|
label: __('Gestione bandi', 'gepafin'),
|
|
icon: 'pi pi-file',
|
|
href: '/bandi',
|
|
id: 2,
|
|
enable: intersection(permissions, ['MANAGE_TENDERS']).length
|
|
},
|
|
{
|
|
label: __('Domande in lavorazione', 'gepafin'),
|
|
icon: 'pi pi-file',
|
|
href: '/imieibandi',
|
|
id: 3,
|
|
enable: intersection(permissions, ['APPLY_CALLS']).length
|
|
},
|
|
{
|
|
label: __('Bandi disponibili', 'gepafin'),
|
|
icon: 'pi pi-bookmark',
|
|
href: '/bandi',
|
|
id: 4,
|
|
enable: intersection(permissions, ['VIEW_CALLS']).length
|
|
},
|
|
{
|
|
label: __('Gestione Utenti', 'gepafin'),
|
|
icon: 'pi pi-users',
|
|
href: '/utenti',
|
|
id: 5,
|
|
enable: false
|
|
//enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
|
},
|
|
{
|
|
label: __('Configurazione', 'gepafin'),
|
|
icon: 'pi pi-cog',
|
|
//href: '/configurazione',
|
|
id: 6,
|
|
enable: false
|
|
},
|
|
{
|
|
label: __('Report e Analisi', 'gepafin'),
|
|
icon: 'pi pi-chart-bar',
|
|
//href: '/stats',
|
|
id: 7,
|
|
enable: false
|
|
},
|
|
{
|
|
label: __('Log di Sistema', 'gepafin'),
|
|
icon: 'pi pi-receipt',
|
|
clickFn: () => {},
|
|
id: 8,
|
|
enable: false
|
|
}
|
|
]
|
|
|
|
return <aside>
|
|
<ul>
|
|
{items
|
|
.filter(o => o.enable)
|
|
.map(o => <li key={o.id}>
|
|
{o.href
|
|
? <NavLink to={o.href}>
|
|
<i className={o.icon}></i>
|
|
<span>{o.label}</span>
|
|
</NavLink>
|
|
: <button onClick={() => {}}>
|
|
<i className={o.icon}></i>
|
|
<span>{o.label}</span>
|
|
</button>}
|
|
</li>)}
|
|
</ul>
|
|
</aside>
|
|
}
|
|
|
|
export default AppSidebar; |