From 8eee3b04ce981004da79875b9531acda23565c36 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Wed, 1 Jul 2026 11:50:39 +0700 Subject: [PATCH] refactor: remove mandatory image validation for product variants and improve error handling in owner verification actions --- app/Services/Master/ProductService.php | 6 ------ .../OwnerVerificationRowActions.vue | 12 ++++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/Services/Master/ProductService.php b/app/Services/Master/ProductService.php index 0a49bb0..14aa1d9 100644 --- a/app/Services/Master/ProductService.php +++ b/app/Services/Master/ProductService.php @@ -681,12 +681,6 @@ private function applyVariantImageChanges( } $this->copyRequestVariantImages($verificationRequest, $index, $variant); - - if ($variant->getMedia('images')->isEmpty()) { - throw ValidationException::withMessages([ - "variants.{$index}.images" => 'Foto varian wajib diisi.', - ]); - } } private function copyRequestVariantImages(OwnerVerificationRequest $verificationRequest, int $index, ProductVariant $variant): void diff --git a/resources/js/components/owner-verification/OwnerVerificationRowActions.vue b/resources/js/components/owner-verification/OwnerVerificationRowActions.vue index fd5d98b..5ab78cd 100644 --- a/resources/js/components/owner-verification/OwnerVerificationRowActions.vue +++ b/resources/js/components/owner-verification/OwnerVerificationRowActions.vue @@ -55,8 +55,10 @@ function submitApprove() { .post(approveUrl.value, { preserveScroll: true, onError: (errors: Record) => { - if (errors.system) { - toast.error(errors.system); + const firstError = Object.values(errors)[0]; + + if (firstError) { + toast.error(firstError); } }, }); @@ -71,8 +73,10 @@ function submitReject() { rejectForm.reset(); }, onError: (errors: Record) => { - if (errors.system) { - toast.error(errors.system); + const firstError = Object.values(errors)[0]; + + if (firstError) { + toast.error(firstError); } }, });