InvoiceScriptsController.php
3 years ago
InvoicesListTable.php
3 years ago
InvoicesViewController.php
3 years ago
InvoicesViewController.php
49 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 | [ |
| 20 | 'invoices' => [ |
| 21 | 'title' => __( 'Invoices', 'surecart' ), |
| 22 | ], |
| 23 | ] |
| 24 | ); |
| 25 | return \SureCart::view( 'admin/invoices/index' )->with( |
| 26 | [ |
| 27 | 'table' => $table, |
| 28 | ] |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Coupons edit. |
| 34 | */ |
| 35 | public function edit() { |
| 36 | // enqueue needed script. |
| 37 | add_action( 'admin_enqueue_scripts', \SureCart::closure()->method( InvoiceScriptsController::class, 'enqueue' ) ); |
| 38 | // return view. |
| 39 | return '<div id="app"></div>'; |
| 40 | } |
| 41 | |
| 42 | public function archive( $request ) { |
| 43 | // flash an error message |
| 44 | \SureCart::flash()->add( 'errors', 'Please enter a valid email address.' ); |
| 45 | // redirect to order index page. |
| 46 | return \SureCart::redirect()->to( \SureCart::getUrl()->index( 'invoice' ) ); |
| 47 | } |
| 48 | } |
| 49 |