import{d as N,ah as S,aa as V,g,A as v,J as a,B as h,j as s,t,am as D,H as d,C as Q,aH as T,_ as C,P as p,O as H,r as K,c}from"./index-DOFLUERq.js";import{api as j}from"./common-DEIQtiPI.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const I={class:"toolbar"},O={class:"filters"},P={class:"view-toggle"},$=["title"],z=["title"],F=["disabled"],J=["disabled","title"],R=["disabled"],U=["disabled"],q=N({__name:"error_log_list_toolbar",props:{entity:{},searchQuery:{},viewMode:{},selectedKeys:{},loading:{type:Boolean},canEdit:{type:Boolean}},emits:["update:searchQuery","update:viewMode","reload","create","delete-selected"],setup(o,{emit:w}){const u=o,r=w,_=S(),b=V(),n=K(!1),y=c(()=>u.canEdit!==!1),m=c({get:()=>u.searchQuery,set:l=>r("update:searchQuery",l)}),i=c({get:()=>u.viewMode,set:l=>r("update:viewMode",l)});function k(){r("reload")}function M(){r("create")}function E(){r("delete-selected")}const x=c(()=>[{label:t("Clear Error Logs"),key:"clear-error-logs"}]);function B(l){l==="clear-error-logs"&&L()}async function L(){_.warning({title:t("Clear Error Logs"),content:t("Are you sure you want to clear all Error Logs? This action cannot be undone."),positiveText:t("Clear"),negativeText:t("Cancel"),onPositiveClick:async()=>{n.value=!0;try{await j.call("jingrow.core.pagetype.error_log.error_log.clear_error_logs"),b.success(t("Error Logs cleared successfully")),r("reload")}catch(l){b.error(l?.message||t("Failed to clear error logs"))}finally{n.value=!1}}})}return(l,e)=>(g(),v("div",I,[a("div",O,[h(s(D),{value:m.value,"onUpdate:value":e[0]||(e[0]=f=>m.value=f),placeholder:s(t)("Search"),clearable:"",style:{width:"200px"}},null,8,["value","placeholder"])]),a("div",P,[a("button",{class:d(["toggle-btn",{active:i.value==="list"}]),onClick:e[1]||(e[1]=f=>i.value="list"),title:s(t)("List View")},[...e[3]||(e[3]=[a("i",{class:"fa fa-list"},null,-1)])],10,$),a("button",{class:d(["toggle-btn",{active:i.value==="card"}]),onClick:e[2]||(e[2]=f=>i.value="card"),title:s(t)("Card View")},[...e[4]||(e[4]=[a("i",{class:"fa fa-th-large"},null,-1)])],10,z)]),a("button",{class:"refresh-btn",onClick:k,disabled:o.loading},[a("i",{class:d(o.loading?"fa fa-spinner fa-spin":"fa fa-refresh")},null,2)],8,F),h(s(T),{trigger:"click",options:x.value,onSelect:B},{default:Q(()=>[a("button",{class:"refresh-btn",disabled:n.value,title:s(t)("More")},[a("i",{class:d(n.value?"fa fa-spinner fa-spin":"fa fa-ellipsis-h")},null,2)],8,J)]),_:1},8,["options"]),o.selectedKeys.length===0&&y.value?(g(),v("button",{key:0,class:"create-btn",onClick:M,disabled:o.loading},[e[5]||(e[5]=a("i",{class:"fa fa-plus"},null,-1)),C(" "+p(s(t)("Create")),1)],8,R)):y.value?(g(),v("button",{key:1,class:"delete-btn",onClick:E,disabled:o.loading},[e[6]||(e[6]=a("i",{class:"fa fa-trash"},null,-1)),C(" "+p(s(t)("Delete Selected"))+" ("+p(o.selectedKeys.length)+") ",1)],8,U)):H("",!0)]))}}),Y=A(q,[["__scopeId","data-v-afe6bd39"]]);export{Y as default};
