paginate false
This commit is contained in:
+4
-1
@@ -488,7 +488,10 @@
|
|||||||
"4": "چهارماهه",
|
"4": "چهارماهه",
|
||||||
"5": "سالانه",
|
"5": "سالانه",
|
||||||
"maxRecurringCycles": "حداکثر تعداد تکرار دوره",
|
"maxRecurringCycles": "حداکثر تعداد تکرار دوره",
|
||||||
"WAIT_PAYMENT": "در انتظار پرداخت"
|
"WAIT_PAYMENT": "در انتظار پرداخت",
|
||||||
|
"overdue": "سررسید شده",
|
||||||
|
"OVERDUE": "سررسید شده",
|
||||||
|
"lateFee": "مبلغ پرداختی"
|
||||||
},
|
},
|
||||||
"edit": "ویرایش",
|
"edit": "ویرایش",
|
||||||
"transaction": {
|
"transaction": {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import * as api from "../service/CustomerService";
|
|||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { CreateCustomerType } from "../types/CustomerTypes";
|
import { CreateCustomerType } from "../types/CustomerTypes";
|
||||||
|
|
||||||
export const useGetCustomers = (page: number) => {
|
export const useGetCustomers = (page: number, withoutPaginate?: boolean) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["customers", page],
|
queryKey: ["customers", page],
|
||||||
queryFn: () => api.getCustomers(page),
|
queryFn: () => api.getCustomers(page, withoutPaginate),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import axios from "../../../config/axios";
|
import axios from "../../../config/axios";
|
||||||
import { CreateCustomerType } from "../types/CustomerTypes";
|
import { CreateCustomerType } from "../types/CustomerTypes";
|
||||||
|
|
||||||
export const getCustomers = async (page: number) => {
|
export const getCustomers = async (page: number, withoutPaginate?: boolean) => {
|
||||||
const { data } = await axios.get(`/users/customers?page=${page}`);
|
const { data } = await axios.get(
|
||||||
|
`/users/customers?page=${page}&paginate=${withoutPaginate ? "0" : "1"}`
|
||||||
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const CreateReceipt: FC = () => {
|
|||||||
const [isRecurring, setIsRecurring] = useState<boolean>(false)
|
const [isRecurring, setIsRecurring] = useState<boolean>(false)
|
||||||
const [type, setType] = useState<ReceiptTypeEnum>(ReceiptTypeEnum.DAILY)
|
const [type, setType] = useState<ReceiptTypeEnum>(ReceiptTypeEnum.DAILY)
|
||||||
const [maxRecurringCycles, setMaxRecurringCycles] = useState<number>(0)
|
const [maxRecurringCycles, setMaxRecurringCycles] = useState<number>(0)
|
||||||
const getCustomers = useGetCustomers(1)
|
const getCustomers = useGetCustomers(1, true)
|
||||||
const createInvoice = useCreateInvoice()
|
const createInvoice = useCreateInvoice()
|
||||||
|
|
||||||
const formik = useFormik<ReceiptCreateItemsType>({
|
const formik = useFormik<ReceiptCreateItemsType>({
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import DatePickerComponent from '../../components/DatePicker'
|
|||||||
import { useSearchParams } from 'react-router-dom'
|
import { useSearchParams } from 'react-router-dom'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import Pagination from '../../components/Pagination'
|
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 = () => {
|
const ReceiptsList: FC = () => {
|
||||||
|
|
||||||
@@ -111,6 +111,11 @@ const ReceiptsList: FC = () => {
|
|||||||
label: t('receip.archive'),
|
label: t('receip.archive'),
|
||||||
value: 'EXPIRED'
|
value: 'EXPIRED'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: <CloseCircle color={activeTab === 'OVERDUE' ? 'black' : '#8C90A3'} size={22} />,
|
||||||
|
label: t('receip.overdue'),
|
||||||
|
value: 'OVERDUE'
|
||||||
|
}
|
||||||
]}
|
]}
|
||||||
onChange={(value) => setActiveTab(value as ActiveTabType)}
|
onChange={(value) => setActiveTab(value as ActiveTabType)}
|
||||||
/>
|
/>
|
||||||
@@ -131,6 +136,7 @@ const ReceiptsList: FC = () => {
|
|||||||
<Td text={t('receip.date_receipt')} />
|
<Td text={t('receip.date_receipt')} />
|
||||||
<Td text={t('receip.last_date_receipt')} />
|
<Td text={t('receip.last_date_receipt')} />
|
||||||
<Td text={t('receip.total')} />
|
<Td text={t('receip.total')} />
|
||||||
|
<Td text={t('receip.lateFee')} />
|
||||||
<Td text={t('receip.service')} />
|
<Td text={t('receip.service')} />
|
||||||
<Td text={t('receip.status')} />
|
<Td text={t('receip.status')} />
|
||||||
<Td text={t('receip.status_paid')} />
|
<Td text={t('receip.status_paid')} />
|
||||||
@@ -149,7 +155,8 @@ const ReceiptsList: FC = () => {
|
|||||||
<Td text={moment(item.createdAt).format('jYYYY/jMM/jDD')} />
|
<Td text={moment(item.createdAt).format('jYYYY/jMM/jDD')} />
|
||||||
<Td text={moment(item.dueDate).format('jYYYY/jMM/jDD')} />
|
<Td text={moment(item.dueDate).format('jYYYY/jMM/jDD')} />
|
||||||
<Td text={NumberFormat(item.totalPrice)} />
|
<Td text={NumberFormat(item.totalPrice)} />
|
||||||
<Td text={t('receip.service')} />
|
<Td text={NumberFormat(item.lateFee)} />
|
||||||
|
<Td text={item.items[0]?.name} />
|
||||||
<Td text={item.status === 'APPROVED' || item.status === 'PAID' ? t('receip.approved') : t('receip.pending')} />
|
<Td text={item.status === 'APPROVED' || item.status === 'PAID' ? t('receip.approved') : t('receip.pending')} />
|
||||||
<Td text={t(`receip.${item.status}`)} />
|
<Td text={t(`receip.${item.status}`)} />
|
||||||
<Td text=''>
|
<Td text=''>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export type ReceiptItemType = {
|
|||||||
isRecurring: boolean;
|
isRecurring: boolean;
|
||||||
recurringPeriod?: number;
|
recurringPeriod?: number;
|
||||||
maxRecurringCycles?: number;
|
maxRecurringCycles?: number;
|
||||||
|
lateFee: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type InvoiceUserItemType = {
|
export type InvoiceUserItemType = {
|
||||||
|
|||||||
Reference in New Issue
Block a user