From d6b41759f0a833fcc44e6fc5aedfd8446271447b Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Dec 2016 18:18:13 -0800 Subject: [PATCH] Updated manufacturers, suppliers, depreciations for new route resources --- .../Controllers/DepreciationsController.php | 24 +-- .../Controllers/ManufacturersController.php | 87 +++++------ app/Http/Controllers/ReportsController.php | 4 +- .../Controllers/StatuslabelsController.php | 16 +- app/Http/Controllers/SuppliersController.php | 30 ++-- app/Http/Controllers/ViewAssetsController.php | 2 +- .../views/asset_maintenances/view.blade.php | 2 +- resources/views/depreciations/edit.blade.php | 3 +- resources/views/depreciations/index.blade.php | 2 +- resources/views/hardware/qr-view.blade.php | 4 +- resources/views/hardware/view.blade.php | 4 +- resources/views/layouts/default.blade.php | 20 +-- resources/views/manufacturers/edit.blade.php | 3 +- resources/views/manufacturers/index.blade.php | 2 +- resources/views/manufacturers/view.blade.php | 4 +- resources/views/statuslabels/edit.blade.php | 3 +- resources/views/statuslabels/index.blade.php | 2 +- resources/views/suppliers/edit.blade.php | 3 +- resources/views/suppliers/index.blade.php | 2 +- resources/views/suppliers/view.blade.php | 12 +- resources/views/users/view.blade.php | 10 +- routes/web.php | 137 +++++------------- tests/functional/DepreciationsCest.php | 10 +- tests/functional/ManufacturersCest.php | 10 +- tests/functional/StatusLabelsCest.php | 8 +- tests/functional/SuppliersCest.php | 10 +- 26 files changed, 178 insertions(+), 236 deletions(-) diff --git a/app/Http/Controllers/DepreciationsController.php b/app/Http/Controllers/DepreciationsController.php index f64ae1a117..22d0c86c71 100755 --- a/app/Http/Controllers/DepreciationsController.php +++ b/app/Http/Controllers/DepreciationsController.php @@ -28,7 +28,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('depreciations/index', compact('depreciations')); @@ -43,7 +43,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getCreate() + public function create() { // Show the page return View::make('depreciations/edit')->with('item', new Depreciation); @@ -58,7 +58,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function postCreate(Request $request) + public function store(Request $request) { // get the POST data @@ -91,12 +91,12 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getEdit($depreciationId = null) + public function edit($depreciationId = null) { // Check if the depreciation exists if (is_null($item = Depreciation::find($depreciationId))) { // Redirect to the blogs management page - return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist')); + return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); } return View::make('depreciations/edit', compact('item')); @@ -112,12 +112,12 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function postEdit(Request $request, $depreciationId = null) + public function update(Request $request, $depreciationId = null) { // Check if the depreciation exists if (is_null($depreciation = Depreciation::find($depreciationId))) { // Redirect to the blogs management page - return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist')); + return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); } // Depreciation data @@ -144,24 +144,24 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function getDelete($depreciationId) + public function destroy($depreciationId) { // Check if the depreciation exists if (is_null($depreciation = Depreciation::find($depreciationId))) { // Redirect to the blogs management page - return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.not_found')); + return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.not_found')); } if ($depreciation->has_models() > 0) { // Redirect to the asset management page - return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.assoc_users')); + return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.assoc_users')); } else { $depreciation->delete(); // Redirect to the depreciations management page - return redirect()->to('admin/settings/depreciations')->with('success', trans('admin/depreciations/message.delete.success')); + return redirect()->route('depreciations.index')->with('success', trans('admin/depreciations/message.delete.success')); } } @@ -208,7 +208,7 @@ class DepreciationsController extends Controller $rows = array(); foreach ($depreciations as $depreciation) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $depreciation->id, diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php index 7152e4ad02..aeaf4fdd9f 100755 --- a/app/Http/Controllers/ManufacturersController.php +++ b/app/Http/Controllers/ManufacturersController.php @@ -11,6 +11,7 @@ use Lang; use Redirect; use Str; use View; +use Illuminate\Http\Request; /** * This controller handles all actions related to Manufacturers for @@ -29,7 +30,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('manufacturers/index', compact('manufacturers')); @@ -44,7 +45,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getCreate() + public function create() { return View::make('manufacturers/edit')->with('item', new Manufacturer); } @@ -58,10 +59,10 @@ class ManufacturersController extends Controller * @since [v1.0] * @return Redirect */ - public function postCreate() + public function store(Request $request) { $manufacturer = new Manufacturer; - $manufacturer->name = e(Input::get('name')); + $manufacturer->name = e($request->input('name')); $manufacturer->user_id = Auth::user()->id; if ($manufacturer->save()) { @@ -81,12 +82,12 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getEdit($manufacturerId = null) + public function edit($manufacturerId = null) { // Check if the manufacturer exists if (is_null($item = Manufacturer::find($manufacturerId))) { // Redirect to the manufacturer page - return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist')); + return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist')); } // Show the page @@ -103,16 +104,16 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function postEdit($manufacturerId = null) + public function update(Request $request, $manufacturerId = null) { // Check if the manufacturer exists if (is_null($manufacturer = Manufacturer::find($manufacturerId))) { // Redirect to the manufacturer page - return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist')); + return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist')); } // Save the data - $manufacturer->name = e(Input::get('name')); + $manufacturer->name = e($request->input('name')); // Was it created? if ($manufacturer->save()) { @@ -133,25 +134,25 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getDelete($manufacturerId) + public function destroy($manufacturerId) { // Check if the manufacturer exists if (is_null($manufacturer = Manufacturer::find($manufacturerId))) { // Redirect to the manufacturers page - return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.not_found')); + return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.not_found')); } if ($manufacturer->has_models() > 0) { // Redirect to the asset management page - return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.assoc_users')); + return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.assoc_users')); } else { // Delete the manufacturer $manufacturer->delete(); // Redirect to the manufacturers management page - return redirect()->to('admin/settings/manufacturers')->with('success', trans('admin/manufacturers/message.delete.success')); + return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.delete.success')); } } @@ -169,7 +170,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getView($manufacturerId = null) + public function show($manufacturerId = null) { $manufacturer = Manufacturer::find($manufacturerId); @@ -194,30 +195,30 @@ class ManufacturersController extends Controller * @since [v1.0] * @return String JSON */ - public function getDatatable() + public function getDatatable(Request $request) { $manufacturers = Manufacturer::select(array('id','name'))->with('assets') ->whereNull('deleted_at'); - if (Input::has('search')) { - $manufacturers = $manufacturers->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $manufacturers = $manufacturers->TextSearch(e($request->input('search'))); } - if (Input::has('offset')) { - $offset = e(Input::get('offset')); + if ($request->has('offset')) { + $offset = e($request->input('offset')); } else { $offset = 0; } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } $allowed_columns = ['id','name']; - $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; $manufacturers->orderBy($sort, $order); @@ -227,11 +228,11 @@ class ManufacturersController extends Controller $rows = array(); foreach ($manufacturers as $manufacturer) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $manufacturer->id, - 'name' => (string)link_to('admin/settings/manufacturers/'.$manufacturer->id.'/view', e($manufacturer->name)), + 'name' => (string)link_to_route('manufacturers.show', e($manufacturer->name),['manufacturer' => $manufacturer->id]), 'assets' => $manufacturer->assets->count(), 'actions' => $actions ); @@ -279,26 +280,26 @@ class ManufacturersController extends Controller $manufacturer = $manufacturer->load('assets.model', 'assets.assigneduser', 'assets.assetstatus', 'assets.company'); $manufacturer_assets = $manufacturer->assets; - if (Input::has('search')) { - $manufacturer_assets = $manufacturer_assets->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $manufacturer_assets = $manufacturer_assets->TextSearch(e($request->input('search'))); } - if (Input::has('offset')) { - $offset = e(Input::get('offset')); + if ($request->has('offset')) { + $offset = e($request->input('offset')); } else { $offset = 0; } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } - $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $allowed_columns = ['id','name','serial','asset_tag']; - $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; $count = $manufacturer_assets->count(); $rows = array(); @@ -348,8 +349,8 @@ class ManufacturersController extends Controller $manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation'); $licenses = $manufacturer->licenses; - if (Input::has('search')) { - $licenses = $licenses->TextSearch(Input::get('search')); + if ($request->has('search')) { + $licenses = $licenses->TextSearch($request->input('search')); } $licenseCount = $licenses->count(); @@ -415,12 +416,12 @@ class ManufacturersController extends Controller ); $accessories = $manufacturer->accessories; - if (Input::has('search')) { - $accessories = $accessories->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $accessories = $accessories->TextSearch(e($request->input('search'))); } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } @@ -480,12 +481,12 @@ class ManufacturersController extends Controller ); $consumables = $manufacturer->consumables; - if (Input::has('search')) { - $consumables = $consumables->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $consumables = $consumables->TextSearch(e($request->input('search'))); } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 2d920accfb..67f33272c9 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -353,7 +353,7 @@ class ReportsController extends Controller } if (($activity->item) && ($activity->itemType()=="asset")) { - $activity_item = ''.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).''; + $activity_item = ''.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).''; $item_type = 'asset'; } elseif ($activity->item) { $activity_item = 'target_id).'">'.$activity->user->fullName().''; } elseif ($activity->target_type === "App\Models\Asset") { if($activity->target) { - $activity_target = ''.$activity->target->showAssetName().''; + $activity_target = ''.$activity->target->showAssetName().''; } else { $activity_target = ""; } diff --git a/app/Http/Controllers/StatuslabelsController.php b/app/Http/Controllers/StatuslabelsController.php index 08a3df65fe..52c40e8e5e 100755 --- a/app/Http/Controllers/StatuslabelsController.php +++ b/app/Http/Controllers/StatuslabelsController.php @@ -30,7 +30,7 @@ class StatuslabelsController extends Controller * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('statuslabels/index', compact('statuslabels')); @@ -84,7 +84,7 @@ class StatuslabelsController extends Controller * * @return View */ - public function getCreate() + public function create() { // Show the page $item = new Statuslabel; @@ -100,7 +100,7 @@ class StatuslabelsController extends Controller * * @return Redirect */ - public function postCreate(Request $request) + public function store(Request $request) { // create a new model instance @@ -133,7 +133,7 @@ class StatuslabelsController extends Controller } - public function store(Request $request) + public function apiStore(Request $request) { $statuslabel = new Statuslabel(); @@ -166,7 +166,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return View */ - public function getEdit($statuslabelId = null) + public function edit($statuslabelId = null) { // Check if the Statuslabel exists if (is_null($item = Statuslabel::find($statuslabelId))) { @@ -188,7 +188,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return Redirect */ - public function postEdit(Request $request, $statuslabelId = null) + public function update(Request $request, $statuslabelId = null) { // Check if the Statuslabel exists if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { @@ -232,7 +232,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return Redirect */ - public function getDelete($statuslabelId) + public function destroy($statuslabelId) { // Check if the Statuslabel exists if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { @@ -302,7 +302,7 @@ class StatuslabelsController extends Controller $label_type = trans('admin/statuslabels/table.undeployable'); } - $actions = ''; + $actions = ''; if ($statuslabel->color!='') { $color = '
'.e($statuslabel->color); diff --git a/app/Http/Controllers/SuppliersController.php b/app/Http/Controllers/SuppliersController.php index d6114c2b05..babb64b96d 100755 --- a/app/Http/Controllers/SuppliersController.php +++ b/app/Http/Controllers/SuppliersController.php @@ -28,7 +28,7 @@ class SuppliersController extends Controller * * @return View */ - public function getIndex() + public function index() { // Grab all the suppliers $suppliers = Supplier::orderBy('created_at', 'DESC')->get(); @@ -43,7 +43,7 @@ class SuppliersController extends Controller * * @return View */ - public function getCreate() + public function create() { return View::make('suppliers/edit')->with('item', new Supplier); } @@ -54,7 +54,7 @@ class SuppliersController extends Controller * * @return Redirect */ - public function postCreate() + public function store() { // get the POST data @@ -103,7 +103,7 @@ class SuppliersController extends Controller } - public function store(Request $request) + public function apiStore(Request $request) { $supplier = new Supplier; $supplier->name = e($request->input('name')); @@ -122,12 +122,12 @@ class SuppliersController extends Controller * @param int $supplierId * @return View */ - public function getEdit($supplierId = null) + public function edit($supplierId = null) { // Check if the supplier exists if (is_null($item = Supplier::find($supplierId))) { // Redirect to the supplier page - return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist')); + return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.does_not_exist')); } // Show the page @@ -141,12 +141,12 @@ class SuppliersController extends Controller * @param int $supplierId * @return Redirect */ - public function postEdit($supplierId = null) + public function update($supplierId = null) { // Check if the supplier exists if (is_null($supplier = Supplier::find($supplierId))) { // Redirect to the supplier page - return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist')); + return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.does_not_exist')); } // Save the data @@ -193,25 +193,25 @@ class SuppliersController extends Controller * @param int $supplierId * @return Redirect */ - public function getDelete($supplierId) + public function destroy($supplierId) { // Check if the supplier exists if (is_null($supplier = Supplier::find($supplierId))) { // Redirect to the suppliers page - return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.not_found')); + return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.not_found')); } if ($supplier->num_assets() > 0) { // Redirect to the asset management page - return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.assoc_users')); + return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.assoc_users')); } else { // Delete the supplier $supplier->delete(); // Redirect to the suppliers management page - return redirect()->to('admin/settings/suppliers')->with('success', trans('admin/suppliers/message.delete.success')); + return redirect()->route('suppliers.index')->with('success', trans('admin/suppliers/message.delete.success')); } } @@ -223,7 +223,7 @@ class SuppliersController extends Controller * @param int $assetId * @return View **/ - public function getView($supplierId = null) + public function show($supplierId = null) { $supplier = Supplier::find($supplierId); @@ -273,11 +273,11 @@ class SuppliersController extends Controller $rows = array(); foreach ($suppliers as $supplier) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $supplier->id, - 'name' => (string)link_to('admin/settings/suppliers/'.$supplier->id.'/view', e($supplier->name)), + 'name' => (string)link_to_route('suppliers.show', e($supplier->name), ['supplier' => $supplier->id ]), 'contact' => e($supplier->contact), 'address' => e($supplier->address).' '.e($supplier->address2).' '.e($supplier->city).' '.e($supplier->state).' '.e($supplier->country), 'phone' => e($supplier->phone), diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php index d7cf2e5296..680efacbf3 100755 --- a/app/Http/Controllers/ViewAssetsController.php +++ b/app/Http/Controllers/ViewAssetsController.php @@ -108,7 +108,7 @@ class ViewAssetsController extends Controller $data['item_type'] = $itemType; if ($fullItemType == Asset::class) { - $data['item_url'] = route('view/hardware', $item->id); + $data['item_url'] = route('hardware.show', $item->id); $slackMessage = ' Asset <'.url('/').'/hardware/'.$item->id.'/view'.'|'.$item->showAssetName().'> requested by <'.url('/').'/users/'.$item->user_id.'/view'.'|'.$user->fullName().'>.'; } else { $data['item_url'] = route("view/${itemType}", $item->id); diff --git a/resources/views/asset_maintenances/view.blade.php b/resources/views/asset_maintenances/view.blade.php index 33b5419947..f13402c0cc 100644 --- a/resources/views/asset_maintenances/view.blade.php +++ b/resources/views/asset_maintenances/view.blade.php @@ -47,7 +47,7 @@ use Carbon\Carbon;
{{ trans('admin/asset_maintenances/table.asset_name') }}: - + {{ $assetMaintenance->asset->name }}
diff --git a/resources/views/depreciations/edit.blade.php b/resources/views/depreciations/edit.blade.php index 70037f5121..cd65031847 100755 --- a/resources/views/depreciations/edit.blade.php +++ b/resources/views/depreciations/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/depreciations/general.create') , 'updateText' => trans('admin/depreciations/general.update'), 'helpTitle' => trans('admin/depreciations/general.about_asset_depreciations'), - 'helpText' => trans('admin/depreciations/general.about_depreciations') + 'helpText' => trans('admin/depreciations/general.about_depreciations'), + 'formAction' => ($item) ? route('about_depreciations.update', ['about_depreciation' => $item->id]) : route('about_depreciations.store'), ]) {{-- Page content --}} diff --git a/resources/views/depreciations/index.blade.php b/resources/views/depreciations/index.blade.php index bfad07a5f4..8a55fcb855 100755 --- a/resources/views/depreciations/index.blade.php +++ b/resources/views/depreciations/index.blade.php @@ -7,7 +7,7 @@ Asset Depreciations @stop @section('header_right') - + {{ trans('general.create') }} @stop diff --git a/resources/views/hardware/qr-view.blade.php b/resources/views/hardware/qr-view.blade.php index f6b2396f35..7c2ae9edb6 100644 --- a/resources/views/hardware/qr-view.blade.php +++ b/resources/views/hardware/qr-view.blade.php @@ -73,7 +73,7 @@ @if ($asset->model->manufacturer)
{{ trans('admin/hardware/form.manufacturer') }}: - + {{ $asset->model->manufacturer->name }}
{{ trans('admin/hardware/form.model') }}: @@ -175,7 +175,7 @@ @foreach ($asset->licenseseats as $seat) - {{ $seat->license->name }} + {{ $seat->license->name }} {{ $seat->license->serial }} {{ trans('general.checkin') }} diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 0bd86cccaf..ead5569e68 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -438,7 +438,7 @@ @foreach ($asset->licenseseats as $seat) - {{ $seat->license->name }} + {{ $seat->license->name }} {{ $seat->license->serial }} {{ trans('general.checkin') }} @@ -614,7 +614,7 @@ @endif @elseif($log->target instanceof \App\Models\Asset) @if ($log->target->deleted_at=='') - + {{ $log->target->showAssetName() }} @else diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 720e9bdec4..1499cfe08d 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -326,32 +326,32 @@ @lang('general.asset_models') -
  • +
  • @lang('general.categories')
  • -
  • - +
  • + @lang('general.manufacturers')
  • -
  • - +
  • + @lang('general.suppliers')
  • -
  • - +
  • + @lang('general.status_labels')
  • -
  • - +
  • + @lang('general.depreciation')
  • -
  • +
  • @lang('general.locations') diff --git a/resources/views/manufacturers/edit.blade.php b/resources/views/manufacturers/edit.blade.php index 23eada86ea..2c05f288ec 100755 --- a/resources/views/manufacturers/edit.blade.php +++ b/resources/views/manufacturers/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/manufacturers/table.create') , 'updateText' => trans('admin/manufacturers/table.update'), 'helpTitle' => trans('admin/manufacturers/table.about_manufacturers_title'), - 'helpText' => trans('admin/manufacturers/table.about_manufacturers_text') + 'helpText' => trans('admin/manufacturers/table.about_manufacturers_text'), + 'formAction' => ($item) ? route('manufacturers.update', ['manufacturer' => $item->id]) : route('manufacturers.store'), ]) diff --git a/resources/views/manufacturers/index.blade.php b/resources/views/manufacturers/index.blade.php index cee0ca0fb9..d453eebb2d 100755 --- a/resources/views/manufacturers/index.blade.php +++ b/resources/views/manufacturers/index.blade.php @@ -8,7 +8,7 @@ {{-- Page title --}} @section('header_right') - + {{ trans('general.create') }} @stop diff --git a/resources/views/manufacturers/view.blade.php b/resources/views/manufacturers/view.blade.php index 0ecb663f81..04f077b13f 100644 --- a/resources/views/manufacturers/view.blade.php +++ b/resources/views/manufacturers/view.blade.php @@ -14,8 +14,8 @@
  • @stop diff --git a/resources/views/statuslabels/edit.blade.php b/resources/views/statuslabels/edit.blade.php index 06e1132059..acf74e2aff 100755 --- a/resources/views/statuslabels/edit.blade.php +++ b/resources/views/statuslabels/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/statuslabels/table.create') , 'updateText' => trans('admin/statuslabels/table.update'), 'helpTitle' => trans('admin/statuslabels/table.about'), - 'helpText' => trans('admin/statuslabels/table.info') + 'helpText' => trans('admin/statuslabels/table.info'), + 'formAction' => ($item) ? route('statuslabels.update', ['statuslabel' => $item->id]) : route('statuslabels.store'), ]) {{-- Page content --}} diff --git a/resources/views/statuslabels/index.blade.php b/resources/views/statuslabels/index.blade.php index d3dafc1856..728fce8575 100755 --- a/resources/views/statuslabels/index.blade.php +++ b/resources/views/statuslabels/index.blade.php @@ -7,7 +7,7 @@ @stop @section('header_right') - + {{ trans('general.create') }} @stop {{-- Page content --}} diff --git a/resources/views/suppliers/edit.blade.php b/resources/views/suppliers/edit.blade.php index f9e126f2ce..5b9a2b78a8 100755 --- a/resources/views/suppliers/edit.blade.php +++ b/resources/views/suppliers/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/suppliers/table.create') , 'updateText' => trans('admin/suppliers/table.update'), 'helpTitle' => trans('admin/suppliers/table.about_suppliers_title'), - 'helpText' => trans('admin/suppliers/table.about_suppliers_text') + 'helpText' => trans('admin/suppliers/table.about_suppliers_text'), + 'formAction' => ($item) ? route('suppliers.update', ['supplier' => $item->id]) : route('suppliers.store'), ]) {{-- Page content --}} diff --git a/resources/views/suppliers/index.blade.php b/resources/views/suppliers/index.blade.php index b7e1542fcb..d999328f8c 100755 --- a/resources/views/suppliers/index.blade.php +++ b/resources/views/suppliers/index.blade.php @@ -11,7 +11,7 @@ @section('header_right') - {{ trans('general.create') }} + {{ trans('general.create') }} @stop diff --git a/resources/views/suppliers/view.blade.php b/resources/views/suppliers/view.blade.php index f4230e913c..276f58434f 100755 --- a/resources/views/suppliers/view.blade.php +++ b/resources/views/suppliers/view.blade.php @@ -8,7 +8,7 @@ @stop @section('header_right') - + {{ trans('admin/suppliers/table.update') }} @stop @@ -48,8 +48,8 @@ @foreach ($supplier->assets as $supplierassets) - {{ $supplierassets->asset_tag }} - {{ $supplierassets->showAssetName() }} + {{ $supplierassets->asset_tag }} + {{ $supplierassets->showAssetName() }} @if ($supplierassets->assigneduser) @@ -151,8 +151,8 @@ @foreach ($supplier->licenses as $license) - {{ $license->name }} - {{ $license->serial }} + {{ $license->name }} + {{ $license->serial }} @endforeach @@ -196,7 +196,7 @@ @foreach ($supplier->asset_maintenances as $improvement) @if (is_null($improvement->deleted_at)) - {{ $improvement->asset->name }} + {{ $improvement->asset->name }} {{ $improvement->improvement_type }} {{ $improvement->start_date }} {{ $improvement->completion_date }} diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index 90f90c9ff9..177d1bbac0 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -193,10 +193,10 @@ @can('assets.view') - {{ $asset->asset_tag }} + {{ $asset->asset_tag }} @endcan - {{ $asset->name }} + {{ $asset->name }} @can('assets.edit') @@ -223,10 +223,10 @@ @foreach ($user->licenses as $license) - {{ $license->name }} + {{ $license->name }} - {{ mb_strimwidth($license->serial, 0, 50, "...") }} + {{ mb_strimwidth($license->serial, 0, 50, "...") }} @can('licenses.edit') Checkin @@ -403,7 +403,7 @@ @if (($log->item) && ($log->itemType()=="asset")) - {{ $log->item->asset_tag }} - {{ $log->item->showAssetName() }} + {{ $log->item->asset_tag }} - {{ $log->item->showAssetName() }} @elseif ($log->item) {{ $log->item->name }} @else diff --git a/routes/web.php b/routes/web.php index 46194494cb..54458c3d0f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,40 +3,63 @@ use App\Models\CheckoutRequest; use App\Models\Location; use App\Models\Statuslabel; - - - /* * Custom Fields Routes - */ +*/ Route::resource('fields', 'CustomFieldsController', [ - 'parameters' => ['customfield' => 'field_id', 'fieldset' => 'fieldset_id'] +'parameters' => ['customfield' => 'field_id', 'fieldset' => 'fieldset_id'] ]); /* * Companies - */ +*/ Route::resource('companies', 'CompaniesController', [ - 'parameters' => ['company' => 'company_id'] +'parameters' => ['company' => 'company_id'] ]); /* * Categories +*/ +Route::resource('categories', 'CategoriesController', [ + 'parameters' => ['category' => 'category_id'] +]); + +/* +* Locations +*/ +Route::resource('locations', 'LocationsController', [ + 'parameters' => ['location' => 'location_id'] +]); + +/* +* Manufacturers +*/ +Route::resource('manufacturers', 'ManufacturersController', [ + 'parameters' => ['manufacturer' => 'manufacturers_id'] +]); + +/* +* Suppliers +*/ +Route::resource('suppliers', 'SuppliersController', [ + 'parameters' => ['supplier' => 'supplier_id'] +]); + +/* +* Depreciations */ - Route::resource('categories', 'CategoriesController', [ - 'parameters' => ['category' => 'category_id'] + Route::resource('depreciations', 'DepreciationsController', [ + 'parameters' => ['depreciation' => 'depreciation_id'] ]); /* - * Locations + * Status Labels */ - Route::resource('locations', 'LocationsController', [ - 'parameters' => ['location' => 'location_id'] + Route::resource('statuslabels', 'StatuslabelsController', [ + 'parameters' => ['statuslabel' => 'statuslabel_id'] ]); - - /* |-------------------------------------------------------------------------- | Log Routes @@ -163,92 +186,6 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function () Route::get('/', [ 'as' => 'settings/backups', 'uses' => 'SettingsController@getBackups' ]); }); - - - - # Manufacturers - Route::group([ 'prefix' => 'manufacturers' ], function () { - - Route::get('/', [ 'as' => 'manufacturers', 'uses' => 'ManufacturersController@getIndex' ]); - Route::get( - 'create', - [ 'as' => 'create/manufacturer', 'uses' => 'ManufacturersController@getCreate' ] - ); - Route::post('create', 'ManufacturersController@postCreate'); - Route::get( - '{manufacturerId}/edit', - [ 'as' => 'update/manufacturer', 'uses' => 'ManufacturersController@getEdit' ] - ); - Route::post('{manufacturerId}/edit', 'ManufacturersController@postEdit'); - Route::get( - '{manufacturerId}/delete', - [ 'as' => 'delete/manufacturer', 'uses' => 'ManufacturersController@getDelete' ] - ); - Route::get( - '{manufacturerId}/view', - [ 'as' => 'view/manufacturer', 'uses' => 'ManufacturersController@getView' ] - ); - }); - - # Suppliers - Route::group([ 'prefix' => 'suppliers' ], function () { - - Route::get('/', [ 'as' => 'suppliers', 'uses' => 'SuppliersController@getIndex' ]); - Route::get('create', [ 'as' => 'create/supplier', 'uses' => 'SuppliersController@getCreate' ]); - Route::post('create', 'SuppliersController@postCreate'); - Route::get( - '{supplierId}/edit', - [ 'as' => 'update/supplier', 'uses' => 'SuppliersController@getEdit' ] - ); - Route::post('{supplierId}/edit', 'SuppliersController@postEdit'); - Route::get( - '{supplierId}/delete', - [ 'as' => 'delete/supplier', 'uses' => 'SuppliersController@getDelete' ] - ); - Route::get('{supplierId}/view', [ 'as' => 'view/supplier', 'uses' => 'SuppliersController@getView' ]); - }); - - - - # Depreciations - Route::group([ 'prefix' => 'depreciations' ], function () { - - Route::get('/', [ 'as' => 'depreciations', 'uses' => 'DepreciationsController@getIndex' ]); - Route::get( - 'create', - [ 'as' => 'create/depreciations', 'uses' => 'DepreciationsController@getCreate' ] - ); - Route::post('create', 'DepreciationsController@postCreate'); - Route::get( - '{depreciationId}/edit', - [ 'as' => 'update/depreciations', 'uses' => 'DepreciationsController@getEdit' ] - ); - Route::post('{depreciationId}/edit', 'DepreciationsController@postEdit'); - Route::get( - '{depreciationId}/delete', - [ 'as' => 'delete/depreciations', 'uses' => 'DepreciationsController@getDelete' ] - ); - }); - - - - # Status Labels - Route::group([ 'prefix' => 'statuslabels' ], function () { - - Route::get('/', [ 'as' => 'statuslabels', 'uses' => 'StatuslabelsController@getIndex' ]); - Route::get('create', [ 'as' => 'create/statuslabel', 'uses' => 'StatuslabelsController@getCreate' ]); - Route::post('create', 'StatuslabelsController@postCreate'); - Route::get( - '{statuslabelId}/edit', - [ 'as' => 'update/statuslabel', 'uses' => 'StatuslabelsController@getEdit' ] - ); - Route::post('{statuslabelId}/edit', 'StatuslabelsController@postEdit'); - Route::get( - '{statuslabelId}/delete', - [ 'as' => 'delete/statuslabel', 'uses' => 'StatuslabelsController@getDelete' ] - ); - }); - }); # Custom fields support diff --git a/tests/functional/DepreciationsCest.php b/tests/functional/DepreciationsCest.php index 50c9ff0f99..21567348ce 100644 --- a/tests/functional/DepreciationsCest.php +++ b/tests/functional/DepreciationsCest.php @@ -16,7 +16,7 @@ class DepreciationCest { $I->wantTo('Test Depreciation Creation'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('create/depreciations')); + $I->amOnPage(route('depreciations.create')); $I->seeInTitle('Create Depreciation'); $I->dontSee('Create Depreciation', '.page-header'); $I->see('Create Depreciation', 'h1.pull-left'); @@ -25,7 +25,7 @@ class DepreciationCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage(route('create/depreciations')); + $I->amOnPage(route('depreciations.create')); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); @@ -35,7 +35,7 @@ class DepreciationCest public function failsShortValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with short name"); - $I->amOnPage(route('create/depreciations')); + $I->amOnPage(route('depreciations.create')); $I->fillField('name', 't2'); $I->click('Save'); $I->seeElement('.alert-danger'); @@ -50,7 +50,7 @@ class DepreciationCest 'months' => $depreciation->months ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('create/depreciations')); + $I->amOnPage(route('depreciations.create')); $I->submitForm('form#create-form', $values); $I->seeRecord('depreciations', $values); $I->seeElement('.alert-success'); @@ -59,7 +59,7 @@ class DepreciationCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete a depreciation'); - $I->amOnPage(route('delete/depreciations', $I->getDepreciationId())); + $I->amOnPage(route('depreciations.destroy', $I->getDepreciationId())); $I->seeElement('.alert-success'); } } diff --git a/tests/functional/ManufacturersCest.php b/tests/functional/ManufacturersCest.php index 119ca402e4..131ba59970 100644 --- a/tests/functional/ManufacturersCest.php +++ b/tests/functional/ManufacturersCest.php @@ -18,7 +18,7 @@ class ManufacturersCest { $I->wantTo('Test Manufacturer Creation'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('create/manufacturer')); + $I->amOnPage(route('manufacturers.create')); $I->seeInTitle('Create Manufacturer'); $I->see('Create Manufacturer', 'h1.pull-left'); } @@ -26,7 +26,7 @@ class ManufacturersCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage(route('create/manufacturer')); + $I->amOnPage(route('manufacturers.create')); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); @@ -35,7 +35,7 @@ class ManufacturersCest public function failsShortValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with short name"); - $I->amOnPage(route('create/manufacturer')); + $I->amOnPage(route('manufacturers.create')); $I->fillField('name', 't'); $I->click('Save'); $I->seeElement('.alert-danger'); @@ -48,7 +48,7 @@ class ManufacturersCest 'name' => $manufacturer->name ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('create/manufacturer')); + $I->amOnPage(route('manufacturers.create')); $I->submitForm('form#create-form', $values); $I->seeRecord('manufacturers', $values); $I->seeElement('.alert-success'); @@ -57,7 +57,7 @@ class ManufacturersCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete a manufacturer'); - $I->amOnPage(route('delete/manufacturer', Manufacturer::doesntHave('models') + $I->amOnPage(route('manufacturers.destroy', Manufacturer::doesntHave('models') ->doesntHave('accessories') ->doesntHave('consumables') ->doesntHave('licenses')->first()->id diff --git a/tests/functional/StatusLabelsCest.php b/tests/functional/StatusLabelsCest.php index cbe50f0f74..a00eb00217 100644 --- a/tests/functional/StatusLabelsCest.php +++ b/tests/functional/StatusLabelsCest.php @@ -18,7 +18,7 @@ class StatusLabelsCest { $I->wantTo('ensure that the create statuslabels form loads without errors'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('create/statuslabel')); + $I->amOnPage(route('statuslabels.create')); $I->dontSee('Create Status Label', '.page-header'); $I->see('Create Status Label', 'h1.pull-left'); } @@ -26,7 +26,7 @@ class StatusLabelsCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage(route('create/statuslabel')); + $I->amOnPage(route('statuslabels.create')); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); @@ -53,7 +53,7 @@ class StatusLabelsCest 'show_in_nav' => true, ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('create/statuslabel')); + $I->amOnPage(route('statuslabels.create')); $I->submitForm('form#create-form', $submitValues); $I->seeRecord('status_labels', $recordValues); $I->seeElement('.alert-success'); @@ -62,7 +62,7 @@ class StatusLabelsCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete a Status Label'); - $I->amOnPage(route('delete/statuslabel', Statuslabel::doesntHave('assets')->first()->id)); + $I->amOnPage(route('statuslabels.destroy', Statuslabel::doesntHave('assets')->first()->id)); $I->seeElement('.alert-success'); } } diff --git a/tests/functional/SuppliersCest.php b/tests/functional/SuppliersCest.php index f2fbabea04..1461595efe 100644 --- a/tests/functional/SuppliersCest.php +++ b/tests/functional/SuppliersCest.php @@ -18,7 +18,7 @@ class SuppliersCest { $I->wantTo('ensure that the create settings/suppliers form loads without errors'); $I->lookForwardTo('seeing it load without errors'); - $I->amOnPage(route('create/supplier')); + $I->amOnPage(route('suppliers.create')); $I->dontSee('Create Supplier', '.page-header'); $I->see('Create Supplier', 'h1.pull-left'); } @@ -26,7 +26,7 @@ class SuppliersCest public function failsEmptyValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with blank elements"); - $I->amOnPage(route('create/supplier')); + $I->amOnPage(route('suppliers.create')); $I->click('Save'); $I->seeElement('.alert-danger'); $I->see('The name field is required.', '.alert-msg'); @@ -35,7 +35,7 @@ class SuppliersCest public function failsShortValidation(FunctionalTester $I) { $I->wantTo("Test Validation Fails with short name"); - $I->amOnPage(route('create/supplier')); + $I->amOnPage(route('suppliers.create')); $I->fillField('name', 't2'); $I->click('Save'); $I->seeElement('.alert-danger'); @@ -60,7 +60,7 @@ class SuppliersCest 'notes' => $supplier->notes ]; $I->wantTo("Test Validation Succeeds"); - $I->amOnPage(route('create/supplier')); + $I->amOnPage(route('suppliers.create')); $I->submitForm('form#create-form', $values); $I->seeRecord('suppliers', $values); $I->seeElement('.alert-success'); @@ -69,7 +69,7 @@ class SuppliersCest public function allowsDelete(FunctionalTester $I) { $I->wantTo('Ensure I can delete a supplier'); - $I->amOnPage(route('delete/supplier', Supplier::doesntHave('assets')->doesntHave('licenses')->first()->id)); + $I->amOnPage(route('suppliers.destroy', Supplier::doesntHave('assets')->doesntHave('licenses')->first()->id)); $I->seeElement('.alert-success'); } }