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:32661 -added AppUtils file. #298

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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-reactjs-ui/src/menuItems/MenuItemDeviceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const MenuItemDeviceDetails = (props) => {
<path id="dvr_FILL0_wght200_GRAD0_opsz24"
d="M124.849-788.343a.718.718,0,0,0,.526-.22.718.718,0,0,0,.22-.526.718.718,0,0,0-.22-.526.718.718,0,0,0-.526-.22.718.718,0,0,0-.526.22.718.718,0,0,0-.22.526.718.718,0,0,0,.22.526A.718.718,0,0,0,124.849-788.343Zm0-4.849a.718.718,0,0,0,.526-.22.718.718,0,0,0,.22-.526.718.718,0,0,0-.22-.526.718.718,0,0,0-.526-.22.718.718,0,0,0-.526.22.718.718,0,0,0-.22.526.718.718,0,0,0,.22.526A.718.718,0,0,0,124.849-793.192Zm2.565,4.709h10.165V-789.7H127.414Zm0-4.849h10.165v-1.212H127.414Zm-.14,12.729v-2.425h-5.316a1.9,1.9,0,0,1-1.4-.561,1.9,1.9,0,0,1-.561-1.4v-13.056a1.9,1.9,0,0,1,.561-1.4,1.9,1.9,0,0,1,1.4-.561h17.905a1.9,1.9,0,0,1,1.4.561,1.9,1.9,0,0,1,.561,1.4v13.056a1.9,1.9,0,0,1-.561,1.4,1.9,1.9,0,0,1-1.4.561h-5.316v2.425Zm-5.316-3.637h17.905a.713.713,0,0,0,.513-.233.713.713,0,0,0,.233-.513v-13.056a.713.713,0,0,0-.233-.513.713.713,0,0,0-.513-.233H121.958a.713.713,0,0,0-.513.233.713.713,0,0,0-.233.513v13.056a.713.713,0,0,0,.233.513A.713.713,0,0,0,121.958-784.24Zm-.746,0v0Z"
transform="translate(-119.75 800.25)"
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} stroke-width="0.5" />
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} strokeWidth="0.5" />
</svg>

</div>
Expand Down
2 changes: 1 addition & 1 deletion pmp-reactjs-ui/src/menuItems/MenuItemPartnerCertificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const MenuItemPartnerCertificate = (props) => {
<path id="upload_file_FILL0_wght200_GRAD0_opsz24"
d="M207-824.084h1.078v-5.059l2.263,2.263.763-.769-3.564-3.564-3.564,3.564.769.763L207-829.143Zm-5.264,3.482a1.686,1.686,0,0,1-1.242-.5,1.686,1.686,0,0,1-.5-1.242v-15.916a1.686,1.686,0,0,1,.5-1.242,1.686,1.686,0,0,1,1.242-.5h8.5l4.849,4.849v12.807a1.686,1.686,0,0,1-.5,1.242,1.686,1.686,0,0,1-1.242.5Zm7.958-14.009v-4.31h-7.958a.634.634,0,0,0-.456.207.634.634,0,0,0-.207.456v15.916a.634.634,0,0,0,.207.456.634.634,0,0,0,.456.207h11.605a.634.634,0,0,0,.456-.207.634.634,0,0,0,.207-.456v-12.268Zm-8.621-4.31v0Z"
transform="translate(-199.75 840.25)"
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} stroke-width="0.5" />
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} strokeWidth="0.5" />
</svg>
</div>
<p className={`duration-200 text-nowrap font-semibold text-xs`}>
Expand Down
2 changes: 1 addition & 1 deletion pmp-reactjs-ui/src/menuItems/MenuItemPartnerProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const MenuItemPartnerProfile = (props) => {
<path id="library_books_FILL0_wght200_GRAD0_opsz24"
d="M147.417-833.75h6.359V-836.8h-6.359Zm0,6.128h7.943v-1.141h-7.943Zm0-2.945h7.943v-1.141h-7.943Zm-2.15,6.542a1.785,1.785,0,0,1-1.315-.528,1.785,1.785,0,0,1-.528-1.315v-12.288a1.785,1.785,0,0,1,.528-1.315,1.785,1.785,0,0,1,1.315-.528h12.288a1.785,1.785,0,0,1,1.315.528,1.785,1.785,0,0,1,.528,1.315v12.288a1.785,1.785,0,0,1-.528,1.315,1.785,1.785,0,0,1-1.315.528Zm0-1.141h12.288a.671.671,0,0,0,.483-.219.671.671,0,0,0,.219-.483v-12.288a.671.671,0,0,0-.219-.483.671.671,0,0,0-.483-.219H145.266a.671.671,0,0,0-.483.219.671.671,0,0,0-.219.483v12.288a.671.671,0,0,0,.219.483A.671.671,0,0,0,145.266-825.167Zm-3.423,4.564a1.785,1.785,0,0,1-1.315-.528,1.785,1.785,0,0,1-.528-1.315v-13.429h1.141v13.429a.671.671,0,0,0,.219.483.671.671,0,0,0,.483.219h13.429v1.141Zm2.721-18.256v0Z"
transform="translate(-139.75 840.25)"
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} stroke-width="0.5" />
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} strokeWidth="0.5" />
</svg>

