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);
|
setActionLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||||
status: 'Approved',
|
approve_reject_status: 1,
|
||||||
remarks: ''
|
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';
|
const establishmentName = submissionData?.establishment?.factory_name || 'Establishment';
|
||||||
navigate('/admin/validations', {
|
navigate('/admin/validations', {
|
||||||
state: {
|
state: {
|
||||||
@ -96,7 +99,7 @@ const ValidationReview = () => {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Approval failed:', 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 {
|
} finally {
|
||||||
setActionLoading(false);
|
setActionLoading(false);
|
||||||
}
|
}
|
||||||
@ -113,11 +116,14 @@ const ValidationReview = () => {
|
|||||||
setActionLoading(true);
|
setActionLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
const response = await apiClient.put(`/approveOrRejectSubmission/${id}`, {
|
||||||
status: 'Rejected',
|
approve_reject_status: 0,
|
||||||
remarks: rejectReason.trim()
|
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';
|
const establishmentName = submissionData?.establishment?.factory_name || 'Establishment';
|
||||||
navigate('/admin/validations', {
|
navigate('/admin/validations', {
|
||||||
state: {
|
state: {
|
||||||
@ -130,7 +136,7 @@ const ValidationReview = () => {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Rejection failed:', 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 {
|
} finally {
|
||||||
setActionLoading(false);
|
setActionLoading(false);
|
||||||
setIsRejectOpen(false);
|
setIsRejectOpen(false);
|
||||||
|
|||||||
@ -193,7 +193,7 @@ const ManageSubmissions = () => {
|
|||||||
item,
|
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 = (
|
const toolbar = (
|
||||||
<div className="px-6 pt-6 pb-5 space-y-4">
|
<div className="px-6 pt-6 pb-5 space-y-4">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user