diff --git a/resources/js/components/admin/manage/PosCatalogCard.vue b/resources/js/components/admin/manage/PosCatalogCard.vue
new file mode 100644
index 0000000..d48888a
--- /dev/null
+++ b/resources/js/components/admin/manage/PosCatalogCard.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
![]()
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+
diff --git a/resources/js/components/admin/manage/PosCatalogVariantThumb.vue b/resources/js/components/admin/manage/PosCatalogVariantThumb.vue
new file mode 100644
index 0000000..22be460
--- /dev/null
+++ b/resources/js/components/admin/manage/PosCatalogVariantThumb.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
diff --git a/resources/js/components/admin/manage/orders/OrderPosForm.vue b/resources/js/components/admin/manage/orders/OrderPosForm.vue
index 2b23583..6233e19 100644
--- a/resources/js/components/admin/manage/orders/OrderPosForm.vue
+++ b/resources/js/components/admin/manage/orders/OrderPosForm.vue
@@ -3,7 +3,8 @@ import { useForm } from '@inertiajs/vue3';
import { Minus, Plus, Save, Search, ShoppingCart, Trash2 } from '@lucide/vue';
import { computed, ref, watch } from 'vue';
import { toast } from 'vue-sonner';
-import MediaThumbnailCell from '@/components/media/MediaThumbnailCell.vue';
+import PosCatalogCard from '@/components/admin/manage/PosCatalogCard.vue';
+import PosCatalogVariantThumb from '@/components/admin/manage/PosCatalogVariantThumb.vue';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import {
@@ -30,15 +31,8 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Separator } from '@/components/ui/separator';
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from '@/components/ui/table';
import { Textarea } from '@/components/ui/textarea';
+import { getFirstCoverImage } from '@/lib/catalog-cover';
import { formatRupiah, parseRupiah } from '@/lib/rupiah';
import type { ProductPriceItem, ProductVariantItem } from '@/types/product';
import type { EnumOption, OrderCartItem, OrderCatalogItem, SelectOption } from '@/types/order';
@@ -256,61 +250,52 @@ function submit() {
-
-
-
-
- {{ product.name }}
-
+
+
+
+ Belum ada varian
+
+
+
+
+
+ {{ variant.name }}
+
+
+ {{ variant.stock }} pcs
+ ยท
+
+ {{ getVariantPrice(variant)!.price_formatted }}
+
+ -
+
+
+
-
-
-
-
- Varian
- Foto
- Stok
- Harga
-
-
-
-
-
-
- Belum ada varian
-
-
-
-
- {{ variant.name }}
-
-
-
-
-
- {{ variant.stock }} pcs
-
-
-
- {{ getVariantPrice(variant)!.price_formatted }}
-
- -
-
-
-
-
-
-
-
-
+
diff --git a/resources/js/components/admin/manage/purchases/PurchasePosForm.vue b/resources/js/components/admin/manage/purchases/PurchasePosForm.vue
index 58a2db1..36ea949 100644
--- a/resources/js/components/admin/manage/purchases/PurchasePosForm.vue
+++ b/resources/js/components/admin/manage/purchases/PurchasePosForm.vue
@@ -3,8 +3,9 @@ import { useForm } from '@inertiajs/vue3';
import { Minus, Plus, Save, Search, ShoppingCart, Trash2 } from '@lucide/vue';
import { computed, ref, watch } from 'vue';
import { toast } from 'vue-sonner';
+import PosCatalogCard from '@/components/admin/manage/PosCatalogCard.vue';
+import PosCatalogVariantThumb from '@/components/admin/manage/PosCatalogVariantThumb.vue';
import MediaImageUpload from '@/components/media/MediaImageUpload.vue';
-import MediaThumbnailCell from '@/components/media/MediaThumbnailCell.vue';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
@@ -32,15 +33,8 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Separator } from '@/components/ui/separator';
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from '@/components/ui/table';
import { Textarea } from '@/components/ui/textarea';
+import { getFirstCoverImage } from '@/lib/catalog-cover';
import { formatRupiah, parseRupiah } from '@/lib/rupiah';
import type { MediaItem } from '@/types/media';
import { appendRootPhotosToFormData, createMediaUploadState } from '@/types/media';
@@ -237,57 +231,51 @@ function submit() {
-
-
-
-
-
- {{ rawMaterial.name }}
-
-
- {{ rawMaterial.unit_label }}
-
-
-
+
+
+
+
+ {{ rawMaterial.unit_label }}
+
+
-
-
-
- Varian
- Foto
- Harga
-
-
-
-
-
-
- Belum ada varian
-
-
-
-
- {{ price.variant }}
-
-
-
-
-
- {{ price.price_formatted }}
-
-
-
-
-
-
-
-
+
+ Belum ada varian
+
+
+
+
+
+ {{ price.variant }}
+
+
+ {{ price.price_formatted }}
+
+
+
+
+
diff --git a/resources/js/lib/catalog-cover.ts b/resources/js/lib/catalog-cover.ts
new file mode 100644
index 0000000..1d6c85d
--- /dev/null
+++ b/resources/js/lib/catalog-cover.ts
@@ -0,0 +1,13 @@
+import type { MediaItem } from '@/types/media';
+
+export function getFirstCoverImage(
+ items: Array<{ images?: MediaItem[] }>,
+): MediaItem | undefined {
+ for (const item of items) {
+ if (item.images?.length) {
+ return item.images[0];
+ }
+ }
+
+ return undefined;
+}