You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
4.9 KiB
React

1 year ago
import React from 'react'
import { Head } from '@inertiajs/react'
1 year ago
1 year ago
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'
import { formatDate, formatIDR } from '@/utils'
1 year ago
export default function Sale(props) {
const { sale, auth } = props
1 year ago
1 year ago
return (
<AuthenticatedLayout
auth={props.auth}
errors={props.errors}
flash={props.flash}
page={'Penjualan'}
action={sale.code}
>
<Head title="Penjualan" />
<div>
<div className="mx-auto sm:px-6 lg:px-8 ">
<div className="p-6 overflow-hidden shadow-sm sm:rounded-lg bg-white dark:bg-gray-800 space-y-4">
1 year ago
<div className="flex flex-col">
<div>
Date : <b>{formatDate(sale.date)}</b>
</div>
<div>
Customer : <b>{sale.customer?.name}</b>
</div>
<div>
Total : <b>{formatIDR(sale.total)}</b>
</div>
1 year ago
</div>
1 year ago
<div className="overflow-auto">
1 year ago
<div>
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 mb-4">
<thead className="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
1 year ago
<th
scope="col"
className="py-3 px-6"
>
Produk
1 year ago
</th>
1 year ago
<th
scope="col"
className="py-3 px-6"
>
1 year ago
Harga
</th>
1 year ago
<th
scope="col"
className="py-3 px-6"
>
1 year ago
Jumlah
</th>
1 year ago
<th
scope="col"
className="py-3 px-6"
>
1 year ago
Subtotal
</th>
</tr>
</thead>
<tbody>
1 year ago
{sale?.items?.map((item) => (
<tr
className="bg-white border-b dark:bg-gray-800 dark:border-gray-700"
key={item.id}
>
<td
scope="row"
className="py-4 px-6 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
{item.product.name} (
{item.product.code})
1 year ago
</td>
<td className="py-4 px-6">
{formatIDR(item.price)}
</td>
<td className="py-4 px-6">
{formatIDR(item.quantity)}
</td>
<td className="py-4 px-6">
1 year ago
{formatIDR(
item.quantity *
item.price
)}
1 year ago
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</AuthenticatedLayout>
1 year ago
)
}