update filter

This commit is contained in:
wayanrivan
2025-05-06 11:00:04 +07:00
parent 49f32883f7
commit c255e59733
4 changed files with 32 additions and 8 deletions

View File

@ -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),
});

View File

@ -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

View File

@ -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),
});

View File

@ -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;
// }