mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-12 12:47:40 +02:00
refactor: change help text
This commit is contained in:
@@ -24,7 +24,7 @@ const BulkSendUi = (props) => {
|
||||
price: (75.0).toFixed(2),
|
||||
quantity: 500,
|
||||
priceperbulksend: 0.15,
|
||||
totalQuickSend: 0
|
||||
totalcredits: 0
|
||||
});
|
||||
const [isQuotaReached, setIsQuotaReached] = useState(false);
|
||||
const [isLoader, setIsLoader] = useState(false);
|
||||
@@ -44,11 +44,16 @@ const BulkSendUi = (props) => {
|
||||
if (subscription?.plan === "freeplan") {
|
||||
setIsFreePlan(true);
|
||||
}
|
||||
const allowedquicksend = await Parse.Cloud.run("allowedquicksend");
|
||||
if (allowedquicksend > 0) {
|
||||
setIsBulkAvailable(true);
|
||||
const resCredits = await Parse.Cloud.run("allowedcredits");
|
||||
if (resCredits) {
|
||||
const allowedcredits = resCredits?.allowedcredits || 0;
|
||||
const addoncredits = resCredits?.addoncredits || 0;
|
||||
const totalcredits = allowedcredits + addoncredits;
|
||||
if (totalcredits > 0) {
|
||||
setIsBulkAvailable(true);
|
||||
}
|
||||
setAmount((obj) => ({ ...obj, totalcredits: totalcredits }));
|
||||
}
|
||||
setAmount((obj) => ({ ...obj, totalQuickSend: allowedquicksend }));
|
||||
const getPlaceholder = props.item?.Placeholders;
|
||||
const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) =>
|
||||
placeholderObj?.placeHolder?.some((holder) =>
|
||||
@@ -121,7 +126,7 @@ const BulkSendUi = (props) => {
|
||||
const handleAddForm = (e) => {
|
||||
e.preventDefault();
|
||||
// Check if the quick send limit has been reached
|
||||
if (isEnableSubscription && forms.length >= amount.totalQuickSend) {
|
||||
if (isEnableSubscription && forms.length >= amount.totalcredits) {
|
||||
setIsQuotaReached(true);
|
||||
} else {
|
||||
if (forms?.length < allowedForm) {
|
||||
@@ -244,8 +249,8 @@ const BulkSendUi = (props) => {
|
||||
e.stopPropagation();
|
||||
setIsSubmit(true);
|
||||
try {
|
||||
const resAddon = await Parse.Cloud.run("buyquicksend", {
|
||||
quicksend: amount.quantity
|
||||
const resAddon = await Parse.Cloud.run("buycredits", {
|
||||
credits: amount.quantity
|
||||
});
|
||||
if (resAddon) {
|
||||
const _resAddon = JSON.parse(JSON.stringify(resAddon));
|
||||
@@ -257,7 +262,7 @@ const BulkSendUi = (props) => {
|
||||
quantity: 500,
|
||||
priceperbulksend: 0.15,
|
||||
price: (75.0).toFixed(2),
|
||||
totalQuickSend: _resAddon.addon
|
||||
totalcredits: _resAddon.addon
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -345,13 +350,15 @@ const BulkSendUi = (props) => {
|
||||
))}
|
||||
</div>
|
||||
<div className="flex flex-col mx-4 mb-4 gap-3">
|
||||
<button
|
||||
onClick={handleAddForm}
|
||||
className="op-btn op-btn-primary focus:outline-none"
|
||||
>
|
||||
<i className="fa-light fa-plus"></i>{" "}
|
||||
<span>{t("add-new")}</span>
|
||||
</button>
|
||||
{isEnableSubscription && (
|
||||
<button
|
||||
onClick={handleAddForm}
|
||||
className="op-btn op-btn-primary focus:outline-none"
|
||||
>
|
||||
<i className="fa-light fa-plus"></i>{" "}
|
||||
<span>{t("add-new")}</span>
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="submit"
|
||||
className="op-btn op-btn-accent focus:outline-none"
|
||||
|
||||
@@ -29,7 +29,8 @@ function GenerateToken() {
|
||||
const [amount, setAmount] = useState({
|
||||
quantity: 500,
|
||||
priceperapi: 0.15,
|
||||
totalapis: 0,
|
||||
allowedcredits: 0,
|
||||
addoncredits: 0,
|
||||
price: (75.0).toFixed(2)
|
||||
});
|
||||
const [isFormLoader, setIsFormLoader] = useState(false);
|
||||
@@ -59,8 +60,12 @@ function GenerateToken() {
|
||||
};
|
||||
const res = await axios.post(url, {}, { headers: headers });
|
||||
if (res) {
|
||||
const allowedapis = await Parse.Cloud.run("allowedapis");
|
||||
setAmount((obj) => ({ ...obj, totalapis: allowedapis }));
|
||||
const resCredits = await Parse.Cloud.run("allowedcredits");
|
||||
setAmount((obj) => ({
|
||||
...obj,
|
||||
allowedcredits: resCredits.allowedcredits,
|
||||
addoncredits: resCredits.addoncredits
|
||||
}));
|
||||
SetApiToken(res?.data?.result?.result);
|
||||
}
|
||||
const body = { email: Parse?.User?.current()?.getEmail() || "" };
|
||||
@@ -142,8 +147,8 @@ function GenerateToken() {
|
||||
e.stopPropagation();
|
||||
setIsFormLoader(true);
|
||||
try {
|
||||
const resAddon = await Parse.Cloud.run("buyapis", {
|
||||
apis: amount.quantity
|
||||
const resAddon = await Parse.Cloud.run("buycredits", {
|
||||
credits: amount.quantity
|
||||
});
|
||||
if (resAddon) {
|
||||
const _resAddon = JSON.parse(JSON.stringify(resAddon));
|
||||
@@ -153,7 +158,7 @@ function GenerateToken() {
|
||||
quantity: 500,
|
||||
priceperapi: 0.15,
|
||||
price: (75.0).toFixed(2),
|
||||
totalapis: _resAddon.addon
|
||||
addoncredits: _resAddon.addon
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -293,7 +298,11 @@ function GenerateToken() {
|
||||
</li>
|
||||
<div className="text-xs md:text-[15px] my-4">
|
||||
<span className="font-medium">{t("remainingapis")}</span>{" "}
|
||||
{amount.totalapis}
|
||||
{amount.allowedcredits}
|
||||
</div>
|
||||
<div className="text-xs md:text-[15px] my-4">
|
||||
<span className="font-medium">Addon credits: </span>{" "}
|
||||
{amount.addoncredits}
|
||||
</div>
|
||||
<hr />
|
||||
</ul>
|
||||
|
||||
@@ -1456,7 +1456,13 @@ const ReportTable = (props) => {
|
||||
<i className={act.btnIcon}></i>
|
||||
{act.btnLabel && (
|
||||
<span className="uppercase font-medium">
|
||||
{t(`btnLabel.${act.btnLabel}`)}
|
||||
{act.btnLabel.includes(
|
||||
"Quick send"
|
||||
) && isEnableSubscription
|
||||
? "Bulk Send"
|
||||
: `${t(
|
||||
`btnLabel.${act.btnLabel}`
|
||||
)}`}
|
||||
</span>
|
||||
)}
|
||||
{isOption[item.objectId] &&
|
||||
@@ -1783,7 +1789,11 @@ const ReportTable = (props) => {
|
||||
{isBulkSend[item.objectId] && (
|
||||
<ModalUi
|
||||
isOpen
|
||||
title={t("quick-send")}
|
||||
title={
|
||||
isEnableSubscription
|
||||
? "Bulk send"
|
||||
: t("quick-send")
|
||||
}
|
||||
handleClose={() => setIsBulkSend({})}
|
||||
>
|
||||
{isLoader[item.objectId] ? (
|
||||
|
||||
Reference in New Issue
Block a user