mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
1652e07b4d
Summary: Ref T2787. This provides a purchase detail screen (which has nothing useful on it yet) and converts a bunch of PHIDs into slightly more useful links. Test Plan: Browsed around my account. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D10284
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
abstract class PhortuneCartController
|
|
extends PhortuneController {
|
|
|
|
protected function buildCartContents(PhortuneCart $cart) {
|
|
|
|
$rows = array();
|
|
$total = 0;
|
|
foreach ($cart->getPurchases() as $purchase) {
|
|
$rows[] = array(
|
|
$purchase->getFullDisplayName(),
|
|
PhortuneCurrency::newFromUSDCents($purchase->getBasePriceInCents())
|
|
->formatForDisplay(),
|
|
$purchase->getQuantity(),
|
|
PhortuneCurrency::newFromUSDCents($purchase->getTotalPriceInCents())
|
|
->formatForDisplay(),
|
|
);
|
|
|
|
$total += $purchase->getTotalPriceInCents();
|
|
}
|
|
|
|
$rows[] = array(
|
|
phutil_tag('strong', array(), pht('Total')),
|
|
'',
|
|
'',
|
|
phutil_tag('strong', array(),
|
|
PhortuneCurrency::newFromUSDCents($total)->formatForDisplay()),
|
|
);
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setHeaders(
|
|
array(
|
|
pht('Item'),
|
|
pht('Price'),
|
|
pht('Qty.'),
|
|
pht('Total'),
|
|
));
|
|
$table->setColumnClasses(
|
|
array(
|
|
'wide',
|
|
'right',
|
|
'right',
|
|
'right',
|
|
));
|
|
|
|
return id(new PHUIObjectBoxView())
|
|
->setHeaderText(pht('Cart Contents'))
|
|
->appendChild($table);
|
|
}
|
|
|
|
}
|