Skip to content

Commit c199c30

Browse files
feat: add message for all signers linked in template for quick send
1 parent facbc8e commit c199c30

File tree

2 files changed

+69
-68
lines changed

2 files changed

+69
-68
lines changed

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 61 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -164,54 +164,72 @@ const BulkSendUi = (props) => {
164164
></div>
165165
</div>
166166
)}
167-
<form onSubmit={handleSubmit}>
168-
<div className=" min-h-max max-h-[250px] overflow-y-auto">
169-
{forms?.map((form, index) => (
170-
<div
171-
key={form.Id}
172-
className="p-3 rounded-xl border-[1px] border-gray-400 m-4 bg-white text-black grid grid-cols-1 md:grid-cols-2 gap-2 relative"
173-
>
174-
{form?.fields?.map((field, fieldIndex) => (
175-
<div className="flex flex-col " key={field.fieldId}>
176-
<label>{field.label}</label>
177-
<SuggestionInput
178-
required
179-
type="email"
180-
value={field.value}
181-
index={fieldIndex}
182-
onChange={(signer) =>
183-
handleInputChange(index, signer, fieldIndex)
184-
}
185-
/>
186-
</div>
187-
))}
188-
{index > 0 && (
167+
{props.Placeholders?.length > 0 ? (
168+
<>
169+
{props.Placeholders?.some((x) => !x.signerObjId) ? (
170+
<form onSubmit={handleSubmit}>
171+
<div className=" min-h-max max-h-[250px] overflow-y-auto">
172+
{forms?.map((form, index) => (
173+
<div
174+
key={form.Id}
175+
className="p-3 rounded-xl border-[1px] border-gray-400 m-4 bg-white text-black grid grid-cols-1 md:grid-cols-2 gap-2 relative"
176+
>
177+
{form?.fields?.map((field, fieldIndex) => (
178+
<div className="flex flex-col " key={field.fieldId}>
179+
<label>{field.label}</label>
180+
<SuggestionInput
181+
required
182+
type="email"
183+
value={field.value}
184+
index={fieldIndex}
185+
onChange={(signer) =>
186+
handleInputChange(index, signer, fieldIndex)
187+
}
188+
/>
189+
</div>
190+
))}
191+
{forms?.length > 1 && (
192+
<button
193+
onClick={() => handleRemoveForm(index)}
194+
className="absolute right-3 top-1 border border-gray-300 rounded-lg px-2 py-1"
195+
>
196+
<i className="fa-solid fa-trash"></i>
197+
</button>
198+
)}
199+
<div ref={formRef}></div>
200+
</div>
201+
))}
202+
</div>
203+
<div className="flex flex-col mx-4 mb-4 gap-3">
189204
<button
190-
onClick={() => handleRemoveForm(index)}
191-
className="absolute right-3 top-1 border border-gray-300 rounded-lg px-2 py-1"
205+
onClick={handleAddForm}
206+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
192207
>
193-
<i className="fa-solid fa-trash"></i>
208+
<i className="fa-solid fa-plus"></i> <span>Add new</span>
194209
</button>
195-
)}
196-
<div ref={formRef}></div>
210+
<button
211+
type="submit"
212+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
213+
>
214+
<i className="fa-solid fa-paper-plane"></i> <span>Send</span>
215+
</button>
216+
</div>
217+
</form>
218+
) : (
219+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
220+
All roles in this document are currently linked to contacts. To
221+
&apos;quick send&apos; copies of this template to multiple
222+
signers, please ensure that at least one role is not linked to any
223+
contact.
197224
</div>
198-
))}
225+
)}
226+
</>
227+
) : (
228+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
229+
Please add at least one role to this template in order to &apos;quick
230+
send&apos; copies of it to multiple signers.
199231
</div>
200-
<div className="flex flex-col mx-4 mb-4 gap-3">
201-
<button
202-
onClick={handleAddForm}
203-
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
204-
>
205-
<i className="fa-solid fa-plus"></i> <span>Add new</span>
206-
</button>
207-
<button
208-
type="submit"
209-
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
210-
>
211-
<i className="fa-solid fa-paper-plane"></i> <span>Send</span>
212-
</button>
213-
</div>
214-
</form>
232+
)}
215233
</>
216234
);
217235
};

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const ReportTable = (props) => {
2525
const [currentPage, setCurrentPage] = useState(1);
2626
const [actLoader, setActLoader] = useState({});
2727
const [isAlert, setIsAlert] = useState(false);
28-
const [isDocErr, setIsDocErr] = useState(false);
2928
const [isContactform, setIsContactform] = useState(false);
3029
const [isDeleteModal, setIsDeleteModal] = useState({});
3130
const [isRevoke, setIsRevoke] = useState({});
@@ -186,7 +185,6 @@ const ReportTable = (props) => {
186185
setActLoader({});
187186
}
188187
} else {
189-
setIsDocErr(true);
190188
setActLoader({});
191189
}
192190
} else {
@@ -648,7 +646,6 @@ const ReportTable = (props) => {
648646
const handleBulkSend = async (template) => {
649647
setIsBulkSend({ [template.objectId]: true });
650648
setIsLoader({ [template.objectId]: true });
651-
setIsDocErr(false);
652649
try {
653650
const params = {
654651
templateId: template.objectId,
@@ -666,18 +663,12 @@ const ReportTable = (props) => {
666663
}
667664
);
668665
const templateRes = axiosRes.data && axiosRes.data.result;
669-
if (templateRes?.Placeholders?.length > 0) {
670-
setPlaceholders(templateRes?.Placeholders);
671-
setTemplateDetails(templateRes);
672-
setIsLoader({});
673-
} else {
674-
setIsLoader(false);
675-
setIsDocErr(true);
676-
}
666+
setPlaceholders(templateRes?.Placeholders);
667+
setTemplateDetails(templateRes);
668+
setIsLoader({});
677669
} catch (err) {
678670
console.log("err in fetch template in bulk modal", err);
679671
setIsBulkSend({});
680-
setIsDocErr(false);
681672
setIsAlert(true);
682673
setAlertMsg({
683674
type: "danger",
@@ -940,19 +931,11 @@ const ReportTable = (props) => {
940931
></div>
941932
</div>
942933
) : (
943-
<>
944-
{isDocErr ? (
945-
<div className="text-black bg-white w-full h-[80px] md:h-[100px] text-sm md:text-xl flex justify-center items-center">
946-
Please add Signers or Roles in template
947-
</div>
948-
) : (
949-
<BulkSendUi
950-
Placeholders={placeholders}
951-
item={templateDeatils}
952-
handleClose={handleQuickSendClose}
953-
/>
954-
)}
955-
</>
934+
<BulkSendUi
935+
Placeholders={placeholders}
936+
item={templateDeatils}
937+
handleClose={handleQuickSendClose}
938+
/>
956939
)}
957940
</ModalUi>
958941
)}

0 commit comments

Comments
 (0)