Add reference size fields to product admin editor
- Add referenceWidthCm and referenceHeightCm to ProductDTO - Update toProductDTO to include reference size fields - Add reference size inputs to admin product edit page - Update updateProduct action to handle reference sizes - Rulers on personalization page use product reference size Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
740d2bbd29
commit
0e14fc7981
@@ -168,6 +168,10 @@ export async function updateProduct(formData: FormData) {
|
||||
const showOnPersonalised = String(formData.get('showOnPersonalised') ?? '') === '1';
|
||||
const showOnProducts = String(formData.get('showOnProducts') ?? '') === '1';
|
||||
const collectionIds = formData.getAll('collections').map((v) => String(v));
|
||||
const referenceWidthCmInput = String(formData.get('referenceWidthCm') ?? '').trim();
|
||||
const referenceHeightCmInput = String(formData.get('referenceHeightCm') ?? '').trim();
|
||||
const referenceWidthCm = referenceWidthCmInput ? Number(referenceWidthCmInput) : null;
|
||||
const referenceHeightCm = referenceHeightCmInput ? Number(referenceHeightCmInput) : null;
|
||||
|
||||
if (!id) throw new Error('Missing product id.');
|
||||
if (!name || !category || !priceDollars) {
|
||||
@@ -228,6 +232,8 @@ export async function updateProduct(formData: FormData) {
|
||||
photoRecolorable: boolean;
|
||||
showOnPersonalised: boolean;
|
||||
showOnProducts: boolean;
|
||||
referenceWidthCm: number | null;
|
||||
referenceHeightCm: number | null;
|
||||
imageUrl?: string;
|
||||
imageUrlBack?: string;
|
||||
printArea?: string;
|
||||
@@ -247,6 +253,8 @@ export async function updateProduct(formData: FormData) {
|
||||
photoRecolorable,
|
||||
showOnPersonalised,
|
||||
showOnProducts,
|
||||
referenceWidthCm,
|
||||
referenceHeightCm,
|
||||
};
|
||||
|
||||
// Only touch the front photo/print area if a new photo was actually uploaded —
|
||||
|
||||
Reference in New Issue
Block a user