Refactor Delete Functionality Across Multiple Components
- Removed the delete action from various components including InvoiceInfo, PaymentInfo, and others to streamline functionality. - Introduced a new DeleteObject component to handle deletion logic in a centralized manner, enhancing code maintainability. - Updated models to utilize the new DeleteObject component for consistent deletion handling across the application. - Simplified ObjectForm by eliminating the previous delete modal, improving component structure and clarity.
This commit is contained in:
parent
c99227816e
commit
43464f8054
@ -92,10 +92,6 @@ const InvoiceInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -85,10 +85,6 @@ const PaymentInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -77,10 +77,6 @@ const TaxRecordInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -78,10 +78,6 @@ const OrderItemInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -98,10 +98,6 @@ const ProductStockInfo = () => {
|
|||||||
objectFormRef?.current.handleUpdate()
|
objectFormRef?.current.handleUpdate()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -103,10 +103,6 @@ const PurchaseOrderInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -96,10 +96,6 @@ const PurchaseOrderInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
newOrderItem: () => {
|
newOrderItem: () => {
|
||||||
setNewOrderItemOpen(true)
|
setNewOrderItemOpen(true)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -88,10 +88,6 @@ const ShipmentInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -88,10 +88,6 @@ const StockTransferInfo = () => {
|
|||||||
objectFormRef?.current.handleUpdate()
|
objectFormRef?.current.handleUpdate()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -79,10 +79,6 @@ const CourierServiceInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -75,10 +75,6 @@ const CourierInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -74,10 +74,6 @@ const FilamentSkuInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -93,10 +93,6 @@ const FilamentInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -87,10 +87,6 @@ const FileInfo = () => {
|
|||||||
fetchFileContent(objectFormState?.objectData, true)
|
fetchFileContent(objectFormState?.objectData, true)
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -88,10 +88,6 @@ const HostInfo = () => {
|
|||||||
objectFormRef?.current.handleUpdate()
|
objectFormRef?.current.handleUpdate()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -77,10 +77,6 @@ const MaterialInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -78,10 +78,6 @@ const NoteInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -69,10 +69,6 @@ const PartSkuInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -81,10 +81,6 @@ const PermissionSettingInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -74,10 +74,6 @@ const ProductCategoryInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -75,10 +75,6 @@ const ProductSkuInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -74,10 +74,6 @@ const TaxRateInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -81,10 +81,6 @@ const UserGroupInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -74,10 +74,6 @@ const VendorInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -112,10 +112,6 @@ const FilamentProfileInfo = () => {
|
|||||||
objectFormRef.current?.handleUpdate?.()
|
objectFormRef.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -90,10 +90,6 @@ const PrinterProfileInfo = () => {
|
|||||||
objectFormRef.current?.handleUpdate?.()
|
objectFormRef.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -74,10 +74,6 @@ const ClientInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -88,10 +88,6 @@ const ListingVarientInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -86,10 +86,6 @@ const ListingInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -143,10 +143,6 @@ const MarketplaceInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
connect: () => {
|
connect: () => {
|
||||||
startAuthorization()
|
startAuthorization()
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -101,10 +101,6 @@ const SalesOrderInfo = () => {
|
|||||||
objectFormRef?.current?.handleUpdate?.()
|
objectFormRef?.current?.handleUpdate?.()
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
delete: () => {
|
|
||||||
objectFormRef?.current?.handleDelete?.()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -16,7 +16,9 @@ const ActionHandler = forwardRef(
|
|||||||
) => {
|
) => {
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const action = new URLSearchParams(location.search).get(actionParam)
|
const searchParams = new URLSearchParams(location.search)
|
||||||
|
const action = searchParams.get(actionParam)
|
||||||
|
const actionObjectType = searchParams.get('actionObjectType')
|
||||||
|
|
||||||
// Ref to track last executed action
|
// Ref to track last executed action
|
||||||
const lastExecutedAction = useRef(null)
|
const lastExecutedAction = useRef(null)
|
||||||
@ -44,6 +46,7 @@ const ActionHandler = forwardRef(
|
|||||||
if (
|
if (
|
||||||
loading == false &&
|
loading == false &&
|
||||||
action &&
|
action &&
|
||||||
|
!actionObjectType &&
|
||||||
actions[action] &&
|
actions[action] &&
|
||||||
lastExecutedAction.current !== action
|
lastExecutedAction.current !== action
|
||||||
) {
|
) {
|
||||||
@ -71,6 +74,7 @@ const ActionHandler = forwardRef(
|
|||||||
}, [
|
}, [
|
||||||
loading,
|
loading,
|
||||||
action,
|
action,
|
||||||
|
actionObjectType,
|
||||||
actions,
|
actions,
|
||||||
actionParam,
|
actionParam,
|
||||||
clearAfterExecute,
|
clearAfterExecute,
|
||||||
|
|||||||
76
src/components/Dashboard/common/DeleteObject.jsx
Normal file
76
src/components/Dashboard/common/DeleteObject.jsx
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import { useState, useContext } from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import { useLocation, useNavigate } from 'react-router-dom'
|
||||||
|
import { ApiServerContext } from '../context/ApiServerContext'
|
||||||
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
|
import { useActions } from '../context/ActionsContext'
|
||||||
|
import { getModelByName } from '../../../database/ObjectModels'
|
||||||
|
import MessageDialogView from './MessageDialogView.jsx'
|
||||||
|
import BinIcon from '../../Icons/BinIcon'
|
||||||
|
|
||||||
|
const capitalizeFirstLetter = (value) => {
|
||||||
|
return String(value).charAt(0).toUpperCase() + String(value).slice(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const DeleteObject = ({ onOk, objectData, objectType: objectTypeProp }) => {
|
||||||
|
const [deleteLoading, setDeleteLoading] = useState(false)
|
||||||
|
const { deleteObject } = useContext(ApiServerContext)
|
||||||
|
const { showSuccess, showError } = useMessageContext()
|
||||||
|
const { currentObjectType } = useActions()
|
||||||
|
const location = useLocation()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const objectType =
|
||||||
|
objectTypeProp ||
|
||||||
|
new URLSearchParams(location.search).get('actionObjectType') ||
|
||||||
|
currentObjectType
|
||||||
|
|
||||||
|
const model = objectType ? getModelByName(objectType) : null
|
||||||
|
const modelLabel = model?.label || 'object'
|
||||||
|
const objectName =
|
||||||
|
objectData?.name || objectData?._reference || objectData?._id
|
||||||
|
|
||||||
|
const handleDelete = async () => {
|
||||||
|
if (!objectData?._id || !objectType) return
|
||||||
|
setDeleteLoading(true)
|
||||||
|
try {
|
||||||
|
await deleteObject(objectData._id, objectType)
|
||||||
|
showSuccess(
|
||||||
|
`${capitalizeFirstLetter(modelLabel.toLowerCase())} deleted successfully!`
|
||||||
|
)
|
||||||
|
const onInfoPage = model?.url && location.pathname === `${model.url}/info`
|
||||||
|
if (onInfoPage) {
|
||||||
|
navigate(model.url)
|
||||||
|
} else {
|
||||||
|
onOk()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error deleting object:', error)
|
||||||
|
showError(`Failed to delete ${modelLabel.toLowerCase()}.`)
|
||||||
|
} finally {
|
||||||
|
setDeleteLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MessageDialogView
|
||||||
|
icon={<BinIcon />}
|
||||||
|
title={`Are you sure you want to delete this ${modelLabel.toLowerCase()}?`}
|
||||||
|
description={
|
||||||
|
objectName ? `This will permanently delete ${objectName}.` : undefined
|
||||||
|
}
|
||||||
|
onOk={handleDelete}
|
||||||
|
okText='Delete'
|
||||||
|
okLoading={deleteLoading}
|
||||||
|
danger
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteObject.propTypes = {
|
||||||
|
onOk: PropTypes.func.isRequired,
|
||||||
|
objectData: PropTypes.object,
|
||||||
|
objectType: PropTypes.string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DeleteObject
|
||||||
@ -1,58 +0,0 @@
|
|||||||
import PropTypes from 'prop-types'
|
|
||||||
import { Modal, Button, Space, Typography } from 'antd'
|
|
||||||
import { getModelByName } from '../../../database/ObjectModels'
|
|
||||||
import BinIcon from '../../Icons/BinIcon'
|
|
||||||
|
|
||||||
const { Text } = Typography
|
|
||||||
|
|
||||||
const DeleteObjectModal = ({ open, onOk, onCancel, loading, objectType }) => {
|
|
||||||
const model = getModelByName(objectType)
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
open={open}
|
|
||||||
title={
|
|
||||||
<Space size={'middle'}>
|
|
||||||
<BinIcon />
|
|
||||||
{`Confirm Delete ${model.label}`}
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
onOk={onOk}
|
|
||||||
onCancel={onCancel}
|
|
||||||
okText='Delete'
|
|
||||||
cancelText='Cancel'
|
|
||||||
okType='danger'
|
|
||||||
closable={false}
|
|
||||||
centered
|
|
||||||
maskClosable={false}
|
|
||||||
footer={[
|
|
||||||
<Button key='cancel' onClick={onCancel} disabled={loading}>
|
|
||||||
Cancel
|
|
||||||
</Button>,
|
|
||||||
<Button
|
|
||||||
key='delete'
|
|
||||||
type='primary'
|
|
||||||
danger
|
|
||||||
onClick={onOk}
|
|
||||||
loading={loading}
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
Delete
|
|
||||||
</Button>
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Text>
|
|
||||||
Are you sure you want to delete this {model.label.toLowerCase()}?
|
|
||||||
</Text>
|
|
||||||
</Modal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteObjectModal.propTypes = {
|
|
||||||
open: PropTypes.bool.isRequired,
|
|
||||||
onOk: PropTypes.func.isRequired,
|
|
||||||
onCancel: PropTypes.func.isRequired,
|
|
||||||
loading: PropTypes.bool,
|
|
||||||
objectType: PropTypes.string.isRequired
|
|
||||||
}
|
|
||||||
|
|
||||||
export default DeleteObjectModal
|
|
||||||
@ -10,7 +10,8 @@ const MessageDialogView = ({
|
|||||||
description,
|
description,
|
||||||
onOk,
|
onOk,
|
||||||
okText,
|
okText,
|
||||||
okLoading
|
okLoading,
|
||||||
|
danger = false
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Flex vertical gap={'middle'}>
|
<Flex vertical gap={'middle'}>
|
||||||
@ -20,7 +21,12 @@ const MessageDialogView = ({
|
|||||||
</Flex>
|
</Flex>
|
||||||
{description && <Text>{description}</Text>}
|
{description && <Text>{description}</Text>}
|
||||||
<Flex justify={'end'}>
|
<Flex justify={'end'}>
|
||||||
<Button type='primary' onClick={onOk} loading={okLoading}>
|
<Button
|
||||||
|
type='primary'
|
||||||
|
danger={danger}
|
||||||
|
onClick={onOk}
|
||||||
|
loading={okLoading}
|
||||||
|
>
|
||||||
{okText || 'OK'}
|
{okText || 'OK'}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
@ -34,7 +40,8 @@ MessageDialogView.propTypes = {
|
|||||||
description: PropTypes.node,
|
description: PropTypes.node,
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
okText: PropTypes.string,
|
okText: PropTypes.string,
|
||||||
okLoading: PropTypes.bool
|
okLoading: PropTypes.bool,
|
||||||
|
danger: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MessageDialogView
|
export default MessageDialogView
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { Form } from 'antd'
|
|||||||
import { ApiServerContext } from '../context/ApiServerContext'
|
import { ApiServerContext } from '../context/ApiServerContext'
|
||||||
import { AuthContext } from '../context/AuthContext'
|
import { AuthContext } from '../context/AuthContext'
|
||||||
import { useMessageContext } from '../context/MessageContext'
|
import { useMessageContext } from '../context/MessageContext'
|
||||||
import DeleteObjectModal from './DeleteObjectModal'
|
|
||||||
import merge from 'lodash/merge'
|
import merge from 'lodash/merge'
|
||||||
import mergeWith from 'lodash/mergeWith'
|
import mergeWith from 'lodash/mergeWith'
|
||||||
import set from 'lodash/set'
|
import set from 'lodash/set'
|
||||||
@ -157,12 +156,9 @@ const ObjectForm = forwardRef(
|
|||||||
const [form] = Form.useForm()
|
const [form] = Form.useForm()
|
||||||
const formUpdateValues = Form.useWatch([], form)
|
const formUpdateValues = Form.useWatch([], form)
|
||||||
const { showSuccess, showError } = useMessageContext()
|
const { showSuccess, showError } = useMessageContext()
|
||||||
const [deleteModalOpen, setDeleteModalOpen] = useState(false)
|
|
||||||
const [deleteLoading, setDeleteLoading] = useState(false)
|
|
||||||
const {
|
const {
|
||||||
fetchObject,
|
fetchObject,
|
||||||
updateObject,
|
updateObject,
|
||||||
deleteObject,
|
|
||||||
setObjectActivity,
|
setObjectActivity,
|
||||||
clearObjectActivity,
|
clearObjectActivity,
|
||||||
fetchObjectActivities,
|
fetchObjectActivities,
|
||||||
@ -777,34 +773,10 @@ const ObjectForm = forwardRef(
|
|||||||
onStateChangeRef.current({ editLoading: false })
|
onStateChangeRef.current({ editLoading: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDelete = () => {
|
|
||||||
setDeleteModalOpen(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmDelete = async () => {
|
|
||||||
setDeleteLoading(true)
|
|
||||||
try {
|
|
||||||
await deleteObject(id, type)
|
|
||||||
setDeleteModalOpen(false)
|
|
||||||
showSuccess(`${getModelMessageLabel(type)} deleted successfully!`)
|
|
||||||
navigate(-2)
|
|
||||||
// Optionally: trigger a callback to parent to remove this object from view
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
showError(
|
|
||||||
`Failed to delete ${getModelMessageLabel(type).toLowerCase()}.`
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
setDeleteLoading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
startEditing,
|
startEditing,
|
||||||
cancelEditing,
|
cancelEditing,
|
||||||
handleUpdate,
|
handleUpdate,
|
||||||
handleDelete,
|
|
||||||
confirmDelete,
|
|
||||||
handleFetchObject,
|
handleFetchObject,
|
||||||
editLoading,
|
editLoading,
|
||||||
fetchLoading,
|
fetchLoading,
|
||||||
@ -815,14 +787,6 @@ const ObjectForm = forwardRef(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DeleteObjectModal
|
|
||||||
open={deleteModalOpen}
|
|
||||||
onOk={confirmDelete}
|
|
||||||
onCancel={() => setDeleteModalOpen(false)}
|
|
||||||
loading={deleteLoading}
|
|
||||||
objectType={type}
|
|
||||||
objectName={objectData?.name || objectData?.label || ''}
|
|
||||||
/>
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout='vertical'
|
layout='vertical'
|
||||||
@ -897,8 +861,7 @@ const ObjectForm = forwardRef(
|
|||||||
editLoading,
|
editLoading,
|
||||||
editDisabled: getEditDisabled(model, objectData, userProfile),
|
editDisabled: getEditDisabled(model, objectData, userProfile),
|
||||||
activities,
|
activities,
|
||||||
handleFetchObject,
|
handleFetchObject
|
||||||
handleDelete
|
|
||||||
})}
|
})}
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -174,9 +174,7 @@ const ActionsProvider = ({ children }) => {
|
|||||||
|
|
||||||
const [modalCentered, setModalCentered] = useState(false)
|
const [modalCentered, setModalCentered] = useState(false)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (resolvedModalAction?.modalCentered !== undefined) {
|
setModalCentered(resolvedModalAction?.modalCentered === true)
|
||||||
setModalCentered(resolvedModalAction.modalCentered)
|
|
||||||
}
|
|
||||||
}, [resolvedModalAction?.modalCentered])
|
}, [resolvedModalAction?.modalCentered])
|
||||||
|
|
||||||
const modalContentData =
|
const modalContentData =
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const ClientInfo = lazy(
|
|||||||
const NewClient = lazy(
|
const NewClient = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/Clients/NewClient')
|
() => import('../../components/Dashboard/Sales/Clients/NewClient')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ClientIcon from '../../components/Icons/ClientIcon'
|
import ClientIcon from '../../components/Icons/ClientIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const Client = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const CourierInfo = lazy(
|
|||||||
const NewCourier = lazy(
|
const NewCourier = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Couriers/NewCourier')
|
() => import('../../components/Dashboard/Management/Couriers/NewCourier')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import CourierIcon from '../../components/Icons/CourierIcon'
|
import CourierIcon from '../../components/Icons/CourierIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const Courier = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const CourierServiceInfo = lazy(
|
|||||||
const NewCourierService = lazy(
|
const NewCourierService = lazy(
|
||||||
() => import('../../components/Dashboard/Management/CourierServices/NewCourierService')
|
() => import('../../components/Dashboard/Management/CourierServices/NewCourierService')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import CourierServiceIcon from '../../components/Icons/CourierServiceIcon'
|
import CourierServiceIcon from '../../components/Icons/CourierServiceIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const CourierService = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const FilamentInfo = lazy(
|
|||||||
const NewFilament = lazy(
|
const NewFilament = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Filaments/NewFilament')
|
() => import('../../components/Dashboard/Management/Filaments/NewFilament')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import EditIcon from '../../components/Icons/EditIcon'
|
import EditIcon from '../../components/Icons/EditIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import CheckIcon from '../../components/Icons/CheckIcon'
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
||||||
@ -95,13 +98,17 @@ export const Filament = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
return !(objectData?._isEditing && objectData?._isEditing == true)
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -7,6 +7,9 @@ const FilamentProfileInfo = lazy(
|
|||||||
const NewFilamentProfile = lazy(
|
const NewFilamentProfile = lazy(
|
||||||
() => import('../../components/Dashboard/Production/FilamentProfiles/NewFilamentProfile')
|
() => import('../../components/Dashboard/Production/FilamentProfiles/NewFilamentProfile')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import FilamentProfileIcon from '../../components/Icons/FilamentProfileIcon'
|
import FilamentProfileIcon from '../../components/Icons/FilamentProfileIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -85,12 +88,16 @@ export const FilamentProfile = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
row: true,
|
row: true,
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const FilamentSkuInfo = lazy(
|
|||||||
const NewFilamentSku = lazy(
|
const NewFilamentSku = lazy(
|
||||||
() => import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
() => import('../../components/Dashboard/Management/FilamentSkus/NewFilamentSku')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import FilamentSkuIcon from '../../components/Icons/FilamentSkuIcon'
|
import FilamentSkuIcon from '../../components/Icons/FilamentSkuIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const FilamentSku = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import { createElement, lazy } from 'react'
|
|||||||
const FileInfo = lazy(
|
const FileInfo = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Files/FileInfo')
|
() => import('../../components/Dashboard/Management/Files/FileInfo')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import DownloadIcon from '../../components/Icons/DownloadIcon'
|
import DownloadIcon from '../../components/Icons/DownloadIcon'
|
||||||
import FileIcon from '../../components/Icons/FileIcon'
|
import FileIcon from '../../components/Icons/FileIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -78,11 +81,15 @@ export const File = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -9,6 +9,9 @@ const NewHost = lazy(
|
|||||||
const HostOTP = lazy(
|
const HostOTP = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Hosts/HostOtp')
|
() => import('../../components/Dashboard/Management/Hosts/HostOtp')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import HostIcon from '../../components/Icons/HostIcon'
|
import HostIcon from '../../components/Icons/HostIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -100,11 +103,15 @@ export const Host = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -12,6 +12,9 @@ const PostInvoice = lazy(
|
|||||||
const AcknowledgeInvoice = lazy(
|
const AcknowledgeInvoice = lazy(
|
||||||
() => import('../../components/Dashboard/Finance/Invoices/AcknowledgeInvoice')
|
() => import('../../components/Dashboard/Finance/Invoices/AcknowledgeInvoice')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import InvoiceIcon from '../../components/Icons/InvoiceIcon'
|
import InvoiceIcon from '../../components/Icons/InvoiceIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -92,8 +95,9 @@ export const Invoice = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -102,6 +106,9 @@ export const Invoice = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -9,6 +9,9 @@ const NewJob = lazy(
|
|||||||
const DeployJob = lazy(
|
const DeployJob = lazy(
|
||||||
() => import('../../components/Dashboard/Production/Jobs/DeployJob')
|
() => import('../../components/Dashboard/Production/Jobs/DeployJob')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import JobIcon from '../../components/Icons/JobIcon'
|
import JobIcon from '../../components/Icons/JobIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -90,8 +93,9 @@ export const Job = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -100,6 +104,9 @@ export const Job = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -12,6 +12,9 @@ const PublishListing = lazy(
|
|||||||
const UnpublishListing = lazy(
|
const UnpublishListing = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/Listings/UnpublishListing')
|
() => import('../../components/Dashboard/Sales/Listings/UnpublishListing')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ListingIcon from '../../components/Icons/ListingIcon'
|
import ListingIcon from '../../components/Icons/ListingIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -126,11 +129,15 @@ export const Listing = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -12,6 +12,9 @@ const PublishListingVarient = lazy(
|
|||||||
const UnpublishListingVarient = lazy(
|
const UnpublishListingVarient = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/ListingVarients/UnpublishListingVarient')
|
() => import('../../components/Dashboard/Sales/ListingVarients/UnpublishListingVarient')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ListingVarientIcon from '../../components/Icons/ListingVarientIcon'
|
import ListingVarientIcon from '../../components/Icons/ListingVarientIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -118,11 +121,15 @@ export const ListingVarient = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -12,6 +12,9 @@ const SyncListings = lazy(
|
|||||||
const SyncOrders = lazy(
|
const SyncOrders = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/Marketplaces/SyncOrders')
|
() => import('../../components/Dashboard/Sales/Marketplaces/SyncOrders')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import MarketplaceIcon from '../../components/Icons/MarketplaceIcon'
|
import MarketplaceIcon from '../../components/Icons/MarketplaceIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -154,11 +157,15 @@ export const Marketplace = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const MaterialInfo = lazy(
|
|||||||
const NewMaterial = lazy(
|
const NewMaterial = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Materials/NewMaterial')
|
() => import('../../components/Dashboard/Management/Materials/NewMaterial')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import MaterialIcon from '../../components/Icons/MaterialIcon'
|
import MaterialIcon from '../../components/Icons/MaterialIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const Material = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const OrderItemInfo = lazy(
|
|||||||
const NewOrderItem = lazy(
|
const NewOrderItem = lazy(
|
||||||
() => import('../../components/Dashboard/Inventory/OrderItems/NewOrderItem')
|
() => import('../../components/Dashboard/Inventory/OrderItems/NewOrderItem')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import OrderItemIcon from '../../components/Icons/OrderItemIcon'
|
import OrderItemIcon from '../../components/Icons/OrderItemIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -31,7 +34,11 @@ export const OrderItem = {
|
|||||||
label: 'New Order Item',
|
label: 'New Order Item',
|
||||||
icon: PlusIcon,
|
icon: PlusIcon,
|
||||||
content: (objectData, { onOk } = {}) => {
|
content: (objectData, { onOk } = {}) => {
|
||||||
return createElement(NewOrderItem, { defaultValues: objectData, onOk, reset: true })
|
return createElement(NewOrderItem, {
|
||||||
|
defaultValues: objectData,
|
||||||
|
onOk,
|
||||||
|
reset: true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -86,9 +93,11 @@ export const OrderItem = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
|
row: true,
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
@ -96,6 +105,9 @@ export const OrderItem = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const PartSkuInfo = lazy(
|
|||||||
const NewPartSku = lazy(
|
const NewPartSku = lazy(
|
||||||
() => import('../../components/Dashboard/Management/PartSkus/NewPartSku')
|
() => import('../../components/Dashboard/Management/PartSkus/NewPartSku')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PartSkuIcon from '../../components/Icons/PartSkuIcon'
|
import PartSkuIcon from '../../components/Icons/PartSkuIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const PartSku = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -18,6 +18,9 @@ const DeclinePayment = lazy(
|
|||||||
const CancelPayment = lazy(
|
const CancelPayment = lazy(
|
||||||
() => import('../../components/Dashboard/Finance/Payments/CancelPayment')
|
() => import('../../components/Dashboard/Finance/Payments/CancelPayment')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PaymentIcon from '../../components/Icons/PaymentIcon'
|
import PaymentIcon from '../../components/Icons/PaymentIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -98,8 +101,9 @@ export const Payment = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -108,6 +112,9 @@ export const Payment = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -7,6 +7,9 @@ const PermissionSettingInfo = lazy(
|
|||||||
const NewPermissionSetting = lazy(
|
const NewPermissionSetting = lazy(
|
||||||
() => import('../../components/Dashboard/Management/PermissionSettings/NewPermissionSetting')
|
() => import('../../components/Dashboard/Management/PermissionSettings/NewPermissionSetting')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PermissionSettingIcon from '../../components/Icons/PermissionSettingIcon'
|
import PermissionSettingIcon from '../../components/Icons/PermissionSettingIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -86,11 +89,15 @@ export const PermissionSetting = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const PrinterProfileInfo = lazy(
|
|||||||
const NewPrinterProfile = lazy(
|
const NewPrinterProfile = lazy(
|
||||||
() => import('../../components/Dashboard/Production/PrinterProfiles/NewPrinterProfile')
|
() => import('../../components/Dashboard/Production/PrinterProfiles/NewPrinterProfile')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PrinterProfileIcon from '../../components/Icons/PrinterProfileIcon'
|
import PrinterProfileIcon from '../../components/Icons/PrinterProfileIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -349,12 +352,16 @@ export const PrinterProfile = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
row: true,
|
row: true,
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const ProductCategoryInfo = lazy(
|
|||||||
const NewProductCategory = lazy(
|
const NewProductCategory = lazy(
|
||||||
() => import('../../components/Dashboard/Management/ProductCategories/NewProductCategory')
|
() => import('../../components/Dashboard/Management/ProductCategories/NewProductCategory')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ProductCategoryIcon from '../../components/Icons/ProductCategoryIcon'
|
import ProductCategoryIcon from '../../components/Icons/ProductCategoryIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -85,11 +88,15 @@ export const ProductCategory = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const ProductSkuInfo = lazy(
|
|||||||
const NewProductSku = lazy(
|
const NewProductSku = lazy(
|
||||||
() => import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
() => import('../../components/Dashboard/Management/ProductSkus/NewProductSku')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ProductSkuIcon from '../../components/Icons/ProductSkuIcon'
|
import ProductSkuIcon from '../../components/Icons/ProductSkuIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const ProductSku = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -9,6 +9,9 @@ const NewProductStock = lazy(
|
|||||||
const PostProductStock = lazy(
|
const PostProductStock = lazy(
|
||||||
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
|
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ProductStockIcon from '../../components/Icons/ProductStockIcon'
|
import ProductStockIcon from '../../components/Icons/ProductStockIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import { getModelByName } from '../ObjectModels.js'
|
import { getModelByName } from '../ObjectModels.js'
|
||||||
@ -90,8 +93,9 @@ export const ProductStock = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -100,6 +104,9 @@ export const ProductStock = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -15,6 +15,9 @@ const AcknowledgePurchaseOrder = lazy(
|
|||||||
const CancelPurchaseOrder = lazy(
|
const CancelPurchaseOrder = lazy(
|
||||||
() => import('../../components/Dashboard/Inventory/PurchaseOrders/CancelPurchaseOrder')
|
() => import('../../components/Dashboard/Inventory/PurchaseOrders/CancelPurchaseOrder')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PurchaseOrderIcon from '../../components/Icons/PurchaseOrderIcon'
|
import PurchaseOrderIcon from '../../components/Icons/PurchaseOrderIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -95,8 +98,9 @@ export const PurchaseOrder = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -105,6 +109,9 @@ export const PurchaseOrder = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -15,6 +15,9 @@ const ConfirmSalesOrder = lazy(
|
|||||||
const CancelSalesOrder = lazy(
|
const CancelSalesOrder = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/SalesOrders/CancelSalesOrder')
|
() => import('../../components/Dashboard/Sales/SalesOrders/CancelSalesOrder')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import SalesOrderIcon from '../../components/Icons/SalesOrderIcon'
|
import SalesOrderIcon from '../../components/Icons/SalesOrderIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -95,8 +98,9 @@ export const SalesOrder = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -105,6 +109,9 @@ export const SalesOrder = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -15,6 +15,9 @@ const ReceiveShipment = lazy(
|
|||||||
const CancelShipment = lazy(
|
const CancelShipment = lazy(
|
||||||
() => import('../../components/Dashboard/Inventory/Shipments/CancelShipment')
|
() => import('../../components/Dashboard/Inventory/Shipments/CancelShipment')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import ShipmentIcon from '../../components/Icons/ShipmentIcon'
|
import ShipmentIcon from '../../components/Icons/ShipmentIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -95,8 +98,9 @@ export const Shipment = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -105,6 +109,9 @@ export const Shipment = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -9,6 +9,9 @@ const NewStockTransfer = lazy(
|
|||||||
const PostStockTransfer = lazy(
|
const PostStockTransfer = lazy(
|
||||||
() => import('../../components/Dashboard/Inventory/StockTransfers/PostStockTransfer')
|
() => import('../../components/Dashboard/Inventory/StockTransfers/PostStockTransfer')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import StockTransferIcon from '../../components/Icons/StockTransferIcon'
|
import StockTransferIcon from '../../components/Icons/StockTransferIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -89,8 +92,9 @@ export const StockTransfer = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true,
|
danger: true,
|
||||||
@ -99,6 +103,9 @@ export const StockTransfer = {
|
|||||||
},
|
},
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
|
},
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const TaxRateInfo = lazy(
|
|||||||
const NewTaxRate = lazy(
|
const NewTaxRate = lazy(
|
||||||
() => import('../../components/Dashboard/Management/TaxRates/NewTaxRate')
|
() => import('../../components/Dashboard/Management/TaxRates/NewTaxRate')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import TaxRateIcon from '../../components/Icons/TaxRateIcon'
|
import TaxRateIcon from '../../components/Icons/TaxRateIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const TaxRate = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const TaxRecordInfo = lazy(
|
|||||||
const NewTaxRecord = lazy(
|
const NewTaxRecord = lazy(
|
||||||
() => import('../../components/Dashboard/Finance/TaxRecords/NewTaxRecord')
|
() => import('../../components/Dashboard/Finance/TaxRecords/NewTaxRecord')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import TaxRecordIcon from '../../components/Icons/TaxRecordIcon'
|
import TaxRecordIcon from '../../components/Icons/TaxRecordIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const TaxRecord = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const UserGroupInfo = lazy(
|
|||||||
const NewUserGroup = lazy(
|
const NewUserGroup = lazy(
|
||||||
() => import('../../components/Dashboard/Management/UserGroups/NewUserGroup')
|
() => import('../../components/Dashboard/Management/UserGroups/NewUserGroup')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import PersonGroupIcon from '../../components/Icons/PersonGroupIcon'
|
import PersonGroupIcon from '../../components/Icons/PersonGroupIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -85,11 +88,15 @@ export const UserGroup = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ const VendorInfo = lazy(
|
|||||||
const NewVendor = lazy(
|
const NewVendor = lazy(
|
||||||
() => import('../../components/Dashboard/Management/Vendors/NewVendor')
|
() => import('../../components/Dashboard/Management/Vendors/NewVendor')
|
||||||
)
|
)
|
||||||
|
const DeleteObject = lazy(
|
||||||
|
() => import('../../components/Dashboard/common/DeleteObject')
|
||||||
|
)
|
||||||
import VendorIcon from '../../components/Icons/VendorIcon'
|
import VendorIcon from '../../components/Icons/VendorIcon'
|
||||||
import PlusIcon from '../../components/Icons/PlusIcon'
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -84,11 +87,15 @@ export const Vendor = {
|
|||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
type: 'page',
|
type: 'modal',
|
||||||
pageName: 'info',
|
modalWidth: 520,
|
||||||
|
modalCentered: true,
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
icon: BinIcon,
|
icon: BinIcon,
|
||||||
danger: true
|
danger: true,
|
||||||
|
content: (objectData, { onOk } = {}) => {
|
||||||
|
return createElement(DeleteObject, { objectData, onOk })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user