import{_ as v,a as _,c as n,o as l,e as p,b as e,f as y,G as m,t as a,I as u,D as i,d as P,E as U,h as g,w as b}from"./Bgmy51Qv.js";import{A as f}from"./AmaTRG5a.js";import{v as k}from"./B2895E6R.js";import{_ as F}from"./CNIrc0EA.js";import{u as S}from"./BHvLfWtM.js";import{u as q}from"./7pZkuj9N.js";import{_ as H}from"./DIkWVjrx.js";import"./DuhDFJjj.js";const V={setup(){const t=q(),{setRequest:r,getRequest:d}=t;return{setRequest:r,getRequest:d}},name:"SmtpSetting",data(){return{gettingStore:!1,updating:!1,loading:!1,hasError:!1,result:{smtpHost:null,smtpPort:null,smtpUsername:null,smtpPassword:null,smtpEncryption:null,mailFrom:null}}},props:{},mixins:[S,k],components:{AjaxButton:f,Spinner:_,ErrorFormatter:F},computed:{},methods:{async fetchingData(){try{this.loading=!0;const t=await this.getRequest({params:{},api:"smtpFind"});t&&(this.result=t),this.loading=!1}catch(t){g({statusCode:400,message:t.message})}},async updateData(){if(this.result.smtpHost&&this.result.smtpPort&&this.result.smtpUsername&&this.result.smtpPassword&&this.result.smtpEncryption&&this.result.mailFrom){this.updating=!0;try{const t=await this.setRequest({params:this.result,api:"smtpAction"});t&&(this.result=t)}catch(t){g({statusCode:400,message:t.message})}this.updating=!1}else this.hasError=!0}},created(){},async mounted(){await this.fetchingData()}},D={key:0,class:"spinner-wrapper"},C={class:"input-wrapper"},B={class:"input-wrapper"},A=["placeholder"],R={key:0,class:"error"},N={class:"dply-felx inputs"},j={class:"input-wrapper w-50 pr-7-5"},M=["placeholder"],z={key:0,class:"error"},G={class:"input-wrapper w-50 pl-7-5"},I=["placeholder"],L={key:0,class:"error"},T={class:"input-wrapper"},J=["placeholder"],K={key:0,class:"error"},O={class:"input-wrapper"},Q=["placeholder"],W={key:0,class:"error"},X={class:"input-wrapper"},Y=["placeholder"],Z={key:0,class:"error"},x={class:"oflow-hidden"};function $(t,r,d,c,s,h){const E=_,w=f;return l(),n("form",{class:i({"has-error":s.hasError}),onSubmit:r[6]||(r[6]=U((...o)=>h.updateData&&h.updateData(...o),["prevent"]))},[s.loading?(l(),n("div",D,[y(E,{radius:60,color:"primary",class:"mr-15"})])):p("",!0),e("div",C,[e("div",B,[e("label",null,a(t.$t("dataPage.smtpHost")),1),m(e("input",{type:"text",placeholder:t.$t("dataPage.smtpHost"),"onUpdate:modelValue":r[0]||(r[0]=o=>s.result.smtpHost=o),class:i({invalid:!s.result.smtpHost&&s.hasError})},null,10,A),[[u,s.result.smtpHost]]),!s.result.smtpHost&&s.hasError?(l(),n("span",R,a(t.$t("category.req",{type:t.$t("dataPage.smtpHost")})),1)):p("",!0)]),e("div",N,[e("div",j,[e("label",null,a(t.$t("dataPage.smtpPort")),1),m(e("input",{type:"text",placeholder:t.$t("dataPage.smtpPort"),"onUpdate:modelValue":r[1]||(r[1]=o=>s.result.smtpPort=o),class:i({invalid:!s.result.smtpPort&&s.hasError})},null,10,M),[[u,s.result.smtpPort]]),!s.result.smtpPort&&s.hasError?(l(),n("span",z,a(t.$t("category.req",{type:t.$t("dataPage.smtpPort")})),1)):p("",!0)]),e("div",G,[e("label",null,a(t.$t("dataPage.smtpEnc")),1),m(e("input",{type:"text",placeholder:t.$t("dataPage.smtpEnc"),"onUpdate:modelValue":r[2]||(r[2]=o=>s.result.smtpEncryption=o),class:i({invalid:!s.result.smtpEncryption&&s.hasError})},null,10,I),[[u,s.result.smtpEncryption]]),!s.result.smtpEncryption&&s.hasError?(l(),n("span",L,a(t.$t("category.req",{type:t.$t("dataPage.smtpEnc")})),1)):p("",!0)])]),e("div",T,[e("label",null,a(t.$t("dataPage.smtpUser")),1),m(e("input",{type:"text",placeholder:t.$t("dataPage.smtpUser"),"onUpdate:modelValue":r[3]||(r[3]=o=>s.result.smtpUsername=o),class:i({invalid:!s.result.smtpUsername&&s.hasError})},null,10,J),[[u,s.result.smtpUsername]]),!s.result.smtpUsername&&s.hasError?(l(),n("span",K,a(t.$t("category.req",{type:t.$t("dataPage.smtpUser")})),1)):p("",!0)]),e("div",O,[e("label",null,a(t.$t("dataPage.smtpPass")),1),m(e("input",{type:"password",placeholder:t.$t("dataPage.smtpPass"),"onUpdate:modelValue":r[4]||(r[4]=o=>s.result.smtpPassword=o),class:i({invalid:!s.result.smtpPassword&&s.hasError})},null,10,Q),[[u,s.result.smtpPassword]]),!s.result.smtpPassword&&s.hasError?(l(),n("span",W,a(t.$t("category.req",{type:t.$t("dataPage.smtpPass")})),1)):p("",!0)]),e("div",X,[e("label",null,a(t.$t("dataPage.smtpForm")),1),m(e("input",{type:"text",placeholder:t.$t("dataPage.smtpForm"),"onUpdate:modelValue":r[5]||(r[5]=o=>s.result.mailFrom=o),class:i({invalid:!s.result.mailFrom&&s.hasError})},null,10,Y),[[u,s.result.mailFrom]]),!s.result.mailFrom&&s.hasError?(l(),n("span",Z,a(t.$t("category.req",{type:t.$t("dataPage.smtpForm")})),1)):p("",!0)])]),e("div",x,[t.$can("setting","edit")?(l(),P(w,{key:0,class:"primary-btn","fetching-data":s.updating},null,8,["fetching-data"])):p("",!0)])],34)}const ss=v(V,[["render",$]]),is={__name:"smtp",setup(t){return(r,d)=>{const c=ss,s=H;return l(),P(s,{"active-route":"smtp",class:"mb-5"},{rightArea:b(()=>[y(c)]),_:1})}}};export{is as default};
