import{_ as S,a as _,c as n,o as a,e as i,b as o,f as m,G as c,t as r,K as f,I as u,D as p,d as b,E as w,h,w as E}from"./Bgmy51Qv.js";import{A as y}from"./AmaTRG5a.js";import{u as P}from"./7pZkuj9N.js";import{v as I}from"./B2895E6R.js";import{_ as V}from"./CNIrc0EA.js";import{u as q}from"./BHvLfWtM.js";import{_ as D}from"./DIkWVjrx.js";import"./DuhDFJjj.js";const L={setup(){const{setRequest:t,getRequest:s}=P();return{setRequest:t,getRequest:s}},name:"SocialLoginSetting",data(){return{gettingStore:!1,updating:!1,loading:!1,hasError:!1,result:{facebook_login:!0,google_login:!0,googleClientId:null,googleClientSecret:null,facebookClientId:null,facebookClientSecret:null}}},props:{},mixins:[q,I],components:{AjaxButton:y,Spinner:_,ErrorFormatter:V},computed:{},methods:{async fetchingData(){try{this.loading=!0;const t=await this.getRequest({params:{},api:"socialLoginFind"});t&&(this.result=t),this.loading=!1}catch(t){h({statusCode:400,message:t.message})}},async updateData(){if(this.result.googleClientId&&this.result.googleClientSecret||this.result.facebookClientId&&this.result.facebookClientSecret){this.updating=!0;try{const t=await this.setRequest({params:this.result,api:"socialLoginAction"});t&&(this.result=t)}catch(t){h({statusCode:400,message:t.message})}this.updating=!1}else this.hasError=!0}},async mounted(){await this.fetchingData()}},U={key:0,class:"spinner-wrapper"},B={class:"input-wrapper"},A={class:"input-wrapper dply-felx start gap-10"},R={for:"google-login",class:"mb-0 dply-felx start gap-10"},M={class:"label"},N={class:"input-wrapper"},j=["placeholder"],F={key:0,class:"error"},x={class:"input-wrapper"},z=["placeholder"],G={key:0,class:"error"},K={class:"input-wrapper dply-felx start gap-10"},T={for:"facebook-login",class:"mb-0 dply-felx start gap-10"},H={class:"label"},J={class:"input-wrapper"},O=["placeholder"],Q={key:0,class:"error"},W={class:"input-wrapper"},X=["placeholder"],Y={key:0,class:"error"},Z={class:"oflow-hidden"};function $(t,s,C,g,e,d){const k=_,v=y;return a(),n("form",{class:p({"has-error":e.hasError}),onSubmit:s[6]||(s[6]=w((...l)=>d.updateData&&d.updateData(...l),["prevent"]))},[e.loading?(a(),n("div",U,[m(k,{radius:60,color:"primary",class:"mr-15"})])):i("",!0),o("div",B,[o("div",A,[o("label",R,[o("span",M,r(t.$t("title.googleLogin")),1),c(o("input",{type:"checkbox",id:"google-login","true-value":1,"false-value":0,"onUpdate:modelValue":s[0]||(s[0]=l=>e.result.google_login=l)},null,512),[[f,e.result.google_login]])])]),o("div",N,[o("label",null,r(t.$t("dataPage.gci")),1),c(o("input",{type:"password",placeholder:t.$t("dataPage.gci"),"onUpdate:modelValue":s[1]||(s[1]=l=>e.result.googleClientId=l),class:p({invalid:!e.result.googleClientId&&e.hasError})},null,10,j),[[u,e.result.googleClientId]]),!e.result.googleClientId&&e.hasError?(a(),n("span",F,r(t.$t("category.req",{type:t.$t("dataPage.gci")})),1)):i("",!0)]),o("div",x,[o("label",null,r(t.$t("dataPage.gcs")),1),c(o("input",{type:"password",placeholder:t.$t("dataPage.gcs"),"onUpdate:modelValue":s[2]||(s[2]=l=>e.result.googleClientSecret=l),class:p({invalid:!e.result.googleClientSecret&&e.hasError})},null,10,z),[[u,e.result.googleClientSecret]]),!e.result.googleClientSecret&&e.hasError?(a(),n("span",G,r(t.$t("category.req",{type:t.$t("dataPage.gcs")})),1)):i("",!0)]),o("div",K,[o("label",T,[o("span",H,r(t.$t("title.facebookLogin")),1),c(o("input",{type:"checkbox",id:"facebook-login","true-value":1,"false-value":0,"onUpdate:modelValue":s[3]||(s[3]=l=>e.result.facebook_login=l)},null,512),[[f,e.result.facebook_login]])])]),o("div",J,[o("label",null,r(t.$t("dataPage.fci")),1),c(o("input",{type:"password",placeholder:t.$t("dataPage.fci"),"onUpdate:modelValue":s[4]||(s[4]=l=>e.result.facebookClientId=l),class:p({invalid:!e.result.facebookClientId&&e.hasError})},null,10,O),[[u,e.result.facebookClientId]]),!e.result.facebookClientId&&e.hasError?(a(),n("span",Q,r(t.$t("category.req",{type:t.$t("dataPage.fci")})),1)):i("",!0)]),o("div",W,[o("label",null,r(t.$t("dataPage.fcs")),1),c(o("input",{type:"password",placeholder:t.$t("dataPage.fcs"),"onUpdate:modelValue":s[5]||(s[5]=l=>e.result.facebookClientSecret=l),class:p({invalid:!e.result.facebookClientSecret&&e.hasError})},null,10,X),[[u,e.result.facebookClientSecret]]),!e.result.facebookClientSecret&&e.hasError?(a(),n("span",Y,r(t.$t("category.req",{type:t.$t("dataPage.fcs")})),1)):i("",!0)])]),o("div",Z,[t.$can("setting","edit")?(a(),b(v,{key:0,class:"primary-btn","fetching-data":e.updating},null,8,["fetching-data"])):i("",!0)])],34)}const ee=S(L,[["render",$]]),ce={__name:"social-login",setup(t){return(s,C)=>{const g=ee,e=D;return a(),b(e,{"active-route":"social-login",class:"mb-5"},{rightArea:E(()=>[m(g)]),_:1})}}};export{ce as default};
