import{_ as N,d as R,c as u,g as a,w as t,h as k,F as B,j as x,f as V,e as h,i as S,t as w,k as g,l as T,a as j,T as q,U as L,a9 as U,aa as I,o as n,a7 as M}from"./app-CgV11GBz.js";import{a as O}from"./apiAdmin-CiAsr8eb.js";import{i as D}from"./isSameOrAfter-BqHK716D.js";import{T as z}from"./Title-p64jezvO.js";import{F as G,_ as H}from"./index-DX5UyTUL.js";import{I as J}from"./index-CJx7RGCD.js";import{S as K}from"./index-4wtx7HnJ.js";import{B as P}from"./useFlexGapSupport-CWWB0EO1.js";import{L as Q}from"./LeftCircleOutlined-BFhtIwfV.js";import{a as W,_ as X}from"./index-CyQQxPex.js";import{_ as Y}from"./TextArea-CiAld6jk.js";import{_ as Z}from"./index-Cj--B_iU.js";import"./Base-CoAoxKFd.js";import"./transButton-BBsxYOSm.js";import"./EditOutlined-CDoHc2FT.js";const F=R({components:{LeftCircleOutlined:Q},setup(){const e=L(),y=I(),i=g([]),p=g([]),{addEditRequestAdmin:C,loading:$,rules:c}=O(),_=g(),r=g(!1);T.extend(D);const{user:d}=j();return q(()=>{_.value=e.params.id,axiosAdmin.get(`employee-survey/${_.value}`).then(s=>{i.value=s.data,U(i.value,v=>{T().isAfter(v.last_date,"date")&&(r.value=!0,M.warning("Submission date is expired !"),y.push({name:"admin.assigned_survey.index"}))})})}),{rules:c,loading:$,feedbacks:i,onSubmit:()=>{p.value.length==0&&U(i.value,s=>{p.value=s}),C({url:"employee-feedback",data:p.value,successMessage:"Success",success:s=>{emit("addEditSuccess",s.xid),y.push({name:"admin.assigned_survey.index"})}})},replyChanged:s=>{p.value=s},toShowFeedbackForm:r,user:d}}}),ee={class:"bg-white"},ae={key:0},te={style:{"text-align":"center"},class:"mt-50 mb-40"};function se(e,y,i,p,C,$){const c=z,_=J,r=W,d=X,f=H,b=Y,s=Z,v=P,A=K,E=G;return n(),u("div",ee,[a(d,{type:"flex",justify:"center"},{default:t(()=>[a(r,{span:20},{default:t(()=>[e.feedbacks&&e.feedbacks.length>0?(n(),u("div",ae,[(n(!0),u(B,null,x(e.feedbacks,l=>(n(),u("div",{key:l.id},[V("div",te,[a(c,{level:3,style:{marginBottom:"5px"}},{default:t(()=>[S(w(l.title),1)]),_:2},1024),l.description!=""?(n(),h(c,{key:0,type:"secondary",level:5,style:{marginTop:"0px"}},{default:t(()=>[S(w(l.description),1)]),_:2},1024)):k("",!0)]),a(E,{layout:"vertical",class:"mt-30"},{default:t(()=>[(n(!0),u(B,null,x(l.feedback_form_fields,o=>(n(),u("div",{key:o.id},[o.type=="input"?(n(),h(f,{key:0,label:o.name,help:e.rules.answer?e.rules.answer.message:null,validateStatus:e.rules.answer?"error":null,class:"required"},{default:t(()=>[a(d,{gutter:[30,30]},{default:t(()=>[a(r,{xs:24,sm:24,md:24,lg:24,xl:24},{default:t(()=>[a(_,{value:o.reply,"onUpdate:value":m=>o.reply=m,onChange:m=>e.replyChanged(l),placeholder:e.$t("common.placeholder_default_text",[e.$t("feedback.answers")])},null,8,["value","onUpdate:value","onChange","placeholder"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","help","validateStatus"])):(n(),h(f,{key:1,help:e.rules.answer?e.rules.answer.message:null,validateStatus:e.rules.answer?"error":null,label:o.name,class:"required"},{default:t(()=>[a(d,{gutter:[30,30]},{default:t(()=>[a(r,{xs:24,sm:24,md:24,lg:24,xl:24},{default:t(()=>[a(b,{value:o.reply,"onUpdate:value":m=>o.reply=m,onChange:m=>e.replyChanged(l),placeholder:e.$t("common.placeholder_default_text",[e.$t("feedback.answers")])},null,8,["value","onUpdate:value","onChange","placeholder"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["help","validateStatus","label"]))]))),128)),a(s,{dashed:""}),a(f,{style:{"text-align":"center"}},{default:t(()=>[a(A,null,{default:t(()=>[a(v,{type:"primary",class:"mt-10",onClick:e.onSubmit,loading:e.loading,disabled:e.toShowFeedbackForm},{default:t(()=>[S(w(e.$t("common.submit")),1)]),_:1},8,["onClick","loading","disabled"])]),_:1})]),_:1})]),_:2},1024)]))),128))])):k("",!0)]),_:1})]),_:1})])}const he=N(F,[["render",se]]);export{he as default};
