import{k as e,aB as a,aH as t,aI as s,e as i}from"../../../../vendor-element-plus.js?ver=3.1.0";import{P as o}from"../../../../PaginationBar.js?ver=3.1.0";import{D as l}from"../../../../DataTable.js?ver=3.1.0";import{S as n}from"../../../../SettingsHeader.js?ver=3.1.0";import{_ as r,I as d}from"../../../../fc-bits-ui.js?ver=3.1.0";import{r as c,c as g,o as p,d as h,b as m,w as f,O as _,P as y,a as u,L as b,aB as v}from"../../../../vendor.js?ver=3.1.0";const w={class:"fcrm_system_logs fcrm_settings fcrm_view"},$={class:"fcrm_body"},k={class:"icon"},x={key:0,class:"icon"},D={key:0,class:"d-flex flex-column gap-1"},T={class:"text-secondary"},j={class:"text-secondary"},C=["innerHTML"];const H=r({name:"SystemLogs",components:{Icons:d,PaginationBar:o,DataTable:l,SettingsHeader:n},data:()=>({logs:[],pagination:{total:0,current_page:1,per_page:20},loading:!1,search:""}),methods:{fetch(){this.loading=!0,this.storage.set("system_logs_perpage",this.pagination.per_page),this.$get("setting/system-logs",{per_page:this.pagination.per_page,page:this.pagination.current_page,search:this.search}).then(e=>{this.logs=e.logs.data,this.pagination.total=e.logs.total}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},deleteAll(){this.loading=!0,this.$del("setting/system-logs/reset").then(e=>{this.$notify.success(e.message),this.logs=[],this.pagination.total=0}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},formatDate:e=>e?e.split(" ")[0]:"",formatTime:e=>e&&e.split(" ")[1]||""},mounted(){this.pagination.per_page=parseInt(this.storage.get("system_logs_perpage",20),10)||20,this.fetch()}},[["render",function(o,l,n,r,d,H){const I=e,S=c("SettingsHeader"),L=c("Icons"),B=i,P=a,F=s,V=t,z=c("pagination-bar"),A=c("data-table");return p(),g("div",w,[h(S,{title:o.$t("System Logs")},{actions:f(()=>[h(I,{type:"danger",size:"small",onClick:H.deleteAll},{default:f(()=>[_(y(o.$t("Reset")),1)],void 0,!0),_:1},8,["onClick"])]),_:1},8,["title"]),m("div",$,[h(A,{"has-selection":!1},{"header-left":f(()=>[h(B,{modelValue:d.search,"onUpdate:modelValue":l[0]||(l[0]=e=>d.search=e),onClear:H.fetch,onKeyup:v(H.fetch,["enter"]),placeholder:o.$t("Type & enter"),clearable:""},{prefix:f(()=>[m("span",k,[h(L,{"icon-name":"search"})])]),_:1},8,["modelValue","onClear","onKeyup","placeholder"])]),"header-actions":f(()=>[h(I,{size:"small",loading:d.loading,onClick:H.fetch},{default:f(()=>[d.loading?b("",!0):(p(),g("span",x,[h(L,{"icon-name":"reload"})])),_(" "+y(o.$t("Refresh")),1)],void 0,!0),_:1},8,["loading","onClick"])]),table:f(()=>[d.loading?(p(),u(P,{key:0,style:{padding:"20px"},rows:8})):(p(),u(V,{key:1,"empty-text":o.$t("No Data Found"),data:d.logs},{default:f(()=>[h(F,{label:o.$t("ID"),prop:"id",width:"120"},null,8,["label"]),h(F,{label:o.$t("Date & Time"),"min-width":"150",property:"created_at"},{default:f(e=>[e.row.created_at?(p(),g("div",D,[m("div",T,y(H.formatDate(e.row.created_at)),1),m("small",j,y(H.formatTime(e.row.created_at)),1)])):b("",!0)]),_:1},8,["label"]),h(F,{label:o.$t("Title"),"min-width":"300"},{default:f(e=>[_(y(e.row.title),1)]),_:1},8,["label"]),h(F,{label:o.$t("Description"),"min-width":"390"},{default:f(e=>[m("div",{innerHTML:e.row.description},null,8,C)]),_:1},8,["label"])],void 0,!0),_:1},8,["empty-text","data"]))]),pagination:f(()=>[d.loading?b("",!0):(p(),u(z,{key:0,pagination:d.pagination,onFetch:H.fetch},null,8,["pagination","onFetch"]))]),_:1})])])}]]);export{H as default};
