Refactor form components to accept defaultValues prop for enhanced flexibility
- Updated NewFilamentStock, NewPartStock, NewPurchaseOrder, NewStockAudit, NewCourierService, NewCourier, NewDocumentPrinter, NewDocumentSize, NewDocumentTemplate, NewPart, NewProduct, NewTaxRate, NewTaxRecord, NewVendor, NewGCodeFile, NewJob, and NewPrinter components to accept a defaultValues prop. - Merged defaultValues with existing default values in each component to allow for more customizable form initialization.
This commit is contained in:
parent
dbb6be8654
commit
2f323181f5
@ -3,12 +3,12 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewFilamentStock = ({ onOk, reset }) => {
|
const NewFilamentStock = ({ onOk, reset, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'filamentStock'}
|
type={'filamentStock'}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ state: { type: 'unconsumed' } }}
|
defaultValues={{ state: { type: 'unconsumed' }, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -64,7 +64,8 @@ const NewFilamentStock = ({ onOk, reset }) => {
|
|||||||
|
|
||||||
NewFilamentStock.propTypes = {
|
NewFilamentStock.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewFilamentStock
|
export default NewFilamentStock
|
||||||
|
|||||||
@ -3,12 +3,12 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewPartStock = ({ onOk, reset }) => {
|
const NewPartStock = ({ onOk, reset, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'partStock'}
|
type={'partStock'}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ state: { type: 'new' } }}
|
defaultValues={{ state: { type: 'new' }, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -64,7 +64,8 @@ const NewPartStock = ({ onOk, reset }) => {
|
|||||||
|
|
||||||
NewPartStock.propTypes = {
|
NewPartStock.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewPartStock
|
export default NewPartStock
|
||||||
|
|||||||
@ -5,12 +5,12 @@ import WizardView from '../../common/WizardView'
|
|||||||
import { getModelProperty } from '../../../../database/ObjectModels.js'
|
import { getModelProperty } from '../../../../database/ObjectModels.js'
|
||||||
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
import ObjectProperty from '../../common/ObjectProperty.jsx'
|
||||||
|
|
||||||
const NewPurchaseOrder = ({ onOk, reset }) => {
|
const NewPurchaseOrder = ({ onOk, reset, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'purchaseOrder'}
|
type={'purchaseOrder'}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ state: { type: 'new' } }}
|
defaultValues={{ state: { type: 'new' }, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -83,7 +83,8 @@ const NewPurchaseOrder = ({ onOk, reset }) => {
|
|||||||
|
|
||||||
NewPurchaseOrder.propTypes = {
|
NewPurchaseOrder.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewPurchaseOrder
|
export default NewPurchaseOrder
|
||||||
|
|||||||
@ -3,12 +3,12 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewStockAudit = ({ onOk, reset }) => {
|
const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'stockAudit'}
|
type={'stockAudit'}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ state: { type: 'new' } }}
|
defaultValues={{ state: { type: 'new' }, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -64,7 +64,8 @@ const NewStockAudit = ({ onOk, reset }) => {
|
|||||||
|
|
||||||
NewStockAudit.propTypes = {
|
NewStockAudit.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewStockAudit
|
export default NewStockAudit
|
||||||
|
|||||||
@ -3,13 +3,14 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewCourierService = ({ onOk }) => {
|
const NewCourierService = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'courierService'}
|
type={'courierService'}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
active: true,
|
active: true,
|
||||||
tracked: false
|
tracked: false,
|
||||||
|
...defaultValues
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
@ -80,7 +81,8 @@ const NewCourierService = ({ onOk }) => {
|
|||||||
|
|
||||||
NewCourierService.propTypes = {
|
NewCourierService.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewCourierService
|
export default NewCourierService
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewCourier = ({ onOk }) => {
|
const NewCourier = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'courier'}>
|
<NewObjectForm type={'courier'} defaultValues={{ ...defaultValues }}>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -74,7 +74,8 @@ const NewCourier = ({ onOk }) => {
|
|||||||
|
|
||||||
NewCourier.propTypes = {
|
NewCourier.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewCourier
|
export default NewCourier
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewDocumentPrinter = ({ onOk }) => {
|
const NewDocumentPrinter = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'documentPrinter'}
|
type={'documentPrinter'}
|
||||||
defaultValues={{ active: true, global: false }}
|
defaultValues={{ active: true, global: false, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -79,7 +79,8 @@ const NewDocumentPrinter = ({ onOk }) => {
|
|||||||
|
|
||||||
NewDocumentPrinter.propTypes = {
|
NewDocumentPrinter.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewDocumentPrinter
|
export default NewDocumentPrinter
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewDocumentSize = ({ onOk }) => {
|
const NewDocumentSize = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'documentSize'}>
|
<NewObjectForm type={'documentSize'} defaultValues={{ ...defaultValues }}>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -60,7 +60,8 @@ const NewDocumentSize = ({ onOk }) => {
|
|||||||
|
|
||||||
NewDocumentSize.propTypes = {
|
NewDocumentSize.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewDocumentSize
|
export default NewDocumentSize
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewDocumentTemplate = ({ onOk }) => {
|
const NewDocumentTemplate = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'documentTemplate'}
|
type={'documentTemplate'}
|
||||||
defaultValues={{ active: true, global: false }}
|
defaultValues={{ active: true, global: false, ...defaultValues }}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -79,7 +79,8 @@ const NewDocumentTemplate = ({ onOk }) => {
|
|||||||
|
|
||||||
NewDocumentTemplate.propTypes = {
|
NewDocumentTemplate.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewDocumentTemplate
|
export default NewDocumentTemplate
|
||||||
|
|||||||
@ -3,11 +3,15 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewPart = ({ onOk }) => {
|
const NewPart = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'part'}
|
type={'part'}
|
||||||
defaultValues={{ priceMode: 'margin', globalPricing: true }}
|
defaultValues={{
|
||||||
|
priceMode: 'margin',
|
||||||
|
globalPricing: true,
|
||||||
|
...defaultValues
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -112,7 +116,8 @@ const NewPart = ({ onOk }) => {
|
|||||||
|
|
||||||
NewPart.propTypes = {
|
NewPart.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewPart
|
export default NewPart
|
||||||
|
|||||||
@ -3,9 +3,12 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewProduct = ({ onOk }) => {
|
const NewProduct = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'product'} defaultValues={{ priceMode: 'margin' }}>
|
<NewObjectForm
|
||||||
|
type={'product'}
|
||||||
|
defaultValues={{ priceMode: 'margin', ...defaultValues }}
|
||||||
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -98,7 +101,8 @@ const NewProduct = ({ onOk }) => {
|
|||||||
|
|
||||||
NewProduct.propTypes = {
|
NewProduct.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewProduct
|
export default NewProduct
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewTaxRate = ({ onOk }) => {
|
const NewTaxRate = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'taxRate'}>
|
<NewObjectForm type={'taxRate'} defaultValues={{ ...defaultValues }}>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -74,7 +74,8 @@ const NewTaxRate = ({ onOk }) => {
|
|||||||
|
|
||||||
NewTaxRate.propTypes = {
|
NewTaxRate.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewTaxRate
|
export default NewTaxRate
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewTaxRecord = ({ onOk }) => {
|
const NewTaxRecord = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'taxRecord'}>
|
<NewObjectForm type={'taxRecord'} defaultValues={{ ...defaultValues }}>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -74,7 +74,8 @@ const NewTaxRecord = ({ onOk }) => {
|
|||||||
|
|
||||||
NewTaxRecord.propTypes = {
|
NewTaxRecord.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewTaxRecord
|
export default NewTaxRecord
|
||||||
|
|||||||
@ -3,9 +3,12 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewVendor = ({ onOk }) => {
|
const NewVendor = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm type={'vendor'} defaultValues={{ active: true }}>
|
<NewObjectForm
|
||||||
|
type={'vendor'}
|
||||||
|
defaultValues={{ active: true, ...defaultValues }}
|
||||||
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -74,7 +77,8 @@ const NewVendor = ({ onOk }) => {
|
|||||||
|
|
||||||
NewVendor.propTypes = {
|
NewVendor.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewVendor
|
export default NewVendor
|
||||||
|
|||||||
@ -3,12 +3,13 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewGCodeFile = ({ onOk }) => {
|
const NewGCodeFile = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'gcodeFile'}
|
type={'gcodeFile'}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
state: { type: 'draft' }
|
state: { type: 'draft' },
|
||||||
|
...defaultValues
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
@ -83,7 +84,8 @@ const NewGCodeFile = ({ onOk }) => {
|
|||||||
|
|
||||||
NewGCodeFile.propTypes = {
|
NewGCodeFile.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewGCodeFile
|
export default NewGCodeFile
|
||||||
|
|||||||
@ -3,12 +3,13 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewJob = ({ onOk }) => {
|
const NewJob = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'job'}
|
type={'job'}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
state: { type: 'draft' }
|
state: { type: 'draft' },
|
||||||
|
...defaultValues
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
@ -66,7 +67,8 @@ const NewJob = ({ onOk }) => {
|
|||||||
|
|
||||||
NewJob.propTypes = {
|
NewJob.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewJob
|
export default NewJob
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import ObjectInfo from '../../common/ObjectInfo'
|
|||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const NewPrinter = ({ onOk }) => {
|
const NewPrinter = ({ onOk, defaultValues }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'printer'}
|
type={'printer'}
|
||||||
@ -12,7 +12,8 @@ const NewPrinter = ({ onOk }) => {
|
|||||||
port: 7125,
|
port: 7125,
|
||||||
protocol: 'ws'
|
protocol: 'ws'
|
||||||
},
|
},
|
||||||
active: true
|
active: true,
|
||||||
|
...defaultValues
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
@ -103,7 +104,8 @@ const NewPrinter = ({ onOk }) => {
|
|||||||
|
|
||||||
NewPrinter.propTypes = {
|
NewPrinter.propTypes = {
|
||||||
onOk: PropTypes.func.isRequired,
|
onOk: PropTypes.func.isRequired,
|
||||||
reset: PropTypes.bool
|
reset: PropTypes.bool,
|
||||||
|
defaultValues: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NewPrinter
|
export default NewPrinter
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user