"use client"; import { order_api } from "@/features/specification/lib/api"; import { formatPrice } from "@/shared/lib/formatPrice"; import AddedButton from "@/shared/ui/added-button"; import { Button } from "@/shared/ui/button"; import { DashboardLayout } from "@/widgets/dashboard-layout/ui"; import { useQuery } from "@tanstack/react-query"; import { Eye } from "lucide-react"; import { useNavigate } from "react-router-dom"; export function HistoryListPage() { const router = useNavigate(); const { data, isLoading, isError } = useQuery({ queryKey: ["order_list"], queryFn: () => order_api.order_list(), select(data) { return data.data.data; }, }); if (isLoading) { return (

Yuklanmoqda...

); } if (isError) { return (

Xatolik yuz berdi

); } return (

Buyurtmalar Tarixi

{"Barcha buyurtmalar ro'yxati"}

router("/specification/added")} />
{data && data.length > 0 ? ( data.map((item) => (

Buyurtma №{item.id}

Mijoz

{item.employee_name}

Farmasevtika

{item.factory.name}

Hisoblangan narxi

{formatPrice(item.total_price)}

{"To'langan foizi"}

{item.advance}%

{"To'langan narxi"}

{formatPrice(item.paid_price)}

{/* KO‘RISH BUTTON */}
)) ) : (

{"Hozircha ma'lumot yo‘q."}

)}
); }