import{An as e,C as t,E as n,Nn as r,Qt as i,_n as a,an as o,bn as s,en as c,jn as l,nn as u,on as d,q as f,rn as p,tn as m,vn as h,wn as g}from"./app-4kCgdoJR.js";import{t as _}from"./AdminLayout-DEe0k-dp.js";var v={class:`flex items-center justify-center gap-4`},y={class:`relative flex grow flex-col items-stretch justify-stretch self-stretch bg-white px-4 sm:px-6 lg:px-8 dark:bg-gray-800`},b={class:`flow-root grow`},x={class:`-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8`},S={class:`my-2 inline-block min-w-full border-b border-gray-200 align-middle dark:border-gray-700`},C={class:`min-w-full divide-y divide-gray-200 dark:divide-gray-700`},w={scope:`col`,class:`text-focus py-3.5 ps-6 pe-3 text-start text-sm font-semibold`},T={scope:`col`,class:`text-focus px-3 py-3.5 text-start text-sm font-semibold`},E={scope:`col`,class:`text-focus px-3 py-3.5 text-end text-sm font-semibold whitespace-nowrap`},D={scope:`col`,class:`text-focus px-3 py-3.5 text-end text-sm font-semibold whitespace-nowrap`},O={scope:`col`,class:`text-focus py-3.5 ps-3 pe-6 text-end text-sm font-semibold whitespace-nowrap`},k={class:`divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900`},A={class:`py-4 ps-6 pe-3 text-sm whitespace-nowrap`},j={class:`px-3 py-4 text-sm whitespace-nowrap`},M=[`innerHTML`],N={class:`px-3 py-4 text-end text-sm whitespace-nowrap text-red-600 dark:text-red-400`},P={class:`px-3 py-4 text-end text-sm whitespace-nowrap text-green-600 dark:text-green-400`},F={key:1},I={colspan:`100%`},L={class:`text-mute py-3.5 ps-4 pe-3 text-sm font-light whitespace-nowrap sm:ps-2 lg:ps-4`},R={class:`-mx-4 sm:-mx-6 lg:-mx-8`},z=Object.assign({layout:_},{__name:`Statement`,props:[`pagination`,`customer`],setup(_){let{filters:z,searching:B,sortBy:V}=f();return(f,H)=>{let U=s(`Head`),W=s(`Link`),G=s(`Header`),K=s(`Icon`);return a(),p(i,null,[d(U,null,{default:g(()=>[c(`title`,null,r(f.$t(`Customer Statement`)),1)]),_:1}),d(G,null,{subheading:g(()=>[o(r(f.$t(`Please review the data below`)),1)]),menu:g(()=>[c(`div`,v,[d(W,{class:`btn-primary`,href:f.route(`customers.index`)},{default:g(()=>[o(r(f.$t(`List {x}`,{x:f.$t(`Customers`)})),1)]),_:1},8,[`href`])])]),default:g(()=>[o(r(f.$t(`Customer Statement`))+` (`+r(_.customer.company||_.customer.name)+`) `,1),_.customer.balance<0?(a(),p(i,{key:0},[o(`(`+r(f.$t(`Adv`))+`: `+r(f.$currency(0-_.customer.balance))+`)`,1)],64)):(a(),p(i,{key:1},[o(`(`+r(f.$t(`Due`))+`: `+r(f.$currency(_.customer.balance))+`)`,1)],64))]),_:1}),c(`div`,y,[e(B)?(a(),m(e(n),{key:0,"circle-size":`w-10 h-10`})):u(``,!0),c(`div`,b,[c(`div`,x,[c(`div`,S,[c(`table`,C,[c(`thead`,null,[c(`tr`,null,[c(`th`,w,[c(`button`,{type:`button`,class:`flex items-center gap-2 whitespace-nowrap`,onClick:H[0]||=t=>e(V)(e(z)?.sort==`created_at:asc`?`created_at:desc`:`created_at:asc`)},[o(r(f.$t(`Created at`))+` `,1),e(z)?.sort?.startsWith(`created_at:`)?(a(),m(K,{key:0,size:`size-3 text-mute`,name:e(z).sort==`created_at:desc`?`c-up`:`c-down`},null,8,[`name`])):u(``,!0)])]),c(`th`,T,[c(`button`,{type:`button`,class:`flex items-center gap-2 whitespace-nowrap`,onClick:H[1]||=t=>e(V)(e(z)?.sort==`description:asc`?`description:desc`:`description:asc`)},[o(r(f.$t(`Description`))+` `,1),e(z)?.sort?.startsWith(`description:`)?(a(),m(K,{key:0,size:`size-3 text-mute`,name:e(z).sort==`description:desc`?`c-up`:`c-down`},null,8,[`name`])):u(``,!0)])]),c(`th`,E,r(f.$t(`Debit`)),1),c(`th`,D,r(f.$t(`Credit`)),1),c(`th`,O,r(f.$t(`Balance`)),1)])]),c(`tbody`,k,[_.pagination&&_.pagination.data&&_.pagination.data.length?(a(!0),p(i,{key:0},h(_.pagination.data,e=>(a(),p(`tr`,{key:e.id,class:l(e.deleted_at?`bg-red-100 dark:bg-red-950`:``)},[c(`td`,A,r(f.$datetime(e.created_at)),1),c(`td`,j,[c(`div`,{class:`-my-2 line-clamp-2 min-w-64`,innerHTML:e.description||``},null,8,M)]),c(`td`,N,r(e.value<0?f.$currency(Math.abs(e.value)):`-`),1),c(`td`,P,r(e.value>0?f.$currency(e.value):`-`),1),c(`td`,{class:l([`py-4 ps-3 pe-6 text-end text-sm font-semibold whitespace-nowrap`,e.balance<0?`text-red-600 dark:text-red-400`:`text-green-600 dark:text-green-400`])},r(f.$currency(e.balance)),3)],2))),128)):(a(),p(`tr`,F,[c(`td`,I,[c(`div`,L,r(f.$t(`There is no data to display!`)),1)])]))])])])])]),c(`div`,R,[d(e(t),{class:`mx-4 mt-auto py-2 text-sm sm:mx-6`,meta:_.pagination.meta,links:_.pagination.links},null,8,[`meta`,`links`])])])],64)}}});export{z as default};