import{d as x}from"./datatables-CdFC5o1t.js";import{r as k,g as y}from"./api-DZ3cXm1m.js";import{i as v}from"./tooltip-manager-D9RaGGY4.js";import{c as C,g as T}from"./datatable-filters-dR_6SwzI.js";import"./bootstrap.esm-Bb7dPm-H.js";import"jquery";import"./datatables-bbQliV7G.js";/* empty css                                  */import"./vendor-C0v32J92.js";import"./tr-gGhodeh6.js";const j=window.translations||{},f=C(null,{search:!0,searchPlaceholder:j.search_placeholder||"Search..."}),_=$("#refundOrders").DataTable({...x.getDefaultConfig(),serverSide:!0,dom:T(),ajax:{url:$("#refundOrders").data("records-url"),type:"GET",headers:{Authorization:"Bearer "+y()},data:function(e){e.search={value:f.getValues().search||""}},error:function(e){e.status===401&&k().then(a=>{a&&_.ajax.reload()})}},columns:[{data:"order_number",name:"order_number",render:function(e){return`<span class="fw-bold">${e}</span>`}},{data:"client_name",name:"client_name"},{data:"products",name:"products",orderable:!1,render:function(e){if(!e||e==="-")return"-";const a=50;return e.length>a?`<span data-bs-toggle="tooltip" title="${e}">${e.substring(0,a)}...</span>`:e}},{data:"amount",name:"amount",render:function(e,a,t){return`${parseFloat(e).toFixed(2)} ${t.currency_code}`}},{data:"status",name:"status",render:function(){var e,a;return`<span class="badge bg-info">${((a=(e=window.translations)==null?void 0:e.orders)==null?void 0:a.statuses_refunded)||"Refunded"}</span>`}},{data:"fraud_status",name:"fraud_status",orderable:!1,render:function(e,a,t){var d,c,l,i,p,m,g,b,w,h;if(!e)return`<span class="badge bg-secondary">${((c=(d=window.translations)==null?void 0:d.orders)==null?void 0:c.fraud_unchecked)||"-"}</span>`;let n="bg-secondary",r=e,s="fas fa-question-circle";switch(e){case"approved":n="bg-success",r=((i=(l=window.translations)==null?void 0:l.orders)==null?void 0:i.fraud_approved)||"Approved",s="fas fa-check-circle";break;case"review":n="bg-warning",r=((m=(p=window.translations)==null?void 0:p.orders)==null?void 0:m.fraud_review)||"Review",s="fas fa-exclamation-triangle";break;case"rejected":n="bg-danger",r=((b=(g=window.translations)==null?void 0:g.orders)==null?void 0:b.fraud_rejected)||"Rejected",s="fas fa-times-circle";break;case"checking":n="bg-info",r=((h=(w=window.translations)==null?void 0:w.orders)==null?void 0:h.fraud_checking)||"Checking",s="fas fa-spinner fa-spin";break}let o="";if(t.fraud_score!==null&&t.fraud_score!==void 0){const u=parseInt(t.fraud_score);o=` <small class="${u>=70?"text-danger":u>=30?"text-warning":"text-success"}">(${u})</small>`}return`<span class="badge ${n}"><i class="${s} me-1"></i>${r}</span>${o}`}},{data:"created_at",name:"created_at"},{data:"id",name:"actions",orderable:!1,searchable:!1,render:function(e){var t,n,r,s,o,d,c,l;const a=[];if((n=(t=window.pageConfig)==null?void 0:t.permissions)!=null&&n.canView){const i=window.routes.orders.show.replace(":id",e);a.push(`
                        <a href="${i}"
                           class="btn btn-sm btn-outline-info d-inline-flex align-items-center justify-content-center"
                           style="width: 32px; height: 32px;"
                           data-bs-toggle="tooltip"
                           title="${((s=(r=window.translations)==null?void 0:r.common)==null?void 0:s.buttons_view)||"View"}">
                            <i class="fas fa-eye"></i>
                        </a>`)}if((d=(o=window.pageConfig)==null?void 0:o.permissions)!=null&&d.canEdit){const i=window.routes.orders.edit.replace(":id",e);a.push(`
                        <a href="${i}"
                           class="btn btn-sm btn-outline-primary d-inline-flex align-items-center justify-content-center ms-1"
                           style="width: 32px; height: 32px;"
                           data-bs-toggle="tooltip"
                           title="${((l=(c=window.translations)==null?void 0:c.common)==null?void 0:l.buttons_edit)||"Edit"}">
                            <i class="fas fa-edit"></i>
                        </a>`)}return a.length===0?'<span class="text-muted">-</span>':`<div class="d-inline-flex">${a.join("")}</div>`}}],initComplete:function(){f.init()},drawCallback:function(){v()}});f.setDataTable(_);
