From efef7d273dd2ca2c19634b308f2abbf003271b9c Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 7 Nov 2025 11:55:00 +0530 Subject: [PATCH 1/6] =?UTF-8?q?Payment=20Pending=20List=20=E2=80=94=20?= =?UTF-8?q?=E2=80=9CSubmitted=20By=E2=80=9D=20Filter=20Not=20Sorted=20Alph?= =?UTF-8?q?abetically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PaymentRequest/PaymentRequestList.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/PaymentRequest/PaymentRequestList.jsx b/src/components/PaymentRequest/PaymentRequestList.jsx index 061601fa..32b21988 100644 --- a/src/components/PaymentRequest/PaymentRequestList.jsx +++ b/src/components/PaymentRequest/PaymentRequestList.jsx @@ -180,9 +180,14 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { ]; if (isLoading) return ; - const grouped = groupBy - ? groupByField(data?.data ?? [], groupBy) + const grouped = groupBy + ? Object.fromEntries( + Object.entries(groupByField(data?.data ?? [], groupBy)).sort(([keyA], [keyB]) => + keyA.localeCompare(keyB) + ) + ) : { All: data?.data ?? [] }; + const IsGroupedByDate = [ { key: "transactionDate", displayField: "Transaction Date" }, { key: "createdAt", displayField: "created Date" }, -- 2.43.0 From afac22da234cdbe53300a5b86b5dd390734061a9 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 7 Nov 2025 12:05:09 +0530 Subject: [PATCH 2/6] Incorrect Currency Symbol Displayed for USD in Payment Request Form --- .../PaymentRequest/PaymentRequestList.jsx | 39 ++++++++----------- .../RecurringExpense/RecurringExpenseList.jsx | 14 +++---- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/components/PaymentRequest/PaymentRequestList.jsx b/src/components/PaymentRequest/PaymentRequestList.jsx index 32b21988..20b3d470 100644 --- a/src/components/PaymentRequest/PaymentRequestList.jsx +++ b/src/components/PaymentRequest/PaymentRequestList.jsx @@ -43,9 +43,8 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { displayField = "Status"; break; case "submittedBy": - key = `${item?.createdBy?.firstName ?? ""} ${ - item.createdBy?.lastName ?? "" - }`.trim(); + key = `${item?.createdBy?.firstName ?? ""} ${item.createdBy?.lastName ?? "" + }`.trim(); displayField = "Submitted By"; break; case "project": @@ -98,9 +97,8 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { label: "Submitted By", align: "text-start", getValue: (e) => - `${e.createdBy?.firstName ?? ""} ${ - e.createdBy?.lastName ?? "" - }`.trim() || "N/A", + `${e.createdBy?.firstName ?? ""} ${e.createdBy?.lastName ?? "" + }`.trim() || "N/A", customRender: (e) => (
{ lastName={e.createdBy?.lastName} /> - {`${e.createdBy?.firstName ?? ""} ${ - e.createdBy?.lastName ?? "" - }`.trim() || "N/A"} + {`${e.createdBy?.firstName ?? ""} ${e.createdBy?.lastName ?? "" + }`.trim() || "N/A"}
), @@ -128,15 +125,12 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { }, { key: "amount", - label: " Amount", - align: "text-start", - getValue: (e) => ( - <> - {formatCurrency(e?.amount)} {e.currency.currencyCode} - - ), - - align: "text-end px-3", + label: "Amount", + align: "text-end", + getValue: (e) => + e?.amount + ? `${e?.currency?.symbol ? e.currency.symbol + " " : ""}${e.amount.toLocaleString()}` + : "N/A", }, { key: "expenseStatus", @@ -144,9 +138,8 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { align: "text-center", getValue: (e) => ( {e?.expenseStatus?.name || "Unknown"} @@ -180,14 +173,14 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => { ]; if (isLoading) return ; - const grouped = groupBy + const grouped = groupBy ? Object.fromEntries( Object.entries(groupByField(data?.data ?? [], groupBy)).sort(([keyA], [keyB]) => keyA.localeCompare(keyB) ) ) : { All: data?.data ?? [] }; - + const IsGroupedByDate = [ { key: "transactionDate", displayField: "Transaction Date" }, { key: "createdAt", displayField: "created Date" }, diff --git a/src/components/RecurringExpense/RecurringExpenseList.jsx b/src/components/RecurringExpense/RecurringExpenseList.jsx index cb9bee5b..51ae40b3 100644 --- a/src/components/RecurringExpense/RecurringExpenseList.jsx +++ b/src/components/RecurringExpense/RecurringExpenseList.jsx @@ -68,7 +68,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { align: "text-end", getValue: (e) => e?.amount - ? `${e?.currency?.symbol || ""}${e.amount.toLocaleString()}` + ? `${e?.currency?.symbol ? e.currency.symbol + " " : ""}${e.amount.toLocaleString()}` : "N/A", }, { @@ -109,7 +109,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { ); - const paginate = (page) => { + const paginate = (page) => { if (page >= 1 && page <= (data?.totalPages ?? 1)) { setCurrentPage(page); } @@ -277,11 +277,11 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { {/* Pagination */} - + ); -- 2.43.0 From f19b9037e7a5b27520a23e724f0c512b03b78361 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 7 Nov 2025 12:56:20 +0530 Subject: [PATCH 3/6] When document filter is now auto closed at we are go to next tab or component. --- .../Documents/DocumentFilterPanel.jsx | 420 +++++++++--------- 1 file changed, 213 insertions(+), 207 deletions(-) diff --git a/src/components/Documents/DocumentFilterPanel.jsx b/src/components/Documents/DocumentFilterPanel.jsx index edc613e1..04f54956 100644 --- a/src/components/Documents/DocumentFilterPanel.jsx +++ b/src/components/Documents/DocumentFilterPanel.jsx @@ -13,230 +13,236 @@ import { useParams } from "react-router-dom"; const DocumentFilterPanel = forwardRef( ({ entityTypeId, onApply, setFilterdata }, ref) => { - const [resetKey, setResetKey] = useState(0); - const { status } = useParams(); + const [resetKey, setResetKey] = useState(0); + const { status } = useParams(); - const { data, isError, isLoading, error } = - useDocumentFilterEntities(entityTypeId); + const { data, isError, isLoading, error } = + useDocumentFilterEntities(entityTypeId); - //changes + useEffect(() => { + return () => { + closePanel(); + }; + }, []); - const dynamicDocumentFilterDefaultValues = useMemo(() => { - return { - ...DocumentFilterDefaultValues, - uploadedByIds: DocumentFilterDefaultValues.uploadedByIds || [], - documentCategoryIds: DocumentFilterDefaultValues.documentCategoryIds || [], - documentTypeIds: DocumentFilterDefaultValues.documentTypeIds || [], - documentTagIds: DocumentFilterDefaultValues.documentTagIds || [], - startDate: DocumentFilterDefaultValues.startDate, - endDate: DocumentFilterDefaultValues.endDate, + //changes + + const dynamicDocumentFilterDefaultValues = useMemo(() => { + return { + ...DocumentFilterDefaultValues, + uploadedByIds: DocumentFilterDefaultValues.uploadedByIds || [], + documentCategoryIds: DocumentFilterDefaultValues.documentCategoryIds || [], + documentTypeIds: DocumentFilterDefaultValues.documentTypeIds || [], + documentTagIds: DocumentFilterDefaultValues.documentTagIds || [], + startDate: DocumentFilterDefaultValues.startDate, + endDate: DocumentFilterDefaultValues.endDate, + }; + + }, [status]); + + const methods = useForm({ + resolver: zodResolver(DocumentFilterSchema), + defaultValues: dynamicDocumentFilterDefaultValues, + }); + + const { handleSubmit, reset, setValue, watch } = methods; + + // Watch values from form + const isUploadedAt = watch("isUploadedAt"); + const isVerified = watch("isVerified"); + + // Close the offcanvas (bootstrap specific) + const closePanel = () => { + document.querySelector(".offcanvas.show .btn-close")?.click(); }; - }, [status]); + useImperativeHandle(ref, () => ({ + resetFieldValue: (name, value) => { + if (value !== undefined) { + setValue(name, value); + } else { + reset({ ...methods.getValues(), [name]: DocumentFilterDefaultValues[name] }); + } + }, + getValues: methods.getValues, // optional, to read current filter state + })); - const methods = useForm({ - resolver: zodResolver(DocumentFilterSchema), - defaultValues: dynamicDocumentFilterDefaultValues, - }); - - const { handleSubmit, reset, setValue, watch } = methods; - - // Watch values from form - const isUploadedAt = watch("isUploadedAt"); - const isVerified = watch("isVerified"); - - // Close the offcanvas (bootstrap specific) - const closePanel = () => { - document.querySelector(".offcanvas.show .btn-close")?.click(); - }; - - useImperativeHandle(ref, () => ({ - resetFieldValue: (name, value) => { - if (value !== undefined) { - setValue(name, value); - } else { - reset({ ...methods.getValues(), [name]: DocumentFilterDefaultValues[name] }); + //changes + useEffect(() => { + if (data && setFilterdata) { + setFilterdata(data); } - }, - getValues: methods.getValues, // optional, to read current filter state - })); + }, [data, setFilterdata]); - //changes - useEffect(() => { - if (data && setFilterdata) { - setFilterdata(data); - } - }, [data, setFilterdata]); + const onSubmit = (values) => { + onApply({ + ...values, + startDate: values.startDate + ? moment.utc(values.startDate, "DD-MM-YYYY").toISOString() + : null, + endDate: values.endDate + ? moment.utc(values.endDate, "DD-MM-YYYY").toISOString() + : null, + }); + // closePanel(); + }; - const onSubmit = (values) => { - onApply({ - ...values, - startDate: values.startDate - ? moment.utc(values.startDate, "DD-MM-YYYY").toISOString() - : null, - endDate: values.endDate - ? moment.utc(values.endDate, "DD-MM-YYYY").toISOString() - : null, - }); - // closePanel(); - }; + const onClear = () => { + reset(DocumentFilterDefaultValues); + setResetKey((prev) => prev + 1); + onApply(DocumentFilterDefaultValues); + // closePanel(); + }; - const onClear = () => { - reset(DocumentFilterDefaultValues); - setResetKey((prev) => prev + 1); - onApply(DocumentFilterDefaultValues); - // closePanel(); - }; + if (isLoading) return
Loading...
; + if (isError) + return
Error: {error?.message || "Something went wrong!"}
; - if (isLoading) return
Loading...
; - if (isError) - return
Error: {error?.message || "Something went wrong!"}
; - - const { - uploadedBy = [], - documentCategory = [], - documentType = [], - documentTag = [], - } = data?.data || {}; + const { + uploadedBy = [], + documentCategory = [], + documentType = [], + documentTag = [], + } = data?.data || {}; - return ( - -
- {/* Date Range Section */} -
-
- -
- - + return ( + + + {/* Date Range Section */} +
+
+ +
+ + +
+
+ + +
+ + {/* Dropdown Filters */} +
+ + + + +
+ + {/* Status Filter */} +
+ +
+ + + + +
- -
- - {/* Dropdown Filters */} -
- - - - -
- - {/* Status Filter */} -
- -
- - - - - + {/* Footer Buttons */} +
+ +
-
- - {/* Footer Buttons */} -
- - -
- - - ); -}); + + + ); + }); export default DocumentFilterPanel; -- 2.43.0 From 4c144c58e9b513d73eb19cbaed30a8a7751518da Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 7 Nov 2025 10:16:23 +0530 Subject: [PATCH 4/6] =?UTF-8?q?=E2=80=9CError=20=E2=80=98Something=20Went?= =?UTF-8?q?=20Wrong=E2=80=99=20When=20Selecting=20Any=20Value=20from=20Cat?= =?UTF-8?q?egory=20Dropdown=20in=20Dashboard=20>=20Monthly=20Expense=20Car?= =?UTF-8?q?d=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dashboard/ExpenseByProject.jsx | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/Dashboard/ExpenseByProject.jsx b/src/components/Dashboard/ExpenseByProject.jsx index d59c9522..7c0e829f 100644 --- a/src/components/Dashboard/ExpenseByProject.jsx +++ b/src/components/Dashboard/ExpenseByProject.jsx @@ -35,7 +35,7 @@ const ExpenseByProject = () => { const getSelectedTypeName = () => { if (!selectedType) return "All Types"; - const found = ExpenseTypes.find((t) => t.id === selectedType); + const found = ExpenseCategories.find((t) => t.id === selectedType); return found ? found.name : "All Types"; }; @@ -69,8 +69,8 @@ const ExpenseByProject = () => { const ExpenseCategoryType = [ - {id:1,category:"Category",label:"Category"}, - {id:2,category:"Project",label:"Project"} + { id: 1, category: "Category", label: "Category" }, + { id: 2, category: "Project", label: "Project" } ] return ( @@ -91,19 +91,19 @@ const ExpenseByProject = () => { > {viewMode} -
    - {ExpenseCategoryType.map((cat)=>( -
  • - -
  • +
      + {ExpenseCategoryType.map((cat) => ( +
    • + +
    • ))}
@@ -115,8 +115,8 @@ const ExpenseByProject = () => {
-- 2.43.0 From 053cb842e0159f788cb480350cacfb583d826c3c Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 7 Nov 2025 15:14:59 +0530 Subject: [PATCH 6/6] Changes --- src/components/PaymentRequest/ManagePaymentRequest.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PaymentRequest/ManagePaymentRequest.jsx b/src/components/PaymentRequest/ManagePaymentRequest.jsx index f6f41f62..20211b0e 100644 --- a/src/components/PaymentRequest/ManagePaymentRequest.jsx +++ b/src/components/PaymentRequest/ManagePaymentRequest.jsx @@ -519,7 +519,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) { ? "Please Wait..." : requestToEdit ? "Update" - : "Save as Draft"} + : "Submit"}
-- 2.43.0