Skip to content

Commit

Permalink
TM-5915, Bid Audit List At Grade
Browse files Browse the repository at this point in the history
  • Loading branch information
Mostafa Habib committed May 16, 2024
1 parent 7f8d8cb commit 02b7378
Show file tree
Hide file tree
Showing 6 changed files with 541 additions and 331 deletions.
51 changes: 27 additions & 24 deletions src/Components/AdministratorPage/bidAudit/BidAuditCategory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ const BidAuditCategory = (props) => {
const [bidAuditCategoryData$, setBidAuditCategoryData$] = useState(bidAuditCategoryData?.in_categories);
const [clearFilters, setClearFilters] = useState(false);
const [selectedPositionCodes, setSelectedPositionCodes] = useState([]);
const [selectedEmployeeDesc, setSelectedEmployeeDesc] = useState([]);
const [selectedPositionDesc, setSelectedPositionDesc] = useState([]);
const [selectedEmployeeDescs, setSelectedEmployeeDescs] = useState([]);
const [selectedPositionDescs, setSelectedPositionDescs] = useState([]);
const [selectedEmployeeCodes, setSelectedEmployeeCodes] = useState([]);

const noFiltersSelected = [
selectedEmployeeCodes,
selectedPositionCodes,
selectedPositionDesc,
selectedEmployeeDesc].flat().length === 0;
selectedPositionDescs,
selectedEmployeeDescs].flat().length === 0;

const resetFilters = () => {
setSelectedPositionCodes([]);
setSelectedEmployeeCodes([]);
setSelectedPositionDesc([]);
setSelectedEmployeeDesc([]);
setSelectedPositionDescs([]);
setSelectedEmployeeDescs([]);
setClearFilters(false);
};

const skillDataFiltered = () => {
const filterData = () => {
if (noFiltersSelected) return bidAuditCategoryData?.in_categories;
let skillCategories = bidAuditCategoryData?.in_categories;
if (selectedPositionCodes.length > 0) {
Expand All @@ -73,21 +73,21 @@ const BidAuditCategory = (props) => {
selectedEmployeeCodes.some(codes => codes.text === category.employee_skill_code),
);
}
if (selectedPositionDesc.length > 0) {
if (selectedPositionDescs.length > 0) {
skillCategories = skillCategories.filter(category =>
selectedPositionDesc.some(descriptions => descriptions.text === category.position_skill_desc),
selectedPositionDescs.some(descriptions => descriptions.text === category.position_skill_desc),
);
}
if (selectedEmployeeDesc.length > 0) {
if (selectedEmployeeDescs.length > 0) {
skillCategories = skillCategories.filter(category =>
selectedEmployeeDesc.some(descriptions => descriptions.text === category.employee_skill_desc),
selectedEmployeeDescs.some(descriptions => descriptions.text === category.employee_skill_desc),
);
}
return skillCategories;
};

useEffect(() => {
setBidAuditCategoryData$(skillDataFiltered);
setBidAuditCategoryData$(filterData);
if (noFiltersSelected) {
setClearFilters(false);
} else {
Expand All @@ -96,8 +96,8 @@ const BidAuditCategory = (props) => {
}, [
selectedPositionCodes,
selectedEmployeeCodes,
selectedPositionDesc,
selectedEmployeeDesc,
selectedPositionDescs,
selectedEmployeeDescs,
bidAuditCategoryData,
]);

Expand Down Expand Up @@ -184,7 +184,7 @@ const BidAuditCategory = (props) => {
<div className="position-search bid-audit-page">
<div className="usa-grid-full position-search--header">
<BackButton />
<ProfileSectionTitle title="Bid Audit" icon="keyboard-o" className="xl-icon" />
<ProfileSectionTitle title="Bid Audit - In Skill Category" icon="keyboard-o" className="xl-icon" />

<div className="filterby-container" >
<div className="filterby-label">Filter by:</div>
Expand All @@ -200,10 +200,10 @@ const BidAuditCategory = (props) => {

<div className="usa-width-one-whole position-search--filters--cm">
<div className="filter-div">
<div className="ba-label">Position Code:</div>
<div className="ba-label">Position Skill Code:</div>
<Picky
{...pickyProps}
placeholder="Filter by Position Skill Code"
placeholder="Select Position Skill Code"
options={getUniqData('position_skill_code')}
valueKey="text"
labelKey="text"
Expand All @@ -216,20 +216,20 @@ const BidAuditCategory = (props) => {
<div className="ba-label">Position Skill:</div>
<Picky
{...pickyProps}
placeholder="Filter by Position Skill"
placeholder="Select Position Skill"
options={getUniqData('position_skill_desc')}
valueKey="text"
labelKey="text"
onChange={setSelectedPositionDesc}
value={selectedPositionDesc}
onChange={setSelectedPositionDescs}
value={selectedPositionDescs}
disabled={disableSearch}
/>
</div>
<div className="filter-div">
<div className="ba-label">Employee Skill Code:</div>
<Picky
{...pickyProps}
placeholder="Filter by Employee Skill Code"
placeholder="Select Employee Skill Code"
options={getUniqData('employee_skill_code')}
valueKey="text"
labelKey="text"
Expand All @@ -242,12 +242,12 @@ const BidAuditCategory = (props) => {
<div className="ba-label">Employee Skill:</div>
<Picky
{...pickyProps}
placeholder="Filter by Employee Skill"
placeholder="Select Employee Skill"
options={getUniqData('employee_skill_desc')}
valueKey="text"
labelKey="text"
onChange={setSelectedEmployeeDesc}
value={selectedEmployeeDesc}
onChange={setSelectedEmployeeDescs}
value={selectedEmployeeDescs}
disabled={disableSearch}
/>
</div>
Expand All @@ -266,6 +266,9 @@ const BidAuditCategory = (props) => {
<FA name="plus" />Add New In Skill-Category</a>
</div>
</span>
<span className="ba-subheading">
<div className="ba-audit-sub-info">Employee Skills considered In-Skill for Positions in a Bid Cycle</div>
</span>

{
disableSearch &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ const BidAuditCategoryCard = ({ data, onEditModeSearch, isOpen }) => {
<div className="label">Employee Skill Code - Description:</div>
<select>
{mockData.map(grade => (
<option value={grade.code}>{grade.name}</option>
<option value={grade.code} key={grade?.code}>{grade.name}</option>
))}
</select>
</div>
</div>
</div>
),
cancelText: 'Are you sure you want to discard all changes made to this position?',
cancelText: 'Are you sure you want to discard all changes made to this card?',
handleSubmit: () => onSubmit(),
handleCancel: () => onCancelForm(),
handleEdit: {
Expand All @@ -90,7 +90,6 @@ const BidAuditCategoryCard = ({ data, onEditModeSearch, isOpen }) => {
tabs={
[
{
text: 'In Skill Categories',
value: 'In Skill Categories',
content: (
<div className="position-content--container">
Expand Down
Loading

0 comments on commit 02b7378

Please sign in to comment.