Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions apps/OpenSign/src/components/pdf/EditTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ const EditTemplate = ({
e.target.setCustomValidity(t("input-required"))
}
onInput={(e) => e.target.setCustomValidity("")}
min={1}
required
/>
</div>
Expand Down
16 changes: 13 additions & 3 deletions apps/OpenSign/src/components/pdf/Placeholder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import {
import PlaceholderType from "./PlaceholderType";
import moment from "moment";
import "../../styles/opensigndrive.css";
import ModalUi from "../../primitives/ModalUi";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { setIsShowModal } from "../../redux/reducers/widgetSlice";
import { themeColor } from "../../constant/const";
import { useGuidelinesContext } from "../../context/GuidelinesContext";
import DatePicker from "react-datepicker";
import DateWidgetModal from "../../primitives/DateWidgetModal";

function Placeholder(props) {
const { t } = useTranslation();
Expand Down Expand Up @@ -655,6 +655,9 @@ function Placeholder(props) {
setIsToday(false);
setSelectDate((prev) => ({ ...prev, date: "" }));
};
const handleCloseDateModal = () => {
setIsDateModal(false);
};
return (
<>
{/* 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. */}
Expand Down Expand Up @@ -923,7 +926,7 @@ function Placeholder(props) {
</div>
</Rnd>
)}
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
<DateWidgetModal isOpen={isDateModal} title={t("widget-info")}>
<div className="text-base-content h-[100%] p-[20px]">
<div className="flex flex-col gap-3">
<div className="flex flex-col md:items-center md:flex-row gap-y-3">
Expand Down Expand Up @@ -1132,8 +1135,15 @@ function Placeholder(props) {
>
{t("save")}
</button>
<button
type="button"
className="op-btn op-btn-ghost text-base-content ml-1"
onClick={() => handleCloseDateModal()}
>
{t("cancel")}
</button>
</div>
</ModalUi>
</DateWidgetModal>
</>
);
}
Expand Down
3 changes: 3 additions & 0 deletions apps/OpenSign/src/pages/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ const Forms = (props) => {
e.target.setCustomValidity(t("input-required"))
}
onInput={(e) => e.target.setCustomValidity("")}
min={1}
required
/>
</div>
Expand Down Expand Up @@ -1059,6 +1060,7 @@ const Forms = (props) => {
e.target.setCustomValidity(t("input-required"))
}
onInput={(e) => e.target.setCustomValidity("")}
min={1}
required
/>
</div>
Expand Down Expand Up @@ -1109,6 +1111,7 @@ const Forms = (props) => {
e.target.setCustomValidity(t("input-required"))
}
onInput={(e) => e.target.setCustomValidity("")}
min={1}
required
/>
</div>
Expand Down
27 changes: 27 additions & 0 deletions apps/OpenSign/src/primitives/DateWidgetModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import "../styles/signature.css";
import { createPortal } from "react-dom";

const DateWidgetModal = ({
children,
title,
isOpen
}) => {
if (!isOpen) return null;

return createPortal(
<div id="dateWidgetModal" className="items-center op-modal op-modal-open">
<div className="md:min-w-[500px] op-modal-box p-0 max-h-90 overflow-y-auto hide-scrollbar text-sm">
{title && (
<h3 className="text-base-content text-left font-bold text-lg pt-[15px] px-[20px]">
{title}
</h3>
)}

<div>{children}</div>
</div>
</div>,
document.body
);
};

export default DateWidgetModal;