From cb367a38f9e40d516aca0b44578c0c5fa3e59b61 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Fri, 17 Jul 2026 07:36:54 -0400 Subject: [PATCH] printedparts stage 4: catalog mutations, item photos, detail + form POST/PUT/DELETE for items: create mints the itemcode from the configured prefix plus the flushed row id, update refuses quantityonhand (ledger-managed - restock/adjust arrive next stage), delete soft-retires. The image upload/serve/delete trio replicates the models.py pattern into instance/printedpartsimages/ with a public GET. PrintedItemDetail follows the unified detail skeleton (hero photo, info list, transaction history table); PrintedItemForm covers create/edit plus photo management on edit. --- frontend/src/api/index.js | 19 ++ .../views/printedparts/PrintedItemDetail.vue | 214 ++++++------- .../views/printedparts/PrintedItemForm.vue | 288 +++++++----------- plugins/printedparts/api/routes.py | 146 +++++++++ 4 files changed, 379 insertions(+), 288 deletions(-) diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index e02d22e..5684439 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -1134,5 +1134,24 @@ export const printedpartsApi = { }, get(printeditemid) { return api.get(`/printedparts/items/${printeditemid}`) + }, + create(data) { + return api.post('/printedparts/items', data) + }, + update(printeditemid, data) { + return api.put(`/printedparts/items/${printeditemid}`, data) + }, + remove(printeditemid) { + return api.delete(`/printedparts/items/${printeditemid}`) + }, + uploadImage(printeditemid, file) { + const formData = new FormData() + formData.append('file', file) + return api.post(`/printedparts/items/${printeditemid}/image`, formData, { + headers: { 'Content-Type': 'multipart/form-data' } + }) + }, + deleteImage(printeditemid) { + return api.delete(`/printedparts/items/${printeditemid}/image`) } } diff --git a/frontend/src/views/printedparts/PrintedItemDetail.vue b/frontend/src/views/printedparts/PrintedItemDetail.vue index be6a777..2c370a3 100644 --- a/frontend/src/views/printedparts/PrintedItemDetail.vue +++ b/frontend/src/views/printedparts/PrintedItemDetail.vue @@ -1,149 +1,133 @@ diff --git a/frontend/src/views/printedparts/PrintedItemForm.vue b/frontend/src/views/printedparts/PrintedItemForm.vue index 32e1036..10058d0 100644 --- a/frontend/src/views/printedparts/PrintedItemForm.vue +++ b/frontend/src/views/printedparts/PrintedItemForm.vue @@ -1,74 +1,66 @@