2026-01-07 09:31:02 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Button } from '../../ui/button';
|
|
|
|
|
import { X, RefreshCcw, UploadCloud } from 'lucide-react';
|
2026-01-26 13:12:17 +00:00
|
|
|
import { useToast } from '../../../components/feedback/ToastProvider';
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
interface RefundRequestModalProps {
|
|
|
|
|
orderId: string;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const RefundRequestModal: React.FC<RefundRequestModalProps> = ({
|
|
|
|
|
orderId,
|
|
|
|
|
onClose,
|
|
|
|
|
}) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [reason, setReason] = useState('Duplicate Purchase');
|
|
|
|
|
const [details, setDetails] = useState('');
|
|
|
|
|
|
|
|
|
|
const handleSubmit = () => {
|
2026-01-13 18:47:57 +00:00
|
|
|
addToast(`Refund request submitted for Order #${orderId}`, 'success');
|
|
|
|
|
onClose();
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-12 00:54:47 +00:00
|
|
|
<div className="fixed inset-0 z-[400] flex items-center justify-center p-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
2026-02-07 15:07:09 +00:00
|
|
|
className="absolute inset-0 bg-background/90 backdrop-blur-sm"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={onClose}
|
|
|
|
|
></div>
|
2026-02-07 15:07:09 +00:00
|
|
|
<div className="relative w-full max-w-lg bg-card border border-border rounded-xl shadow-2xl animate-scaleIn overflow-hidden">
|
|
|
|
|
<div className="p-4 border-b border-border bg-muted flex justify-between items-center">
|
2026-01-07 09:31:02 +00:00
|
|
|
<h3 className="font-bold text-white flex items-center gap-2">
|
2026-02-07 15:07:09 +00:00
|
|
|
<RefreshCcw className="w-4 h-4 text-warning" /> Request Refund
|
2026-01-07 09:31:02 +00:00
|
|
|
</h3>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button onClick={onClose}>
|
2026-02-07 15:07:09 +00:00
|
|
|
<X className="w-5 h-5 text-muted-foreground hover:text-white" />
|
2026-01-13 18:47:57 +00:00
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="p-6 space-y-4">
|
2026-02-07 15:07:09 +00:00
|
|
|
<p className="text-sm text-muted-foreground">
|
2026-01-13 18:47:57 +00:00
|
|
|
Refund requests are subject to approval. Please provide details
|
|
|
|
|
below for Order{' '}
|
|
|
|
|
<span className="font-mono text-white">#{orderId}</span>.
|
|
|
|
|
</p>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div>
|
2026-02-07 15:07:09 +00:00
|
|
|
<label className="block text-xs font-bold text-muted-foreground uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Reason
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
2026-02-07 15:07:09 +00:00
|
|
|
className="w-full bg-muted border border-border rounded-lg px-4 py-2.5 text-white focus:border-primary outline-none"
|
2026-01-13 18:47:57 +00:00
|
|
|
value={reason}
|
|
|
|
|
onChange={(e) => setReason(e.target.value)}
|
|
|
|
|
>
|
|
|
|
|
<option>Duplicate Purchase</option>
|
|
|
|
|
<option>Accidental Purchase</option>
|
|
|
|
|
<option>Quality Issue / Corrupted File</option>
|
|
|
|
|
<option>Other</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div>
|
2026-02-07 15:07:09 +00:00
|
|
|
<label className="block text-xs font-bold text-muted-foreground uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Details
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
2026-02-07 15:07:09 +00:00
|
|
|
className="w-full bg-muted border border-border rounded-lg p-4 text-white focus:border-primary outline-none text-sm resize-none h-24"
|
2026-01-13 18:47:57 +00:00
|
|
|
placeholder="Please explain why you are requesting a refund..."
|
|
|
|
|
value={details}
|
|
|
|
|
onChange={(e) => setDetails(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-02-07 15:07:09 +00:00
|
|
|
<div className="border-2 border-dashed border-border rounded-lg p-6 flex flex-col items-center justify-center text-muted-foreground hover:text-foreground hover:border-border cursor-pointer transition-colors">
|
2026-01-13 18:47:57 +00:00
|
|
|
<UploadCloud className="w-8 h-8 mb-2" />
|
|
|
|
|
<span className="text-xs font-bold uppercase">
|
|
|
|
|
Upload Evidence (Optional)
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
2026-02-07 15:07:09 +00:00
|
|
|
<div className="p-4 border-t border-border bg-muted flex justify-end gap-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button variant="ghost" onClick={onClose}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button variant="primary" onClick={handleSubmit}>
|
|
|
|
|
Submit Request
|
|
|
|
|
</Button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|