import"./bootstrap.esm-Bb7dPm-H.js";import{d as p}from"./datatables-I6jthWPb.js";import{i as u}from"./tooltip-manager-D9RaGGY4.js";import"./datatables-Bo82YvhT.js";/* empty css                                  */let i,a={};document.addEventListener("DOMContentLoaded",function(){g(),y(),u()});function g(){const t=document.getElementById("clientLogsTable");if(!t)return;const n=t.getAttribute("data-records-url");a={type:t.getAttribute("data-log-type")},i=$("#clientLogsTable").DataTable({...p.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,a),e}},columns:[{data:"id",name:"id"},{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 s,d,o;return(s=permissions.logs)!=null&&s.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="${((o=(d=translations.logs)==null?void 0:d.buttons)==null?void 0:o.view)||"View"}">
                            <i class="fas fa-eye"></i>
                        </a>
                    `:'<span class="text-muted">-</span>'}}],drawCallback:function(){u()}})}function y(){const t=document.getElementById("applyFilters");t&&t.addEventListener("click",m);const n=document.getElementById("clearFilters");n&&n.addEventListener("click",b);const r=document.getElementById("refreshLogs");r&&r.addEventListener("click",v);const e=document.getElementById("filterSearch");e&&e.addEventListener("keypress",function(l){l.key==="Enter"&&m()})}function m(){var t,n,r,e,l,s,d,o;a={type:"client",module:((t=document.getElementById("filterModule"))==null?void 0:t.value)||"",start_date:((n=document.getElementById("filterStartDate"))==null?void 0:n.value)||"",end_date:((r=document.getElementById("filterEndDate"))==null?void 0:r.value)||"",ip_address:((e=document.getElementById("filterIpAddress"))==null?void 0:e.value)||"",search:((l=document.getElementById("filterSearch"))==null?void 0:l.value)||"",observer:((s=document.getElementById("filterObserver"))==null?void 0:s.value)||""},Object.keys(a).forEach(c=>{a[c]||delete a[c]}),i&&i.ajax.reload(),f("success",((o=(d=translations.logs)==null?void 0:d.messages)==null?void 0:o.filters_applied)||"Filters applied.")}function b(){var t,n;document.getElementById("filterModule").value="",document.getElementById("filterStartDate").value="",document.getElementById("filterEndDate").value="",document.getElementById("filterIpAddress").value="",document.getElementById("filterSearch").value="",document.getElementById("filterObserver").value="",a={type:"client"},i&&i.ajax.reload(),f("info",((n=(t=translations.logs)==null?void 0:t.messages)==null?void 0:n.filters_cleared)||"Filtreler temizlendi.")}function v(){i&&i.ajax.reload()}function f(t,n){window.showToast?window.showToast(t,n):console.warn("Notification system not available:",t,n)}
