update dashboard show data
This commit is contained in:
parent
d7c8c62ff4
commit
d3e782d9cd
|
|
@ -32,7 +32,7 @@ const useDashboard = () => {
|
|||
setLoadingActivity(true);
|
||||
try {
|
||||
const data = await dashboardService.fetchActivity("", "", 1, 5);
|
||||
setActivity(data.payload.monitorings);
|
||||
setActivity(data.payload.studentActivities);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const fetchTotalTeacher = async (search, sort, page, limit) => {
|
|||
|
||||
const fetchActivity = async (search, sort, page, limit) => {
|
||||
try {
|
||||
const response = await axiosInstance.get(`/monitoring/progress?search=${search}&sort=${sort}&page=${page}&limit=${limit}`);
|
||||
const response = await axiosInstance.get(`/stdLearning/activities?search=${search}&sort=${sort}&page=${page}&limit=${limit}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching reports:', error);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Table, Row, Col, Card, Button, Spinner } from 'react-bootstrap';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { NavLink, Link } from 'react-router-dom';
|
||||
import useDashboard from '../hooks/useDashboard';
|
||||
|
||||
function validName(text) {
|
||||
|
|
@ -46,17 +46,18 @@ const AdminDashboard = () => {
|
|||
<Table hover>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>NISN</th>
|
||||
<th>Name</th>
|
||||
<th>Section</th>
|
||||
<th>Full Name</th>
|
||||
<th className='text-center'>Class</th>
|
||||
<th>Topic</th>
|
||||
<th>Level</th>
|
||||
<th className='text-center'>Score</th>
|
||||
<th className='text-center'>Review</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loadingActivity?(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:"20vh"}}>
|
||||
<td colSpan={6} style={{height:"20vh"}}>
|
||||
<Spinner animation="grow" variant="primary" />
|
||||
<Spinner animation="grow" variant="secondary" />
|
||||
<Spinner animation="grow" variant="success" />
|
||||
|
|
@ -69,16 +70,19 @@ const AdminDashboard = () => {
|
|||
activity.length > 0?(
|
||||
activity.map((data, index) => (
|
||||
<tr key={index}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{data.NISN}</td>
|
||||
<td>{data.NAME_USERS}</td>
|
||||
<td>{data.NAME_SECTION}</td>
|
||||
<td className='text-center'>{data.NAME_CLASS ? data.NAME_CLASS : '-'}</td>
|
||||
<td>{data.NAME_TOPIC}</td>
|
||||
<td>{data.NAME_LEVEL}</td>
|
||||
<td className='text-center'>{data.SCORE}</td>
|
||||
<td className='text-center action-col'>
|
||||
<Link className='btn btn-sm btn-view' to={`s/${data.ID_STUDENT_LEARNING}`}><i className="bi bi-eye"></i></Link>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<td colSpan={6} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const useDashboard = () => {
|
|||
setLoadingActivity(true);
|
||||
try {
|
||||
const data = await dashboardService.fetchActivity("", "", 1, 5);
|
||||
setActivity(data.payload.monitorings);
|
||||
setActivity(data.payload.studentActivities);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const fetchTotalClass = async (search, sort, page, limit) => {
|
|||
|
||||
const fetchActivity = async (search, sort, page, limit) => {
|
||||
try {
|
||||
const response = await axiosInstance.get(`/monitoring/progress?search=${search}&sort=${sort}&page=${page}&limit=${limit}`);
|
||||
const response = await axiosInstance.get(`/stdLearning/activities?search=${search}&sort=${sort}&page=${page}&limit=${limit}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching reports:', error);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Table, Row, Col, Card, Button, Spinner } from 'react-bootstrap';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { NavLink, Link } from 'react-router-dom';
|
||||
import avatar from '../../../../assets/images/avatar.png';
|
||||
|
||||
import useDashboard from '../hooks/useDashboard';
|
||||
|
|
@ -121,17 +121,20 @@ const TeacherDashboard = () => {
|
|||
<Table hover>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>NISN</th>
|
||||
<th>Name</th>
|
||||
<th className='text-start'>NISN</th>
|
||||
<th>Full Name</th>
|
||||
<th className='text-center'>Class</th>
|
||||
<th>Section</th>
|
||||
<th>Topic</th>
|
||||
<th>Level</th>
|
||||
<th className='text-center'>Score</th>
|
||||
<th className='text-center'>Review</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loadingActivity?(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:"20vh"}}>
|
||||
<td colSpan={8} style={{height:"20vh"}}>
|
||||
<Spinner animation="grow" variant="primary" />
|
||||
<Spinner animation="grow" variant="secondary" />
|
||||
<Spinner animation="grow" variant="success" />
|
||||
|
|
@ -144,16 +147,21 @@ const TeacherDashboard = () => {
|
|||
activity.length > 0?(
|
||||
activity.map((data, index) => (
|
||||
<tr key={index}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{data.NISN}</td>
|
||||
<td className='text-start'>{data.NISN}</td>
|
||||
<td>{data.NAME_USERS}</td>
|
||||
<td className='text-center'>{data.NAME_CLASS ? data.NAME_CLASS : '-'}</td>
|
||||
<td>{data.NAME_SECTION}</td>
|
||||
<td>{data.NAME_TOPIC}</td>
|
||||
<td>{data.NAME_LEVEL}</td>
|
||||
<td className='text-center'>{data.SCORE}</td>
|
||||
<td className='text-center action-col'>
|
||||
<Link className='btn btn-sm btn-view' to={`s/${data.ID_STUDENT_LEARNING}`}><i className="bi bi-eye"></i></Link>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<td colSpan={8} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user