Skip to content

Commit a64da4c

Browse files
Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into raktima-patch-2
2 parents e80bcfc + c2dccf1 commit a64da4c

File tree

17 files changed

+346
-127
lines changed

17 files changed

+346
-127
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
"role-not-found": "Role not found.",
478478
"do-not-access": "You don't have access, please contact the admin.",
479479
"add-admin": "Add admin",
480-
"opensign-setup": "Opensign Setup",
480+
"opensign-setup": "OpenSign Setup",
481481
"join-discord": "Join our discord server",
482482
"admin-already-exist": "Admin already exist.",
483483
"password-update-alert-1": "Password updated successfully.",
@@ -533,7 +533,7 @@
533533
"filed-required-correctly": "Please fill required details correctly.",
534534
"admin-created": "Admin created",
535535
"invalid-masterkey": "Invalid masterkey",
536-
"opensign-Setup": "Opensign Setup",
536+
"opensign-Setup": "OpenSign Setup",
537537
"master-key": " Master key",
538538
"profile-update-alert": "Profile updated successfully.",
539539
"date": "Date",
@@ -595,7 +595,7 @@
595595
"Recently sent for signatures": "This is a list of documents you've sent to other parties for signature.",
596596
"Drafts": "This are documents you have started but have not finalized for sending.",
597597
"public-template": "This video demonstrates how to set up your personalized public profile, such as ‘https://opensign.me/your-username’. You’ll also learn how to customize your tagline and make your templates available for public signing."
598-
},
598+
},
599599
"enter-email-plaholder": "Add an email address and hit enter",
600600
"success-email-alert": "Email sent successfully!",
601601
"expired-doc-title": "Expired Document",
@@ -646,6 +646,7 @@
646646
"copy-code":"COPY",
647647
"copied-code":"COPIED",
648648
"Installation":"Installation",
649-
"Usage" :"Usage"
649+
"Usage" :"Usage",
650+
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminName}}<{{adminEmail}}>."
650651

