feat(warehouseTransfer): warehouse transfer detail.

This commit is contained in:
elforjani13
2022-02-03 01:02:31 +02:00
parent 8bf64c68e0
commit e7024955dd
5 changed files with 19 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ import { useDeleteWarehouseTransfer } from 'hooks/query';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -23,9 +24,12 @@ function WarehouseTransferDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteWarehouseTransferMutate, isLoading } = const { mutateAsync: deleteWarehouseTransferMutate, isLoading } =
useDeleteWarehouseTransfer(); useDeleteWarehouseTransfer();
// handle cancel delete warehouse alert. // handle cancel delete warehouse alert.
const handleCancelDeleteAlert = () => { const handleCancelDeleteAlert = () => {
@@ -40,6 +44,7 @@ function WarehouseTransferDeleteAlert({
message: intl.get('warehouse_transfer.alert.delete_message'), message: intl.get('warehouse_transfer.alert.delete_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('warehouse-transfer-detail-drawer');
}) })
.catch( .catch(
({ ({
@@ -76,4 +81,5 @@ function WarehouseTransferDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(WarehouseTransferDeleteAlert); )(WarehouseTransferDeleteAlert);

View File

@@ -34,15 +34,18 @@ function WarehouseTransferDetailActionsBar({
}) { }) {
const history = useHistory(); const history = useHistory();
const { warehouseTransferId, warehouseTransfer } =
useWarehouseDetailDrawerContext();
// Handle edit warehosue transfer. // Handle edit warehosue transfer.
const handleEditWarehosueTransfer = () => { const handleEditWarehosueTransfer = () => {
// history.push(`/warehouse-transfers/${warehouseTransferId}/edit`); history.push(`/warehouses-transfers/${warehouseTransferId}/edit`);
closeDrawer('warehouse-transfer-detail-drawer'); closeDrawer('warehouse-transfer-detail-drawer');
}; };
// Handle delete warehouse transfer. // Handle delete warehouse transfer.
const handleDeletetWarehosueTransfer = () => { const handleDeletetWarehosueTransfer = () => {
// openAlert('warehouse-transfer-delete', { warehouseTransferId }); openAlert('warehouse-transfer-delete', { warehouseTransferId });
}; };
return ( return (

View File

@@ -28,7 +28,9 @@ function WarehouseTransferDetailDrawerProvider({
<DrawerHeaderContent <DrawerHeaderContent
name="warehouse-transfer-detail-drawer" name="warehouse-transfer-detail-drawer"
title={intl.get('warehouse_transfer.drawer.title', { title={intl.get('warehouse_transfer.drawer.title', {
number: 'W-10', number: warehouseTransfer.transaction_number
? `(${warehouseTransfer.transaction_number})`
: null,
})} })}
/> />
<WarehouseTransferDetailDrawerContext.Provider <WarehouseTransferDetailDrawerContext.Provider

View File

@@ -25,7 +25,7 @@ export default function WarehouseTransferDetailHeader() {
<CommercialDocHeader> <CommercialDocHeader>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<DetailItem label={intl.get('date')}> <DetailItem label={intl.get('date')}>
<FormatDate value={warehouseTransfer.date} /> <FormatDate value={warehouseTransfer.formatted_date} />
</DetailItem> </DetailItem>
<DetailItem <DetailItem

View File

@@ -1790,7 +1790,7 @@
"warehouse_transfer.auto_increment.auto": "Your transfer numbers are set on auto-increment mode. Are you sure changing this setting?", "warehouse_transfer.auto_increment.auto": "Your transfer numbers are set on auto-increment mode. Are you sure changing this setting?",
"warehouse_transfer.auto_increment.manually": "Your transfer numbers are set on manual mode. Are you sure chaning this settings?", "warehouse_transfer.auto_increment.manually": "Your transfer numbers are set on manual mode. Are you sure chaning this settings?",
"warehouse_transfer.setting_your_auto_generated_transfer_no": "Setting your auto-generated transfer number", "warehouse_transfer.setting_your_auto_generated_transfer_no": "Setting your auto-generated transfer number",
"warehouse_transfer.drawer.title": "Warehouse Transfer details ({number})", "warehouse_transfer.drawer.title": "Warehouse Transfer details {number}",
"warehouse_transfer.drawer.label.transfer_number": "Transfer Number", "warehouse_transfer.drawer.label.transfer_number": "Transfer Number",
"warehouse_transfer.drawer.label.from_warehouse": "From Warehouse", "warehouse_transfer.drawer.label.from_warehouse": "From Warehouse",
"warehouse_transfer.drawer.label.to_warehouse": "To Warehouse", "warehouse_transfer.drawer.label.to_warehouse": "To Warehouse",
@@ -1801,5 +1801,6 @@
"warehouse_transfer.edit_success_message":"The warehouse transfer transaction has been created successfully.", "warehouse_transfer.edit_success_message":"The warehouse transfer transaction has been created successfully.",
"select_warehouse_transfer":"Select Warehouse Transfer", "select_warehouse_transfer":"Select Warehouse Transfer",
"warehouse_transfer.alert.delete_message":"The warehouse transfer transaction has been deleted successfully", "warehouse_transfer.alert.delete_message":"The warehouse transfer transaction has been deleted successfully",
"warehouse_transfer.once_delete_this_warehouse_transfer":"Once you delete this warehouse transfer, you won't be able to restore it later. Are you sure you want to delete this warehouse transfer?" "warehouse_transfer.once_delete_this_warehouse_transfer":"Once you delete this warehouse transfer, you won't be able to restore it later. Are you sure you want to delete this warehouse transfer?",
"warehouse_transfer.error.could_not_transfer_item_from_source_to_destination":"Could not transfer item from source to destination on the same warehouse"
} }