import{l as x,T as S,m as C,h as K,c as p,b as s,a as i,w as _,t as a,F as f,r as N,d as m,v as b,u as r,g as D,o as g,q as h,O as T}from"./app-13978987.js";import{_ as v}from"./SpinnerBtn-cb152833.js";import{_ as U}from"./AdminLayout-bd13ff9d.js";import{_ as $}from"./PageHeader-8c638686.js";import{d as y}from"./drawer-fe4c5e1a.js";import"./dropdown-45d66330.js";const q={class:"sm:p6 container flex-grow p-4"},B={class:"space-y-6"},M={class:"table-responsive whitespace-nowrap rounded-primary"},O={class:"table"},j={class:"col-6"},E={class:"col-6"},F=["onUpdate:modelValue"],I={class:"card-footer"},A={id:"addNewLanguageKeyDrawer",class:"drawer drawer-right"},P={class:"drawer-header"},z={type:"button",class:"btn btn-plain-secondary dark:text-slate-300 dark:hover:bg-slate-700 dark:focus:bg-slate-700","data-dismiss":"drawer"},G={class:"drawer-body"},H={class:"mb-2"},J={class:"mb-2"},Q={class:"drawer-footer"},R={class:"flex justify-between gap-2"},W={type:"button",class:"btn btn-secondary w-full","data-dismiss":"drawer"},X=D({layout:U}),ns=Object.assign(X,{__name:"Show",props:["posts","id","buttons","segments"],setup(o){x(()=>{y.init()});const u=o,e=S({key:"",value:"",id:u.id}),w=()=>{e.post("/admin/language/addkey",{onSuccess:()=>{e.reset(),h.success(trans("Language key has been added successfully")),y.of("#addNewLanguageKeyDrawer").hide()}})},c=C(!1),k=()=>{c.value=!0,T.patch(route("admin.language.update",u.id),{values:u.posts},{onSuccess:()=>{e.reset(),c.value=!1,h.success(trans("Language key has been added successfully"))}})};return(t,n)=>{const L=K("Icon");return g(),p(f,null,[s("main",q,[i($,{title:"Edit Language",buttons:o.buttons},null,8,["buttons"]),s("div",B,[s("form",{onSubmit:_(k,["prevent"]),method:"post"},[s("div",M,[s("table",O,[s("thead",null,[s("tr",null,[s("th",j,a(t.trans("Translation Key")),1),s("th",E,a(t.trans("Translated Value")),1)])]),s("tbody",null,[(g(!0),p(f,null,N(o.posts,(l,d)=>(g(),p("tr",{key:d},[s("td",null,a(d),1),s("td",null,[m(s("input",{type:"text",class:"input","onUpdate:modelValue":V=>o.posts[d]=V},null,8,F),[[b,o.posts[d]]])])]))),128))])])]),s("div",I,[i(v,{"btn-text":t.trans("Save Changes"),processing:c.value},null,8,["btn-text","processing"])])],32)])]),s("div",A,[s("form",{onSubmit:n[2]||(n[2]=_(l=>w(),["prevent"]))},[s("div",P,[s("h5",null,a(t.trans("Add New Language")),1),s("button",z,[i(L,{class:"text-xl",icon:"mdi:close"})])]),s("div",G,[s("div",H,[s("label",null,a(t.trans("Key")),1),m(s("input",{type:"text",name:"key","onUpdate:modelValue":n[0]||(n[0]=l=>r(e).key=l),class:"input",required:""},null,512),[[b,r(e).key]])]),s("div",J,[s("label",null,a(t.trans("Value")),1),m(s("input",{type:"text",name:"value","onUpdate:modelValue":n[1]||(n[1]=l=>r(e).value=l),class:"input",required:""},null,512),[[b,r(e).value]])])]),s("div",Q,[s("div",R,[s("button",W,[s("span",null,a(t.trans("Close")),1)]),i(v,{classes:"btn btn-primary w-full",processing:r(e).processing,"btn-text":t.trans("Create")},null,8,["processing","btn-text"])])])],32)])],64)}}});export{ns as default};
