update table views
This commit is contained in:
parent
5f386e079f
commit
ef00467309
|
|
@ -106,22 +106,30 @@ const ManageClasses = () => {
|
|||
</td>
|
||||
</tr>
|
||||
):(
|
||||
classes.map((data, index) => (
|
||||
<tr key={data.ID_CLASS}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{data.NAME_CLASS}</td>
|
||||
<td>{data.TOTAL_STUDENT}</td>
|
||||
<td className='text-center action-col'>
|
||||
<NavLink className='btn btn-sm btn-view' to={`class-detail/${data.ID_CLASS}`}><i className="bi bi-eye"></i></NavLink>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(data)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteClass(data.ID_CLASS)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
classes.length > 0 ?(
|
||||
classes.map((data, index) => (
|
||||
<tr key={data.ID_CLASS}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{data.NAME_CLASS}</td>
|
||||
<td>{data.TOTAL_STUDENT}</td>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<NavLink className='btn btn-sm btn-view' to={`class-detail/${data.ID_CLASS}`}><i className="bi bi-eye"></i></NavLink>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(data)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteClass(data.ID_CLASS)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const ManageExercises = () => {
|
|||
<h2 className='page-title strip'>Exercise</h2>
|
||||
<p className='page-desc'>Description of Exercise.</p>
|
||||
<Tab.Container id="left-tabs-example" defaultActiveKey="detail">
|
||||
<Row className='mb-45'>
|
||||
{/* <Row className='mb-45'>
|
||||
<Col xs={12}>
|
||||
<Nav variant="pills" className='col-tabs'>
|
||||
<Nav.Item>
|
||||
|
|
@ -38,7 +38,7 @@ const ManageExercises = () => {
|
|||
</Nav.Item>
|
||||
</Nav>
|
||||
</Col>
|
||||
</Row>
|
||||
</Row> */}
|
||||
<Row className='mb-45'>
|
||||
<Col xs={12} className='col-tabs-content'>
|
||||
<Tab.Content>
|
||||
|
|
@ -62,7 +62,7 @@ const ManageExercises = () => {
|
|||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Level</th>
|
||||
<th>Section</th>
|
||||
<th>Topic</th>
|
||||
<th className='text-center'>Level</th>
|
||||
<th className='text-center'>Action</th>
|
||||
|
|
@ -81,19 +81,27 @@ const ManageExercises = () => {
|
|||
</td>
|
||||
</tr>
|
||||
):(
|
||||
levels.map((level, index) => (
|
||||
<tr key={level.ID_LEVEL}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{level.NAME_SECTION}</td>
|
||||
<td>{level.NAME_TOPIC}</td>
|
||||
<td>{level.NAME_LEVEL}</td>
|
||||
<td className='text-center action-col'>
|
||||
<Link className='btn btn-sm btn-edit' to={`update-exercise/${level.ID_LEVEL}`}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Link>
|
||||
levels.length > 0 ?(
|
||||
levels.map((level, index) => (
|
||||
<tr key={level.ID_LEVEL}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{level.NAME_SECTION}</td>
|
||||
<td>{level.NAME_TOPIC}</td>
|
||||
<td className='text-center'>{level.NAME_LEVEL}</td>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Link className='btn btn-sm btn-edit' to={`update-exercise/${level.ID_LEVEL}`}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ const ManageMaterials = () => {
|
|||
<Nav.Item>
|
||||
<Nav.Link eventKey="detail">View Entries</Nav.Link>
|
||||
</Nav.Item>
|
||||
<Nav.Item>
|
||||
{/* <Nav.Item>
|
||||
<OverlayTrigger overlay={<Tooltip id="tooltip-disabled">Select the level below </Tooltip>}>
|
||||
<span className="d-inline-block">
|
||||
<Nav.Link disabled onClick={(e)=>{e.preventDefault();}}>Create Data</Nav.Link>
|
||||
</span>
|
||||
</OverlayTrigger>
|
||||
</Nav.Item>
|
||||
</Nav.Item> */}
|
||||
</Nav>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
@ -63,7 +63,7 @@ const ManageMaterials = () => {
|
|||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Level</th>
|
||||
<th>Section</th>
|
||||
<th>Topic</th>
|
||||
<th className='text-center'>Level</th>
|
||||
<th className='text-center'>Action</th>
|
||||
|
|
@ -82,25 +82,27 @@ const ManageMaterials = () => {
|
|||
</td>
|
||||
</tr>
|
||||
):(
|
||||
levels.map((level, index) => (
|
||||
<tr key={level.ID_LEVEL}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{level.NAME_SECTION}</td>
|
||||
<td>{level.NAME_TOPIC}</td>
|
||||
<td>{level.NAME_LEVEL}</td>
|
||||
<td className='text-center action-col'>
|
||||
{/* <Button size='sm' className='btn-edit' onClick={() => handleShow(level)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button> */}
|
||||
<Link className='btn btn-sm btn-edit' to={`update-material/${level.ID_LEVEL}`}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Link>
|
||||
{/* <Button size='sm' className='btn-edit' onClick={() => handleShow(level)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button> */}
|
||||
levels.length > 0 ?(
|
||||
levels.map((level, index) => (
|
||||
<tr key={level.ID_LEVEL}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{level.NAME_SECTION}</td>
|
||||
<td>{level.NAME_TOPIC}</td>
|
||||
<td className='text-center'>{level.NAME_LEVEL}</td>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Link className='btn btn-sm btn-edit' to={`update-material/${level.ID_LEVEL}`}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
|
|
|
|||
|
|
@ -68,15 +68,20 @@ const useSections = () => {
|
|||
try {
|
||||
const createdSection = await sectionService.createData(createData);
|
||||
setSections((prevSections) => [...prevSections, createdSection.payload]);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
}finally{
|
||||
resetForm();
|
||||
setLoaderState(prev => ({
|
||||
...prev,
|
||||
loading: false,
|
||||
successMessage: 'Your new entry has been successfully created and saved.'
|
||||
}));
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
setLoaderState(prev => ({
|
||||
...prev,
|
||||
title: "ERROR",
|
||||
loading: false,
|
||||
successMessage: err.message
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -95,21 +95,29 @@ const ManageSections = () => {
|
|||
</td>
|
||||
</tr>
|
||||
):(
|
||||
sections.map((section, index) => (
|
||||
<tr key={section.ID_SECTION}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{section.NAME_SECTION}</td>
|
||||
<td>{section.DESCRIPTION_SECTION}</td>
|
||||
<td className='text-center action-col'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(section)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteSection(section.ID_SECTION)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
sections.length > 0 ?(
|
||||
sections.map((section, index) => (
|
||||
<tr key={section.ID_SECTION}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{section.NAME_SECTION}</td>
|
||||
<td>{section.DESCRIPTION_SECTION}</td>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(section)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteSection(section.ID_SECTION)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ const ManageStudents = () => {
|
|||
<td>{student.NISN}</td>
|
||||
<td>{student.NAME_USERS}</td>
|
||||
<td>{student.EMAIL}</td>
|
||||
<td className='text-center action-col'>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(student)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ const ManageTeachers = () => {
|
|||
<td>{teacher.NIP}</td>
|
||||
<td>{teacher.NAME_USERS}</td>
|
||||
<td>{teacher.EMAIL}</td>
|
||||
<td className='text-center action-col'>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(teacher)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -74,16 +74,21 @@ const useTopics = () => {
|
|||
DESCRIPTION_TOPIC: data.description,
|
||||
};
|
||||
const createdTopic = await topicService.createData(newTopic);
|
||||
setTopics((prevTopics) => [...prevTopics, createdTopic.payload]);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
}finally{
|
||||
setTopics((prevTopics) => [...prevTopics, createdTopic.payload.topic]);
|
||||
resetForm();
|
||||
setLoaderState(prev => ({
|
||||
...prev,
|
||||
loading: false,
|
||||
successMessage: 'Your new entry has been successfully created and saved.'
|
||||
}));
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
setLoaderState(prev => ({
|
||||
...prev,
|
||||
title: "ERROR",
|
||||
loading: false,
|
||||
successMessage: err.message
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ const fetchDataSection = async () => {
|
|||
|
||||
const getTopicById = async (id) => {
|
||||
try {
|
||||
const response = await axiosInstance.get(`/${id}`);
|
||||
const response = await axiosInstance.get(`/topic/${id}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching topic with ID ${id}:`, error);
|
||||
console.error(`Error get topic with ID ${id}:`, error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,21 +99,29 @@ const ManageTopics = () => {
|
|||
</td>
|
||||
</tr>
|
||||
):(
|
||||
topics.map((topic, index) => (
|
||||
<tr key={topic.ID_TOPIC}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{sectionSlug[topic.ID_SECTION]}</td>
|
||||
<td>{topic.NAME_TOPIC}</td>
|
||||
<td className='text-center action-col'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(topic)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteTopic(topic.ID_TOPIC)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
topics.length > 0 ?(
|
||||
topics.map((topic, index) => (
|
||||
<tr key={index}>
|
||||
<td>{index + 1}</td>
|
||||
<td>{sectionSlug[topic.ID_SECTION]}</td>
|
||||
<td>{topic.NAME_TOPIC}</td>
|
||||
<td className='text-center action-col d-flex justify-content-center'>
|
||||
<Button size='sm' className='btn-edit' onClick={() => handleShow(topic)}>
|
||||
<i className="bi bi-pencil-square"></i>
|
||||
</Button>
|
||||
<Button size='sm' className='btn-delete' onClick={() => deleteTopic(topic.ID_TOPIC)}>
|
||||
<i className="bi bi-trash3"></i>
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
):(
|
||||
<tr>
|
||||
<td colSpan={5} style={{height:'20vh'}}>
|
||||
<h3>Empty Data</h3>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const useSettings = () => {
|
|||
const fetchData = async () => {
|
||||
try {
|
||||
const data = await settingService.fetchProfile();
|
||||
console.log(data);
|
||||
setProfile(data.payload);
|
||||
setIdUser(data.payload.ID)
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user