@@ -3,13 +3,12 @@ import { getBorrow, getListBorrows } from '@/lib/api/borrow'
33import { Borrow } from '@/lib/types/borrow'
44import { redirect , RedirectType } from 'next/navigation'
55import { DetailBorrow } from '@/components/borrows/DetailBorrow'
6- import { BtnReturnBook } from '@/components/borrows/BtnReturnBorrow'
76import { Button } from '@/components/ui/button'
87import { BtnUndoReturn } from '@/components/borrows/BtnUndoReturn'
98import Link from 'next/link'
10- import { Pen } from 'lucide-react'
11- import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card '
12- import { FormLostBorrow } from '@/components/borrows/FormLostBorrow '
9+ import { CornerUpLeft , Pen , PenOff } from 'lucide-react'
10+ import { BtnUndoLost } from '@/components/borrows/BtnUndoLost '
11+ import { ButtonGroup } from '@/components/ui/button-group '
1312
1413export default async function BorrowDetailsPage ( {
1514 params,
@@ -55,42 +54,53 @@ export default async function BorrowDetailsPage({
5554
5655 return (
5756 < DetailBorrow borrow = { borrowRes . data } prevBorrows = { prevBorrows } >
58- < >
59- { borrowRes . data . returning || borrowRes . data . lost ? null : (
60- < Card className = "bg-destructive/10 border-destructive/20" >
61- < CardHeader >
62- < CardTitle > Mark as Lost</ CardTitle >
63- </ CardHeader >
64- < CardContent >
65- < FormLostBorrow id = { borrowRes . data . id } />
66- </ CardContent >
67- </ Card >
57+ < div className = "bottom-0 sticky py-2 grid md:grid-cols-2 gap-2" >
58+ { borrowRes . data . returning ? (
59+ < BtnUndoReturn
60+ variant = "outline"
61+ className = "w-full backdrop-blur-md"
62+ borrow = { borrowRes . data }
63+ />
64+ ) : null }
65+ { borrowRes . data . lost ? (
66+ < BtnUndoLost
67+ variant = "outline"
68+ className = "w-full backdrop-blur-md"
69+ borrow = { borrowRes . data }
70+ />
71+ ) : null }
72+ { borrowRes . data . lost || borrowRes . data . returning ? null : (
73+ < ButtonGroup className = "w-full backdrop-blur-md" >
74+ < Button variant = "secondary" asChild >
75+ < Link
76+ href = { `/admin/borrows/${ borrowRes . data . id } /return` }
77+ className = "w-1/2 bg-secondary"
78+ >
79+ < CornerUpLeft />
80+ Return
81+ </ Link >
82+ </ Button >
83+ < Button asChild variant = "secondary" className = "text-destructive" >
84+ < Link
85+ href = { `/admin/borrows/${ borrowRes . data . id } /lost` }
86+ className = "w-1/2"
87+ >
88+ < PenOff />
89+ Mark as Lost
90+ </ Link >
91+ </ Button >
92+ </ ButtonGroup >
6893 ) }
69- < div className = "bottom-0 sticky py-2 grid md:grid-cols-2 gap-2" >
70- { borrowRes . data . returning ? (
71- < BtnUndoReturn
72- variant = "outline"
73- className = "w-full backdrop-blur-md"
74- borrow = { borrowRes . data }
75- />
76- ) : (
77- < BtnReturnBook
78- variant = "outline"
79- className = "w-full"
80- borrow = { borrowRes . data }
81- />
82- ) }
83- < Button asChild >
84- < Link
85- href = { `/admin/borrows/${ borrowRes . data . id } /edit` }
86- className = "w-full"
87- >
88- < Pen />
89- Edit
90- </ Link >
91- </ Button >
92- </ div >
93- </ >
94+ < Button asChild >
95+ < Link
96+ href = { `/admin/borrows/${ borrowRes . data . id } /edit` }
97+ className = "w-full"
98+ >
99+ < Pen />
100+ Edit
101+ </ Link >
102+ </ Button >
103+ </ div >
94104 </ DetailBorrow >
95105 )
96106}
0 commit comments