mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: home page ability.
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useAbilityContext } from '../../hooks';
|
||||
|
||||
function useFilterFinancialReports(financial) {
|
||||
function useFilterFinancialReports(financialSection) {
|
||||
const ability = useAbilityContext();
|
||||
|
||||
const seaction = financial
|
||||
.map((seaction) => {
|
||||
const reports = seaction.reports.filter((report) => {
|
||||
const section = financialSection
|
||||
.map((section) => {
|
||||
const reports = section.reports.filter((report) => {
|
||||
return ability.can(report.ability, report.subject);
|
||||
});
|
||||
|
||||
return {
|
||||
sectionTitle: seaction.sectionTitle,
|
||||
sectionTitle: section.sectionTitle,
|
||||
reports,
|
||||
};
|
||||
})
|
||||
.filter(({ reports }) => !isEmpty(reports));
|
||||
|
||||
return seaction;
|
||||
return section;
|
||||
}
|
||||
|
||||
export default useFilterFinancialReports;
|
||||
|
||||
Reference in New Issue
Block a user