{
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const productId = new URLSearchParams(location.search).get('productId')
const [collapseState, updateCollapseState] = useCollapseState('ProductInfo', {
@@ -29,7 +29,7 @@ const ProductInfo = () => {
notes: true,
auditLogs: true
})
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -39,19 +39,19 @@ const ProductInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current?.fetchObject?.()
+ objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
- editFormRef?.current?.startEditing?.()
+ objectFormRef?.current?.startEditing?.()
return false
},
cancelEdit: () => {
- editFormRef?.current?.cancelEditing?.()
+ objectFormRef?.current?.cancelEditing?.()
return true
},
finishEdit: () => {
- editFormRef?.current?.handleUpdate?.()
+ objectFormRef?.current?.handleUpdate?.()
return true
}
}
@@ -69,10 +69,10 @@ const ProductInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -97,10 +97,10 @@ const ProductInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -108,7 +108,7 @@ const ProductInfo = () => {
{
id={productId}
type='product'
style={{ height: '100%' }}
- ref={editFormRef}
+ ref={objectFormRef}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
@@ -174,7 +174,7 @@ const ProductInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (
{
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const userId = new URLSearchParams(location.search).get('userId')
const [collapseState, updateCollapseState] = useCollapseState('UserInfo', {
@@ -28,7 +28,7 @@ const UserInfo = () => {
notes: true,
auditLogs: true
})
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -38,19 +38,19 @@ const UserInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current?.fetchObject?.()
+ objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
- editFormRef?.current?.startEditing?.()
+ objectFormRef?.current?.startEditing?.()
return false
},
cancelEdit: () => {
- editFormRef?.current?.cancelEditing?.()
+ objectFormRef?.current?.cancelEditing?.()
return true
},
finishEdit: () => {
- editFormRef?.current?.handleUpdate?.()
+ objectFormRef?.current?.handleUpdate?.()
return true
}
}
@@ -68,10 +68,10 @@ const UserInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -95,10 +95,10 @@ const UserInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -106,7 +106,7 @@ const UserInfo = () => {
{
id={userId}
type='user'
style={{ height: '100%' }}
- ref={editFormRef}
+ ref={objectFormRef}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
@@ -157,7 +157,7 @@ const UserInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (
{
- const [currentStep, setCurrentStep] = useState(0)
- const isMobile = useMediaQuery({ maxWidth: 768 })
-
return (
{({ handleSubmit, submitLoading, objectData, formValid }) => {
@@ -65,43 +56,16 @@ const NewVendor = ({ onOk }) => {
}
]
return (
-
- {!isMobile && (
-
-
-
- )}
-
- {!isMobile && (
-
- )}
-
-
-
- New Vendor
-
-
- {steps[currentStep].content}
-
- setCurrentStep((prev) => prev - 1)}
- onNext={() => setCurrentStep((prev) => prev + 1)}
- onSubmit={() => {
- handleSubmit()
- onOk()
- }}
- formValid={formValid}
- submitLoading={submitLoading}
- />
-
-
+ {
+ handleSubmit()
+ onOk()
+ }}
+ />
)
}}
diff --git a/src/components/Dashboard/Management/Vendors/VendorInfo.jsx b/src/components/Dashboard/Management/Vendors/VendorInfo.jsx
index c07ca8c..3b2eb56 100644
--- a/src/components/Dashboard/Management/Vendors/VendorInfo.jsx
+++ b/src/components/Dashboard/Management/Vendors/VendorInfo.jsx
@@ -24,7 +24,7 @@ log.setLevel(config.logLevel)
const VendorInfo = () => {
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const vendorId = new URLSearchParams(location.search).get('vendorId')
const [collapseState, updateCollapseState] = useCollapseState('VendorInfo', {
@@ -32,7 +32,7 @@ const VendorInfo = () => {
notes: true,
auditLogs: true
})
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -42,23 +42,23 @@ const VendorInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current?.handleFetchObject?.()
+ objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
- editFormRef?.current?.startEditing?.()
+ objectFormRef?.current?.startEditing?.()
return false
},
cancelEdit: () => {
- editFormRef?.current?.cancelEditing?.()
+ objectFormRef?.current?.cancelEditing?.()
return true
},
finishEdit: () => {
- editFormRef?.current?.handleUpdate?.()
+ objectFormRef?.current?.handleUpdate?.()
return true
},
delete: () => {
- editFormRef?.current?.handleDelete?.()
+ objectFormRef?.current?.handleDelete?.()
return true
}
}
@@ -76,10 +76,10 @@ const VendorInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -103,10 +103,10 @@ const VendorInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -114,7 +114,7 @@ const VendorInfo = () => {
{
id={vendorId}
type='vendor'
style={{ height: '100%' }}
- ref={editFormRef}
+ ref={objectFormRef}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
@@ -164,7 +164,7 @@ const VendorInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (
{
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const gcodeFileId = new URLSearchParams(location.search).get('gcodeFileId')
const [collapseState, updateCollapseState] = useCollapseState(
@@ -41,7 +41,7 @@ const GCodeFileInfo = () => {
}
)
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -51,19 +51,19 @@ const GCodeFileInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current.handleFetchObject()
+ objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
- editFormRef?.current.startEditing()
+ objectFormRef?.current.startEditing()
return false
},
cancelEdit: () => {
- editFormRef?.current.cancelEditing()
+ objectFormRef?.current.cancelEditing()
return true
},
finishEdit: () => {
- editFormRef?.current.handleUpdate()
+ objectFormRef?.current.handleUpdate()
return true
}
}
@@ -84,10 +84,10 @@ const GCodeFileInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -112,10 +112,10 @@ const GCodeFileInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -124,14 +124,14 @@ const GCodeFileInfo = () => {
{
console.log('Got edit form state change', state)
setEditFormState((prev) => ({ ...prev, ...state }))
@@ -206,7 +206,7 @@ const GCodeFileInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (
{
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const jobId = new URLSearchParams(location.search).get('jobId')
const [collapseState, updateCollapseState] = useCollapseState('JobInfo', {
@@ -36,7 +36,7 @@ const JobInfo = () => {
auditLogs: true
})
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -46,19 +46,19 @@ const JobInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current.handleFetchObject()
+ objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
- editFormRef?.current.startEditing()
+ objectFormRef?.current.startEditing()
return false
},
cancelEdit: () => {
- editFormRef?.current.cancelEditing()
+ objectFormRef?.current.cancelEditing()
return true
},
finishEdit: () => {
- editFormRef?.current.handleUpdate()
+ objectFormRef?.current.handleUpdate()
return true
}
}
@@ -79,10 +79,10 @@ const JobInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -107,10 +107,10 @@ const JobInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -119,7 +119,7 @@ const JobInfo = () => {
{
id={jobId}
type='job'
style={{ height: '100%' }}
- ref={editFormRef}
+ ref={objectFormRef}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
@@ -186,7 +186,7 @@ const JobInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (
{
const location = useLocation()
- const editFormRef = useRef(null)
+ const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null)
const printerId = new URLSearchParams(location.search).get('printerId')
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
@@ -35,7 +35,7 @@ const PrinterInfo = () => {
auditLogs: true
})
- const [editFormState, setEditFormState] = useState({
+ const [objectFormState, setEditFormState] = useState({
isEditing: false,
editLoading: false,
formValid: false,
@@ -45,20 +45,20 @@ const PrinterInfo = () => {
const actions = {
reload: () => {
- editFormRef?.current.handleFetchObject()
+ objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
- editFormRef?.current.startEditing()
+ objectFormRef?.current.startEditing()
console.log('CALLING START EDITING')
return false
},
cancelEdit: () => {
- editFormRef?.current.cancelEditing()
+ objectFormRef?.current.cancelEditing()
return true
},
finishEdit: () => {
- editFormRef?.current.handleUpdate()
+ objectFormRef?.current.handleUpdate()
return true
}
}
@@ -79,10 +79,10 @@ const PrinterInfo = () => {
{
updateVisibleState={updateCollapseState}
/>
-
+
{
actionHandlerRef.current.callAction('finishEdit')
}}
@@ -106,10 +106,10 @@ const PrinterInfo = () => {
startEditing={() => {
actionHandlerRef.current.callAction('edit')
}}
- editLoading={editFormState.editLoading}
- formValid={editFormState.formValid}
- disabled={editFormState.lock?.locked || editFormState.loading}
- loading={editFormState.editLoading}
+ editLoading={objectFormState.editLoading}
+ formValid={objectFormState.formValid}
+ disabled={objectFormState.lock?.locked || objectFormState.loading}
+ loading={objectFormState.editLoading}
/>
@@ -118,7 +118,7 @@ const PrinterInfo = () => {
{
id={printerId}
type='printer'
style={{ height: '100%' }}
- ref={editFormRef}
+ ref={objectFormRef}
onStateChange={(state) => {
console.log('Got edit form state change', state)
setEditFormState((prev) => ({ ...prev, ...state }))
@@ -174,7 +174,7 @@ const PrinterInfo = () => {
}
collapseKey='auditLogs'
>
- {editFormState.loading ? (
+ {objectFormState.loading ? (
) : (