import{j as e,H as o,L as c}from"./app-CAqQVdqj.js";import{A as n}from"./AuthenticatedLayout-CQEcc2iz.js";import{f as l,a as x}from"./utils-f31lc4sE.js";const a=({icon:s,label:d,value:i,color:t="blue"})=>{const r={blue:"bg-blue-50 text-blue-600 border-blue-200",green:"bg-green-50 text-green-600 border-green-200",red:"bg-red-50 text-red-600 border-red-200",yellow:"bg-yellow-50 text-yellow-600 border-yellow-200",gray:"bg-gray-50 text-gray-600 border-gray-200",indigo:"bg-indigo-50 text-indigo-600 border-indigo-200",purple:"bg-purple-50 text-purple-600 border-purple-200",orange:"bg-orange-50 text-orange-600 border-orange-200"};return e.jsx("div",{className:`rounded-lg border p-5 ${r[t]}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium opacity-75",children:d}),e.jsx("p",{className:"mt-1 text-2xl font-bold",children:i})]}),e.jsx("div",{className:"text-3xl opacity-50",children:s})]})})};function h({stats:s,recentPayments:d=[],shops:i=[]}){return e.jsxs(n,{header:e.jsx("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:"Dashboard"}),children:[e.jsx(o,{title:"Dashboard"}),e.jsx("div",{className:"py-6",children:e.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(a,{icon:"🏪",label:"Total Shops",value:s.totalShops,color:"blue"}),e.jsx(a,{icon:"✅",label:"Occupied",value:s.occupiedShops,color:"green"}),e.jsx(a,{icon:"🔑",label:"Vacant",value:s.vacantShops,color:"gray"}),e.jsx(a,{icon:"👤",label:"Owners",value:s.totalOwners,color:"indigo"}),e.jsx(a,{icon:"📊",label:"Monthly Expected",value:l(s.monthlyExpected),color:"blue"}),e.jsx(a,{icon:"💰",label:"Collected",value:l(s.monthlyCollected),color:"green"}),e.jsx(a,{icon:"⏳",label:"Pending",value:l(s.pendingAmount),color:"yellow"}),e.jsx(a,{icon:"⚠️",label:"Overdue Invoices",value:s.overdueInvoices,color:"red"})]}),s.securityDepositDues>0&&e.jsxs("div",{className:"mt-4 rounded-lg border border-orange-200 bg-orange-50 p-4 text-orange-700",children:[e.jsx("span",{className:"font-semibold",children:"Security Deposit Dues:"})," ",l(s.securityDepositDues)]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"mb-4 text-lg font-semibold text-gray-800",children:"Shops Overview"}),e.jsx("div",{className:"grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8",children:i.map(t=>{const r=!!t.active_lease;return e.jsxs(c,{href:route("shops.show",t.id),className:`rounded-lg border p-3 text-center transition hover:shadow-md ${r?"border-green-300 bg-green-50 text-green-800":"border-gray-300 bg-gray-50 text-gray-500"}`,children:[e.jsx("div",{className:"text-sm font-bold",children:t.shop_number}),r&&t.active_lease?.tenant&&e.jsx("div",{className:"mt-1 truncate text-xs",children:t.active_lease.tenant.name}),!r&&e.jsx("div",{className:"mt-1 text-xs italic",children:"Vacant"}),t.owner&&e.jsx("div",{className:"mt-1 truncate text-xs opacity-60",children:t.owner.name})]},t.id)})})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"mb-4 text-lg font-semibold text-gray-800",children:"Recent Payments"}),e.jsx("div",{className:"overflow-hidden rounded-lg bg-white shadow",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-gray-500",children:"Date"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-gray-500",children:"Tenant"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-gray-500",children:"Shop"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-gray-500",children:"Amount"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-gray-500",children:"Method"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-200",children:[d.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:"5",className:"px-4 py-6 text-center text-gray-400",children:"No recent payments"})}),d.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-sm text-gray-700",children:x(t.payment_date)}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-sm text-gray-700",children:t.invoice?.lease?.tenant?.name||"-"}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-sm text-gray-700",children:t.invoice?.lease?.shop?.shop_number||"-"}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-sm font-medium text-gray-900",children:l(t.amount)}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-sm text-gray-700 capitalize",children:t.payment_method||"-"})]},t.id))]})]})})})]})]})})]})}export{h as default};
