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