UNPKG

seti-ramesesv1

Version:

Reusable components and context for Next.js apps

71 lines (68 loc) 2.2 kB
import { jsxs, jsx } from 'react/jsx-runtime'; import { loadPage } from 'loader-lib'; import DataList from '../components/common/Datalist.js'; import Spacer from '../components/ui/Spacer.js'; import { useContent } from '../context/ContentContext.js'; import { getApplicationList } from '../stores/applications.js'; const cols = [ { name: "trackno", title: "Tracking No.", width: 150, }, { name: "type", title: "Type", width: 100, }, { name: "particulars", title: "Particulars", }, { name: "applicant", title: "Applicant", width: 150, }, { name: "dtsubmitted", title: "Date Submitted", width: 170, }, { name: "elapsed", title: "Elapsed(days)", width: 100, alignment: "center", }, ]; const OnlineTxnListPage = (props) => { const { tag, title } = props.attr; const { id, target } = props; const { setContent } = useContent(); const listHandler = async (params) => { const data = await getApplicationList({ ...params, tag, limit: params.limit ?? 10, }); return data; }; const openItem = async (item) => { const type = item.type.toLowerCase(); const page = `online_page_${type}`; const templ = await loadPage({ page: page, target: target, params: { itemid: item.trackno, prevPage: id }, }); setContent(target, () => templ); }; return (jsxs("div", { className: "flex flex-col p-4", children: [jsx("p", { className: "text-3xl font-bold", children: title }), jsx(Spacer, {}), jsx(DataList, { cols: cols, handler: listHandler, limit: 10, openItem: openItem, searchFields: ["trackno", "type"], emptyState: { title: "No Record Yet", message: `To see results, enter a keyword or phrase in the search bar as tracking number to find what you're looking for`, }, allowSearch: true })] })); }; export { OnlineTxnListPage as default }; //# sourceMappingURL=OnlineTxnListPage.js.map