mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
import { Intent, Alert } from '@blueprintjs/core';
|
||||
|
||||
import { useTransferredWarehouseTransfer } from '@/hooks/query';
|
||||
|
||||
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
* warehouse transfer transferred alert.
|
||||
* @returns
|
||||
*/
|
||||
function TransferredWarehouseTransferAlert({
|
||||
name,
|
||||
|
||||
// #withAlertStoreConnect
|
||||
isOpen,
|
||||
payload: { warehouseTransferId },
|
||||
|
||||
// #withAlertActions
|
||||
closeAlert,
|
||||
}) {
|
||||
const { mutateAsync: transferredWarehouseTransferMutate, isLoading } =
|
||||
useTransferredWarehouseTransfer();
|
||||
|
||||
// handle cancel alert.
|
||||
const handleCancelAlert = () => {
|
||||
closeAlert(name);
|
||||
};
|
||||
|
||||
// Handle confirm alert.
|
||||
const handleConfirmTransferred = () => {
|
||||
transferredWarehouseTransferMutate(warehouseTransferId)
|
||||
.then(() => {
|
||||
AppToaster.show({
|
||||
message: intl.get('warehouse_transfer.alert.transferred_warehouse'),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
})
|
||||
.catch((error) => {})
|
||||
.finally(() => {
|
||||
closeAlert(name);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={<T id={'deliver'} />}
|
||||
intent={Intent.WARNING}
|
||||
isOpen={isOpen}
|
||||
onCancel={handleCancelAlert}
|
||||
onConfirm={handleConfirmTransferred}
|
||||
loading={isLoading}
|
||||
>
|
||||
<p>
|
||||
<T id={'warehouse_transfer.alert.are_you_sure_you_want_to_deliver'} />
|
||||
</p>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertStoreConnect(),
|
||||
withAlertActions,
|
||||
)(TransferredWarehouseTransferAlert);
|
||||
@@ -0,0 +1,70 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent, Alert } from '@blueprintjs/core';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
|
||||
import { useMarkWarehouseAsPrimary } from '@/hooks/query';
|
||||
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
* warehouse mark primary alert.
|
||||
*/
|
||||
function WarehouseMarkPrimaryAlert({
|
||||
name,
|
||||
|
||||
// #withAlertStoreConnect
|
||||
isOpen,
|
||||
payload: { warehouseId },
|
||||
|
||||
// #withAlertActions
|
||||
closeAlert,
|
||||
}) {
|
||||
// const { mutateAsync: markPrimaryWarehouseMutate, isLoading } =
|
||||
// useMarkWarehouseAsPrimary();
|
||||
|
||||
// Handle cancel mark primary alert.
|
||||
const handleCancelMarkPrimaryAlert = () => {
|
||||
closeAlert(name);
|
||||
};
|
||||
|
||||
// andle cancel mark primary confirm.
|
||||
const handleConfirmMarkPrimaryWarehouse = () => {
|
||||
markPrimaryWarehouseMutate(warehouseId)
|
||||
.then(() => {
|
||||
AppToaster.show({
|
||||
message: intl.get('warehouse.alert.mark_primary_message'),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
closeAlert(name);
|
||||
})
|
||||
.catch((error) => {
|
||||
closeAlert(name);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={<T id={'make_primary'} />}
|
||||
intent={Intent.WARNING}
|
||||
isOpen={isOpen}
|
||||
onCancel={handleCancelMarkPrimaryAlert}
|
||||
onConfirm={handleConfirmMarkPrimaryWarehouse}
|
||||
loading={isLoading}
|
||||
>
|
||||
<p>
|
||||
<T id={'warehouse.alert.are_you_sure_you_want_to_make'} />
|
||||
</p>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertStoreConnect(),
|
||||
withAlertActions,
|
||||
)(WarehouseMarkPrimaryAlert);
|
||||
@@ -0,0 +1,89 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent, Alert } from '@blueprintjs/core';
|
||||
import {
|
||||
AppToaster,
|
||||
FormattedMessage as T,
|
||||
FormattedHTMLMessage,
|
||||
} from '@/components';
|
||||
import { useDeleteWarehouseTransfer } from '@/hooks/query';
|
||||
|
||||
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
* Warehouse transfer delete alert
|
||||
* @returns
|
||||
*/
|
||||
function WarehouseTransferDeleteAlert({
|
||||
name,
|
||||
|
||||
// #withAlertStoreConnect
|
||||
isOpen,
|
||||
payload: { warehouseTransferId },
|
||||
|
||||
// #withAlertActions
|
||||
closeAlert,
|
||||
|
||||
// #withDrawerActions
|
||||
closeDrawer,
|
||||
}) {
|
||||
const { mutateAsync: deleteWarehouseTransferMutate, isLoading } =
|
||||
useDeleteWarehouseTransfer();
|
||||
|
||||
// handle cancel delete warehouse alert.
|
||||
const handleCancelDeleteAlert = () => {
|
||||
closeAlert(name);
|
||||
};
|
||||
|
||||
// handleConfirm delete warehouse transfer.
|
||||
const handleConfirmWarehouseTransferDelete = () => {
|
||||
deleteWarehouseTransferMutate(warehouseTransferId)
|
||||
.then(() => {
|
||||
AppToaster.show({
|
||||
message: intl.get('warehouse_transfer.alert.delete_message'),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
closeDrawer('warehouse-transfer-detail-drawer');
|
||||
})
|
||||
.catch(
|
||||
({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {},
|
||||
)
|
||||
.finally(() => {
|
||||
closeAlert(name);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={<T id={'delete'} />}
|
||||
icon="trash"
|
||||
intent={Intent.DANGER}
|
||||
isOpen={isOpen}
|
||||
onCancel={handleCancelDeleteAlert}
|
||||
onConfirm={handleConfirmWarehouseTransferDelete}
|
||||
loading={isLoading}
|
||||
>
|
||||
<p>
|
||||
<FormattedHTMLMessage
|
||||
id={'warehouse_transfer.once_delete_this_warehouse_transfer'}
|
||||
/>
|
||||
</p>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertStoreConnect(),
|
||||
withAlertActions,
|
||||
withDrawerActions,
|
||||
)(WarehouseTransferDeleteAlert);
|
||||
@@ -0,0 +1,71 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
import { Intent, Alert } from '@blueprintjs/core';
|
||||
|
||||
import { useInitiateWarehouseTransfer } from '@/hooks/query';
|
||||
|
||||
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
/**
|
||||
* warehouse transfer initiate alert.
|
||||
* @returns
|
||||
*/
|
||||
function WarehouseTransferInitiateAlert({
|
||||
name,
|
||||
|
||||
// #withAlertStoreConnect
|
||||
isOpen,
|
||||
payload: { warehouseTransferId },
|
||||
|
||||
// #withAlertActions
|
||||
closeAlert,
|
||||
}) {
|
||||
const { mutateAsync: initialWarehouseTransferMutate, isLoading } =
|
||||
useInitiateWarehouseTransfer();
|
||||
|
||||
// handle cancel alert.
|
||||
const handleCancelAlert = () => {
|
||||
closeAlert(name);
|
||||
};
|
||||
|
||||
// Handle confirm alert.
|
||||
const handleConfirmInitiated = () => {
|
||||
initialWarehouseTransferMutate(warehouseTransferId)
|
||||
.then(() => {
|
||||
AppToaster.show({
|
||||
message: intl.get('warehouse_transfer.alert.initiate_warehouse'),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
})
|
||||
.catch((error) => {})
|
||||
.finally(() => {
|
||||
closeAlert(name);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={<T id={'warehouse_transfer.label.initiate'} />}
|
||||
intent={Intent.WARNING}
|
||||
isOpen={isOpen}
|
||||
onCancel={handleCancelAlert}
|
||||
onConfirm={handleConfirmInitiated}
|
||||
loading={isLoading}
|
||||
>
|
||||
<p>
|
||||
<T id={'warehouse_transfer.alert.are_you_sure_you_want_to_initate'} />
|
||||
</p>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertStoreConnect(),
|
||||
withAlertActions,
|
||||
)(WarehouseTransferInitiateAlert);
|
||||
Reference in New Issue
Block a user