import{d as N,s as A,f as s,T as w,r as f,c as p,o as u,b as c,a as t,w as C,l as r,t as o,u as e,v as _,A as g,e as V,F as k,g as F,n as $}from"./app-Do7K7VDV.js";import{_ as M}from"./AdminLayout-DeT_GLTC.js";import{_ as B}from"./Paginate-BZTS8QtF.js";import{_ as E}from"./NoDataFound-oJx-Mfyi.js";import{_ as Y}from"./FilterDropdown-HyKaUaTA.js";import{h as T}from"./moment-BAtM24Ew.js";import"./AssetModal-C18ToIEK.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./InputFieldError-0BmYlL24.js";import"./ToastrContainer-CtYDvNPN.js";import"./SpinnerBtn-C-rqKjUt.js";const j={class:"mb-2"},z={class:"mb-2"},O={class:"mb-2"},L={value:"active"},R={value:"inactive"},q={class:"mb-2"},G={class:"mb-2"},H={class:"mb-2"},J={value:"active"},K={value:"inactive"},P={class:"table-responsive whitespace-nowrap rounded-primary"},Q={class:"table"},W={class:"!text-end"},X={key:0},Z={class:"text-center"},tt={class:"flex justify-end"},et={class:"dropdown","data-placement":"bottom-start"},st={class:"dropdown-toggle"},ot={class:"dropdown-content w-40"},at={class:"dropdown-list"},nt={class:"dropdown-list-item"},lt=["onClick"],it={class:"dropdown-list-item"},dt=["onClick"],ct=N({layout:M}),gt=Object.assign(ct,{__name:"Index",props:["countries","counter"],setup(m){const{deleteRow:x}=A(),v=m,y=[{label:"Name",value:"name"},{label:"Country Code",value:"code"},{label:"Status",value:"status",options:[{label:"Active",value:"active"},{label:"Inactive",value:"inactive"}]}];v.counter.total,s("Total"),v.counter.active,s("Active"),v.counter.inactive,s("Inactive");const i=w({name:"",code:"",status:"active"}),I=()=>{i.post(route("admin.countries.store"),{onSuccess:()=>drawer.of("#addNewItemDrawer").hide(),onFinish:()=>form.reset()})},n=w({id:null,name:"",code:"",status:"active"}),S=d=>{n.id=d.id,n.name=d.name,n.code=d.code,n.status=d.status,drawer.of("#updateItemDrawer").show()},D=()=>{n.put(route("admin.countries.update",n.id),{onSuccess:()=>n.reset(),onFinish:()=>drawer.of("#updateItemDrawer").hide()})};return(d,l)=>{const h=f("Drawer"),b=f("Icon");return u(),p(k,null,[c(h,{id:"addNewItemDrawer",title:e(s)("Add New Country"),handleSubmit:I,processing:e(i).processing},{default:C(()=>[t("div",j,[t("label",null,o(e(s)("Country Name")),1),r(t("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>e(i).name=a),class:"input",placeholder:"United States"},null,512),[[_,e(i).name]])]),t("div",z,[t("label",null,o(e(s)("Country Code")),1),r(t("input",{"onUpdate:modelValue":l[1]||(l[1]=a=>e(i).code=a),class:"input",placeholder:"US"},null,512),[[_,e(i).code]])]),t("div",O,[t("label",null,o(e(s)("Status")),1),r(t("select",{"onUpdate:modelValue":l[2]||(l[2]=a=>e(i).status=a),class:"select"},[t("option",L,o(e(s)("Active")),1),t("option",R,o(e(s)("Inactive")),1)],512),[[g,e(i).status]])])]),_:1},8,["title","processing"]),c(h,{id:"updateItemDrawer",title:e(s)("Edit Country"),handleSubmit:D,processing:e(n).processing},{default:C(()=>[t("div",q,[t("label",null,o(e(s)("Country Name")),1),r(t("input",{"onUpdate:modelValue":l[3]||(l[3]=a=>e(n).name=a),class:"input",placeholder:"United States"},null,512),[[_,e(n).name]])]),t("div",G,[t("label",null,o(e(s)("Country Code")),1),r(t("input",{"onUpdate:modelValue":l[4]||(l[4]=a=>e(n).code=a),class:"input",placeholder:"US"},null,512),[[_,e(n).code]])]),t("div",H,[t("label",null,o(e(s)("Status")),1),r(t("select",{"onUpdate:modelValue":l[5]||(l[5]=a=>e(n).status=a),class:"select"},[t("option",J,o(e(s)("Active")),1),t("option",K,o(e(s)("Inactive")),1)],512),[[g,e(n).status]])])]),_:1},8,["title","processing"]),c(Y,{action:d.route("admin.countries.index"),options:y},null,8,["action"]),t("div",P,[t("table",Q,[t("thead",null,[t("tr",null,[t("th",null,o(e(s)("#")),1),t("th",null,o(e(s)("Country Name")),1),t("th",null,o(e(s)("Country Code")),1),t("th",null,o(e(s)("Status")),1),t("th",null,o(e(s)("Created At")),1),t("th",W,o(e(s)("Actions")),1)])]),m.countries.total?(u(),p("tbody",X,[(u(!0),p(k,null,F(m.countries.data,a=>(u(),p("tr",{key:a.id},[t("td",null,o(a.id),1),t("td",null,o(a.name),1),t("td",null,o(a.code),1),t("td",null,[t("div",{class:$([[a.status=="active"?"badge-primary":"badge-secondary"],"badge capitalize"])},o(a.status),3)]),t("td",Z,o(e(T)(a.created_at).format("DD MMM, YYYY")),1),t("td",null,[t("div",tt,[t("div",et,[t("div",st,[c(b,{class:"w-30 text-lg",icon:"bi:three-dots-vertical"})]),t("div",ot,[t("ul",at,[t("li",nt,[t("button",{onClick:U=>S(a),class:"dropdown-link"},[c(b,{class:"h-6",icon:"bx:pencil"}),t("span",null,o(e(s)("Edit")),1)],8,lt)]),t("li",it,[t("button",{type:"button",class:"dropdown-link",onClick:U=>e(x)(d.route("admin.countries.destroy",a))},[c(b,{class:"h-6",icon:"material-symbols:delete-outline"}),t("span",null,o(e(s)("Delete")),1)],8,dt)])])])])])])]))),128))])):(u(),V(E,{key:1,"for-table":"true"}))])]),c(B,{links:m.countries.links},null,8,["links"])],64)}}});export{gt as default};