</div>
Expand Down
2 changes: 1 addition & 1 deletion pmp-reactjs-ui/src/menuItems/MenuItemSBIInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const MenuItemSBIInformation = (props) => {
data-name="quick_reference_FILL0_wght200_GRAD0_opsz24"
d="M161.119-838.881v0Zm2.8,10.631h3.66q.179-.3.38-.579t.425-.54h-4.465Zm0,4.476h2.752a3.791,3.791,0,0,1-.041-.549q0-.269.019-.57h-2.731Zm-2.109,3.917a1.751,1.751,0,0,1-1.29-.518,1.751,1.751,0,0,1-.518-1.29v-16.527a1.751,1.751,0,0,1,.518-1.29,1.751,1.751,0,0,1,1.29-.518h8.823l5.036,5.036v3.413q-.295-.082-.564-.133a4.872,4.872,0,0,0-.555-.073V-834.4h-4.476v-4.476h-8.263a.658.658,0,0,0-.473.215.658.658,0,0,0-.215.473v16.527a.658.658,0,0,0,.215.473.658.658,0,0,0,.473.215h5.855a6.164,6.164,0,0,0,.38.6,3.9,3.9,0,0,0,.447.519Z"
transform="translate(-145 853.628)"
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} stroke-width="0.5" />
fill={activeIcon ? "#1447b2" : "#7a7e82"} stroke={activeIcon ? "#1447b2" : "#7a7e82"} strokeWidth="0.5" />
</g>
</svg>

