import { useTranslation } from "@/Utils/Hooks/useTranslate";
import Pagination from "@/Utils/Other/Pagination"

const CustomPagination = (props: any) => {
    const { total, currentPageObj, setParams } = props;
    const { translations } = useTranslation();
    return (
        <div className="flex max-md:flex-col items-center max-md:justify-center justify-between mt-5 px-1">
            {total / currentPageObj?.per_page > 0 &&
                <>
                    {total >= 1 && (
                        <h6 className='text-xs text-neutral-500 max-md:mb-3'>
                            {translations?.showing} <span className="font-medium text-neutral-700">{(currentPageObj?.page - 1) * currentPageObj?.per_page + 1}</span> {translations?.to} <span className="font-medium text-neutral-700">{total > currentPageObj?.page * currentPageObj?.per_page ? currentPageObj?.page * currentPageObj?.per_page : total}</span> {translations?.of} <span className="font-medium text-neutral-700">{total}</span> {translations?.entries}
                        </h6>
                    )}
                    <Pagination current_page={currentPageObj?.page} total={total ?? 0} per_page={currentPageObj?.per_page} setParams={setParams} />
                </>
            }
        </div>
    )
}

export default CustomPagination
