import{jsxs as t,Fragment as c,jsx as o}from"react/jsx-runtime";import{T as u}from"./table-filter-CFSMxglD.js";import{T as g}from"./table-footer-lUcSaZ5Q.js";import{T as h}from"./table-header-DXTJ1r7-.js";import{B as f,a as b,aD as x,aE as C,aF as p,aG as s}from"./ui-components-B24mpb8o.js";import{D as R}from"./layout-CZk01yM3.js";import{Head as T}from"@inertiajs/react";import{useReactTable as w,getFilteredRowModel as N,getSortedRowModel as y,getCoreRowModel as M,flexRender as S}from"@tanstack/react-table";import{Plus as F}from"lucide-react";import*as D from"react";import j from"./coupon-form-Viqs_2Jy.js";import v from"./coupon-table-columns-CDzCwfrd.js";import"./use-lang-Cw_jKJYs.js";import"./debounce-CWHP_ANh.js";import"./route-D0xh7FtZ.js";import"./table-page-size-B94DPeOD.js";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";import"./main-Cv60h411.js";import"./theme-colors-CLpwvDr4.js";import"./appearance-zLWEcDPI.js";import"./language-79bZLpyc.js";import"./notification-BBQVVMqD.js";import"date-fns";import"./app-logo-CAnM-q9p.js";import"./input-error-BbsDx4-P.js";import"./loading-button-B_LaGOAp.js";import"./date-BZvGgr5q.js";import"./inertia-FIn3q7f1.js";const B=({coupons:e,exams:a})=>{var l;const[n,d]=D.useState([]),r=w({data:e.data,columns:v({exams:a}),onSortingChange:d,getCoreRowModel:M(),getSortedRowModel:y(),getFilteredRowModel:N(),state:{sorting:n}});return t(c,{children:[o(T,{title:"Exam Coupons"}),t("div",{className:"space-y-6",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{children:[o("h1",{className:"text-3xl font-bold text-gray-900",children:"Exam Coupons"}),o("p",{className:"mt-1 text-sm text-gray-600",children:"Manage discount coupons for your exams"})]}),o(j,{title:"Create Coupon",exams:a,handler:t(f,{children:[o(F,{className:"mr-2 h-4 w-4"}),"Add Coupon"]})})]}),t(b,{children:[o(u,{data:e,title:"Coupon List",globalSearch:!0,tablePageSizes:[10,15,20,25],routeName:"exam-coupons.index"}),t(x,{className:"border-border border-y",children:[o(h,{table:r}),o(C,{children:(l=r.getRowModel().rows)!=null&&l.length?r.getRowModel().rows.map(i=>o(p,{"data-state":i.getIsSelected()&&"selected",children:i.getVisibleCells().map(m=>o(s,{children:S(m.column.columnDef.cell,m.getContext())},m.id))},i.id)):o(p,{children:o(s,{colSpan:r.getAllColumns().length,className:"h-24 text-center",children:"No coupons found."})})})]}),o(g,{className:"p-5 sm:p-7",routeName:"exam-coupons.index",paginationInfo:e})]})]})]})};B.layout=e=>o(R,{children:e});export{B as default};
