PageSourceSearch

https://jhasolutions.com/assets/TenantPortal-CEITZMv2.js

js jhasolutions.com collected 2026-10-02 01:33:37 UTC 15,200 bytes, 7 lines download raw bytes

1import{r as y,b as W,j as e}from"./query-vendor-CqOtiPNe.js";import{D as A,af as G,ag as J,ah as V}from"./DashboardLayout-bhpyg6kK.js";import{P as X}from"./PageHeader-CZkE0AwI.js";import{u as O,x as Z,D as ee,p as te,q as ae,r as re,L as H,B as P,s,h as w,i as I,k,m as b}from"./index-CgiuONvO.js";import{B as Q}from"./badge-CSzvBtO5.js";import{S as g}from"./skeleton-B97PTBMn.js";import{u as ie,T as se}from"./useTenantData-Be53stAn.js";import{E as M}from"./EmptyState-B8Ncwn5F.js";import{T as oe}from"./textarea-CxLaKExY.js";import{I as ne}from"./input-oPoHA7Fw.js";import{u as me}from"./useCurrency-BwCXcmAr.js";import{H as R}from"./house-C9sHcoTX.js";import{F as le}from"./file-text-BqBFGr3S.js";import{f as _}from"./format-Ch7dQtBq.js";import{D as B}from"./dollar-sign-BoJmMuTa.js";import{C as de}from"./calendar-njTWr43i.js";import{W as K}from"./wrench-BveqLzJ6.js";import"./ui-vendor-C92kXd7i.js";import"./react-vendor-Oyj1q24G.js";import"./use-mobile-Bs-uMLmp.js";import"./separator-BBHmpRWz.js";import"./sheet-Dt5T48FQ.js";import"./tooltip-DukMi9Yb.js";import"./Logo-BMQirxBI.js";import"./calendar-days-BvC5INej.js";import"./building-2-Dhg-JMoH.js";import"./users-BKG6ZMTq.js";import"./map-pin-C3B4zHzE.js";import"./wifi-off--tLv87Xm.js";import"./message-square-BqIfb2eA.js";import"./credit-card-B4XMcBmh.js";import"./panel-top-C_rCNK16.js";import"./mail-dnbKMUvE.js";import"./log-out-BzS-CLno.js";import"./scroll-area-Cf6pvS46.js";import"./index-BdQq_4o_.js";import"./bell-CJIBHycy.js";import"./check-check-XSobeTl0.js";import"./formatDistanceToNow-DExfhm_y.js";import"./en-US-5rFTtd83.js";import"./LanguageSwitcher-k7A6VFzv.js";import"./dropdown-menu-D-1fS2hr.js";import"./chevron-right-Cl4Mx2Wq.js";import"./check-EsNBkSFR.js";import"./circle-QNrbGPhh.js";import"./languages-1QBd6nWm.js";import"./message-circle-C3Kdh8KU.js";import"./activity-DmUxG0fV.js";import"./arrow-down-C4HxAdL9.js";import"./arrow-left-Cg5pwYzI.js";import"./arrow-right-left-tf9Dbt9n.js";import"./arrow-right-CcjvJnjH.js";import"./banknote-wg82AAG7.js";import"./bed--FRu_ZOR.js";import"./list-ordered-CD-hc5AR.js";import"./book-open-check-DeGSCDpn.js";import"./book-open-CkJItcBu.js";import"./brain-QP504LxU.js";import"./building-B1y8ifkf.js";import"./calculator-BuA7e-mZ.js";import"./car-BBeSSily.js";import"./landmark-DVOwzqRj.js";import"./chart-no-axes-column-increasing-DINm0A4J.js";import"./chart-pie-BH1JXQN4.js";import"./chevron-down-C04YKbFY.js";import"./chevron-left-ChhJq7GD.js";import"./chevron-up-YEko4sQ9.js";import"./circle-check-big-B-nqExcc.js";import"./circle-check-DJQ0aRpE.js";import"./message-square-text-CGi8Ghec.js";import"./circle-help-C7Zpw0pA.js";import"./circle-x-BuyswQ-Z.js";import"./clipboard-check-BqHgjlQp.js";import"./clipboard-list-Csw_7fPS.js";import"./clipboard-BrLc9XKt.js";import"./clock-DZbyb8Zh.js";import"./copy-B3hQhSgM.js";import"./database-BFqeg3FR.js";import"./download-CVkjVrJo.js";import"./zoom-out-CZzr-t9-.js";import"./external-link-DLbL3mEn.js";import"./twitter-DZP3beY2.js";import"./file-chart-column-increasing-B5g6evDe.js";import"./file-check-2P_f7S4-.js";import"./file-spreadsheet-BbKDqPhp.js";import"./filter-DOTkE5Cb.js";import"./folder-open-CQAcdSBr.js";import"./tree-pine-BPQJJftn.js";import"./globe-CnUNDEKq.js";import"./video-CEw6mOAP.js";import"./hammer-wk7AQWqX.js";import"./heart-BnQgcucT.js";import"./hotel-GOTEiWOT.js";import"./image-plus-DfX-_AyQ.js";import"./image-DrO_YHf9.js";import"./infinity-BeOXN0LM.js";import"./key-round-Cl3pyXjD.js";import"./pen-tool-ErvG_pvg.js";import"./keyboard-CzV9enBr.js";import"./layers-BFQ0OLI3.js";import"./lightbulb-IBP3Qpkq.js";import"./list-checks-CsRR_GQp.js";import"./list-Cj3mFARp.js";import"./lock-rMWs3zu_.js";import"./map-pinned-DBhEITMu.js";import"./map-Dml-fuwB.js";import"./maximize-2-BAo6X0VP.js";import"./maximize-DllRQL4I.js";import"./menu-B6QavzjZ.js";import"./minus-BWhsihkF.js";import"./mouse-pointer-click-BX0OFv2U.js";import"./mouse-z7gxK0yj.js";import"./navigation-CE5W2bfp.js";import"./pause-DMf9J0er.js";import"./pencil-s0UamddO.js";import"./ruler-PMZpHEX4.js";import"./phone-CCpZm87m.js";import"./play-jGttOVZX.js";import"./plus-DhJDBkeB.js";import"./printer-DPItEGKX.js";import"./refresh-ccw-D8-NZbc0.js";import"./rocket-o5dk1x7z.js";import"./rotate-ccw-D5LvpNON.js";import"./rotate-cw-qBQXdDzU.js";import"./route-BHkgA-GC.js";import"./save-CD5NOpBU.js";import"./scale-ChbaOrX5.js";import"./search-CT8fLn3_.js";import"./send-Dev9pED3.js";import"./share-2-CZ8fruyy.js";import"./square-plus-BYoTN96c.js";import"./skip-forward-B2g28Adz.js";import"./smartphone-BVaS8Ogf.js";import"./square-check-big-S7f3xHqK.js";import"./square-pen-Cd8FE6iD.js";import"./square-DpPlSXOl.js";import"./star-DgTF5ai2.js";
1import"./trash-2-XdlKjO4t.js";import"./trending-down-BOTbmgUi.js";import"./trending-up-BVHf_RoK.js";import"./upload-B2TjyuSq.js";import"./user-check-DLa2T6BS.js";import"./user-C4n8hF8r.js";import"./volume-2-CyzFl9Wm.js";import"./volume-x-DwUdAb_B.js";import"./wallet-DFZjOwp1.js";import"./workflow-eRF_Iozj.js";import"./zap-CZwSyBya.js";import"./useIsRTL-CvXztNyx.js";import"./useOrganization-BfvJJCCq.js";import"./chart-vendor-De-uRwFm.js";import"./select-DLa9MRfA.js";import"./useMaintenanceRequests-Zy9smGmD.js";function pe({open:r,onOpenChange:f,payment:t}){const{t:C}=O(),[o,d]=y.useState(""),[p,j]=y.useState(null),[n,m]=y.useState(!1),{toast:c}=Z(),l=W(),N=async i=>{var a,$,T,q;if(i.preventDefault(),!o.trim()){c({title:"Payment Details Required",description:"Please describe how you paid.",variant:"destructive"});return}m(!0);try{let h=null;if(p){const F=p.name.split(".").pop(),v=`${t.id}-${Date.now()}.${F}`,{error:L}=await s.storage.from("receipts").upload(v,p);if(L)throw L;const{data:{publicUrl:Y}}=s.storage.from("receipts").getPublicUrl(v);h=Y}const{error:E}=await s.from("payments").update({tenant_confirmation:!0,tenant_confirmation_date:new Date().toISOString(),tenant_notes:o,...h&&{receipt_url:h}}).eq("id",t.id);if(E)throw E;const{data:{user:u}}=await s.auth.getUser(),{data:D}=await s.from("profiles").select("full_name").eq("id",u==null?void 0:u.id).single(),{data:z}=await s.from("leases").select("unit:units(property:properties(manager_id, name))").eq("id",t.lease_id).single(),x=z,S=($=(a=x==null?void 0:x.unit)==null?void 0:a.property)==null?void 0:$.manager_id,U=((q=(T=x==null?void 0:x.unit)==null?void 0:T.property)==null?void 0:q.name)||"your property";if(S){await s.rpc("create_notification",{p_user_id:S,p_title:"Payment Confirmation Received",p_message:`A tenant has confirmed sending a payment of $${t.amount}`,p_type:"payment",p_link:"/financials",p_related_id:t.id});const v=`💰 Payment Confirmation
2
3${(D==null?void 0:D.full_name)||"A tenant"} has confirmed sending a payment of $${t.amount} for ${U}.
4
5Payment details: ${o}
6
7Please verify and confirm receipt in the Financials section.`;await s.from("messages").insert({sender_id:u==null?void 0:u.id,recipient_id:S,message:v})}c({title:"Payment Confirmed",description:"Your payment confirmation has been sent to the landlord."}),l.invalidateQueries({queryKey:["tenant-data"]}),l.invalidateQueries({queryKey:["tenant-dashboard"]}),l.invalidateQueries({queryKey:["conversations"]}),l.invalidateQueries({queryKey:["messages"]}),f(!1),d(""),j(null)}catch(h){console.error("Error confirming payment:",h),c({title:"Error",description:"Failed to confirm payment. Please try again.",variant:"destructive"})}finally{m(!1)}};return e.jsx(ee,{open:r,onOpenChange:f,children:e.jsxs(te,{className:"sm:max-w-[500px]",children:[e.jsx(ae,{children:e.jsx(re,{children:"Confirm Payment Sent"})}),e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Amount: ",e.jsxs("span",{className:"font-medium text-foreground",children:["$",t.amount]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Due Date: ",e.jsx("span",{className:"font-medium text-foreground",children:new Date(t.due_date).toLocaleDateString()})]}),t.agreed_payment_method&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agreed Method: ",e.jsx("span",{className:"font-medium text-foreground capitalize",children:t.agreed_payment_method.replace("_"," ")})]})]}),e.jsx("div",{className:"rounded-lg border bg-muted/40 p-4 text-sm text-muted-foreground",children:"Use this form after sending rent through the payment method agreed with your landlord. Your confirmation, notes, and optional receipt will be saved to the payment record."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(H,{htmlFor:"payment-details",children:"Payment Details *"}),e.jsx(oe,{id:"payment-details",placeholder:C("forms.paymentDescription"),value:o,onChange:i=>d(i.target.value),rows:4,className:"resize-none",required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Include any relevant details like check number, transaction ID, or payment method"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(H,{htmlFor:"proof-image",children:"Proof of Payment (Optional)"}),e.jsx(ne,{id:"proof-image",type:"file",accept:"image/*",onChange:i=>{var a;return j(((a=i.target.files)==null?void 0:a[0])||null)}}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a photo of your check, receipt, or payment confirmation"})]}),e.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[e.jsx(P,{type:"button",variant:"outline",onClick:()=>f(!1),disabled:n,children:"Cancel"}),e.jsx(P,{type:"submit",disabled:n,children:n?"Confirming...":"Confirm Payment Sent"})]})]})]})})}const rr=()=>{var c,l,N,i;const{data:r,isLoading:f}=ie(),{t,i18n:C}=O(),{formatCurrency:o}=me(),[d,p]=y.useState(null),[j,n]=y.useState(!1),m=()=>{switch(C.language){case"es":return V;case"fr":return J;case"he":return G;default:return}};return f?e.jsxs(A,{children:[e.jsxs("div",{children:[e.jsx(g,{className:"h-8 w-64 mb-2"}),e.jsx(g,{className:"h-4 w-96"})]}),e.jsx(g,{className:"h-48 w-full"}),e.jsx(g,{className:"h-64 w-full"}),e.jsx(g,{className:"h-64 w-full"})]}):e.jsxs(A,{children:[e.jsx(X,{title:t("tenantPortal.title"),subtitle:t("tenantPortal.subtitle"),icon:e.jsx(R,{className:"h-5 w-5"})}),r!=null&&r.lease?e.jsxs(w,{className:"shadow-card hover:shadow-elevated transition-all duration-300",children:[e.jsx(I,{children:e.jsxs(k,{className:"flex items-center gap-2 text-lg md:text-xl",children:[e.jsx(le,{className:"h-5 w-5 flex-shrink-0"}),t("tenantPortal.leaseInfo.title")]})}),e.jsx(b,{children:e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 md:gap-6",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-muted/30",children:[e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mb-1",children:t("tenantPortal.leaseInfo.unit")}),e.jsx("p",{className:"font-semibold text-base md:text-lg truncate",children:(c=r.lease.unit)==null?void 0:c.unit_number})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/30",children:[e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mb-1",children:t("tenantPortal.leaseInfo.leasePeriod")}),e.jsxs("p",{className:"font-semibold text-sm md:text-base",children:[_(new Date(r.lease.start_date),"MMM d, yyyy",{locale:m()})," - ",_(new Date(r.lease.end_date),"MMM d, yyyy",{locale:m()})]})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/30",children:[e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mb-1",children:t("tenantPortal.leaseInfo.monthlyRent")}
7),e.jsx("p",{className:"font-semibold text-base md:text-lg",children:o(Number(r.lease.monthly_rent))})]})]})})]}):e.jsx(w,{className:"shadow-card",children:e.jsx(b,{className:"py-8",children:e.jsx(M,{icon:R,title:t("tenantPortal.leaseInfo.noLease"),description:"Contact your property manager to set up your lease."})})}),e.jsxs(w,{className:"shadow-card hover:shadow-elevated transition-all duration-300",children:[e.jsx(I,{children:e.jsxs(k,{className:"flex items-center gap-2 text-lg md:text-xl",children:[e.jsx(B,{className:"h-5 w-5 flex-shrink-0"}),t("tenantPortal.payments.title")]})}),e.jsx(b,{children:e.jsx("div",{className:"space-y-3",children:r!=null&&r.payments&&r.payments.length>0?e.jsx(e.Fragment,{children:e.jsx("div",{className:"max-h-[400px] overflow-y-auto space-y-3 pr-2",children:r.payments.map(a=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 bg-muted/50 rounded-lg hover:bg-muted/70 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(de,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:_(new Date(a.due_date),"MMM d, yyyy",{locale:m()})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o(Number(a.amount))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.status==="pending"&&!a.tenant_confirmation&&e.jsx(P,{size:"sm",variant:"outline",onClick:()=>p(a),children:"Confirm Payment Sent"}),a.tenant_confirmation&&a.status==="pending"&&e.jsx("div",{className:"text-xs text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"Awaiting landlord confirmation"})}),e.jsx(Q,{variant:a.status==="paid"?"default":a.status==="pending"?"secondary":"destructive",className:"w-fit",children:t(`tenantPortal.payments.status.${a.status}`)})]})]},a.id))})}):e.jsx(M,{icon:B,title:t("tenantPortal.payments.noPayments"),description:"Your payment history will appear here once you make your first payment."})})})]}),e.jsxs(w,{className:"shadow-card hover:shadow-elevated transition-all duration-300",children:[e.jsx(I,{children:e.jsxs(k,{className:"flex items-center gap-2 text-lg md:text-xl",children:[e.jsx(K,{className:"h-5 w-5 flex-shrink-0"}),t("tenantPortal.maintenance.title")]})}),e.jsx(b,{children:e.jsx("div",{className:"space-y-3",children:r!=null&&r.maintenance&&r.maintenance.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"max-h-[400px] overflow-y-auto space-y-3 pr-2",children:r.maintenance.map(a=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 bg-muted/50 rounded-lg hover:bg-muted/70 transition-colors",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium truncate",children:a.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:_(new Date(a.created_at),"MMM d, yyyy",{locale:m()})})]}),e.jsx(Q,{variant:a.status==="completed"?"default":a.status==="in_progress"?"secondary":"outline",className:"w-fit",children:t(`tenantPortal.maintenance.status.${a.status}`)})]},a.id))}),e.jsx(P,{variant:"outline",className:"w-full mt-4",onClick:()=>n(!0),children:t("tenantPortal.maintenance.submitNew")})]}):e.jsx(M,{icon:K,title:t("tenantPortal.maintenance.noRequests"),description:"Submit a maintenance request if you need any repairs.",action:{label:t("tenantPortal.maintenance.submitNew"),onClick:()=>n(!0)}})})})]}),d&&e.jsx(pe,{open:!!d,onOpenChange:a=>!a&&p(null),payment:d}),e.jsx(se,{open:j,onOpenChange:n,unitId:(l=r==null?void 0:r.lease)==null?void 0:l.unit_id,propertyId:(i=(N=r==null?void 0:r.lease)==null?void 0:N.unit)==null?void 0:i.property_id})]})};export{rr 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.