1"use strict";(self.webpackChunkstudent_management_app=self.webpackChunkstudent_management_app||[]).push([[6710],{14185:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const n=a.forwardRef(r)},19676:(e,t,s)=>{s.d(t,{Yq:()=>r,n4:()=>l,vv:()=>n});var a=s(69212);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"MMM dd, yyyy";if(!e)return"Not set";try{return null!==e&&void 0!==e&&e.toDate?(0,a.GP)(e.toDate(),t):(0,a.GP)(new Date(e),t)}catch(s){return console.error("Error formatting date:",s),"Invalid date"}},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"USD";if(void 0===e||null===e)return"$0.00";try{return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(s){return console.error("Error formatting currency:",s),"$0.00"}},l=e=>{if(!e)return"";const t=e.replace(/\D/g,"");return 10===t.length?`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`:e}},36710:(e,t,s)=>{s.r(t),s.d(t,{default:()=>j});var a=s(9950),r=s(73814),n=s(56600),l=s(67714),i=s(19676),d=s(48805),o=s(40732),c=s(2765),m=s(63421),u=s(36923),x=s(14185),g=s(48996),h=s(52941),b=s(73214),p=s(82777),f=s(44414);const j=()=>{const{studentId:e}=(0,r.g)(),t=(0,r.Zp)(),{showToast:s}=(0,l.d)(),[j,v]=(0,a.useState)(null),[y,N]=(0,a.useState)(!0),[w,k]=(0,a.useState)(!1),[D,A]=(0,a.useState)({status:"pending",roomNumber:"",startDate:"",endDate:"",address:"",notes:"",assignedBy:"",assignedDate:null});(0,a.useEffect)(()=>{e&&(async()=>{try{const t=await(0,n.x7)((0,n.H9)(n.db,"students",e));if(t.exists()){const e={id:t.id,...t.data()};v(e),e.accommodationDetails&&A({status:e.accommodationDetails.status||"pending",roomNumber:e.accommodationDetails.roomNumber||"",startDate:e.accommodationDetails.startDate||"",endDate:e.accommodationDetails.endDate||"",address:e.accommodationDetails.address||"",notes:e.accommodationDetails.notes||"",assignedBy:e.accommodationDetails.assignedBy||"",assignedDate:e.accommodationDetails.assignedDate||null})}}catch(t){console.error("Error fetching student:",t),s("error","Failed to load student information")}finally{N(!1)}})()},[e,s]);const C=(e,t)=>{A(s=>({...s,[e]:t}))};if(y)return(0,f.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,f.jsx)(o.A,{})});if(!j)return(0,f.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,f.jsxs)("div",{className:"text-center",children:[(0,f.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Student Not Found"}),(0,f.jsx)(d.$,{onClick:()=>t("/dashboard"),children:"Return to Dashboard"})]})});const E=e=>{switch(e){case"approved":return(0,f.jsx)(c.A,{className:"h-5 w-5"});case"denied":return(0,f.jsx)(m.A,{className:"h-5 w-5"});default:return(0,f.jsx)(u.A,{className:"h-5 w-5"})}};return(0,f.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,f.jsx)("div",{className:"bg-white shadow-sm border-b",children:(0,f.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,f.jsx)("div",{className:"flex items-center justify-between h-16",children:(0,f.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,f.jsxs)(d.$,{variant:"ghost",size:"sm",onClick:()=>t(`/dashboard/student/${e}`),className:"flex items-center space-x-2",children:[(0,f.jsx)(x.A,{className:"h-4 w-4"}),(0,f.jsx)("span",{children:"Back to Student Details"})]}),(0,f.jsxs)("div",{className:"border-l border-gray-300 pl-4",children:[(0,f.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Accommodation Management"}),(0,f.jsx)("p",{className:"text-sm text-gray-600",children:j.fullName})]})]})})})}),(0,f.jsx)("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:(0,f.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,f.jsx)("div",{className:"lg:col-span-1",children:(0,f.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border p-6",children:[(0,f.jsxs)("div",{className:"flex items-center space-x-3 mb-4",children:[(0,f.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,f.jsx)(g.A,{className:"h-6 w-6 text-blue-600"})}),(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Student Information"}),(0,f.jsx)("p",{className:"text-sm text-gray-600",children:"Basic details"})]})]}),(0,f.jsxs)("div",{className:"space-y-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Full Name"}),(0,f.jsx)("p",{className:"mt-1 text-sm text-gray-900",children:j.fullName})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Email"}),(0,f.jsx)("p",{className:"mt-1 text-sm text-gray-900",children:j.email||"N/A"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Phone"}),(0,f.jsx)("p",{className:"mt-1 text-sm text-gray-900",children:j.phoneNumber||"N/A"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Course Start Date"}),(0,f.jsx)("p",{className:"mt-1 text-sm text-gray-900",children:(0,i.Yq)(j.
1courseStartDate)})]})]})]})}),(0,f.jsx)("div",{className:"lg:col-span-2",children:(0,f.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border p-6",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Accommodation Details"}),(0,f.jsx)("p",{className:"text-sm text-gray-600",children:"Manage student accommodation assignment"})]}),(0,f.jsxs)("div",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${(e=>{switch(e){case"approved":return"text-green-600 bg-green-100";case"denied":return"text-red-600 bg-red-100";case"pending":return"text-yellow-600 bg-yellow-100";default:return"text-gray-600 bg-gray-100"}})(D.status)}`,children:[E(D.status),(0,f.jsx)("span",{className:"ml-2 capitalize",children:D.status})]})]}),(0,f.jsxs)("div",{className:"space-y-6",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:"Accommodation Status"}),(0,f.jsx)("div",{className:"grid grid-cols-3 gap-3",children:["pending","approved","denied"].map(e=>(0,f.jsx)("button",{onClick:()=>{return t=e,void A(e=>({...e,status:t,assignedBy:"Administrator",assignedDate:(new Date).toISOString()}));var t},className:"p-3 rounded-lg border-2 transition-colors "+(D.status===e?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-200 hover:border-gray-300 text-gray-700"),children:(0,f.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[E(e),(0,f.jsx)("span",{className:"capitalize font-medium",children:e})]})},e))})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Room Number"}),(0,f.jsx)("input",{type:"text",value:D.roomNumber,onChange:e=>C("roomNumber",e.target.value),placeholder:"e.g., A101, B205",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),(0,f.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[(0,f.jsx)(h.A,{className:"h-4 w-4 inline mr-1"}),"Start Date"]}),(0,f.jsx)("input",{type:"date",value:D.startDate,onChange:e=>C("startDate",e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[(0,f.jsx)(h.A,{className:"h-4 w-4 inline mr-1"}),"End Date"]}),(0,f.jsx)("input",{type:"date",value:D.endDate,onChange:e=>C("endDate",e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]})]}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[(0,f.jsx)(b.A,{className:"h-4 w-4 inline mr-1"}),"Address"]}),(0,f.jsx)("textarea",{value:D.address,onChange:e=>C("address",e.target.value),placeholder:"Full accommodation address...",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),(0,f.jsxs)("div",{children:[(0,f.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[(0,f.jsx)(p.A,{className:"h-4 w-4 inline mr-1"}),"Notes"]}),(0,f.jsx)("textarea",{value:D.notes,onChange:e=>C("notes",e.target.value),placeholder:"Any additional notes or special requirements...",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),D.assignedBy&&(0,f.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,f.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:"Assignment Information"}),(0,f.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-gray-600",children:"Assigned by:"}),(0,f.jsx)("span",{className:"ml-2 font-medium text-gray-900",children:D.assignedBy})]}),D.assignedDate&&(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{className:"text-gray-600",children:"Assigned on:"}),(0,f.jsx)("span",{className:"ml-2 font-medium text-gray-900",children:(0,i.Yq)(D.assignedDate)})]})]})]}),(0,f.jsxs)("div",{className:"flex justify-end space-x-3 pt-6 border-t",children:[(0,f.jsx)(d.$,{variant:"outline",onClick:()=>t(`/dashboard/student/${e}`),children:"Cancel"}),(0,f.jsx)(d.$,{onClick:async()=>
1{if(j){k(!0);try{const t={...D,required:!0,lastUpdated:(0,n.O5)()};await(0,n.mZ)((0,n.H9)(n.db,"students",e),{accommodationDetails:t}),v(e=>({...e,accommodationDetails:t})),s("success","Accommodation details updated successfully")}catch(t){console.error("Error updating accommodation:",t),s("error","Failed to update accommodation details")}finally{k(!1)}}},disabled:w,className:"min-w-[120px]",children:w?(0,f.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,f.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),(0,f.jsx)("span",{children:"Saving..."})]}):"Save Changes"})]})]})]})})]})})]})}},36923:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const n=a.forwardRef(r)},40732:(e,t,s)=>{s.d(t,{A:()=>r});s(9950);var a=s(44414);const r=e=>{let{size:t="medium",color:s="blue"}=e;const r={small:"w-4 h-4",medium:"w-8 h-8",large:"w-12 h-12"}[t],n={blue:"text-blue-600",gray:"text-gray-600",white:"text-white"}[s];return(0,a.jsx)("div",{className:"flex justify-center items-center",children:(0,a.jsxs)("svg",{className:`animate-spin ${r} ${n}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})}},48805:(e,t,s)=>{s.d(t,{$:()=>r});s(9950);var a=s(44414);const r=e=>{let{children:t,variant:s="primary",size:r="default",isLoading:n=!1,disabled:l=!1,icon:i,onClick:d,type:o="button",className:c="",...m}=e;const u=l||n?"opacity-50 cursor-not-allowed":"";return(0,a.jsxs)("button",{type:o,className:`inline-flex items-center justify-center font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-200 ${{primary:"bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500",secondary:"bg-gray-100 text-gray-700 hover:bg-gray-200 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-primary-500"}[s]} ${{small:"px-3 py-1.5 text-sm",default:"px-4 py-2 text-sm",large:"px-6 py-3 text-base"}[r]} ${u} ${c}`,disabled:l||n,onClick:d,...m,children:[n&&(0,a.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-current",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i&&!n&&(0,a.jsx)(i,{className:"h-5 w-5 mr-2","aria-hidden":"true"}),t]})}},48996:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"}))}const n=a.forwardRef(r)},52941:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))}const n=a.forwardRef(r)},73214:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const n=a.forwardRef(r)},82777:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(9950);function r(e,t){let{title:s,titleId:r,...n}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},n),s?a.createElement("title",{id:r},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const n=a.forwardRef(r)}}]);
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.