Skip to content

Commit 75ad566

Browse files
Merge pull request #1841 from OpenSignLabs/updates-16144605887
v2.26.1
2 parents cb3e31e + fda9fb5 commit 75ad566

File tree

10 files changed

+181
-102
lines changed

10 files changed

+181
-102
lines changed

apps/OpenSign/public/locales/de/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"certificate": "Zertifikat",
380380
"decline": "Ablehnen",
381381
"finish": "Fertigstellen",
382+
"done": "Fertig",
382383
"mail": "E-Mail",
383384
"sign-now": "Jetzt unterzeichnen",
384385
"successfully-signed": "Erfolgreich unterzeichnet!",

apps/OpenSign/public/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"certificate": "Certificate",
380380
"decline": "Decline",
381381
"finish": "Finish",
382+
"done": "Done",
382383
"mail": "Mail",
383384
"sign-now": "Sign now",
384385
"successfully-signed": "Successfully signed!",

apps/OpenSign/public/locales/es/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380
"certificate": "Certificado",
381381
"decline": "Rechazar",
382382
"finish": "Finalizar",
383+
"done": "Hecho",
383384
"mail": "Correo",
384385
"sign-now": "Firmar ahora",
385386
"successfully-signed": "¡Firmado exitosamente!",

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"certificate": "Certificat",
380380
"decline": "refusé",
381381
"finish": "terminé",
382+
"done": "Terminé",
382383
"mail": "Mail",
383384
"sign-now": "Signez maintenant",
384385
"successfully-signed": "Signé avec succès !",

apps/OpenSign/public/locales/hi/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"certificate": "प्रमाण पत्र",
380380
"decline": "अस्वीकार करें",
381381
"finish": "समाप्त करें",
382+
"done": "हो गया",
382383
"mail": "मेल",
383384
"sign-now": "अभी हस्ताक्षर करें",
384385
"successfully-signed": "सफलतापूर्वक हस्ताक्षर किए गए!",

apps/OpenSign/public/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"certificate": "Certificato",
380380
"decline": "Rifiuta",
381381
"finish": "Completa",
382+
"done": "Fatto",
382383
"mail": "Email",
383384
"sign-now": "Firma ora",
384385
"successfully-signed": "Firmato con successo!",

