3 final class PhortuneExternalOverviewController
4 extends PhortuneExternalController
{
6 protected function handleExternalRequest(AphrontRequest
$request) {
7 $xviewer = $this->getExternalViewer();
8 $email = $this->getAccountEmail();
9 $account = $email->getAccount();
11 $crumbs = $this->newExternalCrumbs()
12 ->addTextCrumb(pht('Viewing As "%s"', $email->getAddress()))
15 $header = id(new PHUIHeaderView())
16 ->setHeader(pht('Invoices and Receipts: %s', $account->getName()))
18 id(new PHUIButtonView())
21 ->setText(pht('Unsubscribe'))
22 ->setHref($email->getUnsubscribeURI())
25 $external_view = $this->newExternalView();
26 $invoices_view = $this->newInvoicesView();
27 $receipts_view = $this->newReceiptsView();
29 $column_view = id(new PHUITwoColumnView())
38 return $this->newPage()
42 pht('Invoices and Receipts'),
45 ->appendChild($column_view);
48 private function newInvoicesView() {
49 $xviewer = $this->getExternalViewer();
50 $email = $this->getAccountEmail();
51 $account = $email->getAccount();
53 $invoices = id(new PhortuneCartQuery())
55 ->withAccountPHIDs(array($account->getPHID()))
60 $header = id(new PHUIHeaderView())
61 ->setHeader(pht('Invoices'));
63 $invoices_table = id(new PhortuneOrderTableView())
65 ->setAccountEmail($email)
67 ->setIsInvoices(true);
69 return id(new PHUIObjectBoxView())
71 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
72 ->setTable($invoices_table);
75 private function newReceiptsView() {
76 $xviewer = $this->getExternalViewer();
77 $email = $this->getAccountEmail();
78 $account = $email->getAccount();
80 $receipts = id(new PhortuneCartQuery())
82 ->withAccountPHIDs(array($account->getPHID()))
87 $header = id(new PHUIHeaderView())
88 ->setHeader(pht('Receipts'));
90 $receipts_table = id(new PhortuneOrderTableView())
92 ->setAccountEmail($email)
93 ->setCarts($receipts);
95 return id(new PHUIObjectBoxView())
97 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
98 ->setTable($receipts_table);