made new hook for make action on give employee
This commit is contained in:
parent
dbdb7a1299
commit
2ab2a1d8bd
@ -168,7 +168,7 @@ const ExpenseList = () => {
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="d-none d-md-table-cell"><i className='bx bx-rupee b-xs'></i>{expense.amount}</td>
|
||||
<td className="d-none d-md-table-cell text-end"><i className='bx bx-rupee b-xs'></i>{expense.amount}</td>
|
||||
<td>
|
||||
<span
|
||||
style={{
|
||||
|
@ -67,3 +67,8 @@ export const ExpenseSchema = (expenseTypes) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const ActionSchema = z.object({
|
||||
comment : z.string().min(1,{message:"Please leave comment"}),
|
||||
selectedStatus: z.string().min(1, { message: "Please select a status" }),
|
||||
})
|
@ -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",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user