From e8ae633509f35a4e9dd2c5d4979c32020d4c5cff Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Fri, 17 Apr 2026 09:54:53 +0700 Subject: [PATCH] feat: update product create and edit forms to include detailed pricing fields and improved layout structure --- .../js/pages/admin/master/product/create.tsx | 302 +++++++++-------- .../js/pages/admin/master/product/edit.tsx | 307 ++++++++++-------- 2 files changed, 334 insertions(+), 275 deletions(-) diff --git a/resources/js/pages/admin/master/product/create.tsx b/resources/js/pages/admin/master/product/create.tsx index db0100d..dd67ca7 100644 --- a/resources/js/pages/admin/master/product/create.tsx +++ b/resources/js/pages/admin/master/product/create.tsx @@ -1,5 +1,5 @@ import { Head, useForm, Link } from '@inertiajs/react'; -import { Card, CardContent } from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Field, FieldGroup } from "@/components/ui/field" import { Input } from "@/components/ui/input" @@ -58,29 +58,154 @@ export default function ProductCreate({ categories }: { categories: Category[] }

Tambah Produk

+ + + - - -
- - - - setData('name', e.target.value)} - autoComplete='off' - placeholder='Contoh: Gamis Wanita' - maxLength={100} - /> - {errors.name &&

{errors.name}

} -
- -
+ +
+
+ + + Informasi Produk + + + + + setData('name', e.target.value)} + autoComplete='off' + placeholder='Contoh: Gamis Wanita' + maxLength={100} + /> + {errors.name &&

{errors.name}

} +
+
+
+ + + + Harga Produk + + +
+ + + { + setData('prices', { + ...data.prices, + purchase: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.purchase'] &&

{errors['prices.purchase']}

} +
+ + + + { + setData('prices', { + ...data.prices, + distributor: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.distributor'] &&

{errors['prices.distributor']}

} +
+ + + + { + setData('prices', { + ...data.prices, + agent: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.agent'] &&

{errors['prices.agent']}

} +
+ + + + { + setData('prices', { + ...data.prices, + reseller: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.reseller'] &&

{errors['prices.reseller']}

} +
+ + + + { + setData('prices', { + ...data.prices, + retail: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.retail'] &&

{errors['prices.retail']}

} +
+
+
+
+
+ +
+ + + Kategori + + - - {errors.category_ids &&

{errors.category_ids}

} + {errors.category_ids &&

{errors.category_ids}

}
+
+
+ + + Deskripsi + + - - { - setData('prices', { - ...data.prices, - purchase: values.value - }) - }} - placeholder="Rp 0" + setData('description', val)} /> - {errors['prices.purchase'] &&

{errors['prices.purchase']}

} + {errors.description &&

{errors.description}

}
+
+
- - - { - setData('prices', { - ...data.prices, - distributor: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.distributor'] &&

{errors['prices.distributor']}

} -
- - - - { - setData('prices', { - ...data.prices, - agent: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.agent'] &&

{errors['prices.agent']}

} -
- - - - { - setData('prices', { - ...data.prices, - reseller: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.reseller'] &&

{errors['prices.reseller']}

} -
- - - - { - setData('prices', { - ...data.prices, - retail: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.retail'] &&

{errors['prices.retail']}

} -
-
- - - - setData('description', val)} - /> - {errors.description &&

{errors.description}

} -
- - -
- - - -
- - - +
+
+ ); diff --git a/resources/js/pages/admin/master/product/edit.tsx b/resources/js/pages/admin/master/product/edit.tsx index 7e93c8b..6e7dc97 100644 --- a/resources/js/pages/admin/master/product/edit.tsx +++ b/resources/js/pages/admin/master/product/edit.tsx @@ -1,7 +1,7 @@ import { Head, useForm, Link } from '@inertiajs/react'; import type { Product, ProductPrice } from '@/types'; import { Category } from '@/types/category'; -import { Card, CardContent } from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Field, FieldGroup } from "@/components/ui/field" import { Input } from "@/components/ui/input" @@ -66,29 +66,155 @@ export default function ProductEdit({ product, categories }: { product: Product,

Ubah Produk

+ + + - - -
- - - - setData('name', e.target.value)} - autoComplete='off' - placeholder='Contoh: Gamis Wanita' - maxLength={100} - /> - {errors.name &&

{errors.name}

} -
- -
+ +
+
+ + + Informasi Produk + + + + + setData('name', e.target.value)} + autoComplete='off' + placeholder='Contoh: Gamis Wanita' + maxLength={100} + /> + {errors.name &&

{errors.name}

} +
+
+
+ + + + Harga Produk + + +
+ + + { + setData('prices', { + ...data.prices, + purchase: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.purchase'] &&

{errors['prices.purchase']}

} +
+ + + + { + setData('prices', { + ...data.prices, + distributor: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.distributor'] &&

{errors['prices.distributor']}

} +
+ + + + { + setData('prices', { + ...data.prices, + agent: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.agent'] &&

{errors['prices.agent']}

} +
+ + + + { + setData('prices', { + ...data.prices, + reseller: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.reseller'] &&

{errors['prices.reseller']}

} +
+ + + + { + setData('prices', { + ...data.prices, + retail: values.value + }) + }} + placeholder="Rp 0" + /> + {errors['prices.retail'] &&

{errors['prices.retail']}

} +
+
+
+
+
+ + {/* Right Column - 1/3 width */} +
+ + + Kategori + + - - {errors.category_ids &&

{errors.category_ids}

} + {errors.category_ids &&

{errors.category_ids}

}
+
+
+ + + Deskripsi + + - - { - setData('prices', { - ...data.prices, - purchase: values.value - }) - }} - placeholder="Rp 0" + setData('description', val)} /> - {errors['prices.purchase'] &&

{errors['prices.purchase']}

} + {errors.description &&

{errors.description}

}
+
+
- - - { - setData('prices', { - ...data.prices, - distributor: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.distributor'] &&

{errors['prices.distributor']}

} -
- - - - { - setData('prices', { - ...data.prices, - agent: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.agent'] &&

{errors['prices.agent']}

} -
- - - - { - setData('prices', { - ...data.prices, - reseller: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.reseller'] &&

{errors['prices.reseller']}

} -
- - - - { - setData('prices', { - ...data.prices, - retail: values.value - }) - }} - placeholder="Rp 0" - /> - {errors['prices.retail'] &&

{errors['prices.retail']}

} -
+
+
+
- - - - setData('description', val)} - /> - {errors.description &&

{errors.description}

} -
- - -
- - - -
- - - +
+
+
);