From 6193104e6f65c453d287ae12e0f11583534705ce Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Fri, 31 Jul 2026 23:20:04 +0530 Subject: [PATCH] enh --- .../app/(drawer)/prices-overview/index.tsx | 18 +++--------------- .../db_helper_sqlite/src/user-apis/banners.ts | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/apps/admin-ui/app/(drawer)/prices-overview/index.tsx b/apps/admin-ui/app/(drawer)/prices-overview/index.tsx index 1a192b9..16991a6 100644 --- a/apps/admin-ui/app/(drawer)/prices-overview/index.tsx +++ b/apps/admin-ui/app/(drawer)/prices-overview/index.tsx @@ -43,7 +43,7 @@ const SkuItemComponent: React.FC = ({ const displayPrice = change.price !== undefined ? change.price : sku.price; const displayMarketPrice = change.marketPrice !== undefined ? change.marketPrice : sku.marketPrice; const displayFlashPrice = change.flashPrice !== undefined ? change.flashPrice : sku.flashPrice; - const displayProductQuantity = change.productQuantity !== undefined ? change.productQuantity : sku.productQuantity; + const displayUnit = (sku.features || []).map((f: any) => f.featureValue).join(' ') || '—'; return ( @@ -130,7 +130,7 @@ const SkuItemComponent: React.FC = ({ Size - {displayProductQuantity ? `${displayProductQuantity}${sku.unit?.shortNotation || ''}` : "N/A"} + {displayUnit} openEditDialog(sku, productName)} style={tw`ml-1`}> @@ -145,7 +145,6 @@ interface PendingChange { price?: number; marketPrice?: number | null; flashPrice?: number | null; - productQuantity?: number | null; isFlashAvailable?: boolean; } @@ -156,7 +155,6 @@ interface EditDialogState { tempPrice: string; tempMarketPrice: string; tempFlashPrice: string; - tempProductQuantity: string; } export default function PricesOverview() { @@ -170,7 +168,6 @@ export default function PricesOverview() { tempPrice: "", tempMarketPrice: "", tempFlashPrice: "", - tempProductQuantity: "", }); const [showMenu, setShowMenu] = useState(false); @@ -233,7 +230,6 @@ export default function PricesOverview() { tempPrice: (change.price ?? sku.price)?.toString() || "", tempMarketPrice: (change.marketPrice ?? sku.marketPrice)?.toString() || "", tempFlashPrice: (change.flashPrice ?? sku.flashPrice)?.toString() || "", - tempProductQuantity: (change.productQuantity ?? sku.productQuantity)?.toString() || "", }); }; @@ -241,7 +237,6 @@ export default function PricesOverview() { const price = parseFloat(editDialog.tempPrice); const marketPrice = editDialog.tempMarketPrice ? parseFloat(editDialog.tempMarketPrice) : null; const flashPrice = editDialog.tempFlashPrice ? parseFloat(editDialog.tempFlashPrice) : null; - const productQuantity = editDialog.tempProductQuantity ? parseFloat(editDialog.tempProductQuantity) : null; if (isNaN(price) || price <= 0) { Alert.alert("Error", "Please enter a valid price"); @@ -258,7 +253,6 @@ export default function PricesOverview() { return; } - if (editDialog.tempProductQuantity && (isNaN(productQuantity!) || productQuantity! <= 0)) { Alert.alert("Error", "Please enter a valid size"); return; } @@ -269,21 +263,18 @@ export default function PricesOverview() { price: price !== parseFloat(editDialog.sku.price) ? price : undefined, marketPrice: marketPrice !== parseFloat(editDialog.sku.marketPrice || '0') ? marketPrice : undefined, flashPrice: flashPrice !== parseFloat(editDialog.sku.flashPrice || '0') ? flashPrice : undefined, - productQuantity: productQuantity !== (editDialog.sku.productQuantity || 1) ? productQuantity : undefined, }, })); - setEditDialog({ open: false, sku: null, productName: "", tempPrice: "", tempMarketPrice: "", tempFlashPrice: "", tempProductQuantity: "" }); }; const handleSave = () => { const updates = Object.entries(pendingChanges).map(([skuId, change]) => { const sku = allSkus.find(s => s.id === parseInt(skuId)); - const update: any = { productId: sku?.productId }; + const update: any = { productId: sku?.id }; if (change.price !== undefined) update.price = change.price; if (change.marketPrice !== undefined) update.marketPrice = change.marketPrice; if (change.flashPrice !== undefined) update.flashPrice = change.flashPrice; - if (change.productQuantity !== undefined) update.productQuantity = change.productQuantity; if (change.isFlashAvailable !== undefined) update.isFlashAvailable = change.isFlashAvailable; return update; }); @@ -377,7 +368,6 @@ export default function PricesOverview() { /> )} - setEditDialog({ ...editDialog, open: false, tempFlashPrice: "", tempMarketPrice: "", tempPrice: "", tempProductQuantity: "" })}> {editDialog.productName} {editDialog.sku?.displayName || editDialog.sku?.name || ''} @@ -419,8 +409,6 @@ export default function PricesOverview() { Size setEditDialog({ ...editDialog, tempProductQuantity: text })} keyboardType="decimal-pad" placeholder="Enter size" /> diff --git a/packages/db_helper_sqlite/src/user-apis/banners.ts b/packages/db_helper_sqlite/src/user-apis/banners.ts index 5aeb02b..3d95589 100644 --- a/packages/db_helper_sqlite/src/user-apis/banners.ts +++ b/packages/db_helper_sqlite/src/user-apis/banners.ts @@ -11,7 +11,7 @@ const mapBanner = (banner: BannerRow): UserBanner => ({ name: banner.name, imageUrl: banner.imageUrl, description: banner.description ?? null, - productIds: banner.productIds ?? null, + skuIds: banner.skuIds ?? null, redirectUrl: banner.redirectUrl ?? null, serialNum: banner.serialNum ?? null, isActive: banner.isActive,