apps/OpenSign/src/components/Header.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,13 @@ const Header = ({ showSidebar, setIsMenu, isConsole }) => {
123123
<div className="h-[25px] md:h-[40px] w-auto overflow-hidden">
124124
{applogo && (
125125
<img
126+
className="object-contain h-full w-auto"
126127
src={
127128
isDarkTheme
128129
? "/static/js/assets/images/logo-dark.png"
129130
: applogo
130131
}
132+
alt="logo"
131133
/>
132134
)}
133135
</div>

apps/OpenSign/src/components/pdf/PlaceholderType.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function PlaceholderType(props) {
108108
alt="signature"
109109
draggable="false"
110110
src={props.pos.SignUrl}
111-
className="w-full h-full select-none-cls "
111+
className={`${props.pos.signatureType !== "type" ? "object-contain" : ""} w-full h-full select-none-cls`}
112112
/>
113113
) : (
114114
<div className={widgetCls}>
@@ -132,7 +132,7 @@ function PlaceholderType(props) {
132132
alt="stamp"
133133
draggable="false"
134134
src={props.pos.SignUrl}
135-
className="w-full h-full select-none-cls"
135+
className="w-full h-full select-none-cls object-contain"
136136
/>
137137
) : (
138138
<div className={widgetCls}>
@@ -253,7 +253,7 @@ function PlaceholderType(props) {
253253
alt="initials"
254254
draggable="false"
255255
src={props.pos.SignUrl}
256-
className="w-full h-full select-none-cls"
256+
className={`${props.pos.signatureType !== "type" ? "object-contain" : ""} w-full h-full select-none-cls`}
257257
/>
258258
) : (
259259
<div className={widgetCls}>
@@ -402,7 +402,7 @@ function PlaceholderType(props) {
402402
alt="image"
403403
draggable="false"
404404
src={props.pos.SignUrl}
405-
className="w-full h-full select-none-cls"
405+
className="w-full h-full select-none-cls object-contain"
406406
/>
407407
) : (
408408
<div className={widgetCls}>

apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
cellsWidget,
1919
textWidget,
2020
years,
21-
convertTextToImg
21+
convertTextToImg,
22+
convertJpegToPng
2223
} from "../../constant/Utils";
2324
import CellsWidget from "./CellsWidget";
2425
import DatePicker from "react-datepicker";
@@ -110,7 +111,6 @@ function WidgetsValueModal(props) {
110111
const [signature, setSignature] = useState();
111112
const [isImageSelect, setIsImageSelect] = useState(false);
112113
const [isFinish, setIsFinish] = useState(false);
113-
const [imgWH, setImgWH] = useState({});
114114
const [fontSelect, setFontSelect] = useState(fontOptions[0].value);
115115
const [isSavedSign, setIsSavedSign] = useState(false);
116116
const [isAutoSign, setIsAutoSign] = useState(false);
@@ -257,11 +257,11 @@ function WidgetsValueModal(props) {
257257
setOriginalImage(null); // Reset original image when a new file is selected
258258
setRemoveBgEnabled(false); // Optionally reset toggle
259259
// Ensure compressedFileSize calls setImage, which then triggers the useEffect for BG removal.
260-
compressedFileSize(file, setImgWH, setImage);
260+
compressedFileSize(file, setImage);
261261
}
262262
};
263263
//function is used to save image,stamp widgets data
264-
const handleSaveImage = () => {
264+
const handleSaveImage = (signatureType) => {
265265
const widgetsType = currWidgetsDetails?.type;
266266
//`isApplyAll` is used when user edit stamp then updated signature apply all existing drawn signatures
267267
const isApplyAll = true;
@@ -278,10 +278,10 @@ function WidgetsValueModal(props) {
278278

279279
// Get updated placeholder list
280280
const updatedPlaceholders = onSaveImage(
281+
signatureType,
281282
signer.placeHolder,
282283
index,
283284
currWidgetsDetails?.key,
284-
imgWH,
285285
image,
286286
isAutoSign,
287287
widgetsType,
@@ -299,48 +299,42 @@ function WidgetsValueModal(props) {
299299
return object.pageNumber === pageNumber;
300300
});
301301
const getImage = onSaveImage(
302+
signatureType,
302303
props?.xyPosition,
303304
index,
304305
currWidgetsDetails?.key,
305-
imgWH,
306-
image
306+
image,
307+
false,
308+
widgetsType
307309
);
308310
setXyPosition(getImage);
309311
}
310312
setIsAutoSign(false);
311313
};
312314

313315
//function is used to save draw type or initial type signature
314-
const handleSaveSignature = (
315-
type,
316+
const handleSaveSignature = async (
317+
signType,
316318
isDefaultSign,
317319
width,
318320
height,
319321
typedSignature
320322
) => {
321-
//get current click widget type
323+
// get current click widget type
322324
const widgetsType = currWidgetsDetails?.type;
323-
//if there are any width and height then it will typed signature
325+
// if there are any width and height then it will typed signature
324326
const isTypeText = width && height ? true : false;
325-
//final getting signature url via default select sign/default initial sign/self draw sign
326-
const signatureImg = isDefaultSign
327+
// final getting signature url via default select sign/default initial sign/self draw sign
328+
const signUrl = isDefaultSign
327329
? isDefaultSign === "initials"
328-
? myInitial
329-
: defaultSignImg
330-
: signature;
331-
330+
? await convertJpegToPng(myInitial, "myinitials") // default initials set through my signature tab
331+
: await convertJpegToPng(defaultSignImg, "mysign") // default signature set through my signature tab
332+
: signature; // signature done by user thorugh draw, upload, typed
333+
const signatureImg = signUrl;
332334
let imgWH = { width: width ? width : "", height: height ? height : "" };
333335
setIsImageSelect(false);
334336
setImage();
335-
//set default signature image width and height
336-
if (isDefaultSign) {
337-
const img = new Image();
338-
img.src = defaultSignImg;
339-
if (img.complete) {
340-
imgWH = { width: img.width, height: img.height };
341-
}
342-
}
343-
//`isApplyAll` is used when user edit signature/initial then updated signature apply all existing drawn signatures
337+
// `isApplyAll` is used when user edit signature/initial then updated signature apply all existing drawn signatures
344338
const isApplyAll = true;
345339
if (uniqueId) {
346340
setXyPosition((prevState) =>
@@ -351,13 +345,12 @@ function WidgetsValueModal(props) {
351345
(x) => x.pageNumber === pageNumber
352346
);
353347
const updatedPlaceholders = onSaveSign(
354-
type,
348+
signType,
355349
signer.placeHolder,
356350
placeholderIndex,
357351
currWidgetsDetails?.key,
358352
signatureImg,
359353
imgWH,
360-
isDefaultSign,
361354
isTypeText,
362355
typedSignature,
363356
isAutoSign,
@@ -377,13 +370,12 @@ function WidgetsValueModal(props) {
377370
return object.pageNumber === pageNumber;
378371
});
379372
const getUpdatePosition = onSaveSign(
380-
type,
373+
signType,
381374
props?.xyPosition,
382375
index,
383376
currWidgetsDetails?.key,
384377
signatureImg,
385378
imgWH,
386-
isDefaultSign,
387379
isTypeText,
388380
typedSignature,
389381
false,
@@ -535,7 +527,7 @@ function WidgetsValueModal(props) {
535527
}
536528
};
537529

538-
// `handlesavesign` is used to save signaute, initials, stamp as a default
530+
// `handlesavesign` is used to save signature, initials, stamp as a default
539531
const handleSaveSign = async () => {
540532
if (signature || image?.src) {
541533
setIsLoader(true);
@@ -556,7 +548,7 @@ function WidgetsValueModal(props) {
556548
objectId: User?.id
557549
};
558550
if (imageUrl) {
559-
// below code is used to save or update default signaute, initials, stamp
551+
// below code is used to save or update default signature, initials, stamp
560552
try {
561553
const signCls = new Parse.Object("contracts_Signature");
562554
if (props?.saveSignCheckbox?.signId) {
@@ -642,13 +634,14 @@ function WidgetsValueModal(props) {
642634
} else {
643635
setSignature("");
644636
canvasRef?.current?.clear();
645-
handleSaveSignature(isTab);
637+
const tab = isTab === "uploadImage" ? "image" : isTab;
638+
handleSaveSignature(tab);
646639
}
647640
}
648641
setPenColor("blue");
649642
} else {
650643
setSignature("");
651-
handleSaveImage();
644+
handleSaveImage("image");
652645
}
653646
setIsImageSelect(false);
654647
setIsDefaultSign(false);
@@ -1178,7 +1171,9 @@ function WidgetsValueModal(props) {
11781171
hidden
11791172
/>
11801173
<i className="fa-light fa-cloud-upload-alt uploadImgLogo text-base-content"></i>
1181-
<div className="text-[10px] text-base-content">{t("upload")}</div>
1174+
<div className="text-[10px] text-base-content">
1175+
{t("upload")}
1176+
</div>
11821177
</div>
11831178
</div>
11841179
) : (
@@ -1324,7 +1319,6 @@ function WidgetsValueModal(props) {
13241319
dotSize={1}
13251320
/>
13261321
</div>
1327-
13281322
<div className="flex flex-row justify-between mt-[10px]">
13291323
<PenColorComponent />
13301324
</div>
@@ -1988,7 +1982,7 @@ function WidgetsValueModal(props) {
19881982
handleClickOnNext(isFinishDoc);
19891983
}}
19901984
>
1991-
{t("finish")}
1985+
{t("done")}
19921986
</button>
19931987
) : (
19941988
<button

0 commit comments

Comments
 (0)