Skip to content

Commit

Permalink
clients/web: display discount in order/subscriptions table
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Nov 20, 2024
1 parent 5e5ad38 commit e2afb0d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ const ClientPage: React.FC<ClientPageProps> = ({
<>{formatCurrencyAndAmount(order.amount, order.currency)}</>
),
},
{
accessorKey: 'discount',
enableSorting: true,
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Discount" />
),
cell: ({ row: { original: order } }) => (
<>{order.discount ? order.discount.name : '—'}</>
),
},
...(customFields
? customFields.items.map<DataTableColumnDef<Order>>((field) => ({
accessorKey: `custom_field_data.${field.slug}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ const ClientPage: React.FC<ClientPageProps> = ({
)
},
},
{
id: 'discount',
accessorKey: 'discount',
enableSorting: true,
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Discount" />
),
cell: ({ row: { original: subscription } }) => (
<>{subscription.discount ? subscription.discount.name : '—'}</>
),
},
...(customFields
? customFields.items.map<DataTableColumnDef<Subscription>>((field) => ({
accessorKey: `custom_field_data.${field.slug}`,
Expand Down
1 change: 1 addition & 0 deletions clients/apps/web/src/components/Customization/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,5 @@ export const SUBSCRIPTION_ORDER_PREVIEW: UserSubscription = {
modified_at: new Date().toDateString(),
product_id: '123',
},
discount_id: null,
}

0 comments on commit e2afb0d

Please sign in to comment.