diff --git a/resources/js/components/admin/master/products/CuttingVerificationSection.vue b/resources/js/components/admin/master/products/CuttingVerificationSection.vue index c671f53..9b30fe1 100644 --- a/resources/js/components/admin/master/products/CuttingVerificationSection.vue +++ b/resources/js/components/admin/master/products/CuttingVerificationSection.vue @@ -4,6 +4,7 @@ import { Check, ChevronDown, Copy, RotateCcw, Scissors, X } from '@lucide/vue'; import { computed, ref, watch } from 'vue'; import { toast } from 'vue-sonner'; import ConfirmDialog from '@/components/ConfirmDialog.vue'; +import { RupiahInput } from '@/components/form/rupiah-input'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; @@ -41,15 +42,14 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; -import { RupiahInput } from '@/components/form/rupiah-input'; import { useCan } from '@/composables/useCan'; import { FIELD_LIMITS } from '@/lib/field-limits'; import { parseRupiah } from '@/lib/rupiah'; +import type { CuttingListItem } from '@/types/cutting'; import { PRICE_TYPES, PRICE_TYPE_LABELS, } from '@/types/product'; -import type { CuttingListItem } from '@/types/cutting'; const props = defineProps<{ cuttings: CuttingListItem[]; @@ -172,6 +172,7 @@ function toggleUseSamePrice(checked: boolean) { function setResultPrice(resultIndex: number, type: string, value: string) { const result = verifyForm.results[resultIndex]; + if (!result) { return; } @@ -184,6 +185,7 @@ function setResultPrice(resultIndex: number, type: string, value: string) { function applyPriceToAllVariants(sourceIndex: number) { const source = verifyForm.results[sourceIndex]; + if (!source) { return; } @@ -209,6 +211,7 @@ function openAction(cutting: CuttingListItem, action: CuttingStatusAction) { if (action.status === 'verified') { verifyDialogOpen.value = true; + return; } @@ -216,6 +219,7 @@ function openAction(cutting: CuttingListItem, action: CuttingStatusAction) { rejectForm.reset(); rejectForm.clearErrors(); rejectDialogOpen.value = true; + return; } @@ -287,21 +291,21 @@ function submitVerify() { result_prices: buildResultPricesPayload(), })) .post(`/admin/manage/cuttings/${activeCutting.value.id}/status`, { - preserveScroll: true, - onSuccess: () => { - verifyDialogOpen.value = false; - activeCutting.value = null; - }, - onError: (errors) => { - const message = Object.values(errors)[0]; + preserveScroll: true, + onSuccess: () => { + verifyDialogOpen.value = false; + activeCutting.value = null; + }, + onError: (errors) => { + const message = Object.values(errors)[0]; - toast.error( - typeof message === 'string' - ? message - : 'Gagal memverifikasi cutting.', - ); - }, - }); + toast.error( + typeof message === 'string' + ? message + : 'Gagal memverifikasi cutting.', + ); + }, + }); } function submitReject() { @@ -344,15 +348,13 @@ watch(rejectDialogOpen, (isOpen) => {

- Cutting Menunggu Verifikasi + Verifikasi Cutting

- + {{ totalCompleted }}
-

- Daftar cutting yang telah selesai dikerjakan. Verifikasi untuk menambahkan stok ke produk. -

{
- +

@@ -375,11 +378,8 @@ watch(rejectDialogOpen, (isOpen) => {
- @@ -389,12 +389,9 @@ watch(rejectDialogOpen, (isOpen) => { - @@ -404,12 +401,9 @@ watch(rejectDialogOpen, (isOpen) => { - @@ -428,7 +422,8 @@ watch(rejectDialogOpen, (isOpen) => { Bahan Baku:
  • - {{ mat.raw_material_price?.raw_material?.name }} ({{ mat.raw_material_price?.variant }}) - {{ mat.material_usage_formatted }} + {{ mat.raw_material_price?.raw_material?.name }} ({{ + mat.raw_material_price?.variant }}) - {{ mat.material_usage_formatted }}
  • Belum ada bahan baku
@@ -438,7 +433,8 @@ watch(rejectDialogOpen, (isOpen) => { Hasil Produk:
  • - {{ res.product_variant?.product?.name }} ({{ res.product_variant?.name }}) - {{ res.cutting_result }} pcs + {{ res.product_variant?.product?.name }} ({{ res.product_variant?.name }}) - + {{ res.cutting_result }} pcs
  • Belum ada hasil produk
@@ -446,10 +442,12 @@ watch(rejectDialogOpen, (isOpen) => {
Harga modal: - {{ cutting.estimated_cost_per_unit_formatted }} / pcs + {{ + cutting.estimated_cost_per_unit_formatted }} / pcs
-
+
Pembuat: {{ cutting.created_by?.profile?.full_name ?? cutting.created_by?.username }} @@ -473,22 +471,12 @@ watch(rejectDialogOpen, (isOpen) => { - + @@ -501,42 +489,24 @@ watch(rejectDialogOpen, (isOpen) => {
- Alasan Penolakan -