Fitur foto produk: image_picker + upload Supabase Storage (bucket product-images), thumbnail di daftar produk
This commit is contained in:
@@ -502,7 +502,8 @@ class AppState extends ChangeNotifier {
|
||||
|
||||
/* ---------- Produk ---------- */
|
||||
Future<String?> addProduct(String name, String barcode, double price,
|
||||
double priceReseller, int stock, int minStock, double hargaPokok) async {
|
||||
double priceReseller, int stock, int minStock, double hargaPokok,
|
||||
{String? imagePath}) async {
|
||||
try {
|
||||
final trimmed = barcode.trim();
|
||||
if (trimmed.isNotEmpty &&
|
||||
@@ -518,6 +519,7 @@ class AppState extends ChangeNotifier {
|
||||
stock: stock,
|
||||
minStock: minStock,
|
||||
hargaPokok: hargaPokok,
|
||||
imagePath: imagePath,
|
||||
);
|
||||
await _withTimeout(
|
||||
_supabase.from('products').insert(product.toJson()..['store_id'] = _currentStoreId),
|
||||
@@ -534,7 +536,8 @@ class AppState extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<String?> updateProduct(String id, String name, String barcode,
|
||||
double price, double priceReseller, int stock, int minStock, double hargaPokok) async {
|
||||
double price, double priceReseller, int stock, int minStock, double hargaPokok,
|
||||
{String? imagePath}) async {
|
||||
try {
|
||||
final trimmed = barcode.trim();
|
||||
if (trimmed.isNotEmpty &&
|
||||
@@ -551,6 +554,7 @@ class AppState extends ChangeNotifier {
|
||||
'min_stock': minStock,
|
||||
'harga_pokok': hargaPokok,
|
||||
'store_id': _currentStoreId,
|
||||
'image_path': imagePath,
|
||||
}).eq('id', id),
|
||||
'Update product',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user