mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
8ba2a1fd44
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
89 lines
1.9 KiB
PHP
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;
|
|
}
|
|
|
|
}
|