import u from"./CXFeb46j.js";import h from"./Bvs3L9q-.js";import b from"./YMgwR3Gi.js";import{K as f,i as y,j as p,w as g,k as t,t as o,v as k,l as c,C as w,m as v,A as S,D as I,E as B,X as E,a as G,b as x,s as C}from"./BCLrUOBx.js";import{p as P}from"./Dq2bRmo2.js";import"./CWalxxGV.js";const T={setup(){const e=G(),{getUserToken:s}=e,l=x(),{paymentGateway:a}=C(l),{unAuthGet:r,postRequest:n,setToastMessage:m,setToastError:i}=l;return{getUserToken:s,paymentGateway:a,postRequest:n,setToastMessage:m,setToastError:i,unAuthGet:r}},name:"BankPopup",data(){return{formSubmitting:!1,hasFormError:!1,transId:"",errors:[]}},watch:{},props:{order:{type:Object,default(){return null}}},components:{ErrorHandler:u,AjaxButton:h,PopOver:b},computed:{orderId(){return parseInt((this._.provides[E]||this.$route).params.id)}},mixins:[P],methods:{async formSubmit(){var e;if(this.transId){this.hasFormError=!1,this.formSubmitting=!0;const s=await this.postRequest({params:{data:this.phpEncryption({id:this.orderId,trans_id:this.transId,user_token:await this.getUserToken()})},api:"setTransaction"});(s==null?void 0:s.status)===200?(this.closeBankVerify(),this.setToastMessage(this.$t("date.pds"))):this.errors=(e=s==null?void 0:s.data)==null?void 0:e.form,this.formSubmitting=!1}else this.hasFormError=!0},closeBankVerify(){this.$emit("close",this.transId)}},created(){},async mounted(){var e;if(this.transId=(e=this.order)==null?void 0:e.trans_id,!this.paymentGateway){const s=await this.unAuthGet({params:"",api:"paymentGateway"});this.setPaymentGateway(s.data)}}},V={class:"mn-w-350x mn-w-sm-0"},F={class:"bank-detail mt-30 mt-sm-20 mb-30 mb-sm-20"},R={class:"bold block mb-5"},$={class:"color-lite"},j={class:"bold block mb-5"},A={class:"color-lite"},M={class:"bold block mb-5"},N={class:"color-lite"},U={class:"bold block mb-5"},q={class:"color-lite"},D={class:"color-lite"},H={class:"icon-input"},O={key:0,class:"error"},X={ref:"submitBtn",class:"flex right gap-10 no-space"};function z(e,s,l,a,r,n){const m=u,i=h,_=b;return p(),y(_,{title:e.$t("date.pv"),onClose:n.closeBankVerify,layer:!0,class:"bank-popup","elem-id":"verify-bank"},{content:g(()=>[t("p",V,o(e.$t("date.kr")),1),t("div",F,[t("div",null,[t("label",R,o(e.$t("date.bn")),1),t("label",$,o(a.paymentGateway.bank_name),1)]),t("div",null,[t("label",j,o(e.$t("date.ahn")),1),t("label",A,o(a.paymentGateway.account_name),1)]),t("div",null,[t("label",M,o(e.$t("date.an")),1),t("label",N,o(a.paymentGateway.account_number),1)]),t("div",null,[t("label",U,o(e.$t("date.brn")),1),t("label",q,o(a.paymentGateway.branch_name),1)])]),t("form",{onSubmit:s[1]||(s[1]=k((...d)=>n.formSubmit&&n.formSubmit(...d),["prevent"]))},[c(m,{errors:r.errors},null,8,["errors"]),t("div",{class:w(["input-wrap",{invalid:!r.transId&&r.hasFormError}])},[t("label",D,o(e.$t("date.ti")),1),t("div",H,[s[2]||(s[2]=t("i",{class:"icon trans-icon"},null,-1)),I(t("input",{type:"text","onUpdate:modelValue":s[0]||(s[0]=d=>r.transId=d),placeholder:"eg. 20230704N2H5X2"},null,512),[[B,r.transId]])]),!r.transId&&r.hasFormError?(p(),v("span",O,o(e.$t("addressPopup.isRequired",{type:e.$t("date.ti")})),1)):S("",!0)],2),t("div",X,[c(i,{type:"button",class:"outline-btn plr-20 w-100x",text:e.$t("addressPopup.cancel"),"loading-text":e.$t("forgotPassword.registering"),onClicked:n.closeBankVerify},null,8,["text","loading-text","onClicked"]),c(i,{class:"primary-btn plr-20 w-150x","fetching-data":r.formSubmitting,"loading-text":e.$t("forgotPassword.registering")},null,8,["fetching-data","loading-text"])],512)],32)]),_:1},8,["title","onClose"])}const Z=f(T,[["render",z]]);export{Z as default};
