Compare commits
No commits in common. "fbeed04f65a7a9fd03410d4fcef273dfba5532ad" and "dd7231b6a091988a21acadbc5e4b7822a1b0c965" have entirely different histories.
fbeed04f65
...
dd7231b6a0
51
src/App.tsx
51
src/App.tsx
|
|
@ -153,11 +153,7 @@ export default function App() {
|
||||||
category: 'general',
|
category: 'general',
|
||||||
discountType: 'percentage',
|
discountType: 'percentage',
|
||||||
discountValue: '20',
|
discountValue: '20',
|
||||||
discountValueUsd: '',
|
|
||||||
discountValueEur: '',
|
|
||||||
maxDiscountCap: '0',
|
maxDiscountCap: '0',
|
||||||
maxDiscountCapUsd: '',
|
|
||||||
maxDiscountCapEur: '',
|
|
||||||
description: '',
|
description: '',
|
||||||
startDate: '',
|
startDate: '',
|
||||||
endDate: '',
|
endDate: '',
|
||||||
|
|
@ -165,8 +161,6 @@ export default function App() {
|
||||||
applicablePlanIds: [],
|
applicablePlanIds: [],
|
||||||
applicableModuleIds: [],
|
applicableModuleIds: [],
|
||||||
minSpend: '0',
|
minSpend: '0',
|
||||||
minSpendUsd: '',
|
|
||||||
minSpendEur: '',
|
|
||||||
usageLimit: '0',
|
usageLimit: '0',
|
||||||
firstOnly: false,
|
firstOnly: false,
|
||||||
});
|
});
|
||||||
|
|
@ -751,11 +745,7 @@ export default function App() {
|
||||||
category: 'general',
|
category: 'general',
|
||||||
discountType: 'percentage',
|
discountType: 'percentage',
|
||||||
discountValue: '20',
|
discountValue: '20',
|
||||||
discountValueUsd: '',
|
|
||||||
discountValueEur: '',
|
|
||||||
maxDiscountCap: '0',
|
maxDiscountCap: '0',
|
||||||
maxDiscountCapUsd: '',
|
|
||||||
maxDiscountCapEur: '',
|
|
||||||
description: '',
|
description: '',
|
||||||
startDate: todayStr,
|
startDate: todayStr,
|
||||||
endDate: nextYearStr,
|
endDate: nextYearStr,
|
||||||
|
|
@ -763,8 +753,6 @@ export default function App() {
|
||||||
applicablePlanIds: [],
|
applicablePlanIds: [],
|
||||||
applicableModuleIds: [],
|
applicableModuleIds: [],
|
||||||
minSpend: '0',
|
minSpend: '0',
|
||||||
minSpendUsd: '',
|
|
||||||
minSpendEur: '',
|
|
||||||
usageLimit: '0',
|
usageLimit: '0',
|
||||||
firstOnly: false,
|
firstOnly: false,
|
||||||
});
|
});
|
||||||
|
|
@ -781,21 +769,15 @@ export default function App() {
|
||||||
code: c.code,
|
code: c.code,
|
||||||
category: c.coupon_category || 'general',
|
category: c.coupon_category || 'general',
|
||||||
discountType: c.discount_type || 'percentage',
|
discountType: c.discount_type || 'percentage',
|
||||||
discountValue: String(c.value_inr ?? c.value ?? 0),
|
discountValue: String(c.value ?? 0),
|
||||||
discountValueUsd: c.value_usd !== undefined && c.value_usd !== null ? String(c.value_usd) : '',
|
maxDiscountCap: String(c.max_discount_limit ?? 0),
|
||||||
discountValueEur: c.value_eur !== undefined && c.value_eur !== null ? String(c.value_eur) : '',
|
|
||||||
maxDiscountCap: String(c.max_discount_inr ?? c.max_discount_limit ?? 0),
|
|
||||||
maxDiscountCapUsd: c.max_discount_usd !== undefined && c.max_discount_usd !== null ? String(c.max_discount_usd) : '',
|
|
||||||
maxDiscountCapEur: c.max_discount_eur !== undefined && c.max_discount_eur !== null ? String(c.max_discount_eur) : '',
|
|
||||||
description: c.description || '',
|
description: c.description || '',
|
||||||
startDate: c.start_date ? c.start_date.split('T')[0] : '',
|
startDate: c.start_date ? c.start_date.split('T')[0] : '',
|
||||||
endDate: c.end_date ? c.end_date.split('T')[0] : '',
|
endDate: c.end_date ? c.end_date.split('T')[0] : '',
|
||||||
scope: hasSpecific ? 'specific' : 'storewide',
|
scope: hasSpecific ? 'specific' : 'storewide',
|
||||||
applicablePlanIds: c.applicable_plan_ids || [],
|
applicablePlanIds: c.applicable_plan_ids || [],
|
||||||
applicableModuleIds: c.applicable_module_ids || [],
|
applicableModuleIds: c.applicable_module_ids || [],
|
||||||
minSpend: String(c.min_purchase_inr ?? c.min_purchase_amount ?? 0),
|
minSpend: String(c.min_purchase_amount ?? 0),
|
||||||
minSpendUsd: c.min_purchase_usd !== undefined && c.min_purchase_usd !== null ? String(c.min_purchase_usd) : '',
|
|
||||||
minSpendEur: c.min_purchase_eur !== undefined && c.min_purchase_eur !== null ? String(c.min_purchase_eur) : '',
|
|
||||||
usageLimit: String(c.usage_limit ?? 0),
|
usageLimit: String(c.usage_limit ?? 0),
|
||||||
firstOnly: Boolean(c.is_first_purchase_only),
|
firstOnly: Boolean(c.is_first_purchase_only),
|
||||||
});
|
});
|
||||||
|
|
@ -814,35 +796,14 @@ export default function App() {
|
||||||
setCouponSaving(true);
|
setCouponSaving(true);
|
||||||
try {
|
try {
|
||||||
const headers = { Authorization: `Bearer ${userToken}` };
|
const headers = { Authorization: `Bearer ${userToken}` };
|
||||||
const valInr = parseFloat(couponFormData.discountValue) || 0;
|
|
||||||
const valUsd = couponFormData.discountValueUsd.trim() ? parseFloat(couponFormData.discountValueUsd) : undefined;
|
|
||||||
const valEur = couponFormData.discountValueEur.trim() ? parseFloat(couponFormData.discountValueEur) : undefined;
|
|
||||||
|
|
||||||
const capInr = parseFloat(couponFormData.maxDiscountCap) || 0;
|
|
||||||
const capUsd = couponFormData.maxDiscountCapUsd.trim() ? parseFloat(couponFormData.maxDiscountCapUsd) : undefined;
|
|
||||||
const capEur = couponFormData.maxDiscountCapEur.trim() ? parseFloat(couponFormData.maxDiscountCapEur) : undefined;
|
|
||||||
|
|
||||||
const minInr = parseFloat(couponFormData.minSpend) || 0;
|
|
||||||
const minUsd = couponFormData.minSpendUsd.trim() ? parseFloat(couponFormData.minSpendUsd) : undefined;
|
|
||||||
const minEur = couponFormData.minSpendEur.trim() ? parseFloat(couponFormData.minSpendEur) : undefined;
|
|
||||||
|
|
||||||
const payload: any = {
|
const payload: any = {
|
||||||
code: couponFormData.code.trim().toUpperCase(),
|
code: couponFormData.code.trim().toUpperCase(),
|
||||||
discount_type: couponFormData.discountType,
|
discount_type: couponFormData.discountType,
|
||||||
coupon_category: couponFormData.category,
|
coupon_category: couponFormData.category,
|
||||||
value: valInr,
|
value: parseFloat(couponFormData.discountValue) || 0,
|
||||||
value_inr: valInr,
|
max_discount_limit: parseFloat(couponFormData.maxDiscountCap) || 0,
|
||||||
value_usd: valUsd,
|
|
||||||
value_eur: valEur,
|
|
||||||
max_discount_limit: capInr,
|
|
||||||
max_discount_inr: capInr,
|
|
||||||
max_discount_usd: capUsd,
|
|
||||||
max_discount_eur: capEur,
|
|
||||||
usage_limit: parseInt(couponFormData.usageLimit) || 0,
|
usage_limit: parseInt(couponFormData.usageLimit) || 0,
|
||||||
min_purchase_amount: minInr,
|
min_purchase_amount: parseFloat(couponFormData.minSpend) || 0,
|
||||||
min_purchase_inr: minInr,
|
|
||||||
min_purchase_usd: minUsd,
|
|
||||||
min_purchase_eur: minEur,
|
|
||||||
is_first_purchase_only: couponFormData.firstOnly,
|
is_first_purchase_only: couponFormData.firstOnly,
|
||||||
is_active: true,
|
is_active: true,
|
||||||
description: couponFormData.description.trim() || undefined,
|
description: couponFormData.description.trim() || undefined,
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,7 @@ export interface CouponFormData {
|
||||||
category: string;
|
category: string;
|
||||||
discountType: 'percentage' | 'flat';
|
discountType: 'percentage' | 'flat';
|
||||||
discountValue: string;
|
discountValue: string;
|
||||||
discountValueUsd: string;
|
|
||||||
discountValueEur: string;
|
|
||||||
maxDiscountCap: string;
|
maxDiscountCap: string;
|
||||||
maxDiscountCapUsd: string;
|
|
||||||
maxDiscountCapEur: string;
|
|
||||||
description: string;
|
description: string;
|
||||||
startDate: string;
|
startDate: string;
|
||||||
endDate: string;
|
endDate: string;
|
||||||
|
|
@ -18,8 +14,6 @@ export interface CouponFormData {
|
||||||
applicablePlanIds: string[];
|
applicablePlanIds: string[];
|
||||||
applicableModuleIds: string[];
|
applicableModuleIds: string[];
|
||||||
minSpend: string;
|
minSpend: string;
|
||||||
minSpendUsd: string;
|
|
||||||
minSpendEur: string;
|
|
||||||
usageLimit: string;
|
usageLimit: string;
|
||||||
firstOnly: boolean;
|
firstOnly: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +105,7 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-3">
|
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Discount Type</label>
|
<label className="block text-[11px] font-bold text-slate-600 mb-1">Discount Type</label>
|
||||||
<select
|
<select
|
||||||
|
|
@ -120,112 +114,36 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-semibold text-slate-800 focus:outline-none focus:border-indigo-500 cursor-pointer"
|
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-semibold text-slate-800 focus:outline-none focus:border-indigo-500 cursor-pointer"
|
||||||
>
|
>
|
||||||
<option value="percentage">Percentage (%)</option>
|
<option value="percentage">Percentage (%)</option>
|
||||||
<option value="flat">Flat Amount (₹ / $ / €)</option>
|
<option value="flat">Flat Amount (₹/$)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{data.discountType === 'percentage' ? (
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-4 gap-2.5">
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Discount % *</label>
|
<label className="block text-[11px] font-bold text-slate-600 mb-1">
|
||||||
<div className="relative">
|
{data.discountType === 'percentage' ? 'Percentage (%) *' : 'Flat Amount *'}
|
||||||
|
</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
min="0.01"
|
min="0.01"
|
||||||
max="100"
|
|
||||||
required
|
required
|
||||||
value={data.discountValue}
|
value={data.discountValue}
|
||||||
onChange={(e) => onChange('discountValue', e.target.value)}
|
onChange={(e) => onChange('discountValue', e.target.value)}
|
||||||
placeholder="e.g. 20"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500"
|
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500"
|
||||||
/>
|
/>
|
||||||
<span className="absolute right-3 top-2 text-xs font-bold text-slate-400">%</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Max Cap ₹ (INR)</label>
|
<label className="block text-[11px] font-bold text-slate-600 mb-1">Max Cap (0=None)</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
min="0"
|
min="0"
|
||||||
|
disabled={data.discountType !== 'percentage'}
|
||||||
value={data.maxDiscountCap}
|
value={data.maxDiscountCap}
|
||||||
onChange={(e) => onChange('maxDiscountCap', e.target.value)}
|
onChange={(e) => onChange('maxDiscountCap', e.target.value)}
|
||||||
placeholder="0 = None"
|
placeholder="0"
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500 disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Max Cap $ (USD)</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.maxDiscountCapUsd}
|
|
||||||
onChange={(e) => onChange('maxDiscountCapUsd', e.target.value)}
|
|
||||||
placeholder="0 = None"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Max Cap € (EUR)</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.maxDiscountCapEur}
|
|
||||||
onChange={(e) => onChange('maxDiscountCapEur', e.target.value)}
|
|
||||||
placeholder="0 = None"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div>
|
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1.5">
|
|
||||||
Flat Discount Amount (by Currency Tier) *
|
|
||||||
</label>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2.5">
|
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">₹</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0.01"
|
|
||||||
required
|
|
||||||
value={data.discountValue}
|
|
||||||
onChange={(e) => onChange('discountValue', e.target.value)}
|
|
||||||
placeholder="INR (₹)"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">$</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.discountValueUsd}
|
|
||||||
onChange={(e) => onChange('discountValueUsd', e.target.value)}
|
|
||||||
placeholder="USD ($)"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">€</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.discountValueEur}
|
|
||||||
onChange={(e) => onChange('discountValueEur', e.target.value)}
|
|
||||||
placeholder="EUR (€)"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs font-bold text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -318,7 +236,7 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
</label>
|
</label>
|
||||||
<div className="max-h-28 overflow-y-auto bg-white border border-slate-200 rounded-xl p-2 space-y-1.5">
|
<div className="max-h-28 overflow-y-auto bg-white border border-slate-200 rounded-xl p-2 space-y-1.5">
|
||||||
{plans.map((p) => {
|
{plans.map((p) => {
|
||||||
const pids: string[] = [p.inr_plan_id, p.usd_plan_id, p.eur_plan_id, p.id].filter(Boolean);
|
const pids: string[] = [p.inr_plan_id, p.usd_plan_id, p.id].filter(Boolean);
|
||||||
const checked = pids.some((id) => data.applicablePlanIds.includes(id));
|
const checked = pids.some((id) => data.applicablePlanIds.includes(id));
|
||||||
return (
|
return (
|
||||||
<label key={p.base_code || p.code} className="flex items-center gap-2 text-xs text-slate-700 cursor-pointer">
|
<label key={p.base_code || p.code} className="flex items-center gap-2 text-xs text-slate-700 cursor-pointer">
|
||||||
|
|
@ -377,51 +295,19 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
<span className="text-xs font-bold text-slate-700">Block 4: Conditions & Usage Limits</span>
|
<span className="text-xs font-bold text-slate-700">Block 4: Conditions & Usage Limits</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1.5">
|
<label className="block text-[11px] font-bold text-slate-600 mb-1">Min Spend (0=None)</label>
|
||||||
Minimum Cart Spend (0 = No Minimum)
|
|
||||||
</label>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2.5">
|
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">₹</span>
|
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
min="0"
|
min="0"
|
||||||
value={data.minSpend}
|
value={data.minSpend}
|
||||||
onChange={(e) => onChange('minSpend', e.target.value)}
|
onChange={(e) => onChange('minSpend', e.target.value)}
|
||||||
placeholder="Min ₹ (INR)"
|
placeholder="0"
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">$</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.minSpendUsd}
|
|
||||||
onChange={(e) => onChange('minSpendUsd', e.target.value)}
|
|
||||||
placeholder="Min $ (USD)"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="relative">
|
|
||||||
<span className="absolute left-3 top-2 text-xs font-bold text-slate-400">€</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
value={data.minSpendEur}
|
|
||||||
onChange={(e) => onChange('minSpendEur', e.target.value)}
|
|
||||||
placeholder="Min € (EUR)"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl pl-7 pr-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1">
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-bold text-slate-600 mb-1">Global Usage Limit (0=None)</label>
|
<label className="block text-[11px] font-bold text-slate-600 mb-1">Global Usage Limit (0=None)</label>
|
||||||
<input
|
<input
|
||||||
|
|
@ -433,8 +319,9 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs text-slate-800 focus:outline-none focus:border-indigo-500"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center pt-5">
|
</div>
|
||||||
<label className="flex items-center gap-2 cursor-pointer">
|
|
||||||
|
<label className="flex items-center gap-2 cursor-pointer pt-1">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={data.firstOnly}
|
checked={data.firstOnly}
|
||||||
|
|
@ -442,12 +329,10 @@ export const CouponModal: React.FC<CouponModalProps> = ({
|
||||||
className="accent-indigo-600 rounded"
|
className="accent-indigo-600 rounded"
|
||||||
/>
|
/>
|
||||||
<span className="text-xs font-bold text-slate-700">
|
<span className="text-xs font-bold text-slate-700">
|
||||||
First Purchase Only
|
First Purchase Only (Exclusive to new customers with 0 prior subscriptions)
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="flex gap-3 pt-2">
|
<div className="flex gap-3 pt-2">
|
||||||
|
|
|
||||||
|
|
@ -199,26 +199,11 @@ export const CouponsTab: React.FC<CouponsTabProps> = ({
|
||||||
{/* Value */}
|
{/* Value */}
|
||||||
<td className="py-3.5 px-4 whitespace-nowrap">
|
<td className="py-3.5 px-4 whitespace-nowrap">
|
||||||
<div className="inline-flex items-center gap-1 font-extrabold text-slate-800 text-xs">
|
<div className="inline-flex items-center gap-1 font-extrabold text-slate-800 text-xs">
|
||||||
{isPercent ? (
|
{isPercent ? `${c.value}% OFF` : `₹${c.value} FLAT`}
|
||||||
`${c.value}% OFF`
|
|
||||||
) : (
|
|
||||||
<div className="flex items-center gap-1.5 flex-wrap">
|
|
||||||
<span>₹{c.value_inr ?? c.value}</span>
|
|
||||||
{c.value_usd !== undefined && c.value_usd !== null && (
|
|
||||||
<span className="text-slate-400 font-medium">/ ${c.value_usd}</span>
|
|
||||||
)}
|
|
||||||
{c.value_eur !== undefined && c.value_eur !== null && (
|
|
||||||
<span className="text-slate-400 font-medium">/ €{c.value_eur}</span>
|
|
||||||
)}
|
|
||||||
<span className="text-[10px] font-bold text-slate-500">FLAT</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{hasCap && (
|
{hasCap && (
|
||||||
<p className="text-[10px] text-slate-400 font-semibold mt-0.5">
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5">
|
||||||
Cap: ₹{c.max_discount_inr ?? c.max_discount_limit}
|
Cap: ₹{c.max_discount_limit}
|
||||||
{c.max_discount_usd !== undefined && c.max_discount_usd !== null && ` / $${c.max_discount_usd}`}
|
|
||||||
{c.max_discount_eur !== undefined && c.max_discount_eur !== null && ` / €${c.max_discount_eur}`}
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<span className="block text-[9px] font-bold text-slate-400 capitalize mt-0.5">
|
<span className="block text-[9px] font-bold text-slate-400 capitalize mt-0.5">
|
||||||
|
|
@ -276,11 +261,9 @@ export const CouponsTab: React.FC<CouponsTabProps> = ({
|
||||||
: 'Targeted Items'
|
: 'Targeted Items'
|
||||||
: 'Storewide'}
|
: 'Storewide'}
|
||||||
</span>
|
</span>
|
||||||
{(c.min_purchase_amount > 0 || (c.min_purchase_inr && c.min_purchase_inr > 0)) && (
|
{c.min_purchase_amount > 0 && (
|
||||||
<span className="text-[9px] font-bold px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200">
|
<span className="text-[9px] font-bold px-1.5 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200">
|
||||||
Min: ₹{c.min_purchase_inr ?? c.min_purchase_amount}
|
Min: ₹{c.min_purchase_amount}
|
||||||
{c.min_purchase_usd !== undefined && c.min_purchase_usd !== null && c.min_purchase_usd > 0 && ` / $${c.min_purchase_usd}`}
|
|
||||||
{c.min_purchase_eur !== undefined && c.min_purchase_eur !== null && c.min_purchase_eur > 0 && ` / €${c.min_purchase_eur}`}
|
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{c.is_first_purchase_only && (
|
{c.is_first_purchase_only && (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue