1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/phortune/view/PhortuneChargeTableView.php
epriestley 8ba2a1fd44 Show only recent orders and charges on Phortune account profile page
Summary: Ref T2787. Currently, we show all orders/charges, which won't scale well. Show the 10 most recent and link to full order/charge history.

Test Plan: {F216325}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D10685
2014-10-13 11:14:50 -07:00

89 lines
1.9 KiB
PHP

<?php
final class PhortuneChargeTableView extends AphrontView {
private $charges;
private $handles;
private $showOrder;
public function setShowOrder($show_order) {
$this->showOrder = $show_order;
return $this;
}
public function getShowOrder() {
return $this->showOrder;
}
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function getHandles() {
return $this->handles;
}
public function setCharges(array $charges) {
$this->charges = $charges;
return $this;
}
public function getCharges() {
return $this->charges;
}
public function render() {
$charges = $this->getCharges();
$handles = $this->getHandles();
$viewer = $this->getUser();
$rows = array();
foreach ($charges as $charge) {
$rows[] = array(
$charge->getID(),
$handles[$charge->getCartPHID()]->renderLink(),
$handles[$charge->getProviderPHID()]->renderLink(),
$charge->getPaymentMethodPHID()
? $handles[$charge->getPaymentMethodPHID()]->renderLink()
: null,
$handles[$charge->getMerchantPHID()]->renderLink(),
$charge->getAmountAsCurrency()->formatForDisplay(),
$charge->getStatusForDisplay(),
phabricator_datetime($charge->getDateCreated(), $viewer),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
pht('ID'),
pht('Cart'),
pht('Provider'),
pht('Method'),
pht('Merchant'),
pht('Amount'),
pht('Status'),
pht('Created'),
))
->setColumnClasses(
array(
'',
'',
'',
'',
'',
'wide right',
'',
'',
))
->setColumnVisibility(
array(
true,
$this->getShowOrder(),
));
return $table;
}
}