diff --git a/src/components/Layout/Sidebar.jsx b/src/components/Layout/Sidebar.jsx
index fb5349c4..b41cb654 100644
--- a/src/components/Layout/Sidebar.jsx
+++ b/src/components/Layout/Sidebar.jsx
@@ -27,14 +27,14 @@ const Sidebar = () => {
-
+
- OnField
+ OnField
Work
- .com
+ .com
diff --git a/src/components/PaymentRequest/ViewPaymentRequest.jsx b/src/components/PaymentRequest/ViewPaymentRequest.jsx
index 6f3f75d6..b686cdde 100644
--- a/src/components/PaymentRequest/ViewPaymentRequest.jsx
+++ b/src/components/PaymentRequest/ViewPaymentRequest.jsx
@@ -31,6 +31,7 @@ import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import {
EXPENSE_PROCESSED,
EXPENSE_REJECTEDBY,
+ EXPENSE_STATUS,
PROCESS_EXPENSE,
REVIEW_EXPENSE,
} from "../../utils/constants";
@@ -123,13 +124,22 @@ const ViewPaymentRequest = ({ requestId }) => {
setImageLoaded((prev) => ({ ...prev, [id]: true }));
};
+ const STATUS_HEADING = {
+ [EXPENSE_STATUS.daft]: "Initiation",
+ [EXPENSE_STATUS.review_pending]: "Review & Validation",
+ [EXPENSE_STATUS.approve_pending]: "Approval",
+ [EXPENSE_STATUS.payment_pending]: " Processing & Disbursement",
+ };
+
return (
-
Payment Request Details
+
+ Payment Request - {STATUS_HEADING[data?.expenseStatus?.id] || "Payment Request Details"}
+
@@ -138,9 +148,8 @@ const ViewPaymentRequest = ({ requestId }) => {
{data?.paymentRequestUID}
{data?.expenseStatus?.name}
@@ -254,9 +263,8 @@ const ViewPaymentRequest = ({ requestId }) => {
lastName={data?.createdBy?.lastName}
/>
- {`${data?.createdBy?.firstName ?? ""} ${
- data?.createdBy?.lastName ?? ""
- }`.trim() || "N/A"}
+ {`${data?.createdBy?.firstName ?? ""} ${data?.createdBy?.lastName ?? ""
+ }`.trim() || "N/A"}
@@ -276,9 +284,8 @@ const ViewPaymentRequest = ({ requestId }) => {
lastName={data?.paidBy?.lastName}
/>
- {`${data?.paidBy?.firstName ?? ""} ${
- data?.paidBy?.lastName ?? ""
- }`.trim() || "N/A"}
+ {`${data?.paidBy?.firstName ?? ""} ${data?.paidBy?.lastName ?? ""
+ }`.trim() || "N/A"}
diff --git a/src/components/RecurringExpense/ManageRecurringExpense.jsx b/src/components/RecurringExpense/ManageRecurringExpense.jsx
index e4b951c7..71967108 100644
--- a/src/components/RecurringExpense/ManageRecurringExpense.jsx
+++ b/src/components/RecurringExpense/ManageRecurringExpense.jsx
@@ -26,6 +26,7 @@ import {
import InputSuggestions from "../common/InputSuggestion";
import { useEmployeesName } from "../../hooks/useEmployees";
import PmsEmployeeInputTag from "../common/PmsEmployeeInputTag";
+import HoverPopup from "../common/HoverPopup";
const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
const {
@@ -111,7 +112,8 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
strikeDate: data.strikeDate?.slice(0, 10) || "",
projectId: data.project.id || "",
paymentBufferDays: data.paymentBufferDays || "",
- numberOfIteration: data.numberOfIteration || "",
+ // numberOfIteration: data.numberOfIteration || "",
+ endDate: data.endDate?.slice(0, 10) || "",
expenseCategoryId: data.expenseCategory.id || "",
statusId: data.status.id || "",
frequency: data.frequency || "",
@@ -129,6 +131,8 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
}
}, [currencyData, requestToEdit, setValue]);
+ const StrikeDate = watch("strikeDate")
+
const onSubmit = (fromdata) => {
console.log(fromdata);
let payload = {
@@ -136,6 +140,9 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
strikeDate: fromdata.strikeDate
? new Date(fromdata.strikeDate).toISOString()
: null,
+ endDate: fromdata.endDate
+ ? new Date(fromdata.endDate).toISOString()
+ : null,
notifyTo: handleEmailGetting(fromdata.notifyTo),
};
if (requestToEdit) {
@@ -145,6 +152,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
CreateRecurringExpense(payload);
}
};
+
return (
@@ -227,36 +235,33 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
)}
- {/*
-
- Is Variable
-
- v === "true" ? true : v === "false" ? false : false,
- })}
- >
- False
- True
-
- {errors.isVariable && (
- {errors.isVariable.message}
- )}
-
*/}
-
-
- Payment Type
-
+
+
+ Payment Type
+
+
+ Choose whether the payment amount varies or remains fixed each cycle.
+
+ Is Variable: Amount changes per cycle.
+
+ Fixed: Amount stays constant.
+
+ }
+ >
+
+
+
(
-
)}
/>
+
{errors.isVariable && (
{errors.isVariable.message}
)}
+
{/* Date and Amount */}
@@ -381,12 +382,25 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
{/* Frequency To and Status Id */}
-
- Frequency
-
+
+
+ Frequency
+
+
+ Defines how often payments or billing occur, such as monthly, quarterly, or annually.
+
+ }
+ >
+
+
+
+
Select Frequency
@@ -396,10 +410,12 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
))}
+
{errors.frequency && (
{errors.frequency.message}
)}
+
Status
@@ -425,48 +441,76 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
- {/* Payment Buffer Days and Number of Iteration */}
+ {/* Payment Buffer Days and End Date */}
+
-
- Payment Buffer Days
-
+
+
+ Payment Buffer Days
+
+
+ Number of extra days allowed after the due date before payment is considered late.
+
+ }
+ >
+
+
+
+
+
{errors.paymentBufferDays && (
{errors.paymentBufferDays.message}
)}
+
+
-
- Number of Iteration
-
-
+
+ End Date
+
+
+ The final date until which the plan, subscription, or project remains valid.
+
+ }
+ >
+
+
+
+
+
- {errors.numberOfIteration && (
-
- {errors.numberOfIteration.message}
-
+
+ {errors.endDate && (
+
{errors.endDate.message}
)}
+
+
@@ -525,8 +569,8 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
{createPending || isPending
? "Please wait...."
: requestToEdit
- ? "Update"
- : "Submit"}
+ ? "Update"
+ : "Submit"}
diff --git a/src/components/RecurringExpense/RecurringExpenseSchema.js b/src/components/RecurringExpense/RecurringExpenseSchema.js
index 2555a9ac..a2feb508 100644
--- a/src/components/RecurringExpense/RecurringExpenseSchema.js
+++ b/src/components/RecurringExpense/RecurringExpenseSchema.js
@@ -24,7 +24,7 @@ export const PaymentRecurringExpense = () => {
strikeDate: z
.string()
- .min(1, { message: "Date is required" })
+ .min(1, { message: "Strike Date is required" })
.refine((val) => !isNaN(Date.parse(val)), {
message: "Invalid date format",
})
@@ -42,12 +42,13 @@ export const PaymentRecurringExpense = () => {
})
.min(0, { message: "Buffer days cannot be negative" }),
- numberOfIteration: z
- .number({
- required_error: "Iteration is required",
- invalid_type_error: "Iteration must be a number",
+ endDate: z
+ .string()
+ .min(1, { message: "End Date is required" })
+ .refine((val) => !isNaN(Date.parse(val)), {
+ message: "Invalid date format",
})
- .min(1, { message: "Iteration must be at least 1" }),
+ .transform((val) => val.trim()),
expenseCategoryId: z
.string()
@@ -83,7 +84,7 @@ export const defaultRecurringExpense = {
strikeDate: "",
projectId: "",
paymentBufferDays: 0,
- numberOfIteration: 1,
+ endDate: "",
expenseCategoryId: "",
statusId: "",
frequency: 1,
diff --git a/src/components/RecurringExpense/ViewRecurringExpense.jsx b/src/components/RecurringExpense/ViewRecurringExpense.jsx
index a021d2db..1284c2ce 100644
--- a/src/components/RecurringExpense/ViewRecurringExpense.jsx
+++ b/src/components/RecurringExpense/ViewRecurringExpense.jsx
@@ -21,7 +21,7 @@ const ViewRecurringExpense = ({ RecurringId }) => {
return (