From 8f1524a4c9afeb069360251e867db23a444afb5c Mon Sep 17 00:00:00 2001 From: Malini Date: Fri, 14 Nov 2025 11:42:34 +0530 Subject: [PATCH] establishement bug fixed --- .../dashboard/SubmissionHistory.jsx | 38 +++++++++++- .../components/dashboard/SurveyCarousel.jsx | 59 ++++++++++--------- .../src/components/dashboard/SurveyStatus.jsx | 8 +-- .../components/dashboard/WelcomeSection.jsx | 4 +- .../pages/Admin/configuration/IsicHsCodes.jsx | 2 +- 5 files changed, 71 insertions(+), 40 deletions(-) diff --git a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx index 2147533..f290daf 100644 --- a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx +++ b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx @@ -78,13 +78,45 @@ const downloadCsv = (data) => { if (['rejected', 'rejected'].includes(normalized)) return 'Returned'; return item.status || '—'; })(); + + // Format date to Dubai time (GST, UTC+4) in 24-hour format + const formatDate = (dateString) => { + if (!dateString) return '—'; + try { + const date = new Date(dateString); + // Convert to Dubai time (UTC+4) + const options = { + timeZone: 'Asia/Dubai', + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + hour12: false, // 24-hour format + }; + const formatter = new Intl.DateTimeFormat('en-GB', options); + const parts = formatter.formatToParts(date); + + // Extract date and time parts + const day = parts.find(part => part.type === 'day').value; + const month = parts.find(part => part.type === 'month').value; + const year = parts.find(part => part.type === 'year').value; + const hour = parts.find(part => part.type === 'hour').value.padStart(2, '0'); + const minute = parts.find(part => part.type === 'minute').value.padStart(2, '0'); + + return `${day}/${month}/${year} ${hour}:${minute}`; // Format: DD/MM/YYYY HH:mm + } catch (e) { + console.error('Error formatting date:', e); + return dateString || '—'; + } + }; const row = [ item.survey_name || '—', item.year || '—', item.quarter || '—', statusText, - item.submission_on || '—', + formatDate(item.submission_on), `${item.products || 0}`, ]; @@ -172,7 +204,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) return ( <> -
+

@@ -185,7 +217,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) type="text" value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} - placeholder="Search Establishment" + placeholder="Search Survey Name, Quarter, Year" className="w-full h-10 rounded-md border border-[#E5E7EB] pl-10 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-[#92722A]" /> (prev === surveys.length - 1 ? 0 : prev + 1)); return ( -
-
-
-

+
+
+
+
+

{current?.title || '—'}

-

+

{current?.subtitle || ''}

-
- - - Due Date:  - {current?.dueDate || '—'} - +
+ + + Due: + {current?.dueDate || '—'} + - - - Est. time:  - {current?.estTime || '—'} - + + + Est. time: + {current?.estTime || '—'} + - - Status:  - {current?.status || '—'} - -
+ + Status: + {current?.status || '—'} + +
-
+
- + onClick={() => setIsPaused(!isPaused)} + className="w-6 h-6 flex items-center justify-center rounded-full border border-black bg-transparent hover:bg-gray-100 transition" + > + +
+
); }; diff --git a/ipi-survey-platform/src/components/dashboard/SurveyStatus.jsx b/ipi-survey-platform/src/components/dashboard/SurveyStatus.jsx index 6ae8e3e..c1622ff 100644 --- a/ipi-survey-platform/src/components/dashboard/SurveyStatus.jsx +++ b/ipi-survey-platform/src/components/dashboard/SurveyStatus.jsx @@ -144,14 +144,13 @@ export const SurveyStatus = () => { : 'Complete your quarterly industrial production data submission'; return ( -
-
+
{loading ? ( -
+
Loading survey status...
) : error ? ( -
{error}
+
{error}
) : ( { onStartSurvey={handleStartSurvey} /> )} -
); }; diff --git a/ipi-survey-platform/src/components/dashboard/WelcomeSection.jsx b/ipi-survey-platform/src/components/dashboard/WelcomeSection.jsx index 21b4200..527e706 100644 --- a/ipi-survey-platform/src/components/dashboard/WelcomeSection.jsx +++ b/ipi-survey-platform/src/components/dashboard/WelcomeSection.jsx @@ -28,9 +28,9 @@ export const WelcomeSection = ({ data = null, loading = false, error = '' }) => // } return ( -
+
-
+

Welcome{' '} diff --git a/ipi-survey-platform/src/pages/Admin/configuration/IsicHsCodes.jsx b/ipi-survey-platform/src/pages/Admin/configuration/IsicHsCodes.jsx index 380b334..151b5be 100644 --- a/ipi-survey-platform/src/pages/Admin/configuration/IsicHsCodes.jsx +++ b/ipi-survey-platform/src/pages/Admin/configuration/IsicHsCodes.jsx @@ -452,7 +452,7 @@ const IsicHsCodes = () => { code: product.hs_code || 'N/A', product: product.product_name || 'N/A', unit: product.unit?.uom || 'N/A', - estimatedMapped: 0, + estimatedMapped: product.mapped_establishment_count || 0, createdBy: createdByName, createdOn: createdDate || null, updated: updatedDate,