import{j as o,P as j,k as B,l as C,at as S,c as d,e as p,m as a,f as u,a as x,b as e,t as l,o as m}from"./Bgmy51Qv.js";import{_ as M}from"./D_7E8SMU.js";import{A as N}from"./AmaTRG5a.js";import{u as R}from"./7pZkuj9N.js";import{u as V}from"./DKgjlGGV.js";const A={key:0,class:"detail-width"},D={key:0,class:"spinner-wrapper"},I={key:1,class:"order-wrapper tab-sidebar"},U={class:"title"},E={class:"dply-felx d-block-sm"},O={class:"mb-sm-10"},P={class:"dply-felx j-left f-wrap mlr--5 mtb-sm--5"},q={class:"form-wrapper"},z={class:"dply-felx d-block-sm"},F={class:"input-wrapper"},G={class:"input-wrapper"},H={class:"input-wrapper"},J={class:"input-wrapper"},Z={__name:"[id]",setup(K){const{getById:f,setById:v}=R(),n=o(!1),i=o(!1),r=o(!1),t=o({id:"",name:"",email:"",subject:"",replied:""}),{messageReply:b}=V(),c=j(),_=B(()=>{var s;return(s=c==null?void 0:c.params)==null?void 0:s.id}),h=async()=>{if(!i.value)return!1;i.value=!1,n.value=!0,await v({id:_.value,params:t.value,api:"setUserMessage"}),n.value=!1},y=s=>{i.value=!0,t.value.replied=s.key},g=async()=>{r.value=!0,t.value=Object.assign({},await f({id:_.value,params:{},api:"getUserMessage"})),r.value=!1};return C(async()=>{S.can("message","view")&&await g()}),(s,L)=>{const w=x,k=M,$=N;return s.$can("message","view")?(m(),d("div",A,[a(r)?(m(),d("div",D,[u(w,{radius:60,color:"primary"})])):p("",!0),a(t)?(m(),d("div",I,[e("div",U,[e("div",E,[e("h4",O,l(s.$t("profile.um")),1),e("div",P,[u(k,{class:"mlr-5 mtb-sm-5","selected-key":a(t).replied,options:a(b),onClicked:y},null,8,["selected-key","options"]),u($,{name:"save-edit",class:"primary-btn mlr-5 mtb-sm-5",text:s.$t("profile.us"),"loading-text":s.$t("profile.updatn"),"fetching-data":a(n),type:"button",onClicked:h},null,8,["text","loading-text","fetching-data"])])])]),e("form",q,[e("div",z,[e("div",F,[e("label",null,l(s.$t("user.name")),1),e("p",null,l(a(t).name),1)]),e("div",G,[e("label",null,l(s.$t("fSale.email")),1),e("p",null,l(a(t).email),1)])]),e("div",H,[e("label",null,l(s.$t("util.sub")),1),e("p",null,l(a(t).subject),1)]),e("div",J,[e("label",null,l(s.$t("user.msg")),1),e("p",null,l(a(t).message),1)])])])):p("",!0)])):p("",!0)}}};export{Z as default};
