mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
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
@@ -142,6 +142,7 @@ export function Sidebar() {
|
||||
icon: Wallet,
|
||||
labelKey: 'nav.finance',
|
||||
basePath: '/finance',
|
||||
moduleId: 'finance',
|
||||
children: [
|
||||
{ labelKey: 'nav.finance.overview', to: '/finance' },
|
||||
{ labelKey: 'nav.finance.invoices', to: '/invoices' },
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -6,6 +6,7 @@ export const BUSINESS_DASHBOARD_MODULE_IDS = [
|
||||
'blog',
|
||||
'warehouse',
|
||||
'videos',
|
||||
'finance',
|
||||
] as const
|
||||
|
||||
/** Optional customer-dashboard modules. Always-on: home, profile, addresses, orders, favorites. */
|
||||
|
||||
@@ -6,6 +6,7 @@ export const BUSINESS_DASHBOARD_MODULE_IDS = [
|
||||
'blog',
|
||||
'warehouse',
|
||||
'videos',
|
||||
'finance',
|
||||
] as const
|
||||
|
||||
/** Optional customer-dashboard modules. Always-on: home, profile, addresses, orders, favorites. */
|
||||
@@ -32,6 +33,7 @@ export const BUSINESS_DASHBOARD_MODULE_LABELS: Record<
|
||||
blog: 'Blog',
|
||||
warehouse: 'Warehouse',
|
||||
videos: 'Videos',
|
||||
finance: 'Finance',
|
||||
}
|
||||
|
||||
export const CUSTOMER_MODULE_LABELS: Record<CustomerModuleId, string> = {
|
||||
|
||||
Reference in New Issue
Block a user