diff --git a/.env b/.env index a0b511c..639667a 100644 --- a/.env +++ b/.env @@ -1,8 +1,10 @@ -VITE_BASE_URI="https://glider-precious-similarly.ngrok-free.app" +# VITE_BASE_URI="https://glider-precious-similarly.ngrok-free.app" # VITE_BASE_URI="https://wired-terminally-muskrat.ngrok-free.app" # VITE_BASE_URI="https://officially-powerful-goat.ngrok-free.app" # VITE_BASE_URI="https://python-amused-adder.ngrok-free.app" # VITE_BASE_URI="https://concrete-gladly-mullet.ngrok-free.app" +# VITE_BASE_URI="https://smashing-albacore-engaging.ngrok-free.app" +VITE_BASE_URI="https://basically-polished-yeti.ngrok-free.app" -# VITE_BASE_URI="http://192.168.2.176:8083" \ No newline at end of file +# VITE_BASE_URI="http://10.10.1.248:8083" \ No newline at end of file diff --git a/public/sme-colored.png b/public/sme-colored.png new file mode 100644 index 0000000..2cc81c1 Binary files /dev/null and b/public/sme-colored.png differ diff --git a/src/App.tsx b/src/App.tsx index 38d1023..5a4eb38 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -24,6 +24,7 @@ import JoyrideController from "./utlity/JoyRideTour"; import Contacts from "./components/contacts/Contacts"; import TransactionSentSuccess from "./components/process/CompletionScreen/TransactionSentSuccess"; import CompletionScreen from "./components/client/CompletionScreen"; +import SessionExpired from "./components/client/SessionExpired"; const App = () => { return ( @@ -108,6 +109,7 @@ const App = () => { } /> } /> } /> + } /> {/* Links work wothout Login */} diff --git a/src/components/accounts/DownloadDocument.tsx b/src/components/accounts/DownloadDocument.tsx new file mode 100644 index 0000000..878bb6b --- /dev/null +++ b/src/components/accounts/DownloadDocument.tsx @@ -0,0 +1,73 @@ +import React from 'react' +import { IoMdClose } from 'react-icons/io' +import downloadDocumentUtils from '../../utlity/downloadDocumentsUtils'; +import { DownloadTypesEnum } from './TransactionDataTable'; + +interface DownloadDocumentInt { + showMenu: { open: boolean, transactionId: string | null }, + setShowMenu: React.Dispatch<{ open: boolean, transactionId: string | null }>, + accountId: string +} + +const DownloadDocument: React.FC = ({ showMenu, setShowMenu, accountId }) => { + + + function handleDownloadFormSubmit(e) { + e.preventDefault(); + + const formData = new FormData(e.target); + const docType = formData.get('download-doc-type'); + const includeCertificate = formData.get('download-doc-type-include-cert'); + + downloadDocumentUtils(accountId, showMenu.transactionId as string, docType as string, includeCertificate as string | null) + } + + + return ( + <> + {showMenu.open && ( +
handleDownloadFormSubmit(e)} className='fixed inset-0 z-50'> +
setShowMenu({ open: false, transactionId: null })}>
+
+
+

Download Document

