Gate Finance behind a super-admin business module.
Add finance to the modules picker and hide sidebar, home tile, and customer invoice actions when it is disabled. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
917b840ee5
commit
a50685ec69
@@ -12,6 +12,7 @@ import { Pagination } from '../components/Pagination'
|
||||
import { ToggleSwitch } from '../components/ToggleSwitch'
|
||||
import { Tooltip } from '../components/Tooltip'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { useTenantBranding } from '../context/TenantBrandingContext'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
import { useT } from '../i18n/useT'
|
||||
import type { BusinessMessageKey } from '../i18n/messages'
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
type CustomerAccessFilter,
|
||||
type CustomersListResponse,
|
||||
} from '../services/customerService'
|
||||
import { hasBusinessModule } from '../utils/businessModules'
|
||||
import { formatIrtPrice } from '../utils/irtPrice'
|
||||
import { textLocaleAttrs } from '../utils/textLocale'
|
||||
import filterStyles from '../components/ListFiltersPanel.module.css'
|
||||
@@ -74,7 +76,9 @@ export function CustomersPage() {
|
||||
const navigate = useNavigate()
|
||||
const { locale } = useLocale()
|
||||
const { user: authUser } = useAuth()
|
||||
const { enabledModules } = useTenantBranding()
|
||||
const { showToast } = useToast()
|
||||
const financeEnabled = hasBusinessModule(enabledModules, 'finance')
|
||||
const [data, setData] = useState<CustomersListResponse | null>(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
@@ -537,16 +541,18 @@ export function CustomersPage() {
|
||||
<Pencil size={15} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip label={t('customers.invoices')}>
|
||||
<button
|
||||
type="button"
|
||||
className={styles.actionBtn}
|
||||
onClick={() => handleViewInvoices(customer)}
|
||||
aria-label={t('customers.invoices')}
|
||||
>
|
||||
<Receipt size={15} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{financeEnabled ? (
|
||||
<Tooltip label={t('customers.invoices')}>
|
||||
<button
|
||||
type="button"
|
||||
className={styles.actionBtn}
|
||||
onClick={() => handleViewInvoices(customer)}
|
||||
aria-label={t('customers.invoices')}
|
||||
>
|
||||
<Receipt size={15} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
<Tooltip label={t('customers.sms')}>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -75,6 +75,7 @@ const sections: {
|
||||
descKey: 'home.card.finance.desc',
|
||||
linkKey: 'home.card.finance.link',
|
||||
href: '/finance',
|
||||
moduleId: 'finance',
|
||||
},
|
||||
{
|
||||
icon: FileText,
|
||||
|
||||
Reference in New Issue
Block a user