Expand Down
12 changes: 6 additions & 6 deletions pmp-reactjs-ui/src/pages/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ function Dashboard() {
</div>
</div>
</div>
<hr class="h-px ml-7 mt-7 bg-gray-200 border-0" />
<div class="flex mt-7 ml-7 justify-between text-sm text-gray-400">
<hr className="h-px ml-7 mt-7 bg-gray-200 border-0" />
<div className="flex mt-7 ml-7 justify-between text-sm text-gray-400">
<div>
<p>2024 © MOSIP - All rights reserved.</p>
</div>
<div class="flex justify-between">
<p class="mr-7">Documentation</p>
<p class="mr-7">MOSIP Community</p>
<p class="mr-7">Contact Us</p>
<div className="flex justify-between">
<p className="mr-7">Documentation</p>
<p className="mr-7">MOSIP Community</p>
<p className="mr-7">Contact Us</p>
</div>
</div>
</div>
Expand Down
19 changes: 4 additions & 15 deletions pmp-reactjs-ui/src/pages/PartnerCertificatesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import UploadCertificate from "./UploadCertificate";
import HttpService from "../services/HttpService";
import {formatDate} from "../utils/AppUtils"

function PartnerCertificatesList() {

Expand Down Expand Up @@ -59,25 +60,13 @@ function PartnerCertificatesList() {
setErrorMsg("");
};

const formatDate = (dateString, format) => {
if (!dateString) return '-';
const date = new Date(dateString);
if (format === 'dateTime') {
return date.toLocaleString();
} else if (format === 'date') {
return date.toLocaleDateString();
} else {
return '-';
}
};

return (
<div className=" flex-col w-full p-5 bg-anti-flash-white h-full font-inter">
{!dataLoaded && (
<div className="flex items-center justify-center h-4/5">

<div role="status" className="flex items-center">
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg aria-hidden="true" className="w-8 h-8 text-gray-200 animate-spin fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor" />
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill" />
</svg>
Expand Down Expand Up @@ -123,7 +112,7 @@ function PartnerCertificatesList() {
<path
id="keyboard_backspace_FILL0_wght200_GRAD0_opsz24"
d="M168-676.306l-8-8,8-8,1.067,1.067-6.18,6.18h18.671v1.507H162.887l6.18,6.18Z"
transform="translate(-159.293 693.015)" stroke="#000" stroke-width="1.5" />
transform="translate(-159.293 693.015)" stroke="#000" strokeWidth="1.5" />
</svg>

<div className="flex-col mt-4">
Expand Down Expand Up @@ -152,7 +141,7 @@ function PartnerCertificatesList() {
<path id="Path_155391" data-name="Path 155391" d="M118.084,176.189H149.07c.288,0,.522-1.805.522-4.025s-.234-4.025-.522-4.025H118.084c-.288,0-.522,1.805-.522,4.025S117.8,176.189,118.084,176.189Z" transform="translate(-63.465 -143.682)" fill="#d0d0d0" />
</g>
</g>
<g id="Rectangle_7160" data-name="Rectangle 7160" transform="translate(633 323)" fill="none" stroke="#d0d0d0" stroke-width="1">
<g id="Rectangle_7160" data-name="Rectangle 7160" transform="translate(633 323)" fill="none" stroke="#d0d0d0" strokeWidth="1">
<rect width="273" height="132" rx="20" stroke="none" />
<rect x="0.5" y="0.5" width="272" height="131" rx="19.5" fill="none" />
</g>
Expand Down
21 changes: 5 additions & 16 deletions pmp-reactjs-ui/src/pages/UploadCertificate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState, useEffect } from 'react';
import HttpService from '../services/HttpService';
import { formatDate } from '../utils/AppUtils';

function UploadCertificate({ closePopup, partnerData }) {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
Expand Down Expand Up @@ -123,26 +124,14 @@ function UploadCertificate({ closePopup, partnerData }) {
}
}, [partnerData.uploadDt]);

const formatDate = (dateString, format) => {
if (!dateString) return '-';
const date = new Date(dateString);
if (format === 'dateTime') {
return date.toLocaleString();
} else if (format === 'date') {
return date.toLocaleDateString();
} else {
return '-';
}
};

return (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50">
<div className={`bg-white md:w-[400px] w-[60%] mx-auto ${partnerData.isCertificateAvailable ? 'h-[520px]' : 'h-[500px]'} rounded-lg shadow-lg mt-5`}>
{!dataLoaded && (
<div className="flex items-center justify-center h-full">

<div role="status" className="flex items-center">
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg aria-hidden="true" className="w-8 h-8 text-gray-200 animate-spin fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor" />
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill" />
</svg>
Expand All @@ -168,15 +157,15 @@ function UploadCertificate({ closePopup, partnerData }) {
<div className="mb-4">
<label className="block text-indigo-950 text-md font-semibold mb-2">Partner Domain Type<span className="text-red-500">*</span></label>
<div className="relative z-10">
<button onClick={openDropdown} class="flex items-center justify-between w-full h-10 px-2 py-2 border border-gray-400 rounded-md text-md text-start text-gray-800 leading-tight focus:outline-none focus:shadow-none" type="button">
<button onClick={openDropdown} className="flex items-center justify-between w-full h-10 px-2 py-2 border border-gray-400 rounded-md text-md text-start text-gray-800 leading-tight focus:outline-none focus:shadow-none" type="button">
<span>{selectedDomainType || setDefaultDomainType()}</span>
<svg class={`w-3 h-2 ml-3 transform ${isDropdownOpen ? 'rotate-180' : 'rotate-0'} text-gray-500 text-sm`} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<svg className={`w-3 h-2 ml-3 transform ${isDropdownOpen ? 'rotate-180' : 'rotate-0'} text-gray-500 text-sm`} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="m1 1 4 4 4-4" />
</svg>
</button>
{isDropdownOpen && (
<div className="absolute z-50 top-10 left-0 w-full">
<div class="z-10 border border-gray-400 bg-white rounded-lg shadow-lg w-full dark:bg-gray-700 cursor-pointer">
<div className="z-10 border border-gray-400 bg-white rounded-lg shadow-lg w-full dark:bg-gray-700 cursor-pointer">
<a className="block px-4 py-2 text-base text-blue-950" onClick={() => selectDomainType("DEVICE")}>DEVICE</a>
<div className="border-gray-100 border-t mx-2"></div>
<a className="block px-4 py-2 text-base text-blue-950" onClick={() => selectDomainType("FTM")}>FTM</a>
Expand Down
11 changes: 11 additions & 0 deletions pmp-reactjs-ui/src/utils/AppUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const formatDate = (dateString, format) => {
if (!dateString) return '-';
const date = new Date(dateString);
if (format === 'dateTime') {
return date.toLocaleString();
} else if (format === 'date') {
return date.toLocaleDateString();
} else {
return '-';
}
};