651652
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
"role-not-found": "Rôle introuvable.",
477477
"do-not-access": "Vous n'y avez pas accès, veuillez contacter l'administrateur.",
478478
"add-admin": "Ajouter un administrateur",
479-
"opensign-setup": "Configuration d'Opensign",
479+
"opensign-setup": "Configuration d'OpenSign",
480480
"join-discord": "Rejoignez notre serveur Discord",
481481
"admin-already-exist": "L'administrateur existe déjà.",
482482
"password-update-alert-1": "Mot de passe mis à jour avec succès.",
@@ -532,7 +532,7 @@
532532
"filed-required-correctly": "Veuillez remplir correctement les informations requises.",
533533
"admin-created": "Administrateur créé",
534534
"invalid-masterkey": "Clé principale invalide",
535-
"opensign-Setup": "Configuration d'Opensign",
535+
"opensign-Setup": "Configuration d'OpenSign",
536536
"master-key": "La clef maitresse",
537537
"profile-update-alert": "Mise à jour du profil réussie.",
538538
"date": "Date",
@@ -646,6 +646,7 @@
646646
"copy-code":"COPIE",
647647
"copied-code":"COPIÉ",
648648
"Installation":"Installation",
649-
"Usage" :"Usage"
650-
649+
"Usage" :"Usage",
650+
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminName}}<{{adminEmail}}>."
651+
651652
}

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 78 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ const BulkSendUi = (props) => {
2929
const [isQuotaReached, setIsQuotaReached] = useState(false);
3030
const [isLoader, setIsLoader] = useState(false);
3131
const [isFreePlan, setIsFreePlan] = useState(false);
32+
const [admin, setAdmin] = useState({
33+
objectId: "",
34+
name: "",
35+
email: "",
36+
isAdmin: true
37+
});
3238
const allowedSigners = 50;
3339
useEffect(() => {
3440
signatureExist();
@@ -41,6 +47,27 @@ const BulkSendUi = (props) => {
4147
setIsLoader(true);
4248
try {
4349
const subscription = await fetchSubscription();
50+
const extUser =
51+
localStorage.getItem("Extand_Class") &&
52+
JSON.parse(localStorage.getItem("Extand_Class"))?.[0];
53+
if (
54+
subscription?.adminId &&
55+
extUser?.objectId === subscription?.adminId
56+
) {
57+
setAdmin((obj) => ({
58+
...obj,
59+
objectId: subscription?.adminId,
60+
isAdmin: true
61+
}));
62+
} else {
63+
setAdmin((obj) => ({
64+
...obj,
65+
isAdmin: false,
66+
name: extUser?.CreatedBy?.name,
67+
email: extUser?.CreatedBy?.email
68+
}));
69+
}
70+
setAdmin((obj) => ({ ...obj, objectId: subscription?.adminId }));
4471
if (subscription?.plan === "freeplan") {
4572
setIsFreePlan(true);
4673
}
@@ -69,6 +96,7 @@ const BulkSendUi = (props) => {
6996
}
7097
} else {
7198
setIsBulkAvailable(true);
99+
setAdmin((obj) => ({ ...obj, isAdmin: true }));
72100
const getPlaceholder = props.item?.Placeholders;
73101
const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) =>
74102
placeholderObj?.placeHolder?.some((holder) =>
@@ -417,46 +445,57 @@ const BulkSendUi = (props) => {
417445
</button>
418446
</div>
419447
) : (
420-
<form onSubmit={handleAddOnQuickSubmit} className="p-3">
421-
<p className="flex justify-center text-center mx-2 mb-3 text-base op-text-accent font-medium">
422-
{t("additional-credits")}
423-
</p>
424-
<div className="mb-3 flex justify-between">
425-
<label
426-
htmlFor="quantity"
427-
className="block text-xs text-gray-700 font-semibold"
428-
>
429-
{t("quantityofcredits")}
430-
<span className="text-[red] text-[13px]">*</span>
431-
</label>
432-
<select
433-
value={amount.quantity}
434-
onChange={(e) => handlePricePerQuick(e)}
435-
name="quantity"
436-
className="op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content w-1/4 text-xs"
437-
required
438-
>
439-
{quantityList.length > 0 &&
440-
quantityList.map((x) => (
441-
<option key={x} value={x}>
442-
{x}
443-
</option>
444-
))}
445-
</select>
446-
</div>
447-
<div className="mb-3 flex justify-between">
448-
<label className="block text-xs text-gray-700 font-semibold">
449-
{t("Price")} (1 * {amount.priceperbulksend})
450-
</label>
451-
<div className="w-1/4 flex justify-center items-center text-sm">
452-
USD {amount.price}
448+
<>
449+
{admin?.isAdmin ? (
450+
<form onSubmit={handleAddOnQuickSubmit} className="p-3">
451+
<p className="flex justify-center text-center mx-2 mb-3 text-base op-text-accent font-medium">
452+
{t("additional-credits")}
453+
</p>
454+
<div className="mb-3 flex justify-between">
455+
<label
456+
htmlFor="quantity"
457+
className="block text-xs text-gray-700 font-semibold"
458+
>
459+
{t("quantityofcredits")}
460+
<span className="text-[red] text-[13px]">*</span>
461+
</label>
462+
<select
463+
value={amount.quantity}
464+
onChange={(e) => handlePricePerQuick(e)}
465+
name="quantity"
466+
className="op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content w-1/4 text-xs"
467+
required
468+
>
469+
{quantityList.length > 0 &&
470+
quantityList.map((x) => (
471+
<option key={x} value={x}>
472+
{x}
473+
</option>
474+
))}
475+
</select>
476+
</div>
477+
<div className="mb-3 flex justify-between">
478+
<label className="block text-xs text-gray-700 font-semibold">
479+
{t("Price")} (1 * {amount.priceperbulksend})
480+
</label>
481+
<div className="w-1/4 flex justify-center items-center text-sm">
482+
USD {amount.price}
483+
</div>
484+
</div>
485+
<hr className="text-base-content mb-3" />
486+
<button className="op-btn op-btn-primary w-full mt-2">
487+
{t("Proceed")}
488+
</button>
489+
</form>
490+
) : (
491+
<div className="mx-8 mt-4 mb-8 flex justify-center text-center items-center font-medium break-all">
492+
{t("unauthorized-modal", {
493+
adminName: admin?.name,
494+
adminEmail: admin?.email
495+
})}
453496
</div>
454-
</div>
455-
<hr className="text-base-content mb-3" />
456-
<button className="op-btn op-btn-primary w-full mt-2">
457-
{t("Proceed")}
458-
</button>
459-
</form>
497+
)}
498+
</>
460499
)}
461500
</>
462501
)}

apps/OpenSign/src/components/Header.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ const Header = ({ showSidebar }) => {
1818
const { t, i18n } = useTranslation();
1919
const navigate = useNavigate();
2020
const { width } = useWindowSize();
21-
let username = localStorage.getItem("username");
21+
const username = localStorage.getItem("username") || "";
2222
const image = localStorage.getItem("profileImg") || dp;
2323
const [isOpen, setIsOpen] = useState(false);
2424
const [isSubscribe, setIsSubscribe] = useState(true);
2525
const [isTeam, setIsTeam] = useState({ plan: "", isValid: false });
2626
const [applogo, setAppLogo] = useState(
2727
localStorage.getItem("appLogo") || " "
2828
);
29+
const [emailUsed, setEmailUsed] = useState(0);
2930

3031
const toggleDropdown = () => {
3132
setIsOpen(!isOpen);
@@ -47,6 +48,13 @@ const Header = ({ showSidebar }) => {
4748
}
4849
setIsTeam(subscribe);
4950
setIsSubscribe(subscribe.isValid);
51+
try {
52+
const extUser = await Parse.Cloud.run("getUserDetails");
53+
const MonthlyFreeEmails = extUser?.get("MonthlyFreeEmails") || 0;
54+
setEmailUsed(MonthlyFreeEmails);
55+
} catch (err) {
56+
console.log("err in while fetching monthlyfreeEmails", err);
57+
}
5058
}
5159
}
5260

@@ -195,6 +203,14 @@ const Header = ({ showSidebar }) => {
195203
tabIndex={0}
196204
className="mt-3 z-[1] p-2 shadow op-menu op-menu-sm op-dropdown-content text-base-content bg-base-100 rounded-box w-52"
197205
>
206+
{isEnableSubscription && isTeam?.plan === "freeplan" && (
207+
<li className="cursor-pointer">
208+
<span>
209+
<i className="fa-light fa-envelope"></i> Email used:{" "}
210+
{emailUsed}/20
211+
</span>
212+
</li>
213+
)}
198214
<li onClick={() => openInNewTab("https://docs.opensignlabs.com")}>
199215
<span>
200216
<i className="fa-light fa-book"></i> {t("docs")}

apps/OpenSign/src/components/opensigndrive/DriveBody.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ function DriveBody(props) {
357357
e.stopPropagation();
358358
handleMenuItemClick("Download", data);
359359
}}
360-
className="fa-light fa-download mr-[8px] op-text-primary"
360+
className="fa-light fa-download mr-[8px] op-text-primary cursor-pointer"
361361
aria-hidden="true"
362362
></i>
363363
</td>
@@ -370,7 +370,11 @@ function DriveBody(props) {
370370
{/* folder */}
371371
<div
372372
data-tut={props.dataTutSeventh}
373-
onClick={() => handleOnclikFolder(data)}
373+
onClick={() => {
374+
if (!rename) {
375+
handleOnclikFolder(data);
376+
}
377+
}}
374378
className="cursor-pointer"
375379
>
376380
<svg
@@ -383,7 +387,6 @@ function DriveBody(props) {
383387
{rename === data.objectId ? (
384388
<input
385389
onFocus={() => {
386-
inputRef.current.setSelectionRange(0, 0);
387390
const input = inputRef.current;
388391
if (input) {
389392
input.select();
@@ -395,9 +398,8 @@ function DriveBody(props) {
395398
onKeyDown={(e) => handleEnterPress(e, data)}
396399
ref={inputRef}
397400
defaultValue={renameValue}
398-
// value={renameValue}
399401
onChange={(e) => setRenameValue(e.target.value)}
400-
className="w-[100px] border-[1.5px] border-black rounded-sm text-[10px]"
402+
className="op-input op-input-bordered op-input-xs w-[100px] focus:outline-none hover:border-base-content text-[10px]"
401403
/>
402404
) : (
403405
<span className="fileName">{data.Name}</span>
@@ -423,7 +425,11 @@ function DriveBody(props) {
423425
</ContextMenu.Root>
424426
</div>
425427
) : (
426-
<HoverCard.Root openDelay={0} closeDelay={100}>
428+
<HoverCard.Root
429+
open={rename ? false : undefined}
430+
openDelay={0}
431+
closeDelay={100}
432+
>
427433
<HoverCard.Trigger asChild>
428434
<div>
429435
<ContextMenu.Root>
@@ -432,7 +438,11 @@ function DriveBody(props) {
432438
{/* pdf */}
433439
<div
434440
data-tut={props.dataTutSixth}
435-
onClick={() => checkPdfStatus(data)}
441+
onClick={() => {
442+
if (!rename) {
443+
checkPdfStatus(data);
444+
}
445+
}}
436446
className="cursor-pointer"
437447
>
438448
<svg
@@ -447,7 +457,6 @@ function DriveBody(props) {
447457
autoFocus={true}
448458
type="text"
449459
onFocus={() => {
450-
inputRef.current.setSelectionRange(0, 0);
451460
const input = inputRef.current;
452461
if (input) {
453462
input.select();
@@ -457,9 +466,8 @@ function DriveBody(props) {
457466
onKeyDown={(e) => handleEnterPress(e, data)}
458467
ref={inputRef}
459468
defaultValue={renameValue}
460-
// value={renameValue}
461469
onChange={(e) => setRenameValue(e.target.value)}
462-
className="w-[100px] border-[1.5px] border-black rounded-sm text-[10px]"
470+
className="op-input op-input-bordered op-input-xs w-[100px] focus:outline-none hover:border-base-content text-[10px]"
463471
/>
464472
) : (
465473
<span className="fileName">{data.Name}</span>

apps/OpenSign/src/constant/Utils.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,21 @@ export async function fetchSubscription(
5656
? { contactId: contactObjId }
5757
: { extUserId: extUser };
5858
const tenatRes = await axios.post(url, params, { headers: headers });
59-
let plan, status, billingDate;
59+
let plan, status, billingDate, adminId;
6060
if (isGuestSign) {
6161
plan = tenatRes.data?.result?.result?.plan;
6262
status = tenatRes.data?.result?.result?.isSubscribed;
6363
} else {
6464
plan = tenatRes.data?.result?.result?.PlanCode;
6565
billingDate = tenatRes.data?.result?.result?.Next_billing_date?.iso;
6666
const allowedUsers = tenatRes.data?.result?.result?.AllowedUsers || 0;
67+
adminId = tenatRes?.data?.result?.result?.ExtUserPtr?.objectId;
6768
localStorage.setItem("allowedUsers", allowedUsers);
6869
}
69-
return { plan, billingDate, status };
70+
return { plan, billingDate, status, adminId };
7071
} catch (err) {
7172
console.log("Err in fetch subscription", err);
72-
return { plan: "", billingDate: "" };
73+
return { plan: "", billingDate: "", status: "", adminId: "" };
7374
}
7475
}
7576

@@ -122,22 +123,22 @@ export async function checkIsSubscribed() {
122123
try {
123124
const res = await fetchSubscription();
124125
if (res.plan === "freeplan") {
125-
return { plan: res.plan, isValid: false };
126+
return { plan: res.plan, isValid: false, adminId: res?.adminId };
126127
} else if (res.billingDate) {
127128
const plan = validplan[res.plan] || false;
128129
if (plan && new Date(res.billingDate) > new Date()) {
129-
return { plan: res.plan, isValid: true };
130+
return { plan: res.plan, isValid: true, adminId: res?.adminId };
130131
} else if (new Date(res.billingDate) > new Date()) {
131-
return { plan: res.plan, isValid: true };
132+
return { plan: res.plan, isValid: true, adminId: res?.adminId };
132133
} else {
133-
return { plan: res.plan, isValid: false };
134+
return { plan: res.plan, isValid: false, adminId: res?.adminId };
134135
}
135136
} else {
136-
return { plan: res.plan, isValid: false };
137+
return { plan: res.plan, isValid: false, adminId: res?.adminId };
137138
}
138139
} catch (err) {
139140
console.log("Err in fetch subscription", err);
140-
return { plan: "no-plan", isValid: false };
141+
return { plan: "no-plan", isValid: false, adminId: "" };
141142
}
142143
}
143144

0 commit comments

Comments
 (0)