![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/inventory.corals.io/Corals/modules/Inventory/DataTables/ |
<?php namespace Corals\Modules\Inventory\DataTables; use Corals\Foundation\DataTables\BaseDataTable; use Corals\Modules\Inventory\Facades\Inventory; use Corals\Modules\Inventory\Models\Order; use Corals\Modules\Inventory\Transformers\OrderTransformer; use Yajra\DataTables\EloquentDataTable; class OrdersDataTable extends BaseDataTable { /** * Build DataTable class. * * @param mixed $query Results from query() method. * @return \Yajra\DataTables\DataTableAbstract */ public function dataTable($query) { $this->setResourceUrl(config('inventory.models.order.resource_url')); $dataTable = new EloquentDataTable($query); return $dataTable->setTransformer(new OrderTransformer()); } /** * Get query source of dataTable. * @param Order $model * @return \Illuminate\Database\Eloquent\Builder|static */ public function query(Order $model) { return $model->newQuery(); } /** * Get columns. * * @return array */ protected function getColumns() { return [ 'id' => ['visible' => false], 'number' => ['title' => trans('Inventory::attributes.order.number')], 'inventory' => [ 'title' => trans('Inventory::attributes.order.inventory'), 'searchable' => false, 'orderable' => false ], 'sub_total' => ['title' => trans('Inventory::attributes.order.sub_total')], 'payment_status' => [ 'title' => trans('Inventory::attributes.order.payment_status'), 'orderable' => false, 'searchable' => false ], 'user_id' => ['title' => trans('Inventory::attributes.order.user_id')], 'supplier_id' => ['title' => trans('Inventory::attributes.order.supplier')], 'discount_total' => ['title' => trans('Inventory::attributes.order.discount_total')], 'tax_total' => ['title' => trans('Inventory::attributes.order.tax_total')], 'total' => ['title' => trans('Inventory::attributes.order.total')], 'status' => ['title' => trans('Corals::attributes.status')], 'type' => ['title' => trans('Inventory::attributes.order.type')], ]; } public function getFilters() { return [ 'inventory_id' => [ 'title' => trans('Inventory::attributes.order.inventory'), 'class' => 'col-md-2', 'type' => 'select', 'options' => Inventory::getInventoriesList(null, true), 'active' => true ], 'status' => [ 'title' => trans('Inventory::attributes.order.status'), 'class' => 'col-md-2', 'type' => 'select', 'options' => trans('Inventory::attributes.order.status_options'), 'active' => true ], ]; } }