import"./bootstrap.esm-Bb7dPm-H.js";import{d as g}from"./datatables-I6jthWPb.js";import{i as f}from"./tooltip-manager-D9RaGGY4.js";import"./datatables-Bo82YvhT.js";/* empty css                                  */let i,d={};document.addEventListener("DOMContentLoaded",function(){y(),b(),f()});function y(){const t=document.getElementById("logsTable");if(!t)return;const n=t.getAttribute("data-records-url");i=$("#logsTable").DataTable({...g.getDefaultConfig(),serverSide:!0,searching:!1,dom:'<"d-flex align-items-center mb-3"<"d-flex align-items-center"l>>t<"d-flex justify-content-between align-items-center mt-3"<"d-flex align-items-center"i><"d-flex align-items-center"p>>',ajax:{url:n,type:"GET",headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').getAttribute("content")},data:function(e){return Object.assign(e,d),e}},columns:[{data:"id",name:"id"},{data:"type",name:"type",render:function(e,r,a){const s=a.type_label||e;return`<span class="badge ${h(e)}">${s}</span>`}},{data:"module",name:"module"},{data:"observer",name:"observer"},{data:"ip_address",name:"ip_address"},{data:"method",name:"method"},{data:"description",name:"description",render:function(e){return e?e.length>50?e.substring(0,50)+"...":e:'<span class="text-muted">-</span>'}},{data:"elapsed_ms",name:"elapsed_ms",render:function(e){return e?`${e}ms`:'<span class="text-muted">-</span>'}},{data:"user_info",name:"user_info",render:function(e){return!e||e==="Sistem"?'<span class="text-muted">Sistem</span>':e}},{data:"created_at",name:"created_at"},{data:"id",name:"actions",orderable:!1,searchable:!1,render:function(e){var a,s,l;return(a=permissions.logs)!=null&&a.view?`
                        <a href="${routes.logs.view.replace(":id",e)}"
                           class="btn btn-sm btn-outline-primary d-inline-flex align-items-center justify-content-center"
                           style="width: 32px; height: 32px;"
                           data-bs-toggle="tooltip"
                           title="${((l=(s=translations.logs)==null?void 0:s.buttons)==null?void 0:l.view)||"View"}">
                            <i class="fas fa-eye"></i>
                        </a>
                    `:'<span class="text-muted">-</span>'}}],drawCallback:function(){f()}})}function b(){const t=document.getElementById("applyFilters");t&&t.addEventListener("click",u);const n=document.getElementById("clearFilters");n&&n.addEventListener("click",v);const e=document.getElementById("refreshLogs");e&&e.addEventListener("click",E);const r=document.getElementById("filterSearch");r&&r.addEventListener("keypress",function(a){a.key==="Enter"&&u()})}function u(){var t,n,e,r,a,s,l,o,c;d={type:((t=document.getElementById("filterType"))==null?void 0:t.value)||"",module:((n=document.getElementById("filterModule"))==null?void 0:n.value)||"",start_date:((e=document.getElementById("filterStartDate"))==null?void 0:e.value)||"",end_date:((r=document.getElementById("filterEndDate"))==null?void 0:r.value)||"",ip_address:((a=document.getElementById("filterIpAddress"))==null?void 0:a.value)||"",search:((s=document.getElementById("filterSearch"))==null?void 0:s.value)||"",observer:((l=document.getElementById("filterObserver"))==null?void 0:l.value)||""},Object.keys(d).forEach(m=>{d[m]||delete d[m]}),i&&i.ajax.reload(),p("success",((c=(o=translations.logs)==null?void 0:o.messages)==null?void 0:c.filters_applied)||"Filters applied.")}function v(){var t,n;document.getElementById("filterType").value="",document.getElementById("filterModule").value="",document.getElementById("filterStartDate").value="",document.getElementById("filterEndDate").value="",document.getElementById("filterIpAddress").value="",document.getElementById("filterSearch").value="",document.getElementById("filterObserver").value="",d={},i&&i.ajax.reload(),p("info",((n=(t=translations.logs)==null?void 0:t.messages)==null?void 0:n.filters_cleared)||"Filtreler temizlendi.")}function E(){i&&i.ajax.reload()}function h(t){return{system:"bg-primary",payment:"bg-success",mail:"bg-info",payment_provider:"bg-warning",module:"bg-secondary",client:"bg-dark",admin:"bg-danger",php:" text-dark"}[t]||"bg-secondary"}function p(t,n){window.showToast?window.showToast(t,n):console.warn("Notification system not available:",t,n)}
