update filter
This commit is contained in:
@ -40,9 +40,9 @@ const ListToolbar = () => {
|
||||
// useEffect to set the default date values
|
||||
useEffect(() => {
|
||||
const today = new Date();
|
||||
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
// const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
settrxDate({
|
||||
from: formatDate(firstDayOfMonth),
|
||||
from: formatDate(today),
|
||||
to: formatDate(today),
|
||||
});
|
||||
}, []);
|
||||
@ -136,13 +136,13 @@ const ListToolbar = () => {
|
||||
className="h-7.5"
|
||||
onClick={() => {
|
||||
const today = new Date();
|
||||
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
// const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
|
||||
// Resetting all filters
|
||||
setSearchValue('');
|
||||
setStatusApproval('');
|
||||
settrxDate({
|
||||
from: formatDate(firstDayOfMonth),
|
||||
from: formatDate(today),
|
||||
to: formatDate(today),
|
||||
});
|
||||
|
||||
|
||||
@ -282,6 +282,18 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode }
|
||||
formattedFilter["Transactions.code"] = { like: `%${transactioncode}%` };
|
||||
}
|
||||
|
||||
if (transactioncode) {
|
||||
formattedFilter["Transactions.msisdn"] = {
|
||||
like: `%${transactioncode}%`
|
||||
};
|
||||
}
|
||||
|
||||
if (transactioncode) {
|
||||
formattedFilter["Transactions.fullname"] = {
|
||||
like: `%${transactioncode}%`
|
||||
};
|
||||
}
|
||||
|
||||
// Handle approval status filter
|
||||
formattedFilter["Transactions.status_approve"] = approvalstatus
|
||||
? approvalstatus
|
||||
|
||||
@ -61,9 +61,9 @@ const ListToolbar = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const today = new Date();
|
||||
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
// const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
settrxDate({
|
||||
from: formatDate(firstDayOfMonth),
|
||||
from: formatDate(today),
|
||||
to: formatDate(today),
|
||||
});
|
||||
}, []);
|
||||
@ -167,14 +167,14 @@ const ListToolbar = () => {
|
||||
onClick={() => {
|
||||
// Preserve trxDate values (from, to) and reset others
|
||||
const today = new Date();
|
||||
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
// const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
|
||||
// Only reset filters excluding from and to
|
||||
setSearchValue('');
|
||||
// setStatusValue('');
|
||||
setTypeValue('');
|
||||
settrxDate({
|
||||
from: formatDate(firstDayOfMonth),
|
||||
from: formatDate(today),
|
||||
to: formatDate(today),
|
||||
});
|
||||
|
||||
|
||||
@ -279,6 +279,18 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (transactioncode) {
|
||||
formattedFilter["Transactions.msisdn"] = {
|
||||
like: `%${transactioncode}%`
|
||||
};
|
||||
}
|
||||
|
||||
if (transactioncode) {
|
||||
formattedFilter["Transactions.fullname"] = {
|
||||
like: `%${transactioncode}%`
|
||||
};
|
||||
}
|
||||
|
||||
// if (transactionstatus) {
|
||||
// formattedFilter["Transactions.status"] = transactionstatus;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user