public function tableInventory(WorkOrder $workOrder, Inventory $inventory)
    {
        $inventory = $inventory->noVariants();

        return $this->table->of('work-orders.inventory', function (TableGrid $table) use ($inventory, $workOrder) {
            $table->with($inventory)->paginate($this->perPage);

            $table->pageName = 'page-inventory';

            $table->column('ID', 'id');

            $table->column('sku', function (Column $column) {
                $column->label = 'SKU';

                $column->value = function (Inventory $item) {
                    return $item->getSku();
                };
            });

            $table->column('name', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return link_to_route('maintenance.inventory.show', $item->name, [$item->getKey()]);
                };
            });

            $table->column('category', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return $item->category->trail;
                };
            });

            $table->column('current_stock', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return $item->getTotalStock();
                };
            });

            $table->column('select', function (Column $column) use ($workOrder) {
                $column->value = function (Inventory $item) use ($workOrder) {
                    $route = 'maintenance.work-orders.parts.stocks.index';

                    $params = [$workOrder->getKey(), $item->getKey()];

                    $attributes = [
                        'class' => 'btn btn-default btn-sm',
                    ];

                    return link_to_route($route, 'Select', $params, $attributes);
                };
            });
        });
    }
public function tableInventory(WorkOrder $workOrder, Inventory $inventory)
    {
        $inventory = $inventory->noVariants();

        return $this->table->of('work-orders.inventory', function (TableGrid $table) use ($inventory, $workOrder) {
            $table->with($inventory)->paginate($this->perPage);

            $table->pageName = 'page-inventory';

            $table->column('ID', 'id');

            $table->column('sku', function (Column $column) {
                $column->label = 'SKU';

                $column->value = function (Inventory $item) {
                    return $item->getSku();
                };
            });

            $table->column('name', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return link_to_route('maintenance.inventory.show', $item->name, [$item->getKey()]);
                };
            });

            $table->column('category', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return $item->category->trail;
                };
            });

            $table->column('current_stock', function (Column $column) {
                $column->value = function (Inventory $item) {
                    return $item->getTotalStock();
                };
            });

            $table->column('select', function (Column $column) use ($workOrder) {
                $column->value = function (Inventory $item) use ($workOrder) {
                    $route = 'maintenance.work-orders.parts.stocks.index';

                    $params = [$workOrder->getKey(), $item->getKey()];

                    $attributes = [
                        'class' => 'btn btn-default btn-sm',
                    ];

                    return link_to_route($route, 'Select', $params, $attributes);
                };
            });
        });
    }
public function tableInventory ( WorkOrder $ workOrder , Inventory $ inventory ) { $ inventory = $ inventory -> noVariants ( ) ; return $ this -> table -> of ( 'work-orders.inventory' , function ( TableGrid $ table ) use ( $ inventory , $ workOrder ) { $ table -> with ( $ inventory ) -> paginate ( $ this -> perPage ) ; $ table -> pageName = 'page-inventory' ; $ table -> column ( 'ID' , 'id' ) ; $ table -> column ( 'sku' , function ( Column $ column ) { $ column -> label = 'SKU' ; $ column -> value = function ( Inventory $ item ) { return $ item -> getSku ( ) ; } ; } ) ; $ table -> column ( 'name' , function ( Column $ column ) { $ column -> value = function ( Inventory $ item ) { return link_to_route ( 'maintenance.inventory.show' , $ item -> name , [ $ item -> getKey ( ) ] ) ; } ; } ) ; $ table -> column ( 'category' , function ( Column $ column ) { $ column -> value = function ( Inventory $ item ) { return $ item -> category -> trail ; } ; } ) ; $ table -> column ( 'current_stock' , function ( Column $ column ) { $ column -> value = function ( Inventory $ item ) { return $ item -> getTotalStock ( ) ; } ; } ) ; $ table -> column ( 'select' , function ( Column $ column ) use ( $ workOrder ) { $ column -> value = function ( Inventory $ item ) use ( $ workOrder ) { $ route = 'maintenance.work-orders.parts.stocks.index' ; $ params = [ $ workOrder -> getKey ( ) , $ item -> getKey ( ) ] ; $ attributes = [ 'class' => 'btn btn-default btn-sm' , ] ; return link_to_route ( $ route , 'Select' , $ params , $ attributes ) ; } ; } ) ; } ) ; }
Displays all inventory available for selection.

@param WorkOrder $workOrder
@param Inventory $inventory

@return \Orchestra\Contracts\Html\Builder
Displays all inventory available for selection .