import{d as h,e as R,r as I,w as B,o as N,g as b,i as g,C as a,j as e,an as r,_ as y,P as v,t as d,O as C,B as o,ax as u,aw as S,c as z,aI as P}from"./index-DOFLUERq.js";import{I as p}from"./iconify-p99pbjf9.js";import{_}from"./_plugin-vue_export-helper-DlAUqK2U.js";const T=h({__name:"report_toolbar",props:{entity:{},id:{},record:{default:()=>({})},canEdit:{type:Boolean},loading:{type:Boolean},sidebarPosition:{default:"left"}},emits:["toggle-sidebar-position","refresh","delete","go-back","save"],setup(l,{emit:V}){const s=l,f=R(),m=z(()=>{const t=s.id;return t==="new"||t.startsWith("new-")}),c=I(s.sidebarPosition||"left");B(()=>s.sidebarPosition,t=>{t&&(c.value=t)},{immediate:!0}),N(()=>{if(!s.sidebarPosition){const t=localStorage.getItem("jingrow-sidebar-position");(t==="left"||t==="right")&&(c.value=t)}});function $(){const t=s.record;if(!t||!t.name)return;const i=t.report_type,n=t.name,k=t.ref_pagetype;switch(i){case"Report Builder":if(k){const w=P(k);f.push(`/app/${w}/view/report/${encodeURIComponent(n)}`)}break;case"Query Report":case"Script Report":case"Custom Report":f.push(`/app/query-report/${encodeURIComponent(n)}`);break;default:f.push(`/app/query-report/${encodeURIComponent(n)}`)}}return(t,i)=>(b(),g(e(S),{align:"center"},{default:a(()=>[m.value?C("",!0):(b(),g(e(r),{key:0,type:"default",size:"medium",onClick:$,class:"toolbar-btn show-report-btn"},{default:a(()=>[y(v(e(d)("Show Report")),1)]),_:1})),o(e(r),{type:"default",size:"medium",onClick:i[0]||(i[0]=n=>t.$emit("toggle-sidebar-position")),title:c.value==="left"?"切换到右侧":"切换到左侧",class:"header-action-btn"},{icon:a(()=>[o(e(u),null,{default:a(()=>[o(e(p),{icon:c.value==="left"?"fluent:panel-right-16-regular":"fluent:panel-left-16-regular"},null,8,["icon"])]),_:1})]),_:1},8,["title"]),o(e(r),{type:"default",size:"medium",onClick:i[1]||(i[1]=n=>t.$emit("refresh")),disabled:l.loading||m.value,title:e(d)("Refresh"),class:"header-action-btn"},{icon:a(()=>[o(e(u),null,{default:a(()=>[o(e(p),{icon:"tabler:refresh"})]),_:1})]),_:1},8,["disabled","title"]),o(e(r),{type:"default",size:"medium",onClick:i[2]||(i[2]=n=>t.$emit("delete")),disabled:l.loading||m.value,title:e(d)("Delete"),class:"header-action-btn delete-btn"},{icon:a(()=>[o(e(u),null,{default:a(()=>[o(e(p),{icon:"tabler:trash"})]),_:1})]),_:1},8,["disabled","title"]),o(e(r),{type:"default",size:"medium",onClick:i[3]||(i[3]=n=>t.$emit("go-back")),disabled:l.loading},{icon:a(()=>[o(e(u),null,{default:a(()=>[o(e(p),{icon:"tabler:arrow-left"})]),_:1})]),default:a(()=>[y(" "+v(e(d)("Back")),1)]),_:1},8,["disabled"]),l.canEdit?(b(),g(e(r),{key:1,type:"primary",size:"medium",disabled:l.loading,onClick:i[4]||(i[4]=n=>t.$emit("save")),class:"save-btn-brand"},{icon:a(()=>[o(e(u),null,{default:a(()=>[o(e(p),{icon:"tabler:check"})]),_:1})]),default:a(()=>[y(" "+v(e(d)("Save")),1)]),_:1},8,["disabled"])):C("",!0)]),_:1}))}}),D=_(T,[["__scopeId","data-v-cc519dc9"]]);export{D as default};
