import{d as A,j as B,s as P,T as U,k as b,r as f,c as m,o as d,a as t,b as r,e as I,i as V,t as s,F as g,g as F,n as N,u as i,w as k,l as v,v as w,A as $,N as E}from"./app-Do7K7VDV.js";import{_ as Y}from"./AdminLayout-DeT_GLTC.js";import{_ as T}from"./Paginate-BZTS8QtF.js";import{h as j}from"./moment-BAtM24Ew.js";import{_ as q}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 z={class:"card"},L={class:"table-responsive whitespace-nowrap rounded-primary"},O={class:"table"},R={class:"!text-right"},G={class:"text-left"},H={class:"w-28 rounded-md bg-gray-400 px-1 dark:bg-gray-600"},J=["src"],K={class:"text-left"},Q={class:"text-left"},W={class:"text-left"},X={class:"dropdown","data-placement":"bottom-start"},Z={class:"dropdown-toggle"},x={class:"dropdown-content w-40"},tt={class:"dropdown-list"},et={class:"dropdown-list-item"},st=["onClick"],at={class:"dropdown-list-item"},nt=["onClick"],lt={class:"mb-2"},ot={class:"mb-2"},it={class:"mb-2"},rt={class:"select",name:"status"},dt={value:"1"},ut={value:"0"},ct={class:"mb-2"},pt={class:"mb-2"},mt={class:"mb-2"},vt={value:"1"},_t={value:"0"},ht=A({layout:Y}),St=Object.assign(ht,{__name:"Index",props:["brands"],setup(u){const c=B(),{deleteRow:y}=P(),o=U({url:"",status:"1",type:"partner",preview:null}),_=b(!1),n=b({}),C=()=>{o.post(route("admin.partner.store"),{onSuccess:()=>{o.reset(),c.close("createModal")}})};function M(e){n.value={...e,_method:"patch"},c.open("editModal")}const D=()=>{!n.value.preview instanceof File&&(n.value.preview=null),_.value=!0,E.post(route("admin.partner.update",n.value.id),n.value,{onSuccess:()=>{n.value={},_.value=!1,c.close("editModal")}})};return(e,l)=>{const p=f("Icon"),h=f("Modal");return d(),m(g,null,[t("div",z,[t("div",L,[t("table",O,[t("thead",null,[t("tr",null,[t("th",null,s(e.trans("Image")),1),t("th",null,s(e.trans("Url")),1),t("th",null,s(e.trans("Type")),1),t("th",null,s(e.trans("Status")),1),t("th",null,s(e.trans("Created At")),1),t("th",R,s(e.trans("Action")),1)])]),t("tbody",null,[(d(!0),m(g,null,F(u.brands.data,a=>(d(),m("tr",{key:a.id},[t("td",G,[t("div",H,[t("img",{src:a.preview,alt:"preview",class:"h-full w-full"},null,8,J)])]),t("td",K,s(a.title),1),t("td",Q,s(a.lang=="en"?"Partner":a.lang),1),t("td",W,[t("span",{class:N(["badge",a.status==1?"badge-success":"badge-danger"])},s(a.status==1?e.trans("Active"):e.trans("Draft")),3)]),t("td",null,s(i(j)(a.created_at).format("DD MMM, YYYY")),1),t("td",null,[t("div",X,[t("div",Z,[r(p,{class:"text-2xl",icon:"bx:dots-horizontal-rounded"})]),t("div",x,[t("ul",tt,[t("li",et,[t("button",{onClick:S=>M(a),class:"dropdown-link"},[r(p,{icon:"fe:edit"}),t("span",null,s(e.trans("Edit")),1)],8,st)]),t("li",at,[t("button",{class:"dropdown-link",onClick:S=>i(y)(e.route("admin.partner.destroy",a.id))},[r(p,{icon:"fe:trash"}),t("span",null,s(e.trans("Delete")),1)],8,nt)])])])])])]))),128))]),u.brands.total?V("",!0):(d(),I(q,{key:0,"for-table":!0}))])])]),r(T,{links:u.brands.links},null,8,["links"]),r(h,{state:"createModal","header-state":!0,"header-title":e.trans("Create Partner"),"action-btn-text":e.trans("Create"),"action-btn-state":!0,"action-processing":i(o).processing,onAction:C},{default:k(()=>[t("div",lt,[t("label",null,s(e.trans("Brand Url")),1),v(t("input",{type:"text",name:"url","onUpdate:modelValue":l[0]||(l[0]=a=>i(o).url=a),class:"input"},null,512),[[w,i(o).url]])]),t("div",ot,[t("label",null,s(e.trans("Brand image")),1),t("input",{onInput:l[1]||(l[1]=a=>i(o).preview=a.target.files[0]),type:"file",accept:"image/*",name:"image",required:"",class:"input"},null,32)]),t("div",it,[t("label",null,s(e.trans("Status")),1),t("select",rt,[t("option",dt,s(e.trans("Active")),1),t("option",ut,s(e.trans("Deactivate")),1)])])]),_:1},8,["header-title","action-btn-text","action-processing"]),r(h,{state:"editModal","header-state":!0,"header-title":e.trans("Edit Partner"),"action-btn-text":e.trans("Update"),"action-btn-state":!0,"action-processing":i(o).processing,onAction:D},{default:k(()=>[t("div",ct,[t("label",null,s(e.trans("Brand Url")),1),v(t("input",{type:"text",name:"url","onUpdate:modelValue":l[2]||(l[2]=a=>n.value.title=a),class:"input",id:"url"},null,512),[[w,n.value.title]])]),t("div",pt,[t("label",null,s(e.trans("Brand image")),1),t("input",{onInput:l[3]||(l[3]=a=>n.value.preview=a.target.files[0]),type:"file",name:"image",accept:"image/*",class:"input"},null,32)]),t("div",mt,[t("label",null,s(e.trans("Status")),1),v(t("select",{"onUpdate:modelValue":l[4]||(l[4]=a=>n.value.status=a),class:"select",name:"status",id:"status"},[t("option",vt,s(e.trans("Active")),1),t("option",_t,s(e.trans("Deactivate")),1)],512),[[$,n.value.status]])])]),_:1},8,["header-title","action-btn-text","action-processing"])],64)}}});export{St as default};
