Merge branch 'master' of https://bitbucket.org/jubilian/fcsc_ipi_frontend
This commit is contained in:
commit
fca7cbbcac
@ -79,11 +79,14 @@ const ValidationReview = () => {
|
||||
setActionLoading(true);
|
||||
try {
|
||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||
status: 'Approved',
|
||||
approve_reject_status: 1,
|
||||
remarks: ''
|
||||
});
|
||||
|
||||
if (response?.data || response?.status === 'success') {
|
||||
const ok =
|
||||
(response && response.data) || response?.status === 200 || response?.status === 'success';
|
||||
|
||||
if (ok) {
|
||||
const establishmentName = submissionData?.establishment?.factory_name || 'Establishment';
|
||||
navigate('/admin/validations', {
|
||||
state: {
|
||||
@ -96,7 +99,7 @@ const ValidationReview = () => {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Approval failed:', err);
|
||||
alert(err.response?.data?.message || err.message || 'Failed to approve submission. Please try again.');
|
||||
alert(err?.response?.data?.message || err?.message || 'Failed to approve submission. Please try again.');
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
}
|
||||
@ -113,11 +116,14 @@ const ValidationReview = () => {
|
||||
setActionLoading(true);
|
||||
try {
|
||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||
status: 'Rejected',
|
||||
approve_reject_status: 0,
|
||||
remarks: rejectReason.trim()
|
||||
});
|
||||
|
||||
if (response?.data || response?.status === 'success') {
|
||||
const ok =
|
||||
(response && response.data) || response?.status === 200 || response?.status === 'success';
|
||||
|
||||
if (ok) {
|
||||
const establishmentName = submissionData?.establishment?.factory_name || 'Establishment';
|
||||
navigate('/admin/validations', {
|
||||
state: {
|
||||
@ -130,7 +136,7 @@ const ValidationReview = () => {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Rejection failed:', err);
|
||||
alert(err.response?.data?.message || err.message || 'Failed to reject submission. Please try again.');
|
||||
alert(err?.response?.data?.message || err?.message || 'Failed to reject submission. Please try again.');
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
setIsRejectOpen(false);
|
||||
|
||||
@ -193,7 +193,7 @@ const ManageSubmissions = () => {
|
||||
item,
|
||||
]);
|
||||
|
||||
const columnWidths = [302, 105, 83, 91, 100, 152, 208, 120, 120, 208, 130];
|
||||
const columnWidths = [220, 150, 83, 91, 100, 152, 208, 120, 120, 208, 130];
|
||||
|
||||
const toolbar = (
|
||||
<div className="px-6 pt-6 pb-5 space-y-4">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user