{"version":3,"file":"AppointmentForm.CQNn5ZzD.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/qNx1Smt1kxe3qP46qrKc/TfcBHyyA2Xp9orrRy4Ru/AppointmentForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function AppointmentForm(props){const{endpoint,clinics,buttonText,successMessage,errorMessage,primaryColor,borderColor,borderRadius,textColor,backgroundColor}=props;const[location,setLocation]=React.useState(\"\");const[name,setName]=React.useState(\"\");const[phone,setPhone]=React.useState(\"\");const[loading,setLoading]=React.useState(false);const[success,setSuccess]=React.useState(false);const[error,setError]=React.useState(\"\");async function submit(e){e.preventDefault();setSuccess(false);setError(\"\");if(!location||!name||!phone){setError(\"Vul alle velden in.\");return;}setLoading(true);try{const response=await fetch(endpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({location,name,phone})});const result=await response.json();if(!response.ok){throw new Error(result.message||\"Unknown error\");}setSuccess(true);setLocation(\"\");setName(\"\");setPhone(\"\");}catch(err){setError(err.message||errorMessage);}finally{setLoading(false);}}return /*#__PURE__*/_jsxs(\"form\",{onSubmit:submit,style:{width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:24,fontFamily:\"Inter, sans-serif\"},children:[/*#__PURE__*/_jsxs(\"label\",{style:{display:\"flex\",flexDirection:\"column\",gap:10,fontSize:16},children:[/*#__PURE__*/_jsx(\"span\",{children:\"Locatie\"}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsxs(\"select\",{value:location,onChange:e=>setLocation(e.target.value),style:{width:\"100%\",height:48,border:`1px solid ${borderColor}`,borderRadius,padding:\"0 48px 0 12px\",appearance:\"none\",WebkitAppearance:\"none\",MozAppearance:\"none\",fontSize:16,background:backgroundColor,color:textColor,outline:\"none\",cursor:\"pointer\"},children:[/*#__PURE__*/_jsx(\"option\",{value:\"\",children:\"Kies vestiging\"}),clinics.map(clinic=>/*#__PURE__*/_jsx(\"option\",{value:clinic.name,children:clinic.name},clinic.name))]}),/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{position:\"absolute\",right:16,top:\"50%\",transform:\"translateY(-50%)\",pointerEvents:\"none\",color:textColor},children:/*#__PURE__*/_jsx(\"polyline\",{points:\"6 9 12 15 18 9\"})})]})]}),/*#__PURE__*/_jsxs(\"label\",{style:{display:\"flex\",flexDirection:\"column\",gap:10,fontSize:16},children:[/*#__PURE__*/_jsx(\"span\",{children:\"Volledige naam\"}),/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:name,onChange:e=>setName(e.target.value),placeholder:\"Jan Jansen\",style:{height:48,border:`1px solid ${borderColor}`,borderRadius,padding:\"0 12px\",fontSize:16,background:backgroundColor,color:textColor,outline:\"none\"}})]}),/*#__PURE__*/_jsxs(\"label\",{style:{display:\"flex\",flexDirection:\"column\",gap:10,fontSize:16},children:[/*#__PURE__*/_jsx(\"span\",{children:\"Telefoonnummer\"}),/*#__PURE__*/_jsx(\"input\",{type:\"tel\",value:phone,onChange:e=>setPhone(e.target.value),placeholder:\"0612345678\",style:{height:48,border:`1px solid ${borderColor}`,borderRadius,padding:\"0 12px\",fontSize:16,background:backgroundColor,color:textColor,outline:\"none\"}})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading,style:{height:40,border:\"none\",borderRadius:8,background:primaryColor,color:\"#fff\",fontSize:16,fontWeight:600,cursor:loading?\"not-allowed\":\"pointer\",opacity:loading?.7:1,transition:\"0.2s\"},children:loading?\"Verzenden...\":buttonText}),success&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#ffffff\",fontSize:16,fontWeight:600,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",padding:\"12px\",backgroundColor:\"#0DB862\",borderRadius:10},children:successMessage}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF2244\",fontSize:16,fontWeight:600,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",padding:\"12px\",backgroundColor:\"#FF224426\",borderRadius:10},children:error})]});}AppointmentForm.defaultProps={endpoint:\"https://tph-appointment.pinverse-api.workers.dev/\",buttonText:\"Afspraak maken\",successMessage:\"Je afspraakaanvraag is succesvol verzonden.\",errorMessage:\"Er is iets misgegaan. Probeer het later opnieuw.\",primaryColor:\"#0273AC\",borderColor:\"#E5E7EB\",borderRadius:10,textColor:\"#111827\",backgroundColor:\"#BBBBBB26\",clinics:[{name:\"Nieuw-Vennep\"},{name:\"Hoofddorp\"}]};addPropertyControls(AppointmentForm,{endpoint:{type:ControlType.String,title:\"Endpoint\"},clinics:{type:ControlType.Array,title:\"Branches\",control:{type:ControlType.Object,controls:{name:{type:ControlType.String,title:\"Name\"}}}},buttonText:{type:ControlType.String,title:\"Button\"},successMessage:{type:ControlType.String,title:\"Success\"},errorMessage:{type:ControlType.String,title:\"Error\"},primaryColor:{type:ControlType.Color,title:\"Primary\"},borderColor:{type:ControlType.Color,title:\"Border\"},textColor:{type:ControlType.Color,title:\"Text\"},backgroundColor:{type:ControlType.Color,title:\"Background\"},borderRadius:{type:ControlType.Number,title:\"Radius\",min:0,max:40,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AppointmentForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AppointmentForm.map"],"mappings":"iLAAyI,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,aAAW,iBAAe,eAAa,eAAa,cAAY,eAAa,YAAU,mBAAiB,EAAW,CAAC,EAAS,GAAaA,EAAe,EAAE,EAAO,CAAC,EAAK,GAASA,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