establishment user listing view details routing done
This commit is contained in:
parent
a0105e59bd
commit
e79d6ea298
@ -64,7 +64,7 @@ function App() {
|
|||||||
<Route
|
<Route
|
||||||
path="/admin/validations"
|
path="/admin/validations"
|
||||||
element={(
|
element={(
|
||||||
<RequireRole allowedRoles={['Admin']}>
|
<RequireRole allowedRoles={['Admin','EstablishmentUser']}>
|
||||||
<Validations />
|
<Validations />
|
||||||
</RequireRole>
|
</RequireRole>
|
||||||
)}
|
)}
|
||||||
@ -72,7 +72,7 @@ function App() {
|
|||||||
<Route
|
<Route
|
||||||
path="/admin/validations/:id"
|
path="/admin/validations/:id"
|
||||||
element={(
|
element={(
|
||||||
<RequireRole allowedRoles={['Admin']}>
|
<RequireRole allowedRoles={['Admin','EstablishmentUser']}>
|
||||||
<ValidationReview />
|
<ValidationReview />
|
||||||
</RequireRole>
|
</RequireRole>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
if (!Array.isArray(history)) return [];
|
if (!Array.isArray(history)) return [];
|
||||||
return history.map((entry, index) => ({
|
return history.map((entry, index) => ({
|
||||||
id: entry?.id ?? index,
|
id: entry?.id ?? index,
|
||||||
survey_name: 'Industrial Producation Survey',
|
survey_name: 'Industrial Production Survey',
|
||||||
year: entry?.year || '—',
|
year: entry?.year || '—',
|
||||||
quarter: entry?.quarter || '—',
|
quarter: entry?.quarter || '—',
|
||||||
status: entry?.status || 'Pending',
|
status: entry?.status || 'Pending',
|
||||||
@ -84,7 +84,12 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const navigateToView = (id) => navigate(`/history/${id}`);
|
// ✅ Updated navigation to match SubmissionTable pattern
|
||||||
|
const navigateToView = (id) => {
|
||||||
|
navigate(`/admin/validations/${id}`, {
|
||||||
|
state: { actionType: 'view' }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const rowsData = filteredRows.map((item) => {
|
const rowsData = filteredRows.map((item) => {
|
||||||
const productCount = Number(item.products) || 0;
|
const productCount = Number(item.products) || 0;
|
||||||
@ -95,10 +100,10 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
item.year,
|
item.year,
|
||||||
item.quarter,
|
item.quarter,
|
||||||
<span className={getStatusClass(item.status)}>{item.status}</span>,
|
<span className={getStatusClass(item.status)}>{item.status}</span>,
|
||||||
<span className="whitespace-nowrap">{item.submission_on}</span>,
|
<span className="whitespace-nowrap">{item.submission_on}</span>,
|
||||||
productLabel,
|
productLabel,
|
||||||
<button
|
<button
|
||||||
onClick={() => navigateToView(item.id)}
|
onClick={() => navigateToView(item.id)} // ✅ Now routes to /admin/validations/:id
|
||||||
className="text-[#9E792B] hover:text-[#7b5f22] font-medium"
|
className="text-[#9E792B] hover:text-[#7b5f22] font-medium"
|
||||||
>
|
>
|
||||||
View Details
|
View Details
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user