InvoiceScriptsController.php
4 years ago
InvoicesListTable.php
4 years ago
InvoicesViewController.php
2 years ago
InvoicesViewController.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Controllers\Admin\Invoices; |
| 4 | |
| 5 | use SureCart\Controllers\Admin\AdminController; |
| 6 | use SureCart\Controllers\Admin\Invoices\InvoicesListTable; |
| 7 | |
| 8 | /** |
| 9 | * Handles product admin requests. |
| 10 | */ |
| 11 | class InvoicesViewController extends AdminController { |
| 12 | /** |
| 13 | * Invoices index. |
| 14 | */ |
| 15 | public function index() { |
| 16 | $table = new InvoicesListTable(); |
| 17 | $table->prepare_items(); |
| 18 | $this->withHeader( |
| 19 | array( |
| 20 | 'breadcrumbs' => [ |
| 21 | 'invoices' => [ |
| 22 | 'title' => __( 'Invoices', 'surecart' ), |
| 23 | ], |
| 24 | ], |
| 25 | ) |
| 26 | ); |
| 27 | return \SureCart::view( 'admin/invoices/index' )->with( |
| 28 | [ |
| 29 | 'table' => $table, |
| 30 | ] |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Coupons edit. |
| 36 | */ |
| 37 | public function edit() { |
| 38 | // enqueue needed script. |
| 39 | add_action( 'admin_enqueue_scripts', \SureCart::closure()->method( InvoiceScriptsController::class, 'enqueue' ) ); |
| 40 | // return view. |
| 41 | return '<div id="app"></div>'; |
| 42 | } |
| 43 | |
| 44 | public function archive( $request ) { |
| 45 | // flash an error message |
| 46 | \SureCart::flash()->add( 'errors', 'Please enter a valid email address.' ); |
| 47 | // redirect to order index page. |
| 48 | return \SureCart::redirect()->to( \SureCart::getUrl()->index( 'invoice' ) ); |
| 49 | } |
| 50 | } |
| 51 |