diff --git a/src/components/Expenses/ExpenseList.jsx b/src/components/Expenses/ExpenseList.jsx
index 32463732..4476dbad 100644
--- a/src/components/Expenses/ExpenseList.jsx
+++ b/src/components/Expenses/ExpenseList.jsx
@@ -168,7 +168,7 @@ const ExpenseList = () => {
-
{expense.amount} |
+ {expense.amount} |
{
}
});
};
+
+export const ActionSchema = z.object({
+ comment : z.string().min(1,{message:"Please leave comment"}),
+ selectedStatus: z.string().min(1, { message: "Please select a status" }),
+})
\ No newline at end of file
diff --git a/src/hooks/useExpense.js b/src/hooks/useExpense.js
index edaa1a95..bc0396c3 100644
--- a/src/hooks/useExpense.js
+++ b/src/hooks/useExpense.js
@@ -24,8 +24,6 @@ export const useExpense =(ExpenseId)=>{
}
-
-
// ---------------------------Mutation---------------------------------------------
export const useCreateExpnse =(onSuccessCallBack)=>{
@@ -40,29 +38,24 @@ export const useCreateExpnse =(onSuccessCallBack)=>{
if (onSuccessCallBack) onSuccessCallBack();
},
onError:(error)=>{
- showToast(error.message || "Something went wrong please try again !","success")
+ showToast(error.message || "Something went wrong please try again !","error")
+ }
+ })
+}
+
+export const useActionOnExpense=(onSuccessCallBack)=>{
+ const queryClient = useQueryClient()
+ return useMutation({
+ mutationFn: async(payload)=>{
+ await ExpenseRepository.ActionOnExpense(payload)
+ },
+ onSuccess:(data,variables)=>{
+ console.log(data)
+ showToast("Expense Created Successfully","success")
+ if (onSuccessCallBack) onSuccessCallBack();
+ },
+ onError:(error)=>{
+ showToast(error.message || "Something went wrong please try again !","error")
}
})
}
-const demoExpense = {
- projectId: "proj_123",
- expensesTypeId: "1", // corresponds to Travel
- paymentModeId: "pm_456",
- paidById: "emp_789",
- transactionDate: "2025-07-21",
- transactionId: "TXN-001234",
- description: "Taxi fare from airport to hotel",
- location: "New York",
- supplerName: "City Taxi Service",
- amount: 45.50,
- noOfPersons: 2,
- billAttachments: [
- {
- fileName: "receipt.pdf",
- base64Data: "JVBERi0xLjQKJcfs...", // truncated base64 example string
- contentType: "application/pdf",
- fileSize: 450000, // less than 5MB
- description: "Taxi receipt",
- },
- ],
-};
|