import{u as g,G as b,a as N,j as e,H as P,L as T}from"./app-CyJEXGyv.js";import{A as D,u as i}from"./app-layout-DbUGBUec.js";import{P as w}from"./page-pagination-f8WRSjxd.js";import{T as k,a as H,b as C,c as v,d as c,e as r,f as B,g as y,h as t}from"./table-fuaFg2Mm.js";import{B as A}from"./button-COEJSQkW.js";import{B as M}from"./badge-BSEA-Kjk.js";import{A as _,M as F}from"./modal-delete-CUfNw5Hz.js";import{H as S}from"./heading-BLley4b9.js";import{C as E}from"./trash-BflsAFp1.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 L=[{title:"Retur Penjualan",href:"#"}];function je(){const{transactionReturns:n,perPage:m,currentPage:u}=g().props,[p,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:L,children:[e.jsx(P,{title:"Retur Penjualan"}),e.jsxs("div",{className:"p-4",children:[e.jsx(S,{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(E,{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:u,perPage:m,url:route("apps.transaction-returns.index"),placeholder:"Cari data retur penjualan berdasarkan nomor faktur penjualan"})}),e.jsx(H,{className:"mt-5",children:e.jsxs(C,{children:[e.jsx(v,{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(_,{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(F,{open:p,onOpenChange:l,url:route("apps.transaction-returns.destroy",x.id)}),e.jsx(w,{data:n})]})]})]})}export{je as default};
