diff --git a/apps/frontend/src/components/ui/admin/AdminBillingChargeCard.vue b/apps/frontend/src/components/ui/admin/AdminBillingChargeCard.vue
new file mode 100644
index 000000000..46f9e7927
--- /dev/null
+++ b/apps/frontend/src/components/ui/admin/AdminBillingChargeCard.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+ Succeeded
+ Failed
+ Cancelled
+ Processing
+ Upcoming
+ Expiring
+ {{ charge.status }}
+
+ •
+
+ Refund
+
+ Subscription
+ Started subscription
+ Subscription renewal
+
+ One-time charge
+ Proration charge
+ {{ charge.status }}
+
+
+ •
+ {{ formatPrice(charge.amount, charge.currency_code) }}
+
+
+
+ Product:
+ {{ productMetadata.ram / 1024 }}GB RAM
+ Unknown RAM
+ •
+ {{ productMetadata.cpu }} vCPU
+ Unknown CPU
+ •
+ {{ productMetadata.storage / 1024 }}GB Storage
+ Unknown Storage
+ •
+ {{ productMetadata.swap }}MB Swap
+ Unknown Swap
+
+
+
+ Ended:
+
+ Ends:
+ Issued:
+ Due:
+ {{ formatDateTime(charge.due) }}
+ ({{ formatRelativeTime(charge.due) }})
+
+
+ Last attempt:
+ Charged:
+ {{ formatDateTime(charge.last_attempt) }}
+ ({{ formatRelativeTime(charge.last_attempt) }})
+
+
+ {{ charge.status }}
+ •
+ {{ charge.type }}
+ •
+ {{ formatPrice(charge.amount, charge.currency_code) }}
+ •
+
+ {{ formatDateTimeShort(charge.due) }}
+
+ •
+ {{ charge.subscription_interval }}
+
+
+
+
+
+ Charge refunded
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/frontend/src/pages/admin/billing/[charge].vue b/apps/frontend/src/pages/admin/billing/[user].vue
similarity index 71%
rename from apps/frontend/src/pages/admin/billing/[charge].vue
rename to apps/frontend/src/pages/admin/billing/[user].vue
index 220da9129..936ac39ca 100644
--- a/apps/frontend/src/pages/admin/billing/[charge].vue
+++ b/apps/frontend/src/pages/admin/billing/[user].vue
@@ -198,115 +198,17 @@
-
-
-
-
-
-
- Succeeded
- Failed
- Cancelled
- Processing
- Upcoming
- Expiring
- {{ charge.status }}
-
- ⋅
-
- Refund
-
- Subscription
-
- Started subscription
-
- Subscription renewal
-
- One-time charge
- Proration charge
- {{ charge.status }}
-
-
- ⋅
- {{ formatPrice(charge.amount, charge.currency_code) }}
-
-
-
-
- Ended:
-
- Ends:
- Issued:
- Due:
- {{ formatDateTime(charge.due) }}
- ({{ formatRelativeTime(charge.due) }})
-
-
- Last attempt:
- Charged:
- {{ formatDateTime(charge.last_attempt) }}
- ({{ formatRelativeTime(charge.last_attempt) }})
-
-
-
- {{ charge.status }}
- ⋅
- {{ charge.type }}
- ⋅
- {{ formatPrice(charge.amount, charge.currency_code) }}
- ⋅
- {{ formatDateTimeShort(charge.due) }}
-
- ⋅ {{ charge.subscription_interval }}
-
-
-
-
-
- Charge refunded
-
-
-
-
-
-
-
-
-
-
+ :charge="charge"
+ :subscription="subscription"
+ :all-charges="charges"
+ :charge-index="index"
+ :charge-count="subscription.charges.length"
+ @refund="showRefundModal"
+ @modify="showModifyModal"
+ />
@@ -334,7 +236,6 @@ import {
StyledInput,
Toggle,
useFormatDateTime,
- useFormatPrice,
useRelativeTime,
useVIntl,
} from '@modrinth/ui'
@@ -344,21 +245,14 @@ import { useQuery } from '@tanstack/vue-query'
import dayjs from 'dayjs'
import ModrinthServersIcon from '~/components/brand/ModrinthServersIcon.vue'
+import AdminBillingChargeCard from '~/components/ui/admin/AdminBillingChargeCard.vue'
const { addNotification } = injectNotificationManager()
const { labrinth } = injectModrinthClient()
-const formatPrice = useFormatPrice()
const formatDateTime = useFormatDateTime({
timeStyle: 'short',
dateStyle: 'long',
})
-const formatDateTimeShort = useFormatDateTime({
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: 'numeric',
- minute: 'numeric',
-})
const vintl = useVIntl()
@@ -372,15 +266,15 @@ const messages = defineMessages({
},
})
-const chargeId = useRouteId('charge')
+const userId = useRouteId('user')
const {
data: user,
error: userError,
suspense: userSuspense,
} = useQuery({
- queryKey: ['user', chargeId],
- queryFn: () => labrinth.users_v2.get(chargeId),
+ queryKey: ['user', userId],
+ queryFn: () => labrinth.users_v2.get(userId),
})
onServerPrefetch(userSuspense)
@@ -533,27 +427,6 @@ async function modifyCharge() {
}
modifying.value = false
}
-
-const chargeStatuses = {
- open: {
- color: 'bg-blue',
- },
- processing: {
- color: 'bg-orange',
- },
- succeeded: {
- color: 'bg-green',
- },
- failed: {
- color: 'bg-red',
- },
- cancelled: {
- color: 'bg-red',
- },
- expiring: {
- color: 'bg-orange',
- },
-}