Compare commits
No commits in common. "7b448558c02ee9450b660c25a8339d7a0f051da9" and "f206d549634576249d8de3b537dfc64998497fd2" have entirely different histories.
7b448558c0
...
f206d54963
|
|
@ -54,12 +54,6 @@ const App = () => {
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
} />
|
} />
|
||||||
|
|
||||||
<Route path="/process-step-one/:accountId/:transactionId/:signType" element={
|
|
||||||
<ProtectedRoute>
|
|
||||||
<ProcessStepOne />
|
|
||||||
</ProtectedRoute>
|
|
||||||
} />
|
|
||||||
|
|
||||||
<Route path="/process-step-one/:accountId/template/:templateId" element={
|
<Route path="/process-step-one/:accountId/template/:templateId" element={
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<ProcessStepOne />
|
<ProcessStepOne />
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ const DocumentPages = ({ selectedDocuments, setDropDownTogglePage, dropDownToggl
|
||||||
onClick={() => (`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`)}
|
onClick={() => (`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`)}
|
||||||
className={`p-2 ${(dropDownTogglePage === 'pageDropDown' + indx) ? "bg-[var(--primary)]" : "bg-slate-200"} flex flex-col justify-center items-center gap-2 rounded`}>
|
className={`p-2 ${(dropDownTogglePage === 'pageDropDown' + indx) ? "bg-[var(--primary)]" : "bg-slate-200"} flex flex-col justify-center items-center gap-2 rounded`}>
|
||||||
{
|
{
|
||||||
document.pages != undefined && <img
|
document.images != undefined && <img
|
||||||
key={indx}
|
key={indx}
|
||||||
className='rounded-sm shadow'
|
className='rounded-sm shadow'
|
||||||
src={document.pages[0].src}
|
src={document.images[0].src}
|
||||||
alt="" />
|
alt="" />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ const DocumentPages = ({ selectedDocuments, setDropDownTogglePage, dropDownToggl
|
||||||
{
|
{
|
||||||
dropDownTogglePage === 'pageDropDown' + indx &&
|
dropDownTogglePage === 'pageDropDown' + indx &&
|
||||||
<div className='my-1 flex justify-center items-center gap-1 flex-wrap'>
|
<div className='my-1 flex justify-center items-center gap-1 flex-wrap'>
|
||||||
{document.pages != undefined && document.pages.map((img, indx) => (
|
{document.images != undefined && document.images.map((img, indx) => (
|
||||||
<a
|
<a
|
||||||
href={"#" + document.documentId + indx}
|
href={"#" + document.documentId + indx}
|
||||||
className='max-w-max px-4 py-2 shadow cursor-pointer border-1 rounded-sm border-slate-200 hover:border-[var(--primary)] transition-all duration-300 bg-slate-300'
|
className='max-w-max px-4 py-2 shadow cursor-pointer border-1 rounded-sm border-slate-200 hover:border-[var(--primary)] transition-all duration-300 bg-slate-300'
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ interface RecipientType {
|
||||||
acceptedTerms: boolean;
|
acceptedTerms: boolean;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
}
|
}
|
||||||
interface pagesType {
|
interface ImagesType {
|
||||||
index: number;
|
index: number;
|
||||||
type: string;
|
type: string;
|
||||||
src: string;
|
src: string;
|
||||||
|
|
@ -56,7 +56,7 @@ interface pagesType {
|
||||||
}
|
}
|
||||||
interface DocumentType {
|
interface DocumentType {
|
||||||
documentId: string;
|
documentId: string;
|
||||||
pages: pagesType[];
|
images: ImagesType[];
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ const fitObj = [
|
||||||
|
|
||||||
// Functions - LIST
|
// Functions - LIST
|
||||||
// handleSignClick - Handle when sign || Initial tag got clicked
|
// handleSignClick - Handle when sign || Initial tag got clicked
|
||||||
// fetchData - Fetch document pages and tags data
|
// fetchData - Fetch document images and tags data
|
||||||
// handleFormSubmit - handle form submit and send data to server
|
// handleFormSubmit - handle form submit and send data to server
|
||||||
|
|
||||||
const SignDocument = () => {
|
const SignDocument = () => {
|
||||||
|
|
@ -144,7 +144,6 @@ const SignDocument = () => {
|
||||||
const [transaction, setTransaction] = useState<TransactionType | null>(null);
|
const [transaction, setTransaction] = useState<TransactionType | null>(null);
|
||||||
const [recSignStatus, setRecSignStatus] = useState<string | null>(null);
|
const [recSignStatus, setRecSignStatus] = useState<string | null>(null);
|
||||||
const [droppedItems, setDroppedItems] = useState([]);
|
const [droppedItems, setDroppedItems] = useState([]);
|
||||||
const[signTagId , setSignTagId] = useState<number>(0)
|
|
||||||
|
|
||||||
const [stamp, setStamp] = useState<StampTypeObj>({ open: false, blob: "" });
|
const [stamp, setStamp] = useState<StampTypeObj>({ open: false, blob: "" });
|
||||||
|
|
||||||
|
|
@ -179,12 +178,8 @@ const SignDocument = () => {
|
||||||
initial: null,
|
initial: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const [signConfObj, setSignConfObj] = useState<SignConfTypeObj | {}>({});
|
const [signConfObj, setSignConfObj] = useState<SignConfTypeObj | {}>({});
|
||||||
|
|
||||||
console.log("signConfObj",signConfObj)
|
|
||||||
|
|
||||||
const zoom = (percentage: number, contentClass: string) => {
|
const zoom = (percentage: number, contentClass: string) => {
|
||||||
const content = document.querySelector(`.${contentClass}`);
|
const content = document.querySelector(`.${contentClass}`);
|
||||||
if (content) {
|
if (content) {
|
||||||
|
|
@ -244,9 +239,7 @@ const SignDocument = () => {
|
||||||
}
|
}
|
||||||
}, [saved])
|
}, [saved])
|
||||||
|
|
||||||
const handleSignClick = (index: number , id:number) => {
|
const handleSignClick = (index: number) => {
|
||||||
console.log("IDNumber" , id)
|
|
||||||
setSignTagId(id)
|
|
||||||
if (saved.save) {
|
if (saved.save) {
|
||||||
if (index in signConfObj) {
|
if (index in signConfObj) {
|
||||||
setOpenSign(true);
|
setOpenSign(true);
|
||||||
|
|
@ -270,11 +263,8 @@ const SignDocument = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSignConfObj({ ...newObj })
|
setSignConfObj({ ...newObj })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleStampClick = (index: number) => {
|
const handleStampClick = (index: number) => {
|
||||||
console.log("Stamp Clicked", index)
|
console.log("Stamp Clicked", index)
|
||||||
setStamp({
|
setStamp({
|
||||||
|
|
@ -512,12 +502,11 @@ const SignDocument = () => {
|
||||||
|
|
||||||
const fetchSignatureData = async (signatureId: string) => {
|
const fetchSignatureData = async (signatureId: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/sign/signatures/${signatureId}?recipientId=${recipientId}`, {
|
const response = await axios.get(`${import.meta.env.VITE_BASE_URI}/api/sign/signatures/${signatureId}`, {
|
||||||
headers: { "ngrok-skip-browser-warning": "69420" }
|
headers: { "ngrok-skip-browser-warning": "69420" }
|
||||||
});
|
});
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
console.log("line 516" , response.data)
|
return response.data.signature;
|
||||||
return response.data;
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching signature data:", error);
|
console.error("Error fetching signature data:", error);
|
||||||
|
|
@ -525,19 +514,18 @@ const SignDocument = () => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// (async () => {
|
(async () => {
|
||||||
// if (droppedItems) {
|
if (droppedItems) {
|
||||||
// for (const tag of droppedItems) {
|
for (const tag of droppedItems) {
|
||||||
// if (tag.type === "SIGNATURE" && "value" in tag) {
|
if (tag.type === "SIGNATURE" && "value" in tag) {
|
||||||
// console.log(tag, "line 533")
|
const signatureData = await fetchSignatureData(tag.value);
|
||||||
// const signatureData = await fetchSignatureData(tag["value"]);
|
console.log(signatureData);
|
||||||
// console.log("Currnet Signature",signatureData);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
})()
|
||||||
// })()
|
}, [droppedItems])
|
||||||
// }, [droppedItems])
|
|
||||||
|
|
||||||
|
|
||||||
const handleTagUpdate = (updateIndx: number, updateValue: string) => {
|
const handleTagUpdate = (updateIndx: number, updateValue: string) => {
|
||||||
|
|
@ -891,7 +879,7 @@ const SignDocument = () => {
|
||||||
|
|
||||||
<div className='flex flex-col gap-3 max-w-max relative left-[50%] translate-x-[-50%]'>
|
<div className='flex flex-col gap-3 max-w-max relative left-[50%] translate-x-[-50%]'>
|
||||||
{
|
{
|
||||||
doc.pages && doc.pages.length > 0 && doc.pages.map((page, indx) => {
|
doc.images && doc.images.length > 0 && doc.images.map((page, indx) => {
|
||||||
const key = `${doc.documentId}_${page.index}`;
|
const key = `${doc.documentId}_${page.index}`;
|
||||||
console.log(droppedItems, "line 820")
|
console.log(droppedItems, "line 820")
|
||||||
// const tagJsonData = [...droppedItems];
|
// const tagJsonData = [...droppedItems];
|
||||||
|
|
@ -1024,7 +1012,7 @@ const SignDocument = () => {
|
||||||
<div
|
<div
|
||||||
tabIndex={1}
|
tabIndex={1}
|
||||||
id={item.id}
|
id={item.id}
|
||||||
onClick={() => handleSignClick(index , item.id)}
|
onClick={() => handleSignClick(index)}
|
||||||
className={`flex justify-center items-center h-full w-full rounded cursor-pointer ${transparentTags || hideTags ? "pointer-events-none bg-transparent" : "bg-slate-200 shadow-sm border-slate-100 opacity-80"}`}
|
className={`flex justify-center items-center h-full w-full rounded cursor-pointer ${transparentTags || hideTags ? "pointer-events-none bg-transparent" : "bg-slate-200 shadow-sm border-slate-100 opacity-80"}`}
|
||||||
// style={{ height: item.dimensions.height + "px" }}
|
// style={{ height: item.dimensions.height + "px" }}
|
||||||
>
|
>
|
||||||
|
|
@ -1040,9 +1028,7 @@ const SignDocument = () => {
|
||||||
width: `${item.dimensions.width}px`,
|
width: `${item.dimensions.width}px`,
|
||||||
height: `${item.dimensions.height}px`,
|
height: `${item.dimensions.height}px`,
|
||||||
}}
|
}}
|
||||||
// src={saved.signature as string} />
|
src={saved.signature as string} />
|
||||||
src={`data:image/png;base64,${saved.signature}`}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
</div>}
|
</div>}
|
||||||
{/* SIGNATURE FIELD - END */}
|
{/* SIGNATURE FIELD - END */}
|
||||||
|
|
@ -1053,7 +1039,7 @@ const SignDocument = () => {
|
||||||
<div
|
<div
|
||||||
tabIndex={1}
|
tabIndex={1}
|
||||||
id={item.id}
|
id={item.id}
|
||||||
onClick={() => handleSignClick(index , item.id)}
|
onClick={() => handleSignClick(index)}
|
||||||
className={`flex justify-center items-center h-full w-full rounded cursor-pointer ${transparentTags || hideTags ? "pointer-events-none" : "bg-slate-200 shadow-sm border-slate-100 opacity-80"}`}
|
className={`flex justify-center items-center h-full w-full rounded cursor-pointer ${transparentTags || hideTags ? "pointer-events-none" : "bg-slate-200 shadow-sm border-slate-100 opacity-80"}`}
|
||||||
// style={{ height: item.dimensions.height + "px" }}
|
// style={{ height: item.dimensions.height + "px" }}
|
||||||
>
|
>
|
||||||
|
|
@ -1066,9 +1052,7 @@ const SignDocument = () => {
|
||||||
height: `${item.dimensions.height}px`,
|
height: `${item.dimensions.height}px`,
|
||||||
}}
|
}}
|
||||||
className="w-[100%] h-full"
|
className="w-[100%] h-full"
|
||||||
// src={saved.initial as string}
|
src={saved.initial as string} />
|
||||||
src={`data:image/png;base64,${saved.initial}`}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
</div>}
|
</div>}
|
||||||
{/* INITIALS FIELD - END */}
|
{/* INITIALS FIELD - END */}
|
||||||
|
|
@ -1223,7 +1207,7 @@ const SignDocument = () => {
|
||||||
|
|
||||||
{/* Side details of documents Pages and document Name - START */}
|
{/* Side details of documents Pages and document Name - START */}
|
||||||
<p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs left-[-60px] text-slate-600'>
|
<p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs left-[-60px] text-slate-600'>
|
||||||
page {indx + 1} of {doc.pages && doc.pages.length}
|
page {indx + 1} of {doc.images && doc.images.length}
|
||||||
</p>
|
</p>
|
||||||
{/* Side details of documents Pages and document Name - END */}
|
{/* Side details of documents Pages and document Name - END */}
|
||||||
|
|
||||||
|
|
@ -1274,7 +1258,7 @@ const SignDocument = () => {
|
||||||
|
|
||||||
|
|
||||||
<div style={{ display: `${openSign ? 'block' : 'none'}` }}>
|
<div style={{ display: `${openSign ? 'block' : 'none'}` }}>
|
||||||
<SignCon recipientId={recipientId as string} setOpenSign={setOpenSign} saved={saved} setSaved={setSaved} signTagId={signTagId}/>
|
<SignCon recipientId={recipientId as string} setOpenSign={setOpenSign} saved={saved} setSaved={setSaved} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: `${stamp.open ? 'block' : 'none'}` }}>
|
<div style={{ display: `${stamp.open ? 'block' : 'none'}` }}>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,10 @@ import React, { useEffect, useRef } from 'react'
|
||||||
import { IoMdArrowDropdown } from "react-icons/io";
|
import { IoMdArrowDropdown } from "react-icons/io";
|
||||||
import { IoIosSend } from "react-icons/io";
|
import { IoIosSend } from "react-icons/io";
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { setSignType, SignType } from '../../store/slices/selectedDocsSlice';
|
import { setSignType } from '../../store/slices/selectedDocsSlice';
|
||||||
import { RootState } from '../../store/store';
|
import { RootState } from '../../store/store';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Bounce, toast } from 'react-toastify';
|
import { Bounce, toast } from 'react-toastify';
|
||||||
import api from '../../config/api';
|
|
||||||
import { StartCard } from '../home/StartSection';
|
|
||||||
import { setTransactionId, TRANSACTION_STATUS_ENUMS, updateTransactionStatus } from '../../store/slices/transactionSlice';
|
|
||||||
import { SignTypeEnum } from '../../utlity/types';
|
|
||||||
// import { IoMdArrowDropright } from "react-icons/io";
|
// import { IoMdArrowDropright } from "react-icons/io";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -26,54 +22,31 @@ const SendForSign: React.FC<Props> = ({ showSideBar }) => {
|
||||||
sendForSignDropdown && dropDownRef.current?.focus();
|
sendForSignDropdown && dropDownRef.current?.focus();
|
||||||
}, [sendForSignDropdown])
|
}, [sendForSignDropdown])
|
||||||
|
|
||||||
const user = useSelector((state: RootState) => state.user);
|
|
||||||
if (!user.account || user.account === null) {
|
|
||||||
window.location.href = "/login";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultAccountId = user.account.id;
|
|
||||||
|
|
||||||
const selectedDocuments = useSelector((state: RootState) => state.selectedDocuments.selectedDocuments);
|
const selectedDocuments = useSelector((state: RootState) => state.selectedDocuments.selectedDocuments);
|
||||||
|
|
||||||
const handleStartSectionClick = (signType: SignTypeEnum) => {
|
const handleSendSignDispatch: (type: "self-sign" | "multiple-sign") => void = (signType) => {
|
||||||
|
if (selectedDocuments === null || !selectedDocuments.length) {
|
||||||
api.post(`/api/accounts/${defaultAccountId}/transactions`)
|
if (selectedDocuments === null || !selectedDocuments.length) {
|
||||||
.then(res => {
|
toast.dismiss();
|
||||||
if (res.status === 200 || res.status === 201) {
|
toast.error("Select 📄 Documents first!", {
|
||||||
dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_INITIATED));
|
position: "bottom-right",
|
||||||
dispatch(setTransactionId(res.data));
|
autoClose: 5000,
|
||||||
let navigateUrl = `/process-step-one/${defaultAccountId}/${res.data}`;
|
hideProgressBar: false,
|
||||||
if (signType === SignTypeEnum.selfSign) navigateUrl = `/process-step-one/${defaultAccountId}/${res.data}/self_sign`;
|
closeOnClick: false,
|
||||||
setTimeout(() => navigate(navigateUrl), 0)
|
pauseOnHover: true,
|
||||||
|
draggable: true,
|
||||||
|
progress: undefined,
|
||||||
|
theme: "light",
|
||||||
|
transition: Bounce,
|
||||||
|
});
|
||||||
|
return
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch(err => console.log(err))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// const handleSendSignDispatch: (type: "self-sign" | "multiple-sign") => void = (signType) => {
|
if (selectedDocuments.length) {
|
||||||
// if (selectedDocuments === null || !selectedDocuments.length) {
|
dispatch(setSignType(signType));
|
||||||
// if (selectedDocuments === null || !selectedDocuments.length) {
|
}
|
||||||
// toast.dismiss();
|
}
|
||||||
// toast.error("Select 📄 Documents first!", {
|
|
||||||
// position: "bottom-right",
|
|
||||||
// autoClose: 5000,
|
|
||||||
// hideProgressBar: false,
|
|
||||||
// closeOnClick: false,
|
|
||||||
// pauseOnHover: true,
|
|
||||||
// draggable: true,
|
|
||||||
// progress: undefined,
|
|
||||||
// theme: "light",
|
|
||||||
// transition: Bounce,
|
|
||||||
// });
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (selectedDocuments.length) {
|
|
||||||
// dispatch(setSignType(signType));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative max-h-max pb-3'
|
<div className='relative max-h-max pb-3'
|
||||||
|
|
@ -100,12 +73,12 @@ const SendForSign: React.FC<Props> = ({ showSideBar }) => {
|
||||||
{
|
{
|
||||||
sendForSignDropdown &&
|
sendForSignDropdown &&
|
||||||
<div className={`w-[300px] rounded absolute z-40 bg-[var(--sendForSignDropDownBg)] shadow-lg top-[54px] text-left outline-none`}>
|
<div className={`w-[300px] rounded absolute z-40 bg-[var(--sendForSignDropDownBg)] shadow-lg top-[54px] text-left outline-none`}>
|
||||||
<div className='py-3 px-8 leading-6 rounded-t-sm hover:bg-[var(--sendForSignDropDownHover)] cursor-pointer' onClick={() => handleStartSectionClick(SignTypeEnum.selfSign)}>
|
<div className='py-3 px-8 leading-6 rounded-t-sm hover:bg-[var(--sendForSignDropDownHover)] cursor-pointer' onClick={() => handleSendSignDispatch('self-sign')}>
|
||||||
<p>Self Sign</p>
|
<p>Self Sign</p>
|
||||||
<p className='text-[var(--greyTextCol)] text-sm'>You're the only signer.</p>
|
<p className='text-[var(--greyTextCol)] text-sm'>You're the only signer.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='w-full h-[1px] opacity-30 bg-[var(--greyTextCol)]'></div>
|
<div className='w-full h-[1px] opacity-30 bg-[var(--greyTextCol)]'></div>
|
||||||
<div className='py-3 px-8 leading-6 rounded-b-sm hover:bg-[var(--sendForSignDropDownHover)] cursor-pointer' onClick={() => handleStartSectionClick(SignTypeEnum.multipleSign)}>
|
<div className='py-3 px-8 leading-6 rounded-b-sm hover:bg-[var(--sendForSignDropDownHover)] cursor-pointer' onClick={() => handleSendSignDispatch('multiple-sign')}>
|
||||||
<p>Send for Sign</p>
|
<p>Send for Sign</p>
|
||||||
<p className='text-[var(--greyTextCol)] text-sm'>You and other need to sign.</p>
|
<p className='text-[var(--greyTextCol)] text-sm'>You and other need to sign.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import api from '../../config/api';
|
||||||
import { setTransactionId, TRANSACTION_STATUS_ENUMS, updateTransactionStatus } from '../../store/slices/transactionSlice';
|
import { setTransactionId, TRANSACTION_STATUS_ENUMS, updateTransactionStatus } from '../../store/slices/transactionSlice';
|
||||||
|
|
||||||
|
|
||||||
export interface StartCard {
|
interface StartCard {
|
||||||
icon: ReactNode;
|
icon: ReactNode;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
|
@ -57,7 +57,7 @@ const StartSection = () => {
|
||||||
if (res.status === 200 || res.status === 201) {
|
if (res.status === 200 || res.status === 201) {
|
||||||
dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_INITIATED));
|
dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_INITIATED));
|
||||||
dispatch(setTransactionId(res.data));
|
dispatch(setTransactionId(res.data));
|
||||||
setTimeout(() => navigate(`/process-step-one/${defaultAccountId}/${res.data.id}`), 0)
|
setTimeout(() => navigate(`/process-step-one/${defaultAccountId}/${res.data}`), 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err))
|
.catch(err => console.log(err))
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ const DocumentCompletionScreen = () => {
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<div className="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center">
|
<div className="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center">
|
||||||
{/* <FaFileAlt className="text-blue-600 text-xl" /> */}
|
{/* <FaFileAlt className="text-blue-600 text-xl" /> */}
|
||||||
<img src={item.pages[0].src} alt="document" className="h-10 w-10" />
|
<img src={item.images[0].src} alt="document" className="h-10 w-10" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-md font-semibold text-gray-800">
|
<h3 className="text-md font-semibold text-gray-800">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import { hideLoader, showLoader } from "../../../store/slices/loaderSlice";
|
||||||
import Loader from "../../dashboard/Loader";
|
import Loader from "../../dashboard/Loader";
|
||||||
import { Bounce, toast } from "react-toastify";
|
import { Bounce, toast } from "react-toastify";
|
||||||
import { fetchDocuments, resetDocuments, setDocuments, uploadDocuments } from "../../../store/slices/documentSlice";
|
import { fetchDocuments, resetDocuments, setDocuments, uploadDocuments } from "../../../store/slices/documentSlice";
|
||||||
import { SignTypeEnum } from "../../../utlity/types";
|
|
||||||
|
|
||||||
const ProcessStepOne = () => {
|
const ProcessStepOne = () => {
|
||||||
interface EmailDtls {
|
interface EmailDtls {
|
||||||
|
|
@ -24,8 +23,8 @@ const ProcessStepOne = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let transactionTemplateToggle = TRANSACTION_TEMPLATE_TOGGLE.TRANSACTIONS;
|
let transactionTemplateToggle = TRANSACTION_TEMPLATE_TOGGLE.TRANSACTIONS;
|
||||||
|
console.log("transactionTemplateToggle1", transactionTemplateToggle)
|
||||||
const signType = useParams<{ signType: string }>().signType;
|
console.log()
|
||||||
const templateId = useParams<{ templateId: string }>().templateId;
|
const templateId = useParams<{ templateId: string }>().templateId;
|
||||||
let { accountId, transactionId } = useParams<{ accountId: string, transactionId: string }>();
|
let { accountId, transactionId } = useParams<{ accountId: string, transactionId: string }>();
|
||||||
|
|
||||||
|
|
@ -34,11 +33,11 @@ const ProcessStepOne = () => {
|
||||||
|
|
||||||
if (!transactionId) {
|
if (!transactionId) {
|
||||||
transactionTemplateToggle = TRANSACTION_TEMPLATE_TOGGLE.TEMPLATES;
|
transactionTemplateToggle = TRANSACTION_TEMPLATE_TOGGLE.TEMPLATES;
|
||||||
|
console.log("transactionTemplateToggle2", transactionTemplateToggle)
|
||||||
transactionId = templateId;
|
transactionId = templateId;
|
||||||
dispatch(toggleToTemplates());
|
dispatch(toggleToTemplates());
|
||||||
}
|
}
|
||||||
|
console.log("ProcessStepOne called with accountId:", accountId, "and transactionId:", transactionId);
|
||||||
// if (!accountId || !transactionId) {
|
// if (!accountId || !transactionId) {
|
||||||
// window.location.href = "/";
|
// window.location.href = "/";
|
||||||
// return null;
|
// return null;
|
||||||
|
|
@ -49,10 +48,10 @@ const ProcessStepOne = () => {
|
||||||
|
|
||||||
const selectedDocuments = useSelector((state: RootState) => state.documents.documents)
|
const selectedDocuments = useSelector((state: RootState) => state.documents.documents)
|
||||||
const selectedRecipients = useSelector((state: RootState) => state.selectedRecipients.recipients)
|
const selectedRecipients = useSelector((state: RootState) => state.selectedRecipients.recipients)
|
||||||
const userData = useSelector((state: RootState) => state.user)
|
|
||||||
|
|
||||||
console.log("selectedRecipients", selectedRecipients)
|
console.log("selectedRecipients", selectedRecipients)
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
selectedRecipients.length === 0 && dispatch(fetchRecipients({ accountId, transactionId }));
|
selectedRecipients.length === 0 && dispatch(fetchRecipients({ accountId, transactionId }));
|
||||||
selectedDocuments.length === 0 && dispatch(fetchDocuments({ accountId, transactionId }));
|
selectedDocuments.length === 0 && dispatch(fetchDocuments({ accountId, transactionId }));
|
||||||
|
|
@ -86,8 +85,6 @@ const ProcessStepOne = () => {
|
||||||
formError.subject = true
|
formError.subject = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SignTypeEnum.selfSign === signType) formError.recipients = false;
|
|
||||||
|
|
||||||
if (formError.documents || formError.recipients || formError.subject) {
|
if (formError.documents || formError.recipients || formError.subject) {
|
||||||
console.log(selectedDocuments, 'line 193')
|
console.log(selectedDocuments, 'line 193')
|
||||||
toast.dismiss();
|
toast.dismiss();
|
||||||
|
|
@ -152,34 +149,7 @@ const ProcessStepOne = () => {
|
||||||
roleName: recipient.roleName
|
roleName: recipient.roleName
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let recipientsDataTemp = recipientsData;
|
dispatch(addRecipientAsync({ recipientsData, accountId, transactionId }));
|
||||||
|
|
||||||
if (signType === SignTypeEnum.selfSign) {
|
|
||||||
recipientsDataTemp = [{
|
|
||||||
id: null,
|
|
||||||
routingOrder: 1,
|
|
||||||
provideOwnTags: true,
|
|
||||||
type: recipientType.SIGNER,
|
|
||||||
firstName: userData.firstName,
|
|
||||||
lastName: userData.lastName,
|
|
||||||
authType: "NONE",
|
|
||||||
deliveryMethod: "EMAIL",
|
|
||||||
email: userData.email,
|
|
||||||
hostName: "",
|
|
||||||
hostEmail: "",
|
|
||||||
company: "",
|
|
||||||
title: "",
|
|
||||||
website: "",
|
|
||||||
phone: "",
|
|
||||||
accessCode: "",
|
|
||||||
accessCodeDelivery: true,
|
|
||||||
language: "en",
|
|
||||||
name: `${userData.firstName} ${userData.lastName}`,
|
|
||||||
roleName: ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(addRecipientAsync({ recipientsData: recipientsDataTemp, accountId, transactionId }));
|
|
||||||
dispatch(showLoader("Processing Message..."));
|
dispatch(showLoader("Processing Message..."));
|
||||||
|
|
||||||
console.log(`1/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`)
|
console.log(`1/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`)
|
||||||
|
|
@ -232,15 +202,6 @@ const ProcessStepOne = () => {
|
||||||
navigate('/')
|
navigate('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleSelfSignCb = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
if (e.currentTarget.checked) {
|
|
||||||
navigate("self_sign");
|
|
||||||
} else {
|
|
||||||
navigate("./../");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const globalLoader = useSelector((state: RootState) => state.loader)
|
const globalLoader = useSelector((state: RootState) => state.loader)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -258,15 +219,12 @@ const ProcessStepOne = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex items-center gap-3'>
|
<div className='flex items-center gap-3'>
|
||||||
<div className="flex items-center" >
|
<button
|
||||||
<input
|
onClick={() => handleNextClick(true)}
|
||||||
checked={signType === SignTypeEnum.selfSign}
|
className="text-sm px-4 py-2 rounded border border-gray-300 hover:bg-gray-100 transition"
|
||||||
onChange={(e) => handleSelfSignCb(e)}
|
>
|
||||||
id="default-checkbox" type="checkbox" value="" className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded-sm outline-none"
|
Send Now
|
||||||
/>
|
</button>
|
||||||
|
|
||||||
<label htmlFor="default-checkbox" className="ms-2 text-sm text-slate-600">SELF SIGN</label>
|
|
||||||
</div>
|
|
||||||
<button
|
<button
|
||||||
onClick={() => handleNextClick(false)}
|
onClick={() => handleNextClick(false)}
|
||||||
className="text-sm px-4 py-2 rounded bg-[var(--primary)] text-white shadow hover:bg-[var(--primaryLight2)] transition"
|
className="text-sm px-4 py-2 rounded bg-[var(--primary)] text-white shadow hover:bg-[var(--primaryLight2)] transition"
|
||||||
|
|
@ -286,9 +244,7 @@ const ProcessStepOne = () => {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Recipients */}
|
{/* Recipients */}
|
||||||
{
|
<section className="mt-8">
|
||||||
signType !== SignTypeEnum.selfSign &&
|
|
||||||
< section className="mt-8">
|
|
||||||
<h2 className="text-lg font-medium mb-4 pt-6 border-t text-[var(--processStepOneTextHead)]">Signers</h2>
|
<h2 className="text-lg font-medium mb-4 pt-6 border-t text-[var(--processStepOneTextHead)]">Signers</h2>
|
||||||
<div className="flex flex-col gap-4 align-start">
|
<div className="flex flex-col gap-4 align-start">
|
||||||
<RecipientCards />
|
<RecipientCards />
|
||||||
|
|
@ -296,7 +252,6 @@ const ProcessStepOne = () => {
|
||||||
<RecipientAddCard transactionTemplateToggle={transactionTemplateToggle} />
|
<RecipientAddCard transactionTemplateToggle={transactionTemplateToggle} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
}
|
|
||||||
|
|
||||||
{/* Email */}
|
{/* Email */}
|
||||||
<section className="mt-8">
|
<section className="mt-8">
|
||||||
|
|
@ -331,7 +286,7 @@ const ProcessStepOne = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{globalLoader.isLoading && <Loader />}
|
{globalLoader.isLoading && <Loader />}
|
||||||
</div >
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import typeToIconMap from '../../../helper/iconMap';
|
||||||
|
|
||||||
import { IoAdd } from 'react-icons/io5';
|
import { IoAdd } from 'react-icons/io5';
|
||||||
import Loader from '../../dashboard/Loader';
|
import Loader from '../../dashboard/Loader';
|
||||||
// import { TRANSACTION_TEMPLATE_TOGGLE } from "../../../store/slices/selectedRecipientsSlice";
|
|
||||||
import { handleGroupBorderPosition } from '../../../utlity/tagGroupConUtils';
|
import { handleGroupBorderPosition } from '../../../utlity/tagGroupConUtils';
|
||||||
|
|
||||||
export interface DroppedItemsObj {
|
export interface DroppedItemsObj {
|
||||||
|
|
@ -291,8 +290,7 @@ const DocumentContainer: React.FC<DocumentContainerProps> = ({ isSend }) => {
|
||||||
sendTagsToRecipients(tagsData, accountId, transactionId);
|
sendTagsToRecipients(tagsData, accountId, transactionId);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const res = await api.put(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`, { status: "SENT" })
|
const res = await api.put(`/api/accounts/${accountId}/transactions/${transactionId}`, {status: "SENT"})
|
||||||
// const res = await api.put(`/api/accounts/${accountId}/transactions/${transactionId}`, { status: "SENT" })
|
|
||||||
console.log(res, "Check123")
|
console.log(res, "Check123")
|
||||||
})()
|
})()
|
||||||
}, [isSend])
|
}, [isSend])
|
||||||
|
|
@ -778,7 +776,7 @@ const DocumentContainer: React.FC<DocumentContainerProps> = ({ isSend }) => {
|
||||||
|
|
||||||
<div className='flex flex-col gap-3 max-w-max relative left-[50%] translate-x-[-50%]'>
|
<div className='flex flex-col gap-3 max-w-max relative left-[50%] translate-x-[-50%]'>
|
||||||
{
|
{
|
||||||
doc.pages && doc.pages.length > 0 && doc.pages.map((page, indx) => {
|
doc.images && doc.images.length > 0 && doc.images.map((page, indx) => {
|
||||||
const key = `${doc.id}_${page.index}`;
|
const key = `${doc.id}_${page.index}`;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -897,7 +895,7 @@ const DocumentContainer: React.FC<DocumentContainerProps> = ({ isSend }) => {
|
||||||
|
|
||||||
{/* Side details of documents Pages and document Name - START */}
|
{/* Side details of documents Pages and document Name - START */}
|
||||||
<p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs left-[-60px] text-slate-600'>
|
<p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs left-[-60px] text-slate-600'>
|
||||||
page {indx + 1} of {doc.pages && doc.pages.length}
|
page {indx + 1} of {doc.images && doc.images.length}
|
||||||
</p>
|
</p>
|
||||||
{/* <p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs right-[-140px] text-slate-600'>
|
{/* <p className='absolute top-[50%] translate-y-[-50%] rotate-[-90deg] text-xs right-[-140px] text-slate-600'>
|
||||||
Document {indxDoc + 1} {doc.name}
|
Document {indxDoc + 1} {doc.name}
|
||||||
|
|
@ -929,6 +927,6 @@ const DocumentContainer: React.FC<DocumentContainerProps> = ({ isSend }) => {
|
||||||
{/* Center Doc Container - END */}
|
{/* Center Doc Container - END */}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DocumentContainer;
|
export default DocumentContainer;
|
||||||
|
|
@ -133,10 +133,10 @@ const LeftSideBar: React.FC<LeftSideBarProps> = ({ isFields, selectedRecipientIn
|
||||||
onClick={() => setDropDownTogglePage(`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`)}
|
onClick={() => setDropDownTogglePage(`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`)}
|
||||||
className={`p-2 ${(dropDownTogglePage === 'pageDropDown' + indx) ? "bg-[var(--primary)]" : "bg-slate-200"} flex flex-col justify-center items-center gap-2 rounded`}>
|
className={`p-2 ${(dropDownTogglePage === 'pageDropDown' + indx) ? "bg-[var(--primary)]" : "bg-slate-200"} flex flex-col justify-center items-center gap-2 rounded`}>
|
||||||
{
|
{
|
||||||
document.pages != undefined && <img
|
document.images != undefined && <img
|
||||||
key={indx}
|
key={indx}
|
||||||
className='rounded-sm shadow'
|
className='rounded-sm shadow'
|
||||||
src={document.pages[0].src}
|
src={document.images[0].src}
|
||||||
alt="" />
|
alt="" />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ const LeftSideBar: React.FC<LeftSideBarProps> = ({ isFields, selectedRecipientIn
|
||||||
{
|
{
|
||||||
dropDownTogglePage === 'pageDropDown' + indx &&
|
dropDownTogglePage === 'pageDropDown' + indx &&
|
||||||
<div className='my-1 flex justify-center items-center gap-1 flex-wrap'>
|
<div className='my-1 flex justify-center items-center gap-1 flex-wrap'>
|
||||||
{document.pages != undefined && document.pages.map((img, indx) => (
|
{document.images != undefined && document.images.map((img, indx) => (
|
||||||
<a
|
<a
|
||||||
href={"#" + document.id + indx}
|
href={"#" + document.id + indx}
|
||||||
className='max-w-max px-4 py-2 shadow cursor-pointer border-1 rounded-sm border-slate-200 hover:border-[var(--primary)] transition-all duration-300 bg-slate-300'
|
className='max-w-max px-4 py-2 shadow cursor-pointer border-1 rounded-sm border-slate-200 hover:border-[var(--primary)] transition-all duration-300 bg-slate-300'
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import { Bounce, toast } from "react-toastify";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { SaveType } from '../client/SignDocument';
|
import { SaveType } from '../client/SignDocument';
|
||||||
import { CiSaveDown1 } from 'react-icons/ci';
|
import { CiSaveDown1 } from 'react-icons/ci';
|
||||||
import api from '../../config/api';
|
|
||||||
|
|
||||||
interface Signature {
|
interface Signature {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -55,7 +54,6 @@ interface AddSignatureModalProps {
|
||||||
setOpenSign: React.Dispatch<React.SetStateAction<boolean>>;
|
setOpenSign: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
saved: SaveType;
|
saved: SaveType;
|
||||||
setSaved: React.Dispatch<React.SetStateAction<SaveType>>;
|
setSaved: React.Dispatch<React.SetStateAction<SaveType>>;
|
||||||
signTagId: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Account {
|
interface Account {
|
||||||
|
|
@ -82,12 +80,9 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
setOpenSign,
|
setOpenSign,
|
||||||
recipientId,
|
recipientId,
|
||||||
saved,
|
saved,
|
||||||
setSaved,
|
setSaved
|
||||||
signTagId
|
|
||||||
}) => {
|
}) => {
|
||||||
|
const [activeTab, setActiveTab] = useState<'TYPED' | 'DRAW' | 'UPLOAD'>('TYPED');
|
||||||
console.log("savedModal", saved)
|
|
||||||
const [activeTab, setActiveTab] = useState<'TYPED' | 'DRAW' | 'UPLOAD' | 'SAVED'>('TYPED');
|
|
||||||
const [fullName, setFullName] = useState('');
|
const [fullName, setFullName] = useState('');
|
||||||
const [initials, setInitials] = useState('');
|
const [initials, setInitials] = useState('');
|
||||||
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
||||||
|
|
@ -105,22 +100,6 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
{ id: 6, name: 'classic', initials: 'LA', style: 'classic' },
|
{ id: 6, name: 'classic', initials: 'LA', style: 'classic' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// User data
|
|
||||||
const [user, setUser] = useState<UserData>({
|
|
||||||
id: "",
|
|
||||||
firstName: "",
|
|
||||||
lastName: "",
|
|
||||||
email: "",
|
|
||||||
language: "",
|
|
||||||
account: {
|
|
||||||
id: 0,
|
|
||||||
isDefault: false,
|
|
||||||
name: "",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("User data", user)
|
|
||||||
|
|
||||||
const [selectedSignature, setSelectedSignature] = useState<SelectStyle>(
|
const [selectedSignature, setSelectedSignature] = useState<SelectStyle>(
|
||||||
signatureOptions.length > 0 ? { id: signatureOptions[0].id, style: signatureOptions[0].style } : { id: 0, style: "" }
|
signatureOptions.length > 0 ? { id: signatureOptions[0].id, style: signatureOptions[0].style } : { id: 0, style: "" }
|
||||||
);
|
);
|
||||||
|
|
@ -133,8 +112,21 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
const [preview1, setPreview1] = useState<string | null>(null);
|
const [preview1, setPreview1] = useState<string | null>(null);
|
||||||
const [preview2, setPreview2] = useState<string | null>(null);
|
const [preview2, setPreview2] = useState<string | null>(null);
|
||||||
|
|
||||||
const [preSaveSignatures, setPreSaveSignatures] = useState([])
|
// User data
|
||||||
|
// const [user, setUser] = useState<UserData>({
|
||||||
|
// id: "",
|
||||||
|
// firstName: "",
|
||||||
|
// lastName: "",
|
||||||
|
// email: "",
|
||||||
|
// language: "",
|
||||||
|
// account: {
|
||||||
|
// id: 0,
|
||||||
|
// isDefault: false,
|
||||||
|
// name: "",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const isEditMode = !!editingSignature;
|
||||||
|
|
||||||
// Navigation items
|
// Navigation items
|
||||||
const navigationItems = [
|
const navigationItems = [
|
||||||
|
|
@ -144,6 +136,34 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
{ id: 'SAVED', label: 'SAVED', icon: <CiSaveDown1 className="w-5 h-5" /> },
|
{ id: 'SAVED', label: 'SAVED', icon: <CiSaveDown1 className="w-5 h-5" /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Initialize form with editing signature data
|
||||||
|
// useEffect(() => {
|
||||||
|
// if (editingSignature) {
|
||||||
|
// setFullName(`${editingSignature.firstName} ${editingSignature.lastName}`);
|
||||||
|
// setInitials(`${editingSignature.firstName.slice(0, 1)}${editingSignature.lastName.slice(0, 1)}`);
|
||||||
|
// setActiveTab(editingSignature.signatureType as 'TYPED' | 'DRAW' | 'UPLOAD');
|
||||||
|
|
||||||
|
// // Set font for SELECT tab
|
||||||
|
// const fontOption = signatureOptions.find(option => option.style === editingSignature.font);
|
||||||
|
// if (fontOption) {
|
||||||
|
// setSelectedSignature({ id: fontOption.id, style: fontOption.style });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Set signature blobs for all tabs
|
||||||
|
// if (editingSignature.signatureBlob && editingSignature.initialsBlob) {
|
||||||
|
// setSignatures({
|
||||||
|
// fullSignature: `data:image/png;base64,${editingSignature.signatureBlob}`,
|
||||||
|
// initials: `data:image/png;base64,${editingSignature.initialsBlob}`
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // Set preview URLs for UPLOAD tab
|
||||||
|
// if (editingSignature.signatureType === 'UPLOAD') {
|
||||||
|
// setPreview1(`data:image/png;base64,${editingSignature.signatureBlob}`);
|
||||||
|
// setPreview2(`data:image/png;base64,${editingSignature.initialsBlob}`);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }, [editingSignature]);
|
||||||
|
|
||||||
const handleSignatureChange = (data: { fullSignature: string | null; initials: string | null }) => {
|
const handleSignatureChange = (data: { fullSignature: string | null; initials: string | null }) => {
|
||||||
setSignatures(data);
|
setSignatures(data);
|
||||||
|
|
@ -157,10 +177,8 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
"ngrok-skip-browser-warning": "69420"
|
"ngrok-skip-browser-warning": "69420"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (res?.data) {
|
|
||||||
let preSavedSignatures = res?.data
|
console.log(res, "Geting Signatures")
|
||||||
setPreSaveSignatures(preSavedSignatures)
|
|
||||||
}
|
|
||||||
})()
|
})()
|
||||||
}, [])
|
}, [])
|
||||||
// Getting Signatures - END
|
// Getting Signatures - END
|
||||||
|
|
@ -207,7 +225,7 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
console.log("handleSubmit Called")
|
console.log("handleSubmit Called")
|
||||||
if (!signatures.fullSignature || !signatures.initials) {
|
if (!signatures.fullSignature || !signatures.initials) {
|
||||||
alert('Please provide both signature and initials');
|
alert('Please provide both signature and initials');
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
|
|
@ -216,18 +234,15 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
tagId: signTagId,
|
signatureType: activeTab,
|
||||||
// signatureId: signatureId,
|
signatureBase64: signatures.fullSignature,
|
||||||
type: activeTab,
|
initialsBase64: signatures.initials,
|
||||||
firstName: fullName.split(' ')[0] || user.firstName,
|
firstName: fullName.split(' ')[0] || user.firstName,
|
||||||
lastName: fullName.split(' ')[1] || user.lastName,
|
lastName: fullName.split(' ')[1] || user.lastName,
|
||||||
initials: "",
|
|
||||||
initialsBase64: signatures.initials,
|
|
||||||
signatureBase64: signatures.fullSignature,
|
|
||||||
font: selectedSignature.style
|
font: selectedSignature.style
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("payload", payload)
|
let res;
|
||||||
// if (isEditMode && editingSignature) {
|
// if (isEditMode && editingSignature) {
|
||||||
// // Update existing signature
|
// // Update existing signature
|
||||||
// const updatePayload = {
|
// const updatePayload = {
|
||||||
|
|
@ -250,7 +265,7 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
// });
|
// });
|
||||||
// } else {
|
// } else {
|
||||||
// Create new signature
|
// Create new signature
|
||||||
let res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/signatures?recipientId=${recipientId}`,
|
res = await axios.post(`${import.meta.env.VITE_BASE_URI}/api/user/signatures`,
|
||||||
payload,
|
payload,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -273,19 +288,9 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
setSignatures({
|
await getAllSignatures();
|
||||||
fullSignature:"",
|
setShowAddSignature?.(false);
|
||||||
initials:"",
|
|
||||||
})
|
|
||||||
setSaved({
|
|
||||||
saveType: res.data.signatureType ?? null,
|
|
||||||
save: true,
|
|
||||||
signature: res.data.signatureBlob ?? null,
|
|
||||||
initial: res.data.initialsBlob ?? null,
|
|
||||||
});
|
|
||||||
setOpenSign(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting signature:", error);
|
console.error("Error submitting signature:", error);
|
||||||
// toast.error(isEditMode ? "Failed to update signature" : "Failed to create signature", {
|
// toast.error(isEditMode ? "Failed to update signature" : "Failed to create signature", {
|
||||||
|
|
@ -426,105 +431,32 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case 'SAVED':
|
|
||||||
return (
|
|
||||||
<div className="h-full flex flex-col ">
|
|
||||||
<div className="mb-6">
|
|
||||||
<h2 className="text-xl font-semibold text-gray-900 mb-2">Saved Signature's</h2>
|
|
||||||
{/* <p className="text-sm text-gray-600">Select from pre-designed signature styles</p> */}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex-1 overflow-y-auto">
|
|
||||||
<div className="space-y-4">
|
|
||||||
{preSaveSignatures.map((signature) => (
|
|
||||||
<div key={signature?.id} className="grid grid-cols-12 gap-4 px-6 py-9 hover:bg-gray-50 transition-colors duration-150">
|
|
||||||
{/* Signature Column */}
|
|
||||||
<div className="col-span-5">
|
|
||||||
<div className="flex flex-col space-y-2 relative ps-6 border-l-3 border-blue-600 rounded-bl-2xl rounded-tl-2xl">
|
|
||||||
<div className="text-sm text-gray-600 font-medium mb-1">
|
|
||||||
Signed by:
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Signature Image or Fallback Text */}
|
|
||||||
<div className="bg-white rounded-lg p-1 flex items-center justify-center">
|
|
||||||
{signature?.signatureBlob ? (
|
|
||||||
<img
|
|
||||||
src={`data:${signature?.signatureMimeType || "image/png"};base64,${signature?.signatureBlob}`}
|
|
||||||
className="h-[50px] w-[250px] object-contain"
|
|
||||||
alt="Signature"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="text-gray-400 italic text-sm">No Signature</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Name */}
|
|
||||||
<div className="text-xs text-gray-500 truncate">
|
|
||||||
{signature?.signatureHash ?? ' '}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Initial Column */}
|
|
||||||
<div className="col-span-5">
|
|
||||||
<div className="flex flex-col space-y-2 relative ps-6 border-l-3 border-green-600 rounded-bl-2xl rounded-tl-2xl">
|
|
||||||
<div className="text-sm text-gray-600 font-medium mb-1">
|
|
||||||
Initials
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Initials Image */}
|
|
||||||
<div className="bg-white rounded-lg p-1 flex items-center justify-center">
|
|
||||||
{signature?.initialsBlob ? (
|
|
||||||
<img
|
|
||||||
src={`data:image/png;base64,${signature?.initialsBlob}`}
|
|
||||||
className="h-[50px] object-contain"
|
|
||||||
alt="Initials"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="text-gray-400 italic text-sm">No Initials</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Optional initials hash or font */}
|
|
||||||
<div className="text-xs text-gray-500 truncate">
|
|
||||||
{signature?.initialsHash || " "}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUserDetails = async () => {
|
// const getUserDetails = async () => {
|
||||||
try {
|
// try {
|
||||||
let res = await axios.get(`/api/user/details`, {
|
// let res = await api.get(`/api/user/details`);
|
||||||
headers: {
|
// console.log("getuser", res);
|
||||||
"ngrok-skip-browser-warning": "69420",
|
// let currUser = res?.data;
|
||||||
}
|
// setUser(currUser);
|
||||||
});
|
|
||||||
console.log("getuser", res);
|
|
||||||
let currUser = res?.data;
|
|
||||||
setUser(currUser);
|
|
||||||
|
|
||||||
setFullName(currUser.firstName + " " + currUser.lastName);
|
// // Only set default values if not in edit mode
|
||||||
setInitials(currUser.firstName.slice(0, 1) + currUser.lastName.slice(0, 1));
|
// if (!isEditMode) {
|
||||||
} catch (error) {
|
// setFullName(currUser.firstName + " " + currUser.lastName);
|
||||||
console.error("Error fetching user details:", error);
|
// setInitials(currUser.firstName.slice(0, 1) + currUser.lastName.slice(0, 1));
|
||||||
}
|
// }
|
||||||
};
|
// } catch (error) {
|
||||||
|
// console.error("Error fetching user details:", error);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
getUserDetails();
|
// getUserDetails();
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 backdrop-blur-sm bg-opacity-50 flex items-center justify-center z-50 p-4">
|
<div className="fixed inset-0 backdrop-blur-sm bg-opacity-50 flex items-center justify-center z-50 p-4">
|
||||||
|
|
@ -536,7 +468,7 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
<div className="px-4 py-4 border-b border-gray-200">
|
<div className="px-4 py-4 border-b border-gray-200">
|
||||||
<div className="flex items-center space-x-3">
|
<div className="flex items-center space-x-3">
|
||||||
<div className='px-1 py-1'>
|
<div className='px-1 py-1'>
|
||||||
<h3 className="text-md font-semibold text-gray-900">Add Signature Sign</h3>
|
<h3 className="text-md font-semibold text-gray-900">Add Signature</h3>
|
||||||
<p className="text-xs text-gray-500">Create your digital signature</p>
|
<p className="text-xs text-gray-500">Create your digital signature</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -579,7 +511,7 @@ const AddSignatureModal: React.FC<AddSignatureModalProps> = ({
|
||||||
{navigationItems.map((item) => (
|
{navigationItems.map((item) => (
|
||||||
<button
|
<button
|
||||||
key={item.id}
|
key={item.id}
|
||||||
onClick={() => setActiveTab(item.id as 'TYPED' | 'DRAW' | 'UPLOAD' | 'SAVED')}
|
onClick={() => setActiveTab(item.id as 'TYPED' | 'DRAW' | 'UPLOAD')}
|
||||||
className={`w-full flex items-center space-x-3 px-2 py-2 text-sm font-medium rounded-lg cursor-pointer transition-colors ${activeTab === item.id
|
className={`w-full flex items-center space-x-3 px-2 py-2 text-sm font-medium rounded-lg cursor-pointer transition-colors ${activeTab === item.id
|
||||||
? 'bg-blue-50 text-blue-700 border border-blue-200'
|
? 'bg-blue-50 text-blue-700 border border-blue-200'
|
||||||
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,6 @@ canvas {
|
||||||
|
|
||||||
/* Group Border - END */
|
/* Group Border - END */
|
||||||
|
|
||||||
|
|
||||||
/* Loader CSS */
|
/* Loader CSS */
|
||||||
/* From Uiverse.io by Juanes200122 */
|
/* From Uiverse.io by Juanes200122 */
|
||||||
.pl {
|
.pl {
|
||||||
|
|
@ -335,12 +334,3 @@ canvas {
|
||||||
stroke-dashoffset: -440;
|
stroke-dashoffset: -440;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.bottom-border>div:hover {
|
|
||||||
background-color: var(--primaryLight2) ;
|
|
||||||
opacity: 0.9;
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Group Border - END */
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export interface SelectedDocument {
|
||||||
extension: string;
|
extension: string;
|
||||||
original: boolean;
|
original: boolean;
|
||||||
corrupted?: boolean;
|
corrupted?: boolean;
|
||||||
pages?: Image[];
|
images?: Image[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PayloadSelectedDocument {
|
export interface PayloadSelectedDocument {
|
||||||
|
|
@ -30,7 +30,7 @@ export interface PayloadSelectedDocument {
|
||||||
extension: string;
|
extension: string;
|
||||||
original: boolean;
|
original: boolean;
|
||||||
corrupted?: boolean;
|
corrupted?: boolean;
|
||||||
pages?: Image[];
|
images?: Image[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SelectedDocumentsState {
|
interface SelectedDocumentsState {
|
||||||
|
|
@ -87,7 +87,7 @@ const selectedDocumentsSlice = createSlice({
|
||||||
const docId = document.documentId;
|
const docId = document.documentId;
|
||||||
for (const [index, selDoc] of state.selectedDocuments.entries()) {
|
for (const [index, selDoc] of state.selectedDocuments.entries()) {
|
||||||
if (selDoc.id === docId) {
|
if (selDoc.id === docId) {
|
||||||
state.selectedDocuments[index].pages = document.pages;
|
state.selectedDocuments[index].images = document.images;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,6 @@ export interface Recipient {
|
||||||
type: recipientType;
|
type: recipientType;
|
||||||
color?: string;
|
color?: string;
|
||||||
roleName:string
|
roleName:string
|
||||||
provideOwnTags?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectedRecipientInt {
|
export interface SelectedRecipientInt {
|
||||||
|
|
|
||||||
|
|
@ -101,25 +101,19 @@ export interface TagsProperties {
|
||||||
|
|
||||||
|
|
||||||
export enum TagsTypes {
|
export enum TagsTypes {
|
||||||
TEXT = "text",
|
TEXT= "text",
|
||||||
SIGNATURE = "signature",
|
SIGNATURE= "signature",
|
||||||
INITIALS = "initials",
|
INITIALS= "initials",
|
||||||
TEMPORAL = "temporal",
|
TEMPORAL= "temporal",
|
||||||
NUMBER = "number",
|
NUMBER= "number",
|
||||||
IMAGE = "image",
|
IMAGE= "image",
|
||||||
STAMP = "stamp",
|
STAMP= "stamp",
|
||||||
CHECKBOX = "checkbox",
|
CHECKBOX= "checkbox",
|
||||||
SELECT = "select",
|
SELECT= "select",
|
||||||
FILE = "file",
|
FILE= "file",
|
||||||
ATTACHMENT = "attachment",
|
ATTACHMENT= "attachment",
|
||||||
RADIO = "radio",
|
RADIO= "radio",
|
||||||
EMAIL = "email",
|
EMAIL= "email",
|
||||||
NAME = "name",
|
NAME= "name",
|
||||||
COMPANY = "company",
|
COMPANY= "company",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export enum SignTypeEnum {
|
|
||||||
selfSign = "self_sign",
|
|
||||||
multipleSign = "multi_sign"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue