fix sales issues

This commit is contained in:
2026-08-05 17:03:49 +05:30
parent 4324ba1a96
commit cbc72ef830
14 changed files with 392 additions and 114 deletions
@@ -1,4 +1,4 @@
"use client"
"use client"
import Link from "next/link"
import { Lightbulb, PackageCheck } from "lucide-react"
@@ -11,7 +11,7 @@ export function FreeIssuePromotionSuggestions({ suggestion }: { suggestion: Sale
if (!suggestion || suggestion.lines.length === 0) {
return (
<div className="rounded-2xl border border-dashed p-6 text-sm text-muted-foreground">
No free-issue promotion suggestions were generated for this slip yet.
No free-issue suggestions were generated for this slip yet.
</div>
)
}
@@ -22,10 +22,10 @@ export function FreeIssuePromotionSuggestions({ suggestion }: { suggestion: Sale
<div>
<div className="inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-amber-700">
<Lightbulb className="size-3.5" />
Backend suggestion
Suggestion only
</div>
<h2 className="mt-2 text-lg font-semibold text-foreground">Free-issue promotions</h2>
<p className="text-sm text-muted-foreground">The server suggests reward quantities and alternate products for this slip.</p>
<p className="text-sm text-muted-foreground">These are suggestions only. You can review them before creating a free issue.</p>
</div>
<Link href="/dashboard/sales/free-issues/new" className={cn(buttonVariants({ variant: "outline", size: "sm" }))}>
Create free issue
@@ -40,14 +40,12 @@ export function FreeIssuePromotionSuggestions({ suggestion }: { suggestion: Sale
<div className="font-medium text-foreground">{line.itemName}</div>
<div className="text-sm text-muted-foreground">{line.itemSku} Qty {line.qty}</div>
</div>
<div className="rounded-full bg-primary/10 px-3 py-1 text-xs font-semibold text-primary">
Buy {line.triggerQty} get {line.suggestedFreeQty} free
</div>
<div className="rounded-full bg-primary/10 px-3 py-1 text-xs font-semibold text-primary">Free issue</div>
</div>
<div className="mt-3 flex flex-wrap gap-2 text-sm">
{line.rewardOptions.map((option, index) => (
<span key={option.itemId} className={cn("inline-flex items-center gap-1 rounded-full border px-3 py-1", index === 0 && "border-primary bg-primary/5 text-primary") }>
<span key={option.itemId} className={cn("inline-flex items-center gap-1 rounded-full border px-3 py-1", index === 0 && "border-primary bg-primary/5 text-primary")}>
{index === 0 ? <PackageCheck className="size-3.5" /> : null}
{option.name}
</span>
@@ -55,11 +53,11 @@ export function FreeIssuePromotionSuggestions({ suggestion }: { suggestion: Sale
</div>
<div className="mt-3 text-sm text-muted-foreground">
Suggested free qty: <span className="font-medium text-foreground">{line.suggestedFreeQty.toFixed(2)}</span>
Free qty: <span className="font-medium text-foreground">{line.suggestedFreeQty.toFixed(2)}</span>
</div>
</div>
))}
</div>
</div>
)
}
}