add: more things

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-06 15:21:36 +08:00
parent 41e98bb602
commit 244aa607f7
71 changed files with 2998 additions and 1014 deletions
@@ -100,10 +100,20 @@ export default function PaymentPolicy() {
},
promo_rules: promoRules,
});
toast.success("Payment policy saved.");
toast("Payment policy saved.", {
action: {
label: "Close",
onClick: () => {}
}
});
navigate("/admin/tiers/plans");
} catch (err) {
toast.error(err?.response?.data?.message ?? "Could not save payment policy.");
toast(err?.response?.data?.message ?? "Could not save payment policy.", {
action: {
label: "Close",
onClick: () => {}
}
});
} finally {
setSaving(false);
}
@@ -113,10 +123,25 @@ export default function PaymentPolicy() {
const handleAddPromo = () => {
const code = addForm.code.trim().toUpperCase();
if (!code) { toast.error("Code is required."); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast.error("Value must be greater than 0."); return; }
if (!code) { toast("Code is required.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) {
toast.error("A rule with this code already exists."); return;
toast("A rule with this code already exists.", {
action: {
label: "Close",
onClick: () => {}
}
}); return;
}
const rule = {
+30 -5
View File
@@ -220,9 +220,19 @@ function PaymentPolicyTab({ planId, plan }) {
},
promo_rules: promoRules,
});
toast.success("Payment policy saved.");
toast("Payment policy saved.", {
action: {
label: "Close",
onClick: () => {}
}
});
} catch (err) {
toast.error(err?.response?.data?.message ?? "Could not save payment policy.");
toast(err?.response?.data?.message ?? "Could not save payment policy.", {
action: {
label: "Close",
onClick: () => {}
}
});
} finally {
setSaving(false);
}
@@ -230,9 +240,24 @@ function PaymentPolicyTab({ planId, plan }) {
const handleAddPromo = () => {
const code = addForm.code.trim().toUpperCase();
if (!code) { toast.error("Code is required."); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast.error("Value must be greater than 0."); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) { toast.error("A rule with this code already exists."); return; }
if (!code) { toast("Code is required.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (!addForm.value || Number(addForm.value) <= 0) { toast("Value must be greater than 0.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
if (promoRules.some((r) => r.code.toUpperCase() === code)) { toast("A rule with this code already exists.", {
action: {
label: "Close",
onClick: () => {}
}
}); return; }
const rule = {
code,