import{a as y,b as x,r as b,j as n,n as s}from"./index-7c7a558c.js";import{B as j}from"./Breadcrumb-21e99ae5.js";import{g as h,p as F}from"./settingsApi-5a4df441.js";import{G as w}from"./GeneralSettingsSkeleton-aed31d86.js";import{F as G}from"./FormGenerator-3d4cd06b.js";import{o as k}from"./ObjectToFormData-bf0af219.js";import"./ImageUpload-16444a76.js";import"./user_image-87dc2d58.js";function Q(){const{isLoading:_,refetch:g}=y("getGeneralSettings",h,{onSuccess:t=>{var e,a,i,o,d;(a=(e=t==null?void 0:t.data)==null?void 0:e.data)!=null&&a.settings&&(console.log(u),(d=(o=(i=t==null?void 0:t.data)==null?void 0:i.data)==null?void 0:o.settings)==null||d.map(l=>{const r=l==null?void 0:l.option_key;m(c=>({...c,[r]:{...c[r],value:l==null?void 0:l.option_value}}))}))},refetchOnWindowFocus:!1}),{isLoading:f,mutate:p}=x(F,{onMutate:()=>{s.loading("Submitting...")},onSuccess:()=>{s.dismiss(),s.success("Successfully Saved!"),g()},onError:t=>{var e,a,i;s.dismiss(),(e=t==null?void 0:t.response)!=null&&e.data?s.error(`${(i=(a=t==null?void 0:t.response)==null?void 0:a.data)==null?void 0:i.error}`):s.error("something went wrong")}}),S=t=>{s.dismiss(),f||p({formdata:k(t)})},[u,m]=b.useState({student_image_slider_1:{type:"image",value:null},student_image_slider_2:{type:"image",value:null},student_image_slider_3:{type:"image",value:null},student_image_slider_4:{type:"image",value:null},student_image_slider_5:{type:"image",value:null},student_image_slider_6:{type:"image",value:null},student_video_url:{type:"text",value:null},fast_withdraw_video_link:{type:"text",value:null},activation_balance_limit:{type:"number",value:null}}),v=t=>{const{name:e,files:a}=t.target;m(i=>({...i,[e]:{type:"image",value:a[0]}}))};return n.jsxs(n.Fragment,{children:[n.jsx(j,{title:"Student Settings"}),n.jsx("div",{className:"my-12",children:_?n.jsx(w,{}):n.jsx(G,{formData:u,setterFormDataImage:v,onSubmit:S})})]})}export{Q as default};
