public function getAssetsAwaitingApprovalAction()
 {
     /**
      * @var \DDD\Service\Finance\Budget $budgetService
      * @var BackofficeAuthenticationService $auth
      */
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $router = $this->getEvent()->getRouter();
     if (!$auth->checkUniversalDashboardPermission(UserService::DASHBOARD_PENDING_ASSETS)) {
         return $this->redirect()->toRoute('home');
     }
     /** @var \DDD\Service\Warehouse\Asset $assetService */
     $assetService = $this->getServiceLocator()->get('service_warehouse_asset');
     $dataSet = $assetService->getAssetsAwaitingApproval();
     $preparedData = [];
     if ($dataSet && count($dataSet)) {
         /** @var \DDD\Domain\Warehouse\Assets\Consumable | \DDD\Domain\Warehouse\Assets\Valuable $row */
         foreach ($dataSet as $row) {
             /** @var \DDD\Dao\WHOrder\Order $orderDao */
             $orderDao = $this->getServiceLocator()->get('dao_wh_order_order');
             $orders = '<span class ="label label-danger">No matching orders found.</span>';
             $quantity = 1;
             $assetType = 'valuable';
             if (!$row instanceof \DDD\Domain\Warehouse\Assets\Valuable) {
                 $quantity = $row->getQuantityChange();
                 $assetType = 'consumable';
                 $assetId = $row->getAssetId();
                 $entityId = $row->getId();
             } else {
                 $assetId = $row->getId();
                 $entityId = $row->getId();
             }
             if ($assetType === 'consumable') {
                 if ($row->getShipmentStatus() == AssetService::SHIPMENT_STATUS_NOT_OK) {
                     $matchingOrders = $orderDao->getMatchingOrdersForConsumableAsset($row->getCategoryId(), $row->getLocationEntityType(), $row->getLocationEntityId(), $quantity, $row->getShipmentStatus(), $checkOrderExist = 1);
                     // if it did not find any order so will shown in UD
                     if ($matchingOrders->count()) {
                         $matchingOrders = $orderDao->getMatchingOrdersForConsumableAsset($row->getCategoryId(), $row->getLocationEntityType(), $row->getLocationEntityId(), $quantity, $row->getShipmentStatus(), $checkOrderExist = 0);
                         // Did not find any order which its quantity is less than to this asset
                         if (!$matchingOrders->count()) {
                             continue;
                         }
                     }
                 } else {
                     $matchingOrders = $orderDao->getMatchingOrdersForConsumableAsset($row->getCategoryId(), $row->getLocationEntityType(), $row->getLocationEntityId(), $quantity, $row->getShipmentStatus(), $checkOrderExist = 0);
                     // Did not find any order which its quantity is equal to this asset
                     if (!$matchingOrders->count()) {
                         continue;
                     }
                 }
             } else {
                 $matchingOrders = $orderDao->getMatchingOrdersForAsset($row->getCategoryId(), $row->getLocationEntityType(), $row->getLocationEntityId(), $quantity);
             }
             $actions = '<a
                 class="btn btn-xs btn-danger asset-resolve"
                 data-target="/warehouse/asset/resolve-' . $assetType . '/' . $entityId . '"
                 > Resolve </a>';
             if ($matchingOrders->count()) {
                 $orders = '<input type="hidden" class="asset-quantity" value="' . $quantity . '">';
                 $orders .= '<select class="asset-matching-orders form-control">';
                 foreach ($matchingOrders as $order) {
                     $orders .= '<option value="' . $order['id'] . '">' . $order['title'] . ', ' . Order::getShortShippingStatuses()[$order['status']] . '</span>, ' . $order['quantity'] . '/' . $order['remaining_quantity'] . '</option>';
                 }
                 $actions = '<a
                     class="btn btn-xs btn-success asset-received"
                     data-target="/warehouse/asset/receive-' . $assetType . '/' . $entityId . '"
                     > Received </a> ' . $actions;
             }
             $url = $router->assemble(['action' => 'edit-consumable', 'id' => $assetId], ['name' => 'warehouse/asset']);
             if ($assetType === 'valuable') {
                 $url = $router->assemble(['action' => 'edit-valuable', 'id' => $assetId], ['name' => 'warehouse/asset']);
             }
             $actions .= ' <a
                 class="btn btn-xs btn-primary"
                 href="' . $url . '"
                 target="_blank"> View </a>';
             $preparedData[] = [$row->getLocationName(), $row->getCategoryName(), $row->getLastUpdaterFullName(), $orders, $quantity, $actions];
         }
     }
     return new JsonModel(["aaData" => $preparedData]);
 }