import{o as u,r as x,j as t,v as j,M as N,I as f}from"./index-7c7a558c.js";function w({transactions:l}){const[h,{open:n,close:i}]=u(!1),[c,b]=x.useState(25),[r,g]=x.useState([]),m=25,y=3;let d=null;return l.length===0&&(d=t.jsx("tr",{className:"border-b bg-gray-800 border-gray-700 hover:bg-gray-600 hover:text-white",children:t.jsx("td",{colSpan:y,className:"text-center text-white py-6",children:"No Transactions Found!"})})),l.length>0&&(d=l.map((e,a)=>t.jsxs("tr",{className:"bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600",children:[t.jsx("td",{"data-label":"",className:"w-4 p-4 text-black dark:text-white",children:a+1}),t.jsx("td",{"data-label":"Type",className:"px-6 py-4",children:(e==null?void 0:e.type)==1?"Credit":"Debit"}),t.jsx("td",{"data-label":"Credit",className:"px-6 py-4",children:(e==null?void 0:e.type)==1?e==null?void 0:e.amount:""}),t.jsx("td",{"data-label":"Debit",className:"px-6 py-4",children:(e==null?void 0:e.type)==2?e==null?void 0:e.amount:""}),t.jsxs("td",{"data-label":"Amount",className:"px-6 py-4",children:[(e==null?void 0:e.type)==1?"+":"-",e==null?void 0:e.amount]}),t.jsx("td",{"data-label":"Note",className:"px-6 py-4",children:e==null?void 0:e.narration}),t.jsx("td",{"data-label":"Date",className:"px-6 py-4",children:j(e==null?void 0:e.created_at)})]},a))),x.useEffect(()=>{const e=(l==null?void 0:l.length)!=0?l==null?void 0:l.slice(0,c):[];g(e)},[c,l]),t.jsxs(t.Fragment,{children:[t.jsx(N,{opened:h,onClose:i,title:"Passbook",centered:!0,size:"100%",classNames:{content:"bg-gray-900 text-white",header:"bg-gray-900 text-white"},children:t.jsx("div",{className:"my-6",children:t.jsx("div",{children:h&&t.jsx(f,{dataLength:r!=null&&r.length?r==null?void 0:r.length:0,next:()=>{b(e=>e+m)},hasMore:(r==null?void 0:r.length)==c,children:t.jsxs("table",{className:"w-full text-sm text-left text-gray-500 dark:text-gray-400",children:[t.jsx("thead",{className:"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:t.jsxs("tr",{children:[t.jsx("th",{scope:"col",className:"p-4",children:"SL"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Type"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Credit"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Debit"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Amount"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Note"}),t.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date"})]})}),t.jsx("tbody",{children:d})]})})})})}),t.jsx("button",{onClick:n,className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",children:"Get PassBook"})]})}export{w as T};
