diff --git a/payment-iq/app/components/test/test1.tsx b/payment-iq/app/components/test/test1.tsx new file mode 100644 index 0000000..5a9accf --- /dev/null +++ b/payment-iq/app/components/test/test1.tsx @@ -0,0 +1,103 @@ +import * as React from "react"; +import Box from "@mui/material/Box"; +import Drawer from "@mui/material/Drawer"; +import Button from "@mui/material/Button"; +import List from "@mui/material/List"; +import Divider from "@mui/material/Divider"; +import ListItem from "@mui/material/ListItem"; +import ListItemButton from "@mui/material/ListItemButton"; +import ListItemIcon from "@mui/material/ListItemIcon"; +import ListItemText from "@mui/material/ListItemText"; +import InboxIcon from "@mui/icons-material/MoveToInbox"; +import MailIcon from "@mui/icons-material/Mail"; +import SearchIcon from "@mui/icons-material/Search"; + +export default function RightTemporaryDrawer() { + const [open, setOpen] = React.useState(false); + + const toggleDrawer = + (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { + if ( + event.type === "keydown" && + ((event as React.KeyboardEvent).key === "Tab" || + (event as React.KeyboardEvent).key === "Shift") + ) { + return; + } + + setOpen(open); + }; + + const list = () => ( + + + {["Inbox", "Starred", "Send email", "Drafts"].map((text, index) => ( + + + + {index % 2 === 0 ? : } + + + + + ))} + + + + {["All mail", "Trash", "Spam"].map((text, index) => ( + + + + {index % 2 === 0 ? : } + + + + + ))} + + + ); + + return ( +
+ + {/* */} + + {list()} + +
+ ); +} diff --git a/payment-iq/app/components/test/test2.tsx b/payment-iq/app/components/test/test2.tsx new file mode 100644 index 0000000..631ba38 --- /dev/null +++ b/payment-iq/app/components/test/test2.tsx @@ -0,0 +1,207 @@ +import React, { useState } from "react"; +import { + Box, + Grid, + TextField, + MenuItem, + Button, + InputLabel, + FormControl, + Select, + Typography, +} from "@mui/material"; +import { DatePicker } from "@mui/x-date-pickers/DatePicker"; +import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; +import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; +import SearchIcon from "@mui/icons-material/Search"; +import RefreshIcon from "@mui/icons-material/Refresh"; + +const currencies = ["USD", "EUR", "GBP"]; +const states = ["Pending", "Completed", "Failed"]; +const transactionTypes = ["Credit", "Debit"]; +const paymentMethods = ["Card", "Bank Transfer"]; +const psps = ["Stripe", "PayPal"]; +const merchants = ["Amazon", "eBay"]; + +export default function SearchFilterForm() { + const [form, setForm] = useState({ + keyword: "", + transactionId: "", + transactionReferenceId: "", + user: "", + currency: "", + state: "", + statusDescription: "", + transactionType: "", + paymentMethod: "", + psps: "", + initialPsps: "", + merchants: "", + startDate: null, + endDate: null, + lastUpdatedFrom: null, + lastUpdatedTo: null, + minAmount: "", + maxAmount: "", + channel: "", + }); + + const handleChange = (field: string, value: any) => { + setForm((prev) => ({ ...prev, [field]: value })); + }; + + const resetForm = () => { + setForm({ + keyword: "", + transactionId: "", + transactionReferenceId: "", + user: "", + currency: "", + state: "", + statusDescription: "", + transactionType: "", + paymentMethod: "", + psps: "", + initialPsps: "", + merchants: "", + startDate: null, + endDate: null, + lastUpdatedFrom: null, + lastUpdatedTo: null, + minAmount: "", + maxAmount: "", + channel: "", + }); + }; + + return ( + + + + Search + + + + {[ + { label: "Keyword", field: "keyword", type: "text" }, + { label: "Transaction ID", field: "transactionId", type: "text" }, + { + label: "Transaction Reference ID", + field: "transactionReferenceId", + type: "text", + }, + { label: "User", field: "user", type: "text" }, + { + label: "Currency", + field: "currency", + type: "select", + options: currencies, + }, + { label: "State", field: "state", type: "select", options: states }, + { + label: "Status Description", + field: "statusDescription", + type: "text", + }, + { + label: "Transaction Type", + field: "transactionType", + type: "select", + options: transactionTypes, + }, + { + label: "Payment Method", + field: "paymentMethod", + type: "select", + options: paymentMethods, + }, + { label: "PSPs", field: "psps", type: "text" }, + { label: "Initial PSPs", field: "initialPsps", type: "text" }, + { label: "Merchants", field: "merchants", type: "text" }, + { label: "Start Date", field: "startDate", type: "date" }, + { label: "End Date", field: "endDate", type: "date" }, + { + label: "Last Updated From", + field: "lastUpdatedFrom", + type: "date", + }, + { label: "Last Updated To", field: "lastUpdatedTo", type: "date" }, + { label: "Min Amount", field: "minAmount", type: "text" }, + { label: "Max Amount", field: "maxAmount", type: "text" }, + { label: "Channel", field: "channel", type: "text" }, + ].map(({ label, field, type, options }) => ( + + + + {label} + + + + {type === "text" && ( + handleChange(field, e.target.value)} + /> + )} + {type === "select" && ( + + + + )} + {type === "date" && ( + handleChange(field, newValue)} + renderInput={(params) => ( + + )} + /> + )} + + + ))} + + {/* Buttons */} + + + + + + + + ); +} diff --git a/payment-iq/app/dashboard/transactions/page.tsx b/payment-iq/app/dashboard/transactions/page.tsx index f2059f1..80d9118 100644 --- a/payment-iq/app/dashboard/transactions/page.tsx +++ b/payment-iq/app/dashboard/transactions/page.tsx @@ -5,7 +5,7 @@ import TransactionTable from "@/app/features/Pages/Transactions/Transactions"; export default function TransactionPage() { return ( -
+
{/* This page will now be rendered on the client-side */}
diff --git a/payment-iq/app/features/AdvancedSearch/AdvancedSearch.tsx b/payment-iq/app/features/AdvancedSearch/AdvancedSearch.tsx new file mode 100644 index 0000000..44ec2a3 --- /dev/null +++ b/payment-iq/app/features/AdvancedSearch/AdvancedSearch.tsx @@ -0,0 +1,256 @@ +import { useState } from "react"; +import { + Box, + TextField, + MenuItem, + Button, + Drawer, + FormControl, + Select, + Typography, + Stack, +} from "@mui/material"; +import { DatePicker } from "@mui/x-date-pickers/DatePicker"; +import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; +import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; +import SearchIcon from "@mui/icons-material/Search"; +import RefreshIcon from "@mui/icons-material/Refresh"; + +const currencies = ["USD", "EUR", "GBP"]; +const states = ["Pending", "Completed", "Failed"]; +const transactionTypes = ["Credit", "Debit"]; +const paymentMethods = ["Card", "Bank Transfer"]; + +export default function AdvancedSearch() { + const [open, setOpen] = useState(false); + const [form, setForm] = useState({ + keyword: "", + transactionId: "", + transactionReferenceId: "", + user: "", + currency: "", + state: "", + statusDescription: "", + transactionType: "", + paymentMethod: "", + psps: "", + initialPsps: "", + merchants: "", + startDate: null, + endDate: null, + lastUpdatedFrom: null, + lastUpdatedTo: null, + minAmount: "", + maxAmount: "", + channel: "", + }); + + const resetForm = () => { + setForm({ + keyword: "", + transactionId: "", + transactionReferenceId: "", + user: "", + currency: "", + state: "", + statusDescription: "", + transactionType: "", + paymentMethod: "", + psps: "", + initialPsps: "", + merchants: "", + startDate: null, + endDate: null, + lastUpdatedFrom: null, + lastUpdatedTo: null, + minAmount: "", + maxAmount: "", + channel: "", + }); + }; + + const handleChange = (field: string, value: any) => { + setForm((prev) => ({ ...prev, [field]: value })); + }; + + const toggleDrawer = + (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { + if ( + event.type === "keydown" && + ((event as React.KeyboardEvent).key === "Tab" || + (event as React.KeyboardEvent).key === "Shift") + ) { + return; + } + + setOpen(open); + }; + + const list = () => ( + + + + + + Search + + {/* Buttons */} + + + + + + + {[ + { label: "Keyword", field: "keyword", type: "text" }, + { label: "Transaction ID", field: "transactionId", type: "text" }, + { + label: "Transaction Reference ID", + field: "transactionReferenceId", + type: "text", + }, + { label: "User", field: "user", type: "text" }, + { + label: "Currency", + field: "currency", + type: "select", + options: currencies, + }, + { + label: "State", + field: "state", + type: "select", + options: states, + }, + { + label: "Status Description", + field: "statusDescription", + type: "text", + }, + { + label: "Transaction Type", + field: "transactionType", + type: "select", + options: transactionTypes, + }, + { + label: "Payment Method", + field: "paymentMethod", + type: "select", + options: paymentMethods, + }, + { label: "PSPs", field: "psps", type: "text" }, + { label: "Initial PSPs", field: "initialPsps", type: "text" }, + { label: "Merchants", field: "merchants", type: "text" }, + { label: "Start Date", field: "startDate", type: "date" }, + { label: "End Date", field: "endDate", type: "date" }, + { + label: "Last Updated From", + field: "lastUpdatedFrom", + type: "date", + }, + { + label: "Last Updated To", + field: "lastUpdatedTo", + type: "date", + }, + { label: "Min Amount", field: "minAmount", type: "text" }, + { label: "Max Amount", field: "maxAmount", type: "text" }, + { label: "Channel", field: "channel", type: "text" }, + ].map(({ label, field, type, options }) => ( + + + {label} + + {type === "text" && ( + handleChange(field, e.target.value)} + /> + )} + {type === "select" && ( + + + + )} + {type === "date" && ( + handleChange(field, newValue)} + renderInput={(params) => ( + + )} + /> + )} + + ))} + + + + + ); + return ( +
+ + {/* */} + + {list()} + +
+ ); +} diff --git a/payment-iq/app/features/Pages/transactions/Transactions.tsx b/payment-iq/app/features/Pages/transactions/Transactions.tsx index 58f7deb..b2dcda7 100644 --- a/payment-iq/app/features/Pages/transactions/Transactions.tsx +++ b/payment-iq/app/features/Pages/transactions/Transactions.tsx @@ -22,6 +22,7 @@ import { saveAs } from "file-saver"; import { DataGrid } from "@mui/x-data-grid"; import { columns } from "./constants"; import { rows } from "./mockData"; +import AdvancedSearch from "../../AdvancedSearch/AdvancedSearch"; const paginationModel = { page: 0, pageSize: 50 }; @@ -71,6 +72,9 @@ export default function TransactionTable() { onChange={(e) => console.log(`setSearchQuery(${e.target.value})`)} sx={{ width: 300 }} /> + + {/* */} + {/* */}