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';
|
||||
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 (
|
||||
<>
|
||||
<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="flex items-center justify-between px-6 pt-6 pb-4">
|
||||
<h2 className="text-[18px] leading-[28px] font-medium text-[#232528]">
|
||||
@ -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]"
|
||||
/>
|
||||
<img
|
||||
|
||||
@ -30,34 +30,35 @@ const SurveyCarousel = ({
|
||||
setCurrentIndex((prev) => (prev === surveys.length - 1 ? 0 : prev + 1));
|
||||
|
||||
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="rounded-none bg-[#F2ECCF] px-8 py-10 flex items-center justify-between transition-all duration-500">
|
||||
<div className="flex-1">
|
||||
<h3 className="text-[18px] leading-[28px] font-medium text-[#232528]">
|
||||
<div className="w-full max-w-[1280px] mx-auto px-1 mt-1">
|
||||
<div className="bg-black rounded-lg shadow-sm ring-1 ring-gray-200 min-h-[180px] mb-4">
|
||||
<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">
|
||||
<div className="flex-1 w-full">
|
||||
<h3 className="text-base md:text-lg font-medium text-[#232528] line-clamp-1">
|
||||
{current?.title || '—'}
|
||||
</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 || ''}
|
||||
</p>
|
||||
|
||||
<div className="mt-2 flex items-center gap-6 text-[12px] leading-[16px] font-medium text-[#232528]">
|
||||
<span className="flex items-center gap-1">
|
||||
<CalendarDays size={14} className="text-[#92722A]" />
|
||||
<span className="font-semibold">Due Date:</span>
|
||||
{current?.dueDate || '—'}
|
||||
</span>
|
||||
<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 flex-shrink-0">
|
||||
<CalendarDays size={14} className="text-[#92722A] flex-shrink-0" />
|
||||
<span className="font-semibold hidden sm:inline">Due:</span>
|
||||
<span className="font-medium">{current?.dueDate || '—'}</span>
|
||||
</span>
|
||||
|
||||
<span className="flex items-center gap-1">
|
||||
<Clock3 size={14} className="text-[#92722A]" />
|
||||
<span className="font-semibold">Est. time:</span>
|
||||
{current?.estTime || '—'}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 flex-shrink-0">
|
||||
<Clock3 size={14} className="text-[#92722A] flex-shrink-0" />
|
||||
<span className="font-semibold hidden sm:inline">Est. time:</span>
|
||||
<span className="font-medium">{current?.estTime || '—'}</span>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<span className="font-semibold">Status:</span>
|
||||
{current?.status || '—'}
|
||||
</span>
|
||||
</div>
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="font-semibold">Status:</span>
|
||||
<span className="font-medium">{current?.status || '—'}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
@ -65,15 +66,14 @@ const SurveyCarousel = ({
|
||||
onStartSurvey?.(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
|
||||
</button>
|
||||
</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">
|
||||
|
||||
<button
|
||||
onClick={handlePrev}
|
||||
className="p-1 rounded-full hover:bg-gray-100 transition"
|
||||
@ -81,11 +81,11 @@ const SurveyCarousel = ({
|
||||
<ChevronLeft size={20} className="text-gray-700" />
|
||||
</button>
|
||||
<button
|
||||
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"
|
||||
>
|
||||
<Pause size={12} className="text-black" />
|
||||
</button>
|
||||
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"
|
||||
>
|
||||
<Pause size={12} className="text-black" />
|
||||
</button>
|
||||
<button
|
||||
onClick={handleNext}
|
||||
className="p-1 rounded-full hover:bg-gray-100 transition"
|
||||
@ -106,6 +106,7 @@ const SurveyCarousel = ({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@ -144,14 +144,13 @@ export const SurveyStatus = () => {
|
||||
: 'Complete your quarterly industrial production data submission';
|
||||
|
||||
return (
|
||||
<section className="max-w-[1340px] mx-auto px-0 pb-15">
|
||||
<div className="p-6">
|
||||
<section className="w-full max-w-[1340px] mx-auto px-4 py-2">
|
||||
{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...
|
||||
</div>
|
||||
) : 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
|
||||
surveys={surveys}
|
||||
@ -160,7 +159,6 @@ export const SurveyStatus = () => {
|
||||
onStartSurvey={handleStartSurvey}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@ -28,9 +28,9 @@ export const WelcomeSection = ({ data = null, loading = false, error = '' }) =>
|
||||
// }
|
||||
|
||||
return (
|
||||
<div className="min-h-[4rem] bg-gray-50">
|
||||
<div className="bg-gray-50">
|
||||
<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">
|
||||
<h2 className="w-[360px] text-[18px] pt-2 leading-[28px] font-medium text-[#232528]">
|
||||
Welcome{' '}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user