PageSourceSearch

https://frontend-webklinik.vercel.app/_next/static/chunks/pages/admin/booking/[id]-181bcd6e8a952450.js

js frontend-webklinik.vercel.app collected 2026-10-03 06:58:44 UTC 5,472 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[453],{6366:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/booking/[id]",function(){return t(6499)}])},6499:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>n});var l=t(4848),s=t(6540),i=t(6715);t(9527),t(4553);var r=t(3002);function n(){let{id:e}=(0,i.useRouter)().query,[a,t]=(0,s.useState)([]),[r,n]=(0,s.useState)([]),[o,d]=(0,s.useState)([]),[c,u]=(0,s.useState)(!0),[h,m]=(0,s.useState)(null),[x,w]=(0,s.useState)(""),[p,f]=(0,s.useState)(""),[b,g]=(0,s.useState)(""),j=async()=>{try{let e=await fetch("/api/pasien");if(!e.ok)throw Error("Network response was not ok");return await e.json()}catch(e){return console.error("Failed to fetch pasien:",e),m(e.message),[]}},y=async()=>{try{let e=await fetch("/api/jadwal");if(!e.ok)throw Error("Network response was not ok");return(await e.json()).map(e=>{let a=new Date(e.jam_mulai),t=new Date(e.jam_selesai),l=new Date(e.tanggal),s=new Intl.DateTimeFormat("id-ID",{weekday:"long"}).format(l),i=l.toISOString().slice(0,10).split("-").reverse().join("-"),r=a.toISOString().slice(11,16),n=t.toISOString().slice(11,16);return{...e,jam_mulai:`${s}, ${i} - ${r}`,jam_selesai:`${s}, ${i} - ${n}`}})}catch(e){return console.error("Gagal mengambil jadwal:",e),m(e.message),[]}},v=async()=>{try{let e=await fetch("/api/status");if(!e.ok)throw Error("Network response was not ok");return await e.json()}catch(e){return console.error("Failed to fetch status:",e),m(e.message),[]}},N=async()=>{if(e)try{let a=await fetch(`/api/booking/show/${e}`);if(!a.ok)throw Error("Failed to fetch booking details");let t=await a.json();w(t.id_pasien),f(t.id_jadwal),g(t.id_status)}catch(e){console.error("Failed to fetch booking details:",e),m(e.message)}};(0,s.useEffect)(()=>{(async()=>{u(!0);let e=await j(),a=await y(),l=await v();t(e),n(a),d(l),await N(),u(!1)})()},[e]);let k=async()=>{if(!x||!p||!b){alert("Please select all fields.");return}try{let a=await fetch(`/api/booking/show/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id_pasien:x,id_jadwal:p,id_status:b})});if(!a.ok)throw Error("Failed to update booking");await a.json(),alert("Booking updated successfully!")}catch(e){console.error("Error updating booking:",e),m(e.message)}};return(0,l.jsx)(l.Fragment,{children:(0,l.jsx)("div",{className:"flex flex-wrap",children:(0,l.jsx)("div",{className:"w-full lg:w-full px-4",children:(0,l.jsxs)("div",{className:"relative flex flex-col min-w-0 break-words w-full mb-6 shadow-lg rounded-lg bg-blueGray-100 border-0",children:[(0,l.jsx)("div",{className:"rounded-t bg-white mb-0 px-6 py-6",children:(0,l.jsxs)("div",{className:"text-center flex justify-between",children:[(0,l.jsx)("h6",{className:"text-blueGray-700 text-xl font-bold",children:"Booking Form"}),(0,l.jsx)("button",{className:"bg-blueGray-700 active:bg-blueGray-600 text-white font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150",type:"button",onClick:k,children:"Simpan"})]})}),(0,l.jsx)("div",{className:"flex-auto px-4 lg:px-10 py-10 pt-0",children:(0,l.jsxs)("form",{children:[(0,l.jsx)("h6",{className:"text-blueGray-400 text-sm mt-3 mb-6 font-bold uppercase",children:"Booking Information"}),(0,l.jsxs)("div",{className:"flex flex-wrap",children:[(0,l.jsx)("div",{className:"w-full lg:w-4/12 px-4",children:(0,l.jsxs)("div",{className:"relative w-full mb-3",children:[(0,l.jsx)("label",{className:"block uppercase text-blueGray-600 text-xs font-bold mb-2",htmlFor:"patient",children:"Pasien"}),(0,l.jsxs)("select",{id:"patient",className:"border-0 px-3 py-3 text-blueGray-600 bg-white rounded text-sm shadow focus:outline-none focus:ring w-full ease-linear transition-all duration-150",value:x,onChange:e=>w(e.target.value),children:[(0,l.jsx)("option",{value:"",children:"Select Pasien"}),a.map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.nama," - ",e.nomor_telepon]},e.id))]})]})}),(0,l.jsx)("div",{className:"w-full lg:w-4/12 px-4",children:(0,l.jsxs)("div",{className:"relative w-full mb-3",children:[(0,l.jsx)("label",{className:"block uppercase text-blueGray-600 text-xs font-bold mb-2",htmlFor:"schedule",children:"Jadwal"}),(0,l.jsxs)("select",{id:"schedule",className:"border-0 px-3 py-3 text-blueGray-600 bg-white rounded text-sm shadow focus:outline-none focus:ring w-full ease-linear transition-all duration-150",value:p,onChange:e=>f(e.target.value),children:[(0,l.jsx)("option",{value:"",children:"Select Jadwal"}),r.map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.jam_mulai," - ",e.jam_selesai]},e.id))]})]})}),(0,l.jsx)("div",{className:"w-full lg:w-4/12 px-4",children:(0,l.jsxs)("div",{className:"relative w-full mb-3",children:[(0,l.jsx)("label",{className:"block uppercase text-blueGray-600 text-xs font-bold mb-2",htmlFor:"status",children:"Status"}),(0,l.jsxs)("select",{id:"status",className:"border-0 px-3 py-3 text-blueGray-600 bg-white rounded text-sm shadow focus:outline-none focus:ring w-full ease-linear transition-all duration-150",value:b,onChange:e=>g(e.target.value),children:[(0,l.jsx)("option",{value:"",children:"Select Status"}),o.map(e=>(0,l.jsx)("option",{value:e.id,children:e.nama},e.id))]})]})})]}),c&&(0,l.jsx)("p",{children:"Loading..."}),h&&(0,l.jsx)("p",{className:"text-red-500",children:h})]})})]})})})})}n.layout=r.A}},e=>{var a=a=>e(e.s=a);e.O(0,[106,234,2,895,636,593,792],()=>a(6366)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.