mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat(branche & warehouse ) add mark primary alert.
This commit is contained in:
@@ -3,5 +3,14 @@ import React from 'react';
|
||||
const BranchDeleteAlert = React.lazy(() =>
|
||||
import('../../Alerts/Branches/BranchDeleteAlert'),
|
||||
);
|
||||
const BranchMarkPrimaryAlert = React.lazy(() =>
|
||||
import('../../Alerts/Branches/BranchMarkPrimaryAlert'),
|
||||
);
|
||||
|
||||
export default [{ name: 'branch-delete', component: BranchDeleteAlert }];
|
||||
export default [
|
||||
{ name: 'branch-delete', component: BranchDeleteAlert },
|
||||
{
|
||||
name: 'branch-mark-primary',
|
||||
component: BranchMarkPrimaryAlert,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -27,22 +27,27 @@ function BranchesDataTable({
|
||||
// Table columns.
|
||||
const columns = useBranchesTableColumns();
|
||||
|
||||
const Time = true;
|
||||
|
||||
const { branches, isBranchesLoading, isBranchesFetching } =
|
||||
useBranchesContext();
|
||||
|
||||
// Handle edit branch.
|
||||
const handleEditBranch = ({ id }) => {
|
||||
openDialog('branch-form', { branchId: id, action: 'edit' });
|
||||
};
|
||||
|
||||
// Handle delete branch.
|
||||
const handleDeleteBranch = ({ id }) => {
|
||||
openAlert('branch-delete', { branchId: id });
|
||||
};
|
||||
|
||||
if (Time) {
|
||||
return <BranchesEmptyStatus />;
|
||||
}
|
||||
// Handle mark primary branch.
|
||||
const handleMarkPrimaryBranch = ({ id }) => {
|
||||
openAlert('branch-mark-primary', { branchId: id });
|
||||
};
|
||||
|
||||
// if (type) {
|
||||
// return <BranchesEmptyStatus />;
|
||||
// }
|
||||
|
||||
return (
|
||||
<BranchesTableCard>
|
||||
@@ -58,6 +63,7 @@ function BranchesDataTable({
|
||||
payload={{
|
||||
onEdit: handleEditBranch,
|
||||
onDelete: handleDeleteBranch,
|
||||
onMarkPrimary: handleMarkPrimaryBranch,
|
||||
}}
|
||||
/>
|
||||
</BranchesTableCard>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Icon } from 'components';
|
||||
* Context menu of Branches.
|
||||
*/
|
||||
export function ActionsMenu({
|
||||
payload: { onEdit, onDelete },
|
||||
payload: { onEdit, onDelete, onMarkPrimary },
|
||||
row: { original },
|
||||
}) {
|
||||
return (
|
||||
@@ -19,6 +19,11 @@ export function ActionsMenu({
|
||||
text={intl.get('branches.action.edit_branch')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon="check" />}
|
||||
text={intl.get('branches.action.mark_as_primary')}
|
||||
onClick={safeCallback(onMarkPrimary, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
|
||||
@@ -3,8 +3,17 @@ import React from 'react';
|
||||
const WarehouseDeleteAlert = React.lazy(() =>
|
||||
import('../../Alerts/Warehouses/WarehouseDeleteAlert'),
|
||||
);
|
||||
const WarehouseMarkPrimaryAlert = React.lazy(() =>
|
||||
import('../../Alerts/Warehouses/WarehouseMarkPrimaryAlert'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Warehouses alerts.
|
||||
*/
|
||||
export default [{ name: 'warehouse-delete', component: WarehouseDeleteAlert }];
|
||||
export default [
|
||||
{ name: 'warehouse-delete', component: WarehouseDeleteAlert },
|
||||
{
|
||||
name: 'warehouse-mark-primary',
|
||||
component: WarehouseMarkPrimaryAlert,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -30,12 +30,18 @@ function WarehousesGridItems({
|
||||
openAlert('warehouse-delete', { warehouseId: warehouse.id });
|
||||
};
|
||||
|
||||
// Handle mark primary warehouse.
|
||||
const handleMarkPrimaryWarehouse = () => {
|
||||
openAlert('warehouse-mark-primary', { warehouseId: warehouse.id });
|
||||
};
|
||||
|
||||
return (
|
||||
<ContextMenu2
|
||||
content={
|
||||
<WarehouseContextMenu
|
||||
onEditClick={handleEditWarehouse}
|
||||
onDeleteClick={handleDeleteWarehouse}
|
||||
onMarkPrimary={handleMarkPrimaryWarehouse}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -17,7 +17,7 @@ function WarehousesList({
|
||||
changePreferencesPageTitle(intl.get('warehouses.label'));
|
||||
}, [changePreferencesPageTitle]);
|
||||
|
||||
// if () {
|
||||
// if (type) {
|
||||
// return <WarehousesEmptyStatus />;
|
||||
// }
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ function WarehousesProvider({ ...props }) {
|
||||
)}
|
||||
>
|
||||
<React.Fragment>
|
||||
{isWarehouesLoading ? (
|
||||
{/* {isWarehouesLoading ? (
|
||||
<PreferencesPageLoader />
|
||||
) : (
|
||||
) : ( */}
|
||||
<WarehousesContext.Provider value={provider} {...props} />
|
||||
)}
|
||||
{/* )} */}
|
||||
</React.Fragment>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ export function WarehouseContextMenu({
|
||||
onClick={safeCallback(onEditClick)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
icon={<Icon icon="check" />}
|
||||
text={intl.get('warehouses.action.make_as_parimary')}
|
||||
onClick={safeCallback(onPrimary)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user