import{g as e}from"./vendor-react-Dzc9WstK.js";import{t}from"./DataTable-Dc5x7VxX.js";import{t as n}from"./_shared-BigwsEuL.js";import{_ as r}from"./vendor-flow-IzlrcDx6.js";import{r as i}from"./format-DOnLYpxL.js";import{t as a}from"./StatusBadge-D6eiAqxN.js";import{t as o}from"./useMasterTable-CIy11KIN.js";import{E as s,n as c,t as l}from"./PricingShell-B3nPyLDu.js";import{t as u}from"./statusVariants-C102OsHB.js";var d=r();function f(){let r=e(),f=o(),{data:p,isLoading:m,isFetching:h}=s(f.params),g=[{accessorKey:`label`,header:`Batch`,cell:({row:e})=>(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`font-medium text-[var(--color-text-primary)]`,children:e.original.label||`Untitled batch`}),(0,d.jsx)(`p`,{className:`max-w-md truncate text-[11px] text-[var(--color-text-muted)]`,children:e.original.formula_text})]})},{id:`target`,header:`Target`,enableSorting:!1,cell:({row:e})=>(0,d.jsxs)(`span`,{className:`text-[var(--color-text-secondary)]`,children:[e.original.target_kind_display,e.original.target_customer_type_name&&(0,d.jsxs)(`span`,{className:`text-[var(--color-text-muted)]`,children:[` · `,e.original.target_customer_type_name]})]})},{accessorKey:`status`,header:`Status`,cell:({row:e})=>(0,d.jsx)(a,{label:e.original.status_display,variant:u(e.original.status)})},{accessorKey:`row_count`,header:`Rows`,cell:({getValue:e})=>(0,d.jsx)(n,{value:e()})},{accessorKey:`created_by_name`,header:`Created by`,cell:({row:e})=>(0,d.jsxs)(`div`,{className:`text-[12px]`,children:[(0,d.jsx)(`p`,{className:`text-[var(--color-text-secondary)]`,children:e.original.created_by_name||`System`}),(0,d.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:i(e.original.created_at)})]})}],_=p?.count??0;return(0,d.jsx)(l,{children:(0,d.jsx)(c,{children:(0,d.jsx)(t,{columns:g,data:p?.results??[],isLoading:m,isFetching:h,searchable:!0,searchPlaceholder:`Search batches…`,onSearch:f.onSearch,totalItems:_,currentPage:f.page,pageSize:f.pageSize,totalPages:f.totalPages(_),onPageChange:f.onPageChange,emptyTitle:`No batches yet`,emptyDescription:`Batches are created from the price workbench. Open the workbench, write a formula and preview it to make your first one.`,onRowClick:e=>r(`/admin/pricing/batches/${e.id}`)})})})}export{f as default};