diff --git a/src/components/Expenses/ManageExpense.jsx b/src/components/Expenses/ManageExpense.jsx
index 80ba23a5..37bc50b5 100644
--- a/src/components/Expenses/ManageExpense.jsx
+++ b/src/components/Expenses/ManageExpense.jsx
@@ -57,7 +57,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
(store) => store.localVariables.projectId
);
const { projectNames, loading: projectLoading, error } = useProjectName();
-
+debugger
const {
PaymentModes,
loading: PaymentModeLoading,
diff --git a/src/components/Expenses/ViewExpense.jsx b/src/components/Expenses/ViewExpense.jsx
index e46b005d..3ff0d32d 100644
--- a/src/components/Expenses/ViewExpense.jsx
+++ b/src/components/Expenses/ViewExpense.jsx
@@ -12,7 +12,11 @@ import { useExpenseContext } from "../../pages/Expense/ExpensePage";
import { getColorNameFromHex } from "../../utils/appUtils";
import { ExpenseDetailsSkeleton } from "./ExpenseSkeleton";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
-import { EXPENSE_REJECTEDBY, PROCESS_EXPENSE, REVIEW_EXPENSE } from "../../utils/constants";
+import {
+ EXPENSE_REJECTEDBY,
+ PROCESS_EXPENSE,
+ REVIEW_EXPENSE,
+} from "../../utils/constants";
import { useProfile } from "../../hooks/useProfile";
import { useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
@@ -69,22 +73,25 @@ const ViewExpense = ({ ExpenseId }) => {
});
}, [data, userPermissions]);
- const IsRejectedExpense = useMemo(()=>{
- return EXPENSE_REJECTEDBY.includes(data?.status?.id)
- },[data])
+ const IsRejectedExpense = useMemo(() => {
+ return EXPENSE_REJECTEDBY.includes(data?.status?.id);
+ }, [data]);
const isCreatedBy = useMemo(() => {
- return data?.createdBy.id === CurrentUser?.id;
-}, [data, CurrentUser]);
+ return data?.createdBy.id === CurrentUser?.id;
+ }, [data, CurrentUser]);
- const { mutate: MakeAction,isPending } = useActionOnExpense(() => {
+ const { mutate: MakeAction, isPending } = useActionOnExpense(() => {
setClickedStatusId(null);
- reset()});
+ reset();
+ });
const onSubmit = (formData) => {
const Payload = {
...formData,
- reimburseDate:moment.utc(formData.reimburseDate, "DD-MM-YYYY").toISOString(),
+ reimburseDate: moment
+ .utc(formData.reimburseDate, "DD-MM-YYYY")
+ .toISOString(),
expenseId: ExpenseId,
comment: formData.comment,
};
@@ -340,42 +347,51 @@ const ViewExpense = ({ ExpenseId }) => {
)}
- {data.expensesReimburse && (
-
- Transaction ID : {data.expensesReimburse.reimburseTransactionId || "N/A"}
-
-
- Reimburse Date :{" "}
- { moment(data.expensesReimburse.reimburseDate).format("DD-MM-YYYY") }
-
+ {data.expensesReimburse && (
+
+
+
+ {data.expensesReimburse.reimburseTransactionId || "N/A"}
+
+
+
+ {formatUTCToLocalTime(data.expensesReimburse.reimburseDate)}
+
- {data.expensesReimburse && (
- <>
-
-
Reimburse By :
-
-
- {`${data?.expensesReimburse?.reimburseBy?.firstName} ${data?.expensesReimburse?.reimburseBy?.lastName}`.trim()}
-
-
- >
- )}
+ {data.expensesReimburse && (
+ <>
+
+
+
+
+ {`${data?.expensesReimburse?.reimburseBy?.firstName} ${data?.expensesReimburse?.reimburseBy?.lastName}`.trim()}
+
+
+ >
+ )}
-
- Note : {data.expensesReimburse.reimburseNote}
-
-
-
)}
-
-
+
+ {" "}
+ {data.expensesReimburse.reimburseNote}
+
+
+ )}
-
+
{data?.description}
@@ -444,7 +460,7 @@ const ViewExpense = ({ ExpenseId }) => {
{Array.isArray(data?.nextStatus) && data.nextStatus.length > 0 && (
<>
- {(IsPaymentProcess && nextStatusWithPermission?.length > 0) && (
+ {IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
@@ -461,7 +477,11 @@ const ViewExpense = ({ ExpenseId }) => {
-
+
{errors.reimburseDate && (
{errors.reimburseDate.message}
@@ -478,49 +498,47 @@ const ViewExpense = ({ ExpenseId }) => {
)}
-
- {(
- (nextStatusWithPermission.length > 0 && !IsRejectedExpense) ||
- (IsRejectedExpense && isCreatedBy)
- ) && (
- <>
-
-
- {errors.comment && (
-
- {errors.comment.message}
-
- )}
- >
- )}
-
- {(nextStatusWithPermission?.length > 0 && (!IsRejectedExpense || isCreatedBy)) && (
-
- {nextStatusWithPermission.map((status, index) => (
-
- ))}
-
- )}
-
+
+ {((nextStatusWithPermission.length > 0 && !IsRejectedExpense) ||
+ (IsRejectedExpense && isCreatedBy)) && (
+ <>
+
+
+ {errors.comment && (
+
+ {errors.comment.message}
+
+ )}
+ >
+ )}
+ {nextStatusWithPermission?.length > 0 &&
+ (!IsRejectedExpense || isCreatedBy) && (
+
+ {nextStatusWithPermission.map((status, index) => (
+
+ ))}
+
+ )}
+
>
)}
diff --git a/src/components/common/DatePicker.jsx b/src/components/common/DatePicker.jsx
index 7777f769..9645fddb 100644
--- a/src/components/common/DatePicker.jsx
+++ b/src/components/common/DatePicker.jsx
@@ -9,6 +9,7 @@ const DatePicker = ({
className = "",
allowText = false,
maxDate=new Date(),
+ minDate,
...rest
}) => {
const inputRef = useRef(null);
@@ -29,6 +30,7 @@ const DatePicker = ({
? flatpickr.parseDate(value, "Y-m-d")
: null,
maxDate:maxDate,
+ minDate:new Date(minDate?.split("T")[0]) ?? undefined,
onChange: function (selectedDates, dateStr) {
onChange(dateStr);
},
diff --git a/src/components/common/EmployeeSearchInput.jsx b/src/components/common/EmployeeSearchInput.jsx
index 2fb37afd..c3b9295a 100644
--- a/src/components/common/EmployeeSearchInput.jsx
+++ b/src/components/common/EmployeeSearchInput.jsx
@@ -45,7 +45,7 @@ const EmployeeSearchInput = ({ control, name, projectId }) => {
onChange={(e) => {
setSearch(e.target.value);
setShowDropdown(true);
- onChange(""); // Clear previous selection
+ onChange("");
}}
onFocus={() => {
if (search) setShowDropdown(true);