addColumn('text', 'typeTitle', ['title' => 'Type', 'orderBy' => 'typeTitle']); $this->addColumn('enum', 'tribeStatus', [ 'title' => 'Status', 'orderBy' => 'tribeStatus', 'values' => $this->getConfigArray('userLicenseStatuses'), ]); $this->addColumn('date', 'approvedDate', [ 'title' => 'Approved', 'orderBy' => 'approvedDate', 'emptyText' => 'N/A' ]); $this->addColumn('date', 'expiredOnDate', [ 'title' => 'Expires', 'orderBy' => 'expiredOnDate', 'emptyText' => 'N/A' ]); $this->addColumn('money', 'totalTitle', ['title' => 'Cost', 'orderBy' => 'totalTitle', 'emptyText' => 'N/A']); $this->addColumn('options', 'options', [ 'actions' => [ 'view' => ['title' => 'View Details', 'linkTitle' => 'View Details'], 'renew' => [], 'receipt' => ['title' => 'View Receipt', 'linkTitle' => 'View Receipt', 'target' => '_blank'], 'printLicense' => ['title' => 'Print License', 'linkTitle' => 'Print License', 'target' => '_blank'], 'premiumReceipt' => ['title' => 'View Receipt', 'linkTitle' => 'View Receipt', 'target' => '_blank'], 'premiumPayment' => ['title' => 'Pay', 'linkTitle' => 'Pay'], ], 'initCallback' => function (array $options) { $options['column']['actions']['receipt']['url'] = PdfView::getReceiptUrl($options['row']['id']); $options['column']['actions']['printLicense']['url'] = PdfView::getLicenseUrl( $options['row']['id'], $options['row']['tribeId']); $options['column']['actions']['premiumReceipt']['url'] = PdfView::getPremiumReceiptUrl( $options['row']['id'], $options['row']['tribeId']); $options['column']['actions']['premiumPayment']['url'] = LicensePremiumView::getPremiumPaymentPage( $options['row']['id'], $options['row']['tribeId']); switch ($options['row']['status']) { case Entity::STATUS_ACTIVE: //@TODO unset($options['column']['actions']['renew']); break; } switch ($options['row']['type']) { case Entity::USER_TYPE_LICENSE: unset($options['column']['actions']['printLicense']); unset($options['column']['actions']['premiumReceipt']); unset($options['column']['actions']['premiumPayment']); break; case Entity::USER_TYPE_PREMIUM: unset($options['column']['actions']['view']); unset($options['column']['actions']['receipt']); if ($options['row']['tribeStatus'] != Entity::TRIBE_STATUS_APPROVED) { unset($options['column']['actions']['printLicense']); unset($options['column']['actions']['premiumReceipt']); if ($options['row']['tribeStatus'] != Entity::TRIBE_STATUS_APPROVED_PENDING) { unset($options['column']['actions']['premiumPayment']); } } else { unset($options['column']['actions']['premiumPayment']); if (!((float) $options['row']['totalTitle'])) { unset($options['column']['actions']['premiumReceipt']); } } break; } }, ]); return $this; } }