Skip to content

console: Initial version. #376 (WIP) #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
console: Tweak Customer and Invoice rendering. #376
  • Loading branch information
epost committed Mar 20, 2020
commit 5c38b073e957339be3dbebc5d89eaf68fd3dd826
25 changes: 13 additions & 12 deletions console/src/Statebox/Console.purs
Original file line number Diff line number Diff line change
@@ -103,19 +103,20 @@ render state =
, h3 [] [ text "Customer's payment methods" ]
, div [] (state.paymentMethods <#> paymentMethodHtml)
, h2 [] [ text "Invoices" ]
, div []
(state.accounts <#> \account -> table []
(account.invoices <#> invoiceSummaryLineHtml)
)
, div [] (state.accounts <#> \account -> invoiceSummaries account.invoices)
]

invoiceSummaryLineHtml :: m. MonadAff m => Stripe.Invoice -> ComponentHTML Action ChildSlots m
invoiceSummaryLineHtml i =
tr [] [ td [] [ text $ i.customer_email ]
, td [] [ text $ i.account_name ]
, td [] [ text $ i.currency ]
, td [] [ text $ show i.amount_due ]
]
invoiceSummaries :: m. MonadAff m => Array Stripe.Invoice -> ComponentHTML Action ChildSlots m
invoiceSummaries invoices =
table [] (invoices <#> invoiceSummaryLineHtml)
where
invoiceSummaryLineHtml :: m. MonadAff m => Stripe.Invoice -> ComponentHTML Action ChildSlots m
invoiceSummaryLineHtml i =
tr [] [ td [] [ text $ i.customer_email ]
, td [] [ text $ i.account_name ]
, td [] [ text $ i.currency ]
, td [] [ text $ show i.amount_due ]
]

customerHtml :: m. MonadAff m => Stripe.Customer -> ComponentHTML Action ChildSlots m
customerHtml c =
@@ -138,7 +139,7 @@ customerHtml c =
, tr [] [ th [] [ text "balance" ]
, td [] [ text $ c.currency <> " " <> show c.balance <> " cents" ]
]
, tr [] [ th [] [ text "tax" ]
, tr [] [ th [] [ text "tax ids" ]
, td [] [ taxIdsHtml c.tax_ids ]
]
]