import"./vue-JTkEfrjZ-v4.7.11.js";import{t as f}from"./functions-Cxk2NqT8-v4.7.11.js";import{t as i}from"./Toaster-BMffx_eb-v4.7.11.js";import{n as p}from"./NProgress-l2LCo1nA-v4.7.11.js";import{_ as h}from"./_plugin-vue_export-helper-DlAUqK2U-v4.7.11.js";import{A as o,aS as u,G as a,bh as l,F as m,b1 as b,bR as _,bE as c,x as k}from"./@vue-oKGFm1pv-v4.7.11.js";import"./@popperjs-IQGopUey-v4.7.11.js";import"./vue-toast-notification-DVWZlwQ6-v4.7.11.js";import"./nprogress-ByFQqwB7-v4.7.11.js";window.toaster=i;const y={data(){return{isDefault:null,languages:[]}},created(){this.languages=FleetCart.data.languages,this.isDefault=this.languages.find(e=>e.is_default===!0)?.key||"en",p()},methods:{makeDefault(e){this.languages.forEach(t=>{t.is_default=t.key===e}),axios.post("languages/make-default",{language:e}).then(t=>{this.languages=t.data,i(trans("translation::languages.default_language_updated"),{type:"default"})}).catch(t=>{i(t.response.data.message,{type:"default"})})},deleteLanguage(e){e!==this.isDefault&&axios.delete("languages/"+e).then(t=>{this.languages=t.data,window.location.reload()}).catch(t=>{i(t.response.data.message,{type:"default"})})}}},w={class:"table-responsive mb-0"},v={class:"table languages-table"},D=["href"],C={class:"switch"},F=["id","value","onChange"],A=["for"],B=["href","title"],E=["onClick","disabled","title"];function L(e,t,$,P,n,g){return u(),o("div",w,[a("table",v,[a("thead",null,[a("tr",null,[a("th",null,l(e.trans("translation::languages.table.name")),1),a("th",null,l(e.trans("translation::languages.table.default")),1),a("th",null,l(e.trans("translation::languages.table.actions")),1)])]),a("tbody",null,[(u(!0),o(m,null,b(n.languages,s=>(u(),o("tr",{key:s.key},[a("td",null,[a("a",{href:e.window.FleetCart.baseUrl+"/admin/languages/"+s.key+"/translations"},l(s.name),9,D)]),a("td",null,[a("div",C,[_(a("input",{type:"radio",name:"is_default",id:`is_default_${s.key}`,value:s.key,"onUpdate:modelValue":t[0]||(t[0]=r=>n.isDefault=r),onChange:r=>g.makeDefault(s.key)},null,40,F),[[c,n.isDefault]]),a("label",{for:`is_default_${s.key}`},null,8,A)])]),a("td",null,[a("a",{href:e.window.FleetCart.baseUrl+"/admin/languages/"+s.key+"/translations",class:"btn btn-default mr-8",title:e.trans("translation::languages.table.translations")},[...t[1]||(t[1]=[a("i",{class:"fa fa-language","aria-hidden":"true"},null,-1)])],8,B),a("button",{class:"btn btn-default",onClick:r=>g.deleteLanguage(s.key),disabled:n.languages.length>1&&s.is_default,title:e.trans("translation::languages.table.delete")},[...t[2]||(t[2]=[a("i",{class:"fa fa-trash"},null,-1)])],8,E)])]))),128))])])])}const U=h(y,[["render",L]]),d=k(U);d.config.globalProperties.window=window;d.config.globalProperties.trans=f;d.mount("#app");
