Skip to content

Commit

Permalink
Merubah tabel tagihan (#23)
Browse files Browse the repository at this point in the history
* Membuat tabel riwayat penagihan

* menghapus kode yang tidak perlu
  • Loading branch information
denyncrm authored Jul 27, 2020
1 parent 7b16cb2 commit b057ad7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
14 changes: 13 additions & 1 deletion app/Http/Controllers/BillsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ public function index()
'bills' => Bill::orderBy('name')
->filter(Request::only('search', 'trashed'))
->paginate()
->only('id', 'lodging_id', 'name', 'description', 'amount', 'per_month', 'deleted_at'),
->transform(function ($bill) {
return [
'id' => $bill->id,
'room' => $bill->lodging->room,
'renter' => $bill->lodging->renter,
'name' => $bill->name,
'description' => $bill->description,
'amount' => $bill->amount,
'per_month' => $bill->per_month,
'deleted_at' => $bill->deleted_at,
];
}),
// ->only('id', 'lodging_id', 'name', 'description', 'amount', 'per_month', 'deleted_at'),

]);
}
Expand Down
23 changes: 19 additions & 4 deletions resources/js/Pages/Bills/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Bills = () => {
const { links, data } = bills;
return (
<div>
<Helmet title="Bills" />
<Helmet title="Tagihan" />
<div>
<h1 className="mb-8 text-3xl font-bold">Tagihan</h1>
<div className="flex items-center justify-between mb-6">
Expand All @@ -28,15 +28,16 @@ const Bills = () => {
<table className="w-full whitespace-no-wrap">
<thead>
<tr className="font-bold text-left">
<th className="px-6 pt-5 pb-4">ID Penginapan</th>
<th className="px-6 pt-5 pb-4">Nomor Kamar</th>
<th className="px-6 pt-5 pb-4">Nama Penyewa</th>
<th className="px-6 pt-5 pb-4">Nama Tagihan</th>
<th className="px-6 pt-5 pb-4">Deskripsi</th>
<th className="px-6 pt-5 pb-4">Jumlah</th>
<th className="px-6 pt-5 pb-4">Per Bulan</th>
</tr>
</thead>
<tbody>
{data.map(({ id, lodging_id, name, description, amount, per_month, deleted_at }) => {
{data.map(({ id, room, renter, name, description, amount, per_month, deleted_at }) => {
return (
<tr
key={id}
Expand All @@ -47,7 +48,21 @@ const Bills = () => {
href={route('bills.edit', id)}
className="flex items-center px-6 py-4 focus:text-indigo-700"
>
{lodging_id}
{room.number}
{deleted_at && (
<Icon
name="trash"
className="flex-shrink-0 w-3 h-3 ml-2 text-gray-400 fill-current"
/>
)}
</InertiaLink>
</td>
<td className="border-t">
<InertiaLink
href={route('bills.edit', id)}
className="flex items-center px-6 py-4 focus:text-indigo-700"
>
{renter.name}
{deleted_at && (
<Icon
name="trash"
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Renters/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Renters = () => {

return (
<div>
<Helmet title="Renters" />
<Helmet title="Penyewa" />
<div>
<h1 className="mb-8 text-3xl font-bold">Penyewa</h1>
<div className="flex items-center justify-between mb-6">
Expand Down

0 comments on commit b057ad7

Please sign in to comment.