more
This commit is contained in:
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import { useContext, useEffect, useState, useRef, useCallback } from "react";
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useState,
|
|
||||||
useRef,
|
|
||||||
useFocusEffect,
|
|
||||||
useCallback,
|
|
||||||
} from "react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { AppContext } from "../../Hooks/useContext/appContext";
|
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||||
import SelectDropdown from "../../pageElements/SelectDropdown";
|
import SelectDropdown from "../../pageElements/SelectDropdown";
|
||||||
@@ -23,7 +16,6 @@ import {
|
|||||||
} from "firebase/firestore";
|
} from "firebase/firestore";
|
||||||
import ListPagination from "../../pageElements/ListPagination";
|
import ListPagination from "../../pageElements/ListPagination";
|
||||||
import ConfirmModal from "../Modals/ConfirmModal";
|
import ConfirmModal from "../Modals/ConfirmModal";
|
||||||
import Toggle from "../../pageElements/Toggle";
|
|
||||||
import "../../styles/doclist-page.scss";
|
import "../../styles/doclist-page.scss";
|
||||||
|
|
||||||
const DocumentListPage = ({ perPage }) => {
|
const DocumentListPage = ({ perPage }) => {
|
||||||
@@ -40,7 +32,7 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
const [totalPages, setTotalPages] = useState(1);
|
const [totalPages, setTotalPages] = useState(1);
|
||||||
const { group } = appState;
|
const { group } = appState;
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [order, setOrder] = useState("parentCaseName");
|
// const [order, setOrder] = useState("parentCaseName");
|
||||||
const [lowerOrder, setLowerOrder] = useState("parentCaseName");
|
const [lowerOrder, setLowerOrder] = useState("parentCaseName");
|
||||||
const [upperOrder, setUpperOrder] = useState("parentCaseName");
|
const [upperOrder, setUpperOrder] = useState("parentCaseName");
|
||||||
const appUserId = group ? group.appUserId : null;
|
const appUserId = group ? group.appUserId : null;
|
||||||
@@ -48,6 +40,7 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
const [selectedDocumentType, setSelectedDocumentType] = useState();
|
const [selectedDocumentType, setSelectedDocumentType] = useState();
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const [verbValue, setVerbValue] = useState(1);
|
const [verbValue, setVerbValue] = useState(1);
|
||||||
|
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
process.env.NODE_ENV === "development"
|
process.env.NODE_ENV === "development"
|
||||||
? process.env.REACT_APP_API_DEV
|
? process.env.REACT_APP_API_DEV
|
||||||
@@ -99,7 +92,7 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
return unsub;
|
return unsub;
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(getDocuments, [appUserId, order, respDocs, reqDocs]);
|
useEffect(getDocuments, [appUserId, respDocs, reqDocs]);
|
||||||
|
|
||||||
async function deleteFromDb(documentId) {
|
async function deleteFromDb(documentId) {
|
||||||
if (isBusy) {
|
if (isBusy) {
|
||||||
@@ -138,13 +131,18 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dropDownOptions = [
|
const upperDropDownOptions = [
|
||||||
{ label: "Associated case name a - z", value: "parentCaseName" },
|
{ label: "Associated case name a - z", value: "parentCaseName" },
|
||||||
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleNovos = (e) => {
|
const lowerDropDownOptions = [
|
||||||
navigate("/how-to");
|
{ label: "Associated case name a - z", value: "parentCaseName" },
|
||||||
|
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleUpperSort = () => {
|
||||||
|
console.log("handleUpperSort");
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleNavigate(
|
function handleNavigate(
|
||||||
@@ -203,7 +201,7 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
<div className="list-upper-right">
|
<div className="list-upper-right">
|
||||||
<div className="d-flex justify-content-end mb-3">
|
<div className="d-flex justify-content-end mb-3">
|
||||||
<SelectDropdown
|
<SelectDropdown
|
||||||
dropDownOptions={dropDownOptions}
|
dropDownOptions={upperDropDownOptions}
|
||||||
titleText="Sort documents"
|
titleText="Sort documents"
|
||||||
handleSelect={setUpperOrder}
|
handleSelect={setUpperOrder}
|
||||||
/>
|
/>
|
||||||
@@ -244,7 +242,7 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
<div className="list-upper-right">
|
<div className="list-upper-right">
|
||||||
<div className="d-flex justify-content-end mb-3">
|
<div className="d-flex justify-content-end mb-3">
|
||||||
<SelectDropdown
|
<SelectDropdown
|
||||||
dropDownOptions={dropDownOptions}
|
dropDownOptions={lowerDropDownOptions}
|
||||||
titleText="Sort documents"
|
titleText="Sort documents"
|
||||||
handleSelect={setLowerOrder}
|
handleSelect={setLowerOrder}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user