mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: projects actions bar.
This commit is contained in:
@@ -16,7 +16,8 @@ export const TABLES = {
|
|||||||
CASHFLOW_Transactions: 'cashflow_transactions',
|
CASHFLOW_Transactions: 'cashflow_transactions',
|
||||||
CREDIT_NOTES: 'credit_notes',
|
CREDIT_NOTES: 'credit_notes',
|
||||||
VENDOR_CREDITS: 'vendor_credits',
|
VENDOR_CREDITS: 'vendor_credits',
|
||||||
WAREHOUSE_TRANSFERS:'warehouse_transfers'
|
WAREHOUSE_TRANSFERS:'warehouse_transfers',
|
||||||
|
PROJECTS:'projects'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TABLE_SIZE = {
|
export const TABLE_SIZE = {
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import { compose } from 'utils';
|
|||||||
const defaultInitialValues = {
|
const defaultInitialValues = {
|
||||||
contact: '',
|
contact: '',
|
||||||
project_name: '',
|
project_name: '',
|
||||||
project_deadline: '',
|
project_deadline: moment(new Date()).format('YYYY-MM-DD'),
|
||||||
// project_deadline: moment(new Date()).format('YYYY-MM-DD'),
|
|
||||||
project_state: false,
|
project_state: false,
|
||||||
project_cost: '',
|
project_cost: '',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function ProjectFormFloatingActions({
|
|||||||
style={{ minWidth: '75px' }}
|
style={{ minWidth: '75px' }}
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
Create
|
<T id={'projects.label.create'} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function ProjectFormProvider({
|
|||||||
// State provider.
|
// State provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
customers,
|
customers,
|
||||||
|
dialogName,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ function TaskFormProvider({
|
|||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
// State provider.
|
// State provider.
|
||||||
const provider = {};
|
const provider = {
|
||||||
|
dialogName,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<TaskFormContext.Provider value={provider} {...props} />
|
<TaskFormContext.Provider value={provider} {...props} />
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ function ProjectsActionsBar({
|
|||||||
// #withProjectsActions
|
// #withProjectsActions
|
||||||
setProjectsTableState,
|
setProjectsTableState,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
projectsTableSize,
|
||||||
|
|
||||||
// #withSettingsActions
|
// #withSettingsActions
|
||||||
addSetting,
|
addSetting,
|
||||||
}) {
|
}) {
|
||||||
@@ -100,7 +103,7 @@ function ProjectsActionsBar({
|
|||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<DashboardRowsHeightButton
|
<DashboardRowsHeightButton
|
||||||
initialValue={'medium'}
|
initialValue={projectsTableSize}
|
||||||
onChange={handleTableRowSizeChange}
|
onChange={handleTableRowSizeChange}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
@@ -123,4 +126,7 @@ export default compose(
|
|||||||
withProjects(({ projectsTableState }) => ({
|
withProjects(({ projectsTableState }) => ({
|
||||||
projectsFilterRoles: projectsTableState?.filterRoles,
|
projectsFilterRoles: projectsTableState?.filterRoles,
|
||||||
})),
|
})),
|
||||||
|
withSettings(({ projectSettings }) => ({
|
||||||
|
projectsTableSize: projectSettings?.tableSize,
|
||||||
|
})),
|
||||||
)(ProjectsActionsBar);
|
)(ProjectsActionsBar);
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DataTable } from 'components';
|
import { DataTable } from 'components';
|
||||||
|
import { TABLES } from 'common/tables';
|
||||||
|
|
||||||
import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
||||||
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||||
|
|
||||||
import { useProjectsListContext } from './ProjectsListProvider';
|
import { useProjectsListContext } from './ProjectsListProvider';
|
||||||
|
import { useMemorizedColumnsWidths } from 'hooks';
|
||||||
import { useProjectsListColumns, ActionsMenu } from '../components';
|
import { useProjectsListColumns, ActionsMenu } from '../components';
|
||||||
|
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import withProjectsActions from './withProjectsActions';
|
||||||
|
import withSettings from '../../Settings/withSettings';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -19,6 +23,18 @@ const projects = [
|
|||||||
description: 'Project 1 description',
|
description: 'Project 1 description',
|
||||||
status: 'Active',
|
status: 'Active',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: 'Project 2',
|
||||||
|
description: 'Project 2 description',
|
||||||
|
status: 'Active',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: 'Project 3',
|
||||||
|
description: 'Project 3 description',
|
||||||
|
status: 'Active',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +44,9 @@ const projects = [
|
|||||||
function ProjectsDataTable({
|
function ProjectsDataTable({
|
||||||
// #withDial
|
// #withDial
|
||||||
openDialog,
|
openDialog,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
projectsTableSize,
|
||||||
}) {
|
}) {
|
||||||
// Retrieve projects table columns.
|
// Retrieve projects table columns.
|
||||||
const columns = useProjectsListColumns();
|
const columns = useProjectsListColumns();
|
||||||
@@ -40,6 +59,10 @@ function ProjectsDataTable({
|
|||||||
openDialog('task-form');
|
openDialog('task-form');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Local storage memorizing columns widths.
|
||||||
|
const [initialColumnsWidths, , handleColumnResizing] =
|
||||||
|
useMemorizedColumnsWidths(TABLES.PROJECTS);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable
|
<DataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -55,6 +78,9 @@ function ProjectsDataTable({
|
|||||||
TableHeaderSkeletonRenderer={TableSkeletonHeader}
|
TableHeaderSkeletonRenderer={TableSkeletonHeader}
|
||||||
ContextMenu={ActionsMenu}
|
ContextMenu={ActionsMenu}
|
||||||
onCellClick={handleCellClick}
|
onCellClick={handleCellClick}
|
||||||
|
initialColumnsWidths={initialColumnsWidths}
|
||||||
|
onColumnResizing={handleColumnResizing}
|
||||||
|
size={projectsTableSize}
|
||||||
payload={{
|
payload={{
|
||||||
onNewTask: handleNewTaskButtonClick,
|
onNewTask: handleNewTaskButtonClick,
|
||||||
}}
|
}}
|
||||||
@@ -62,4 +88,10 @@ function ProjectsDataTable({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDialogActions)(ProjectsDataTable);
|
export default compose(
|
||||||
|
withDialogActions,
|
||||||
|
withProjectsActions,
|
||||||
|
withSettings(({ projectSettings }) => ({
|
||||||
|
projectsTableSize: projectSettings?.tableSize,
|
||||||
|
})),
|
||||||
|
)(ProjectsDataTable);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export default (mapState) => {
|
|||||||
creditNoteSettings: state.settings.data.creditNote,
|
creditNoteSettings: state.settings.data.creditNote,
|
||||||
vendorsCreditNoteSetting: state.settings.data.vendorCredit,
|
vendorsCreditNoteSetting: state.settings.data.vendorCredit,
|
||||||
warehouseTransferSettings: state.settings.data.warehouseTransfers,
|
warehouseTransferSettings: state.settings.data.warehouseTransfers,
|
||||||
|
projectSettings:state.settings.data.projects
|
||||||
};
|
};
|
||||||
return mapState ? mapState(mapped, state, props) : mapped;
|
return mapState ? mapState(mapped, state, props) : mapped;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2055,6 +2055,7 @@
|
|||||||
"projects.label.deadline": "Deadline",
|
"projects.label.deadline": "Deadline",
|
||||||
"projects.label.calculator_expenses": "Calculator from tasks & estimated expenses",
|
"projects.label.calculator_expenses": "Calculator from tasks & estimated expenses",
|
||||||
"projects.label.cost_estimate": "Cost Estimate",
|
"projects.label.cost_estimate": "Cost Estimate",
|
||||||
|
"projects.label.create": "Create",
|
||||||
"task.label.new_task": "New Task",
|
"task.label.new_task": "New Task",
|
||||||
"task.label.task_name": "Task Name",
|
"task.label.task_name": "Task Name",
|
||||||
"task.label.estimated_hours": "Task Name",
|
"task.label.estimated_hours": "Task Name",
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ const initialState = {
|
|||||||
warehouseTransfer: {
|
warehouseTransfer: {
|
||||||
tableSize: 'medium',
|
tableSize: 'medium',
|
||||||
},
|
},
|
||||||
|
projects: {
|
||||||
|
tableSize: 'medium',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user