/**
  * Returns a new table of specified items variants available
  * for selection on the current work order.
  *
  * @param WorkOrder $workOrder
  * @param Inventory $item
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function tableVariants(WorkOrder $workOrder, Inventory $item)
 {
     $variants = $item->variants();
     return $this->table->of('work-orders.parts.variants', function (TableGrid $table) use($variants, $workOrder) {
         $table->with($variants)->paginate($this->perPage);
         $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);
             };
         });
     });
 }