@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhortuneOrderItemsView
4 extends PhortuneOrderView {
5
6 public function render() {
7 $viewer = $this->getViewer();
8 $order = $this->getOrder();
9
10 $purchases = id(new PhortunePurchaseQuery())
11 ->setViewer($viewer)
12 ->withCartPHIDs(array($order->getPHID()))
13 ->execute();
14
15 $order->attachPurchases($purchases);
16
17 $rows = array();
18 foreach ($purchases as $purchase) {
19 $rows[] = array(
20 $purchase->getFullDisplayName(),
21 $purchase->getBasePriceAsCurrency()->formatForDisplay(),
22 $purchase->getQuantity(),
23 $purchase->getTotalPriceAsCurrency()->formatForDisplay(),
24 );
25 }
26
27 $rows[] = array(
28 phutil_tag('strong', array(), pht('Total')),
29 '',
30 '',
31 phutil_tag('strong', array(),
32 $order->getTotalPriceAsCurrency()->formatForDisplay()),
33 );
34
35 $table = new AphrontTableView($rows);
36 $table->setHeaders(
37 array(
38 pht('Item'),
39 pht('Price'),
40 pht('Qty.'),
41 pht('Total'),
42 ));
43 $table->setColumnClasses(
44 array(
45 'wide',
46 'right',
47 'right',
48 'right',
49 ));
50
51 return id(new PHUIObjectBoxView())
52 ->setHeaderText(pht('Items'))
53 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
54 ->setTable($table);
55 }
56
57
58}