PageSourceSearch

https://splitrent.org/assets/TrackApplicationPage-C9qVTY-h.js

js splitrent.org collected 2026-10-06 12:38:03 UTC 17,716 bytes, 1 lines download raw bytes

1import{a as N,j as e,ac as te,X as P,H as z,R as de,ad as B,G as O,W as F,a6 as re,L as V,ae as ne,Y as le,b as oe,r as j,x as ie,af as ce,aa as U}from"./index-B0OyW6Z1.js";import{b as xe,a as me,i as he,c as pe,s as W,f as be,n as ue,H as ye}from"./applicationStatus-7XE7Z7du.js";import{t as k,d as fe,f as T,a as G,s as q,V as X,v as J}from"./VerificationPill-BMorS3Ft.js";import{i as Q}from"./kycSubmission-CYkW3Y4J.js";import{u as ge,T as je}from"./TernConsentModal-BDbpkbsy.js";import{D as C}from"./DashboardLayout-BoEZucXy.js";import{S as A,A as Ne,d as ve}from"./native-hdIwuQAf.js";import"./useStartFlow-B1cZTc5M.js";import"./useIsPhone-C2aX4iL2.js";import"./passkeyDevice-1Dz9AZk5.js";import"./kycDocuments-BbjVRKzC.js";const I={complete:"bg-emerald-500",current:"bg-brand-600",attention:"bg-amber-500",failed:"bg-red-500",upcoming:"bg-gray-300"},Z=({stage:s,agreement:a=null,documentsSent:n=!0})=>{const{t:d}=N(),x=xe(s,a,{documentsSent:n});return e.jsx("ol",{className:"overflow-hidden rounded-xl bg-white ps-4 divide-y divide-gray-100 md:border md:border-gray-100",children:x.map(t=>{const r=me[t.state],i=t.state==="upcoming";return e.jsxs("li",{className:"flex items-start gap-3 py-3 pe-4",children:[e.jsx("span",{className:`mt-[7px] h-2 w-2 shrink-0 rounded-full ${I[t.state]||I.upcoming}`,"aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:`block text-[17px] ${i?"text-gray-400":"text-brand-900"}`,children:d(t.labelKey)}),e.jsx("span",{className:`mt-0.5 block text-[15px] leading-snug ${i?"text-gray-400":r.body}`,children:d(t.descriptionKey)})]}),t.state==="current"&&e.jsx("span",{className:"shrink-0 pt-0.5 text-[13px] text-brand-600",children:d("dashboard.status.inProgress")}),t.state==="complete"&&e.jsx("svg",{className:"mt-1 h-4 w-4 shrink-0 text-emerald-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},t.key)})})},L=({label:s,value:a,accent:n})=>e.jsxs("div",{className:`flex ${de} items-center justify-between gap-4 py-3 pe-4`,children:[e.jsx("p",{className:"text-[17px] text-brand-900",children:s}),e.jsx("p",{className:`text-[17px] ${n?"font-semibold text-brand-600":"text-gray-500"}`,children:a})]}),we={awaiting:{title:"dashboard.card.awaiting.title",body:"dashboard.card.awaiting.body",secondary:"dashboard.card.stop",confirmTitle:"dashboard.card.stopConfirmTitle",confirmBody:"dashboard.card.awaiting.confirmBody",confirmYes:"dashboard.card.stopYes",confirmBusy:"dashboard.card.stopping",confirmNo:"dashboard.card.awaiting.keep",ariaLabel:"dashboard.card.stop",failureCopy:"dashboard.card.stopFailed"},failing:{title:"dashboard.card.failing.title",body:"dashboard.card.failing.body",secondary:"dashboard.card.stop",confirmTitle:"dashboard.card.stopConfirmTitle",confirmBody:"dashboard.card.stopConfirmBody",confirmYes:"dashboard.card.stopYes",confirmBusy:"dashboard.card.stopping",confirmNo:"dashboard.card.keepPaying",ariaLabel:"dashboard.card.stop",failureCopy:"dashboard.card.stopFailed"},settled:{title:"dashboard.card.settled.title",body:"dashboard.card.settled.body",secondary:"dashboard.card.remove",confirmTitle:"dashboard.card.removeConfirmTitle",confirmBody:"dashboard.card.removeConfirmBody",confirmYes:"dashboard.card.removeYes",confirmBusy:"dashboard.card.removing",confirmNo:"dashboard.card.keepCard",ariaLabel:"dashboard.card.remove",failureCopy:"dashboard.card.removeFailed"},paying:{title:"dashboard.card.paying.title",body:"dashboard.card.paying.body",secondary:"dashboard.card.stop",confirmTitle:"dashboard.card.stopConfirmTitle",confirmBody:"dashboard.card.stopConfirmBody",confirmYes:"dashboard.card.stopYes",confirmBusy:"dashboard.card.stopping",confirmNo:"dashboard.card.keepPaying",ariaLabel:"dashboard.card.stop",failureCopy:"dashboard.card.stopFailed"}},ke=({awaiting:s,failing:a,planComplete:n})=>s?"awaiting":a?"failing":n?"settled":"paying",Te=({card:s,points:a=0,planComplete:n=!1,failing:d=!1,onSetupCard:x,onCancelCard:t})=>{const{t:r}
1=N(),[i,p]=B.useState(!1),[f,h]=B.useState(!1),[y,b]=B.useState(null),g=!!s.awaiting_card,c=we[ke({awaiting:g,failing:d,planComplete:n})],o=g?r("dashboard.card.resume"):d?r("dashboard.card.update"):null,u=!!o&&typeof x=="function",S=async()=>{h(!0),b(null);try{await t(s.connection_id)}catch(v){b((v==null?void 0:v.message)||r(c.failureCopy)),h(!1)}};return i?e.jsxs("div",{className:"rounded-xl bg-amber-50 px-4 py-4",role:"alertdialog","aria-label":r(c.ariaLabel),children:[e.jsx("p",{className:"text-[17px] font-medium text-amber-900",children:r(c.confirmTitle)}),e.jsx("p",{className:"text-[15px] text-amber-800 mt-1",children:r(c.confirmBody)}),y&&e.jsx("p",{className:"text-sm font-semibold text-red-700 mt-2",children:y}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[e.jsx("button",{type:"button",onClick:S,disabled:f,className:O(),children:r(f?c.confirmBusy:c.confirmYes)}),e.jsx("button",{type:"button",onClick:()=>p(!1),disabled:f,className:z(),children:r(c.confirmNo)})]})]}):e.jsxs("div",{className:"rounded-xl bg-white px-4 py-4 md:border md:border-gray-100",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-[12rem]",children:[e.jsx("p",{className:"text-[17px] font-medium text-brand-900",children:r(c.title)}),e.jsx("p",{className:"text-[15px] text-gray-500 mt-0.5",children:r(c.body)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u&&e.jsx("button",{type:"button",onClick:x,className:d?O("whitespace-nowrap"):P("whitespace-nowrap"),children:o}),e.jsx("button",{type:"button",onClick:()=>p(!0),className:`${F} text-[15px] text-gray-500 underline underline-offset-4 whitespace-nowrap`,children:r(c.secondary)})]})]}),a>0&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-lg bg-amber-50 px-3 py-2",children:[e.jsx("span",{className:"text-base leading-none","aria-hidden":"true",children:"★"}),e.jsx("span",{className:"text-[17px] font-medium text-amber-900",children:r("dashboard.card.points",{points:re(a)})}),e.jsx("span",{className:"text-[13px] text-amber-700",children:r("dashboard.card.balance")})]})]})},H={preparing:{title:"dashboard.agreement.preparing.title",body:"dashboard.agreement.preparing.body"},sent:{title:"dashboard.agreement.sent.title",body:"dashboard.agreement.sent.body",primary:"dashboard.step.signAgreement.action"},tenant_signed:{title:"dashboard.agreement.tenantSigned.title",body:"dashboard.agreement.tenantSigned.body"},completed:{title:"dashboard.agreement.completed.title",body:"dashboard.agreement.completed.body",download:"dashboard.agreement.completed.download"},declined:{title:"dashboard.agreement.declined.title",body:"dashboard.agreement.declined.body"},expired:{title:"dashboard.agreement.expired.title",body:"dashboard.agreement.expired.body"},failed:{title:"dashboard.agreement.failed.title",body:"dashboard.agreement.failed.body"}},Ce=({leadId:s,agreement:a})=>{const{t:n}=N(),{sign:d,download:x,busy:t,error:r}=ge(s),i=H[a==null?void 0:a.status]||H.preparing,p=!!(a!=null&&a.can_sign)&&(a==null?void 0:a.status)==="sent",f=(a==null?void 0:a.status)==="completed"&&!!(a!=null&&a.pdf_ready),h=(a==null?void 0:a.status)==="completed"?"bg-emerald-50":"bg-white md:border md:border-gray-100";return e.jsxs("div",{className:`rounded-xl px-4 py-4 ${h}`,"data-testid":"agreement-panel",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-[12rem]",children:[e.jsx("p",{className:"text-[17px] font-medium text-brand-900",children:n(i.title)}),e.jsx("p",{className:"text-[15px] text-gray-500 mt-0.5",children:n(i.body)})]}),p&&e.jsx("button",{type:"button",onClick:d,disabled:t,className:P("whitespace-nowrap"),children:n(t?"dashboard.agreement.opening":i.primary)}),f&&e.jsx("button",{type:"button",onClick:x,disabled:t,className:z("whitespace-nowrap"),children:n(i.download)})]}),r&&e.jsx("p",{className:"text-sm font-semibold text-red-700 mt-2",role:"alert",children:r})]})},ee=({application:s,stage:a,onSetupCard:n,onCancelCard:d,ternEnabled:x=!1})=>{var $;const{t}=N(),r=a==="declined",i=k(s.annual_rent),p=s.ledger_monthly_payment!==void 0&&s.ledger_monthly_payment!==null,f=p?k(s.ledger_monthly_payment):null,h=l=>l!==null&&l>0?l:null,y=h(k(s.monthly_payment)),b=p?f:y??(i!==null&&i>0?h(te(s.annual_rent,s.security_deposit,Number(s.number_of_cheques)||0)):null),c=h(k(s.total_payable))??(b!==null&&b>0?b*12:null),o=fe(s),u=Array.isArray(s.schedule)?s.schedule:[],S=["scheduled","failed","partially_paid"],v=s.next_due_date||(($=u.find(l=>S.includes(l.status)))==null?void 0:$.due_date)||null,w=u.filter(l=>l.status==="failed"),_=s.plan_status==="completed",D=x&&p&&typeof n=="function"&&!_&&!r,m=s.card??null,ae=m&&m.can_stop!==!1&&typeof d=="function",R=!!(m!=null&&m.card_on_file),se=!!(m!=null&&m.awaiting_card),Y=R&&w.length>0;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"px-4",children:[e.jsx("h2",{className:"text-[13px] uppercase text-gray-500",children:t("dashboard.plan.title")}),e.jsx("p",{className:"mt-1 text-[13px] text-gray-500",children:t(r?"dashboard.plan.subDeclined":"dashboard.plan.sub")})]}),!r&&(s.agreement||he(a))&&e.jsx(Ce,{leadId:s.id,agreement:s.agreement??null}),_&&e.jsxs("div",{className:"rounded-xl bg-emerald-50 px-4 py-4",children:[e.jsx("p",{className:"text-[17px] font-medium text-emerald-900",children:t("dashboard.step.planComplete.title")}),e.jsx("p",{className:"text-[15px] text-emerald-800 mt-1",children:t("dashboard.plan.paidInFullBody")})]}),w.length>0&&e.jsxs("div",{className:"rounded-xl bg-red-50 px-4 py-4",role:"alert",children:[e.jsx("p",{className:"text-[17px] font-medium text-red-800",children:t("dashboard.plan.failed",{count:w.length})}),e.jsx("p",{className:"text-[15px] text-red-700 mt-1",children:t(R?"dashboard.plan.failedWithCard":"dashboard.step.paymentFailed.bodyNoCard")})]}),D&&w.length===0&&!m&&e.jsxs("div",{className:"rounded-xl bg-white px-4 py-4 flex flex-col sm:flex-row sm:items-center gap-3 md:border md:border-gray-100",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-[17px] font-medium text-brand-900",children:t("dashboard.plan.cardPitch")}),e.jsx("p",{className:"text-[15px] text-gray-500 mt-0.5",children:t("dashboard.plan.cardPitchBody")})]}),e.jsx("button",{type:"button",onClick:n,className:P("whitespace-nowrap"),children:t("dashboard.step.firstPayment.action")})]}),e.jsxs("div",{className:"overflow-hidden rounded-xl bg-white ps-4 divide-y divide-gray-100 md:border md:border-gray-100",children:[e.jsx(L,{label:t("dashboard.plan.totalRent"),value:T(o)}),e.jsx(L,{label:t("dashboard.plan.monthly"),value:b===null?"—":T(b),accent:!0}),e.jsx(L,{label:t("dashboard.plan.totalPayable"),value:c===null?"—":T(c)})]}),u.length>0?e.jsx("div",{className:"overflow-hidden rounded-xl bg-white md:border md:border-gray-100",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-gray-100 bg-gray-50/60",children:["#",t("dashboard.schedule.due"),t("dashboard.schedule.amount"),t("dashboard.schedule.status")].map(l=>e.jsx("th",{className:"text-start px-4 py-3 text-[13px] uppercase text-gray-500 whitespace-nowrap",children:l},l))})}),e.jsx("tbody",{children:u.map((l,K)=>{var M;return e.jsxs("tr",{className:"border-b border-gray-50 last:border-0",children:[e.jsx("td",{className:"px-4 py-3 text-[15px] text-brand-900 whitespace-nowrap",children:l.installment_no??l.installment??K+1}),e.jsx("td",{className:"px-4 py-3 text-[15px] text-gray-500 whitespace-nowrap",children:G(l.due_date)}),e.jsx("td",{className:"px-4 py-3 text-[15px] text-gray-500 whitespace-nowrap",children:T(l.amount)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full text-[13px] font-medium ${pe[(M=l.status)==null?void 0:M.toLowerCase()]||"bg-gray-100 text-gray-600"}`,children:W(l.status)?t(W(l.status)):be(l.status)})})]},l.installment_no??l.installment??K)})})]})})}):r?e.jsxs("div",{className:"px-4",children:[e.jsx("p",{className:"text-[15px] text-brand-900",children:t("dashboard.plan.noSchedule")}),e.jsx("p",{className:"mt-1 text-[13px] text-gray-500",children:t("dashboard.step.declined.body")})]}):e.jsxs("div",{className:"px-4",children:[e.jsx("p",{className:"text-[13px] uppercase text-gray-500",children:t("dashboard.plan.nextDue")}),e.jsx("p",{className:"mt-1 text-[15px] text-gray-500",children:v?G(v):t("dashboard.plan.scheduleLater")})]}
1),ae&&e.jsx(Te,{card:m,points:(m==null?void 0:m.points)??0,planComplete:_,failing:Y,onSetupCard:(se||Y)&&D?n:void 0,onCancelCard:d})]})},Se=({application:s,stage:a,ternEnabled:n=!1,onSetupCard:d,onCancelCard:x})=>{const{t}=N();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(V,{to:"/dashboard",className:`inline-flex ${F} items-center gap-1 text-[17px] text-brand-600 active:opacity-70`,children:[e.jsx("svg",{className:"w-5 h-5 sr-chevron",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 6 9 12 15 18"})}),t("mobile.track.back")]}),e.jsxs("div",{className:"px-4 text-[13px] text-gray-500",children:[e.jsxs("p",{children:["RNPL-",s.id," · ",t(q(s).labelKey),s.property_location?` · ${s.property_location}`:""]}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2",children:[e.jsx(X,{record:s,size:"sm",className:"!bg-transparent !px-0 !font-normal !text-gray-500"}),J(s)&&!s.verified&&e.jsx("span",{children:t("dashboard.verificationNote")})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"px-4 pb-2 text-[13px] uppercase text-gray-500",children:t("mobile.track.statusTitle")}),e.jsx(Z,{stage:a,agreement:s.agreement??null,documentsSent:Q(s)}),e.jsx("p",{className:"px-4 pt-2 text-[13px] text-gray-500",children:t("mobile.track.statusSubtitle")})]}),e.jsx(ee,{application:s,stage:a,ternEnabled:n,onSetupCard:d,onCancelCard:x})]})},E=()=>{const{t:s}=N();return e.jsxs(V,{to:"/dashboard",className:`inline-flex ${F} items-center gap-1 text-[17px] text-brand-600 active:opacity-70`,children:[e.jsx("svg",{className:"h-5 w-5 sr-chevron",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),s("dashboard.detail.back")]})},Ke=()=>{const{id:s}=ne(),{t:a}=N(),n=le(oe(o=>o.user),a("dashboard.focus.fallbackName")),[d,x]=j.useState(null),[t,r]=j.useState(!0),[i,p]=j.useState(null),[f,h]=j.useState(!1),y=j.useCallback(()=>{r(!0),p(null),ie(s).then(o=>{const u=(o==null?void 0:o.data)??o;x(u&&u.id?u:u||null)}).catch(o=>{p((o==null?void 0:o.message)||null),x(null)}).finally(()=>r(!1))},[s]);j.useEffect(()=>{y()},[y]);const b=j.useCallback(async o=>{await ce(o),y()},[y]);if(t)return e.jsx(C,{heading:a("dashboard.detail.statusTitle"),children:e.jsx(A,{variant:"loading",body:a("dashboard.detail.loading")})});if(i)return e.jsxs(C,{heading:a("dashboard.detail.statusTitle"),children:[e.jsx("div",{className:"mb-4",children:e.jsx(E,{})}),e.jsx(A,{variant:"error",icon:e.jsx(Ne,{}),title:a("dashboard.detail.errorTitle"),body:i||a("dashboard.detail.notFoundBody"),action:a("mobile.applications.retry"),onAction:y})]});if(!d)return e.jsxs(C,{heading:a("dashboard.detail.statusTitle"),children:[e.jsx("div",{className:"mb-4",children:e.jsx(E,{})}),e.jsx(A,{icon:e.jsx(ve,{}),title:a("dashboard.detail.notFoundTitle"),body:a("dashboard.detail.notFoundBody"),action:a("dashboard.detail.back"),actionTo:"/dashboard"})]});const g=ue(d.status),c=ye[g]||"bg-gray-100 text-gray-600";return e.jsxs(C,{heading:a("dashboard.detail.statusTitle"),children:[e.jsx("div",{className:"md:hidden",children:e.jsx(Se,{application:d,stage:g,ternEnabled:U,onSetupCard:()=>h(!0),onCancelCard:b})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx("div",{className:"mb-4",children:e.jsx(E,{})}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-black text-[#1F5BFF] uppercase tracking-widest mb-1",children:["RNPL-",d.id]}),e.jsx("h1",{className:"text-2xl md:text-3xl font-black text-[#0f2461]",children:n}),d.property_location&&e.jsx("p",{className:"text-gray-400 font-medium mt-1",children:d.property_location}),J(d)&&!d.verified&&e.jsx("p",{className:"mt-2 max-w-md text-xs font-medium text-gray-400",children:a("dashboard.verificationNote")})]}),e.jsxs("div",{className:"flex w-fit items-center gap-2",children:[e.jsx("span",{className:`inline-flex items-center px-4 py-1.5 rounded-full text-xs font-black ${c}`,children:a(q(d).labelKey)}),e.jsx(X,{record:d,size:"lg"})]})]}
1),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-6 items-start",children:[e.jsxs("section",{className:"lg:col-span-2 bg-white rounded-2xl border border-gray-100 shadow-sm p-6",children:[e.jsx("h2",{className:"text-lg font-black text-[#0f2461] mb-1",children:a("dashboard.detail.statusTitle")}),e.jsx("p",{className:"text-xs font-medium text-gray-400 mb-6",children:a("dashboard.detail.statusBody")}),e.jsx(Z,{stage:g,agreement:d.agreement??null,documentsSent:Q(d)})]}),e.jsx("section",{className:"lg:col-span-3",children:e.jsx(ee,{application:d,stage:g,ternEnabled:U,onSetupCard:()=>h(!0),onCancelCard:b})})]})]}),f&&e.jsx(je,{application:d,onClose:()=>h(!1)})]})};export{Ke as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.