feat(plans): enable Included Modules checklist for PATTERN_CORE and NUTRITION_CORE
This commit is contained in:
parent
1fa7b96195
commit
167b22d3ec
10
src/App.tsx
10
src/App.tsx
|
|
@ -630,6 +630,10 @@ export default function App() {
|
|||
}
|
||||
setEditPriceSaving(true);
|
||||
try {
|
||||
const isEditableBundle =
|
||||
selectedEditPricePlan.plan_type === 'bundle' ||
|
||||
selectedEditPricePlan.base_code === 'PATTERN_CORE' ||
|
||||
selectedEditPricePlan.base_code === 'NUTRITION_CORE';
|
||||
await axios.put(
|
||||
`${API_BASE}/api/admin/plans/${selectedEditPricePlan.base_code}/pricing`,
|
||||
{
|
||||
|
|
@ -641,12 +645,12 @@ export default function App() {
|
|||
badge_text: editPlanBadge.trim() || undefined,
|
||||
heading: editPlanHeading.trim() || undefined,
|
||||
subtitle: editPlanSubtitle.trim() || undefined,
|
||||
module_ids: selectedEditPricePlan.plan_type === 'bundle' ? editPlanModuleIds : undefined,
|
||||
module_ids: isEditableBundle ? editPlanModuleIds : undefined,
|
||||
},
|
||||
{ headers: { Authorization: `Bearer ${userToken}` } }
|
||||
);
|
||||
const updatedBundleModules =
|
||||
selectedEditPricePlan.plan_type === 'bundle'
|
||||
isEditableBundle
|
||||
? adminModulesList.filter((m) => editPlanModuleIds.includes(m.id))
|
||||
: undefined;
|
||||
setAdminPlansList((prev) =>
|
||||
|
|
@ -664,7 +668,7 @@ export default function App() {
|
|||
price_eur: eurVal,
|
||||
pricing_status:
|
||||
inrVal > 0 || usdVal > 0 || eurVal > 0 ? 'configured' : p.pricing_status,
|
||||
...(selectedEditPricePlan.plan_type === 'bundle'
|
||||
...(isEditableBundle
|
||||
? { module_ids: editPlanModuleIds, modules: updatedBundleModules }
|
||||
: {}),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export const EditPriceModal: React.FC<EditPriceModalProps> = ({
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{plan.plan_type === 'bundle' && allModules.length > 0 && onToggleModule && (
|
||||
{(plan.plan_type === 'bundle' || plan.base_code === 'PATTERN_CORE' || plan.base_code === 'NUTRITION_CORE') && allModules.length > 0 && onToggleModule && (
|
||||
<div className="space-y-2 border-t border-slate-100 pt-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<label className="text-xs font-bold text-slate-600">
|
||||
|
|
|
|||
Loading…
Reference in New Issue