import{N as $,s as m,A as b,j as c,Q as C,d as N,w as x,m as n,o as _,c as D,e as R,f as p,b as d,a as B,t as W}from"./Bgmy51Qv.js";import{_ as j}from"./YvhBcM5y.js";import{_ as E}from"./D_7E8SMU.js";import{_ as P}from"./BOhf1Bbf.js";import{u as V}from"./7pZkuj9N.js";import{u as K}from"./DKgjlGGV.js";import"./CNIrc0EA.js";import"./DZl4_Bww.js";import"./AmaTRG5a.js";import"./BHvLfWtM.js";import"./DuSynPle.js";import"./B2895E6R.js";const O={key:0,class:"spinner-wrapper"},Y={class:"input-wrapper"},q={class:"dply-felx j-left mb-20 mb-sm-15"},A={class:"mr-15"},se={__name:"[id]",setup(G){const f=$(),{currentLanguage:J}=m(f),{setRequest:g,deleteData:v}=V(),{defaultImage:y}=m(b()),{statusObj:w}=K(),l=c(!1),e=c({id:"",image:y.value,status:"",detail:""}),S=({deleted:t,file:a,Editor:o,cursorLocation:i,resetUploader:u})=>{h({deleted:t,file:a,Editor:o,cursorLocation:i,resetUploader:u})},F=C(),h=async({deleted:t,file:a,Editor:o,cursorLocation:i,resetUploader:u})=>{if(t)l.value=!0,await v({params:getImageName(a),api:"deleteFeatureWysiwygImage"}),l.value=!1;else{l.value=!0;const s=new FormData;e.value.id?(s.append("detail",e.value.detail),s.append("site_feature_id",e.value.id)):s.append("site_feature",JSON.stringify(e.value)),s.append("photo",a);const r=await g({params:s,api:"setFeatureWysiwygImage"});r&&(e.value.id?(o.insertEmbed(i,"image",r.url),o.setSelection(i+1)):await F.push({path:`/site-features/${r.site_feature_id}`})),l.value=!1}},k=t=>{e.value.status=t.key};return(t,a)=>{const o=B,i=j,u=E,s=P;return _(),N(s,{ref:"dataPageRef","set-api":"setSiteFeature","get-api":"getSiteFeature","set-image-api":"uploadSiteFeatureImage","route-name":"site-features",name:t.$t("title.sf"),"validation-keys":["detail"],"file-keys":["id","detail"],result:n(e),gate:"home_slider",onResult:a[1]||(a[1]=r=>e.value=r)},{form:x(({hasError:r})=>[n(l)?(_(),D("div",O,[p(o,{radius:70,color:"primary"})])):R("",!0),p(i,{class:"mb-20",title:t.$t("prod.desc"),description:n(e).detail,onChange:a[0]||(a[0]=I=>n(e).detail=I),onFile:S},null,8,["title","description"]),d("div",Y,[d("div",q,[d("span",A,W(t.$t("category.status")),1),p(u,{selectedKey:`${n(e).status}`,options:n(w),onClicked:k},null,8,["selectedKey","options"])])])]),_:1},8,["name","result"])}}};export{se as default};
