Created
September 6, 2013 19:05
-
-
Save shafirov/6468439 to your computer and use it in GitHub Desktop.
Somewhat boring part of business app's UI.
Take note of handling optional order's date though
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun HtmlBodyTag.shortOrdersList(customer: CustomerProfile) { | |
val orders = customer.orders.toList().sortBy { -(it.date?.getMillis()?:0.toLong()) } | |
table(s("table table-striped table-condensed")) { | |
for (order in orders.take(5)) { | |
tr { | |
td { | |
order.date?.let { | |
small { | |
+DateTimeFormat.forPattern("dd/MM/yy").print(it)!! | |
} | |
} | |
} | |
td { | |
small { | |
+order.orderRef | |
} | |
} | |
td { | |
small(pull_right) { | |
+order.totalAmount.displayText() | |
} | |
} | |
} | |
} | |
} | |
if (orders.size() > 5) { | |
small { | |
a { | |
href=CustomerRoutes.ViewOrdersRoute(customer.id) | |
+"View" | |
} | |
+" all ${orders.size} orders" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment