Refund added
This commit is contained in:
BIN
frontend/src/assets/tillo_spinner.gif
Normal file
BIN
frontend/src/assets/tillo_spinner.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 MiB |
@@ -173,3 +173,18 @@
|
||||
font-size: 10pt !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tillo Spinner Replacement for Admin Dashboard */
|
||||
.animate-spin {
|
||||
animation: none !important;
|
||||
border-color: transparent !important;
|
||||
border-top-color: transparent !important;
|
||||
background-image: url('./assets/tillo_spinner.gif') !important;
|
||||
background-size: contain !important;
|
||||
background-position: center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
|
||||
.animate-spin * {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,6 @@ const Login = () => {
|
||||
>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-[9px] font-black text-slate-400 uppercase tracking-widest">Merchant Partner</span>
|
||||
<span className="text-xs font-bold text-[#001828] mt-0.5">Rajalakshmi Institute of Technology</span>
|
||||
</div>
|
||||
<img src={ritLogo} alt="RIT Logo" className="h-12 w-auto object-contain filter drop-shadow-sm" />
|
||||
</motion.div>
|
||||
|
||||
@@ -190,6 +190,23 @@ const Orders: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancelOrder = async (orderId: number) => {
|
||||
if (!window.confirm('Are you sure you want to cancel this order? Tokens will be refunded.')) return;
|
||||
try {
|
||||
const response = await apiFetch(`http://${window.location.hostname}:8080/api/orders/${orderId}/cancel`, {
|
||||
method: 'POST'
|
||||
});
|
||||
if (response.ok) {
|
||||
setShowActionMenu(false);
|
||||
fetchOrders();
|
||||
} else {
|
||||
alert('Failed to cancel order');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error cancelling order:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditOrder = () => {
|
||||
if (!selectedOrder) return;
|
||||
setEditingItems([...selectedOrder.items]);
|
||||
@@ -604,6 +621,14 @@ const Orders: React.FC = () => {
|
||||
>
|
||||
<RotateCcw size={14} className="text-amber-500" /> Mark Undelivered
|
||||
</button>
|
||||
{selectedOrder.status.toUpperCase() !== 'CANCELLED' && selectedOrder.status.toUpperCase() !== 'COMPLETED' && (
|
||||
<button
|
||||
onClick={() => handleCancelOrder(selectedOrder.id)}
|
||||
className="w-full text-left px-4 py-3 text-xs font-bold text-rose-600 hover:bg-rose-50 flex items-center gap-3 transition-colors cursor-pointer"
|
||||
>
|
||||
<XIcon size={14} className="text-rose-600" /> Cancel Order
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user