diff --git a/src/pages/finance/lib/type.ts b/src/pages/finance/lib/type.ts
index 471a51a..1586f5b 100644
--- a/src/pages/finance/lib/type.ts
+++ b/src/pages/finance/lib/type.ts
@@ -192,24 +192,22 @@ export interface History {
total_pages: number;
page_size: number;
current_page: number;
- results: [
- {
+ results: {
+ id: number;
+ travel_agency: {
+ custom_id: string;
+ name: string;
+ email: string;
+ phone: string;
+ };
+ amount: number;
+ note: string;
+ accountant: {
id: number;
- travel_agency: {
- custom_id: string;
- name: string;
- email: string;
- phone: string;
- };
- amount: number;
- note: string;
- accountant: {
- id: number;
- first_name: string;
- last_name: string;
- role: string;
- };
- },
- ];
+ first_name: string;
+ last_name: string;
+ role: string;
+ };
+ }[];
};
}
diff --git a/src/pages/finance/ui/FinanceDetailUsers.tsx b/src/pages/finance/ui/FinanceDetailUsers.tsx
index 2f91d9e..bab4531 100644
--- a/src/pages/finance/ui/FinanceDetailUsers.tsx
+++ b/src/pages/finance/ui/FinanceDetailUsers.tsx
@@ -392,8 +392,11 @@ export default function FinanceDetailUser() {
{companion.participant_pasport_image.map(
(img) => (
-

-
+
),
)}
diff --git a/src/pages/finance/ui/PaymentHistory.tsx b/src/pages/finance/ui/PaymentHistory.tsx
index c19bf5b..30bff90 100644
--- a/src/pages/finance/ui/PaymentHistory.tsx
+++ b/src/pages/finance/ui/PaymentHistory.tsx
@@ -21,9 +21,16 @@ export function PaymentHistory() {
const { t } = useTranslation();
const [page, setPage] = useState(1);
- const { data, isLoading, isError } = useQuery({
+ const {
+ data: history,
+ isLoading,
+ isError,
+ } = useQuery({
queryKey: ["payment-history", page],
queryFn: () => getPaymentHistory({ page, page_size: 10 }),
+ select(data) {
+ return data.data;
+ },
});
if (isLoading)
@@ -33,15 +40,13 @@ export function PaymentHistory() {
);
- if (isError || !data)
+ if (isError || !history)
return (
Xatolik yuz berdi. Qayta urinib ko‘ring.
);
- const history = data.data;
-
return (
@@ -60,7 +65,7 @@ export function PaymentHistory() {
- {history.data.results.map((item) => (
+ {history?.data.results.map((item) => (
{item.travel_agency.custom_id}
{item.travel_agency.name}
@@ -68,7 +73,9 @@ export function PaymentHistory() {
{formatPrice(item.amount, true)}
{item.note || "-"}
- {item.accountant.first_name} {item.accountant.last_name}
+ {item.accountant?.first_name || item.accountant?.last_name
+ ? `${item.accountant?.first_name ?? ""} ${item.accountant?.last_name ?? ""}`
+ : "-"}
))}
@@ -78,14 +85,14 @@ export function PaymentHistory() {
{/* Pagination */}
- {t("Sahifa")} {history.data.current_page} /{" "}
- {history.data.total_pages}
+ {t("Sahifa")} {history?.data.current_page} /{" "}
+ {history?.data.total_pages}
diff --git a/src/pages/users/ui/UserDetail.tsx b/src/pages/users/ui/UserDetail.tsx
index 0a7991e..c151870 100644
--- a/src/pages/users/ui/UserDetail.tsx
+++ b/src/pages/users/ui/UserDetail.tsx
@@ -471,8 +471,11 @@ const UserDetail = () => {
{companion.participant_pasport_image.map(
(img) => (
-
![]()
{
src={img.image}
className="w-full h-full"
/>
-
+
),
)}