🔧 chore: Unify subscription plan status toggle with PATCH endpoint

Replace separate enable/disable flows with a single PATCH API that updates the enabled flag.
Update frontend hooks and table actions to call the unified endpoint and keep UI behavior consistent.
Introduce a minimal admin controller handler and route for the status update.
This commit is contained in:
t0ng7u
2026-01-31 14:27:01 +08:00
parent 28c5feb570
commit 2297af731c
11 changed files with 293 additions and 133 deletions

View File

@@ -27,16 +27,16 @@ import {
import { getSubscriptionsColumns } from './SubscriptionsColumnDefs';
const SubscriptionsTable = (subscriptionsData) => {
const { plans, loading, compactMode, openEdit, disablePlan, t } =
const { plans, loading, compactMode, openEdit, setPlanEnabled, t } =
subscriptionsData;
const columns = useMemo(() => {
return getSubscriptionsColumns({
t,
openEdit,
disablePlan,
setPlanEnabled,
});
}, [t, openEdit, disablePlan]);
}, [t, openEdit, setPlanEnabled]);
const tableColumns = useMemo(() => {
return compactMode