Files
boc/web/_next/static/chunks/1i7qiq_hrx76n.js
T

1 line
7.8 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,143,e=>{"use strict";async function s(e,t={}){let a=localStorage.getItem("amos_token"),l=await fetch(`/api/v1${e}`,{...t,headers:{"Content-Type":"application/json",...a?{Authorization:`Bearer ${a}`}:{},...t.headers}});if(!l.ok)throw Error((await l.json().catch(()=>({}))).error||`HTTP ${l.status}`);return l.json()}e.s(["api",0,{auth:{login:(e,t)=>s("/auth/login",{method:"POST",body:JSON.stringify({email:e,password:t})}),me:()=>s("/auth/me")},crm:{customers:()=>s("/crm/customers")},sales:{deals:()=>s("/sales/deals")},finance:{balance:()=>s("/finance/balance"),accounts:()=>s("/finance/accounts")},hr:{employees:()=>s("/hr/employees")},legal:{contracts:()=>s("/legal/contracts")}}])},93370,e=>{"use strict";var s=e.i(1624),t=e.i(30573);e.s(["Skeleton",0,function({className:e,...a}){return(0,s.jsx)("div",{"data-slot":"skeleton",className:(0,t.cn)("animate-pulse rounded-md bg-muted",e),...a})}])},15070,e=>{"use strict";let s=(0,e.i(64828).default)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);e.s(["Mail",0,s],15070)},96302,e=>{"use strict";var s=e.i(1624),t=e.i(62714),a=e.i(34772),l=e.i(143),r=e.i(43673),c=e.i(1791),i=e.i(80063),d=e.i(93370),n=e.i(76730),x=e.i(71672),o=e.i(53743),m=e.i(6726),h=e.i(15070);let p=(0,e.i(64828).default)("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);var u=e.i(91054);e.s(["default",0,function(){let[e,j]=(0,t.useState)([]),[b,N]=(0,t.useState)(!0),[g,f]=(0,t.useState)(""),[v,w]=(0,t.useState)("");(0,t.useEffect)(()=>{l.api.crm.customers().then(e=>{j(e.customers),N(!1)}).catch(e=>{f(e.message),N(!1)})},[]);let y=e.filter(e=>e.name.toLowerCase().includes(v.toLowerCase())||e.email.toLowerCase().includes(v.toLowerCase())),E=e.reduce((e,s)=>e+s.revenue,0),B=e.filter(e=>"active"===e.status).length,C={active:"bg-emerald-50 text-emerald-700 border-emerald-200",prospect:"bg-blue-50 text-blue-700 border-blue-200",inactive:"bg-slate-50 text-slate-600 border-slate-200"};return(0,s.jsx)(a.DashboardShell,{children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-bold text-[#111827]",children:"CRM"}),(0,s.jsx)("p",{className:"text-sm text-[#6B7280] mt-0.5",children:"Customer Relationship Management"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,s.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl bg-blue-50 flex items-center justify-center",children:(0,s.jsx)(x.Users,{className:"w-5 h-5 text-blue-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Total Customers"}),(0,s.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:e.length})]})]})}),(0,s.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl bg-emerald-50 flex items-center justify-center",children:(0,s.jsx)(o.TrendingUp,{className:"w-5 h-5 text-emerald-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Total Revenue"}),(0,s.jsxs)("p",{className:"text-xl font-bold text-[#111827]",children:["SEK ",(E/1e6).toFixed(1),"M"]})]})]})}),(0,s.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl bg-violet-50 flex items-center justify-center",children:(0,s.jsx)(m.Building2,{className:"w-5 h-5 text-violet-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Active"}),(0,s.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:B})]})]})})]}),(0,s.jsxs)("div",{className:"relative max-w-md",children:[(0,s.jsx)(n.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[#6B7280]"}),(0,s.jsx)(c.Input,{placeholder:"Search customers...",value:v,onChange:e=>w(e.target.value),className:"pl-10 h-10 rounded-xl bg-white border-[#E5E7EB]"})]}),(0,s.jsx)(r.Card,{className:"bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)] overflow-hidden",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-[#E5E7EB]",children:[(0,s.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Customer"}),(0,s.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Contact"}),(0,s.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Status"}),(0,s.jsx)("th",{className:"text-right text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Revenue"}),(0,s.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Last Contact"})]})}),(0,s.jsx)("tbody",{children:b?Array.from({length:5}).map((e,t)=>(0,s.jsxs)("tr",{className:"border-b border-[#E5E7EB]/50",children:[(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(d.Skeleton,{className:"h-4 w-32"})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(d.Skeleton,{className:"h-4 w-40"})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(d.Skeleton,{className:"h-5 w-16"})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(d.Skeleton,{className:"h-4 w-20 ml-auto"})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(d.Skeleton,{className:"h-4 w-24"})})]},t)):g?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:5,className:"px-5 py-8 text-center text-sm text-[#DC2626]",children:g})}):y.map((e,t)=>(0,s.jsxs)(u.motion.tr,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,delay:.03*t},className:"border-b border-[#E5E7EB]/50 hover:bg-[#F7F9FC] transition-colors",children:[(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-9 h-9 rounded-xl bg-[#1E3A5F] flex items-center justify-center text-white text-xs font-bold",children:e.name.split(" ").map(e=>e[0]).join("").slice(0,2)}),(0,s.jsx)("span",{className:"text-sm font-medium text-[#111827]",children:e.name})]})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-[#6B7280]",children:[(0,s.jsx)(h.Mail,{className:"w-3 h-3"}),e.email]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-[#9CA3AF]",children:[(0,s.jsx)(p,{className:"w-3 h-3"}),e.phone]})]})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)(i.Badge,{variant:"outline",className:`${C[e.status]} text-[10px] font-semibold uppercase rounded-full`,children:e.status})}),(0,s.jsx)("td",{className:"px-5 py-4 text-right",children:(0,s.jsx)("span",{className:"text-sm font-medium text-[#111827]",children:e.revenue>0?`SEK ${(e.revenue/1e3).toFixed(0)}K`:"—"})}),(0,s.jsx)("td",{className:"px-5 py-4",children:(0,s.jsx)("span",{className:"text-xs text-[#6B7280]",children:e.lastContact})})]},e.id))})]})})})]})})}],96302)}]);