establishement bug fixed
This commit is contained in:
parent
7c16dec47a
commit
8f1524a4c9
@ -78,13 +78,45 @@ const downloadCsv = (data) => {
|
|||||||
if (['rejected', 'rejected'].includes(normalized)) return 'Returned';
|
if (['rejected', 'rejected'].includes(normalized)) return 'Returned';
|
||||||
return item.status || '—';
|
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 = [
|
const row = [
|
||||||
item.survey_name || '—',
|
item.survey_name || '—',
|
||||||
item.year || '—',
|
item.year || '—',
|
||||||
item.quarter || '—',
|
item.quarter || '—',
|
||||||
statusText,
|
statusText,
|
||||||
item.submission_on || '—',
|
formatDate(item.submission_on),
|
||||||
`${item.products || 0}`,
|
`${item.products || 0}`,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -172,7 +204,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="min-h-[4rem] mt-[-70px]">
|
<div className="min-h-[4rem] mt-[-30px]">
|
||||||
<div className="max-w-[1280px] mx-auto mb-5 bg-white border border-[#E5E7EB] shadow-[0_16px_32px_rgba(15,23,42,0.06)] rounded-[8px] mt-8 w-full overflow-hidden">
|
<div className="max-w-[1280px] mx-auto mb-5 bg-white border border-[#E5E7EB] shadow-[0_16px_32px_rgba(15,23,42,0.06)] rounded-[8px] mt-8 w-full overflow-hidden">
|
||||||
<div className="flex items-center justify-between px-6 pt-6 pb-4">
|
<div className="flex items-center justify-between px-6 pt-6 pb-4">
|
||||||
<h2 className="text-[18px] leading-[28px] font-medium text-[#232528]">
|
<h2 className="text-[18px] leading-[28px] font-medium text-[#232528]">
|
||||||
@ -185,7 +217,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
|
|||||||
type="text"
|
type="text"
|
||||||
value={searchTerm}
|
value={searchTerm}
|
||||||
onChange={(e) => setSearchTerm(e.target.value)}
|
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]"
|
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]"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
|
|||||||
@ -30,34 +30,35 @@ const SurveyCarousel = ({
|
|||||||
setCurrentIndex((prev) => (prev === surveys.length - 1 ? 0 : prev + 1));
|
setCurrentIndex((prev) => (prev === surveys.length - 1 ? 0 : prev + 1));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-black rounded-lg shadow-sm ring-1 w-[1275px] ring-gray-200 h-[148px] mt-[-10px] mb-10 ml-2 ">
|
<div className="w-full max-w-[1280px] mx-auto px-1 mt-1">
|
||||||
<div className="rounded-none bg-[#F2ECCF] px-8 py-10 flex items-center justify-between transition-all duration-500">
|
<div className="bg-black rounded-lg shadow-sm ring-1 ring-gray-200 min-h-[180px] mb-4">
|
||||||
<div className="flex-1">
|
<div className="h-full rounded-none bg-[#F2ECCF] p-5 md:p-6 lg:p-8 flex flex-col md:flex-row items-start md:items-center justify-between gap-4 transition-all duration-500">
|
||||||
<h3 className="text-[18px] leading-[28px] font-medium text-[#232528]">
|
<div className="flex-1 w-full">
|
||||||
|
<h3 className="text-base md:text-lg font-medium text-[#232528] line-clamp-1">
|
||||||
{current?.title || '—'}
|
{current?.title || '—'}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="mt-1 text-[16px] leading-[24px] font-medium text-[#232528]">
|
<p className="mt-1 text-sm md:text-base text-[#232528] line-clamp-2">
|
||||||
{current?.subtitle || ''}
|
{current?.subtitle || ''}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="mt-2 flex items-center gap-6 text-[12px] leading-[16px] font-medium text-[#232528]">
|
<div className="mt-2 flex flex-wrap gap-2 md:gap-4 text-xs md:text-sm text-[#232528]">
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1 flex-shrink-0">
|
||||||
<CalendarDays size={14} className="text-[#92722A]" />
|
<CalendarDays size={14} className="text-[#92722A] flex-shrink-0" />
|
||||||
<span className="font-semibold">Due Date:</span>
|
<span className="font-semibold hidden sm:inline">Due:</span>
|
||||||
{current?.dueDate || '—'}
|
<span className="font-medium">{current?.dueDate || '—'}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1 flex-shrink-0">
|
||||||
<Clock3 size={14} className="text-[#92722A]" />
|
<Clock3 size={14} className="text-[#92722A] flex-shrink-0" />
|
||||||
<span className="font-semibold">Est. time:</span>
|
<span className="font-semibold hidden sm:inline">Est. time:</span>
|
||||||
{current?.estTime || '—'}
|
<span className="font-medium">{current?.estTime || '—'}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>
|
<span className="flex items-center gap-1">
|
||||||
<span className="font-semibold">Status:</span>
|
<span className="font-semibold">Status:</span>
|
||||||
{current?.status || '—'}
|
<span className="font-medium">{current?.status || '—'}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@ -65,15 +66,14 @@ const SurveyCarousel = ({
|
|||||||
onStartSurvey?.(current);
|
onStartSurvey?.(current);
|
||||||
navigate('/survey', { state: { survey: current } });
|
navigate('/survey', { state: { survey: current } });
|
||||||
}}
|
}}
|
||||||
className="inline-flex items-center justify-center w-[196px] h-[52px] px-7 py-3 text-[18px] leading-[28px] font-medium rounded-lg text-white bg-[#92722A] hover:bg-[#7b5c1f] cursor-pointer whitespace-nowrap"
|
className="w-full sm:w-auto mt-0 flex-shrink-0 items-center justify-center px-5 py-3 text-base font-medium rounded-lg text-white bg-[#92722A] hover:bg-[#7b5c1f] cursor-pointer whitespace-nowrap transition-colors"
|
||||||
>
|
>
|
||||||
Start Survey Now
|
Start Survey Now
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between px-6 py-3 bg-[#F2ECCF]">
|
<div className="flex items-center justify-between px-4 sm:px-6 py-2 sm:py-3 bg-[#F2ECCF]">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={handlePrev}
|
onClick={handlePrev}
|
||||||
className="p-1 rounded-full hover:bg-gray-100 transition"
|
className="p-1 rounded-full hover:bg-gray-100 transition"
|
||||||
@ -81,11 +81,11 @@ const SurveyCarousel = ({
|
|||||||
<ChevronLeft size={20} className="text-gray-700" />
|
<ChevronLeft size={20} className="text-gray-700" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsPaused(!isPaused)}
|
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"
|
className="w-6 h-6 flex items-center justify-center rounded-full border border-black bg-transparent hover:bg-gray-100 transition"
|
||||||
>
|
>
|
||||||
<Pause size={12} className="text-black" />
|
<Pause size={12} className="text-black" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
className="p-1 rounded-full hover:bg-gray-100 transition"
|
className="p-1 rounded-full hover:bg-gray-100 transition"
|
||||||
@ -106,6 +106,7 @@ const SurveyCarousel = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -144,14 +144,13 @@ export const SurveyStatus = () => {
|
|||||||
: 'Complete your quarterly industrial production data submission';
|
: 'Complete your quarterly industrial production data submission';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="max-w-[1340px] mx-auto px-0 pb-15">
|
<section className="w-full max-w-[1340px] mx-auto px-4 py-2">
|
||||||
<div className="p-6">
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="text-center text-gray-500 text-sm py-10">
|
<div className="text-center text-gray-500 text-sm py-4">
|
||||||
Loading survey status...
|
Loading survey status...
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div className="text-center text-red-600 text-sm py-10">{error}</div>
|
<div className="text-center text-red-600 text-sm py-4">{error}</div>
|
||||||
) : (
|
) : (
|
||||||
<SurveyCarousel
|
<SurveyCarousel
|
||||||
surveys={surveys}
|
surveys={surveys}
|
||||||
@ -160,7 +159,6 @@ export const SurveyStatus = () => {
|
|||||||
onStartSurvey={handleStartSurvey}
|
onStartSurvey={handleStartSurvey}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,9 +28,9 @@ export const WelcomeSection = ({ data = null, loading = false, error = '' }) =>
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-[4rem] bg-gray-50">
|
<div className="bg-gray-50">
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
<div className="max-w-[1280px] mx-auto px-4 pt-4">
|
<div className="max-w-[1280px] mx-auto px-4 pt-2 pb-1">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<h2 className="w-[360px] text-[18px] pt-2 leading-[28px] font-medium text-[#232528]">
|
<h2 className="w-[360px] text-[18px] pt-2 leading-[28px] font-medium text-[#232528]">
|
||||||
Welcome{' '}
|
Welcome{' '}
|
||||||
|
|||||||
@ -452,7 +452,7 @@ const IsicHsCodes = () => {
|
|||||||
code: product.hs_code || 'N/A',
|
code: product.hs_code || 'N/A',
|
||||||
product: product.product_name || 'N/A',
|
product: product.product_name || 'N/A',
|
||||||
unit: product.unit?.uom || 'N/A',
|
unit: product.unit?.uom || 'N/A',
|
||||||
estimatedMapped: 0,
|
estimatedMapped: product.mapped_establishment_count || 0,
|
||||||
createdBy: createdByName,
|
createdBy: createdByName,
|
||||||
createdOn: createdDate || null,
|
createdOn: createdDate || null,
|
||||||
updated: updatedDate,
|
updated: updatedDate,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user