bug fixes
This commit is contained in:
parent
01be34ae6f
commit
32d87c634a
@ -433,22 +433,30 @@ export const SelectField = ({
|
||||
<div
|
||||
className={`w-full text-sm focus:outline-none ${className}`}
|
||||
style={{
|
||||
...inputStyle,
|
||||
cursor: readOnly ? 'not-allowed' : 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
minHeight: '40px',
|
||||
padding: '0 16px'
|
||||
}}
|
||||
...inputStyle,
|
||||
height: 'auto', // override fixed height
|
||||
minHeight: '40px',
|
||||
cursor: readOnly ? 'not-allowed' : 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: '8px 16px',
|
||||
}}
|
||||
onClick={toggleDropdown}
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
tabIndex={readOnly ? -1 : 0}
|
||||
>
|
||||
<span style={{ color: hasValue ? '#232528' : '#9CA3AF' }}>
|
||||
{getDisplayValue()}
|
||||
</span>
|
||||
<span
|
||||
style={{
|
||||
color: hasValue ? '#232528' : '#9CA3AF',
|
||||
flex: 1,
|
||||
whiteSpace: 'normal',
|
||||
lineHeight: '20px'
|
||||
}}
|
||||
>
|
||||
{getDisplayValue()}
|
||||
</span>
|
||||
{showClear ? (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@ -398,18 +398,18 @@ React.useEffect(() => {
|
||||
const term = search.trim().toLowerCase();
|
||||
|
||||
const filteredItems = submissions.filter((item) => {
|
||||
if (!item) return false;
|
||||
|
||||
const allValues = Object.values(item)
|
||||
.map((v) => String(v ?? '').toLowerCase())
|
||||
.join(' ');
|
||||
|
||||
const matchSearch = !term || allValues.includes(term);
|
||||
const matchYear = !year || year === 'All' || String(item.year) === String(year);
|
||||
const matchQuarter = !quarter || quarter === 'All' || item.quarter === quarter;
|
||||
const matchEmirate = !emirate || emirate === 'All' || item.emirate === emirate;
|
||||
const matchStatus = !status || status === 'All' || item.status === status;
|
||||
|
||||
if (!item || item.status === 'Draft') return false;
|
||||
|
||||
const allValues = Object.values(item)
|
||||
.map((v) => String(v ?? '').toLowerCase())
|
||||
.join(' ');
|
||||
|
||||
const matchSearch = !term || allValues.includes(term);
|
||||
const matchYear = !year || year === 'All' || String(item.year) === String(year);
|
||||
const matchQuarter = !quarter || quarter === 'All' || item.quarter === quarter;
|
||||
const matchEmirate = !emirate || emirate === 'All' || item.emirate === emirate;
|
||||
const matchStatus = !status || status === 'All' || item.status === status;
|
||||
|
||||
const matches = matchSearch && matchYear && matchQuarter && matchEmirate && matchStatus;
|
||||
|
||||
if (matches) {
|
||||
@ -423,16 +423,21 @@ React.useEffect(() => {
|
||||
return filteredItems;
|
||||
}, [submissions, search, year, quarter, emirate, status]);
|
||||
|
||||
const summaryCounts = React.useMemo(
|
||||
() => ({
|
||||
total: submissions.length,
|
||||
approved: submissions.filter((i) => i.status === 'Approved').length,
|
||||
submitted: submissions.filter((i) => i.status === 'Submitted').length,
|
||||
rejected: submissions.filter((i) => i.status === 'Rejected').length,
|
||||
resubmitted: submissions.filter((i) => i.status === 'Resubmitted').length,
|
||||
}),
|
||||
[submissions]
|
||||
);
|
||||
const nonDraftSubmissions = React.useMemo(
|
||||
() => submissions.filter((i) => i.status !== 'Draft'),
|
||||
[submissions]
|
||||
);
|
||||
|
||||
const summaryCounts = React.useMemo(
|
||||
() => ({
|
||||
total: nonDraftSubmissions.length,
|
||||
approved: nonDraftSubmissions.filter((i) => i.status === 'Approved').length,
|
||||
submitted: nonDraftSubmissions.filter((i) => i.status === 'Submitted').length,
|
||||
rejected: nonDraftSubmissions.filter((i) => i.status === 'Rejected').length,
|
||||
resubmitted: nonDraftSubmissions.filter((i) => i.status === 'Resubmitted').length,
|
||||
}),
|
||||
[nonDraftSubmissions]
|
||||
);
|
||||
|
||||
const headers = [
|
||||
'Establishment',
|
||||
|
||||
@ -1775,7 +1775,7 @@ const displayedRows = sortedProfiles.map((item) => {
|
||||
item.establishmentName || "-",
|
||||
|
||||
// Contact Name (userProfileName → contactPersonName → createdBy → "-")
|
||||
item.userProfileName || item.contactPersonName || "-",
|
||||
// item.userProfileName || item.contactPersonName || "-",
|
||||
|
||||
// Emirate
|
||||
item.emirate || "-",
|
||||
@ -2617,7 +2617,7 @@ const handleView = async (id) => {
|
||||
const requiredFields = [
|
||||
{ field: 'userProfileName', label: 'Name' },
|
||||
{ field: 'userProfileEmail', label: 'Email' },
|
||||
{ field: 'contactName', label: 'Contact Name' },
|
||||
// { field: 'contactName', label: 'Contact Name' },
|
||||
{ field: 'contactAddress', label: 'Contact Address' },
|
||||
{ field: 'contactEmirate', label: 'Emirate' },
|
||||
{ field: 'contactMobileNumber', label: 'Mobile Number' },
|
||||
@ -3411,7 +3411,7 @@ const handleImport = async () => {
|
||||
<Table
|
||||
headers={[
|
||||
{ name: 'Establishment Name', key: 'establishmentName', sortable: true, className: 'whitespace-nowrap' },
|
||||
{ name: 'Contact Name', key: 'contactName', sortable: true, className: 'whitespace-nowrap' },
|
||||
// { name: 'Contact Name', key: 'contactName', sortable: true, className: 'whitespace-nowrap' },
|
||||
{ name: 'Emirate', key: 'emirate', sortable: true, className: 'whitespace-nowrap' },
|
||||
{ name: 'ISIC Code', key: 'isicCode', sortable: false, className: 'whitespace-nowrap' },
|
||||
{ name: 'Establishment ID', key: 'establishmentId', sortable: true, className: 'whitespace-nowrap' },
|
||||
@ -3467,7 +3467,7 @@ const handleImport = async () => {
|
||||
}}
|
||||
columnWidths={[
|
||||
300, // Establishment Name (increased from 250)
|
||||
180, // Contact Name (increased from 150)
|
||||
// 180, // Contact Name (increased from 150)
|
||||
150, // Emirate (increased from 120)
|
||||
150, // ISIC Code (increased from 120)
|
||||
200, // Establishment ID (increased from 150)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user