(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,21509,e=>{"use strict";var t=e.i(43476),s=e.i(83009),a=e.i(18566),r=e.i(71645);e.s(["default",0,function({children:e}){let{user:i,loading:n}=(0,s.useAuth)(),l=(0,a.useRouter)();return((0,r.useEffect)(()=>{n||i||l.push("/login")},[i,n,l]),n)?(0,t.jsx)("div",{className:"spinner-overlay",children:(0,t.jsxs)("div",{style:{textAlign:"center"},children:[(0,t.jsx)("div",{className:"spinner"}),(0,t.jsx)("p",{className:"spinner-text",children:"Loading..."})]})}):i?(0,t.jsx)(t.Fragment,{children:e}):null}])},58979,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(18566),r=e.i(83009),i=e.i(21509),n=e.i(5216),l=e.i(71898),d=e.i(22016);function o(){let{user:e}=(0,r.useAuth)(),i=(0,a.useRouter)(),{showToast:o}=(0,n.useToast)(),[c,m]=(0,s.useState)(null),[x,p]=(0,s.useState)(!0),[h,u]=(0,s.useState)(!0),[b,g]=(0,s.useState)(!1),[f,y]=(0,s.useState)({}),j=(0,s.useRef)({});if((0,s.useEffect)(()=>{e&&(0,l.getRegistration)(e.uid).then(e=>{e&&"completed"===e.status?m(e):i.push("/register"),p(!1)})},[e,i]),x)return(0,t.jsx)("div",{className:"flex justify-center items-center h-screen bg-gray-100",children:(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-10 h-10 border-4 border-[#005a8c] border-t-transparent rounded-full animate-spin"}),(0,t.jsx)("p",{className:"mt-4 text-gray-600 font-medium text-sm",children:"Loading applications..."})]})});if(!c)return null;let N=c.personalDetails||{};N.fullName||e?.displayName||e?.email;let v=c.applications||[];return(0,t.jsxs)("div",{className:"p-4 sm:p-6 pb-20 max-w-5xl mx-auto",children:[(0,t.jsx)("div",{className:"mb-6 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-2xl font-normal text-gray-700",children:"Application & Payment Status"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Review your applied posts and download payment receipts."})]})}),v.length>0?(0,t.jsx)("div",{className:"space-y-6",children:v.map((e,s)=>{let a=e.paymentId||`legacy-${s}`,r=e.date?new Date(e.date).toLocaleString("en-IN",{timeZone:"Asia/Kolkata"}):"N/A";return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[(0,t.jsxs)("h3",{className:"font-bold text-[#005a8c] uppercase tracking-wide text-sm",children:[(0,t.jsx)("i",{className:"fa-solid fa-briefcase mr-2"}),"Post: ",e.postCode]}),(0,t.jsx)("button",{onClick:()=>(e=>{let t=j.current[e];if(!t)return;y(t=>({...t,[e]:!0}));let s=document.createElement("style");s.innerHTML=`
            @media print {
                body * { visibility: hidden !important; }
                .print-section, .print-section * { visibility: visible !important; }
                .print-section {
                    position: absolute !important;
                    left: 0 !important;
                    top: 0 !important;
                    width: 100% !important;
                    margin: 0 !important;
                    padding: 0 !important;
                    box-shadow: none !important;
                    border: none !important;
                }
            }
        `,document.head.appendChild(s),t.classList.add("print-section"),setTimeout(()=>{window.print(),t.classList.remove("print-section"),document.head.removeChild(s),y(t=>({...t,[e]:!1}))},100)})(a),disabled:f[a],className:"px-4 py-2 bg-white border border-gray-300 rounded shadow-sm text-xs font-medium text-gray-700 hover:bg-gray-50 transition-colors flex items-center gap-2",children:f[a]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("i",{className:"fa-solid fa-spinner fa-spin"})," Generating..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("i",{className:"fa-solid fa-download"})," Download Receipt"]})})]}),(0,t.jsx)("div",{className:"p-6 overflow-x-auto",children:(0,t.jsxs)("div",{ref:e=>{j.current[a]=e},className:"min-w-[600px] border border-gray-200 rounded p-6 bg-white",children:[(0,t.jsxs)("div",{className:"text-center mb-6 border-b border-gray-200 pb-4",children:[(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800 uppercase tracking-widest",children:"Kokrajhar Medical College & Hospital"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Payment Receipt for Application Fee"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-8 mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-bold text-gray-400 uppercase mb-2",children:"Student Details"}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["Name: ",(0,t.jsx)("span",{className:"font-normal",children:N.fullName||"N/A"})]}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["App No: ",(0,t.jsx)("span",{className:"font-normal",children:c.applicationNumber})]}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["Category: ",(0,t.jsx)("span",{className:"font-normal",children:N.category||"UR"})]})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("h4",{className:"text-xs font-bold text-gray-400 uppercase mb-2",children:"Payment Details"}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["Date: ",(0,t.jsx)("span",{className:"font-normal",children:r})]}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["Transaction ID: ",(0,t.jsx)("span",{className:"font-normal break-all",children:e.paymentId||"N/A"})]}),(0,t.jsxs)("p",{className:"text-sm font-semibold text-gray-800",children:["Status: ",(0,t.jsx)("span",{className:"font-bold text-green-600",children:"SUCCESS"})]})]})]}),(0,t.jsxs)("table",{className:"w-full text-sm text-left text-gray-700 border-collapse border border-gray-200",children:[(0,t.jsx)("thead",{className:"bg-gray-50",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"border border-gray-200 px-4 py-2 font-bold w-1/4",children:"Post Code"}),(0,t.jsx)("th",{className:"border border-gray-200 px-4 py-2 font-bold w-1/2",children:"Post Applied For"}),(0,t.jsx)("th",{className:"border border-gray-200 px-4 py-2 font-bold w-1/4 text-right",children:"Amount Paid"})]})}),(0,t.jsx)("tbody",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"border border-gray-200 px-4 py-3 font-semibold",children:e.postCode}),(0,t.jsx)("td",{className:"border border-gray-200 px-4 py-3",children:e.postName||"N/A"}),(0,t.jsxs)("td",{className:"border border-gray-200 px-4 py-3 text-right font-bold",children:["₹",e.amount||"N/A"]})]})})]}),(0,t.jsxs)("div",{className:"mt-8 pt-4 border-t border-gray-200 text-xs text-gray-500 text-center",children:[(0,t.jsx)("p",{children:"This is a computer generated receipt and does not require a physical signature."}),(0,t.jsx)("p",{className:"mt-1",children:"Please keep this receipt for future reference."})]})]})})]},s)})}):(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded p-8 text-center shadow-sm",children:[(0,t.jsx)("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,t.jsx)("i",{className:"fa-solid fa-folder-open text-gray-400 text-2xl"})}),(0,t.jsx)("h3",{className:"text-lg font-bold text-gray-700",children:"No Applications Found"}),(0,t.jsx)("p",{className:"text-gray-500 mt-2 max-w-md mx-auto",children:"You haven't applied for any vacancies yet, or your past applications were made under the legacy system without tracked payment IDs."}),(0,t.jsx)(d.default,{href:"/vacancy",className:"inline-block mt-6 px-6 py-2.5 bg-[#005a8c] text-white font-medium rounded hover:bg-[#004a75] transition-colors shadow-sm",children:"Browse Vacancies"})]})]})}e.i(38036),e.s(["default",0,function(){return(0,t.jsx)(i.default,{children:(0,t.jsx)(o,{})})}])}]);