diff --git a/src/langs/fa.json b/src/langs/fa.json index 8c39cda..8c13e93 100644 --- a/src/langs/fa.json +++ b/src/langs/fa.json @@ -488,7 +488,10 @@ "4": "چهارماهه", "5": "سالانه", "maxRecurringCycles": "حداکثر تعداد تکرار دوره", - "WAIT_PAYMENT": "در انتظار پرداخت" + "WAIT_PAYMENT": "در انتظار پرداخت", + "overdue": "سررسید شده", + "OVERDUE": "سررسید شده", + "lateFee": "مبلغ پرداختی" }, "edit": "ویرایش", "transaction": { diff --git a/src/pages/customer/hooks/useCustomerData.ts b/src/pages/customer/hooks/useCustomerData.ts index 1322d78..432879b 100644 --- a/src/pages/customer/hooks/useCustomerData.ts +++ b/src/pages/customer/hooks/useCustomerData.ts @@ -2,10 +2,10 @@ import * as api from "../service/CustomerService"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { CreateCustomerType } from "../types/CustomerTypes"; -export const useGetCustomers = (page: number) => { +export const useGetCustomers = (page: number, withoutPaginate?: boolean) => { return useQuery({ queryKey: ["customers", page], - queryFn: () => api.getCustomers(page), + queryFn: () => api.getCustomers(page, withoutPaginate), }); }; diff --git a/src/pages/customer/service/CustomerService.ts b/src/pages/customer/service/CustomerService.ts index 4801ff9..c7ffce8 100644 --- a/src/pages/customer/service/CustomerService.ts +++ b/src/pages/customer/service/CustomerService.ts @@ -1,8 +1,10 @@ import axios from "../../../config/axios"; import { CreateCustomerType } from "../types/CustomerTypes"; -export const getCustomers = async (page: number) => { - const { data } = await axios.get(`/users/customers?page=${page}`); +export const getCustomers = async (page: number, withoutPaginate?: boolean) => { + const { data } = await axios.get( + `/users/customers?page=${page}&paginate=${withoutPaginate ? "0" : "1"}` + ); return data; }; diff --git a/src/pages/receipts/Create.tsx b/src/pages/receipts/Create.tsx index b6d62b2..ce04c37 100644 --- a/src/pages/receipts/Create.tsx +++ b/src/pages/receipts/Create.tsx @@ -26,7 +26,7 @@ const CreateReceipt: FC = () => { const [isRecurring, setIsRecurring] = useState(false) const [type, setType] = useState(ReceiptTypeEnum.DAILY) const [maxRecurringCycles, setMaxRecurringCycles] = useState(0) - const getCustomers = useGetCustomers(1) + const getCustomers = useGetCustomers(1, true) const createInvoice = useCreateInvoice() const formik = useFormik({ diff --git a/src/pages/receipts/List.tsx b/src/pages/receipts/List.tsx index a3ebe44..1734b14 100644 --- a/src/pages/receipts/List.tsx +++ b/src/pages/receipts/List.tsx @@ -13,7 +13,7 @@ import DatePickerComponent from '../../components/DatePicker' import { useSearchParams } from 'react-router-dom' import moment from 'moment-jalaali' import Pagination from '../../components/Pagination' -type ActiveTabType = "PENDING" | "WAIT_PAYMENT" | "PAID" | "CANCELLED" | "EXPIRED" | "" +type ActiveTabType = "PENDING" | "WAIT_PAYMENT" | "PAID" | "CANCELLED" | "EXPIRED" | "" | "OVERDUE" const ReceiptsList: FC = () => { @@ -111,6 +111,11 @@ const ReceiptsList: FC = () => { label: t('receip.archive'), value: 'EXPIRED' }, + { + icon: , + label: t('receip.overdue'), + value: 'OVERDUE' + } ]} onChange={(value) => setActiveTab(value as ActiveTabType)} /> @@ -131,6 +136,7 @@ const ReceiptsList: FC = () => { + @@ -149,7 +155,8 @@ const ReceiptsList: FC = () => { - + + diff --git a/src/pages/receipts/types/ReceiptTypes.ts b/src/pages/receipts/types/ReceiptTypes.ts index d95394c..afef8e3 100644 --- a/src/pages/receipts/types/ReceiptTypes.ts +++ b/src/pages/receipts/types/ReceiptTypes.ts @@ -34,6 +34,7 @@ export type ReceiptItemType = { isRecurring: boolean; recurringPeriod?: number; maxRecurringCycles?: number; + lateFee: number; }; export type InvoiceUserItemType = {