Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-37017: disabled download and upload buttons in view and manage ftm #1068

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pmp-revamp-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@
"PMS_ATH_401": "المصادقة فشلت",
"PMS_PRT_106": "حالة APIKeyReqID قيد التقدم",
"PMS_KKS_001": " API لا يمكن الوصول إليها",
"PMS_PRT_107": "الردود من API لاغي",
"PMS_PRT_107": "الرد من واجهة برمجة التطبيقات هو لا شيء",
"PMS_PRT_500": "غير قادر على معالجة الطلب",
"PMS_PMP_016": "لقد تم إلغاء تنشيط حساب الشريك الخاص بك لنوع شريك معين بواسطة المسؤول، ونتيجة لذلك لن تتمكن بعد الآن من أداء هذا النشاط",
"PMS_PRT_098": "السياسة المقدمة بموجب مجموعة سياسة الشريك غير موجودة.",
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@
"PMS_ATH_401": "Authentication Failed",
"PMS_PRT_106": "APIKeyReqID status is In_progress",
"PMS_KKS_001": " API not accessible ",
"PMS_PRT_107": "Responese from the api is null",
"PMS_PRT_107": "Response from the api is null",
"PMS_PRT_500": "Unable to process the request.",
"PMS_PMP_016": "Your Partner account for given partner type has been deactivated by Admin, due to which you will no longer be able to perform this activity.",
"PMS_PRT_098": "Given policy under partner's policy group not exists.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ function ViewFtmChipDetails() {
setSuccessMsg("");
};

const showHoverMsg = () => {
return (
<div className={`absolute hidden group-hover:block text-center bg-gray-100 text-xs text-gray-500 font-semibold p-2 w-60 mt-1 z-10 ${isLoginLanguageRTL ? "left-0" : "right-0"} top-11 rounded-md shadow-md`}>
{t('partnerCertificatesList.disabledBtnHoverMsg')}
</div>
);
}

return (
<div className={`mt-2 w-[100%] ${isLoginLanguageRTL ? "mr-28 ml-5" : "ml-28 mr-5"} font-inter relative`}>
{errorMsg && (
Expand Down Expand Up @@ -228,20 +236,35 @@ function ViewFtmChipDetails() {

<div className=" flex space-x-2">
{ftmDetails.isViewFtmChipDetails && (
<button id='download_btn' disabled={ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval'} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${(ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval') ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
<div className="relative group">
<button id='download_btn' disabled={ftmDetails.partnerStatus === 'deactivated' || (ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval')} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${(ftmDetails.partnerStatus === 'deactivated' || (ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval')) ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
{ftmDetails.partnerStatus === 'deactivated' && (
showHoverMsg()
)}
</div>
)}
{ftmDetails.isManageFtmCertificate && (
<div className="flex space-x-2 max-640:flex-col max-640:space-y-2 max-640:space-x-0">
<button id='download_btn' disabled={!ftmDetails.isCertificateAvailable} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${!ftmDetails.isCertificateAvailable ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
<button id="certificate_reupload_btn" onClick={clickOnUpload} className={`h-10 w-28 text-xs p-3 py-2 ${ftmDetails.isCertificateAvailable ? 'text-tory-blue bg-white border-blue-800' : 'bg-tory-blue text-snow-white'} border font-semibold rounded-md text-center`}>
{ftmDetails.isCertificateAvailable ? t('partnerCertificatesList.reUpload') : t('partnerCertificatesList.upload')}
</button>
<div className="relative group">
<button id='download_btn' disabled={ftmDetails.partnerStatus === 'deactivated' || !ftmDetails.isCertificateAvailable} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${(ftmDetails.partnerStatus === 'deactivated' || !ftmDetails.isCertificateAvailable) ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
{ftmDetails.partnerStatus === 'deactivated' && (
showHoverMsg()
)}
</div>
<div className="relative group">
<button id="certificate_reupload_btn" disabled={ftmDetails.partnerStatus === 'deactivated'} onClick={clickOnUpload} className={`h-10 w-28 text-xs p-3 py-2 ${ftmDetails.partnerStatus === 'deactivated' ? 'text-[#6f7070] border-gray-300 bg-white': ftmDetails.isCertificateAvailable ? 'text-tory-blue bg-white border-blue-800' : 'bg-tory-blue text-snow-white'} border font-semibold rounded-md text-center`}>
{ftmDetails.isCertificateAvailable ? t('partnerCertificatesList.reUpload') : t('partnerCertificatesList.upload')}
</button>
{ftmDetails.partnerStatus === 'deactivated' && (
showHoverMsg()
)}
</div>
{showPopup && (
<UploadCertificate header={t('addFtm.uploadFtmCertificate')} closePopup={closePopup} popupData={uploadCertificateData} request={uploadCertificateRequest} />
)}
Expand Down
Loading