feat(admin subscription): add page subscription and tabs - #1074
feat(admin subscription): add page subscription and tabs#1074alireza013013 wants to merge 23 commits into
Conversation
- implement admin subscription plan management API composable and types - add another types for input post,put useApiService for handle object in object or list
- add admin subscription feature management functionality and handle api in composable
…lity in composable
…ity in composable
- add page subscription - add tabs for price,plan,gatway,feature - complete plan tab and get data show in table - add modal for add and detail and delete plan
- complete feature tab and get data show in table - add modal for add and detail and delete featur
- add feature management for admin subscription plans by adding feature modal
- complete price tab and get data show in table - add modal for add and detail and delete price
- add modal for add and detail and delete gateway
…front into feat/admin-subscription
…d API error handler
|
@alireza013013 is attempting to deploy a commit to the GamaEdtech Team on Vercel. A member of the Team first needs to authorize it. |
sanaderi
left a comment
There was a problem hiding this comment.
Review
Good adherence to the project's existing composable/CRUD conventions structurally, but there's a real correctness bug that should be fixed before merge, plus a nav placement note.
Bugs to fix before merge
Module-level singleton state in all four new composables — cross-tab data corruption
In every composables/api/subscription/*.api.ts file, several ref()s are declared outside the exported function (module scope), making them shared singletons across every call site for the app's entire lifetime, instead of being scoped per composable instance:
useSubscriptionFeatureAdmin.api.ts—data,featureOptions,totalCount,pageCount, and all loading flags are module-level.useSubscriptionPlanAdmin.api.ts—totalCount,pageCount,planFeatures, and loading flags are module-level (onlydata/loadingGetDataare correctly scoped per-call, inconsistently with the rest).- Same pattern in the price and gateway-mapping composables.
This isn't theoretical — it's concretely triggered by this PR's own code, because all four tabs mount at once (Vuetify's v-window renders every v-window-item up front, not lazily):
prices/form.vuecallsuseSubscriptionPlanAdmin().getPlans({ page: 1, pageSize: 1000 })on mount to populate the "Plan" dropdown when adding/editing a Price. SincetotalCount/pageCountare the same refsplans/index.vue's pagination UI reads, opening "Add Price" after visiting the Plans tab will silently corrupt the Plans tab's displayed count and page-count.gateway-mappings/form.vuedoes the identical thing withuseSubscriptionPriceAdmin().getPrices({ page: 1, pageSize: 1000 })to populate its "Price" dropdown — but heredataitself is shared too, so opening "Add Gateway Mapping" will overwrite the Prices tab's own paginated table (10/20/50 rows) with up to 1000 rows and recompute itspageCountto 1, visibly breaking the Prices tab.
Fix: move all these refs inside the exported composable function (matching how data/loadingGetData are already scoped correctly in the plan composable — the pattern just needs to be applied consistently everywhere). This also sidesteps the general Nuxt/SSR hazard of module-scoped state being created once per server process rather than per request.
Navigation placement
The new "Subscription" menu item (app/layouts/admin.vue) is currently added under the Caption group (alongside Contact Us, User Management, Tags, Transactions, Payments). Please move it to the General group, next to Settings, instead.
Style / consistency (low severity)
app/layouts/admin.vue— new menu entry title is'Subscription 'with a trailing space.- Detail-fetch strategy is inconsistent:
plans/detail.vuere-fetches the item by ID viagetItemByIdon modal open, whilefeatures/detail.vue,prices/detail.vue, andgateway-mappings/detail.vuejust receive the already-loaded row object as a prop (no extra request). Not wrong, but worth aligning — the plan list already has full data available, so the extra round-trip is avoidable.
…front into feat/admin-subscription
…front into feat/admin-subscription
…sable function for subscription
…front into feat/admin-subscription
- Remove billingInterval from subscription plan forms and DTOs. - Show plan price entries with their own billing intervals. - Add required billingInterval support to subscription price forms and DTOs. - Display billing interval in the admin prices table.
- Update plan feature types and API payloads to use `featureGroups`. - Replace single feature picker with Vuetify multiple select. - Add conditional description field for multi-feature groups. - Display feature group descriptions and count grouped features in plan list.
Description
Type of Change
Checklist