1/*! For license information please see 6922.2a1e2b3c.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkymca_website=self.webpackChunkymca_website||[]).push([[6922],{1286:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7784).A)("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"}]])},2054:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7784).A)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},5088:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7784).A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},5327:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7784).A)("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"}]])},6922:(e,t,s)=>{s.r(t),s.d(t,{default:()=>w});var a=s(9379),n=s(2532),i=s(3248),r=s(7097),l=s(5043),o=s(8163),c=s(2154),d=s(2054),u=s(5088),h=s(5327),m=s(1286),p=s(3768),g=s(74),x=s.n(g),y=s(943),b=(s(3071),s(2921)),f=s(689),v=s(380),A=s(1692),j=s(579);const w=()=>{var e,t;const{id:s}=(0,o.g)(),g=(0,o.Zp)(),w=(0,l.useRef)(),N=(0,l.useRef)(),k=(0,l.useRef)(),[C,D]=(0,l.useState)("agreement"),[S,_]=(0,l.useState)(!1),[M,R]=(0,l.useState)(!1),[E,O]=(0,l.useState)(!1),[F,U]=(0,l.useState)({actualDate:""}),q=(0,i.jE)(),{mutate:K}=(0,r.n)({mutationKey:["update-actual-date-and-fees",s],mutationFn:e=>c.A.post("/require/update-actual-date-and-fees",e),onSuccess:()=>{p.Ay.success("Actual date and fees updated successfully"),q.invalidateQueries(["tenency-agreement-get"]),U({actualDate:""})},onError:()=>{p.Ay.error("Failed to update actual date and fees")}}),{data:L,isLoading:P}=(0,n.I)({queryKey:["tenency-agreement-get",s],queryFn:()=>c.A.get("/require/tenancy/".concat(s)),enabled:!!s}),{mutate:T}=(0,r.n)({mutationFn:e=>c.A.put("/require/tenancy",e),mutationKey:["tenency-agreement-approve"],onSuccess:()=>{p.Ay.success("Tenancy agreement approved successfully"),g(-1)},onError:()=>{p.Ay.error("Failed to approve tenancy agreement")}});if(P)return(0,j.jsx)("p",{className:"text-gray-500",children:"Loading..."});const W=null===L||void 0===L||null===(e=L.data)||void 0===e||null===(t=e.data)||void 0===t?void 0:t[0];if(!W)return null;const z="pending"===W.form_status,G="approved"===W.form_status;return(0,j.jsxs)("div",{className:"w-full p-6 space-y-6",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between",children:[(0,j.jsx)("button",{onClick:()=>g(-1),className:"inline-flex items-center gap-2 px-4 py-1 bg-gray-100 text-gray-600 border border-gray-200 rounded-md hover:bg-gray-200 hover:text-gray-700 transition-colors duration-200",children:"Back"}),(0,j.jsxs)("h1",{className:"text-2xl font-bold text-slate-800",children:["Tenancy Agreement for -"," ",(0,j.jsx)("span",{className:"text-2xl",children:"student"===W.applicant_type?"Student":"trainee"===W.applicant_type?"Trainee":"working_professional"===W.applicant_type?"Working Professional":"Admin view"})]}),z&&(0,j.jsxs)("span",{className:"inline-flex items-center gap-2 px-4 py-1.5 text-sm font-medium rounded-full bg-yellow-100 text-yellow-700",children:[(0,j.jsx)(u.A,{className:"w-4 h-4"}),"Pending Approval"]}),G&&(0,j.jsxs)("span",{className:"inline-flex items-center gap-2 px-4 py-1.5 text-sm font-medium rounded-full bg-green-100 text-green-700",children:[(0,j.jsx)(d.A,{className:"w-4 h-4"}),"Approved"]})]}),(0,j.jsxs)("div",{className:"bg-white border border-gray-100 rounded-xl p-6 grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,j.jsx)("div",{className:"flex justify-center",children:(0,j.jsx)("img",{src:W.photo_path,loading:"lazy",alt:"Applicant",className:"w-32 h-32 rounded-xl object-cover border"})}),(0,j.jsxs)("div",{className:"md:col-span-2 space-y-4",children:[(0,j.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:W.name}),(0,j.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 text-sm",children:[(0,j.jsxs)("p",{className:"flex items-center gap-2 text-gray-700",children:[(0,j.jsx)(h.A,{className:"w-4 h-4 text-gray-500"}),W.email]}),(0,j.jsxs)("p",{className:"flex items-center gap-2 text-gray-700",children:[(0,j.jsx)(m.A,{className:"w-4 h-4 text-gray-500"}),W.mobile]}),z&&(0,j.jsx)("div",{className:"flex justify-end gap-4",children:(0,j.jsx)("button",{onClick:()=>{T({id:W.id,form_status:"approved"})},className:"px-6 py-2 rounded-lg bg-green-600 text-white hover:bg-green-700",children:"Approve"})})]}),(0,j.jsxs)("div",{className:"flex gap-3 flex-wrap",children:[(0,j.jsxs)("button",{onClick:async()=>{const e=w.current;if(e)try{R(!0),await x()().from(e).set({margin:10,filename:"YMCA_Tenancy_Agreement.pdf",image:{type:"jpeg",quality:.7},html2canvas:{scale:1.2,useCORS:!0,allowTaint:!1,logging:!1},jsPDF:{unit:"mm",format:"a4",orientation:"portrait",compress:!0}}).save()}catch(t){console.log("error",t)}finally{R(!1)}},disabled:M,className:"px-4 py-1 bg-gray-100 border border-gray-200 rounded-lg text-xs font-semibold text-gray-700 flex items-center gap-2",children:[M&&(0,j.jsx)("span",{className:"w-3 h-3 border-2 border-gray-400 border-t-transparent roun
2ded-full animate-spin"}),M?"Downloading...":"Download agreement"]}),(0,j.jsxs)("button",{onClick:async()=>{const e=k.current;if(e)try{_(!0),await x()().from(e).set({margin:10,filename:"YMCA_Rules_and_Regulations.pdf",image:{type:"jpeg",quality:.7},html2canvas:{scale:1.2,useCORS:!0,allowTaint:!1,logging:!1},jsPDF:{unit:"mm",format:"a4",orientation:"portrait",compress:!0}}).save()}catch(t){console.log("PDF Error:",t)}finally{_(!1)}},disabled:S,className:"px-4 py-1 bg-gray-100 border border-gray-200 rounded-lg text-xs font-semibold text-gray-700 flex items-center gap-2",children:[S&&(0,j.jsx)("span",{className:"w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin"}),S?"Downloading...":"Download Rules & Regulations"]})]}),(0,j.jsxs)("div",{style:{position:"absolute",top:"-9999px",left:"-9999px",visibility:"hidden"},children:[(0,j.jsx)(b.A,{tenancyUserDetails:W,ref:w}),(0,j.jsx)(f.A,{tenancyUserDetails:W,ref:N}),(0,j.jsx)(A.A,{tenancyUserDetails:W,ref:k})]})]})]}),(0,j.jsxs)("div",{className:"w-full bg-white border border-slate-200/80 rounded-2xl p-6 shadow-sm",children:[(0,j.jsxs)("div",{className:"mb-6",children:[(0,j.jsx)("h3",{className:"text-base font-semibold text-slate-900 tracking-tight",children:"Arrival & Fee Adjustments"}),(0,j.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"Update the verified check-in date and apply any early arrival surcharges."})]}),(0,j.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:(0,j.jsxs)("div",{className:"space-y-1.5",children:[(0,j.jsx)("label",{htmlFor:"actualDate",className:"block text-xs font-semibold uppercase tracking-wider text-slate-600",children:"Actual Arrival Date"}),(0,j.jsx)("div",{className:"relative",children:(0,j.jsx)("input",{id:"actualDate",type:"date",name:"actualDate",onChange:e=>{const{name:t,value:s}=e.target;U(e=>(0,a.A)((0,a.A)({},e),{},{[t]:s}))},className:"w-full h-11 rounded-xl border border-slate-200 bg-slate-50/50 px-3.5 text-sm text-slate-800 transition-all placeholder:text-slate-400 hover:border-slate-300 focus:bg-white focus:border-blue-500 focus:ring-4 focus:ring-blue-500/10 focus:outline-none"})})]})}),(0,j.jsx)("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-slate-100",children:(0,j.jsx)("button",{type:"button",onClick:()=>{const e={actual_arrival_date:F.actualDate,application_id:s};K(e)},className:"inline-flex items-center justify-center h-10 px-5 text-sm font-medium text-white transition-all bg-blue-600 rounded-xl hover:bg-blue-700 active:scale-[0.98] shadow-sm shadow-blue-500/20 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",children:"Apply Changes"})})]}),(0,j.jsxs)("div",{className:"flex gap-4 border-b",children:[(0,j.jsx)("button",{onClick:()=>D("agreement"),className:"\n px-4 py-2 font-medium\n ".concat("agreement"===C?"text-[#003478] border-b-2 border-[#003478]":"text-gray-500","\n "),children:"Agreement"}),(0,j.jsx)("button",{onClick:()=>D("rules"),className:"\n px-4 py-2 font-medium\n ".concat("rules"===C?"text-[#003478] border-b-2 border-[#003478]":"text-gray-500","\n "),children:"Rules & Regulations"})]}),"agreement"===C&&(0,j.jsx)(y.A,{tenancyUserDetails:W}),"rules"===C&&(0,j.jsx)(v.A,{tenancyUserDetails:W})]})}},7097:(e,t,s)=>{s.d(t,{n:()=>w});var a,n,i,r,l,o=s(9379),c=s(5043),d=s(9790),u=s(5149),h=s(8458),m=s(6562),p=s(4558),g=s(5239),x=s(1454),y=s(329),b=s(9723),f=(a=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,l=new WeakSet,class extends y.Q{constructor(e,t){super(),(0,d.A)(this,l),(0,u.A)(this,a,void 0),(0,u.A)(this,n,void 0),(0,u.A)(this,i,void 0),(0,u.A)(this,r,void 0),(0,p.A)(a,this,e),this.setOptions(t),this.bindMethods(),(0,m.A)(l,this,v).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const s=this.options;this.options=(0,h.A)(a,this).defaultMutationOptions(e),(0,b.f8)(this.options,s)||(0,h.A)(a,this).getMutationCache().notify({type:"observerOptionsUpdated",mutation:(0,h.A)(i,this),observer:this}),null!==s&&void 0!==s&&s.mutationKey&&this.options.mutationKey&&(0,b.EN)(s.mutationKey)!==(0,b.EN)(this.options.mutationKey)?this.reset():"pending"===(null===(t=(0,h.A)(i,this))||void 0===t?void 0:t.state.status)&&(0,h.A)(i,this).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(null===(e=(0,h.A)(i,this))||void 0===e||e.removeObserver(this))}onMutationUpdate(e){(0,m.A)(l,this,v).call(this),(0,m.A)(l,this,A).call(this,e)}getCurrentResult(){return(0,h.A)(n,this)}reset(){var e;null===(e=(0,h.A)(i,this))||void 0===e||e.removeObserver(this),(0,p.A)(i,this,void 0),(0,m.A)(l,this,v).call(this),(0,m.A)(l,this,A).call(this)}mutate(e,t){var s;return(0,p.A)(r,this,t),null===(s=(0,h.A)(i,this))||void 0===s||s.removeObserver(this),(0,p.A)(i,this,(0,h.A)(a,this).getMutationCache().build((0,h.A)(a,this),this.options)),(0,h.A)(i,this).addObserver(this),(0,h.A)(i,this).execute(e)}});function v(){var e,t;const s=null!==(e=null===(t=(0,h.A)(i,this))||void 0===t?void 0:t.state)&&void 0!==e?e:(0,g.$)();(0,p.A)(n,this,(0,o.A)((0,o.A)({},s),{},{isPending:"pending"===s.status,isSuccess:"success"===s.status,isError:"error"===s.status,isIdle:"idle"===s.status,mutate:this.mutate,reset:this.reset}))}function A(e){x.jG.batch(()=>
2{if((0,h.A)(r,this)&&this.hasListeners()){const m=(0,h.A)(n,this).variables,p=(0,h.A)(n,this).context,g={client:(0,h.A)(a,this),meta:this.options.meta,mutationKey:this.options.mutationKey};var t,s,i,l;if("success"===(null===e||void 0===e?void 0:e.type))null===(t=(s=(0,h.A)(r,this)).onSuccess)||void 0===t||t.call(s,e.data,m,p,g),null===(i=(l=(0,h.A)(r,this)).onSettled)||void 0===i||i.call(l,e.data,null,m,p,g);else if("error"===(null===e||void 0===e?void 0:e.type)){var o,c,d,u;null===(o=(c=(0,h.A)(r,this)).onError)||void 0===o||o.call(c,e.error,m,p,g),null===(d=(u=(0,h.A)(r,this)).onSettled)||void 0===d||d.call(u,void 0,e.error,m,p,g)}}this.listeners.forEach(e=>{e((0,h.A)(n,this))})})}var j=s(3248);function w(e,t){const s=(0,j.jE)(t),[a]=c.useState(()=>new f(s,e));c.useEffect(()=>{a.setOptions(e)},[a,e]);const n=c.useSyncExternalStore(c.useCallback(e=>a.subscribe(x.jG.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),i=c.useCallback((e,t)=>{a.mutate(e,t).catch(b.lQ)},[a]);if(n.error&&(0,b.GU)(a.options.throwOnError,[n.error]))throw n.error;return(0,o.A)((0,o.A)({},n),{},{mutate:i,mutateAsync:n.mutate})}}}]); 3//# sourceMappingURL=6922.2a1e2b3c.chunk.js.map
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.