Skip to content

Commit fce20a1

Browse files
Merge pull request #2083 from OpenSignLabs/updates-20846982071
fix: handle overlapping of date modal
2 parents 0891cf5 + 3a737ea commit fce20a1

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ const EditTemplate = ({
577577
e.target.setCustomValidity(t("input-required"))
578578
}
579579
onInput={(e) => e.target.setCustomValidity("")}
580+
min={1}
580581
required
581582
/>
582583
</div>

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ import {
2525
import PlaceholderType from "./PlaceholderType";
2626
import moment from "moment";
2727
import "../../styles/opensigndrive.css";
28-
import ModalUi from "../../primitives/ModalUi";
2928
import { useTranslation } from "react-i18next";
3029
import { useDispatch } from "react-redux";
3130
import { setIsShowModal } from "../../redux/reducers/widgetSlice";
3231
import { themeColor } from "../../constant/const";
3332
import { useGuidelinesContext } from "../../context/GuidelinesContext";
3433
import DatePicker from "react-datepicker";
34+
import DateWidgetModal from "../../primitives/DateWidgetModal";
3535

3636
function Placeholder(props) {
3737
const { t } = useTranslation();
@@ -655,6 +655,9 @@ function Placeholder(props) {
655655
setIsToday(false);
656656
setSelectDate((prev) => ({ ...prev, date: "" }));
657657
};
658+
const handleCloseDateModal = () => {
659+
setIsDateModal(false);
660+
};
658661
return (
659662
<>
660663
{/* Check if a text widget (prefill type) exists. Once the user enters a value and clicks outside or the widget becomes non-selectable, it should appear as plain text (just like embedded text in a document). When the user clicks on the text again, it should become editable. */}
@@ -923,7 +926,7 @@ function Placeholder(props) {
923926
</div>
924927
</Rnd>
925928
)}
926-
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
929+
<DateWidgetModal isOpen={isDateModal} title={t("widget-info")}>
927930
<div className="text-base-content h-[100%] p-[20px]">
928931
<div className="flex flex-col gap-3">
929932
<div className="flex flex-col md:items-center md:flex-row gap-y-3">
@@ -1132,8 +1135,15 @@ function Placeholder(props) {
11321135
>
11331136
{t("save")}
11341137
</button>
1138+
<button
1139+
type="button"
1140+
className="op-btn op-btn-ghost text-base-content ml-1"
1141+
onClick={() => handleCloseDateModal()}
1142+
>
1143+
{t("cancel")}
1144+
</button>
11351145
</div>
1136-
</ModalUi>
1146+
</DateWidgetModal>
11371147
</>
11381148
);
11391149
}

apps/OpenSign/src/pages/Form.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ const Forms = (props) => {
960960
e.target.setCustomValidity(t("input-required"))
961961
}
962962
onInput={(e) => e.target.setCustomValidity("")}
963+
min={1}
963964
required
964965
/>
965966
</div>
@@ -1059,6 +1060,7 @@ const Forms = (props) => {
10591060
e.target.setCustomValidity(t("input-required"))
10601061
}
10611062
onInput={(e) => e.target.setCustomValidity("")}
1063+
min={1}
10621064
required
10631065
/>
10641066
</div>
@@ -1109,6 +1111,7 @@ const Forms = (props) => {
11091111
e.target.setCustomValidity(t("input-required"))
11101112
}
11111113
onInput={(e) => e.target.setCustomValidity("")}
1114+
min={1}
11121115
required
11131116
/>
11141117
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import "../styles/signature.css";
2+
import { createPortal } from "react-dom";
3+
4+
const DateWidgetModal = ({
5+
children,
6+
title,
7+
isOpen
8+
}) => {
9+
if (!isOpen) return null;
10+
11+
return createPortal(
12+
<div id="dateWidgetModal" className="items-center op-modal op-modal-open">
13+
<div className="md:min-w-[500px] op-modal-box p-0 max-h-90 overflow-y-auto hide-scrollbar text-sm">
14+
{title && (
15+
<h3 className="text-base-content text-left font-bold text-lg pt-[15px] px-[20px]">
16+
{title}
17+
</h3>
18+
)}
19+
20+
<div>{children}</div>
21+
</div>
22+
</div>,
23+
document.body
24+
);
25+
};
26+
27+
export default DateWidgetModal;

0 commit comments

Comments
 (0)