Enhance Document Size Configuration with New Padding Options

- Updated the NewDocumentSize component to include additional default values for print padding and padding dimensions (left, right, top, bottom).
- Modified the ApiServerProvider to pass padding parameters in API requests, ensuring consistent handling of new padding options.
- Expanded the DocumentSize model to incorporate new fields for print padding and padding dimensions, enhancing the document size configuration capabilities.
This commit is contained in:
Tom Butcher 2026-08-21 22:39:11 +01:00
parent 12b963a887
commit 56b9ad9e1a
3 changed files with 80 additions and 7 deletions

View File

@ -7,7 +7,15 @@ const NewDocumentSize = ({ onOk, defaultValues }) => {
return ( return (
<NewObjectForm <NewObjectForm
type={'documentSize'} type={'documentSize'}
defaultValues={{ infiniteHeight: false, ...defaultValues }} defaultValues={{
infiniteHeight: false,
printPadding: false,
paddingLeft: 0,
paddingRight: 0,
paddingTop: 0,
paddingBottom: 0,
...defaultValues
}}
> >
{({ handleSubmit, submitLoading, objectData, formValid }) => { {({ handleSubmit, submitLoading, objectData, formValid }) => {
const steps = [ const steps = [

View File

@ -1854,7 +1854,8 @@ const ApiServerProvider = ({ children }) => {
{ {
content, content,
testObject, testObject,
scale scale,
padding: true
}, },
{ {
headers: { headers: {
@ -1886,7 +1887,7 @@ const ApiServerProvider = ({ children }) => {
object object
}, },
{ {
params: { type }, params: { type, padding: true },
responseType: 'arraybuffer', responseType: 'arraybuffer',
headers: { headers: {
Authorization: `Bearer ${token}` Authorization: `Bearer ${token}`

View File

@ -1,10 +1,12 @@
import { createElement, lazy } from 'react' import { createElement, lazy } from 'react'
const DocumentSizeInfo = lazy( const DocumentSizeInfo = lazy(
() => import('../../components/Dashboard/Management/DocumentSizes/DocumentSizeInfo') () =>
import('../../components/Dashboard/Management/DocumentSizes/DocumentSizeInfo')
) )
const NewDocumentSize = lazy( const NewDocumentSize = lazy(
() => import('../../components/Dashboard/Management/DocumentSizes/NewDocumentSize') () =>
import('../../components/Dashboard/Management/DocumentSizes/NewDocumentSize')
) )
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import PlusIcon from '../../components/Icons/PlusIcon' import PlusIcon from '../../components/Icons/PlusIcon'
@ -30,7 +32,11 @@ export const DocumentSize = {
label: 'New Document Size', label: 'New Document Size',
icon: PlusIcon, icon: PlusIcon,
content: (objectData, { onOk } = {}) => { content: (objectData, { onOk } = {}) => {
return createElement(NewDocumentSize, { defaultValues: objectData, onOk, reset: true }) return createElement(NewDocumentSize, {
defaultValues: objectData,
onOk,
reset: true
})
} }
}, },
{ {
@ -79,7 +85,7 @@ export const DocumentSize = {
visible: (objectData) => { visible: (objectData) => {
return objectData?._isEditing && objectData?._isEditing == true return objectData?._isEditing && objectData?._isEditing == true
} }
}, }
], ],
pages: [ pages: [
{ {
@ -93,6 +99,11 @@ export const DocumentSize = {
'width', 'width',
'height', 'height',
'infiniteHeight', 'infiniteHeight',
'printPadding',
'paddingLeft',
'paddingRight',
'paddingTop',
'paddingBottom',
'createdAt', 'createdAt',
'updatedAt' 'updatedAt'
], ],
@ -100,6 +111,11 @@ export const DocumentSize = {
'name', 'name',
'width', 'width',
'height', 'height',
'printPadding',
'paddingLeft',
'paddingRight',
'paddingTop',
'paddingBottom',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'
@ -109,6 +125,11 @@ export const DocumentSize = {
'width', 'width',
'height', 'height',
'infiniteHeight', 'infiniteHeight',
'printPadding',
'paddingLeft',
'paddingRight',
'paddingTop',
'paddingBottom',
'createdAt', 'createdAt',
'updatedAt' 'updatedAt'
], ],
@ -178,6 +199,49 @@ export const DocumentSize = {
visible: (objectData) => { visible: (objectData) => {
return !objectData.infiniteHeight return !objectData.infiniteHeight
} }
},
{
name: 'printPadding',
label: 'Print Padding',
required: true,
columnWidth: 160,
type: 'bool'
},
{
name: 'paddingLeft',
label: 'Padding Left',
required: true,
columnWidth: 150,
type: 'number',
suffix: 'mm',
min: 0
},
{
name: 'paddingRight',
label: 'Padding Right',
required: true,
columnWidth: 162,
type: 'number',
suffix: 'mm',
min: 0
},
{
name: 'paddingTop',
label: 'Padding Top',
required: true,
columnWidth: 155,
type: 'number',
suffix: 'mm',
min: 0
},
{
name: 'paddingBottom',
label: 'Padding Bottom',
required: true,
columnWidth: 180,
type: 'number',
suffix: 'mm',
min: 0
} }
] ]
} }