diff --git a/ipi-survey-platform/src/components/overview/ProductDetails.jsx b/ipi-survey-platform/src/components/overview/ProductDetails.jsx
index 198cbec..1971d2d 100644
--- a/ipi-survey-platform/src/components/overview/ProductDetails.jsx
+++ b/ipi-survey-platform/src/components/overview/ProductDetails.jsx
@@ -170,15 +170,29 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh
{toast.message}
{toast.type === 'rejected' && (
+ onClick={() => {
+ navigate('/survey', {
+ state: {
+ submission: {
+ id: product.submission_id,
+ quarter: product.quarter,
+ year: product.year,
+ establishment_name: product.establishment_name,
+ permanent_factory_code: product.permanent_factory_code,
+ industry_code: product.industry_code,
+ license_number: product.license_number,
+ isic_code: product.isic_code,
+ emirate: product.emirate
+ },
+ isResubmit: true
+ }
+ });
+ }}
+ className="ml-auto px-3 py-1 bg-[#FEF2F2] text-[#7C2320] text-sm font-medium rounded hover:bg-[#FEF2F2] transition-colors"
+>
+ Resubmit
+
+
)}
diff --git a/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx b/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
index 5717eb2..e7f8079 100644
--- a/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
+++ b/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
@@ -735,6 +735,7 @@ const ReviewSubmit = ({
-
+
+
);
diff --git a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
index 1e486c3..c4ee233 100644
--- a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
+++ b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
@@ -559,9 +559,17 @@ const CompanyProfile = () => {
{
+ // Only allow numeric input
+ if (e.target.value === '' || /^[0-9\b]+$/.test(e.target.value)) {
+ handleFormChange('contactPostalCode')(e);
+ }
+ }}
placeholder="Enter postal code"
width="100%"
+ type="tel"
+ inputMode="numeric"
+ pattern="[0-9]*"
/>
{
{
+ // Only allow numeric input
+ if (e.target.value === '' || /^[0-9\b]+$/.test(e.target.value)) {
+ handleFormChange('corporatePostalCode')(e);
+ }
+ }}
placeholder="Enter postal code"
width="100%"
+ type="tel"
+ inputMode="numeric"
+ pattern="[0-9]*"
/>
{
: hscodeFilter.trim();
return entry.product_name?.toLowerCase().includes(productName.toLowerCase());
})();
+ const matchesStatus = statusFilter === 'all' ||
+ entry.status?.toLowerCase() === statusFilter.toLowerCase();
- return matchesSearch && matchesYear && matchesQuarter && matchesHscode;
+ return matchesSearch && matchesYear && matchesQuarter && matchesHscode && matchesStatus;
});
setPagination((prev) => ({
@@ -322,7 +324,7 @@ const filteredRows = useMemo(() => {
}));
return filtered;
-}, [auditHistory, searchTerm, yearFilter, quarterFilter, hscodeFilter]);
+}, [auditHistory, searchTerm, yearFilter, quarterFilter, hscodeFilter,statusFilter]);
diff --git a/ipi-survey-platform/src/services/configuration/adminService.js b/ipi-survey-platform/src/services/configuration/adminService.js
index 44e9974..28ab2eb 100644
--- a/ipi-survey-platform/src/services/configuration/adminService.js
+++ b/ipi-survey-platform/src/services/configuration/adminService.js
@@ -42,12 +42,40 @@ export const getAdminUserById = async (id) => {
}
};
+// export const deleteAdminUser = async (id) => {
+// try {
+// const response = await deleteRequest(`${admin}/${id}`);
+// return response.data;
+// } catch (error) {
+// console.error('Error deleting admin user:', error);
+// throw error;
+// }
+// };
+
export const deleteAdminUser = async (id) => {
try {
+ if (!id) throw new Error("Invalid user ID");
+
const response = await deleteRequest(`${admin}/${id}`);
- return response.data;
+
+ // Log for debugging
+
+ // Safely check success from API
+ const resData = response?.data || response;
+
+ const success =
+ resData?.status === "success" ||
+ resData?.success === true ||
+ resData?.code === 200 ||
+ resData?.message?.toLowerCase()?.includes("deleted");
+
+ if (!success) {
+ throw new Error("Delete API did not return success");
+ }
+
+ return resData;
} catch (error) {
- console.error('Error deleting admin user:', error);
+ console.error("Error deleting admin user:", error);
throw error;
}
};
\ No newline at end of file
diff --git a/ipi-survey-platform/src/services/submissions/submissionService.js b/ipi-survey-platform/src/services/submissions/submissionService.js
index 9d2b8f5..1957287 100644
--- a/ipi-survey-platform/src/services/submissions/submissionService.js
+++ b/ipi-survey-platform/src/services/submissions/submissionService.js
@@ -1,5 +1,6 @@
import { getRequest, postRequest } from '@/services/api/CommonService';
import resolveEstablishmentId from '@/services/utils/establishment';
+import { putRequest } from '../api/CommonService';
const endpoint = '/submissions';
const QUARTER_PERIODS_ENDPOINT = '/getQuarterPeriods';
@@ -32,6 +33,23 @@ export const submitSurvey = async (payload = {}, config = {}) => {
return response.data;
};
+export const resubmitSurvey = async (submissionId, payload = {}, config = {}) => {
+ if (!submissionId) {
+ throw new Error('Submission ID is required for resubmission');
+ }
+
+ const establishmentId = resolveEstablishmentId(payload.establishment_id);
+ const requestBody = {
+ ...payload,
+ ...(establishmentId !== undefined ? { establishment_id: establishmentId } : {}),
+ };
+
+ const url = `${endpoint}/${submissionId}`;
+ // Use putRequest instead of postRequest with method override
+ const response = await putRequest(url, requestBody, config);
+ return response.data;
+};
+
export const fetchSubmissionHistory = async (establishmentId, config = {}) => {
const resolvedId = resolveEstablishmentId(establishmentId);
if (resolvedId === undefined) {
@@ -126,6 +144,7 @@ export const getSubmissionAuditHistory = async (establishmentId, params = {}) =>
export default {
getSubmissions,
submitSurvey,
+ resubmitSurvey,
fetchSubmissionHistory,
fetchSubmissionDetail,
getQuarterPeriods,