import{u as b,G as f,a as g,j as e,H as N,L as d}from"./app-CyJEXGyv.js";import{A as P,u as n}from"./app-layout-DbUGBUec.js";import{P as T}from"./page-pagination-f8WRSjxd.js";import{T as w,a as D,b as H,c as k,d as o,e as a,f as _,g as B,h as t}from"./table-fuaFg2Mm.js";import{B as C}from"./button-COEJSQkW.js";import{B as v}from"./badge-BSEA-Kjk.js";import{A as y,M as A}from"./modal-delete-CUfNw5Hz.js";import{H as F}from"./heading-BLley4b9.js";import{C as M}from"./trash-BflsAFp1.js";import{F as S}from"./file-text-CLByCbPK.js";import"./utils-D3rN0LeJ.js";import"./sheet-D9YCjyPN.js";import"./index-JbHgsFAK.js";import"./index-BiS8IM9B.js";import"./x-CEXz2EER.js";import"./createLucideIcon-DqnlFWer.js";import"./index-CeYyXWc4.js";import"./index-D448AvbX.js";import"./truck-DSNzHzca.js";import"./package-Ca-wQg6n.js";import"./shopping-bag-kX2qM3ec.js";import"./app-logo-icon-bwP4qd8Q.js";import"./bluetooth-context-DlC5mQaA.js";import"./index-BtT9Eyya.js";import"./index-l-_2VD5G.js";import"./sonner-DMUJNVEP.js";import"./pagination-7aOfsluw.js";import"./chevron-left-O9iIxqlL.js";import"./select-787Dhddj.js";import"./chevron-down-CelnyKCC.js";import"./input-De4RhZu7.js";import"./dialog-C64V63Fe.js";const E=[{title:"Retur Pembelian",href:"#"}];function he(){const{purchaseReturns:i,perPage:m,currentPage:c}=b().props,[p,l]=f.useState(!1),{data:u,setData:x}=g({id:""}),h=r=>{l(!0),x(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(F,{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(d,{href:route("apps.purchase-returns.create"),children:[e.jsx(M,{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(H,{children:[e.jsx(k,{children:e.jsxs(o,{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(_,{children:i.data.length===0?e.jsx(B,{colSpan:9,message:"data pembelian"}):i.data.map((r,s)=>e.jsxs(o,{children:[e.jsx(t,{className:"text-center",children:s+1}),e.jsx(t,{children:r.return_code}),e.jsx(t,{children:e.jsxs(d,{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(v,{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(y,{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(A,{open:p,onOpenChange:l,url:route("apps.purchase-returns.destroy",u.id)}),e.jsx(T,{data:i})]})]})]})}export{he as default};
