fix(subscriptions): fix subscription UI and API after store→merchant migration
Store detail page now shows all platform subscriptions instead of always "No Subscription Found". Subscriptions listing page renamed from Store to Merchant throughout (template, JS, menu, i18n) with Platform column added. Tiers API supports platform_id filtering. Merchant detail page no longer hardcodes 'oms' platform — loads all platforms, shows subscription cards per platform with labels, and the Create Subscription modal includes a platform selector with platform-filtered tiers. Create button always accessible in Quick Actions. Edit modal on /admin/subscriptions loads tiers from API filtered by platform instead of hardcoded options, sends tier_code (not tier) to match PATCH schema, and shows platform context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,17 +39,21 @@ function adminSubscriptions() {
|
||||
},
|
||||
|
||||
// Sorting
|
||||
sortBy: 'store_name',
|
||||
sortBy: 'merchant_name',
|
||||
sortOrder: 'asc',
|
||||
|
||||
// Modal state
|
||||
showModal: false,
|
||||
editingSub: null,
|
||||
formData: {
|
||||
tier: '',
|
||||
tier_code: '',
|
||||
status: ''
|
||||
},
|
||||
|
||||
// Tiers for edit modal
|
||||
editTiers: [],
|
||||
loadingTiers: false,
|
||||
|
||||
// Feature overrides
|
||||
featureOverrides: [],
|
||||
quantitativeFeatures: [],
|
||||
@@ -208,15 +212,34 @@ function adminSubscriptions() {
|
||||
async openEditModal(sub) {
|
||||
this.editingSub = sub;
|
||||
this.formData = {
|
||||
tier: sub.tier,
|
||||
tier_code: sub.tier,
|
||||
status: sub.status
|
||||
};
|
||||
this.featureOverrides = [];
|
||||
this.quantitativeFeatures = [];
|
||||
this.showModal = true;
|
||||
|
||||
// Load feature catalog and merchant overrides
|
||||
await this.loadFeatureOverrides(sub.merchant_id);
|
||||
// Load tiers filtered by platform and feature overrides in parallel
|
||||
await Promise.all([
|
||||
this.loadEditTiers(sub.platform_id),
|
||||
this.loadFeatureOverrides(sub.merchant_id),
|
||||
]);
|
||||
},
|
||||
|
||||
async loadEditTiers(platformId) {
|
||||
this.loadingTiers = true;
|
||||
try {
|
||||
const url = platformId
|
||||
? `/admin/subscriptions/tiers?platform_id=${platformId}`
|
||||
: '/admin/subscriptions/tiers';
|
||||
const response = await apiClient.get(url);
|
||||
this.editTiers = response.tiers || [];
|
||||
subsLog.info('Loaded tiers for edit modal:', this.editTiers.length);
|
||||
} catch (error) {
|
||||
subsLog.error('Failed to load tiers:', error);
|
||||
} finally {
|
||||
this.loadingTiers = false;
|
||||
}
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
@@ -312,7 +335,7 @@ function adminSubscriptions() {
|
||||
// Save feature overrides
|
||||
await this.saveFeatureOverrides(this.editingSub.merchant_id);
|
||||
|
||||
this.successMessage = `Subscription for "${this.editingSub.store_name || this.editingSub.merchant_name}" updated`;
|
||||
this.successMessage = `Subscription for "${this.editingSub.merchant_name}" updated`;
|
||||
|
||||
this.closeModal();
|
||||
await this.loadSubscriptions();
|
||||
|
||||
Reference in New Issue
Block a user