mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: add projects view tabs.
This commit is contained in:
@@ -54,6 +54,13 @@ function ProjectsDataTable({
|
||||
// Handle cell click.
|
||||
const handleCellClick = (cell, event) => {};
|
||||
|
||||
// Handle edit project.
|
||||
const handleEditProject = (project) => {
|
||||
openDialog('project-form', {
|
||||
projectId: project.id,
|
||||
});
|
||||
};
|
||||
|
||||
// Handle new task button click.
|
||||
const handleNewTaskButtonClick = () => {
|
||||
openDialog('task-form');
|
||||
@@ -82,6 +89,7 @@ function ProjectsDataTable({
|
||||
onColumnResizing={handleColumnResizing}
|
||||
size={projectsTableSize}
|
||||
payload={{
|
||||
onEdit: handleEditProject,
|
||||
onNewTask: handleNewTaskButtonClick,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { DashboardPageContent, DashboardContentTable } from 'components';
|
||||
|
||||
import ProjectsActionsBar from './ProjectsActionsBar';
|
||||
// import ProjectsViewTabs from './ProjectsViewTabs';
|
||||
import ProjectsViewTabs from './ProjectsViewTabs';
|
||||
import ProjectsDataTable from './ProjectsDataTable';
|
||||
|
||||
import withProjects from './withProjects';
|
||||
@@ -38,7 +38,7 @@ function ProjectsList({
|
||||
>
|
||||
<ProjectsActionsBar />
|
||||
<DashboardPageContent>
|
||||
{/* <ProjectsViewTabs /> */}
|
||||
<ProjectsViewTabs />
|
||||
<DashboardContentTable>
|
||||
<ProjectsDataTable />
|
||||
</DashboardContentTable>
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
//@ts-nocheck
|
||||
import React from 'react';
|
||||
import { useResourceViews, useResourceMeta } from 'hooks/query';
|
||||
import DashboardInsider from '../../../components/Dashboard/DashboardInsider';
|
||||
|
||||
|
||||
const ProjectsListContext = React.createContext({});
|
||||
const ProjectsListContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Projects list data provider.
|
||||
* @returns
|
||||
*/
|
||||
function ProjectsListProvider({ query, tableStateChanged, ...props }) {
|
||||
// provider payload.
|
||||
// Fetch accounts resource views and fields.
|
||||
const { data: projectsViews, isLoading: isViewsLoading } =
|
||||
useResourceViews('projects');
|
||||
|
||||
const provider = {};
|
||||
// provider payload.
|
||||
const provider = {
|
||||
projectsViews,
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider
|
||||
// loading={}
|
||||
// loading={isViewsLoading}
|
||||
name={'projects'}
|
||||
>
|
||||
<ProjectsListContext.Provider value={provider} {...props} />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//@ts-nocheck
|
||||
import React from 'react';
|
||||
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||
|
||||
@@ -5,6 +6,7 @@ import { DashboardViewsTabs } from 'components';
|
||||
|
||||
import withProjects from './withProjects';
|
||||
import withProjectsActions from './withProjectsActions';
|
||||
import { useProjectsListContext } from './ProjectsListProvider';
|
||||
|
||||
import { compose, transfromViewsToTabs } from 'utils';
|
||||
|
||||
@@ -19,8 +21,11 @@ function ProjectsViewTabs({
|
||||
// #withProjectsActions
|
||||
setProjectsTableState,
|
||||
}) {
|
||||
// Projects list context.
|
||||
const { projectsViews } = useProjectsListContext();
|
||||
|
||||
// Projects views.
|
||||
const tabs = transfromViewsToTabs([]);
|
||||
const tabs = transfromViewsToTabs(projectsViews);
|
||||
|
||||
// Handle tab change.
|
||||
const handleTabsChange = (viewSlug) => {
|
||||
@@ -32,7 +37,7 @@ function ProjectsViewTabs({
|
||||
<NavbarGroup align={Alignment.LEFT}>
|
||||
<DashboardViewsTabs
|
||||
currentViewSlug={projectsCurrentView}
|
||||
resourceName={''}
|
||||
resourceName={'projects'}
|
||||
tabs={tabs}
|
||||
onChange={handleTabsChange}
|
||||
/>
|
||||
@@ -46,4 +51,4 @@ export default compose(
|
||||
projectsCurrentView: projectsTableState?.viewSlug,
|
||||
})),
|
||||
withProjectsActions,
|
||||
)();
|
||||
)(ProjectsViewTabs);
|
||||
|
||||
Reference in New Issue
Block a user