diff --git a/pmp-reactjs-ui/src/pages/PartnerCertificatesList.js b/pmp-reactjs-ui/src/pages/PartnerCertificatesList.js index e38d09c0b..44442f92c 100644 --- a/pmp-reactjs-ui/src/pages/PartnerCertificatesList.js +++ b/pmp-reactjs-ui/src/pages/PartnerCertificatesList.js @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import UploadCertificate from "./UploadCertificate"; -import HttpService from '../services/HttpService'; +import HttpService from "../services/HttpService"; function PartnerCertificatesList() { @@ -9,11 +9,11 @@ function PartnerCertificatesList() { const navigate = useNavigate(); const [showPopup, setShowPopup] = useState(false); + const [selectedPartnerData, setSelectedPartnerData] = useState(null); const [certificatesData, setcertificatesData] = useState([]); const [errorMsg, setErrorMsg] = useState(""); const [dataLoaded, setDataLoaded] = useState(false); - const [selectedPartnerData, setSelectedPartnerData] = useState(null); - + const clickOnUpload = (partner) => { setShowPopup(!showPopup); setSelectedPartnerData(partner); @@ -32,7 +32,6 @@ function PartnerCertificatesList() { const fetchData = async () => { try { const response = await HttpService.get('/api/partners/getAllCertificateDetails'); - if (response != null) { const responseData = response.data; if (responseData.errors && responseData.errors.length > 0) { @@ -44,8 +43,8 @@ function PartnerCertificatesList() { setcertificatesData(resData); console.log('Response data:', resData); } - }else{ - setErrorMsg("Response is null"); + } else { + setErrorMsg("There is some error in fetching the certificates. Try again later!"); } setDataLoaded(true); } catch (err) { @@ -73,7 +72,7 @@ function PartnerCertificatesList() { }; return ( -
+
{!dataLoaded && (
@@ -89,187 +88,186 @@ function PartnerCertificatesList() { )} {dataLoaded && ( <> - {errorMsg && ( -
-
-
-

- {errorMsg} -

-
-
- - - + {errorMsg && ( +
+
+
+

+ {errorMsg} +

+
+
+ + + +
-
- )} -
-
- moveToHome()} className="mt-5 cursor-pointer" - xmlns="http://www.w3.org/2000/svg" - width="22.765" height="14.416" viewBox="0 0 22.765 17.416"> - - - -
-

Partner Certificate

-

moveToHome()} className="font-semibold text-blue-500 text-xs cursor-pointer"> - Home

+ )} +
+
+ moveToHome()} className="mt-5 cursor-pointer" + xmlns="http://www.w3.org/2000/svg" + width="22.765" height="14.416" viewBox="0 0 22.765 17.416"> + + + +
+

Partner Certificate

+

moveToHome()} className="font-semibold text-blue-500 text-xs cursor-pointer"> + Home

+
-
-
    - {certificatesData.length === 0 ? -
    - - - - - - - - - - - - - - - +
      + {certificatesData.length === 0 ? +
      + + + + + + + + + + + + + + + + + + + + - - - - - - -

      No partner types are mapped to your user id

      -
      : - certificatesData.map((partner, index) => { - return ( -
    • -
      -
      - {partner.isCertificateAvailable - ? - - - : - - - } - -
      -
      - {partner.isCertificateAvailable ? "Certificate Name Goes Here.CER" : "Please upload partner certificate here"} -
      -

      {partner.isCertificateAvailable ? null : "Only .cer or .pem certificate formats are allowed for upload"}

      + +

      No partner types are mapped to your user id

      +
      : + certificatesData.map((partner, index) => { + return ( +
    • +
      +
      + {partner.isCertificateAvailable + ? + + + : + + + } + +
      +
      + {partner.isCertificateAvailable ? "Certificate Name Goes Here.CER" : "Please upload partner certificate here"} +
      +

      {partner.isCertificateAvailable ? null : "Only .cer or .pem certificate formats are allowed for upload"}

      +
      -
      - {partner.isCertificateAvailable - ?
      -
      - + + {activeBtn && ( +
      +
      + Original Certificate + + + + +
      + +
      )} +
      + - - {activeBtn && ( -
      -
      - Original Certificate - - - - -
      - -
      )}
      - -
    - : } - {showPopup && ( - - )} -
-
-
-
-

Partner Type

-

{partner.partnerType}

-
-
-

Expiry Date

-

{formatDate(partner.certificateExpiryDate, 'date')}

+ : } + {showPopup && ( + + )}
-
-

Time of Upload

-

{formatDate(partner.certificateUploadDate, 'dateTime')}

+
+
+
+

Partner Type

+

{partner.partnerType}

+
+
+

Expiry Date

+

{formatDate(partner.certificateExpiryDate, 'date')}

+
+
+

Time of Upload

+

{formatDate(partner.certificateUploadDate, 'dateTime')}

+
-
- + + ) + } ) } - ) - } - -
+ +
)} -