Skip to content

Commit

Permalink
Merge branch 'feature/harsh-steven/search-sort-filter' of https://git…
Browse files Browse the repository at this point in the history
…hub.com/TritonSE/PAP-Inventory-Processing into feature/harsh-steven/search-sort-filter
  • Loading branch information
2s2e committed May 26, 2024
2 parents 6ce5944 + 1cd5ee7 commit bcc3c57
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 45 deletions.
8 changes: 5 additions & 3 deletions frontend/src/app/staff/vsr/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export default function VSRTableView() {
<p className={styles.statusLabel}>Status:</p>
<div className={styles.statusWrapper}>
<StatusDropdown
value="Any"
value="All Statuses"
onChanged={(value: string) => {
if (value === "Any") {
if (value === "All Statuses") {
setStatus(undefined);
fetchVSRs(search, filteredZipCodes, filteredIncome, undefined);
} else {
Expand Down Expand Up @@ -329,7 +329,9 @@ export default function VSRTableView() {
{/* {searchOnOwnRow ? <SearchKeyword onUpdate={fetchSearchedVSRs} /> : null} */}

<span className={styles.filterChips}>
<p className={styles.appliedText}>Applied Filters: </p>
{(filteredZipCodes && filteredZipCodes.length > 0) || filteredIncome ? (
<p className={styles.appliedText}>Applied Filters: </p>
) : null}
{filteredZipCodes?.map((zipCode) => (
<FilterChip
label={"Zip Code: " + zipCode}
Expand Down
40 changes: 13 additions & 27 deletions frontend/src/components/VSRTable/FilterModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TextField from "@/components/shared/input/TextField";
import MultipleChoice from "@/components/shared/input/MultipleChoice";
import { incomeOptions } from "@/constants/fieldOptions";
import FilterChip from "@/components/VSRTable/FilterChip";
import { on } from "events";

interface FilterModalProps {
isOpen: boolean;
Expand Down Expand Up @@ -56,13 +55,6 @@ const FilterModal = ({ isOpen, onClose, onInputEntered, onResetFilters }: Filter
}
};

const handleZipCodeEnter = () => {
if (currentZipCode.trim()) {
setZipCodes((prevZipCodes) => [...prevZipCodes, currentZipCode.trim()]);
setCurrentZipCode(""); // Clear the text field after adding the zipcode
}
};

return (
<>
<BaseModal
Expand All @@ -81,24 +73,16 @@ const FilterModal = ({ isOpen, onClose, onInputEntered, onResetFilters }: Filter
required
></MultipleChoice>
<br />
<div className={styles.zipCodeContainer}>
<TextField
label="Zip Code(s)"
variant="outlined"
placeholder="e.g. 92093"
onChange={handleZipCodeChange}
onKeyDown={handleKeyDown}
value={currentZipCode}
required={false}
/>
<Button
variant="primary"
outlined={false}
text="Enter"
onClick={handleZipCodeEnter}
className={styles.enterButton}
/>
</div>
<TextField
label="Zip Code(s)"
variant="outlined"
type="number"
placeholder="e.g. 92093"
onChange={handleZipCodeChange}
onKeyDown={handleKeyDown}
value={currentZipCode}
required={false}
/>
<br />
<div className={styles.filterChips}>
{zipCodes?.map((zipCode) => (
Expand Down Expand Up @@ -127,7 +111,9 @@ const FilterModal = ({ isOpen, onClose, onInputEntered, onResetFilters }: Filter
outlined={false}
text="Apply Filters"
onClick={handleApplyFilter}
className={styles.button}
className={`${styles.button} ${
zipCodes.length > 0 || currentZipCode !== "" || income !== "" ? "" : styles.disabled
}`}
/>
</div>
}
Expand Down
16 changes: 2 additions & 14 deletions frontend/src/components/VSRTable/FilterModal/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@
margin: 0 0 16px;
}

.zipCodeContainer {
display: flex;
flex-direction: row;
gap: 32px;
align-items: flex-end;
}

.enterButton {
width: 20%;
padding: 12px 24px;
text-align: center;
font-family: "Lora";
font-size: 18px;
font-weight: 700;
.disabled {
background-color: grey !important;
}
2 changes: 1 addition & 1 deletion frontend/src/components/shared/StatusDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface StatusOption {
*/
export const STATUS_OPTIONS: StatusOption[] = [
{
value: "Any",
value: "All Statuses",
color: "#ffffff",
},
{
Expand Down

0 comments on commit bcc3c57

Please sign in to comment.