actions API fixed

This commit is contained in:
victorAnumudu
2024-12-12 21:30:41 +01:00
parent 26bb5d0d11
commit 03af1d8887
+21 -41
View File
@@ -5,11 +5,11 @@ import queryKeys from "../../services/queryKeys";
export default function RecentActions() {
const {data, isFetching, isError, error} = useQuery({
const {data:dataAction, isFetching, isError, error} = useQuery({
queryKey: queryKeys.recentAction,
queryFn: async () => await recentActions()
queryFn: () => recentActions()
})
console.log('data', error)
return (
<>
<div className="card card-statistics h-100 mb-0">
@@ -41,7 +41,7 @@ console.log('data', error)
<div className="d-xxs-flex align-items-center">
<div className="total-sales">
<p>Last Update</p>
<h1>10-10-2021 10 AM</h1>
<h1>{dataAction?.data?.action_data?.last_update}</h1>
</div>
<div className="mb-3 mb-sm-0 ml-auto">
{/*<button className="btn btn-primary btn-xs">View All Invoices</button>*/}
@@ -60,19 +60,19 @@ console.log('data', error)
<div className="row no-gutters">
<div className="col-6 col-xxs-3 ">
<p>Initial</p>
<h4>0</h4>
<h4>{dataAction?.data?.action_data?.initial}</h4>
</div>
<div className="col-6 col-xxs-3 ">
<p>Processing</p>
<h4>0</h4>
<h4>{dataAction?.data?.action_data?.processing}</h4>
</div>
<div className="col-6 col-xxs-3 ">
<p>Verifying</p>
<h4>0</h4>
<h4>{dataAction?.data?.action_data?.verifying}</h4>
</div>
<div className="col-6 col-xxs-3 ">
<p>Completed</p>
<h4>0</h4>
<h4>{dataAction?.data?.action_data?.completed}</h4>
</div>
</div>
<div className="table-responsive m-t-20">
@@ -86,39 +86,19 @@ console.log('data', error)
</tr>
</thead>
<tbody className="text-muted">
<tr>
<td>1</td>
<td>Smith Drake</td>
<td>27/3/2014</td>
<td>
<label className="badge mb-0 badge-primary-inverse"> Overdue</label>
</td>
</tr>
<tr>
<td>2</td>
<td>Martha Doe</td>
<td>28/3/2015</td>
<td>
<label className="badge mb-0 badge-warning-inverse"> Outstanding</label>
</td>
</tr>
<tr>
<td>3</td>
<td>Fenish Paul</td>
<td>24/3/2015</td>
<td>
<label className="badge mb-0 badge-info-inverse"> Open</label>
</td>
</tr>
<tr>
<td>4</td>
<td>Albom Mitch</td>
<td>29/3/2016</td>
<td>
<label className="badge mb-0 badge-success-inverse"> Paid</label>
</td>
</tr>
{dataAction?.data?.action_data?.actions.map((action, index) => {
let bgColor = action?.status == 'completed' ? 'badge-success-inverse' : action?.status == 'verifying' ? 'badge-info-inverse' : action?.status == 'processing' ? 'badge-warning-inverse' : 'badge-primary-inverse'
return (
<tr key={index}>
<td>{action?.no}</td>
<td>{action?.description}</td>
<td>{action?.date}</td>
<td>
<label className={`badge mb-0 ${bgColor}`}>{action?.status}</label>
</td>
</tr>
)
})}
</tbody>
</table>
</div>