+ +
+
+
+ Choose file to download +
+ + + + + +
+
+
+ + +
+
+
+
+ )} + + ) +} + +export default DownloadDocument \ No newline at end of file diff --git a/src/components/accounts/TransactionDataTable.tsx b/src/components/accounts/TransactionDataTable.tsx index 2c4f83d..06b1364 100644 --- a/src/components/accounts/TransactionDataTable.tsx +++ b/src/components/accounts/TransactionDataTable.tsx @@ -8,6 +8,7 @@ import logoRecord from '../../assets/record.svg'; import { MdOutlineFileDownload } from 'react-icons/md'; import downloadDocumentUtils from '../../utlity/downloadDocumentsUtils'; import { IoMdClose } from 'react-icons/io'; +import DownloadDocument from './DownloadDocument'; const formatDate = (timestamp: number) => { return new Date(timestamp * 1000).toLocaleString(); @@ -20,6 +21,12 @@ const statusColorMap = { EXPIRED: "bg-red-100 text-red-600", }; +export enum DownloadTypesEnum { + ALL = "archived", + COMBINED = "combined", + CERTIFICATE = "certificate" +} + const TransactionDataTable = ({ activeAccountId }) => { const navigate = useNavigate() @@ -34,11 +41,7 @@ const TransactionDataTable = ({ activeAccountId }) => { }); const [loading, setLoading] = useState(false) - enum DownloadTypesEnum { - ALL = "archived", - COMBINED = "combined", - CERTIFICATE = "certificate" - } + const [downloadDocumentType, setDownloadDocumentType] = useState({ type: DownloadTypesEnum.ALL, @@ -98,7 +101,7 @@ const TransactionDataTable = ({ activeAccountId }) => { function handleDownloadFormSubmit(e) { e.preventDefault(); - + const formData = new FormData(e.target); const docType = formData.get('download-doc-type'); const includeCertificate = formData.get('download-doc-type-include-cert'); @@ -106,8 +109,6 @@ const TransactionDataTable = ({ activeAccountId }) => { downloadDocumentUtils(activeAccountId, showMenu.transactionId as string, docType as string, includeCertificate as string | null) } - - return ( <> @@ -148,7 +149,7 @@ const TransactionDataTable = ({ activeAccountId }) => { {transactions.map((tx, idx) => ( handleTransactionClick(tx.id)} + // onClick={() => handleTransactionClick(tx.id)} >
{ {showMenu.open && ( -
handleDownloadFormSubmit(e)} className='fixed inset-0 z-50'> -
setShowMenu({open: false, transactionId: null})}>
-
-
-

Download Document

- -
-
-
- Choose file to download -
- - - - {/* */} - -
-
-
- - -
-
-
-
+ )} diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index 3177b27..710faac 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -8,6 +8,7 @@ import OAuthGoogle from "./OAuthGoogle"; // import Cookies from "js-cookie"; import { BsEye } from "react-icons/bs"; import { FiEyeOff } from "react-icons/fi"; +import { TokenStorage } from "../../config/api"; // import api from "../../config/api"; interface FormDataState { @@ -115,8 +116,9 @@ const LoginForm = ({ onSwitchToRegister }) => { ); if (res.status === 200) { - navigate("/"); + TokenStorage.setTokens(res.data.accessToken, res.data.refreshToken) formErrorRef.current = { message: "Login Successfully", error: false } + navigate("/"); } } catch (err) { if (err.response?.status === 400 || err.response?.status === 401) { diff --git a/src/components/client/ClientDownloadDocument.tsx b/src/components/client/ClientDownloadDocument.tsx new file mode 100644 index 0000000..7664162 --- /dev/null +++ b/src/components/client/ClientDownloadDocument.tsx @@ -0,0 +1,78 @@ +import React from 'react' +import { IoMdClose } from 'react-icons/io' +import downloadDocumentUtils from '../../utlity/downloadDocumentsUtils'; + +interface DownloadDocumentInt { + showMenuDownload: { open: boolean, transactionId: string | null }, + setShowMenuDownload: React.Dispatch<{ open: boolean, transactionId: string | null }>, + accountId: string +} + +enum DownloadTypesEnum { + ALL = "archived", + COMBINED = "combined", + CERTIFICATE = "certificate" +} + +const ClientDownloadDocument: React.FC = ({ showMenuDownload, setShowMenuDownload, accountId }) => { + + + function handleDownloadFormSubmit(e) { + e.preventDefault(); + + const formData = new FormData(e.target); + const docType = formData.get('download-doc-type'); + const includeCertificate = formData.get('download-doc-type-include-cert'); + + downloadDocumentUtils(accountId, showMenuDownload.transactionId as string, docType as string, includeCertificate as string | null) + } + + + return ( + <> + {showMenuDownload.open && ( +
handleDownloadFormSubmit(e)} className='fixed inset-0 z-50'> +
setShowMenuDownload({ open: false, transactionId: null })}>
+
+
+

Download Document

+ +
+
+
+ Choose file to download +
+ + + + + +
+
+
+ + +
+
+
+
+ )} + + ) +} + +export default ClientDownloadDocument \ No newline at end of file diff --git a/src/components/client/CompletionScreen.tsx b/src/components/client/CompletionScreen.tsx index 8beace7..d360607 100644 --- a/src/components/client/CompletionScreen.tsx +++ b/src/components/client/CompletionScreen.tsx @@ -23,10 +23,10 @@ const CompletionScreen: React.FC = ({
{/* Header */} -
+
- + Sign made easy
@@ -34,10 +34,10 @@ const CompletionScreen: React.FC = ({ {/* Main content */}
-

+

{hit}{title}

-

+

{message}

@@ -49,42 +49,42 @@ const CompletionScreen: React.FC = ({ {/* */} -

+

Access your documents anytime — just Login

{/* Illustration placeholder */} -
+
{textColorSuccess ? Document completed : Document completed}
{/* Apps Section */} -
-

+
+

Boost Efficiency with Our Apps

-
+
{/* Forms Made Easy */} -
+
-

+

Generate Forms with Ease

- Docs Made Easy -
@@ -94,15 +94,15 @@ const CompletionScreen: React.FC = ({
{/* Docs Made Easy */} -
+
-

+

Generate Documents (Invoices, Reports, Quotes)

- Docs Made Easy -
@@ -116,8 +116,8 @@ const CompletionScreen: React.FC = ({

{/* Footer */} -