"use strict";(self.webpackChunkdoublescale=self.webpackChunkdoublescale||[]).push([[441],{9441:(e,t,a)=>{a.r(t),a.d(t,{default:()=>_});var l=a(1609),r=a(7723),s=a(4976),c=a(7767),n=a(4975),m=a(1554),d=a(2957),o=a(2465);const u=({project:e})=>(0,l.createElement)(s.N_,{to:String(e.id),className:"block rounded-xl border border-border bg-card p-4 shadow-sm transition-colors hover:border-primary"},(0,l.createElement)("div",{className:"flex items-start justify-between gap-3"},(0,l.createElement)("p",{className:"font-semibold text-foreground"},e.title),e.status&&(0,l.createElement)(o.Wh,{status:e.status.name})),e.due_date&&(0,l.createElement)("div",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground"},(0,l.createElement)(d.O4,{className:"w-4 h-4 shrink-0"}),(0,l.createElement)("span",null,(0,r.__)("Due","doublescale")," ",(0,m.Yq)(e.due_date))),null!=e.budget&&(0,l.createElement)("p",{className:"mt-1 text-sm text-muted-foreground"},(0,r.__)("Budget","doublescale"),":"," ",(0,m.up)(e.budget,e.currency))),i=()=>{const{data:e,loading:t,error:a}=(0,n.Yb)((()=>(0,n.vj)()),[]),s=e?.data||[];return(0,l.createElement)("section",null,(0,l.createElement)("h2",{className:"mb-4 text-xl font-bold"},(0,r.__)("Projects","doublescale")),t&&(0,l.createElement)(o.y$,null),!t&&a&&(0,l.createElement)(o.W5,{message:a}),!t&&!a&&0===s.length&&(0,l.createElement)(o.pp,{title:(0,r.__)("No projects yet","doublescale"),description:(0,r.__)("When we start a project with you it will show up here.","doublescale")}),!t&&!a&&s.length>0&&(0,l.createElement)("div",{className:"space-y-3"},s.map((e=>(0,l.createElement)(u,{key:e.id,project:e})))))},b=({label:e,children:t})=>(0,l.createElement)("div",{className:"flex items-start justify-between gap-3 text-sm"},(0,l.createElement)("span",{className:"text-muted-foreground"},e),(0,l.createElement)("span",{className:"text-right font-medium text-foreground"},t)),p=({onClick:e})=>(0,l.createElement)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm font-medium text-muted-foreground hover:text-foreground"},(0,l.createElement)(d.YJ,{className:"w-4 h-4"}),(0,r.__)("Back to projects","doublescale")),E=()=>{const e=(0,c.g)(),t=(0,c.Zp)(),a=Number.parseInt(e.id||"0",10),{data:s,loading:d,error:u}=(0,n.Yb)((()=>(0,n.Sw)(a)),[a]);if(d)return(0,l.createElement)(o.y$,null);if(u||!s)return(0,l.createElement)("div",{className:"space-y-4"},(0,l.createElement)(p,{onClick:()=>t("/projects")}),(0,l.createElement)(o.W5,{message:u||(0,r.__)("Project not found.","doublescale")}));const i=s.financials;return(0,l.createElement)("section",{className:"space-y-4"},(0,l.createElement)(p,{onClick:()=>t("/projects")}),(0,l.createElement)("div",{className:"rounded-xl border border-border bg-card p-5 shadow-sm"},(0,l.createElement)("div",{className:"flex items-start justify-between gap-3"},(0,l.createElement)("h2",{className:"text-xl font-bold"},s.title),s.status&&(0,l.createElement)(o.Wh,{status:s.status.name})),s.description&&(0,l.createElement)("p",{className:"mt-3 text-sm text-muted-foreground"},s.description),(0,l.createElement)("div",{className:"mt-4 space-y-2"},null!=s.budget&&(0,l.createElement)(b,{label:(0,r.__)("Budget","doublescale")},(0,m.up)(s.budget,s.currency)),s.start_date&&(0,l.createElement)(b,{label:(0,r.__)("Start date","doublescale")},(0,m.Yq)(s.start_date)),s.due_date&&(0,l.createElement)(b,{label:(0,r.__)("Due date","doublescale")},(0,m.Yq)(s.due_date)))),i&&(i.total>0||i.paid>0||i.due>0)&&(0,l.createElement)("div",{className:"rounded-xl border border-border bg-card p-5 shadow-sm"},(0,l.createElement)("h3",{className:"mb-3 text-sm font-semibold text-foreground"},(0,r.__)("Invoices","doublescale")),(0,l.createElement)("div",{className:"space-y-2"},(0,l.createElement)(b,{label:(0,r.__)("Total","doublescale")},(0,m.up)(i.total,s.currency)),(0,l.createElement)(b,{label:(0,r.__)("Paid","doublescale")},(0,m.up)(i.paid,s.currency)),(0,l.createElement)(b,{label:(0,r.__)("Due","doublescale")},(0,m.up)(i.due,s.currency)))))},_=()=>(0,l.createElement)(c.BV,null,(0,l.createElement)(c.qh,{index:!0,element:(0,l.createElement)(i,null)}),(0,l.createElement)(c.qh,{path:":id",element:(0,l.createElement)(E,null)}),(0,l.createElement)(c.qh,{path:"*",element:(0,l.createElement)(c.C5,{to:"",replace:!0})}))}}]);