Skip to content

Commit

Permalink
feat(frontend): Add new Field on negotiation catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiodmota committed May 14, 2024
1 parent 5b8a2b1 commit 674415e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ REACT_APP_DELETE_REPORTS=/api/dashboard/deleteReport
REACT_APP_GET_USER_BPDM_GATES=/api/dashboard/getAllUserBPDMGates?
REACT_APP_DELETE_RATINGS=/api/dashboard/deleteRating
REACT_APP_GET_COMPANY_USERS=/api/dashboard/getUserFromCompany?
REACT_APP_GET_QUERY_CATALOG=/api/negotiation/queryCatalog?
REACT_APP_POST_TRIGGER_NEGOTIATION=/api/negotiation/triggerNegotiation?
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script>
window.ENV = {
REACT_APP_COUNTRY_RISK_API: "http://localhost:8080",
REACT_APP_AUTH_URL: "https://localhost:8081/auth",
REACT_APP_AUTH_URL: "http://localhost:8080/auth",
REACT_APP_PORTAL_FRONTEND: "http://localhost:3000",
REACT_APP_PORTAL_BACKEND: "http://localhost:8080",
REACT_APP_COUNTRY_RISK_CLIENT: "country_risk_client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { useState, useRef, useContext } from "react";
import { useState, useRef, useContext, useEffect } from "react";
import {
UserAvatar,
UserMenu,
Expand All @@ -36,7 +36,15 @@ import { CompanyUserContext } from "../../../../contexts/companyuser";
export const UserInfo = () => {
const [menuOpen, setMenuOpen] = useState(false);
const wrapperRef = useRef(null);
const { companyUser } = useContext(CompanyUserContext);
const { companyUser, setCompanyUser } = useContext(CompanyUserContext);

useEffect(() => {
// Clean up roles by trimming whitespace
if (companyUser && companyUser.roles) {
const cleanedRoles = companyUser.roles.map((role) => role.trim());
setCompanyUser({ ...companyUser, roles: cleanedRoles });
}
}, [companyUser, setCompanyUser]);

const openCloseMenu = () => setMenuOpen((prevVal) => !prevVal);

Expand All @@ -59,7 +67,8 @@ export const UserInfo = () => {
// Add negotiation link for users with Negotiator or Admin roles
if (
companyUser.roles.includes("Negotiator") ||
companyUser.roles.includes("Admin")
companyUser.roles.includes("Admin") ||
companyUser.roles.includes("Company Admin")
) {
menuItems = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const NegotiationPage = () => {
const negotiationRequest = selectedItems.map((item) => ({
id: item.id,
offerId: item.offerId,
usagePurpose: item.usagePurpose,
}));

try {
Expand Down

0 comments on commit 674415e

Please sign in to comment.