chnages in product details
This commit is contained in:
parent
8eee109297
commit
346790205a
@ -97,7 +97,7 @@ const AdminHeader = () => {
|
||||
// ignore storage errors
|
||||
}
|
||||
setProfileOpen(false);
|
||||
navigate('/login');
|
||||
navigate('/index');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@ -78,15 +78,24 @@ const SubmissionTable = ({ selectedQuarter, selectedYear }) => {
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return '-';
|
||||
const date = new Date(dateStr);
|
||||
const formatted = date.toLocaleString('en-GB', {
|
||||
// Format for Dubai timezone (Asia/Dubai)
|
||||
const options = {
|
||||
timeZone: 'Asia/Dubai',
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: true,
|
||||
});
|
||||
return formatted.replace(/\s?(am|pm)$/i, (match) => match.toUpperCase());
|
||||
};
|
||||
|
||||
// Format the date in Dubai time
|
||||
let formatted = new Intl.DateTimeFormat('en-GB', options).format(date);
|
||||
|
||||
// Convert to uppercase AM/PM and ensure consistent formatting
|
||||
formatted = formatted.replace(/\s?(am|pm)$/i, (match) => match.toUpperCase());
|
||||
|
||||
return formatted;
|
||||
};
|
||||
|
||||
const renderStatusBadge = (status) => {
|
||||
@ -388,14 +397,14 @@ const SubmissionTable = ({ selectedQuarter, selectedYear }) => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end px-6 pb-14 pt-6">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate('/admin/validations')}
|
||||
className="inline-flex h-[44px] w-[190px] items-center justify-center gap-2 rounded-md bg-[#9E792B] text-sm font-medium text-white shadow-[0_8px_18px_rgba(146,114,42,0.35)] hover:bg-[#846522] py-6"
|
||||
>
|
||||
View All Submissions
|
||||
</button>
|
||||
<div className="flex justify-end px-6 mt-2 mb-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate('/admin/validations')}
|
||||
className="h-9 px-4 text-sm font-medium text-white rounded-md bg-[#9E792B] hover:bg-[#846522] shadow-[0_2px_8px_rgba(146,114,42,0.25)]"
|
||||
>
|
||||
View All Submissions
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Approve Confirmation Modal */}
|
||||
|
||||
@ -61,7 +61,7 @@ const HeaderBar = () => {
|
||||
sessionStorage.removeItem('establishment_id');
|
||||
} catch {}
|
||||
setUserOpen(false);
|
||||
navigate('/login');
|
||||
navigate('/index');
|
||||
};
|
||||
|
||||
const onChangePassword = () => {
|
||||
|
||||
@ -182,11 +182,15 @@ const AdminDashboard = () => {
|
||||
<StatCard
|
||||
label="Due Date"
|
||||
labelClassName="text-sm"
|
||||
value={loading ? '--' : quarterlyWindows.end_date ? new Date(quarterlyWindows.end_date).toLocaleDateString('en-GB') : '--'}
|
||||
value={loading ? '--' :
|
||||
(selectedQuarter === 'All' || selectedYear === 'All') ? 'NA' :
|
||||
(quarterlyWindows.end_date ? new Date(quarterlyWindows.end_date).toLocaleDateString('en-GB') : '--')}
|
||||
valueClassName="text-sm"
|
||||
width={190}
|
||||
icon={<img src={dueDateIconSrc} alt="Due Date" className="h-5 w-5" />}
|
||||
tooltipText={`Submission deadline for ${selectedQuarter} ${selectedYear}`}
|
||||
tooltipText={selectedQuarter === 'All' || selectedYear === 'All' ?
|
||||
"Due date is not applicable when viewing all quarters or years" :
|
||||
`Submission deadline for ${selectedQuarter} ${selectedYear}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -78,6 +78,7 @@ const UnitMaster = () => {
|
||||
const [editingRow, setEditingRow] = useState(null);
|
||||
const [deletingRow, setDeletingRow] = useState(null);
|
||||
const [modalMode, setModalMode] = useState(null);
|
||||
const [selectedUnit, setSelectedUnit] = useState(null);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [form, setForm] = useState(createEmptyUnitForm());
|
||||
const [formErrors, setFormErrors] = useState({});
|
||||
@ -199,10 +200,18 @@ const UnitMaster = () => {
|
||||
setIsProductDropdownOpen(false);
|
||||
};
|
||||
|
||||
const handleView = (index) => {
|
||||
const selected = units[index];
|
||||
if (!selected) return;
|
||||
setSelectedUnit(selected);
|
||||
setModalMode('view');
|
||||
};
|
||||
|
||||
const handleEdit = (index) => {
|
||||
const selected = units[index];
|
||||
if (!selected) return;
|
||||
setEditingRow(index);
|
||||
setSelectedUnit(selected);
|
||||
setForm({
|
||||
unitName: selected.uom || selected.unitName,
|
||||
description: selected.uom_short_name || selected.description,
|
||||
@ -220,6 +229,7 @@ const UnitMaster = () => {
|
||||
|
||||
const closeModal = () => {
|
||||
setModalMode(null);
|
||||
setSelectedUnit(null);
|
||||
setForm(createEmptyUnitForm());
|
||||
setFormErrors({});
|
||||
setEditingRow(null);
|
||||
@ -472,6 +482,19 @@ const UnitMaster = () => {
|
||||
className="h-4 w-4"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="h-8 w-8 grid place-items-center rounded hover:bg-gray-50 cursor-pointer"
|
||||
title="View"
|
||||
aria-label="View unit"
|
||||
onClick={() => handleView(rowIndex)}
|
||||
>
|
||||
<img
|
||||
src="/assets/images/Eye.svg"
|
||||
alt="View"
|
||||
className="h-4 w-4"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="h-8 w-8 grid place-items-center rounded hover:bg-gray-50 cursor-pointer"
|
||||
@ -499,8 +522,72 @@ const UnitMaster = () => {
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* View Modal */}
|
||||
{modalMode === 'view' && selectedUnit && (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<div className="absolute inset-0 bg-black/40" onClick={closeModal} />
|
||||
<div
|
||||
className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-[16px] bg-white"
|
||||
style={{
|
||||
width: '628px',
|
||||
maxWidth: '92vw',
|
||||
boxShadow: '0 24px 40px rgba(27, 29, 33, 0.16)',
|
||||
border: '1px solid #E5E7EB',
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-between px-6 py-4 border-b border-[#F1F2F4]">
|
||||
<h3 className="text-[18px] font-medium text-[#232528]">
|
||||
View Unit
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Close"
|
||||
className="h-8 w-8 grid place-items-center rounded hover:bg-gray-100"
|
||||
onClick={closeModal}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" strokeWidth="2" className="h-4 w-4 text-[#92722A]" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6 6l12 12M18 6L6 18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="px-6 py-5">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1 ">
|
||||
Unit Name <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="mt-1 px-3 py-2 border border-[#92722A] rounded-md bg-gray-50">
|
||||
<p className="text-gray-900">{selectedUnit.uom || selectedUnit.unitName || 'N/A'}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Description <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="mt-1 px-3 py-2 border border-[#92722A] rounded-md bg-gray-50 min-h-[42px]">
|
||||
<p className="text-gray-900">{selectedUnit.uom_short_name || selectedUnit.description || 'N/A'}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 flex items-center justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
className="h-10 px-6 rounded-md border border-[#92722A] text-sm font-medium text-[#92722A] bg-white"
|
||||
onClick={closeModal}
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Add/Edit Modal */}
|
||||
{modalMode && (
|
||||
{modalMode && modalMode !== 'view' && (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<div className="absolute inset-0 bg-black/40" onClick={closeModal} />
|
||||
<div
|
||||
|
||||
Loading…
Reference in New Issue
Block a user