예제 #1
0
 /**
  * Returns a new grid instance of all available
  * inventory variants for selection.
  *
  * @param int|string $workOrderId
  * @param int|string $inventoryId
  *
  * @return \Cartalyst\DataGrid\DataGrid
  */
 public function gridVariants($workOrderId, $inventoryId)
 {
     $workOrder = $this->workOrder->model()->findOrFail($workOrderId);
     $columns = ['id', 'name', 'category_id', 'created_at'];
     $settings = ['sort' => 'created_at', 'direction' => 'desc', 'threshold' => 10, 'throttle' => 11];
     $transformer = function (Inventory $item) use($workOrder) {
         return ['id' => $item->id, 'sku' => $item->sku_code ? $item->sku_code : '<em>None</em>', 'name' => $item->name, 'category' => $item->category ? $item->category->trail : null, 'current_stock' => $item->viewer()->lblCurrentStock(), 'created_at' => $item->created_at, 'view_url' => route('maintenance.inventory.show', [$item->id]), 'select_url' => route('maintenance.work-orders.parts.stocks.index', [$workOrder->id, $item->id])];
     };
     return $this->inventory->gridVariants($inventoryId, $columns, $settings, $transformer);
 }
예제 #2
0
 /**
  * Displays the edit form for the specified work order.
  *
  * @param string|int $id
  *
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $workOrder = $this->workOrder->model()->findOrFail($id);
     return view('maintenance::work-orders.edit', compact('workOrder'));
 }