import{r as i,j as e}from"./client-BbMi5ewG.js";import{C as U}from"./CrudLayout-Cx6KhKUY.js";import"./apiConfig-D-T4C2Ae.js";import{a as P}from"./index-D59bwJy3.js";import{f as T}from"./priceFormatter-Dg4GlACg.js";import{c as z,X as J}from"./utils-Q0fnGDhj.js";import{U as K}from"./user-jdISm6se.js";import{b as Q,C as E}from"./CalenderCheck-BuHSX8YD.js";import{C as Z}from"./check-DMod5j-l.js";import{C as ee}from"./copy-C2TM1za3.js";import{m as B,l as F,d as O,e as q,W as G,n as W,R as te,g as D}from"./index-CM0LBdHD.js";import{C as X}from"./circle-check-big-uMTsaxsq.js";import{D as I}from"./dollar-sign-DRtWdm2i.js";import{e as _,s as R}from"./toast-1-c8k_LJ.js";import{S as C}from"./skeleton-ImO4uxQ7.js";import{R as H}from"./refresh-cw-Drw5C3fI.js";import{E as se}from"./eye-XZqBNmRu.js";import{P as V}from"./ProUpgradeBanner-j5GA7rlc.js";import"./vendor-DDjlQeP6.js";import"./ArrowLeftIcon-DrGyoHe_.js";import"./withIconDefaults-C8UfSjn1.js";import"./preload-helper-Dp1pzeXC.js";import"./calendar-CjyQ6Zau.js";import"./tag-CvsOfBQf.js";import"./shield-Bmp_421z.js";import"./proxy-DChtKkEh.js";import"./crown-BdDHOvET.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ae=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],re=z("arrow-down-right",ae);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const le=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],ne=z("arrow-up-right",le),S="/radius-booking/v1/payouts",ie=(t={})=>{const r=new URLSearchParams(t).toString();return P({path:`${S}?${r}`,method:"GET"})},ce=(t,r="")=>P({path:`${S}/${t}/approve`,method:"POST",data:{admin_note:r}}),oe=(t,r="")=>P({path:`${S}/${t}/complete`,method:"POST",data:{admin_note:r}}),de=(t,r="")=>P({path:`${S}/${t}/reject`,method:"POST",data:{admin_note:r}}),me=(t={})=>{const r=new URLSearchParams(t).toString();return P({path:`${S}/admin-income${r?`?${r}`:""}`,method:"GET"})},xe={pending:"bg-yellow-100 text-yellow-800",approved:"bg-blue-100 text-blue-800",completed:"bg-green-100 text-green-800",rejected:"bg-red-100 text-red-800"};function pe({payout:t,onClose:r,onApprove:n,onComplete:f,onReject:l,isProcessing:b}){var u,p,v;const[d,w]=i.useState(""),[h,j]=i.useState(null),[g,m]=i.useState(null);if(!t)return null;const N=c=>T(parseFloat(c||0).toFixed(2),t==null?void 0:t.currency),a=c=>{h===c?(c==="approve"&&n(t.id,d),c==="complete"&&f(t.id,d),c==="reject"&&l(t.id,d),j(null),w("")):j(c)};return e.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/50",onClick:r,children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-title",children:["Payout #",t.id]}),e.jsx("span",{className:`inline-block mt-1 text-xs font-medium px-2.5 py-0.5 rounded-full capitalize ${xe[t.status]}`,children:t.status})]}),e.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx(J,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"px-6 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsx(K,{className:"w-5 h-5 text-gray-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Employee"}),e.jsx("p",{className:"font-medium text-title",children:t.employee_name})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Gross Amount"}),e.jsx("p",{className:"font-semibold text-title",children:N(t.amount)})]}),e.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Commission"}),e.jsxs("p",{className:"font-semibold text-red-600",children:["-",N(t.commission_amount)]})]}),e.jsxs("div",{className:"p-3 bg-primary/5 rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Net Amount"}),e.jsx("p",{className:"font-semibold text-primary",children:N(t.net_amount)})]})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-gray-500",children:"Payout Method"}),e.jsx("span",{className:"font-medium text-title capitalize",children:t.payout_method_label||((u=t.payout_method)==null?void 0:u.replace("_"," "))})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-gray-500",children:"Requested"}),e.jsx("span",{className:"font-medium text-title",children:t.created_at})]}),t.processed_at&&e.jsxs("div",{className:"flex justify-between py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-gray-500",children:"Processed"}),e.jsx("span",{className:"font-medium text-title",children:t.processed_at})]}),t.completed_at&&e.jsxs("div",{className:"flex justify-between py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-gray-500",children:"Completed"}),e.jsx("span",{className:"font-medium text-title",children:t.completed_at})]}),t.processed_by_name&&e.jsxs("div",{className:"flex justify-between py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-gray-500",children:"Processed By"}),e.jsx("span",{className:"font-medium text-title",children:t.processed_by_name})]})]}),t.payment_info&&t.payment_info.length>0&&e.jsxs("div",{className:"p-3 bg-blue-50 rounded-lg border border-blue-100",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Q,{className:"w-4 h-4 text-blue-500"}),e.jsxs("p",{className:"text-xs font-semibold text-blue-700",children:["Payment Details — ",t.payout_method_label||((p=t.payout_method)==null?void 0:p.replace("_"," "))]})]}),e.jsx("div",{className:"space-y-1.5",children:t.payment_info.map((c,y)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 px-2 bg-white rounded-md border border-blue-100",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] text-gray-400",children:c.label}),e.jsx("p",{className:"text-sm font-medium text-title break-all",children:c.value})]}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(c.value),m(y),setTimeout(()=>m(null),1500)},className:"p-1 text-gray-400 hover:text-blue-600 rounded transition-colors shrink-0",title:"Copy",children:g===y?e.jsx(Z,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(ee,{className:"w-3.5 h-3.5"})})]},y))})]}),(!t.payment_info||t.payment_info.length===0)&&(t.status==="pending"||t.status==="approved")&&e.jsx("div",{className:"p-3 bg-amber-50 rounded-lg border border-amber-100",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"w-4 h-4 text-amber-500"}),e.jsxs("p",{className:"text-xs text-amber-700",children:["Employee has not provided payment details for ",e.jsx("span",{className:"font-medium",children:t.payout_method_label||((v=t.payout_method)==null?void 0:v.replace("_"," "))}),"."]})]})}),t.employee_note&&e.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(B,{className:"w-4 h-4 text-gray-400"}),e.jsx("p",{className:"text-xs font-medium text-gray-500",children:"Employee Note"})]}),e.jsx("p",{className:"text-sm text-title",children:t.employee_note})]}),t.admin_note&&e.jsxs("div",{className:"p-3 bg-blue-50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(B,{className:"w-4 h-4 text-blue-400"}),e.jsx("p",{className:"text-xs font-medium text-blue-600",children:"Admin Note"})]}),e.jsx("p",{className:"text-sm text-title",children:t.admin_note})]}),(t.status==="pending"||t.status==="approved")&&e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx("textarea",{value:d,onChange:c=>w(c.target.value),placeholder:"Admin note (optional)",className:"w-full p-3 text-sm border border-gray-200 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",rows:2}),e.jsxs("div",{className:"flex gap-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>a("approve"),disabled:b,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(X,{className:"w-4 h-4"}),h==="approve"?"Confirm Approve":"Approve"]}),e.jsxs("button",{onClick:()=>a("reject"),disabled:b,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(F,{className:"w-4 h-4"}),h==="reject"?"Confirm Reject":"Reject"]})]}),t.status==="approved"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>a("complete"),disabled:b,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(I,{className:"w-4 h-4"}),h==="complete"?"Confirm Complete":"Mark Completed"]}),e.jsxs("button",{onClick:()=>a("reject"),disabled:b,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(F,{className:"w-4 h-4"}),h==="reject"?"Confirm Reject":"Reject"]})]})]}),h&&e.jsx("button",{onClick:()=>j(null),className:"w-full text-center text-sm text-gray-500 hover:text-gray-700 py-1",children:"Cancel"})]})]})]})})}const he=[{key:"all",label:"All"},{key:"pending",label:"Pending",icon:E,color:"text-yellow-600"},{key:"approved",label:"Approved",icon:X,color:"text-blue-600"},{key:"completed",label:"Completed",icon:I,color:"text-green-600"},{key:"rejected",label:"Rejected",icon:F,color:"text-red-600"}],ue={pending:"bg-yellow-100 text-yellow-800",approved:"bg-blue-100 text-blue-800",completed:"bg-green-100 text-green-800",rejected:"bg-red-100 text-red-800"},Y=9;function ge({rows:t=8}){return e.jsx("tbody",{children:Array.from({length:t}).map((r,n)=>e.jsx("tr",{className:"border-b border-gray-50",children:Array.from({length:Y}).map((f,l)=>e.jsx("td",{className:"px-4 py-3.5",children:e.jsx(C,{className:`h-5 ${l===1?"w-28":l===6?"w-16":"w-20"}`})},l))},n))})}function M(){const[t,r]=i.useState([]),[n,f]=i.useState({current_page:1,last_page:1,total:0}),[l,b]=i.useState({}),[d,w]=i.useState("all"),[h,j]=i.useState(!0),[g,m]=i.useState(null),[N,a]=i.useState(!1),u=(s,x)=>T(parseFloat(s||0).toFixed(2),x),p=i.useCallback(async(s=1,x=d)=>{var o,L;try{j(!0);const $={page:s,per_page:15};x&&x!=="all"&&($.status=x);const k=await ie($);k.success&&(r(k.data||[]),f(((o=k.meta)==null?void 0:o.pagination)||{current_page:1,last_page:1,total:0}),(L=k.meta)!=null&&L.status_counts&&b(k.meta.status_counts))}catch{_("Failed to load payouts")}finally{j(!1)}},[d]);i.useEffect(()=>{p(1,d)},[d]);const v=async(s,x)=>{try{a(!0);const o=await ce(s,x);o.success?(R(o.message||"Payout approved"),m(null),p(n.current_page,d)):_(o.message||"Failed to approve")}catch{_("Failed to approve payout")}finally{a(!1)}},c=async(s,x)=>{try{a(!0);const o=await oe(s,x);o.success?(R(o.message||"Payout completed"),m(null),p(n.current_page,d)):_(o.message||"Failed to complete")}catch{_("Failed to complete payout")}finally{a(!1)}},y=async(s,x)=>{try{a(!0);const o=await de(s,x);o.success?(R(o.message||"Payout rejected"),m(null),p(n.current_page,d)):_(o.message||"Failed to reject")}catch{_("Failed to reject payout")}finally{a(!1)}};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[he.map(s=>{const x=l[s.key]||0,o=d===s.key;return e.jsxs("button",{onClick:()=>w(s.key),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg transition-colors ${o?"bg-primary text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[s.icon&&e.jsx(s.icon,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s.label}),e.jsxs("span",{className:`text-xs font-medium ${o?"text-white/80":"text-gray-400"}`,children:["(",x,")"]})]},s.key)}),e.jsx("button",{onClick:()=>p(1,d),className:"ml-auto p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",title:"Refresh",children:e.jsx(H,{className:`w-4 h-4 ${h?"animate-spin":""}`})})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 border-b border-border",children:[e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"ID"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Employee"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Amount"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Commission"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Net"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Method"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Status"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Date"}),e.jsx("th",{className:"text-center px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),h?e.jsx(ge,{}):t.length===0?e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:Y,className:"px-4 py-12 text-center text-sm text-gray-500",children:"No payouts found"})})}):e.jsx("tbody",{className:"divide-y divide-gray-100",children:t.map(s=>{var x;return e.jsxs("tr",{className:"hover:bg-gray-50/50 transition-colors",children:[e.jsxs("td",{className:"px-4 py-3 text-sm font-medium text-title",children:["#",s.id]}),e.jsx("td",{className:"px-4 py-3 text-sm text-title",children:s.employee_name}),e.jsx("td",{className:"px-4 py-3 text-sm font-medium text-title",children:u(s.amount,s==null?void 0:s.currency)}),e.jsxs("td",{className:"px-4 py-3 text-sm text-red-600",children:["-",u(s.commission_amount,s==null?void 0:s.currency)]}),e.jsx("td",{className:"px-4 py-3 text-sm font-medium text-green-600",children:u(s.net_amount,s==null?void 0:s.currency)}),e.jsx("td",{className:"px-4 py-3 text-sm text-title capitalize",children:s.payout_method_label||((x=s.payout_method)==null?void 0:x.replace("_"," "))}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`inline-block text-xs font-medium px-2.5 py-0.5 rounded-full capitalize ${ue[s.status]}`,children:s.status})}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500",children:s.created_at}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("button",{onClick:()=>m(s),className:"p-1.5 text-gray-500 hover:text-primary hover:bg-primary/5 rounded-lg transition-colors",title:"View details",children:e.jsx(se,{className:"w-4 h-4"})})})]},s.id)})})]})}),n.last_page>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[e.jsxs("p",{className:"text-sm text-gray-500",children:["Page ",n.current_page," of ",n.last_page," (",n.total," total)"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>p(n.current_page-1,d),disabled:n.current_page<=1,className:"p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p(n.current_page+1,d),disabled:n.current_page>=n.last_page,className:"p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(q,{className:"w-4 h-4"})})]})]})]}),g&&e.jsx(pe,{payout:g,onClose:()=>m(null),onApprove:v,onComplete:c,onReject:y,isProcessing:N})]})}function je(){var r;const t=!!((r=window.radius_booking_param)!=null&&r.is_pro);return e.jsx(U,{title:"Payouts",description:"Manage employee payout requests",icon:e.jsx(G,{className:"w-5 h-5 text-primary-colordefault"}),children:t?e.jsx(M,{}):e.jsxs("div",{children:[e.jsx(V,{title:"Payouts",type:"setting"}),e.jsx("div",{className:"pointer-events-none select-none opacity-50 mt-4",children:e.jsx(M,{})})]})})}const be=i.memo(je),ye={paid:"bg-green-100 text-green-800",partial_payment:"bg-blue-100 text-blue-800"};function A(){return e.jsxs("div",{className:"bg-white border border-border rounded-xl p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx(C,{className:"w-11 h-11 rounded-xl"}),e.jsx(C,{className:"w-5 h-5 rounded"})]}),e.jsx(C,{className:"h-8 w-28 mb-2"}),e.jsx(C,{className:"h-3.5 w-36"})]})}function fe({rows:t=8}){return e.jsx("tbody",{children:Array.from({length:t}).map((r,n)=>e.jsx("tr",{className:"border-b border-gray-50",children:Array.from({length:7}).map((f,l)=>e.jsx("td",{className:"px-4 py-3.5",children:e.jsx(C,{className:`h-5 ${l===2?"w-28":"w-20"}`})},l))},n))})}function Ne(){const[t,r]=i.useState(null),[n,f]=i.useState([]),[l,b]=i.useState({current_page:1,last_page:1,total:0}),[d,w]=i.useState(null),[h,j]=i.useState(!0),g=i.useCallback(async(a=1)=>{var u,p,v,c,y;try{j(!0);const s=await me({page:a,per_page:15});s.success&&(f(s.data||[]),r(((u=s.meta)==null?void 0:u.summary)||null),b(((p=s.meta)==null?void 0:p.pagination)||{current_page:1,last_page:1,total:0}),w(((v=s.meta)==null?void 0:v.currency)||((y=(c=s.meta)==null?void 0:c.summary)==null?void 0:y.currency)||null))}catch{}finally{j(!1)}},[]);i.useEffect(()=>{g(1)},[g]);const m=a=>T(parseFloat(a||0).toFixed(2),d||(t==null?void 0:t.currency)),N=t?[{label:"Appointment Revenue",value:m(t.total_appointment_revenue),desc:"Total from all paid bookings",icon:I,iconBg:"bg-slate-100",iconColor:"text-slate-600",badge:null},{label:"Commission Income",value:m(t.total_commission_earned),desc:t.commission_rate>0?t.commission_type==="percentage"?`${t.commission_rate}% of revenue`:`${m(t.commission_rate)} per booking`:"No commission set",icon:W,iconBg:"bg-green-100",iconColor:"text-green-600",badge:e.jsx(ne,{className:"w-4 h-4 text-green-500"})},{label:"Paid to Employees",value:m(t.total_paid_to_employees),desc:"Completed payout transfers",icon:G,iconBg:"bg-blue-100",iconColor:"text-blue-600",badge:e.jsx(re,{className:"w-4 h-4 text-blue-500"})},{label:"Pending Payouts",value:m(t.total_pending_payouts),desc:"Awaiting approval or completion",icon:E,iconBg:"bg-amber-100",iconColor:"text-amber-600",badge:null}]:[];return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:t?N.map(a=>e.jsxs("div",{className:"bg-white border border-border rounded-xl p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:`w-11 h-11 rounded-xl ${a.iconBg} flex items-center justify-center`,children:e.jsx(a.icon,{className:`w-5 h-5 ${a.iconColor}`})}),a.badge]}),e.jsx("p",{className:"text-2xl font-bold text-title",children:a.value}),e.jsx("p",{className:"text-xs text-small-font mt-1",children:a.label}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:a.desc})]},a.label)):e.jsxs(e.Fragment,{children:[e.jsx(A,{}),e.jsx(A,{}),e.jsx(A,{}),e.jsx(A,{})]})}),e.jsxs("div",{className:"bg-white border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-title",children:"Appointment Commission"}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:l.total>0?`${l.total} paid bookings`:"Commission per appointment"})]}),e.jsx("button",{onClick:()=>g(l.current_page),className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-colors",children:e.jsx(H,{className:`w-4 h-4 ${h?"animate-spin":""}`})})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 border-b border-border",children:[e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Date"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Service"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Employee"}),e.jsx("th",{className:"text-right px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Booking Amount"}),e.jsx("th",{className:"text-right px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Commission"}),e.jsx("th",{className:"text-right px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Employee Gets"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase",children:"Payment"})]})}),h?e.jsx(fe,{}):n.length===0?e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-12 text-center text-sm text-gray-500",children:"No paid appointments found"})})}):e.jsx("tbody",{className:"divide-y divide-gray-100",children:n.map(a=>{var u;return e.jsxs("tr",{className:"hover:bg-gray-50/50 transition-colors",children:[e.jsxs("td",{className:"px-4 py-3 text-sm text-title whitespace-nowrap",children:[e.jsx("div",{children:a.appointment_date}),e.jsxs("div",{className:"text-[11px] text-small-font",children:[a.start_time," - ",a.end_time]})]}),e.jsx("td",{className:"px-4 py-3 text-sm text-title",children:a.service_name}),e.jsx("td",{className:"px-4 py-3 text-sm text-title",children:a.employee_name}),e.jsx("td",{className:"px-4 py-3 text-sm font-medium text-title text-right",children:m(a.paid_amount)}),e.jsxs("td",{className:"px-4 py-3 text-sm font-semibold text-green-600 text-right",children:["+",m(a.commission)]}),e.jsx("td",{className:"px-4 py-3 text-sm text-small-font text-right",children:m(a.employee_earning)}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`inline-block text-xs font-medium px-2 py-0.5 rounded-full capitalize ${ye[a.payment_status]||"bg-gray-100 text-gray-700"}`,children:(u=a.payment_status)==null?void 0:u.replace("_"," ")})})]},a.appointment_id)})})]})}),l.last_page>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[e.jsxs("p",{className:"text-sm text-gray-500",children:["Page ",l.current_page," of ",l.last_page," (",l.total," total)"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>g(l.current_page-1),disabled:l.current_page<=1,className:"p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>g(l.current_page+1),disabled:l.current_page>=l.last_page,className:"p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(q,{className:"w-4 h-4"})})]})]})]})]})}function ve(){var r;const t=!!((r=window.radius_booking_param)!=null&&r.is_pro);return e.jsx(U,{title:"Admin Income",description:"Commission income from appointments",icon:e.jsx(W,{className:"w-5 h-5 text-primary-colordefault"}),children:t?e.jsx(Ne,{}):e.jsx(V,{title:"Admin Income",type:"setting"})})}const _e=i.memo(ve);function Ke(){return e.jsxs(te,{children:[e.jsx(D,{path:"/",element:e.jsx(be,{})}),e.jsx(D,{path:"income",element:e.jsx(_e,{})})]})}export{Ke as default};
//# sourceMappingURL=index-CjG9-D96.js.map
