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