Skip to content

Commit

Permalink
MOSIP-32700 Active Sort icons implemented (#389)
Browse files Browse the repository at this point in the history
* Removed DownloadAndReuploadButtons sub-component in Partner Certificates component

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Added onClisk action for Re-upload Button

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Added upload date & expiry date in partner certificates screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Added upload date & expiry date in partner certificates screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Resolved sidebar issues, placed menu button at Header

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Implemented Policies screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated text and icons in Dash board

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated the Request policies screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Added tabular form in Policies screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Implemented pagination in policies screen

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Implemented dynamic status back-ground

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Modified into tabular tags in the code

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Now policies screen is device responsive

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated Pagination

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated the individual sorting of items

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Resolved sorting errors of items

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Implemented selecting items per page

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Renamed View Policy details file

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Renamed View Policy details file

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated Routes

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Updated Routes

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Removed unwanted view policies file

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

* Modified sort icon active status

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>

---------

Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com>
Signed-off-by: Mayura Deshmukh <52281514+mayuradesh@users.noreply.github.com>
Co-authored-by: Mayura Deshmukh <52281514+mayuradesh@users.noreply.github.com>
  • Loading branch information
Anil-kumar-Majji and mayuradesh authored May 30, 2024
1 parent 7ff83aa commit 270e621
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions pmp-reactjs-ui/src/pages/policies/Policies.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function Policies() {
const [policiesList, setPoliciesList] = useState([]);
const [filteredPoliciesList, setFilteredPoliciesList] = useState([]);
const [order, setOrder] = useState("ASC");
const [activeSortAsc, setActiveSortAsc] = useState(false);
const [activeSortDesc, setActiveSortDesc] = useState(false);
const [activeSortAsc, setActiveSortAsc] = useState("");
const [activeSortDesc, setActiveSortDesc] = useState("");
const [firstIndex, setFirstIndex] = useState(0);
const [selectedRecordsPerPage, setSelectedRecordsPerPage] = useState(5);
const [previous, setPrevious] = useState(false);
Expand Down Expand Up @@ -142,7 +142,7 @@ function Policies() {
}

//This part is related to Sorting
const toggleSortOrder = (sortItem) => {
const toggleSortDescOrder = (sortItem) => {
if (order === 'ASC') {
if (sortItem === "createDate") {
const sortedPolicies = [...filteredPoliciesList].sort((a, b) => {
Expand All @@ -151,20 +151,23 @@ function Policies() {
return isDescending ? dateA - dateB : dateB - dateA;
});
setFilteredPoliciesList(sortedPolicies);
setOrder("DESC")
setIsDescending(!isDescending);
setActiveSortDesc(true);
setActiveSortAsc(false);
setActiveSortDesc(sortItem);
setActiveSortAsc(sortItem);
}
else {
const sortedPolicies = [...filteredPoliciesList].sort((a, b) =>
a[sortItem].toLowerCase() > b[sortItem].toLowerCase() ? 1 : -1
);
setFilteredPoliciesList(sortedPolicies);
setOrder("DESC")
setActiveSortDesc(true);
setActiveSortAsc(false);
setActiveSortDesc(sortItem);
setActiveSortAsc(sortItem);
}
}
}
const toggleSortAscOrder = (sortItem) => {
if (order === 'DESC') {
if (sortItem === "createDate") {
const sortedPolicies = [...filteredPoliciesList].sort((a, b) => {
Expand All @@ -174,18 +177,19 @@ function Policies() {
});

setFilteredPoliciesList(sortedPolicies);
setOrder("ASC")
setIsDescending(!isDescending);
setActiveSortDesc(false);
setActiveSortAsc(true);
setActiveSortDesc(sortItem);
setActiveSortAsc(sortItem);
}
else {
const sortedPolicies = [...filteredPoliciesList].sort((a, b) =>
a[sortItem].toLowerCase() < b[sortItem].toLowerCase() ? 1 : -1
);
setFilteredPoliciesList(sortedPolicies);
setOrder("ASC")
setActiveSortDesc(false);
setActiveSortAsc(true);
setActiveSortDesc(sortItem);
setActiveSortAsc(sortItem);
}
}
};
Expand Down Expand Up @@ -336,22 +340,18 @@ function Policies() {
<div className="mx-2 flex gap-x-1 items-center">
{t(header.headerNameKey)}
{header.id !== "action" && (
// <img
// src={sortIcon} className="cursor-pointer"
// onClick={() => toggleSortOrder(header.id)} alt=""
// />
<div>
<svg className="cursor-pointer" onClick={() => toggleSortOrder(header.id)} alt=""
<svg className="cursor-pointer mb-0.5" onClick={() => toggleSortAscOrder(header.id)} alt=""
xmlns="http://www.w3.org/2000/svg"
width="7" height="6" viewBox="0 0 7 6">
<path id="Polygon_3" data-name="Polygon 3" d="M2.636,1.481a1,1,0,0,1,1.728,0L6.123,4.5A1,1,0,0,1,5.259,6H1.741A1,1,0,0,1,.877,4.5Z"
fill={`${activeSortDesc ? "#1447b2" : "#6f6e6e"}`} />
fill={`${(activeSortDesc===header.id && order==="ASC") ? "#1447b2" : "#6f6e6e"}`} />
</svg>
<svg className="cursor-pointer" onClick={() => toggleSortOrder(header.id)} alt=""
<svg className="cursor-pointer" onClick={() => toggleSortDescOrder(header.id)} alt=""
xmlns="http://www.w3.org/2000/svg"
width="7" height="6" viewBox="0 0 7 6">
<path id="Polygon_4" data-name="Polygon 4" d="M2.636,1.481a1,1,0,0,1,1.728,0L6.123,4.5A1,1,0,0,1,5.259,6H1.741A1,1,0,0,1,.877,4.5Z"
transform="translate(7 6) rotate(180)" fill={`${activeSortAsc ? "#1447b2" : "#6f6e6e"}`} />
transform="translate(7 6) rotate(180)" fill={`${(activeSortAsc===header.id && order==="DESC") ? "#1447b2" : "#6f6e6e"}`} />
</svg>
</div>
)}
Expand Down

0 comments on commit 270e621

Please sign in to comment.