import{d as q,j as D,s as V,T as U,k as F,r as w,c,o as d,a as t,b as r,e as N,t as a,u as e,f as o,F as m,g as b,n as B,w as f,z as E,l as _,v as k,A as g,N as L}from"./app-Do7K7VDV.js";import{_ as T}from"./AdminLayout-DeT_GLTC.js";import{h as $}from"./moment-BAtM24Ew.js";import{_ as j}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 I={class:"table-responsive whitespace-nowrap rounded-primary"},z={class:"table"},O={class:"text-center"},R={class:"flex justify-end"},Y={key:0},G={class:"text-left"},H={class:"text-left"},J={class:"text-center"},K={class:"text-left"},P={class:"text-right"},Q={class:"dropdown","data-placement":"bottom-start"},W={class:"dropdown-toggle"},X={class:"dropdown-content w-40"},Z={class:"dropdown-list"},tt={class:"dropdown-list-item"},et=["onClick"],st={class:"dropdown-list-item"},at={class:"mb-2"},ot={class:"mb-2"},lt={value:"1"},nt={value:"0"},it={class:"mb-2"},dt=["value"],ct={class:"mb-2"},ut={class:"mb-2"},rt={value:"1"},_t={value:"0"},pt={class:"mb-2"},mt=["value"],gt=q({layout:T}),yt=Object.assign(gt,{__name:"Index",props:["categories","totalCategories","activeCategories","inActiveCategories","languages","buttons"],setup(p){const v=D(),{deleteRow:y}=V(),i=U({title:"",status:"active",language:""}),n=F({}),M=()=>{i.post(route("admin.faq-category.store"),{onSuccess:()=>{i.reset(),v.close("createModal")}})},S=x=>{n.value={...x},v.open("editModal")},A=()=>{L.patch(route("admin.faq-category.update",n.value.id),n.value,{onSuccess:()=>{n.value={},v.close("editModal")}})};return(x,l)=>{const h=w("Icon"),C=w("Modal");return d(),c(m,null,[t("div",I,[t("table",z,[t("thead",null,[t("tr",null,[t("th",null,a(e(o)("Name")),1),t("th",null,a(e(o)("Slug")),1),t("th",O,a(e(o)("Language")),1),t("th",null,a(e(o)("Status")),1),t("th",null,a(e(o)("Created At")),1),t("th",R,a(e(o)("Action")),1)])]),p.categories.total?(d(),c("tbody",Y,[(d(!0),c(m,null,b(p.categories.data,s=>(d(),c("tr",{key:s.id},[t("td",G,a(s.title),1),t("td",H,a(s.slug),1),t("td",J,a(s.lang),1),t("td",K,[t("span",{class:B(["badge",s.status==1?"badge-success":"badge-danger"])},a(s.status==1?e(o)("Active"):e(o)("Draft")),3)]),t("td",null,a(e($)(s.created_at).format("D-MMM-Y")),1),t("td",null,[t("div",P,[t("div",Q,[t("div",W,[r(h,{class:"w-30 text-lg",icon:"bi:three-dots-vertical"})]),t("div",X,[t("ul",Z,[t("li",tt,[t("button",{onClick:u=>S(s),class:"dropdown-link"},[r(h,{class:"h-6 text-slate-400",icon:"material-symbols:edit-outline"}),t("span",null,a(e(o)("Edit")),1)],8,et)]),t("li",st,[r(e(E),{as:"button",class:"dropdown-link",onClick:u=>e(y)("/admin/category/"+s.id)},{default:f(()=>[r(h,{class:"h-6",icon:"material-symbols:delete-outline"}),t("span",null,a(e(o)("Delete")),1)]),_:2},1032,["onClick"])])])])])])])]))),128))])):(d(),N(j,{key:1,"for-table":"true"}))])]),r(C,{state:"createModal","header-state":!0,"header-title":e(o)("Create Faq Category"),"action-btn-text":e(o)("Create"),"action-btn-state":!0,"action-processing":e(i).processing,onAction:M},{default:f(()=>[t("div",at,[t("label",null,a(e(o)("Title")),1),_(t("input",{"onUpdate:modelValue":l[0]||(l[0]=s=>e(i).title=s),type:"text",name:"title",class:"input",required:""},null,512),[[k,e(i).title]])]),t("div",ot,[t("label",null,a(e(o)("Status")),1),_(t("select",{required:"","onUpdate:modelValue":l[1]||(l[1]=s=>e(i).status=s),class:"select",name:"status"},[t("option",lt,a(e(o)("Active")),1),t("option",nt,a(e(o)("Deactive")),1)],512),[[g,e(i).status]])]),t("div",it,[t("label",null,a(e(o)("Language")),1),_(t("select",{required:"","onUpdate:modelValue":l[2]||(l[2]=s=>e(i).language=s),class:"select",name:"language"},[(d(!0),c(m,null,b(p.languages,(s,u)=>(d(),c("option",{key:u,value:u},a(s),9,dt))),128))],512),[[g,e(i).language]])])]),_:1},8,["header-title","action-btn-text","action-processing"]),r(C,{state:"editModal","header-state":!0,"header-title":e(o)("Edit Faq Category"),"action-btn-text":e(o)("Update"),"action-btn-state":!0,"action-processing":n.value.processing,onAction:A},{default:f(()=>[t("div",ct,[t("label",null,a(e(o)("Title")),1),_(t("input",{"onUpdate:modelValue":l[3]||(l[3]=s=>n.value.title=s),type:"text",name:"title",class:"input",required:""},null,512),[[k,n.value.title]])]),t("div",ut,[t("label",null,a(e(o)("Status")),1),_(t("select",{"onUpdate:modelValue":l[4]||(l[4]=s=>n.value.status=s),class:"select",name:"status"},[t("option",rt,a(e(o)("Active")),1),t("option",_t,a(e(o)("Deactive")),1)],512),[[g,n.value.status]])]),t("div",pt,[t("label",null,a(e(o)("Language")),1),_(t("select",{"onUpdate:modelValue":l[5]||(l[5]=s=>n.value.lang=s),class:"select",name:"language"},[(d(!0),c(m,null,b(p.languages,(s,u)=>(d(),c("option",{key:u,value:u},a(s),9,mt))),128))],512),[[g,n.value.lang]])])]),_:1},8,["header-title","action-btn-text","action-processing"])],64)}}});export{yt as default};
