/** * Returns a view that allows the checkout of a component to an asset. * * @author [A. Gianotto] [<*****@*****.**>] * @see ComponentsController::postCheckout() method that stores the data. * @since [v3.0] * @param int $componentId * @return View */ public function getCheckout($componentId) { // Check if the component exists if (is_null($component = Component::find($componentId))) { // Redirect to the component management page with error return redirect()->to('components')->with('error', trans('admin/components/message.not_found')); } elseif (!Company::isCurrentUserHasAccess($component)) { return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions')); } // Get the dropdown of assets and then pass it to the checkout view $assets_list = Helper::detailedAssetList(); return View::make('components/checkout', compact('component'))->with('assets_list', $assets_list); }
/** * Returns a form view to create a new asset maintenance. * * @see AssetMaintenancesController::postCreate() method that stores the data * @author Vincent Sposato <*****@*****.**> * @version v1.0 * @since [v1.8] * @return mixed */ public function getCreate($assetId = null) { // Prepare Asset Maintenance Type List $assetMaintenanceType = ['' => 'Select an asset maintenance type'] + AssetMaintenance::getImprovementOptions(); // Mark the selected asset, if it came in $selectedAsset = $assetId; $assets = Helper::detailedAssetList(); $supplier_list = Helper::suppliersList(); // Render the view return View::make('asset_maintenances/edit')->with('asset_list', $assets)->with('selectedAsset', $selectedAsset)->with('supplier_list', $supplier_list)->with('assetMaintenanceType', $assetMaintenanceType)->with('assetMaintenance', new AssetMaintenance()); }
/** * Provides the form view for checking out a license to a user. * Here we pass the license seat ID instead of the license ID, * because licenses themselves are never checked out to anyone, * only the seats associated with them. * * @author [A. Gianotto] [<*****@*****.**>] * @since [v1.0] * @param int $seatId * @return View */ public function getCheckout($seatId) { // Check if the license seat exists if (is_null($licenseseat = LicenseSeat::find($seatId))) { // Redirect to the asset management page with error return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found')); } elseif (!Company::isCurrentUserHasAccess($licenseseat->license)) { return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions')); } // Get the dropdown of users and then pass it to the checkout view $users_list = Helper::usersList(); $assets = Helper::detailedAssetList(); return View::make('licenses/checkout', compact('licenseseat'))->with('users_list', $users_list)->with('asset_list', $assets); }