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