import{a as W}from"./apiAdmin-DKbjyhIh.js";import{_ as q,d as H,k as C,l as $,a as N,m as T,e as d,w as a,g as t,b as B,i as c,t as u,c as _,h as D,j,F as E,o as l}from"./app-Bei_nIK3.js";import{i as z}from"./isSameOrAfter-CgxEqnGH.js";import{F as L}from"./FormItemHeading-ByxoWgm2.js";import{C as M}from"./CalendarOutlined-CSYNYcxM.js";import{D as R,a as G}from"./index-C9kVL56m.js";import{F as J,_ as K}from"./index-CvmHj1Ev.js";import{I as P}from"./index-Cx28gitG.js";import{S as Q}from"./index-BSQT_3Ti.js";import{B as X}from"./useFlexGapSupport-I9-A4OAO.js";import{a as Y,_ as Z}from"./index-DxFi17QQ.js";import{_ as F}from"./index-CpDcGdHv.js";import{_ as x}from"./TextArea-BzmabrVb.js";import{_ as ee}from"./index-BzGqbIvm.js";const ae=H({props:["data","visible","pageTitle"],components:{CalendarOutlined:M,FormItemHeading:L},setup(e,{emit:f}){const n=C({}),{addEditRequestAdmin:v,loading:h,rules:y}=W(),p=C(!0);$.extend(z);const{formatDate:i,user:b}=N(),s=()=>{y.value={},f("close")},r=()=>{v({url:"self/employee-feedback",data:n.value,successMessage:"Success",success:m=>{f("addSuccess")}})};return T(()=>e.visible,(m,w)=>{m&&(n.value=e.data,n.value.feedback&&n.value.feedback.last_date&&$().isAfter(n.value.feedback.last_date,"date")?p.value=!1:p.value=!0)}),{rules:y,loading:h,onSubmit:r,feedback:n,toShowFeedbackForm:p,user:b,onClose:s,formatDate:i,drawerWidth:window.innerWidth<=991?"90%":"45%"}}}),te={key:0,style:{"white-space":"pre-wrap"}},oe={key:1};function le(e,f,n,v,h,y){const p=B("FormItemHeading"),i=G,b=R,s=Y,r=Z,m=B("CalendarOutlined"),w=F,I=P,k=K,A=x,O=J,S=X,U=Q,V=ee;return l(),d(V,{title:e.pageTitle,width:e.drawerWidth,open:e.visible,"body-style":{paddingBottom:"80px"},"footer-style":{textAlign:"right"},maskClosable:!1},{footer:a(()=>[t(k,null,{default:a(()=>[t(U,null,{default:a(()=>[e.toShowFeedbackForm?(l(),d(S,{key:0,type:"primary",onClick:e.onSubmit,loading:e.loading},{default:a(()=>[c(u(e.$t("common.submit")),1)]),_:1},8,["onClick","loading"])):D("",!0),t(S,{key:"back",onClick:e.onClose},{default:a(()=>[c(u(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),_:1})]),_:1})]),default:a(()=>[t(r,{gutter:16},{default:a(()=>[t(s,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(p,null,{default:a(()=>[c(u(e.$t("feedback.survey_info")),1)]),_:1}),t(b,{labelStyle:{fontWeight:"bold"},contentStyle:{marginBottom:"15px"},column:1,layout:"vertical",size:"small"},{default:a(()=>[t(i,{label:e.$t("feedback.last_date")},{default:a(()=>[c(u(e.feedback.feedback?e.formatDate(e.feedback.last_date):"-"),1)]),_:1},8,["label"]),t(i,{label:e.$t("feedback.description")},{default:a(()=>[e.feedback.feedback.description?(l(),_("div",te,u(e.feedback.feedback.description),1)):(l(),_("span",oe,"-"))]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),e.toShowFeedbackForm?(l(),d(r,{key:1},{default:a(()=>[t(s,{span:24},{default:a(()=>[e.feedback.feedback?(l(),d(O,{key:0,layout:"vertical",class:"mt-30"},{default:a(()=>[(l(!0),_(E,null,j(e.feedback.feedback.feedback_form_fields,o=>(l(),_("div",{key:o.id},[o.type=="input"?(l(),d(r,{key:0,gutter:16},{default:a(()=>[t(s,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(k,{label:o.name,help:e.rules.reply&&!o.reply?e.rules.reply.message:null,validateStatus:e.rules.reply&&!o.reply?"error":null,class:"required"},{default:a(()=>[t(I,{value:o.reply,"onUpdate:value":g=>o.reply=g,placeholder:e.$t("common.placeholder_default_text",[e.$t("feedback.answers")])},null,8,["value","onUpdate:value","placeholder"])]),_:2},1032,["label","help","validateStatus"])]),_:2},1024)]),_:2},1024)):(l(),d(r,{key:1,gutter:16},{default:a(()=>[t(s,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[t(k,{help:e.rules.reply&&!o.reply?e.rules.reply.message:null,validateStatus:e.rules.reply&&!o.reply?"error":null,label:o.name,class:"required"},{default:a(()=>[t(A,{value:o.reply,"onUpdate:value":g=>o.reply=g,placeholder:e.$t("common.placeholder_default_text",[e.$t("feedback.answers")])},null,8,["value","onUpdate:value","placeholder"])]),_:2},1032,["help","validateStatus","label"])]),_:2},1024)]),_:2},1024))]))),128))]),_:1})):D("",!0)]),_:1})]),_:1})):(l(),d(r,{key:0,gutter:16},{default:a(()=>[t(s,{span:24},{default:a(()=>[t(w,{message:e.$t("common.expired"),description:e.$t("feedback.submittion_date_expired"),type:"error","show-icon":""},{icon:a(()=>[t(m)]),_:1},8,["message","description"])]),_:1})]),_:1}))]),_:1},8,["title","width","open"])}const ge=q(ae,[["render",le]]);export{ge as F};
