import{r as v,d as w,o as l,c as d,a,l as _,D,F as k,m as S,t as c,e as i,v as m,w as U,f as V,i as g,B as q,C,g as n}from"./app-91dba96b.js";import{a as P}from"./appFunction-1b5b1f43.js";import{i as B}from"./index-0653e21c.js";import{u as N}from"./urlGenerator-87d92adb.js";import{_ as I}from"./_plugin-vue_export-helper-c27b6911.js";const r=p=>(q("data-v-9d7d6978"),p=p(),C(),p),M={class:"container-fluid pb-5 my-5 installer-container"},F={class:"row justify-content-center align-items-center"},L={class:"col-12 col-lg-7 mt-4 mb-4"},j={class:"card"},T=r(()=>a("div",{class:"card-header"},[a("h4",{class:"mt-2 fw-bolder"},[n(" Database Configuration "),a("span",{class:"text-danger"},"*")])],-1)),E={class:"card-body"},G={class:"mb-4"},H=r(()=>a("label",{class:"form-label"},[n("Database Driver "),a("span",{class:"text-danger"},"*")],-1)),R=["value"],z={key:0,class:"text-danger"},A={class:"mb-4"},J=r(()=>a("label",{class:"form-label"},[n("Database Hostname "),a("span",{class:"text-danger"},"*")],-1)),K={key:0,class:"text-danger"},O={class:"mb-4"},Q=r(()=>a("label",{class:"form-label"},[n("Database Port "),a("span",{class:"text-danger"},"*")],-1)),W={key:0,class:"text-danger"},X={class:"mb-4"},Y=r(()=>a("label",{class:"form-label"},[n("Database Name "),a("span",{class:"text-danger"},"*")],-1)),Z={key:0,class:"text-danger"},$={class:"mb-4"},aa=r(()=>a("label",{class:"form-label"},[n("Database Username "),a("span",{class:"text-danger"},"*")],-1)),ea={key:0,class:"text-danger"},sa={class:"mb-4"},ta=r(()=>a("label",{class:"form-label"},[n("Database Password "),a("span",{class:"text-danger"},"*")],-1)),oa={key:0,class:"text-danger"},la=r(()=>a("div",{class:"mb-2"},[a("span",{class:"m-0"},[n("Database name, username, and password must not contain "),a("code",null,'"#"'),n(" or "),a("code",null,"white spaces"),n("!")])],-1)),na={class:"d-flex justify-content-center gap-3"},da=["disabled"],ra=r(()=>a("span",null,"Next",-1)),ca={__name:"environmentSetup",setup(p){const t=v({database_connection:"mysql"}),s=v({}),x=v([{id:"mysql",name:"Mysql"},{id:"sqlite",name:"Sqlite"},{id:"pgsql",name:"Pgsql"}]),b=v(!1),y=()=>{const f=window.location.search,h=new URLSearchParams(f).get("purchase_code");let e={...t.value,app_url:P.baseUrl(),purchase_code:h};b.value=!0,s.value={},B.post("connect-database",e).then(u=>{g.success(u.data.message),location.replace(N("user-information"))}).catch(({response:u})=>{u.status===422?s.value=u.data.errors:(s.value={},g.error(u.data.message))}).finally(()=>b.value=!1)};return(f,o)=>{const h=w("app-button-loader");return l(),d("div",M,[a("div",F,[a("div",L,[a("div",j,[T,a("div",E,[a("div",G,[H,_(a("select",{class:"form-control",id:"database_driver","onUpdate:modelValue":o[0]||(o[0]=e=>t.value.database_connection=e)},[(l(!0),d(k,null,S(x.value,e=>(l(),d("option",{value:e.id},c(e.name),9,R))),256))],512),[[D,t.value.database_connection]]),s.value.database_connection?(l(),d("small",z,c(s.value.database_connection[0]),1)):i("",!0)]),a("div",A,[J,_(a("input",{type:"text",class:"form-control",id:"database_hostname",placeholder:"Database hostname","onUpdate:modelValue":o[1]||(o[1]=e=>t.value.database_hostname=e)},null,512),[[m,t.value.database_hostname]]),s.value.database_hostname?(l(),d("small",K,c(s.value.database_hostname[0]),1)):i("",!0)]),a("div",O,[Q,_(a("input",{type:"text",class:"form-control",id:"database_port",placeholder:"Database port","onUpdate:modelValue":o[2]||(o[2]=e=>t.value.database_port=e)},null,512),[[m,t.value.database_port]]),s.value.database_port?(l(),d("small",W,c(s.value.database_port[0]),1)):i("",!0)]),a("div",X,[Y,_(a("input",{type:"text",class:"form-control",id:"database_name",placeholder:"Database name","onUpdate:modelValue":o[3]||(o[3]=e=>t.value.database_name=e)},null,512),[[m,t.value.database_name]]),s.value.database_name?(l(),d("small",Z,c(s.value.database_name[0]),1)):i("",!0)]),a("div",$,[aa,_(a("input",{type:"text",class:"form-control",id:"database_username",placeholder:"Database username","onUpdate:modelValue":o[4]||(o[4]=e=>t.value.database_username=e)},null,512),[[m,t.value.database_username]]),s.value.database_username?(l(),d("small",ea,c(s.value.database_username[0]),1)):i("",!0)]),a("div",sa,[ta,_(a("input",{type:"password",class:"form-control",id:"database_password",placeholder:"Database password","onUpdate:modelValue":o[5]||(o[5]=e=>t.value.database_password=e)},null,512),[[m,t.value.database_password]]),s.value.database_password?(l(),d("small",oa,c(s.value.database_password[0]),1)):i("",!0)]),la,a("div",na,[a("button",{type:"button",class:"btn btn-primary btn-lg px-4",disabled:b.value,onClick:U(y,["prevent"])},[b.value?(l(),V(h,{key:0})):i("",!0),ra],8,da)])])])])])])}}},ba=I(ca,[["__scopeId","data-v-9d7d6978"]]);export{ba as default};
