feat(branche & warehouse ) add mark primary alert.

This commit is contained in:
elforjani13
2022-02-08 20:31:15 +02:00
parent 09d5771481
commit 49f8cce54b
13 changed files with 244 additions and 25 deletions

View File

@@ -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,
},
];

View File

@@ -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}
/>
}
>

View File

@@ -17,7 +17,7 @@ function WarehousesList({
changePreferencesPageTitle(intl.get('warehouses.label'));
}, [changePreferencesPageTitle]);
// if () {
// if (type) {
// return <WarehousesEmptyStatus />;
// }

View File

@@ -28,11 +28,11 @@ function WarehousesProvider({ ...props }) {
)}
>
<React.Fragment>
{isWarehouesLoading ? (
{/* {isWarehouesLoading ? (
<PreferencesPageLoader />
) : (
) : ( */}
<WarehousesContext.Provider value={provider} {...props} />
)}
{/* )} */}
</React.Fragment>
</div>
);

View File

@@ -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)}
/>