import{j as e,v as T,r as C,m as P}from"./app-CffHYkHW.js";import{S as c,a as o,b as x,c as u,d as r}from"./select-ClrGyhQo.js";import{I as h}from"./input-Bw4IOOzt.js";import{a as d}from"./utils-C8zp8JNC.js";const _=({children:s,className:l})=>e.jsx("div",{className:d("w-full border border-border rounded-md overflow-x-auto bg-card text-card-foreground transition-colors",l),children:s});_.displayName="TableCard";const k=({url:s,placeholder:l,withFilterPage:p=!1,currentPage:j,perPage:m,withFilterStatus:g=!1,withFilterDate:f=!1,withFilterPlatform:b=!1,withFilterShipping:v=!1,withFilterCashier:N=!1,platforms:w=[],cashiers:S=[]})=>{const{data:t,setData:y}=T({search:"",page:j,perPage:m,status:"",date_from:"",date_to:"",platform:"",shipping:"",cashier:""}),n=C.useCallback(a=>{const i={...t,...a};i.perPage&&(i.per_page=i.perPage,delete i.perPage),y({...t,...a}),P.get(s,i,{preserveState:!0,replace:!0})},[t,s]);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p&&e.jsxs(c,{value:String(t.perPage),onValueChange:a=>n({perPage:parseInt(a)||10,page:1}),children:[e.jsx(o,{className:"w-[70px] focus:ring-0",children:e.jsx(x,{placeholder:m})}),e.jsxs(u,{children:[e.jsx(r,{value:"10",children:"10"}),e.jsx(r,{value:"25",children:"25"}),e.jsx(r,{value:"50",children:"50"}),e.jsx(r,{value:"100",children:"100"})]})]}),e.jsx(h,{className:"w-full",type:"text",value:t.search,onChange:a=>n({search:a.target.value}),placeholder:l})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[g&&e.jsxs(c,{value:t.status,onValueChange:a=>n({status:a}),children:[e.jsx(o,{className:"w-[160px] focus:ring-0",children:e.jsx(x,{placeholder:"Status Pembayaran"})}),e.jsxs(u,{children:[e.jsx(r,{value:"all",children:"Semua"}),e.jsx(r,{value:"pending",children:"Pending"}),e.jsx(r,{value:"partial",children:"Partial"}),e.jsx(r,{value:"paid",children:"Paid"})]})]}),f&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{type:"date",value:t.date_from,onChange:a=>n({date_from:a.target.value}),className:"w-[150px]"}),e.jsx("span",{children:"-"}),e.jsx(h,{type:"date",value:t.date_to,onChange:a=>n({date_to:a.target.value}),className:"w-[150px]"})]}),b&&e.jsxs(c,{value:t.platform,onValueChange:a=>n({platform:a}),children:[e.jsx(o,{className:"w-[160px] focus:ring-0",children:e.jsx(x,{placeholder:"Platform"})}),e.jsxs(u,{children:[e.jsx(r,{value:"all",children:"Semua"}),w.map(a=>e.jsx(r,{value:a.name,children:String(a.name)},a.name))]})]}),v&&e.jsxs(c,{value:t.shipping,onValueChange:a=>n({shipping:a}),children:[e.jsx(o,{className:"w-[160px] focus:ring-0",children:e.jsx(x,{placeholder:"Status Pengiriman"})}),e.jsxs(u,{children:[e.jsx(r,{value:"all",children:"Semua"}),e.jsx(r,{value:"pending",children:"Pending"}),e.jsx(r,{value:"shipped",children:"Shipped"}),e.jsx(r,{value:"delivered",children:"Delivered"})]})]}),N&&e.jsxs(c,{value:t.cashier,onValueChange:a=>n({cashier:a}),children:[e.jsx(o,{className:"w-[160px] focus:ring-0",children:e.jsx(x,{placeholder:"Kasir"})}),e.jsxs(u,{children:[e.jsx(r,{value:"all",children:"Semua"}),S.map(a=>e.jsx(r,{value:String(a.id),children:String(a.name)},String(a.id)))]})]})]})]})})};k.displayName="TableFilter";function B({className:s,...l}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:d("w-full caption-bottom text-sm",s),...l})})}function K({className:s,...l}){return e.jsx("thead",{"data-slot":"table-header",className:d("[&_tr]:border-b border-border bg-muted text-muted-foreground transition-colors",s),...l})}function q({className:s,...l}){return e.jsx("tbody",{"data-slot":"table-body",className:d("[&_tr:last-child]:border-0",s),...l})}function V({className:s,...l}){return e.jsx("tr",{"data-slot":"table-row",className:d("border-b border-border divide-x divide-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...l})}function z({className:s,...l}){return e.jsx("th",{"data-slot":"table-head",className:d("p-3 whitespace-nowrap text-left align-middle font-medium text-muted-foreground transition-colors [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...l})}function E({className:s,...l}){return e.jsx("td",{"data-slot":"table-cell",className:d("p-2 whitespace-nowrap align-middle text-foreground transition-colors [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...l})}const F=({colSpan:s,message:l})=>e.jsx(V,{children:e.jsxs(E,{colSpan:s,align:"center",className:"text-muted-foreground",children:[l," tidak ditemukan."]})});F.displayName="TableEmpty";export{k as T,_ as a,B as b,K as c,V as d,z as e,q as f,F as g,E as h};
