import{d as w,j as S,s as L,T as V,k as b,r as h,c as u,o as i,a as e,b as r,e as j,i as A,t as n,u as t,f as c,F as f,g as B,w as v,l as y,v as k,N as F}from"./app-Do7K7VDV.js";import{_ as E}from"./AdminLayout-DeT_GLTC.js";import{_ as I}from"./NoDataFound-oJx-Mfyi.js";import"./AssetModal-C18ToIEK.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./InputFieldError-0BmYlL24.js";import"./ToastrContainer-CtYDvNPN.js";const U={class:"space-y-6"},$={class:"table-responsive whitespace-nowrap rounded-primary"},q={class:"table"},D={class:"col-2"},T={class:"flex justify-end"},O={class:"text-left"},P={class:"flex justify-end gap-3"},R=["onClick"],z=["onClick"],G={class:"mb-2"},H={class:"mb-2"},J={class:"label mb-2"},K=w({layout:E}),se=Object.assign(K,{__name:"Index",props:["languages"],setup(m){const d=S(),{deleteRow:x}=L(),s=V({name:""}),o=b({}),p=b(!1),C=()=>{s.post(route("admin.ai-language.store"),{preserveScroll:!0,onSuccess:()=>{s.reset(),d.close("createModal")}})},M=()=>{p.value=!0,F.patch(route("admin.ai-language.update",o.value.id),o.value,{preserveScroll:!0,onSuccess:()=>{o.value={},d.close("editModal")},onFinish:()=>p.value=!1})};return(N,l)=>{const _=h("Icon"),g=h("Modal");return i(),u(f,null,[e("div",U,[e("div",$,[e("table",q,[e("thead",null,[e("tr",null,[e("th",D,n(t(c)("Name")),1),e("th",T,n(t(c)("Action")),1)])]),e("tbody",null,[(i(!0),u(f,null,B(m.languages,a=>(i(),u("tr",{key:a.code},[e("td",O,n(a.name),1),e("td",P,[e("button",{type:"button",class:"btn btn-dark",onClick:()=>{o.value={...a},t(d).open("editModal")}},[r(_,{icon:"fe:edit"})],8,R),e("button",{type:"button",class:"btn btn-danger",onClick:Q=>t(x)(N.route("admin.ai-language.destroy",a.id))},[r(_,{icon:"fe:trash"})],8,z)])]))),128))]),m.languages.length<1?(i(),j(I,{key:0,"for-table":"true"})):A("",!0)])])]),r(g,{state:"createModal","header-state":!0,"header-title":"Add New Language","action-btn-state":!0,"action-btn-text":"Create","action-processing":t(s).processing,onAction:C},{default:v(()=>[e("div",G,[e("label",null,n(t(c)("Name")),1),y(e("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>t(s).name=a),type:"text",name:"name",class:"input",required:"",placeholder:"English"},null,512),[[k,t(s).name]])])]),_:1},8,["action-processing"]),r(g,{state:"editModal","header-state":!0,"header-title":"Edit Language","action-btn-state":!0,"action-btn-text":"Update","action-processing":t(s).processing,onAction:M},{default:v(()=>[e("div",H,[e("label",J,n(t(c)("Name")),1),y(e("input",{"onUpdate:modelValue":l[1]||(l[1]=a=>o.value.name=a),type:"text",name:"name",class:"input",required:""},null,512),[[k,o.value.name]])])]),_:1},8,["action-processing"])],64)}}});export{se as default};
