import React from 'react'
import {Link} from 'react-router-dom'
import Img from '../../../assets/user_avatar.jpg'
import formatNumber from '../../../helpers/formatNumber'
import CustomCounter from '../../CustomCounter'
import RouteLinks from '../../../RouteLinks'

export default function Orders({data}) {
    return (
        <div className='h-full flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
            <div className='flex flex-col gap-4'>
                <p className='text-base text-white-body font-bold'>Recent Loans</p>
                <div className='flex flex-col gap-4'>
                    {data.map((item, index)=>{
                        return (
                            <Link 
                                to={RouteLinks.transaction_details_page}
                                state={{transactionID: item?.transaction_id}}
                                key={index} className='flex gap-3 items-center'
                            >
                                <div className='px-4 py-2 bg-[#0E172E] rounded-md'>
                                    <img src={Img} className='w-8' alt="Order Image" />
                                </div>
                                <div className='flex-col'>
                                    <p className='text-sm font-bold text-white-body'>{item?.customer_id}</p>
                                    <p className='text-sm text-slate-500'>{formatNumber(item?.current_loan_amount)}</p>
                                </div>
                            </Link>
                        )
                    })}
                </div>
            </div>
        </div>
    )
}
