mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-01 15:23:58 +00:00
Merge pull request #3 from i701/feat/cancel-selected-devices
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m7s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m7s
feat: enhance device cart with cancel feature
This commit is contained in:
@ -6,11 +6,12 @@ This is a web portal for SAR Link customers.
|
|||||||
## User Menu
|
## User Menu
|
||||||
### Devices
|
### Devices
|
||||||
- [x] Add mac vendor validation for adding devices
|
- [x] Add mac vendor validation for adding devices
|
||||||
- [ ] Add all the filters for devices table (mobile responsive)
|
- [x] Add all the filters for devices table (mobile responsive)
|
||||||
|
- [x] Add cancel feature to selected devices floating button
|
||||||
|
|
||||||
### Payments
|
### Payments
|
||||||
- [ ] Show payments table
|
- [x] Show payments table
|
||||||
- [ ] Add all the filters for payment table (mobile responsive)
|
- [x] Add all the filters for payment table (mobile responsive)
|
||||||
- [ ] Fix bill formula linking for generated payments
|
- [ ] Fix bill formula linking for generated payments
|
||||||
|
|
||||||
### Parental Control
|
### Parental Control
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { useAtom } from "jotai";
|
||||||
import { deviceCartAtom } from "@/lib/atoms";
|
|
||||||
import { useAtomValue } from "jotai";
|
|
||||||
import { MonitorSmartphone } from "lucide-react";
|
import { MonitorSmartphone } from "lucide-react";
|
||||||
import { usePathname, useRouter } from "next/navigation";
|
import { usePathname, useRouter } from "next/navigation";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { deviceCartAtom } from "@/lib/atoms";
|
||||||
|
|
||||||
export function DeviceCartDrawer() {
|
export function DeviceCartDrawer() {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const devices = useAtomValue(deviceCartAtom);
|
const [devices, setDevices] = useAtom(deviceCartAtom);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
if (pathname === "/payment" || pathname === "/devices-to-pay") {
|
if (pathname === "/payment" || pathname === "/devices-to-pay") {
|
||||||
return null;
|
return null;
|
||||||
@ -16,14 +16,23 @@ export function DeviceCartDrawer() {
|
|||||||
|
|
||||||
if (devices.length === 0) return null;
|
if (devices.length === 0) return null;
|
||||||
return (
|
return (
|
||||||
|
<div className="bg-sarLinkOrange rounded-lg shadow-2xl dark:hover:bg-orange-900 fixed bottom-20 w-80 uppercase h-auto z-20 left-1/2 transform -translate-x-1/2 hover:ring-2 hover:ring-sarLinkOrange transition-all duration-200 p-2 flex flex-col gap-2">
|
||||||
<Button
|
<Button
|
||||||
size={"lg"}
|
size={"lg"}
|
||||||
className="bg-sarLinkOrange dark:hover:bg-orange-900 fixed bottom-20 w-80 uppercase h-12 z-20 left-1/2 transform -translate-x-1/2 hover:ring-2 hover:ring-sarLinkOrange transition-all duration-200"
|
className="w-ful"
|
||||||
onClick={() => router.push("/devices-to-pay")}
|
onClick={() => router.push("/devices-to-pay")}
|
||||||
variant="outline"
|
variant="secondary"
|
||||||
>
|
>
|
||||||
<MonitorSmartphone />
|
<MonitorSmartphone />
|
||||||
Pay {devices.length > 0 && `(${devices.length})`} Device
|
Pay {devices.length > 0 && `(${devices.length})`} {devices.length > 1 ? "devices" : "device"}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant={"destructive"}
|
||||||
|
onClick={() => setDevices([])}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export default function DevicesForPayment() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return <FullPageLoader />
|
return <FullPageLoader />;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="max-w-lg mx-auto space-y-4 px-4">
|
<div className="max-w-lg mx-auto space-y-4 px-4">
|
||||||
|
Reference in New Issue
Block a user