import{q as g,U as b,v as N,j as e,$ as P,Y as T}from"./app-CffHYkHW.js";import{A as D,u as i}from"./app-layout-D-VS7nVU.js";import{P as w}from"./page-pagination-haDwcr6r.js";import{T as k,a as v,b as C,c as H,d as c,e as r,f as B,g as y,h as t}from"./table-DVZTgtP_.js";import{B as A}from"./button-qhe8lrPU.js";import{B as M}from"./badge-soq0-NVD.js";import{A as S,M as _}from"./modal-delete-CrQxv22H.js";import{H as E}from"./heading-YfudWo2z.js";import{C as F}from"./trash-o9eyCj69.js";import"./utils-C8zp8JNC.js";import"./sheet-Bisw0FSz.js";import"./index-C0loMkA3.js";import"./index-Cy5bElus.js";import"./index-DPkgfxsD.js";import"./x-BfabuQJD.js";import"./createLucideIcon-DAR-hy5d.js";import"./index-C9NeyPdJ.js";import"./index-CjqRk3xD.js";import"./truck-DnoS8QCL.js";import"./package-BHw0cifz.js";import"./shopping-bag-AryJS2XX.js";import"./app-logo-icon-D3Jzt_fn.js";import"./bluetooth-context-CLrE8g1i.js";import"./index-Dw4sHwMN.js";import"./sonner-CPUj7IiR.js";import"./pagination-DsNVVp24.js";import"./chevron-left-D6h0rvW2.js";import"./select-ClrGyhQo.js";import"./chevron-down-C5A3yn87.js";import"./input-Bw4IOOzt.js";import"./dialog-Djfc3pyN.js";const R=[{title:"Retur Penjualan",href:"#"}];function je(){const{transactionReturns:n,perPage:m,currentPage:p}=g().props,[u,l]=b.useState(!1),{data:x,setData:j}=N({id:""}),h=a=>{l(!0),j(s=>({...s,id:a.id}))},f=a=>{switch(a){case"refund":return"Pengembalian Dana";case"replacement":return"Pergantian Barang";default:return"Status Tidak Dikenal"}};return e.jsxs(D,{breadcrumbs:R,children:[e.jsx(P,{title:"Retur Penjualan"}),e.jsxs("div",{className:"p-4",children:[e.jsx(E,{title:"Return Penjualan",description:"Halaman ini digunakan untuk mengelola data retur penjualan"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[i(["transaction-returns-create"])&&e.jsx(A,{asChild:!0,variant:"outline",children:e.jsxs(T,{href:route("apps.transaction-returns.create"),children:[e.jsx(F,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Tambah Retur Penjualan"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(k,{withFilterPage:!0,currentPage:p,perPage:m,url:route("apps.transaction-returns.index"),placeholder:"Cari data retur penjualan berdasarkan nomor faktur penjualan"})}),e.jsx(v,{className:"mt-5",children:e.jsxs(C,{children:[e.jsx(H,{children:e.jsxs(c,{children:[e.jsx(r,{className:"w-[10px]",children:"No"}),e.jsx(r,{children:"Nomor Retur Penjualan"}),e.jsx(r,{children:"Nomor Faktur Penjualan"}),e.jsx(r,{children:"Customer"}),e.jsx(r,{children:"Tanggal Retur"}),e.jsx(r,{className:"w-[10px] text-center",children:"Status Retur"}),e.jsx(r,{className:"w-[10px] text-center",children:"Jenis Retur"}),e.jsx(r,{children:"Total Retur"}),e.jsx(r,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(B,{children:n.data.length===0?e.jsx(y,{colSpan:9,message:"data retur penjualan"}):n.data.map((a,s)=>{var o,d;return e.jsxs(c,{children:[e.jsx(t,{className:"text-center",children:s+1}),e.jsx(t,{children:a.return_code}),e.jsx(t,{children:a.transaction.invoice}),e.jsx(t,{children:((d=(o=a.transaction)==null?void 0:o.customer)==null?void 0:d.name)??"Umum"}),e.jsx(t,{children:a.return_date}),e.jsx(t,{className:"text-center",children:e.jsx(M,{variant:"secondary",children:a.status=="pending"?"Diajukan":"Diterima"})}),e.jsx(t,{className:"text-center",children:f(a.refund_method)}),e.jsxs(t,{className:"text-right font-semibold",children:[e.jsx("sup",{children:"Rp"})," ",a.grand_total]}),e.jsx(t,{children:e.jsx("div",{className:"text-center",children:(i(["transaction-returns-update"])||i(["transaction-returns-delete"]))&&e.jsx(S,{permissionPrefix:"transaction-returns",withDetail:!0,actionDetailHref:route("apps.transaction-returns.show",a.id),actionEditHref:route("apps.transaction-returns.edit",a.id),actionDelete:()=>h(a),withDelete:a.status=="pending"})})})]},s)})})]})}),e.jsx(_,{open:u,onOpenChange:l,url:route("apps.transaction-returns.destroy",x.id)}),e.jsx(w,{data:n})]})]})]})}export{je as default};
