establishment user view details navigation done
This commit is contained in:
parent
cf07aaea22
commit
737dc47d60
@ -213,7 +213,7 @@ function App() {
|
|||||||
<Route
|
<Route
|
||||||
path="/admin/validations"
|
path="/admin/validations"
|
||||||
element={
|
element={
|
||||||
<RequireRole allowedRoles={['Admin', 'EstablishmentUser']}>
|
<RequireRole allowedRoles={['Admin']}>
|
||||||
<Validations />
|
<Validations />
|
||||||
</RequireRole>
|
</RequireRole>
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ function App() {
|
|||||||
<Route
|
<Route
|
||||||
path="/admin/validations/:id"
|
path="/admin/validations/:id"
|
||||||
element={
|
element={
|
||||||
<RequireRole allowedRoles={['Admin', 'EstablishmentUser']}>
|
<RequireRole allowedRoles={['Admin']}>
|
||||||
<ValidationReview />
|
<ValidationReview />
|
||||||
</RequireRole>
|
</RequireRole>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import React from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import Table from '@/components/common/Table';
|
import Table from '@/components/common/Table';
|
||||||
import Footer from '../common/Footer';
|
import Footer from '../common/Footer';
|
||||||
|
import HeaderBar from '@/components/layout/HeaderBar';
|
||||||
|
import DetailedOverview from '@/components/overview/DetailedOverview';
|
||||||
|
|
||||||
const searchIconSrc = '/assets/images/material-symbols_search-rounded.svg';
|
const searchIconSrc = '/assets/images/material-symbols_search-rounded.svg';
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ const downloadCsv = (rows) => {
|
|||||||
|
|
||||||
export const SubmissionHistory = ({ history = [], loading = false, error = '' }) => {
|
export const SubmissionHistory = ({ history = [], loading = false, error = '' }) => {
|
||||||
const [searchTerm, setSearchTerm] = React.useState('');
|
const [searchTerm, setSearchTerm] = React.useState('');
|
||||||
|
const [selectedSubmission, setSelectedSubmission] = React.useState(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const normalizedHistory = React.useMemo(() => {
|
const normalizedHistory = React.useMemo(() => {
|
||||||
@ -84,11 +87,8 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ✅ Updated navigation to match SubmissionTable pattern
|
const handleViewDetails = (rowData) => {
|
||||||
const navigateToView = (id) => {
|
setSelectedSubmission(rowData);
|
||||||
navigate(`/admin/validations/${id}`, {
|
|
||||||
state: { actionType: 'view' }
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowsData = filteredRows.map((item) => {
|
const rowsData = filteredRows.map((item) => {
|
||||||
@ -103,7 +103,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
<span className="whitespace-nowrap">{item.submission_on}</span>,
|
<span className="whitespace-nowrap">{item.submission_on}</span>,
|
||||||
productLabel,
|
productLabel,
|
||||||
<button
|
<button
|
||||||
onClick={() => navigateToView(item.id)} // ✅ Now routes to /admin/validations/:id
|
onClick={() => handleViewDetails(item)}
|
||||||
className="text-[#9E792B] hover:text-[#7b5f22] font-medium"
|
className="text-[#9E792B] hover:text-[#7b5f22] font-medium"
|
||||||
>
|
>
|
||||||
View Details
|
View Details
|
||||||
@ -169,6 +169,20 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (selectedSubmission) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-[#F8FAFC]">
|
||||||
|
<HeaderBar />
|
||||||
|
<main className="max-w-[1280px] mx-auto px-4 py-6">
|
||||||
|
<DetailedOverview
|
||||||
|
submission={selectedSubmission}
|
||||||
|
onBack={() => setSelectedSubmission(null)}
|
||||||
|
/>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="max-w-[1280px] mx-auto px-0">
|
<section className="max-w-[1280px] mx-auto px-0">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user