import{q as b,U as f,v as g,j as e,$ as N,Y as o}from"./app-CffHYkHW.js";import{A as P,u as n}from"./app-layout-D-VS7nVU.js";import{P as T}from"./page-pagination-haDwcr6r.js";import{T as w,a as D,b as k,c as H,d,e as a,f as v,g as B,h as t}from"./table-DVZTgtP_.js";import{B as C}from"./button-qhe8lrPU.js";import{B as y}from"./badge-soq0-NVD.js";import{A,M}from"./modal-delete-CrQxv22H.js";import{H as _}from"./heading-YfudWo2z.js";import{C as F}from"./trash-o9eyCj69.js";import{F as S}from"./file-text-DnHYjQ7-.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 E=[{title:"Retur Pembelian",href:"#"}];function he(){const{purchaseReturns:i,perPage:m,currentPage:c}=b().props,[p,l]=f.useState(!1),{data:x,setData:u}=g({id:""}),h=r=>{l(!0),u(s=>({...s,id:r.id}))},j=r=>{switch(r){case"refund":return"Pengembalian Dana";case"replacement":return"Pergantian Barang";case"debt_reduction":return"Pengurangan Hutang";default:return"Status Tidak Dikenal"}};return e.jsxs(P,{breadcrumbs:E,children:[e.jsx(N,{title:"Retur Pembelian"}),e.jsxs("div",{className:"p-4",children:[e.jsx(_,{title:"Return Pembelian",description:"Halaman ini digunakan untuk mengelola data retur pembelian"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[n(["purhcase-returns-create"])&&e.jsx(C,{asChild:!0,variant:"outline",children:e.jsxs(o,{href:route("apps.purchase-returns.create"),children:[e.jsx(F,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Tambah Retur Pembelian"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(w,{withFilterPage:!0,currentPage:c,perPage:m,url:route("apps.purchase-returns.index"),placeholder:"Cari data pembelian berdasarkan nomor faktur pembelian"})}),e.jsx(D,{className:"mt-5",children:e.jsxs(k,{children:[e.jsx(H,{children:e.jsxs(d,{children:[e.jsx(a,{className:"w-[10px]",children:"No"}),e.jsx(a,{children:"Nomor Retur Pembelian"}),e.jsx(a,{children:"Nomor Faktur Pembelian"}),e.jsx(a,{children:"Supplier"}),e.jsx(a,{children:"Tanggal Retur"}),e.jsx(a,{className:"w-[10px] text-center",children:"Status Retur"}),e.jsx(a,{className:"w-[10px] text-center",children:"Jenis Retur"}),e.jsx(a,{children:"Total Retur"}),e.jsx(a,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(v,{children:i.data.length===0?e.jsx(B,{colSpan:9,message:"data pembelian"}):i.data.map((r,s)=>e.jsxs(d,{children:[e.jsx(t,{className:"text-center",children:s+1}),e.jsx(t,{children:r.return_code}),e.jsx(t,{children:e.jsxs(o,{href:route("apps.orders.show",r.order.id),className:"flex items-center gap-1",children:[e.jsx(S,{size:15})," ",r.order.order_code]})}),e.jsxs(t,{children:["[",r.order.supplier.code,"] ",r.order.supplier.name]}),e.jsx(t,{children:r.return_date}),e.jsx(t,{className:"text-center",children:e.jsx(y,{variant:"secondary",children:r.status=="pending"?"Diajukan":"Diterima"})}),e.jsx(t,{className:"text-center",children:j(r.refund_method)}),e.jsxs(t,{className:"text-right font-semibold",children:[e.jsx("sup",{children:"Rp"})," ",r.grand_total]}),e.jsx(t,{children:e.jsx("div",{className:"text-center",children:(n(["purchase-returns-update"])||n(["purchase-returns-delete"]))&&e.jsx(A,{permissionPrefix:"purchase-returns",withDetail:!0,actionDetailHref:route("apps.purchase-returns.show",r.id),actionEditHref:route("apps.purchase-returns.edit",r.id),actionDelete:()=>h(r),withDelete:r.status=="pending"})})})]},s))})]})}),e.jsx(M,{open:p,onOpenChange:l,url:route("apps.purchase-returns.destroy",x.id)}),e.jsx(T,{data:i})]})]})]})}export{he as default};
