From b9c7483eeca4eb64a9377f0f7bccefb5d42845e9 Mon Sep 17 00:00:00 2001 From: sulthan Date: Tue, 9 Jun 2026 16:57:55 +0700 Subject: [PATCH] change backend api --- _next/static/chunks/app/homepage/page-905f9e40506126d1.js | 2 +- .../acceptanceletter/applyLetter/page-ed9e0c5055487893.js | 2 +- .../chunks/app/letter/acceptanceletter/page-f5aeb68c5b1400de.js | 2 +- .../letter/acceptanceletter/showLetter/page-cb403df05e9540cc.js | 2 +- .../completionletter/applyLetter/page-14567199585d9f52.js | 2 +- .../chunks/app/letter/completionletter/page-2e880a33eeff02d0.js | 2 +- .../letter/completionletter/showLetter/page-ded16d837713abb8.js | 2 +- _next/static/chunks/app/login/page-5dee644b52c7ce28.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_next/static/chunks/app/homepage/page-905f9e40506126d1.js b/_next/static/chunks/app/homepage/page-905f9e40506126d1.js index ab12fc2..c911167 100644 --- a/_next/static/chunks/app/homepage/page-905f9e40506126d1.js +++ b/_next/static/chunks/app/homepage/page-905f9e40506126d1.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[539],{1259:(e,t,s)=>{"use strict";s.d(t,{default:()=>m});var r=s(5155),a=s(2115),l=s(6868),c=s(6046),o=s(1466),n=s(5236),i=s(7401);let d=(0,i.A)("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]),u=(0,i.A)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);function m(){let[e,t]=(0,a.useState)(0),[s,i]=(0,a.useState)(0),{username:m}=(0,l.A)(),[h,x]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),v=(0,c.useRouter)();return(0,a.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),s=await fetch("https://cetaksuratkp-api.humicprototyping.com/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}}),r=await s.json(),a=r.data;if(Array.isArray(a)){let e=a.filter(e=>"1"===e.is_acceptance).length,s=a.filter(e=>"1"===e.is_completion).length;console.log("Acceptance count:",e),console.log("Completion count:",s),t(e),i(s),console.log(a.map(e=>({id:e.id,is_acceptance:e.is_acceptance,is_completion:e.is_completion})))}else console.error("Unexpected response format",a),console.log("API Response",r)}catch(e){console.error("Failed to fetch letter data:",e)}})()},[]),(0,a.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||b(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||g(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,r.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-8",children:[(0,r.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,r.jsxs)("div",{className:"flex space-x-8",children:[(0,r.jsx)("a",{href:"#",className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A]",children:"Home"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{id:"letter-button",onClick:()=>b(!f),className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Letter"}),f&&(0,r.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,r.jsx)("button",{onClick:()=>v.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,r.jsx)("button",{onClick:()=>v.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,r.jsxs)("div",{className:"relative z-50",children:[(0,r.jsx)("button",{id:"profile-button",onClick:()=>g(!p),className:"text-gray-700 hover:text-black cursor-pointer",children:(0,r.jsx)(o.A,{})}),p&&(0,r.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,r.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,r.jsx)("p",{className:"font-semibold",children:m||"Guest"})}),(0,r.jsxs)("button",{onClick:async()=>{x(!0),await new Promise(e=>setTimeout(e,1e3)),x(!1),v.push("/login")},disabled:h,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[h?(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,r.jsx)(n.A,{className:"mr-2",size:18}),h?"Logging out...":"Log Out"]})]})]})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("img",{src:"/assets/background.jpg",className:"w-full h-[320px] object-cover z-0",alt:"Background"}),(0,r.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white text-center",children:(0,r.jsxs)("h1",{className:"text-5xl font-bold drop-shadow-lg",children:["Welcome",m?", ".concat(m):"","!"]})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-6 p-10",children:[(0,r.jsxs)("div",{className:"bg-white shadow-md rounded-lg p-6 col-span-2",children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-black mb-3",children:"Letter Maker"}),(0,r.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed",children:"This platform allows interns at HUMIC Engineering to easily create and manage their internship documents, including acceptance and completion letters, in a fast, accurate, and secure way."})]}),(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(d,{className:"text-yellow-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:e}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Acceptance letter"})]}),(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(u,{className:"text-green-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:s}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Completion letter"})]})]})]})]})}},1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6046:(e,t,s)=>{"use strict";var r=s(6658);s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>o,AuthProvider:()=>c});var r=s(5155),a=s(2115);let l=(0,a.createContext)(void 0);function c(e){let{children:t}=e,[s,c]=(0,a.useState)("");return(0,a.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&c(t.name)}},[]),(0,r.jsx)(l.Provider,{value:{username:s,setUsername:c,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),c("")}},children:t})}function o(){let e=(0,a.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(2115);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:i="",children:d,iconNode:u,...m}=e;return(0,r.createElement)("svg",{ref:t,...c,width:a,height:a,stroke:s,strokeWidth:n?24*Number(o)/Number(a):o,className:l("lucide",i),...m},[...u.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),n=(e,t)=>{let s=(0,r.forwardRef)((s,c)=>{let{className:n,...i}=s;return(0,r.createElement)(o,{ref:c,iconNode:t,className:l("lucide-".concat(a(e)),n),...i})});return s.displayName="".concat(e),s}},8288:(e,t,s)=>{Promise.resolve().then(s.bind(s,1259))}},e=>{var t=t=>e(e.s=t);e.O(0,[441,587,358],()=>t(8288)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[539],{1259:(e,t,s)=>{"use strict";s.d(t,{default:()=>m});var r=s(5155),a=s(2115),l=s(6868),c=s(6046),o=s(1466),n=s(5236),i=s(7401);let d=(0,i.A)("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]),u=(0,i.A)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);function m(){let[e,t]=(0,a.useState)(0),[s,i]=(0,a.useState)(0),{username:m}=(0,l.A)(),[h,x]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),v=(0,c.useRouter)();return(0,a.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),s=await fetch("https://cetaksuratkp-api.humicprototyping.net/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}}),r=await s.json(),a=r.data;if(Array.isArray(a)){let e=a.filter(e=>"1"===e.is_acceptance).length,s=a.filter(e=>"1"===e.is_completion).length;console.log("Acceptance count:",e),console.log("Completion count:",s),t(e),i(s),console.log(a.map(e=>({id:e.id,is_acceptance:e.is_acceptance,is_completion:e.is_completion})))}else console.error("Unexpected response format",a),console.log("API Response",r)}catch(e){console.error("Failed to fetch letter data:",e)}})()},[]),(0,a.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||b(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||g(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,r.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-8",children:[(0,r.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,r.jsxs)("div",{className:"flex space-x-8",children:[(0,r.jsx)("a",{href:"#",className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A]",children:"Home"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{id:"letter-button",onClick:()=>b(!f),className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Letter"}),f&&(0,r.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,r.jsx)("button",{onClick:()=>v.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,r.jsx)("button",{onClick:()=>v.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,r.jsxs)("div",{className:"relative z-50",children:[(0,r.jsx)("button",{id:"profile-button",onClick:()=>g(!p),className:"text-gray-700 hover:text-black cursor-pointer",children:(0,r.jsx)(o.A,{})}),p&&(0,r.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,r.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,r.jsx)("p",{className:"font-semibold",children:m||"Guest"})}),(0,r.jsxs)("button",{onClick:async()=>{x(!0),await new Promise(e=>setTimeout(e,1e3)),x(!1),v.push("/login")},disabled:h,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[h?(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,r.jsx)(n.A,{className:"mr-2",size:18}),h?"Logging out...":"Log Out"]})]})]})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("img",{src:"/assets/background.jpg",className:"w-full h-[320px] object-cover z-0",alt:"Background"}),(0,r.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white text-center",children:(0,r.jsxs)("h1",{className:"text-5xl font-bold drop-shadow-lg",children:["Welcome",m?", ".concat(m):"","!"]})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-6 p-10",children:[(0,r.jsxs)("div",{className:"bg-white shadow-md rounded-lg p-6 col-span-2",children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-black mb-3",children:"Letter Maker"}),(0,r.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed",children:"This platform allows interns at HUMIC Engineering to easily create and manage their internship documents, including acceptance and completion letters, in a fast, accurate, and secure way."})]}),(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(d,{className:"text-yellow-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:e}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Acceptance letter"})]}),(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(u,{className:"text-green-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:s}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Completion letter"})]})]})]})]})}},1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6046:(e,t,s)=>{"use strict";var r=s(6658);s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>o,AuthProvider:()=>c});var r=s(5155),a=s(2115);let l=(0,a.createContext)(void 0);function c(e){let{children:t}=e,[s,c]=(0,a.useState)("");return(0,a.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&c(t.name)}},[]),(0,r.jsx)(l.Provider,{value:{username:s,setUsername:c,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),c("")}},children:t})}function o(){let e=(0,a.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(2115);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:i="",children:d,iconNode:u,...m}=e;return(0,r.createElement)("svg",{ref:t,...c,width:a,height:a,stroke:s,strokeWidth:n?24*Number(o)/Number(a):o,className:l("lucide",i),...m},[...u.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),n=(e,t)=>{let s=(0,r.forwardRef)((s,c)=>{let{className:n,...i}=s;return(0,r.createElement)(o,{ref:c,iconNode:t,className:l("lucide-".concat(a(e)),n),...i})});return s.displayName="".concat(e),s}},8288:(e,t,s)=>{Promise.resolve().then(s.bind(s,1259))}},e=>{var t=t=>e(e.s=t);e.O(0,[441,587,358],()=>t(8288)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/acceptanceletter/applyLetter/page-ed9e0c5055487893.js b/_next/static/chunks/app/letter/acceptanceletter/applyLetter/page-ed9e0c5055487893.js index 40b884c..b061a12 100644 --- a/_next/static/chunks/app/letter/acceptanceletter/applyLetter/page-ed9e0c5055487893.js +++ b/_next/static/chunks/app/letter/acceptanceletter/applyLetter/page-ed9e0c5055487893.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[844],{745:(e,t,a)=>{"use strict";a.d(t,{bq:()=>u,eb:()=>p,gC:()=>m,l6:()=>c,yv:()=>d});var s=a(5155);a(2115);var r=a(1149),l=a(1719),n=a(8867),i=a(1902),o=a(9602);function c(e){let{...t}=e;return(0,s.jsx)(r.bL,{"data-slot":"select",...t})}function d(e){let{...t}=e;return(0,s.jsx)(r.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,children:a,...n}=e;return(0,s.jsxs)(r.l9,{"data-slot":"select-trigger",className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[a,(0,s.jsx)(r.In,{asChild:!0,children:(0,s.jsx)(l.A,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:a,position:l="popper",...n}=e;return(0,s.jsx)(r.ZL,{children:(0,s.jsxs)(r.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...n,children:[(0,s.jsx)(x,{}),(0,s.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,s.jsx)(h,{})]})})}function p(e){let{className:t,children:a,...l}=e;return(0,s.jsxs)(r.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...l,children:[(0,s.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,s.jsx)(r.VF,{children:(0,s.jsx)(n.A,{className:"size-4"})})}),(0,s.jsx)(r.p4,{children:a})]})}function x(e){let{className:t,...a}=e;return(0,s.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(i.A,{className:"size-4"})})}function h(e){let{className:t,...a}=e;return(0,s.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(l.A,{className:"size-4"})})}},2336:(e,t,a)=>{"use strict";a.d(t,{p:()=>l});var s=a(5155);a(2115);var r=a(9602);function l(e){let{className:t,type:a,...l}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("border-input file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>o});var s=a(5155);a(2115);var r=a(2317),l=a(1027),n=a(9602);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:a,size:l,asChild:o=!1,...c}=e,d=o?r.DX:"button";return(0,s.jsx)(d,{"data-slot":"button",className:(0,n.cn)(i({variant:a,size:l,className:t})),...c})}},6116:(e,t,a)=>{Promise.resolve().then(a.bind(a,7951))},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>i,AuthProvider:()=>n});var s=a(5155),r=a(2115);let l=(0,r.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&n(t.name)}},[]),(0,s.jsx)(l.Provider,{value:{username:a,setUsername:n,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),n("")}},children:t})}function i(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7951:(e,t,a)=>{"use strict";a.d(t,{default:()=>g});var s=a(5155),r=a(2115),l=a(125),n=a(2336),i=a(4085),o=a(2651),c=a(745),d=a(7006),u=a(1466),m=a(5236),p=a(2423),x=a(9348);a(6871);var h=a(6046),v=a(6868);function g(){let e=(0,h.useSearchParams)(),[t,a]=(0,r.useState)(!1),[g,b]=(0,r.useState)(null),f=(0,h.useRouter)(),{username:j}=(0,v.A)(),[y,w]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[_,S]=(0,r.useState)(""),[C,A]=(0,r.useState)(""),[z,P]=(0,r.useState)(""),[E,L]=(0,r.useState)(""),[M,I]=(0,r.useState)(!1),[T,D]=(0,r.useState)(""),[O,G]=(0,r.useState)(),[U,B]=(0,r.useState)(),[q,H]=(0,r.useState)(!1),[W,$]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[V,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=e.get("edit");if(t)try{var s,r,l,n;let e=JSON.parse(t);a(!0),b(e.id),k(e.nomor_surat_acceptance),P(null!==(r=e.nomor_induk_mahasiswa)&&void 0!==r?r:""),G(new Date(e.start_date)),B(new Date(e.completion_date)),w(null!==(l=null===(s=e.letter_scope)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:""),S(null!==(n=e.address_to)&&void 0!==n?n:""),L(e.program_studi_mahasiswa),D(e.tahun_ajaran),A(e.nama_mahasiswa)}catch(e){console.error("Failed to parse edit param:",e)}},[e]),(0,r.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||R(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||J(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]);let X=async()=>{if(!y||!N||!_||!C||!z||!E||!T||!O||!U){alert("Please fill in all the required fields.");return}let e=N.padStart(3,"0"),a=(0,d.GP)(new Date,"dd.MM.yyyy"),s={nama_mahasiswa:C,letter_scope:y,nomor_surat_acceptance:t?N:"HUMIC/".concat("INTERNAL"===y.toUpperCase()?"INT":"EXT","/").concat(a,"/").concat(e),address_to:_,nomor_induk_mahasiswa:z,program_studi_mahasiswa:E,tahun_ajaran:T,nomor_surat_completion:"",start_date:(0,d.GP)(O,"yyyy-MM-dd"),completion_date:(0,d.GP)(U,"yyyy-MM-dd"),is_acceptance:1,is_completion:0};try{let e;let a=localStorage.getItem("authToken");if(!a){alert("Unauthorized! Please log in.");return}console.log("Submitting data:",s),(e=t?await o.A.put("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(g),s,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}}):await o.A.post("https://cetaksuratkp-api.humicprototyping.com/api/letter",s,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}})).data.success?(console.log("Letter submitted successfully:",e.data),f.push("/letter/acceptanceletter")):alert(e.data.message||"Submission failed")}catch(e){if(console.error("Error submitting letter:",e),o.A.isAxiosError(e)){var r,l,n;console.error("Server response:",null===(r=e.response)||void 0===r?void 0:r.data),alert("Error: ".concat((null===(l=e.response)||void 0===l?void 0:l.data.message)||JSON.stringify(null===(n=e.response)||void 0===n?void 0:n.data)))}else alert("Error submitting letter. Please try again later.")}};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,s.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,s.jsxs)("div",{className:"flex space-x-8",children:[(0,s.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium",children:"Home"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"letter-button",onClick:()=>R(!V),className:"text-[#B4262A] border-b-2 border-[#B4262A]",children:"Letter"}),V&&(0,s.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,s.jsx)("button",{onClick:()=>f.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,s.jsx)("button",{onClick:()=>f.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"profile-button",onClick:()=>J(!F),className:"text-gray-700 hover:text-black",children:(0,s.jsx)(u.A,{})}),F&&(0,s.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,s.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,s.jsx)("p",{className:"font-semibold",children:j||"Guest"})}),(0,s.jsxs)("button",{onClick:async()=>{I(!0),await new Promise(e=>setTimeout(e,1e3)),I(!1),f.push("/login")},disabled:M,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[M?(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,s.jsx)(m.A,{className:"mr-2",size:18}),M?"Logging out...":"Log Out"]})]})]})]}),(0,s.jsxs)("div",{className:"px-20 py-10",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-black mb-8",children:t?"Update Practical Work Letter":"Apply Practical Work Letter"}),(0,s.jsxs)("div",{className:"bg-white rounded-lg p-8 shadow-md",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Scope"}),(0,s.jsxs)(c.l6,{value:y,onValueChange:w,disabled:t,children:[(0,s.jsx)(c.bq,{className:"w-full",children:(0,s.jsx)(c.yv,{placeholder:"Select..."})}),(0,s.jsxs)(c.gC,{children:[(0,s.jsx)(c.eb,{value:"internal",children:"Internal"}),(0,s.jsx)(c.eb,{value:"external",children:"External"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Number"}),(0,s.jsx)(n.p,{value:null!=N?N:"",onChange:e=>k(e.target.value),disabled:t})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Addressed To"}),(0,s.jsx)(n.p,{value:null!=_?_:"",onChange:e=>S(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Name"}),(0,s.jsx)(n.p,{value:null!=C?C:"",onChange:e=>A(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Identification Number (NIM)"}),(0,s.jsx)(n.p,{value:null!=z?z:"",onChange:e=>P(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Study Program"}),(0,s.jsx)(n.p,{value:null!=E?E:"",onChange:e=>L(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Academic Year"}),(0,s.jsx)(n.p,{value:null!=T?T:"",placeholder:"e.g. Genap 2022/2023",onChange:e=>D(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Starting Date"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:O&&(0,l.f)(O)?(0,d.GP)(O,"yyyy-MM-dd"):"",placeholder:"Select Start Date",readOnly:!0,className:"pr-10",onClick:()=>H(!q)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>H(!q)}),q&&(0,s.jsx)(x.hv,{mode:"single",selected:O,onSelect:e=>{G(e),H(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Date of Completion"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:U&&(0,l.f)(null!=U?U:new Date)?(0,d.GP)(U,"yyyy-MM-dd"):"",placeholder:"Select End Date",readOnly:!0,className:"pr-10",onClick:()=>$(!W)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>$(!W)}),W&&(0,s.jsx)(x.hv,{mode:"single",selected:U,onSelect:e=>{B(e),$(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]})]}),(0,s.jsxs)("div",{className:"flex gap-4 mt-10",children:[(0,s.jsx)(i.$,{onClick:X,className:"bg-red-600 hover:bg-red-700",children:t?"Update Letter":"Submit"}),(0,s.jsx)(i.$,{variant:"outline",onClick:()=>f.back(),children:"Cancel"})]})]})]})]})}},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var s=a(3463),r=a(9795);function l(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[478,251,501,651,941,599,441,587,358],()=>t(6116)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[844],{745:(e,t,a)=>{"use strict";a.d(t,{bq:()=>u,eb:()=>p,gC:()=>m,l6:()=>c,yv:()=>d});var s=a(5155);a(2115);var r=a(1149),l=a(1719),n=a(8867),i=a(1902),o=a(9602);function c(e){let{...t}=e;return(0,s.jsx)(r.bL,{"data-slot":"select",...t})}function d(e){let{...t}=e;return(0,s.jsx)(r.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,children:a,...n}=e;return(0,s.jsxs)(r.l9,{"data-slot":"select-trigger",className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[a,(0,s.jsx)(r.In,{asChild:!0,children:(0,s.jsx)(l.A,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:a,position:l="popper",...n}=e;return(0,s.jsx)(r.ZL,{children:(0,s.jsxs)(r.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...n,children:[(0,s.jsx)(x,{}),(0,s.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,s.jsx)(h,{})]})})}function p(e){let{className:t,children:a,...l}=e;return(0,s.jsxs)(r.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...l,children:[(0,s.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,s.jsx)(r.VF,{children:(0,s.jsx)(n.A,{className:"size-4"})})}),(0,s.jsx)(r.p4,{children:a})]})}function x(e){let{className:t,...a}=e;return(0,s.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(i.A,{className:"size-4"})})}function h(e){let{className:t,...a}=e;return(0,s.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(l.A,{className:"size-4"})})}},2336:(e,t,a)=>{"use strict";a.d(t,{p:()=>l});var s=a(5155);a(2115);var r=a(9602);function l(e){let{className:t,type:a,...l}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("border-input file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>o});var s=a(5155);a(2115);var r=a(2317),l=a(1027),n=a(9602);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:a,size:l,asChild:o=!1,...c}=e,d=o?r.DX:"button";return(0,s.jsx)(d,{"data-slot":"button",className:(0,n.cn)(i({variant:a,size:l,className:t})),...c})}},6116:(e,t,a)=>{Promise.resolve().then(a.bind(a,7951))},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>i,AuthProvider:()=>n});var s=a(5155),r=a(2115);let l=(0,r.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&n(t.name)}},[]),(0,s.jsx)(l.Provider,{value:{username:a,setUsername:n,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),n("")}},children:t})}function i(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7951:(e,t,a)=>{"use strict";a.d(t,{default:()=>g});var s=a(5155),r=a(2115),l=a(125),n=a(2336),i=a(4085),o=a(2651),c=a(745),d=a(7006),u=a(1466),m=a(5236),p=a(2423),x=a(9348);a(6871);var h=a(6046),v=a(6868);function g(){let e=(0,h.useSearchParams)(),[t,a]=(0,r.useState)(!1),[g,b]=(0,r.useState)(null),f=(0,h.useRouter)(),{username:j}=(0,v.A)(),[y,w]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[_,S]=(0,r.useState)(""),[C,A]=(0,r.useState)(""),[z,P]=(0,r.useState)(""),[E,L]=(0,r.useState)(""),[M,I]=(0,r.useState)(!1),[T,D]=(0,r.useState)(""),[O,G]=(0,r.useState)(),[U,B]=(0,r.useState)(),[q,H]=(0,r.useState)(!1),[W,$]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[V,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=e.get("edit");if(t)try{var s,r,l,n;let e=JSON.parse(t);a(!0),b(e.id),k(e.nomor_surat_acceptance),P(null!==(r=e.nomor_induk_mahasiswa)&&void 0!==r?r:""),G(new Date(e.start_date)),B(new Date(e.completion_date)),w(null!==(l=null===(s=e.letter_scope)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:""),S(null!==(n=e.address_to)&&void 0!==n?n:""),L(e.program_studi_mahasiswa),D(e.tahun_ajaran),A(e.nama_mahasiswa)}catch(e){console.error("Failed to parse edit param:",e)}},[e]),(0,r.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||R(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||J(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]);let X=async()=>{if(!y||!N||!_||!C||!z||!E||!T||!O||!U){alert("Please fill in all the required fields.");return}let e=N.padStart(3,"0"),a=(0,d.GP)(new Date,"dd.MM.yyyy"),s={nama_mahasiswa:C,letter_scope:y,nomor_surat_acceptance:t?N:"HUMIC/".concat("INTERNAL"===y.toUpperCase()?"INT":"EXT","/").concat(a,"/").concat(e),address_to:_,nomor_induk_mahasiswa:z,program_studi_mahasiswa:E,tahun_ajaran:T,nomor_surat_completion:"",start_date:(0,d.GP)(O,"yyyy-MM-dd"),completion_date:(0,d.GP)(U,"yyyy-MM-dd"),is_acceptance:1,is_completion:0};try{let e;let a=localStorage.getItem("authToken");if(!a){alert("Unauthorized! Please log in.");return}console.log("Submitting data:",s),(e=t?await o.A.put("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(g),s,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}}):await o.A.post("https://cetaksuratkp-api.humicprototyping.net/api/letter",s,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}})).data.success?(console.log("Letter submitted successfully:",e.data),f.push("/letter/acceptanceletter")):alert(e.data.message||"Submission failed")}catch(e){if(console.error("Error submitting letter:",e),o.A.isAxiosError(e)){var r,l,n;console.error("Server response:",null===(r=e.response)||void 0===r?void 0:r.data),alert("Error: ".concat((null===(l=e.response)||void 0===l?void 0:l.data.message)||JSON.stringify(null===(n=e.response)||void 0===n?void 0:n.data)))}else alert("Error submitting letter. Please try again later.")}};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,s.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,s.jsxs)("div",{className:"flex space-x-8",children:[(0,s.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium",children:"Home"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"letter-button",onClick:()=>R(!V),className:"text-[#B4262A] border-b-2 border-[#B4262A]",children:"Letter"}),V&&(0,s.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,s.jsx)("button",{onClick:()=>f.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,s.jsx)("button",{onClick:()=>f.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"profile-button",onClick:()=>J(!F),className:"text-gray-700 hover:text-black",children:(0,s.jsx)(u.A,{})}),F&&(0,s.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,s.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,s.jsx)("p",{className:"font-semibold",children:j||"Guest"})}),(0,s.jsxs)("button",{onClick:async()=>{I(!0),await new Promise(e=>setTimeout(e,1e3)),I(!1),f.push("/login")},disabled:M,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[M?(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,s.jsx)(m.A,{className:"mr-2",size:18}),M?"Logging out...":"Log Out"]})]})]})]}),(0,s.jsxs)("div",{className:"px-20 py-10",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-black mb-8",children:t?"Update Practical Work Letter":"Apply Practical Work Letter"}),(0,s.jsxs)("div",{className:"bg-white rounded-lg p-8 shadow-md",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Scope"}),(0,s.jsxs)(c.l6,{value:y,onValueChange:w,disabled:t,children:[(0,s.jsx)(c.bq,{className:"w-full",children:(0,s.jsx)(c.yv,{placeholder:"Select..."})}),(0,s.jsxs)(c.gC,{children:[(0,s.jsx)(c.eb,{value:"internal",children:"Internal"}),(0,s.jsx)(c.eb,{value:"external",children:"External"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Number"}),(0,s.jsx)(n.p,{value:null!=N?N:"",onChange:e=>k(e.target.value),disabled:t})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Addressed To"}),(0,s.jsx)(n.p,{value:null!=_?_:"",onChange:e=>S(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Name"}),(0,s.jsx)(n.p,{value:null!=C?C:"",onChange:e=>A(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Identification Number (NIM)"}),(0,s.jsx)(n.p,{value:null!=z?z:"",onChange:e=>P(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Study Program"}),(0,s.jsx)(n.p,{value:null!=E?E:"",onChange:e=>L(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Academic Year"}),(0,s.jsx)(n.p,{value:null!=T?T:"",placeholder:"e.g. Genap 2022/2023",onChange:e=>D(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Starting Date"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:O&&(0,l.f)(O)?(0,d.GP)(O,"yyyy-MM-dd"):"",placeholder:"Select Start Date",readOnly:!0,className:"pr-10",onClick:()=>H(!q)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>H(!q)}),q&&(0,s.jsx)(x.hv,{mode:"single",selected:O,onSelect:e=>{G(e),H(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Date of Completion"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:U&&(0,l.f)(null!=U?U:new Date)?(0,d.GP)(U,"yyyy-MM-dd"):"",placeholder:"Select End Date",readOnly:!0,className:"pr-10",onClick:()=>$(!W)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>$(!W)}),W&&(0,s.jsx)(x.hv,{mode:"single",selected:U,onSelect:e=>{B(e),$(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]})]}),(0,s.jsxs)("div",{className:"flex gap-4 mt-10",children:[(0,s.jsx)(i.$,{onClick:X,className:"bg-red-600 hover:bg-red-700",children:t?"Update Letter":"Submit"}),(0,s.jsx)(i.$,{variant:"outline",onClick:()=>f.back(),children:"Cancel"})]})]})]})]})}},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var s=a(3463),r=a(9795);function l(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[478,251,501,651,941,599,441,587,358],()=>t(6116)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/acceptanceletter/page-f5aeb68c5b1400de.js b/_next/static/chunks/app/letter/acceptanceletter/page-f5aeb68c5b1400de.js index 9c9deb6..78e8601 100644 --- a/_next/static/chunks/app/letter/acceptanceletter/page-f5aeb68c5b1400de.js +++ b/_next/static/chunks/app/letter/acceptanceletter/page-f5aeb68c5b1400de.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[223],{1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},2060:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},2598:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6659:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>n,AuthProvider:()=>c});var a=s(5155),r=s(2115);let l=(0,r.createContext)(void 0);function c(e){let{children:t}=e,[s,c]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&c(t.name)}},[]),(0,a.jsx)(l.Provider,{value:{username:s,setUsername:c,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),c("")}},children:t})}function n(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7325:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(5155),r=s(2115),l=s(6868),c=s(6046),n=s(2651),i=s(1466),o=s(5236),d=s(2060),x=s(6659),h=s(2598),m=s(8491),u=s(9993);function p(){let[e,t]=(0,r.useState)(""),s=(0,c.useRouter)(),{username:p}=(0,l.A)(),[b,y]=(0,r.useState)(1),[j,g]=(0,r.useState)([]),[f,N]=(0,r.useState)([]),[v,w]=(0,r.useState)(!1),[k,A]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[_,L]=(0,r.useState)(!1),[z,M]=(0,r.useState)(null),[E,P]=(0,r.useState)(null),[D,I]=(0,r.useState)(!1),O=e=>{P(e),I(!0)};(0,r.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),t=(await n.A.get("https://cetaksuratkp-api.humicprototyping.com/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}})).data.data;console.log("Raw data:",t);let s=t.filter(e=>(console.log("letter object:",e),console.log("is_acceptance:",e.is_acceptance),1==e.is_acceptance));console.log("Filtered data:",s),g(s)}catch(e){console.error("Error fetching completion letters:",e)}})()},[]),(0,r.useEffect)(()=>{""===e.trim()?N(j):N(j.filter(t=>{var s,a,r,l;let c=null!==(r=null===(s=t.nomor_induk_mahasiswa)||void 0===s?void 0:s.toLowerCase())&&void 0!==r?r:"",n=null!==(l=null===(a=t.nomor_surat_acceptance)||void 0===a?void 0:a.toLowerCase())&&void 0!==l?l:"",i=e.toLowerCase(),o=c.includes(i),d=n.includes(i);return o||d}))},[j,e]);let B=e=>{M(e),L(!0)},H=async e=>{try{let t=localStorage.getItem("authToken");await n.A.delete("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(e.id),{headers:{Authorization:"Bearer ".concat(t),Accept:"application/json"}});let s=j.filter(t=>t.id!==e.id);g(s),localStorage.setItem("acceptanceLetters",JSON.stringify(s)),console.log("Deleted successfully")}catch(e){console.error("Failed to delete letter:",e),alert("Failed to delete letter. Please try again.")}finally{L(!1),M(null)}},T=e=>{console.log(e),s.push("/letter/acceptanceletter/applyLetter?edit=".concat(JSON.stringify(e)))},V=Math.ceil(f.length/5),F=(b-1)*5,R=f.slice(F,F+5);return(0,a.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,a.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-8",children:[(0,a.jsx)("img",{src:"/logo-humic-text.png",alt:"Logo",className:"h-12 mr-3"}),(0,a.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Home"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>S(!C),className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A] cursor-pointer transition duration-300",children:"Letter"}),C&&(0,a.jsxs)("div",{className:"absolute mt-2 bg-white shadow rounded w-48 z-10",children:[(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Acceptance Letter"}),(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Completion Letter"})]})]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>w(!v),children:(0,a.jsx)(i.A,{})}),v&&(0,a.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg z-50",children:[(0,a.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,a.jsx)("p",{className:"font-semibold",children:p||"Guest"})}),(0,a.jsxs)("button",{onClick:async()=>{A(!0),await new Promise(e=>setTimeout(e,1e3)),A(!1),s.push("/login")},disabled:k,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[k?(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",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-8v8H4z"})]}):(0,a.jsx)(o.A,{className:"mr-2",size:18}),k?"Logging out...":"Log Out"]})]})]})]}),(0,a.jsxs)("div",{className:"px-4 md:px-20 py-10",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-black mb-1",children:"Practical Work Acceptance Letter"}),(0,a.jsx)("p",{className:"text-gray-500 mb-6",children:"Kelola surat penerimaan kerja praktik mahasiswa"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4",children:[(0,a.jsxs)("button",{onClick:()=>s.push("/letter/acceptanceletter/applyLetter"),className:"bg-red-600 text-white px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(d.A,{size:18})," Apply letter"]}),(0,a.jsxs)("button",{onClick:()=>s.push("/letter/acceptanceletter/viewTemplate"),className:"bg-white text-black border px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(x.A,{size:18})," View template"]}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:e,onChange:e=>t(e.target.value),className:"border px-4 py-2 rounded-md text-sm w-full max-w-xs"})]}),(0,a.jsxs)("div",{className:"bg-white p-6 rounded shadow overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-sm text-left border",children:[(0,a.jsx)("thead",{className:"bg-gray-100 text-black",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-2 px-4",children:"Submission Date"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"Letter Number"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"NIM"}),(0,a.jsx)("th",{className:"py-2 px-4 text-center",children:"Action"})]})}),(0,a.jsx)("tbody",{children:R.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t",children:[(0,a.jsx)("td",{className:"py-2 px-4",children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_surat_acceptance}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_induk_mahasiswa}),(0,a.jsx)("td",{className:"py-2 px-4 text-center",children:(0,a.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>O(e),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-md",children:(0,a.jsx)(h.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:()=>T(e),className:"p-2 rounded bg-gray-100 hover:bg-gray-200",children:(0,a.jsx)(m.A,{size:16})}),(0,a.jsx)("button",{onClick:()=>B(e),className:"p-2 rounded bg-red-100 hover:bg-red-200 text-red-600",children:(0,a.jsx)(u.A,{size:16})})]})})]},t))})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center px-4 py-4 text-sm",children:[(0,a.jsxs)("span",{children:["Showing ",F+1," to"," ",Math.min(F+5,f.length)," of"," ",f.length," entries"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>y(e=>Math.max(1,e-1)),disabled:1===b,className:"px-2 py-1 border rounded ".concat(1===b?"text-gray-400":""),children:"← Previous"}),[...Array(V)].map((e,t)=>(0,a.jsx)("button",{onClick:()=>y(t+1),className:"px-3 py-1 border rounded ".concat(b===t+1?"bg-red-600 text-white":""),children:t+1},t)),(0,a.jsx)("button",{onClick:()=>y(e=>Math.min(V,e+1)),disabled:b===V,className:"px-2 py-1 border rounded ".concat(b===V?"text-gray-400":""),children:"Next →"})]})]})]})]}),_&&z&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[400px]",children:[(0,a.jsx)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Delete Confirmation"})}),(0,a.jsx)("div",{className:"px-6 py-4 text-sm text-black",children:(0,a.jsx)("p",{children:"Are you sure you want to delete this letter?"})}),(0,a.jsxs)("div",{className:"px-6 py-4 border-t flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>L(!1),className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>H(z),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Delete"})]})]})}),D&&E&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[600px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:[(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Letter Details"}),(0,a.jsx)("button",{onClick:()=>I(!1),className:"text-gray-500 hover:text-red-600",children:"✕"})]}),(0,a.jsxs)("div",{className:"px-6 py-4 space-y-2 text-sm text-black",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Letter Number"}),(0,a.jsx)("span",{children:E.nomor_surat_acceptance})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Name"}),(0,a.jsx)("span",{children:E.nama_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Identification Number"}),(0,a.jsx)("span",{children:E.nomor_induk_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Study Program"}),(0,a.jsx)("span",{children:E.program_studi_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Academic Year"}),(0,a.jsx)("span",{children:E.tahun_ajaran})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Starting Date"}),(0,a.jsx)("span",{children:E.start_date})]})]}),(0,a.jsx)("div",{className:"px-6 py-4 border-t flex justify-end",children:(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter/showLetter?id=".concat(E.id)),className:"bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 text-sm",children:"Show Letter"})})]})})]})}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var a=s(2115);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:x,...h}=e;return(0,a.createElement)("svg",{ref:t,...c,width:r,height:r,stroke:s,strokeWidth:i?24*Number(n)/Number(r):n,className:l("lucide",o),...h},[...x.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let s=(0,a.forwardRef)((s,c)=>{let{className:i,...o}=s;return(0,a.createElement)(n,{ref:c,iconNode:t,className:l("lucide-".concat(r(e)),i),...o})});return s.displayName="".concat(e),s}},8491:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},9811:(e,t,s)=>{Promise.resolve().then(s.bind(s,7325))},9993:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(9811)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[223],{1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},2060:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},2598:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6659:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>n,AuthProvider:()=>c});var a=s(5155),r=s(2115);let l=(0,r.createContext)(void 0);function c(e){let{children:t}=e,[s,c]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&c(t.name)}},[]),(0,a.jsx)(l.Provider,{value:{username:s,setUsername:c,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),c("")}},children:t})}function n(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7325:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(5155),r=s(2115),l=s(6868),c=s(6046),n=s(2651),i=s(1466),o=s(5236),d=s(2060),x=s(6659),h=s(2598),m=s(8491),u=s(9993);function p(){let[e,t]=(0,r.useState)(""),s=(0,c.useRouter)(),{username:p}=(0,l.A)(),[b,y]=(0,r.useState)(1),[j,g]=(0,r.useState)([]),[f,N]=(0,r.useState)([]),[v,w]=(0,r.useState)(!1),[k,A]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[_,L]=(0,r.useState)(!1),[z,M]=(0,r.useState)(null),[E,P]=(0,r.useState)(null),[D,I]=(0,r.useState)(!1),O=e=>{P(e),I(!0)};(0,r.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),t=(await n.A.get("https://cetaksuratkp-api.humicprototyping.net/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}})).data.data;console.log("Raw data:",t);let s=t.filter(e=>(console.log("letter object:",e),console.log("is_acceptance:",e.is_acceptance),1==e.is_acceptance));console.log("Filtered data:",s),g(s)}catch(e){console.error("Error fetching completion letters:",e)}})()},[]),(0,r.useEffect)(()=>{""===e.trim()?N(j):N(j.filter(t=>{var s,a,r,l;let c=null!==(r=null===(s=t.nomor_induk_mahasiswa)||void 0===s?void 0:s.toLowerCase())&&void 0!==r?r:"",n=null!==(l=null===(a=t.nomor_surat_acceptance)||void 0===a?void 0:a.toLowerCase())&&void 0!==l?l:"",i=e.toLowerCase(),o=c.includes(i),d=n.includes(i);return o||d}))},[j,e]);let B=e=>{M(e),L(!0)},H=async e=>{try{let t=localStorage.getItem("authToken");await n.A.delete("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(e.id),{headers:{Authorization:"Bearer ".concat(t),Accept:"application/json"}});let s=j.filter(t=>t.id!==e.id);g(s),localStorage.setItem("acceptanceLetters",JSON.stringify(s)),console.log("Deleted successfully")}catch(e){console.error("Failed to delete letter:",e),alert("Failed to delete letter. Please try again.")}finally{L(!1),M(null)}},T=e=>{console.log(e),s.push("/letter/acceptanceletter/applyLetter?edit=".concat(JSON.stringify(e)))},V=Math.ceil(f.length/5),F=(b-1)*5,R=f.slice(F,F+5);return(0,a.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,a.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-8",children:[(0,a.jsx)("img",{src:"/logo-humic-text.png",alt:"Logo",className:"h-12 mr-3"}),(0,a.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Home"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>S(!C),className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A] cursor-pointer transition duration-300",children:"Letter"}),C&&(0,a.jsxs)("div",{className:"absolute mt-2 bg-white shadow rounded w-48 z-10",children:[(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Acceptance Letter"}),(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Completion Letter"})]})]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>w(!v),children:(0,a.jsx)(i.A,{})}),v&&(0,a.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg z-50",children:[(0,a.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,a.jsx)("p",{className:"font-semibold",children:p||"Guest"})}),(0,a.jsxs)("button",{onClick:async()=>{A(!0),await new Promise(e=>setTimeout(e,1e3)),A(!1),s.push("/login")},disabled:k,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[k?(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",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-8v8H4z"})]}):(0,a.jsx)(o.A,{className:"mr-2",size:18}),k?"Logging out...":"Log Out"]})]})]})]}),(0,a.jsxs)("div",{className:"px-4 md:px-20 py-10",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-black mb-1",children:"Practical Work Acceptance Letter"}),(0,a.jsx)("p",{className:"text-gray-500 mb-6",children:"Kelola surat penerimaan kerja praktik mahasiswa"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4",children:[(0,a.jsxs)("button",{onClick:()=>s.push("/letter/acceptanceletter/applyLetter"),className:"bg-red-600 text-white px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(d.A,{size:18})," Apply letter"]}),(0,a.jsxs)("button",{onClick:()=>s.push("/letter/acceptanceletter/viewTemplate"),className:"bg-white text-black border px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(x.A,{size:18})," View template"]}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:e,onChange:e=>t(e.target.value),className:"border px-4 py-2 rounded-md text-sm w-full max-w-xs"})]}),(0,a.jsxs)("div",{className:"bg-white p-6 rounded shadow overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-sm text-left border",children:[(0,a.jsx)("thead",{className:"bg-gray-100 text-black",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-2 px-4",children:"Submission Date"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"Letter Number"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"NIM"}),(0,a.jsx)("th",{className:"py-2 px-4 text-center",children:"Action"})]})}),(0,a.jsx)("tbody",{children:R.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t",children:[(0,a.jsx)("td",{className:"py-2 px-4",children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_surat_acceptance}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_induk_mahasiswa}),(0,a.jsx)("td",{className:"py-2 px-4 text-center",children:(0,a.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>O(e),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-md",children:(0,a.jsx)(h.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:()=>T(e),className:"p-2 rounded bg-gray-100 hover:bg-gray-200",children:(0,a.jsx)(m.A,{size:16})}),(0,a.jsx)("button",{onClick:()=>B(e),className:"p-2 rounded bg-red-100 hover:bg-red-200 text-red-600",children:(0,a.jsx)(u.A,{size:16})})]})})]},t))})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center px-4 py-4 text-sm",children:[(0,a.jsxs)("span",{children:["Showing ",F+1," to"," ",Math.min(F+5,f.length)," of"," ",f.length," entries"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>y(e=>Math.max(1,e-1)),disabled:1===b,className:"px-2 py-1 border rounded ".concat(1===b?"text-gray-400":""),children:"← Previous"}),[...Array(V)].map((e,t)=>(0,a.jsx)("button",{onClick:()=>y(t+1),className:"px-3 py-1 border rounded ".concat(b===t+1?"bg-red-600 text-white":""),children:t+1},t)),(0,a.jsx)("button",{onClick:()=>y(e=>Math.min(V,e+1)),disabled:b===V,className:"px-2 py-1 border rounded ".concat(b===V?"text-gray-400":""),children:"Next →"})]})]})]})]}),_&&z&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[400px]",children:[(0,a.jsx)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Delete Confirmation"})}),(0,a.jsx)("div",{className:"px-6 py-4 text-sm text-black",children:(0,a.jsx)("p",{children:"Are you sure you want to delete this letter?"})}),(0,a.jsxs)("div",{className:"px-6 py-4 border-t flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>L(!1),className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>H(z),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Delete"})]})]})}),D&&E&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[600px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:[(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Letter Details"}),(0,a.jsx)("button",{onClick:()=>I(!1),className:"text-gray-500 hover:text-red-600",children:"✕"})]}),(0,a.jsxs)("div",{className:"px-6 py-4 space-y-2 text-sm text-black",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Letter Number"}),(0,a.jsx)("span",{children:E.nomor_surat_acceptance})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Name"}),(0,a.jsx)("span",{children:E.nama_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Identification Number"}),(0,a.jsx)("span",{children:E.nomor_induk_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Study Program"}),(0,a.jsx)("span",{children:E.program_studi_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Academic Year"}),(0,a.jsx)("span",{children:E.tahun_ajaran})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Starting Date"}),(0,a.jsx)("span",{children:E.start_date})]})]}),(0,a.jsx)("div",{className:"px-6 py-4 border-t flex justify-end",children:(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter/showLetter?id=".concat(E.id)),className:"bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 text-sm",children:"Show Letter"})})]})})]})}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var a=s(2115);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:x,...h}=e;return(0,a.createElement)("svg",{ref:t,...c,width:r,height:r,stroke:s,strokeWidth:i?24*Number(n)/Number(r):n,className:l("lucide",o),...h},[...x.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let s=(0,a.forwardRef)((s,c)=>{let{className:i,...o}=s;return(0,a.createElement)(n,{ref:c,iconNode:t,className:l("lucide-".concat(r(e)),i),...o})});return s.displayName="".concat(e),s}},8491:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},9811:(e,t,s)=>{Promise.resolve().then(s.bind(s,7325))},9993:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(9811)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/acceptanceletter/showLetter/page-cb403df05e9540cc.js b/_next/static/chunks/app/letter/acceptanceletter/showLetter/page-cb403df05e9540cc.js index 57ee316..382bca6 100644 --- a/_next/static/chunks/app/letter/acceptanceletter/showLetter/page-cb403df05e9540cc.js +++ b/_next/static/chunks/app/letter/acceptanceletter/showLetter/page-cb403df05e9540cc.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[822],{477:()=>{},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>l});var r=a(5155);a(2115);var s=a(2317),n=a(1027),i=a(9602);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:a,size:n,asChild:l=!1,...c}=e,d=l?s.DX:"button";return(0,r.jsx)(d,{"data-slot":"button",className:(0,i.cn)(o({variant:a,size:n,className:t})),...c})}},9345:(e,t,a)=>{Promise.resolve().then(a.bind(a,9966))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>n});var r=a(3463),s=a(9795);function n(){for(var e=arguments.length,t=Array(e),a=0;a{"use strict";a.d(t,{default:()=>_});var r=a(5155),s=a(6046),n=a(7711),i=a(2115),o=a(7006),l=a(7364),c=a(4085);function d(){let e=(0,s.useRouter)();return(0,r.jsxs)(c.$,{onClick:()=>e.push("/letter/acceptanceletter"),className:"bg-white text-black border border-gray-300 flex items-center gap-2",children:[(0,r.jsx)(l.A,{size:16})," Back"]})}var h=a(4003),m=a(4857);let{pdf:u}=a(4003),g=(0,n.default)(()=>Promise.resolve().then(a.bind(a,4003)).then(e=>e.PDFViewer),{loadableGenerated:{webpack:()=>[4003]},ssr:!1}),x=h.StyleSheet.create({page:{padding:40,fontSize:11,fontFamily:"Calibri"},bold:{fontFamily:"Calibri",fontWeight:"bold"},section:{marginBottom:10},footer:{position:"absolute",bottom:0,left:0,right:0,textAlign:"center",fontSize:10,fontFamily:"Calibri"},paragraph:{marginBottom:6,lineHeight:1.6,fontSize:11,fontFamily:"Calibri"},right:{textAlign:"right"},line:{flexDirection:"row",marginBottom:2},label:{width:100}});function p(e){let{nomor_surat_acceptance:t,nama_mahasiswa:a,nomor_induk_mahasiswa:s,program_studi_mahasiswa:n,start_date:i,address_to:o,completion_date:l,tahun_ajaran:c,created_at:d}=e;return(0,r.jsx)(h.Document,{children:(0,r.jsxs)(h.Page,{size:"A4",style:x.page,children:[(0,r.jsxs)(h.View,{style:{flexDirection:"row",alignItems:"center",marginBottom:10},children:[(0,r.jsx)(h.Image,{src:"/assets/logo-humic-surat.jpg",style:{width:90,height:90}}),(0,r.jsxs)(h.View,{style:{marginLeft:10,flex:1,marginBottom:10},children:[(0,r.jsxs)(h.Text,{style:{fontSize:18,fontWeight:"bold",fontFamily:"Times-Roman",textAlign:"center"},children:["Pusat Penelitian HUMIC Engineering","\n","Universitas Telkom"]}),(0,r.jsxs)(h.Text,{style:{fontSize:10,textAlign:"center",marginTop:7,fontFamily:"Times-Roman"},children:["Jl. Telekomunikasi Terusan Buah Batu, Bandung 40257, Jawa Barat, Indonesia","\n","Telp/Faks: +6281321397936 / +6222-70658638 / +6222-7565931"]})]})]}),(0,r.jsx)(h.View,{style:{borderBottomWidth:2,borderColor:"#000",marginBottom:10,width:"100%"}}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Nomor"}),(0,r.jsxs)(h.Text,{children:[": ",t]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Lampiran"}),(0,r.jsx)(h.Text,{children:": -"})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Perihal"}),(0,r.jsx)(h.Text,{children:": Surat Penerimaan Kerja Praktek"})]})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsx)(h.Text,{children:"Kepada Yth."}),(0,r.jsx)(h.Text,{children:o}),(0,r.jsx)(h.Text,{children:"di Tempat"})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsx)(h.Text,{style:x.paragraph,children:"Dengan hormat,"}),(0,r.jsx)(h.Text,{style:x.paragraph,children:"Sehubungan dengan pengajuan kerja praktek di CoE Humic Engineering yang telah diajukan oleh mahasiswa atas nama:"})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Nama"}),(0,r.jsxs)(h.Text,{children:[": ",a]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"NIM"}),(0,r.jsxs)(h.Text,{children:[": ",s]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Prodi"}),(0,r.jsxs)(h.Text,{children:[": ",n]})]})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.Text,{style:[x.paragraph,{marginTop:20}],children:["Dengan ini kami menyatakan bahwa mahasiswa yang bersangkutan"," ",(0,r.jsx)(h.Text,{style:x.bold,children:"DITERIMA"})," untuk melaksanakan Kerja Praktek di CoE Human Centric Engineering, Telkom University. Kegiatan ini dihitung pada ",i," s.d. ",l," ","periode Tahun Ajaran ",c,"."]}),(0,r.jsx)(h.Text,{style:x.paragraph,children:"Demikian surat keterangan ini kami buat agar dapat dipergunakan sebagaimana mestinya."})]}),(0,r.jsxs)(h.View,{style:[x.section],children:[(0,r.jsxs)(h.Text,{children:["Bandung, ",d]}),(0,r.jsx)(h.Image,{src:"/assets/ttd.png",style:{width:100,height:50}}),(0,r.jsx)(h.Text,{style:{textDecoration:"underline"},children:"Assoc. Prof. Dr. Satria Mandal"}),(0,r.jsx)(h.Text,{children:"Direktur CoE HUMIC Engineering"})]}),(0,r.jsx)(h.View,{style:x.footer,children:(0,r.jsx)(h.Image,{src:"/assets/footer.jpg",style:{width:"100%"}})})]})})}function _(){let e=(0,s.useSearchParams)();(0,s.useRouter)();let t=e.get("id"),[a,n]=(0,i.useState)(null),[l,h]=(0,i.useState)(!0),[x,_]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=async()=>{try{let e=localStorage.getItem("authToken"),a=await fetch("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(t),{headers:{Accept:"application/json",Authorization:"Bearer ".concat(e)}});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error("API Error ".concat(a.status,": ").concat(e.message||a.statusText))}let r=await a.json();console.log("Fetched Data:",r),n(r.data)}catch(e){e instanceof Error?(_(e.message),console.error("API Error:",e)):_("An unknown error occurred")}finally{h(!1)}};t&&e()},[t]);let j=e=>{try{return(0,o.GP)(new Date(e),"dd MMMM yyyy")}catch(e){return console.error("Error formatting date:",e),"-"}};if(x)return(0,r.jsxs)("div",{children:["Error: ",x]});if(!a)return(0,r.jsx)("div",{children:"No letter data found"});console.log("Acceptance Letter Data:",{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",address_to:a.address_to||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",created_at:a.created_at?j(a.created_at):"-"});let f=async()=>{let e=await u((0,r.jsx)(p,{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",address_to:a.address_to||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",tanggalSurat:a.created_at?j(a.created_at):"-"})).toBlob(),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="Surat-Penerimaan-".concat(a.nama_mahasiswa||"unknown",".pdf"),s.click(),URL.revokeObjectURL(t)};return(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100 px-10 py-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,r.jsx)(d,{}),(0,r.jsxs)(c.$,{onClick:f,className:"bg-red-600 text-white flex items-center gap-2",children:[(0,r.jsx)(m.A,{size:16})," Download PDF"]})]}),(0,r.jsx)(g,{width:"100%",height:"1000",children:(0,r.jsx)(p,{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",created_at:a.created_at?j(a.created_at):"-",address_to:a.address_to||"-"})})]})}h.Font.register({family:"Calibri",fonts:[{src:"/fonts/CALIBRI.TTF"},{src:"/fonts/CALIBRIB.TTF",fontWeight:"bold"}]}),h.Font.register({family:"Times-Roman",fonts:[{src:"/fonts/times/TIMES.TTF"},{src:"/fonts/times/TIMESBD.TTF",fontWeight:"bold"}]})}},e=>{var t=t=>e(e.s=t);e.O(0,[792,247,788,746,251,501,941,186,441,587,358],()=>t(9345)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[822],{477:()=>{},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>l});var r=a(5155);a(2115);var s=a(2317),n=a(1027),i=a(9602);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:a,size:n,asChild:l=!1,...c}=e,d=l?s.DX:"button";return(0,r.jsx)(d,{"data-slot":"button",className:(0,i.cn)(o({variant:a,size:n,className:t})),...c})}},9345:(e,t,a)=>{Promise.resolve().then(a.bind(a,9966))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>n});var r=a(3463),s=a(9795);function n(){for(var e=arguments.length,t=Array(e),a=0;a{"use strict";a.d(t,{default:()=>_});var r=a(5155),s=a(6046),n=a(7711),i=a(2115),o=a(7006),l=a(7364),c=a(4085);function d(){let e=(0,s.useRouter)();return(0,r.jsxs)(c.$,{onClick:()=>e.push("/letter/acceptanceletter"),className:"bg-white text-black border border-gray-300 flex items-center gap-2",children:[(0,r.jsx)(l.A,{size:16})," Back"]})}var h=a(4003),m=a(4857);let{pdf:u}=a(4003),g=(0,n.default)(()=>Promise.resolve().then(a.bind(a,4003)).then(e=>e.PDFViewer),{loadableGenerated:{webpack:()=>[4003]},ssr:!1}),x=h.StyleSheet.create({page:{padding:40,fontSize:11,fontFamily:"Calibri"},bold:{fontFamily:"Calibri",fontWeight:"bold"},section:{marginBottom:10},footer:{position:"absolute",bottom:0,left:0,right:0,textAlign:"center",fontSize:10,fontFamily:"Calibri"},paragraph:{marginBottom:6,lineHeight:1.6,fontSize:11,fontFamily:"Calibri"},right:{textAlign:"right"},line:{flexDirection:"row",marginBottom:2},label:{width:100}});function p(e){let{nomor_surat_acceptance:t,nama_mahasiswa:a,nomor_induk_mahasiswa:s,program_studi_mahasiswa:n,start_date:i,address_to:o,completion_date:l,tahun_ajaran:c,created_at:d}=e;return(0,r.jsx)(h.Document,{children:(0,r.jsxs)(h.Page,{size:"A4",style:x.page,children:[(0,r.jsxs)(h.View,{style:{flexDirection:"row",alignItems:"center",marginBottom:10},children:[(0,r.jsx)(h.Image,{src:"/assets/logo-humic-surat.jpg",style:{width:90,height:90}}),(0,r.jsxs)(h.View,{style:{marginLeft:10,flex:1,marginBottom:10},children:[(0,r.jsxs)(h.Text,{style:{fontSize:18,fontWeight:"bold",fontFamily:"Times-Roman",textAlign:"center"},children:["Pusat Penelitian HUMIC Engineering","\n","Universitas Telkom"]}),(0,r.jsxs)(h.Text,{style:{fontSize:10,textAlign:"center",marginTop:7,fontFamily:"Times-Roman"},children:["Jl. Telekomunikasi Terusan Buah Batu, Bandung 40257, Jawa Barat, Indonesia","\n","Telp/Faks: +6281321397936 / +6222-70658638 / +6222-7565931"]})]})]}),(0,r.jsx)(h.View,{style:{borderBottomWidth:2,borderColor:"#000",marginBottom:10,width:"100%"}}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Nomor"}),(0,r.jsxs)(h.Text,{children:[": ",t]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Lampiran"}),(0,r.jsx)(h.Text,{children:": -"})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Perihal"}),(0,r.jsx)(h.Text,{children:": Surat Penerimaan Kerja Praktek"})]})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsx)(h.Text,{children:"Kepada Yth."}),(0,r.jsx)(h.Text,{children:o}),(0,r.jsx)(h.Text,{children:"di Tempat"})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsx)(h.Text,{style:x.paragraph,children:"Dengan hormat,"}),(0,r.jsx)(h.Text,{style:x.paragraph,children:"Sehubungan dengan pengajuan kerja praktek di CoE Humic Engineering yang telah diajukan oleh mahasiswa atas nama:"})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Nama"}),(0,r.jsxs)(h.Text,{children:[": ",a]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"NIM"}),(0,r.jsxs)(h.Text,{children:[": ",s]})]}),(0,r.jsxs)(h.View,{style:x.line,children:[(0,r.jsx)(h.Text,{style:x.label,children:"Prodi"}),(0,r.jsxs)(h.Text,{children:[": ",n]})]})]}),(0,r.jsxs)(h.View,{style:x.section,children:[(0,r.jsxs)(h.Text,{style:[x.paragraph,{marginTop:20}],children:["Dengan ini kami menyatakan bahwa mahasiswa yang bersangkutan"," ",(0,r.jsx)(h.Text,{style:x.bold,children:"DITERIMA"})," untuk melaksanakan Kerja Praktek di CoE Human Centric Engineering, Telkom University. Kegiatan ini dihitung pada ",i," s.d. ",l," ","periode Tahun Ajaran ",c,"."]}),(0,r.jsx)(h.Text,{style:x.paragraph,children:"Demikian surat keterangan ini kami buat agar dapat dipergunakan sebagaimana mestinya."})]}),(0,r.jsxs)(h.View,{style:[x.section],children:[(0,r.jsxs)(h.Text,{children:["Bandung, ",d]}),(0,r.jsx)(h.Image,{src:"/assets/ttd.png",style:{width:100,height:50}}),(0,r.jsx)(h.Text,{style:{textDecoration:"underline"},children:"Assoc. Prof. Dr. Satria Mandal"}),(0,r.jsx)(h.Text,{children:"Direktur CoE HUMIC Engineering"})]}),(0,r.jsx)(h.View,{style:x.footer,children:(0,r.jsx)(h.Image,{src:"/assets/footer.jpg",style:{width:"100%"}})})]})})}function _(){let e=(0,s.useSearchParams)();(0,s.useRouter)();let t=e.get("id"),[a,n]=(0,i.useState)(null),[l,h]=(0,i.useState)(!0),[x,_]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=async()=>{try{let e=localStorage.getItem("authToken"),a=await fetch("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(t),{headers:{Accept:"application/json",Authorization:"Bearer ".concat(e)}});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error("API Error ".concat(a.status,": ").concat(e.message||a.statusText))}let r=await a.json();console.log("Fetched Data:",r),n(r.data)}catch(e){e instanceof Error?(_(e.message),console.error("API Error:",e)):_("An unknown error occurred")}finally{h(!1)}};t&&e()},[t]);let j=e=>{try{return(0,o.GP)(new Date(e),"dd MMMM yyyy")}catch(e){return console.error("Error formatting date:",e),"-"}};if(x)return(0,r.jsxs)("div",{children:["Error: ",x]});if(!a)return(0,r.jsx)("div",{children:"No letter data found"});console.log("Acceptance Letter Data:",{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",address_to:a.address_to||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",created_at:a.created_at?j(a.created_at):"-"});let f=async()=>{let e=await u((0,r.jsx)(p,{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",address_to:a.address_to||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",tanggalSurat:a.created_at?j(a.created_at):"-"})).toBlob(),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="Surat-Penerimaan-".concat(a.nama_mahasiswa||"unknown",".pdf"),s.click(),URL.revokeObjectURL(t)};return(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100 px-10 py-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,r.jsx)(d,{}),(0,r.jsxs)(c.$,{onClick:f,className:"bg-red-600 text-white flex items-center gap-2",children:[(0,r.jsx)(m.A,{size:16})," Download PDF"]})]}),(0,r.jsx)(g,{width:"100%",height:"1000",children:(0,r.jsx)(p,{nomor_surat_acceptance:a.nomor_surat_acceptance||"-",nama_mahasiswa:a.nama_mahasiswa||"-",nomor_induk_mahasiswa:a.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:a.program_studi_mahasiswa||"-",start_date:a.start_date?j(a.start_date):"-",completion_date:a.completion_date?j(a.completion_date):"-",tahun_ajaran:a.tahun_ajaran||"-",created_at:a.created_at?j(a.created_at):"-",address_to:a.address_to||"-"})})]})}h.Font.register({family:"Calibri",fonts:[{src:"/fonts/CALIBRI.TTF"},{src:"/fonts/CALIBRIB.TTF",fontWeight:"bold"}]}),h.Font.register({family:"Times-Roman",fonts:[{src:"/fonts/times/TIMES.TTF"},{src:"/fonts/times/TIMESBD.TTF",fontWeight:"bold"}]})}},e=>{var t=t=>e(e.s=t);e.O(0,[792,247,788,746,251,501,941,186,441,587,358],()=>t(9345)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/completionletter/applyLetter/page-14567199585d9f52.js b/_next/static/chunks/app/letter/completionletter/applyLetter/page-14567199585d9f52.js index 98f6800..1fb8ca4 100644 --- a/_next/static/chunks/app/letter/completionletter/applyLetter/page-14567199585d9f52.js +++ b/_next/static/chunks/app/letter/completionletter/applyLetter/page-14567199585d9f52.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[97],{745:(e,t,a)=>{"use strict";a.d(t,{bq:()=>u,eb:()=>p,gC:()=>m,l6:()=>d,yv:()=>c});var s=a(5155);a(2115);var r=a(1149),l=a(1719),n=a(8867),i=a(1902),o=a(9602);function d(e){let{...t}=e;return(0,s.jsx)(r.bL,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,s.jsx)(r.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,children:a,...n}=e;return(0,s.jsxs)(r.l9,{"data-slot":"select-trigger",className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[a,(0,s.jsx)(r.In,{asChild:!0,children:(0,s.jsx)(l.A,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:a,position:l="popper",...n}=e;return(0,s.jsx)(r.ZL,{children:(0,s.jsxs)(r.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...n,children:[(0,s.jsx)(x,{}),(0,s.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,s.jsx)(h,{})]})})}function p(e){let{className:t,children:a,...l}=e;return(0,s.jsxs)(r.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...l,children:[(0,s.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,s.jsx)(r.VF,{children:(0,s.jsx)(n.A,{className:"size-4"})})}),(0,s.jsx)(r.p4,{children:a})]})}function x(e){let{className:t,...a}=e;return(0,s.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(i.A,{className:"size-4"})})}function h(e){let{className:t,...a}=e;return(0,s.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(l.A,{className:"size-4"})})}},2324:(e,t,a)=>{"use strict";a.d(t,{default:()=>g});var s=a(5155),r=a(2115),l=a(125),n=a(2336),i=a(4085),o=a(2651),d=a(745),c=a(7006),u=a(1466),m=a(5236),p=a(2423),x=a(9348);a(6871);var h=a(6046),v=a(6868);function g(){let e=(0,h.useSearchParams)(),[t,a]=(0,r.useState)(!1),[g,b]=(0,r.useState)(null),f=(0,h.useRouter)(),{username:j}=(0,v.A)(),[y,w]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[_,S]=(0,r.useState)(""),[C,A]=(0,r.useState)(""),[z,E]=(0,r.useState)(""),[L,P]=(0,r.useState)(""),[M,I]=(0,r.useState)(!1),[T,D]=(0,r.useState)(""),[O,G]=(0,r.useState)(),[U,B]=(0,r.useState)(),[q,H]=(0,r.useState)(!1),[W,$]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[V,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=e.get("edit");if(t)try{var s,r,l,n;let e=JSON.parse(t);a(!0),b(e.id),k(e.nomor_surat_completion),E(null!==(r=e.nomor_induk_mahasiswa)&&void 0!==r?r:""),G(new Date(e.start_date)),B(new Date(e.completion_date)),w(null!==(l=null===(s=e.letter_scope)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:""),S(null!==(n=e.address_to)&&void 0!==n?n:""),P(e.program_studi_mahasiswa),D(e.tahun_ajaran),A(e.nama_mahasiswa)}catch(e){console.error("Failed to parse edit param:",e)}},[e]),(0,r.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||R(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||J(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]);let X=async()=>{if(!y||!N||!_||!C||!z||!L||!T||!O||!U){alert("Please fill in all the required fields.");return}let e=N.padStart(3,"0"),a=(0,c.GP)(new Date,"dd.MM.yyyy"),s=t?N:"HUMIC/".concat("INTERNAL"===y.toUpperCase()?"INT":"EXT","/").concat(a,"/").concat(e),r={nama_mahasiswa:C,letter_scope:y,nomor_surat_acceptance:"-",nomor_surat_completion:s,address_to:_,nomor_induk_mahasiswa:z,program_studi_mahasiswa:L,tahun_ajaran:T,start_date:(0,c.GP)(O,"yyyy-MM-dd"),completion_date:(0,c.GP)(U,"yyyy-MM-dd"),is_completion:1,is_acceptance:0};try{let e;let a=localStorage.getItem("authToken");if(!a){alert("Unauthorized! Please log in.");return}console.log("Submitting data:",r),(e=t?await o.A.put("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(g),r,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}}):await o.A.post("https://cetaksuratkp-api.humicprototyping.com/api/letter",r,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}})).data.success?(console.log("Letter submitted successfully:",e.data),f.push("/letter/completionletter")):alert(e.data.message||"Submission failed")}catch(e){if(console.error("Error submitting letter:",e),o.A.isAxiosError(e)){var l,n,i;console.error("Server response:",null===(l=e.response)||void 0===l?void 0:l.data),alert("Error: ".concat((null===(n=e.response)||void 0===n?void 0:n.data.message)||JSON.stringify(null===(i=e.response)||void 0===i?void 0:i.data)))}else alert("Error submitting letter. Please try again later.")}};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,s.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,s.jsxs)("div",{className:"flex space-x-8",children:[(0,s.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium",children:"Home"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"letter-button",onClick:()=>R(!V),className:"text-[#B4262A] border-b-2 border-[#B4262A]",children:"Letter"}),V&&(0,s.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,s.jsx)("button",{onClick:()=>f.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,s.jsx)("button",{onClick:()=>f.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"profile-button",onClick:()=>J(!F),className:"text-gray-700 hover:text-black",children:(0,s.jsx)(u.A,{})}),F&&(0,s.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,s.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,s.jsx)("p",{className:"font-semibold",children:j||"Guest"})}),(0,s.jsxs)("button",{onClick:async()=>{I(!0),await new Promise(e=>setTimeout(e,1e3)),I(!1),f.push("/login")},disabled:M,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[M?(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,s.jsx)(m.A,{className:"mr-2",size:18}),M?"Logging out...":"Log Out"]})]})]})]}),(0,s.jsxs)("div",{className:"px-20 py-10",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-black mb-8",children:t?"Update Completion Work Letter":"Apply Completion Work Letter"}),(0,s.jsxs)("div",{className:"bg-white rounded-lg p-8 shadow-md",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Scope"}),(0,s.jsxs)(d.l6,{value:y,onValueChange:w,disabled:t,children:[(0,s.jsx)(d.bq,{className:"w-full",children:(0,s.jsx)(d.yv,{placeholder:"Select..."})}),(0,s.jsxs)(d.gC,{children:[(0,s.jsx)(d.eb,{value:"internal",children:"Internal"}),(0,s.jsx)(d.eb,{value:"external",children:"External"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Number"}),(0,s.jsx)(n.p,{value:null!=N?N:"",onChange:e=>k(e.target.value),disabled:t})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Addressed To"}),(0,s.jsx)(n.p,{value:null!=_?_:"",onChange:e=>S(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Name"}),(0,s.jsx)(n.p,{value:null!=C?C:"",onChange:e=>A(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Identification Number (NIM)"}),(0,s.jsx)(n.p,{value:null!=z?z:"",onChange:e=>E(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Study Program"}),(0,s.jsx)(n.p,{value:null!=L?L:"",onChange:e=>P(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Academic Year"}),(0,s.jsx)(n.p,{value:null!=T?T:"",placeholder:"e.g. Genap 2022/2023",onChange:e=>D(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Starting Date"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:O&&(0,l.f)(O)?(0,c.GP)(O,"yyyy-MM-dd"):"",placeholder:"Select Start Date",readOnly:!0,className:"pr-10",onClick:()=>H(!q)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>H(!q)}),q&&(0,s.jsx)(x.hv,{mode:"single",selected:O,onSelect:e=>{G(e),H(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Date of Completion"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:U&&(0,l.f)(null!=U?U:new Date)?(0,c.GP)(U,"yyyy-MM-dd"):"",placeholder:"Select End Date",readOnly:!0,className:"pr-10",onClick:()=>$(!W)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>$(!W)}),W&&(0,s.jsx)(x.hv,{mode:"single",selected:U,onSelect:e=>{B(e),$(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]})]}),(0,s.jsxs)("div",{className:"flex gap-4 mt-10",children:[(0,s.jsx)(i.$,{onClick:X,className:"bg-red-600 hover:bg-red-700",children:t?"Update Letter":"Submit"}),(0,s.jsx)(i.$,{variant:"outline",onClick:()=>f.back(),children:"Cancel"})]})]})]})]})}},2336:(e,t,a)=>{"use strict";a.d(t,{p:()=>l});var s=a(5155);a(2115);var r=a(9602);function l(e){let{className:t,type:a,...l}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("border-input file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>o});var s=a(5155);a(2115);var r=a(2317),l=a(1027),n=a(9602);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:a,size:l,asChild:o=!1,...d}=e,c=o?r.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,n.cn)(i({variant:a,size:l,className:t})),...d})}},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>i,AuthProvider:()=>n});var s=a(5155),r=a(2115);let l=(0,r.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&n(t.name)}},[]),(0,s.jsx)(l.Provider,{value:{username:a,setUsername:n,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),n("")}},children:t})}function i(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},8308:(e,t,a)=>{Promise.resolve().then(a.bind(a,2324))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var s=a(3463),r=a(9795);function l(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[478,251,501,651,941,599,441,587,358],()=>t(8308)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[97],{745:(e,t,a)=>{"use strict";a.d(t,{bq:()=>u,eb:()=>p,gC:()=>m,l6:()=>d,yv:()=>c});var s=a(5155);a(2115);var r=a(1149),l=a(1719),n=a(8867),i=a(1902),o=a(9602);function d(e){let{...t}=e;return(0,s.jsx)(r.bL,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,s.jsx)(r.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,children:a,...n}=e;return(0,s.jsxs)(r.l9,{"data-slot":"select-trigger",className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[a,(0,s.jsx)(r.In,{asChild:!0,children:(0,s.jsx)(l.A,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:a,position:l="popper",...n}=e;return(0,s.jsx)(r.ZL,{children:(0,s.jsxs)(r.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...n,children:[(0,s.jsx)(x,{}),(0,s.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,s.jsx)(h,{})]})})}function p(e){let{className:t,children:a,...l}=e;return(0,s.jsxs)(r.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...l,children:[(0,s.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,s.jsx)(r.VF,{children:(0,s.jsx)(n.A,{className:"size-4"})})}),(0,s.jsx)(r.p4,{children:a})]})}function x(e){let{className:t,...a}=e;return(0,s.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(i.A,{className:"size-4"})})}function h(e){let{className:t,...a}=e;return(0,s.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(l.A,{className:"size-4"})})}},2324:(e,t,a)=>{"use strict";a.d(t,{default:()=>g});var s=a(5155),r=a(2115),l=a(125),n=a(2336),i=a(4085),o=a(2651),d=a(745),c=a(7006),u=a(1466),m=a(5236),p=a(2423),x=a(9348);a(6871);var h=a(6046),v=a(6868);function g(){let e=(0,h.useSearchParams)(),[t,a]=(0,r.useState)(!1),[g,b]=(0,r.useState)(null),f=(0,h.useRouter)(),{username:j}=(0,v.A)(),[y,w]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[_,S]=(0,r.useState)(""),[C,A]=(0,r.useState)(""),[z,E]=(0,r.useState)(""),[L,P]=(0,r.useState)(""),[M,I]=(0,r.useState)(!1),[T,D]=(0,r.useState)(""),[O,G]=(0,r.useState)(),[U,B]=(0,r.useState)(),[q,H]=(0,r.useState)(!1),[W,$]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[V,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=e.get("edit");if(t)try{var s,r,l,n;let e=JSON.parse(t);a(!0),b(e.id),k(e.nomor_surat_completion),E(null!==(r=e.nomor_induk_mahasiswa)&&void 0!==r?r:""),G(new Date(e.start_date)),B(new Date(e.completion_date)),w(null!==(l=null===(s=e.letter_scope)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:""),S(null!==(n=e.address_to)&&void 0!==n?n:""),P(e.program_studi_mahasiswa),D(e.tahun_ajaran),A(e.nama_mahasiswa)}catch(e){console.error("Failed to parse edit param:",e)}},[e]),(0,r.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||R(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||J(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]);let X=async()=>{if(!y||!N||!_||!C||!z||!L||!T||!O||!U){alert("Please fill in all the required fields.");return}let e=N.padStart(3,"0"),a=(0,c.GP)(new Date,"dd.MM.yyyy"),s=t?N:"HUMIC/".concat("INTERNAL"===y.toUpperCase()?"INT":"EXT","/").concat(a,"/").concat(e),r={nama_mahasiswa:C,letter_scope:y,nomor_surat_acceptance:"-",nomor_surat_completion:s,address_to:_,nomor_induk_mahasiswa:z,program_studi_mahasiswa:L,tahun_ajaran:T,start_date:(0,c.GP)(O,"yyyy-MM-dd"),completion_date:(0,c.GP)(U,"yyyy-MM-dd"),is_completion:1,is_acceptance:0};try{let e;let a=localStorage.getItem("authToken");if(!a){alert("Unauthorized! Please log in.");return}console.log("Submitting data:",r),(e=t?await o.A.put("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(g),r,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}}):await o.A.post("https://cetaksuratkp-api.humicprototyping.net/api/letter",r,{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(a)}})).data.success?(console.log("Letter submitted successfully:",e.data),f.push("/letter/completionletter")):alert(e.data.message||"Submission failed")}catch(e){if(console.error("Error submitting letter:",e),o.A.isAxiosError(e)){var l,n,i;console.error("Server response:",null===(l=e.response)||void 0===l?void 0:l.data),alert("Error: ".concat((null===(n=e.response)||void 0===n?void 0:n.data.message)||JSON.stringify(null===(i=e.response)||void 0===i?void 0:i.data)))}else alert("Error submitting letter. Please try again later.")}};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,s.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,s.jsxs)("div",{className:"flex space-x-8",children:[(0,s.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium",children:"Home"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"letter-button",onClick:()=>R(!V),className:"text-[#B4262A] border-b-2 border-[#B4262A]",children:"Letter"}),V&&(0,s.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,s.jsx)("button",{onClick:()=>f.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,s.jsx)("button",{onClick:()=>f.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{id:"profile-button",onClick:()=>J(!F),className:"text-gray-700 hover:text-black",children:(0,s.jsx)(u.A,{})}),F&&(0,s.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,s.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,s.jsx)("p",{className:"font-semibold",children:j||"Guest"})}),(0,s.jsxs)("button",{onClick:async()=>{I(!0),await new Promise(e=>setTimeout(e,1e3)),I(!1),f.push("/login")},disabled:M,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[M?(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,s.jsx)(m.A,{className:"mr-2",size:18}),M?"Logging out...":"Log Out"]})]})]})]}),(0,s.jsxs)("div",{className:"px-20 py-10",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-black mb-8",children:t?"Update Completion Work Letter":"Apply Completion Work Letter"}),(0,s.jsxs)("div",{className:"bg-white rounded-lg p-8 shadow-md",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Scope"}),(0,s.jsxs)(d.l6,{value:y,onValueChange:w,disabled:t,children:[(0,s.jsx)(d.bq,{className:"w-full",children:(0,s.jsx)(d.yv,{placeholder:"Select..."})}),(0,s.jsxs)(d.gC,{children:[(0,s.jsx)(d.eb,{value:"internal",children:"Internal"}),(0,s.jsx)(d.eb,{value:"external",children:"External"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Letter Number"}),(0,s.jsx)(n.p,{value:null!=N?N:"",onChange:e=>k(e.target.value),disabled:t})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Addressed To"}),(0,s.jsx)(n.p,{value:null!=_?_:"",onChange:e=>S(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Name"}),(0,s.jsx)(n.p,{value:null!=C?C:"",onChange:e=>A(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Identification Number (NIM)"}),(0,s.jsx)(n.p,{value:null!=z?z:"",onChange:e=>E(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Student Study Program"}),(0,s.jsx)(n.p,{value:null!=L?L:"",onChange:e=>P(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Academic Year"}),(0,s.jsx)(n.p,{value:null!=T?T:"",placeholder:"e.g. Genap 2022/2023",onChange:e=>D(e.target.value)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Starting Date"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:O&&(0,l.f)(O)?(0,c.GP)(O,"yyyy-MM-dd"):"",placeholder:"Select Start Date",readOnly:!0,className:"pr-10",onClick:()=>H(!q)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>H(!q)}),q&&(0,s.jsx)(x.hv,{mode:"single",selected:O,onSelect:e=>{G(e),H(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-black block mb-1",children:"Date of Completion"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(n.p,{value:U&&(0,l.f)(null!=U?U:new Date)?(0,c.GP)(U,"yyyy-MM-dd"):"",placeholder:"Select End Date",readOnly:!0,className:"pr-10",onClick:()=>$(!W)}),(0,s.jsx)(p.A,{size:18,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 cursor-pointer",onClick:()=>$(!W)}),W&&(0,s.jsx)(x.hv,{mode:"single",selected:U,onSelect:e=>{B(e),$(!1)},className:"absolute z-10 mt-2 bg-white border rounded shadow"})]})]})]}),(0,s.jsxs)("div",{className:"flex gap-4 mt-10",children:[(0,s.jsx)(i.$,{onClick:X,className:"bg-red-600 hover:bg-red-700",children:t?"Update Letter":"Submit"}),(0,s.jsx)(i.$,{variant:"outline",onClick:()=>f.back(),children:"Cancel"})]})]})]})]})}},2336:(e,t,a)=>{"use strict";a.d(t,{p:()=>l});var s=a(5155);a(2115);var r=a(9602);function l(e){let{className:t,type:a,...l}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("border-input file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>o});var s=a(5155);a(2115);var r=a(2317),l=a(1027),n=a(9602);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:a,size:l,asChild:o=!1,...d}=e,c=o?r.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,n.cn)(i({variant:a,size:l,className:t})),...d})}},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>i,AuthProvider:()=>n});var s=a(5155),r=a(2115);let l=(0,r.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&n(t.name)}},[]),(0,s.jsx)(l.Provider,{value:{username:a,setUsername:n,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),n("")}},children:t})}function i(){let e=(0,r.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},8308:(e,t,a)=>{Promise.resolve().then(a.bind(a,2324))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var s=a(3463),r=a(9795);function l(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[478,251,501,651,941,599,441,587,358],()=>t(8308)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/completionletter/page-2e880a33eeff02d0.js b/_next/static/chunks/app/letter/completionletter/page-2e880a33eeff02d0.js index b18d4e9..4feaa68 100644 --- a/_next/static/chunks/app/letter/completionletter/page-2e880a33eeff02d0.js +++ b/_next/static/chunks/app/letter/completionletter/page-2e880a33eeff02d0.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58],{1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},2060:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},2598:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6659:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>c,AuthProvider:()=>i});var a=s(5155),l=s(2115);let r=(0,l.createContext)(void 0);function i(e){let{children:t}=e,[s,i]=(0,l.useState)("");return(0,l.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&i(t.name)}},[]),(0,a.jsx)(r.Provider,{value:{username:s,setUsername:i,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),i("")}},children:t})}function c(){let e=(0,l.useContext)(r);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(2115);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:n,className:o="",children:d,iconNode:m,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:l,height:l,stroke:s,strokeWidth:n?24*Number(c)/Number(l):c,className:r("lucide",o),...h},[...m.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),n=(e,t)=>{let s=(0,a.forwardRef)((s,i)=>{let{className:n,...o}=s;return(0,a.createElement)(c,{ref:i,iconNode:t,className:r("lucide-".concat(l(e)),n),...o})});return s.displayName="".concat(e),s}},7634:(e,t,s)=>{Promise.resolve().then(s.bind(s,8484))},8484:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(5155),l=s(2115),r=s(6868),i=s(6046),c=s(2651),n=s(1466),o=s(5236),d=s(2060),m=s(6659),h=s(2598),x=s(8491),u=s(9993);function p(){let[e,t]=(0,l.useState)(""),s=(0,i.useRouter)(),{username:p}=(0,r.A)(),[b,y]=(0,l.useState)(!1),[g,j]=(0,l.useState)(null),[f,N]=(0,l.useState)(1),[w,v]=(0,l.useState)([]),[k,A]=(0,l.useState)([]),[C,S]=(0,l.useState)(!1),[_,L]=(0,l.useState)(!1),[z,M]=(0,l.useState)(!1),[E,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(!1),O=e=>{P(e),I(!0)};(0,l.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),t=(await c.A.get("https://cetaksuratkp-api.humicprototyping.com/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}})).data.data;console.log("Raw data:",t);let s=t.filter(e=>(console.log("letter object:",e),console.log("is_completion:",e.is_completion),1==e.is_completion));console.log("Filtered data:",s),v(s)}catch(e){console.error("Error fetching completion letters:",e)}})()},[]),(0,l.useEffect)(()=>{""===e.trim()?A(w):A(w.filter(t=>{var s,a,l,r;let i=null!==(l=null===(s=t.nomor_induk_mahasiswa)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:"",c=null!==(r=null===(a=t.nomor_surat_completion)||void 0===a?void 0:a.toLowerCase())&&void 0!==r?r:"",n=e.toLowerCase(),o=i.includes(n),d=c.includes(n);return o||d}))},[w,e]),(0,l.useEffect)(()=>{console.log("Letters State:",w)},[w]);let B=e=>{j(e),y(!0)},H=async e=>{try{let t=localStorage.getItem("authToken");await c.A.delete("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(e.id),{headers:{Authorization:"Bearer ".concat(t),Accept:"application/json"}});let s=w.filter(t=>t.id!==e.id);v(s),localStorage.setItem("completionLetters",JSON.stringify(s)),console.log("Deleted successfully")}catch(e){console.error("Failed to delete letter:",e),alert("Failed to delete letter. Please try again.")}finally{y(!1),j(null)}},T=e=>{console.log(e),s.push("/letter/completionletter/applyLetter?edit=".concat(JSON.stringify(e)))},V=Math.ceil(k.length/5),F=(f-1)*5,R=k.slice(F,F+5);return(0,a.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,a.jsxs)("nav",{className:"bg-white shadow-md px-6 md:px-10 py-4 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-8",children:[(0,a.jsx)("img",{src:"/logo-humic-text.png",alt:"Logo",className:"h-12 mr-3"}),(0,a.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Home"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>M(!z),className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A] cursor-pointer transition duration-300",children:"Letter"}),z&&(0,a.jsxs)("div",{className:"absolute mt-2 bg-white shadow rounded w-48 z-10",children:[(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Acceptance Letter"}),(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Completion Letter"})]})]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>S(!C),children:(0,a.jsx)(n.A,{})}),C&&(0,a.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg z-50",children:[(0,a.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,a.jsx)("p",{className:"font-semibold",children:p||"Guest"})}),(0,a.jsxs)("button",{onClick:async()=>{L(!0),await new Promise(e=>setTimeout(e,1e3)),L(!1),s.push("/login")},disabled:_,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[_?(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",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-8v8H4z"})]}):(0,a.jsx)(o.A,{className:"mr-2",size:18}),_?"Logging out...":"Log Out"]})]})]})]}),(0,a.jsxs)("div",{className:"px-4 md:px-20 py-10",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-black mb-1",children:"Practical Work Completion Letter"}),(0,a.jsx)("p",{className:"text-gray-500 mb-6",children:"Kelola surat keterangan selesai kerja praktik mahasiswa"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4",children:[(0,a.jsxs)("button",{onClick:()=>s.push("/letter/completionletter/applyLetter"),className:"bg-red-600 text-white px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(d.A,{size:18})," Apply letter"]}),(0,a.jsxs)("button",{onClick:()=>s.push("/letter/completionletter/viewTemplate"),className:"bg-white text-black border px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(m.A,{size:18})," View template"]}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:e,onChange:e=>t(e.target.value),className:"border px-4 py-2 rounded-md text-sm w-full max-w-xs"})]}),(0,a.jsxs)("div",{className:"bg-white p-6 rounded shadow overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-sm text-left border",children:[(0,a.jsx)("thead",{className:"bg-gray-100 text-black",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-2 px-4",children:"Submission Date"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"Letter Number"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"NIM"}),(0,a.jsx)("th",{className:"py-2 px-4 text-center",children:"Action"})]})}),(0,a.jsx)("tbody",{children:R.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t",children:[(0,a.jsx)("td",{className:"py-2 px-4",children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_surat_completion}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_induk_mahasiswa}),(0,a.jsx)("td",{className:"py-2 px-4 text-center",children:(0,a.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>O(e),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-md",children:(0,a.jsx)(h.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:()=>T(e),className:"p-2 rounded bg-gray-100 hover:bg-gray-200",children:(0,a.jsx)(x.A,{size:16})}),(0,a.jsx)("button",{onClick:()=>B(e),className:"p-2 rounded bg-red-100 hover:bg-red-200 text-red-600",children:(0,a.jsx)(u.A,{size:16})})]})})]},t))})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center px-4 py-4 text-sm",children:[(0,a.jsx)("span",{children:0===k.length?"Showing 0 to 0 of 0 entries":"Showing ".concat(F+1," to ").concat(Math.min(F+5,k.length)," of ").concat(k.length," entries")}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>N(e=>Math.max(1,e-1)),disabled:1===f,className:"px-2 py-1 border rounded ".concat(1===f?"text-gray-400":""),children:"← Previous"}),[...Array(V)].map((e,t)=>(0,a.jsx)("button",{onClick:()=>N(t+1),className:"px-3 py-1 border rounded ".concat(f===t+1?"bg-red-600 text-white":""),children:t+1},t)),(0,a.jsx)("button",{onClick:()=>N(e=>Math.min(V,e+1)),disabled:f===V,className:"px-2 py-1 border rounded ".concat(f===V?"text-gray-400":""),children:"Next →"})]})]})]})]}),b&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[400px]",children:[(0,a.jsx)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Delete Confirmation"})}),(0,a.jsx)("div",{className:"px-6 py-4 text-sm text-black",children:(0,a.jsx)("p",{children:"Are you sure you want to delete this letter?"})}),(0,a.jsxs)("div",{className:"px-6 py-4 border-t flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>y(!1),className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>H(g),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Delete"})]})]})}),D&&E&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[600px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:[(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Letter Details"}),(0,a.jsx)("button",{onClick:()=>I(!1),className:"text-gray-500 hover:text-red-600",children:"✕"})]}),(0,a.jsxs)("div",{className:"px-6 py-4 space-y-2 text-sm text-black",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Letter Number"}),(0,a.jsx)("span",{children:E.nomor_surat_completion})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Name"}),(0,a.jsx)("span",{children:E.nama_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Identification Number"}),(0,a.jsx)("span",{children:E.nomor_induk_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Study Program"}),(0,a.jsx)("span",{children:E.program_studi_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Academic Year"}),(0,a.jsx)("span",{children:E.tahun_ajaran})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Starting Date"}),(0,a.jsx)("span",{children:E.start_date})]})]}),(0,a.jsx)("div",{className:"px-6 py-4 border-t flex justify-end",children:(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter/showLetter?id=".concat(E.id)),className:"bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 text-sm",children:"Show Letter"})})]})})]})}},8491:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},9993:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(7634)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58],{1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},2060:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},2598:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6659:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>c,AuthProvider:()=>i});var a=s(5155),l=s(2115);let r=(0,l.createContext)(void 0);function i(e){let{children:t}=e,[s,i]=(0,l.useState)("");return(0,l.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&i(t.name)}},[]),(0,a.jsx)(r.Provider,{value:{username:s,setUsername:i,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),i("")}},children:t})}function c(){let e=(0,l.useContext)(r);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(2115);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:n,className:o="",children:d,iconNode:m,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:l,height:l,stroke:s,strokeWidth:n?24*Number(c)/Number(l):c,className:r("lucide",o),...h},[...m.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),n=(e,t)=>{let s=(0,a.forwardRef)((s,i)=>{let{className:n,...o}=s;return(0,a.createElement)(c,{ref:i,iconNode:t,className:r("lucide-".concat(l(e)),n),...o})});return s.displayName="".concat(e),s}},7634:(e,t,s)=>{Promise.resolve().then(s.bind(s,8484))},8484:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(5155),l=s(2115),r=s(6868),i=s(6046),c=s(2651),n=s(1466),o=s(5236),d=s(2060),m=s(6659),h=s(2598),x=s(8491),u=s(9993);function p(){let[e,t]=(0,l.useState)(""),s=(0,i.useRouter)(),{username:p}=(0,r.A)(),[b,y]=(0,l.useState)(!1),[g,j]=(0,l.useState)(null),[f,N]=(0,l.useState)(1),[w,v]=(0,l.useState)([]),[k,A]=(0,l.useState)([]),[C,S]=(0,l.useState)(!1),[_,L]=(0,l.useState)(!1),[z,M]=(0,l.useState)(!1),[E,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(!1),O=e=>{P(e),I(!0)};(0,l.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),t=(await c.A.get("https://cetaksuratkp-api.humicprototyping.net/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}})).data.data;console.log("Raw data:",t);let s=t.filter(e=>(console.log("letter object:",e),console.log("is_completion:",e.is_completion),1==e.is_completion));console.log("Filtered data:",s),v(s)}catch(e){console.error("Error fetching completion letters:",e)}})()},[]),(0,l.useEffect)(()=>{""===e.trim()?A(w):A(w.filter(t=>{var s,a,l,r;let i=null!==(l=null===(s=t.nomor_induk_mahasiswa)||void 0===s?void 0:s.toLowerCase())&&void 0!==l?l:"",c=null!==(r=null===(a=t.nomor_surat_completion)||void 0===a?void 0:a.toLowerCase())&&void 0!==r?r:"",n=e.toLowerCase(),o=i.includes(n),d=c.includes(n);return o||d}))},[w,e]),(0,l.useEffect)(()=>{console.log("Letters State:",w)},[w]);let B=e=>{j(e),y(!0)},H=async e=>{try{let t=localStorage.getItem("authToken");await c.A.delete("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(e.id),{headers:{Authorization:"Bearer ".concat(t),Accept:"application/json"}});let s=w.filter(t=>t.id!==e.id);v(s),localStorage.setItem("completionLetters",JSON.stringify(s)),console.log("Deleted successfully")}catch(e){console.error("Failed to delete letter:",e),alert("Failed to delete letter. Please try again.")}finally{y(!1),j(null)}},T=e=>{console.log(e),s.push("/letter/completionletter/applyLetter?edit=".concat(JSON.stringify(e)))},V=Math.ceil(k.length/5),F=(f-1)*5,R=k.slice(F,F+5);return(0,a.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,a.jsxs)("nav",{className:"bg-white shadow-md px-6 md:px-10 py-4 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-8",children:[(0,a.jsx)("img",{src:"/logo-humic-text.png",alt:"Logo",className:"h-12 mr-3"}),(0,a.jsx)("a",{href:"/homepage",className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Home"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>M(!z),className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A] cursor-pointer transition duration-300",children:"Letter"}),z&&(0,a.jsxs)("div",{className:"absolute mt-2 bg-white shadow rounded w-48 z-10",children:[(0,a.jsx)("button",{onClick:()=>s.push("/letter/acceptanceletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Acceptance Letter"}),(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter"),className:"block px-4 py-2 text-left w-full hover:bg-gray-100 cursor-pointer",children:"Completion Letter"})]})]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("button",{onClick:()=>S(!C),children:(0,a.jsx)(n.A,{})}),C&&(0,a.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg z-50",children:[(0,a.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,a.jsx)("p",{className:"font-semibold",children:p||"Guest"})}),(0,a.jsxs)("button",{onClick:async()=>{L(!0),await new Promise(e=>setTimeout(e,1e3)),L(!1),s.push("/login")},disabled:_,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[_?(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",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-8v8H4z"})]}):(0,a.jsx)(o.A,{className:"mr-2",size:18}),_?"Logging out...":"Log Out"]})]})]})]}),(0,a.jsxs)("div",{className:"px-4 md:px-20 py-10",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-black mb-1",children:"Practical Work Completion Letter"}),(0,a.jsx)("p",{className:"text-gray-500 mb-6",children:"Kelola surat keterangan selesai kerja praktik mahasiswa"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4",children:[(0,a.jsxs)("button",{onClick:()=>s.push("/letter/completionletter/applyLetter"),className:"bg-red-600 text-white px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(d.A,{size:18})," Apply letter"]}),(0,a.jsxs)("button",{onClick:()=>s.push("/letter/completionletter/viewTemplate"),className:"bg-white text-black border px-4 py-2 rounded flex items-center gap-2",children:[(0,a.jsx)(m.A,{size:18})," View template"]}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:e,onChange:e=>t(e.target.value),className:"border px-4 py-2 rounded-md text-sm w-full max-w-xs"})]}),(0,a.jsxs)("div",{className:"bg-white p-6 rounded shadow overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-sm text-left border",children:[(0,a.jsx)("thead",{className:"bg-gray-100 text-black",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-2 px-4",children:"Submission Date"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"Letter Number"}),(0,a.jsx)("th",{className:"py-2 px-4",children:"NIM"}),(0,a.jsx)("th",{className:"py-2 px-4 text-center",children:"Action"})]})}),(0,a.jsx)("tbody",{children:R.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t",children:[(0,a.jsx)("td",{className:"py-2 px-4",children:new Date(e.created_at).toLocaleDateString()}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_surat_completion}),(0,a.jsx)("td",{className:"py-2 px-4",children:e.nomor_induk_mahasiswa}),(0,a.jsx)("td",{className:"py-2 px-4 text-center",children:(0,a.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>O(e),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-md",children:(0,a.jsx)(h.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:()=>T(e),className:"p-2 rounded bg-gray-100 hover:bg-gray-200",children:(0,a.jsx)(x.A,{size:16})}),(0,a.jsx)("button",{onClick:()=>B(e),className:"p-2 rounded bg-red-100 hover:bg-red-200 text-red-600",children:(0,a.jsx)(u.A,{size:16})})]})})]},t))})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center px-4 py-4 text-sm",children:[(0,a.jsx)("span",{children:0===k.length?"Showing 0 to 0 of 0 entries":"Showing ".concat(F+1," to ").concat(Math.min(F+5,k.length)," of ").concat(k.length," entries")}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>N(e=>Math.max(1,e-1)),disabled:1===f,className:"px-2 py-1 border rounded ".concat(1===f?"text-gray-400":""),children:"← Previous"}),[...Array(V)].map((e,t)=>(0,a.jsx)("button",{onClick:()=>N(t+1),className:"px-3 py-1 border rounded ".concat(f===t+1?"bg-red-600 text-white":""),children:t+1},t)),(0,a.jsx)("button",{onClick:()=>N(e=>Math.min(V,e+1)),disabled:f===V,className:"px-2 py-1 border rounded ".concat(f===V?"text-gray-400":""),children:"Next →"})]})]})]})]}),b&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[400px]",children:[(0,a.jsx)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Delete Confirmation"})}),(0,a.jsx)("div",{className:"px-6 py-4 text-sm text-black",children:(0,a.jsx)("p",{children:"Are you sure you want to delete this letter?"})}),(0,a.jsxs)("div",{className:"px-6 py-4 border-t flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>y(!1),className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>H(g),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Delete"})]})]})}),D&&E&&(0,a.jsx)("div",{className:"fixed inset-0 backdrop-blur-sm bg-white/30 flex justify-center items-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-md shadow-lg w-[600px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center px-6 py-4 border-b",children:[(0,a.jsx)("h2",{className:"font-semibold text-black text-lg",children:"Letter Details"}),(0,a.jsx)("button",{onClick:()=>I(!1),className:"text-gray-500 hover:text-red-600",children:"✕"})]}),(0,a.jsxs)("div",{className:"px-6 py-4 space-y-2 text-sm text-black",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Letter Number"}),(0,a.jsx)("span",{children:E.nomor_surat_completion})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Name"}),(0,a.jsx)("span",{children:E.nama_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Identification Number"}),(0,a.jsx)("span",{children:E.nomor_induk_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Student Study Program"}),(0,a.jsx)("span",{children:E.program_studi_mahasiswa})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Academic Year"}),(0,a.jsx)("span",{children:E.tahun_ajaran})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Starting Date"}),(0,a.jsx)("span",{children:E.start_date})]})]}),(0,a.jsx)("div",{className:"px-6 py-4 border-t flex justify-end",children:(0,a.jsx)("button",{onClick:()=>s.push("/letter/completionletter/showLetter?id=".concat(E.id)),className:"bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 text-sm",children:"Show Letter"})})]})})]})}},8491:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},9993:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(7401).A)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(7634)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/letter/completionletter/showLetter/page-ded16d837713abb8.js b/_next/static/chunks/app/letter/completionletter/showLetter/page-ded16d837713abb8.js index 94d33e8..edc2cd6 100644 --- a/_next/static/chunks/app/letter/completionletter/showLetter/page-ded16d837713abb8.js +++ b/_next/static/chunks/app/letter/completionletter/showLetter/page-ded16d837713abb8.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[990],{477:()=>{},920:(e,t,a)=>{"use strict";a.d(t,{default:()=>_});var s=a(5155),r=a(6046),n=a(7711),i=a(2115),o=a(7006),l=a(4085),d=a(4003),c=a(7364);function h(){let e=(0,r.useRouter)();return(0,s.jsxs)(l.$,{onClick:()=>e.push("/letter/completionletter"),className:"bg-white text-black border border-gray-300 flex items-center gap-2",children:[(0,s.jsx)(c.A,{size:16})," Back"]})}var m=a(4857);let{pdf:u}=a(4003),g=(0,n.default)(()=>Promise.resolve().then(a.bind(a,4003)).then(e=>e.PDFViewer),{loadableGenerated:{webpack:()=>[4003]},ssr:!1}),x=d.StyleSheet.create({page:{padding:40,fontSize:11,fontFamily:"Calibri"},bold:{fontFamily:"Calibri",fontWeight:"bold"},footer:{position:"absolute",bottom:0,left:0,right:0,textAlign:"center",fontSize:10,fontFamily:"Calibri"},section:{marginBottom:10},paragraph:{marginBottom:6,lineHeight:1.6,fontSize:11,fontFamily:"Calibri"},right:{textAlign:"right"},line:{flexDirection:"row",marginBottom:2},label:{width:100}});function p(e){let{nomor_surat_completion:t,address_to:a,nama_mahasiswa:r,nomor_induk_mahasiswa:n,program_studi_mahasiswa:i,start_date:o,completion_date:l,tahun_ajaran:c,created_at:h}=e;return(0,s.jsx)(d.Document,{children:(0,s.jsxs)(d.Page,{size:"A4",style:x.page,children:[(0,s.jsxs)(d.View,{style:{flexDirection:"row",alignItems:"center",marginBottom:10},children:[(0,s.jsx)(d.Image,{src:"/assets/logo-humic-surat.jpg",style:{width:90,height:90}}),(0,s.jsxs)(d.View,{style:{marginLeft:10,flex:1,marginBottom:10},children:[(0,s.jsxs)(d.Text,{style:{fontSize:18,fontWeight:"bold",fontFamily:"Times-Roman",textAlign:"center"},children:["Pusat Penelitian HUMIC Engineering","\n","Universitas Telkom"]}),(0,s.jsxs)(d.Text,{style:{fontSize:10,textAlign:"center",marginTop:7,fontFamily:"Times-Roman"},children:["Jl. Telekomunikasi Terusan Buah Batu, Bandung 40257, Jawa Barat, Indonesia","\n","Telp/Faks: +6281321397936 / +6222-70658638 / +6222-7565931"]})]})]}),(0,s.jsx)(d.View,{style:{borderBottomWidth:2,borderColor:"#000",marginBottom:10,width:"100%"}}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Nomor"}),(0,s.jsxs)(d.Text,{children:[": ",t]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Lampiran"}),(0,s.jsx)(d.Text,{children:": -"})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Perihal"}),(0,s.jsx)(d.Text,{children:": Surat Keterangan Selesai Kerja Praktek"})]})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsx)(d.Text,{children:"Kepada Yth."}),(0,s.jsx)(d.Text,{children:a}),(0,s.jsx)(d.Text,{children:"di Tempat"})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsx)(d.Text,{style:x.paragraph,children:"Dengan hormat,"}),(0,s.jsx)(d.Text,{style:x.paragraph,children:"Sehubungan dengan telah selesainya kerja praktek di CoE Humic Engineering yang telah dilaksanakan oleh mahasiswa atas nama:"})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Nama"}),(0,s.jsxs)(d.Text,{children:[": ",r]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"NIM"}),(0,s.jsxs)(d.Text,{children:[": ",n]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Prodi"}),(0,s.jsxs)(d.Text,{children:[": ",i]})]})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.Text,{style:[x.paragraph,{marginTop:20}],children:["Dengan ini kami menyatakan bahwa mahasiswa yang bersangkutan"," ",(0,s.jsx)(d.Text,{style:x.bold,children:"TELAH MENYELESAIKAN"})," Kerja Praktek di CoE Human Centric Engineering, Telkom University. Kegiatan ini telah dilaksanakan pada ",o," s.d. ",l," periode Tahun Ajaran ",c,"."]}),(0,s.jsx)(d.Text,{style:x.paragraph,children:"Demikian surat keterangan ini kami buat agar dapat dipergunakan sebagaimana mestinya."})]}),(0,s.jsxs)(d.View,{style:[x.section],children:[(0,s.jsxs)(d.Text,{children:["Bandung, ",h]}),(0,s.jsx)(d.Image,{src:"/assets/ttd.png",style:{width:100,height:50}}),(0,s.jsx)(d.Text,{style:{textDecoration:"underline"},children:"Assoc. Prof. Dr. Satria Mandal"}),(0,s.jsx)(d.Text,{children:"Direktur CoE HUMIC Engineering"})]}),(0,s.jsx)(d.View,{style:x.footer,children:(0,s.jsx)(d.Image,{src:"/assets/footer.jpg",style:{width:"100%"}})})]})})}function _(){let e=(0,r.useSearchParams)().get("id"),[t,a]=(0,i.useState)(null),[n,d]=(0,i.useState)(!0),[c,x]=(0,i.useState)(null);(0,i.useEffect)(()=>{let t=async()=>{try{let t=localStorage.getItem("authToken"),s=await fetch("https://cetaksuratkp-api.humicprototyping.com/api/letter/".concat(e),{headers:{Accept:"application/json",Authorization:"Bearer ".concat(t)}});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error("API Error ".concat(s.status,": ").concat(e.message||s.statusText))}let r=await s.json();console.log("Fetched Data:",r),a(r.data)}catch(e){e instanceof Error?(x(e.message),console.error("API Error:",e)):x("An unknown error occurred")}finally{d(!1)}};e&&t()},[e]);let _=e=>{try{return(0,o.GP)(new Date(e),"dd MMMM yyyy")}catch(e){return console.error("Error formatting date:",e),"-"}};if(c)return(0,s.jsxs)("div",{children:["Error: ",c]});if(!t)return(0,s.jsx)("div",{children:"No letter data found"});console.log("Completion Letter Data:",{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",created_at:t.created_at?_(t.created_at):"-"});let j=async()=>{let e=await u((0,s.jsx)(p,{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",tanggalSurat:t.created_at?_(t.created_at):"-"})).toBlob(),a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download="Surat-Penerimaan-".concat(t.nama_mahasiswa||"unknown",".pdf"),r.click(),URL.revokeObjectURL(a)};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100 px-10 py-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsx)(h,{}),(0,s.jsxs)(l.$,{onClick:j,className:"bg-red-600 text-white flex items-center gap-2",children:[(0,s.jsx)(m.A,{size:16})," Download PDF"]})]}),(0,s.jsx)(g,{width:"100%",height:"1000",children:(0,s.jsx)(p,{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",created_at:t.created_at?_(t.created_at):"-"})})]})}d.Font.register({family:"Calibri",fonts:[{src:"/fonts/CALIBRI.TTF"},{src:"/fonts/CALIBRIB.TTF",fontWeight:"bold"}]}),d.Font.register({family:"Times-Roman",fonts:[{src:"/fonts/times/TIMES.TTF"},{src:"/fonts/times/TIMESBD.TTF",fontWeight:"bold"}]})},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>l});var s=a(5155);a(2115);var r=a(2317),n=a(1027),i=a(9602);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:a,size:n,asChild:l=!1,...d}=e,c=l?r.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,i.cn)(o({variant:a,size:n,className:t})),...d})}},7358:(e,t,a)=>{Promise.resolve().then(a.bind(a,920))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>n});var s=a(3463),r=a(9795);function n(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[792,247,788,746,251,501,941,186,441,587,358],()=>t(7358)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[990],{477:()=>{},920:(e,t,a)=>{"use strict";a.d(t,{default:()=>_});var s=a(5155),r=a(6046),n=a(7711),i=a(2115),o=a(7006),l=a(4085),d=a(4003),c=a(7364);function h(){let e=(0,r.useRouter)();return(0,s.jsxs)(l.$,{onClick:()=>e.push("/letter/completionletter"),className:"bg-white text-black border border-gray-300 flex items-center gap-2",children:[(0,s.jsx)(c.A,{size:16})," Back"]})}var m=a(4857);let{pdf:u}=a(4003),g=(0,n.default)(()=>Promise.resolve().then(a.bind(a,4003)).then(e=>e.PDFViewer),{loadableGenerated:{webpack:()=>[4003]},ssr:!1}),x=d.StyleSheet.create({page:{padding:40,fontSize:11,fontFamily:"Calibri"},bold:{fontFamily:"Calibri",fontWeight:"bold"},footer:{position:"absolute",bottom:0,left:0,right:0,textAlign:"center",fontSize:10,fontFamily:"Calibri"},section:{marginBottom:10},paragraph:{marginBottom:6,lineHeight:1.6,fontSize:11,fontFamily:"Calibri"},right:{textAlign:"right"},line:{flexDirection:"row",marginBottom:2},label:{width:100}});function p(e){let{nomor_surat_completion:t,address_to:a,nama_mahasiswa:r,nomor_induk_mahasiswa:n,program_studi_mahasiswa:i,start_date:o,completion_date:l,tahun_ajaran:c,created_at:h}=e;return(0,s.jsx)(d.Document,{children:(0,s.jsxs)(d.Page,{size:"A4",style:x.page,children:[(0,s.jsxs)(d.View,{style:{flexDirection:"row",alignItems:"center",marginBottom:10},children:[(0,s.jsx)(d.Image,{src:"/assets/logo-humic-surat.jpg",style:{width:90,height:90}}),(0,s.jsxs)(d.View,{style:{marginLeft:10,flex:1,marginBottom:10},children:[(0,s.jsxs)(d.Text,{style:{fontSize:18,fontWeight:"bold",fontFamily:"Times-Roman",textAlign:"center"},children:["Pusat Penelitian HUMIC Engineering","\n","Universitas Telkom"]}),(0,s.jsxs)(d.Text,{style:{fontSize:10,textAlign:"center",marginTop:7,fontFamily:"Times-Roman"},children:["Jl. Telekomunikasi Terusan Buah Batu, Bandung 40257, Jawa Barat, Indonesia","\n","Telp/Faks: +6281321397936 / +6222-70658638 / +6222-7565931"]})]})]}),(0,s.jsx)(d.View,{style:{borderBottomWidth:2,borderColor:"#000",marginBottom:10,width:"100%"}}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Nomor"}),(0,s.jsxs)(d.Text,{children:[": ",t]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Lampiran"}),(0,s.jsx)(d.Text,{children:": -"})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Perihal"}),(0,s.jsx)(d.Text,{children:": Surat Keterangan Selesai Kerja Praktek"})]})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsx)(d.Text,{children:"Kepada Yth."}),(0,s.jsx)(d.Text,{children:a}),(0,s.jsx)(d.Text,{children:"di Tempat"})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsx)(d.Text,{style:x.paragraph,children:"Dengan hormat,"}),(0,s.jsx)(d.Text,{style:x.paragraph,children:"Sehubungan dengan telah selesainya kerja praktek di CoE Humic Engineering yang telah dilaksanakan oleh mahasiswa atas nama:"})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Nama"}),(0,s.jsxs)(d.Text,{children:[": ",r]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"NIM"}),(0,s.jsxs)(d.Text,{children:[": ",n]})]}),(0,s.jsxs)(d.View,{style:x.line,children:[(0,s.jsx)(d.Text,{style:x.label,children:"Prodi"}),(0,s.jsxs)(d.Text,{children:[": ",i]})]})]}),(0,s.jsxs)(d.View,{style:x.section,children:[(0,s.jsxs)(d.Text,{style:[x.paragraph,{marginTop:20}],children:["Dengan ini kami menyatakan bahwa mahasiswa yang bersangkutan"," ",(0,s.jsx)(d.Text,{style:x.bold,children:"TELAH MENYELESAIKAN"})," Kerja Praktek di CoE Human Centric Engineering, Telkom University. Kegiatan ini telah dilaksanakan pada ",o," s.d. ",l," periode Tahun Ajaran ",c,"."]}),(0,s.jsx)(d.Text,{style:x.paragraph,children:"Demikian surat keterangan ini kami buat agar dapat dipergunakan sebagaimana mestinya."})]}),(0,s.jsxs)(d.View,{style:[x.section],children:[(0,s.jsxs)(d.Text,{children:["Bandung, ",h]}),(0,s.jsx)(d.Image,{src:"/assets/ttd.png",style:{width:100,height:50}}),(0,s.jsx)(d.Text,{style:{textDecoration:"underline"},children:"Assoc. Prof. Dr. Satria Mandal"}),(0,s.jsx)(d.Text,{children:"Direktur CoE HUMIC Engineering"})]}),(0,s.jsx)(d.View,{style:x.footer,children:(0,s.jsx)(d.Image,{src:"/assets/footer.jpg",style:{width:"100%"}})})]})})}function _(){let e=(0,r.useSearchParams)().get("id"),[t,a]=(0,i.useState)(null),[n,d]=(0,i.useState)(!0),[c,x]=(0,i.useState)(null);(0,i.useEffect)(()=>{let t=async()=>{try{let t=localStorage.getItem("authToken"),s=await fetch("https://cetaksuratkp-api.humicprototyping.net/api/letter/".concat(e),{headers:{Accept:"application/json",Authorization:"Bearer ".concat(t)}});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error("API Error ".concat(s.status,": ").concat(e.message||s.statusText))}let r=await s.json();console.log("Fetched Data:",r),a(r.data)}catch(e){e instanceof Error?(x(e.message),console.error("API Error:",e)):x("An unknown error occurred")}finally{d(!1)}};e&&t()},[e]);let _=e=>{try{return(0,o.GP)(new Date(e),"dd MMMM yyyy")}catch(e){return console.error("Error formatting date:",e),"-"}};if(c)return(0,s.jsxs)("div",{children:["Error: ",c]});if(!t)return(0,s.jsx)("div",{children:"No letter data found"});console.log("Completion Letter Data:",{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",created_at:t.created_at?_(t.created_at):"-"});let j=async()=>{let e=await u((0,s.jsx)(p,{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",tanggalSurat:t.created_at?_(t.created_at):"-"})).toBlob(),a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download="Surat-Penerimaan-".concat(t.nama_mahasiswa||"unknown",".pdf"),r.click(),URL.revokeObjectURL(a)};return(0,s.jsxs)("div",{className:"min-h-screen bg-gray-100 px-10 py-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsx)(h,{}),(0,s.jsxs)(l.$,{onClick:j,className:"bg-red-600 text-white flex items-center gap-2",children:[(0,s.jsx)(m.A,{size:16})," Download PDF"]})]}),(0,s.jsx)(g,{width:"100%",height:"1000",children:(0,s.jsx)(p,{nomor_surat_completion:t.nomor_surat_completion||"-",address_to:t.address_to||"-",nama_mahasiswa:t.nama_mahasiswa||"-",nomor_induk_mahasiswa:t.nomor_induk_mahasiswa||"-",program_studi_mahasiswa:t.program_studi_mahasiswa||"-",start_date:t.start_date?_(t.start_date):"-",completion_date:t.completion_date?_(t.completion_date):"-",tahun_ajaran:t.tahun_ajaran||"-",created_at:t.created_at?_(t.created_at):"-"})})]})}d.Font.register({family:"Calibri",fonts:[{src:"/fonts/CALIBRI.TTF"},{src:"/fonts/CALIBRIB.TTF",fontWeight:"bold"}]}),d.Font.register({family:"Times-Roman",fonts:[{src:"/fonts/times/TIMES.TTF"},{src:"/fonts/times/TIMESBD.TTF",fontWeight:"bold"}]})},4085:(e,t,a)=>{"use strict";a.d(t,{$:()=>l});var s=a(5155);a(2115);var r=a(2317),n=a(1027),i=a(9602);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:a,size:n,asChild:l=!1,...d}=e,c=l?r.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,i.cn)(o({variant:a,size:n,className:t})),...d})}},7358:(e,t,a)=>{Promise.resolve().then(a.bind(a,920))},9602:(e,t,a)=>{"use strict";a.d(t,{cn:()=>n});var s=a(3463),r=a(9795);function n(){for(var e=arguments.length,t=Array(e),a=0;a{var t=t=>e(e.s=t);e.O(0,[792,247,788,746,251,501,941,186,441,587,358],()=>t(7358)),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/login/page-5dee644b52c7ce28.js b/_next/static/chunks/app/login/page-5dee644b52c7ce28.js index 1cd3aec..ee68a09 100644 --- a/_next/static/chunks/app/login/page-5dee644b52c7ce28.js +++ b/_next/static/chunks/app/login/page-5dee644b52c7ce28.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[520],{2386:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>i});var s=a(5155),r=a(2115),o=a(2651),l=a(6046),n=a(6868);function i(){let{setUsername:e}=(0,n.A)(),[t,a]=(0,r.useState)(""),[i,d]=(0,r.useState)(""),[c,u]=(0,r.useState)(!1),[m,g]=(0,r.useState)(!1),b=(0,l.useRouter)();(0,r.useEffect)(()=>{let e=localStorage.getItem("rememberedUsername");e&&(a(e),u(!0))},[]);let h=async()=>{if(!m){if(!t.trim()||!i.trim()){alert("Please fill in all fields");return}g(!0);try{let{token:a,token_type:s,user:r}=(await o.A.post("https://cetaksuratkp-api.humicprototyping.com/api/login",{email:t,password:i})).data.data,l="".concat(s," ").concat(a);localStorage.setItem("authToken",l),localStorage.setItem("user",JSON.stringify(r)),e(r.name),c?localStorage.setItem("rememberedUsername",t):localStorage.removeItem("rememberedUsername"),b.push("/homepage")}catch(e){var a,s,r;(null===(a=e.response)||void 0===a?void 0:a.status)===422?alert(Object.values(e.response.data.errors||{}).flat().join("\n")||e.response.data.message||"Validation failed. Please check your inputs."):alert((null===(r=e.response)||void 0===r?void 0:null===(s=r.data)||void 0===s?void 0:s.message)||"Login failed"),console.error("Login error:",e)}finally{g(!1)}}};return(0,s.jsxs)("div",{className:"flex items-center justify-center min-h-screen bg-[#a32020] relative overflow-hidden",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('/assets/login.png')"}}),(0,s.jsxs)("div",{className:"relative bg-white p-12 rounded-lg shadow-md w-[500px]",children:[(0,s.jsx)("h2",{className:"text-center text-2xl font-semibold mb-6 text-black",children:"Log In with SSO"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-black",children:"Username"}),(0,s.jsx)("input",{type:"text",className:"text-black mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Enter Username",value:t,onChange:e=>a(e.target.value)})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-black",children:"Password"}),(0,s.jsx)("input",{type:"password",className:"text-black mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Password",value:i,onChange:e=>d(e.target.value)})]}),(0,s.jsxs)("div",{className:"flex items-center mb-4",children:[(0,s.jsx)("input",{type:"checkbox",className:"h-4 w-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500",checked:c,onChange:e=>u(e.target.checked)}),(0,s.jsx)("label",{className:"ml-2 text-sm text-black",children:"Remember me"})]}),(0,s.jsx)("button",{className:"w-full px-4 py-2 text-white bg-indigo-600 hover:bg-indigo-700 rounded-md cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",onClick:h,disabled:m,children:m?"Logging in...":"Log In"})]})]})}},6149:(e,t,a)=>{Promise.resolve().then(a.bind(a,2386))},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>n,AuthProvider:()=>l});var s=a(5155),r=a(2115);let o=(0,r.createContext)(void 0);function l(e){let{children:t}=e,[a,l]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&l(t.name)}},[]),(0,s.jsx)(o.Provider,{value:{username:a,setUsername:l,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),l("")}},children:t})}function n(){let e=(0,r.useContext)(o);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(6149)),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[520],{2386:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>i});var s=a(5155),r=a(2115),o=a(2651),l=a(6046),n=a(6868);function i(){let{setUsername:e}=(0,n.A)(),[t,a]=(0,r.useState)(""),[i,d]=(0,r.useState)(""),[c,u]=(0,r.useState)(!1),[m,g]=(0,r.useState)(!1),b=(0,l.useRouter)();(0,r.useEffect)(()=>{let e=localStorage.getItem("rememberedUsername");e&&(a(e),u(!0))},[]);let h=async()=>{if(!m){if(!t.trim()||!i.trim()){alert("Please fill in all fields");return}g(!0);try{let{token:a,token_type:s,user:r}=(await o.A.post("https://cetaksuratkp-api.humicprototyping.net/api/login",{email:t,password:i})).data.data,l="".concat(s," ").concat(a);localStorage.setItem("authToken",l),localStorage.setItem("user",JSON.stringify(r)),e(r.name),c?localStorage.setItem("rememberedUsername",t):localStorage.removeItem("rememberedUsername"),b.push("/homepage")}catch(e){var a,s,r;(null===(a=e.response)||void 0===a?void 0:a.status)===422?alert(Object.values(e.response.data.errors||{}).flat().join("\n")||e.response.data.message||"Validation failed. Please check your inputs."):alert((null===(r=e.response)||void 0===r?void 0:null===(s=r.data)||void 0===s?void 0:s.message)||"Login failed"),console.error("Login error:",e)}finally{g(!1)}}};return(0,s.jsxs)("div",{className:"flex items-center justify-center min-h-screen bg-[#a32020] relative overflow-hidden",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('/assets/login.png')"}}),(0,s.jsxs)("div",{className:"relative bg-white p-12 rounded-lg shadow-md w-[500px]",children:[(0,s.jsx)("h2",{className:"text-center text-2xl font-semibold mb-6 text-black",children:"Log In with SSO"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-black",children:"Username"}),(0,s.jsx)("input",{type:"text",className:"text-black mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Enter Username",value:t,onChange:e=>a(e.target.value)})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-black",children:"Password"}),(0,s.jsx)("input",{type:"password",className:"text-black mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Password",value:i,onChange:e=>d(e.target.value)})]}),(0,s.jsxs)("div",{className:"flex items-center mb-4",children:[(0,s.jsx)("input",{type:"checkbox",className:"h-4 w-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500",checked:c,onChange:e=>u(e.target.checked)}),(0,s.jsx)("label",{className:"ml-2 text-sm text-black",children:"Remember me"})]}),(0,s.jsx)("button",{className:"w-full px-4 py-2 text-white bg-indigo-600 hover:bg-indigo-700 rounded-md cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",onClick:h,disabled:m,children:m?"Logging in...":"Log In"})]})]})}},6149:(e,t,a)=>{Promise.resolve().then(a.bind(a,2386))},6868:(e,t,a)=>{"use strict";a.d(t,{A:()=>n,AuthProvider:()=>l});var s=a(5155),r=a(2115);let o=(0,r.createContext)(void 0);function l(e){let{children:t}=e,[a,l]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&l(t.name)}},[]),(0,s.jsx)(o.Provider,{value:{username:a,setUsername:l,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),l("")}},children:t})}function n(){let e=(0,r.useContext)(o);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}}},e=>{var t=t=>e(e.s=t);e.O(0,[251,651,441,587,358],()=>t(6149)),_N_E=e.O()}]); \ No newline at end of file