Updated manufacturers, suppliers, depreciations for new route resources

This commit is contained in:
snipe 2016-12-15 18:18:13 -08:00
parent e8945ad85e
commit d6b41759f0
26 changed files with 178 additions and 236 deletions

View file

@ -28,7 +28,7 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getIndex() public function index()
{ {
// Show the page // Show the page
return View::make('depreciations/index', compact('depreciations')); return View::make('depreciations/index', compact('depreciations'));
@ -43,7 +43,7 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getCreate() public function create()
{ {
// Show the page // Show the page
return View::make('depreciations/edit')->with('item', new Depreciation); return View::make('depreciations/edit')->with('item', new Depreciation);
@ -58,7 +58,7 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return Redirect * @return Redirect
*/ */
public function postCreate(Request $request) public function store(Request $request)
{ {
// get the POST data // get the POST data
@ -91,12 +91,12 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getEdit($depreciationId = null) public function edit($depreciationId = null)
{ {
// Check if the depreciation exists // Check if the depreciation exists
if (is_null($item = Depreciation::find($depreciationId))) { if (is_null($item = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page // 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')); return View::make('depreciations/edit', compact('item'));
@ -112,12 +112,12 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return Redirect * @return Redirect
*/ */
public function postEdit(Request $request, $depreciationId = null) public function update(Request $request, $depreciationId = null)
{ {
// Check if the depreciation exists // Check if the depreciation exists
if (is_null($depreciation = Depreciation::find($depreciationId))) { if (is_null($depreciation = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page // 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 // Depreciation data
@ -144,24 +144,24 @@ class DepreciationsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return Redirect * @return Redirect
*/ */
public function getDelete($depreciationId) public function destroy($depreciationId)
{ {
// Check if the depreciation exists // Check if the depreciation exists
if (is_null($depreciation = Depreciation::find($depreciationId))) { if (is_null($depreciation = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page // 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) { if ($depreciation->has_models() > 0) {
// Redirect to the asset management page // 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 { } else {
$depreciation->delete(); $depreciation->delete();
// Redirect to the depreciations management page // 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(); $rows = array();
foreach ($depreciations as $depreciation) { foreach ($depreciations as $depreciation) {
$actions = '<a href="'.route('update/depreciations', $depreciation->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/depreciations', $depreciation->id).'" data-content="'.trans('admin/depreciations/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($depreciation->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; $actions = '<a href="'.route('depreciations.edit', $depreciation->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('depreciations.destroy', $depreciation->id).'" data-content="'.trans('admin/depreciations/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($depreciation->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array( $rows[] = array(
'id' => $depreciation->id, 'id' => $depreciation->id,

View file

@ -11,6 +11,7 @@ use Lang;
use Redirect; use Redirect;
use Str; use Str;
use View; use View;
use Illuminate\Http\Request;
/** /**
* This controller handles all actions related to Manufacturers for * This controller handles all actions related to Manufacturers for
@ -29,7 +30,7 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getIndex() public function index()
{ {
// Show the page // Show the page
return View::make('manufacturers/index', compact('manufacturers')); return View::make('manufacturers/index', compact('manufacturers'));
@ -44,7 +45,7 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getCreate() public function create()
{ {
return View::make('manufacturers/edit')->with('item', new Manufacturer); return View::make('manufacturers/edit')->with('item', new Manufacturer);
} }
@ -58,10 +59,10 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return Redirect * @return Redirect
*/ */
public function postCreate() public function store(Request $request)
{ {
$manufacturer = new Manufacturer; $manufacturer = new Manufacturer;
$manufacturer->name = e(Input::get('name')); $manufacturer->name = e($request->input('name'));
$manufacturer->user_id = Auth::user()->id; $manufacturer->user_id = Auth::user()->id;
if ($manufacturer->save()) { if ($manufacturer->save()) {
@ -81,12 +82,12 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getEdit($manufacturerId = null) public function edit($manufacturerId = null)
{ {
// Check if the manufacturer exists // Check if the manufacturer exists
if (is_null($item = Manufacturer::find($manufacturerId))) { if (is_null($item = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturer page // 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 // Show the page
@ -103,16 +104,16 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function postEdit($manufacturerId = null) public function update(Request $request, $manufacturerId = null)
{ {
// Check if the manufacturer exists // Check if the manufacturer exists
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) { if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturer page // 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 // Save the data
$manufacturer->name = e(Input::get('name')); $manufacturer->name = e($request->input('name'));
// Was it created? // Was it created?
if ($manufacturer->save()) { if ($manufacturer->save()) {
@ -133,25 +134,25 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return View * @return View
*/ */
public function getDelete($manufacturerId) public function destroy($manufacturerId)
{ {
// Check if the manufacturer exists // Check if the manufacturer exists
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) { if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturers page // 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) { if ($manufacturer->has_models() > 0) {
// Redirect to the asset management page // 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 { } else {
// Delete the manufacturer // Delete the manufacturer
$manufacturer->delete(); $manufacturer->delete();
// Redirect to the manufacturers management page // 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] * @since [v1.0]
* @return View * @return View
*/ */
public function getView($manufacturerId = null) public function show($manufacturerId = null)
{ {
$manufacturer = Manufacturer::find($manufacturerId); $manufacturer = Manufacturer::find($manufacturerId);
@ -194,30 +195,30 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return String JSON * @return String JSON
*/ */
public function getDatatable() public function getDatatable(Request $request)
{ {
$manufacturers = Manufacturer::select(array('id','name'))->with('assets') $manufacturers = Manufacturer::select(array('id','name'))->with('assets')
->whereNull('deleted_at'); ->whereNull('deleted_at');
if (Input::has('search')) { if ($request->has('search')) {
$manufacturers = $manufacturers->TextSearch(e(Input::get('search'))); $manufacturers = $manufacturers->TextSearch(e($request->input('search')));
} }
if (Input::has('offset')) { if ($request->has('offset')) {
$offset = e(Input::get('offset')); $offset = e($request->input('offset'));
} else { } else {
$offset = 0; $offset = 0;
} }
if (Input::has('limit')) { if ($request->has('limit')) {
$limit = e(Input::get('limit')); $limit = e($request->input('limit'));
} else { } else {
$limit = 50; $limit = 50;
} }
$allowed_columns = ['id','name']; $allowed_columns = ['id','name'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc'; $order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$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';
$manufacturers->orderBy($sort, $order); $manufacturers->orderBy($sort, $order);
@ -227,11 +228,11 @@ class ManufacturersController extends Controller
$rows = array(); $rows = array();
foreach ($manufacturers as $manufacturer) { foreach ($manufacturers as $manufacturer) {
$actions = '<a href="'.route('update/manufacturer', $manufacturer->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/manufacturer', $manufacturer->id).'" data-content="'.trans('admin/manufacturers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($manufacturer->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; $actions = '<a href="'.route('manufacturers.edit', $manufacturer->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('manufacturers.destroy', $manufacturer->id).'" data-content="'.trans('admin/manufacturers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($manufacturer->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array( $rows[] = array(
'id' => $manufacturer->id, '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(), 'assets' => $manufacturer->assets->count(),
'actions' => $actions 'actions' => $actions
); );
@ -279,26 +280,26 @@ class ManufacturersController extends Controller
$manufacturer = $manufacturer->load('assets.model', 'assets.assigneduser', 'assets.assetstatus', 'assets.company'); $manufacturer = $manufacturer->load('assets.model', 'assets.assigneduser', 'assets.assetstatus', 'assets.company');
$manufacturer_assets = $manufacturer->assets; $manufacturer_assets = $manufacturer->assets;
if (Input::has('search')) { if ($request->has('search')) {
$manufacturer_assets = $manufacturer_assets->TextSearch(e(Input::get('search'))); $manufacturer_assets = $manufacturer_assets->TextSearch(e($request->input('search')));
} }
if (Input::has('offset')) { if ($request->has('offset')) {
$offset = e(Input::get('offset')); $offset = e($request->input('offset'));
} else { } else {
$offset = 0; $offset = 0;
} }
if (Input::has('limit')) { if ($request->has('limit')) {
$limit = e(Input::get('limit')); $limit = e($request->input('limit'));
} else { } else {
$limit = 50; $limit = 50;
} }
$order = Input::get('order') === 'asc' ? 'asc' : 'desc'; $order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$allowed_columns = ['id','name','serial','asset_tag']; $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(); $count = $manufacturer_assets->count();
$rows = array(); $rows = array();
@ -348,8 +349,8 @@ class ManufacturersController extends Controller
$manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation'); $manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation');
$licenses = $manufacturer->licenses; $licenses = $manufacturer->licenses;
if (Input::has('search')) { if ($request->has('search')) {
$licenses = $licenses->TextSearch(Input::get('search')); $licenses = $licenses->TextSearch($request->input('search'));
} }
$licenseCount = $licenses->count(); $licenseCount = $licenses->count();
@ -415,12 +416,12 @@ class ManufacturersController extends Controller
); );
$accessories = $manufacturer->accessories; $accessories = $manufacturer->accessories;
if (Input::has('search')) { if ($request->has('search')) {
$accessories = $accessories->TextSearch(e(Input::get('search'))); $accessories = $accessories->TextSearch(e($request->input('search')));
} }
if (Input::has('limit')) { if ($request->has('limit')) {
$limit = e(Input::get('limit')); $limit = e($request->input('limit'));
} else { } else {
$limit = 50; $limit = 50;
} }
@ -480,12 +481,12 @@ class ManufacturersController extends Controller
); );
$consumables = $manufacturer->consumables; $consumables = $manufacturer->consumables;
if (Input::has('search')) { if ($request->has('search')) {
$consumables = $consumables->TextSearch(e(Input::get('search'))); $consumables = $consumables->TextSearch(e($request->input('search')));
} }
if (Input::has('limit')) { if ($request->has('limit')) {
$limit = e(Input::get('limit')); $limit = e($request->input('limit'));
} else { } else {
$limit = 50; $limit = 50;
} }

View file

@ -353,7 +353,7 @@ class ReportsController extends Controller
} }
if (($activity->item) && ($activity->itemType()=="asset")) { if (($activity->item) && ($activity->itemType()=="asset")) {
$activity_item = '<a href="'.route('view/hardware', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>'; $activity_item = '<a href="'.route('hardware.show', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>';
$item_type = 'asset'; $item_type = 'asset';
} elseif ($activity->item) { } elseif ($activity->item) {
$activity_item = '<a href="' . route('view/' . $activity->itemType(), $activity_item = '<a href="' . route('view/' . $activity->itemType(),
@ -370,7 +370,7 @@ class ReportsController extends Controller
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->user->fullName().'</a>'; $activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->user->fullName().'</a>';
} elseif ($activity->target_type === "App\Models\Asset") { } elseif ($activity->target_type === "App\Models\Asset") {
if($activity->target) { if($activity->target) {
$activity_target = '<a href="'.route('view/hardware', $activity->target_id).'">'.$activity->target->showAssetName().'</a>'; $activity_target = '<a href="'.route('hardware.show', $activity->target_id).'">'.$activity->target->showAssetName().'</a>';
} else { } else {
$activity_target = ""; $activity_target = "";
} }

View file

@ -30,7 +30,7 @@ class StatuslabelsController extends Controller
* @return View * @return View
*/ */
public function getIndex() public function index()
{ {
// Show the page // Show the page
return View::make('statuslabels/index', compact('statuslabels')); return View::make('statuslabels/index', compact('statuslabels'));
@ -84,7 +84,7 @@ class StatuslabelsController extends Controller
* *
* @return View * @return View
*/ */
public function getCreate() public function create()
{ {
// Show the page // Show the page
$item = new Statuslabel; $item = new Statuslabel;
@ -100,7 +100,7 @@ class StatuslabelsController extends Controller
* *
* @return Redirect * @return Redirect
*/ */
public function postCreate(Request $request) public function store(Request $request)
{ {
// create a new model instance // 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(); $statuslabel = new Statuslabel();
@ -166,7 +166,7 @@ class StatuslabelsController extends Controller
* @param int $statuslabelId * @param int $statuslabelId
* @return View * @return View
*/ */
public function getEdit($statuslabelId = null) public function edit($statuslabelId = null)
{ {
// Check if the Statuslabel exists // Check if the Statuslabel exists
if (is_null($item = Statuslabel::find($statuslabelId))) { if (is_null($item = Statuslabel::find($statuslabelId))) {
@ -188,7 +188,7 @@ class StatuslabelsController extends Controller
* @param int $statuslabelId * @param int $statuslabelId
* @return Redirect * @return Redirect
*/ */
public function postEdit(Request $request, $statuslabelId = null) public function update(Request $request, $statuslabelId = null)
{ {
// Check if the Statuslabel exists // Check if the Statuslabel exists
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
@ -232,7 +232,7 @@ class StatuslabelsController extends Controller
* @param int $statuslabelId * @param int $statuslabelId
* @return Redirect * @return Redirect
*/ */
public function getDelete($statuslabelId) public function destroy($statuslabelId)
{ {
// Check if the Statuslabel exists // Check if the Statuslabel exists
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
@ -302,7 +302,7 @@ class StatuslabelsController extends Controller
$label_type = trans('admin/statuslabels/table.undeployable'); $label_type = trans('admin/statuslabels/table.undeployable');
} }
$actions = '<a href="'.route('update/statuslabel', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $statuslabel->id).'" data-content="'.trans('admin/statuslabels/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; $actions = '<a href="'.route('statuslabels.edit', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('statuslabels.destroy', $statuslabel->id).'" data-content="'.trans('admin/statuslabels/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
if ($statuslabel->color!='') { if ($statuslabel->color!='') {
$color = '<div class="pull-left" style="margin-right: 5px; height: 20px; width: 20px; background-color: '.e($statuslabel->color).'"></div>'.e($statuslabel->color); $color = '<div class="pull-left" style="margin-right: 5px; height: 20px; width: 20px; background-color: '.e($statuslabel->color).'"></div>'.e($statuslabel->color);

View file

@ -28,7 +28,7 @@ class SuppliersController extends Controller
* *
* @return View * @return View
*/ */
public function getIndex() public function index()
{ {
// Grab all the suppliers // Grab all the suppliers
$suppliers = Supplier::orderBy('created_at', 'DESC')->get(); $suppliers = Supplier::orderBy('created_at', 'DESC')->get();
@ -43,7 +43,7 @@ class SuppliersController extends Controller
* *
* @return View * @return View
*/ */
public function getCreate() public function create()
{ {
return View::make('suppliers/edit')->with('item', new Supplier); return View::make('suppliers/edit')->with('item', new Supplier);
} }
@ -54,7 +54,7 @@ class SuppliersController extends Controller
* *
* @return Redirect * @return Redirect
*/ */
public function postCreate() public function store()
{ {
// get the POST data // 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 = new Supplier;
$supplier->name = e($request->input('name')); $supplier->name = e($request->input('name'));
@ -122,12 +122,12 @@ class SuppliersController extends Controller
* @param int $supplierId * @param int $supplierId
* @return View * @return View
*/ */
public function getEdit($supplierId = null) public function edit($supplierId = null)
{ {
// Check if the supplier exists // Check if the supplier exists
if (is_null($item = Supplier::find($supplierId))) { if (is_null($item = Supplier::find($supplierId))) {
// Redirect to the supplier page // 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 // Show the page
@ -141,12 +141,12 @@ class SuppliersController extends Controller
* @param int $supplierId * @param int $supplierId
* @return Redirect * @return Redirect
*/ */
public function postEdit($supplierId = null) public function update($supplierId = null)
{ {
// Check if the supplier exists // Check if the supplier exists
if (is_null($supplier = Supplier::find($supplierId))) { if (is_null($supplier = Supplier::find($supplierId))) {
// Redirect to the supplier page // 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 // Save the data
@ -193,25 +193,25 @@ class SuppliersController extends Controller
* @param int $supplierId * @param int $supplierId
* @return Redirect * @return Redirect
*/ */
public function getDelete($supplierId) public function destroy($supplierId)
{ {
// Check if the supplier exists // Check if the supplier exists
if (is_null($supplier = Supplier::find($supplierId))) { if (is_null($supplier = Supplier::find($supplierId))) {
// Redirect to the suppliers page // 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) { if ($supplier->num_assets() > 0) {
// Redirect to the asset management page // 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 { } else {
// Delete the supplier // Delete the supplier
$supplier->delete(); $supplier->delete();
// Redirect to the suppliers management page // 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 * @param int $assetId
* @return View * @return View
**/ **/
public function getView($supplierId = null) public function show($supplierId = null)
{ {
$supplier = Supplier::find($supplierId); $supplier = Supplier::find($supplierId);
@ -273,11 +273,11 @@ class SuppliersController extends Controller
$rows = array(); $rows = array();
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
$actions = '<a href="'.route('update/supplier', $supplier->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/supplier', $supplier->id).'" data-content="'.trans('admin/suppliers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($supplier->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; $actions = '<a href="'.route('suppliers.edit', $supplier->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('suppliers.destroy', $supplier->id).'" data-content="'.trans('admin/suppliers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($supplier->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array( $rows[] = array(
'id' => $supplier->id, '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), 'contact' => e($supplier->contact),
'address' => e($supplier->address).' '.e($supplier->address2).' '.e($supplier->city).' '.e($supplier->state).' '.e($supplier->country), 'address' => e($supplier->address).' '.e($supplier->address2).' '.e($supplier->city).' '.e($supplier->state).' '.e($supplier->country),
'phone' => e($supplier->phone), 'phone' => e($supplier->phone),

View file

@ -108,7 +108,7 @@ class ViewAssetsController extends Controller
$data['item_type'] = $itemType; $data['item_type'] = $itemType;
if ($fullItemType == Asset::class) { 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().'>.'; $slackMessage = ' Asset <'.url('/').'/hardware/'.$item->id.'/view'.'|'.$item->showAssetName().'> requested by <'.url('/').'/users/'.$item->user_id.'/view'.'|'.$user->fullName().'>.';
} else { } else {
$data['item_url'] = route("view/${itemType}", $item->id); $data['item_url'] = route("view/${itemType}", $item->id);

View file

@ -47,7 +47,7 @@ use Carbon\Carbon;
<div class="row"> <div class="row">
<div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;"> <div class="col-md-3 col-sm-3" style="padding-bottom: 10px; margin-left: 15px; word-wrap: break-word;">
<strong>{{ trans('admin/asset_maintenances/table.asset_name') }}: </strong> <strong>{{ trans('admin/asset_maintenances/table.asset_name') }}: </strong>
<a href="{{ route('view/hardware', $assetMaintenance->asset_id) }}"> <a href="{{ route('hardware.show', $assetMaintenance->asset_id) }}">
{{ $assetMaintenance->asset->name }} {{ $assetMaintenance->asset->name }}
</a> </a>
</div> </div>

View file

@ -2,7 +2,8 @@
'createText' => trans('admin/depreciations/general.create') , 'createText' => trans('admin/depreciations/general.create') ,
'updateText' => trans('admin/depreciations/general.update'), 'updateText' => trans('admin/depreciations/general.update'),
'helpTitle' => trans('admin/depreciations/general.about_asset_depreciations'), '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 --}} {{-- Page content --}}

View file

@ -7,7 +7,7 @@ Asset Depreciations
@stop @stop
@section('header_right') @section('header_right')
<a href="{{ route('create/depreciations') }}" class="btn btn-primary pull-right"> <a href="{{ route('depreciations.create') }}" class="btn btn-primary pull-right">
{{ trans('general.create') }}</a> {{ trans('general.create') }}</a>
@stop @stop

View file

@ -73,7 +73,7 @@
@if ($asset->model->manufacturer) @if ($asset->model->manufacturer)
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.manufacturer') }}: </strong> <div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.manufacturer') }}: </strong>
<a href="{{ route('update/manufacturer', $asset->model->manufacturer->id) }}"> <a href="{{ route('manufacturers.edit', $asset->model->manufacturer->id) }}">
{{ $asset->model->manufacturer->name }} {{ $asset->model->manufacturer->name }}
</a> </div> </a> </div>
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.model') }}:</strong> <div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.model') }}:</strong>
@ -175,7 +175,7 @@
<tbody> <tbody>
@foreach ($asset->licenseseats as $seat) @foreach ($asset->licenseseats as $seat)
<tr> <tr>
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td> <td><a href="{{ route('licenses.show', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td> <td>{{ $seat->license->serial }}</td>
<td><a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a> <td><a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
</td> </td>

View file

@ -438,7 +438,7 @@
<tbody> <tbody>
@foreach ($asset->licenseseats as $seat) @foreach ($asset->licenseseats as $seat)
<tr> <tr>
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td> <td><a href="{{ route('licenses.show', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td> <td>{{ $seat->license->serial }}</td>
<td> <td>
<a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a> <a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
@ -614,7 +614,7 @@
@endif @endif
@elseif($log->target instanceof \App\Models\Asset) @elseif($log->target instanceof \App\Models\Asset)
@if ($log->target->deleted_at=='') @if ($log->target->deleted_at=='')
<a href="{{ route('view/hardware', $log->target_id) }}"> <a href="{{ route('hardware.show', $log->target_id) }}">
{{ $log->target->showAssetName() }} {{ $log->target->showAssetName() }}
</a> </a>
@else @else

View file

@ -326,32 +326,32 @@
<i class="fa fa-th fa-fw"></i> @lang('general.asset_models') <i class="fa fa-th fa-fw"></i> @lang('general.asset_models')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/categories*') ? ' class="active"' : '') !!}> <li {!! (Request::is('categories*') ? ' class="active"' : '') !!}>
<a href="{{ route('categories.index') }}"> <a href="{{ route('categories.index') }}">
<i class="fa fa-check fa-fw"></i> @lang('general.categories') <i class="fa fa-check fa-fw"></i> @lang('general.categories')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/manufacturers*') ? ' class="active"' : '') !!}> <li {!! (Request::is('manufacturers*') ? ' class="active"' : '') !!}>
<a href="{{ url('admin/settings/manufacturers') }}"> <a href="{{ route('manufacturers.index') }}">
<i class="fa fa-briefcase fa-fw"></i> @lang('general.manufacturers') <i class="fa fa-briefcase fa-fw"></i> @lang('general.manufacturers')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/suppliers*') ? ' class="active"' : '') !!}> <li {!! (Request::is('suppliers*') ? ' class="active"' : '') !!}>
<a href="{{ url('admin/settings/suppliers') }}"> <a href="{{ route('suppliers.index') }}">
<i class="fa fa-credit-card fa-fw"></i> @lang('general.suppliers') <i class="fa fa-credit-card fa-fw"></i> @lang('general.suppliers')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/statuslabels*') ? ' class="active"' : '') !!}> <li {!! (Request::is('statuslabels*') ? ' class="active"' : '') !!}>
<a href="{{ url('admin/settings/statuslabels') }}"> <a href="{{ route('statuslabels.index') }}">
<i class="fa fa-list fa-fw"></i> @lang('general.status_labels') <i class="fa fa-list fa-fw"></i> @lang('general.status_labels')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/depreciations*') ? ' class="active"' : '') !!}> <li {!! (Request::is('depreciations*') ? ' class="active"' : '') !!}>
<a href="{{ url('admin/settings/depreciations') }}"> <a href="{{ route('depreciations.index') }}">
<i class="fa fa-arrow-down fa-fw"></i> @lang('general.depreciation') <i class="fa fa-arrow-down fa-fw"></i> @lang('general.depreciation')
</a> </a>
</li> </li>
<li {!! (Request::is('settings/locations*') ? ' class="active"' : '') !!}> <li {!! (Request::is('locations*') ? ' class="active"' : '') !!}>
<a href="{{ route('locations.index') }}"> <a href="{{ route('locations.index') }}">
<i class="fa fa-globe fa-fw"></i> @lang('general.locations') <i class="fa fa-globe fa-fw"></i> @lang('general.locations')
</a> </a>

View file

@ -2,7 +2,8 @@
'createText' => trans('admin/manufacturers/table.create') , 'createText' => trans('admin/manufacturers/table.create') ,
'updateText' => trans('admin/manufacturers/table.update'), 'updateText' => trans('admin/manufacturers/table.update'),
'helpTitle' => trans('admin/manufacturers/table.about_manufacturers_title'), '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'),
]) ])

View file

@ -8,7 +8,7 @@
{{-- Page title --}} {{-- Page title --}}
@section('header_right') @section('header_right')
<a href="{{ route('create/manufacturer') }}" class="btn btn-primary pull-right"> <a href="{{ route('manufacturers.create') }}" class="btn btn-primary pull-right">
{{ trans('general.create') }}</a> {{ trans('general.create') }}</a>
@stop @stop

View file

@ -14,8 +14,8 @@
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="{{ route('update/manufacturer', $manufacturer->id) }}">{{ trans('admin/manufacturers/table.update') }}</a></li> <li><a href="{{ route('manufacturers.edit', $manufacturer->id) }}">{{ trans('admin/manufacturers/table.update') }}</a></li>
<li><a href="{{ route('create/manufacturer') }}">{{ trans('admin/manufacturers/table.create') }}</a></li> <li><a href="{{ route('manufacturers.create') }}">{{ trans('admin/manufacturers/table.create') }}</a></li>
</ul> </ul>
</div> </div>
@stop @stop

View file

@ -2,7 +2,8 @@
'createText' => trans('admin/statuslabels/table.create') , 'createText' => trans('admin/statuslabels/table.create') ,
'updateText' => trans('admin/statuslabels/table.update'), 'updateText' => trans('admin/statuslabels/table.update'),
'helpTitle' => trans('admin/statuslabels/table.about'), '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 --}} {{-- Page content --}}

View file

@ -7,7 +7,7 @@
@stop @stop
@section('header_right') @section('header_right')
<a href="{{ route('create/statuslabel') }}" class="btn btn-primary pull-right"> <a href="{{ route('statuslabels.create') }}" class="btn btn-primary pull-right">
{{ trans('general.create') }}</a> {{ trans('general.create') }}</a>
@stop @stop
{{-- Page content --}} {{-- Page content --}}

View file

@ -2,7 +2,8 @@
'createText' => trans('admin/suppliers/table.create') , 'createText' => trans('admin/suppliers/table.create') ,
'updateText' => trans('admin/suppliers/table.update'), 'updateText' => trans('admin/suppliers/table.update'),
'helpTitle' => trans('admin/suppliers/table.about_suppliers_title'), '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 --}} {{-- Page content --}}

View file

@ -11,7 +11,7 @@
@section('header_right') @section('header_right')
<a href="{{ route('create/supplier') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a> <a href="{{ route('suppliers.create') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@stop @stop

View file

@ -8,7 +8,7 @@
@stop @stop
@section('header_right') @section('header_right')
<a href="{{ route('update/supplier', $supplier->id) }}" class="btn btn-default pull-right"> <a href="{{ route('suppliers.edit', $supplier->id) }}" class="btn btn-default pull-right">
{{ trans('admin/suppliers/table.update') }}</a> {{ trans('admin/suppliers/table.update') }}</a>
@stop @stop
@ -48,8 +48,8 @@
@foreach ($supplier->assets as $supplierassets) @foreach ($supplier->assets as $supplierassets)
<tr> <tr>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{ $supplierassets->asset_tag }}</a></td> <td><a href="{{ route('hardware.show', $supplierassets->id) }}">{{ $supplierassets->asset_tag }}</a></td>
<td><a href="{{ route('view/hardware', $supplierassets->id) }}">{{ $supplierassets->showAssetName() }}</a></td> <td><a href="{{ route('hardware.show', $supplierassets->id) }}">{{ $supplierassets->showAssetName() }}</a></td>
<td> <td>
@if ($supplierassets->assigneduser) @if ($supplierassets->assigneduser)
<a href="{{ route('view/user', $supplierassets->assigned_to) }}"> <a href="{{ route('view/user', $supplierassets->assigned_to) }}">
@ -151,8 +151,8 @@
<tbody> <tbody>
@foreach ($supplier->licenses as $license) @foreach ($supplier->licenses as $license)
<tr> <tr>
<td><a href="{{ route('view/license', $license->id) }}">{{ $license->name }}</a></td> <td><a href="{{ route('licenses.show', $license->id) }}">{{ $license->name }}</a></td>
<td><a href="{{ route('view/license', $license->id) }}">{{ $license->serial }}</a></td> <td><a href="{{ route('licenses.show', $license->id) }}">{{ $license->serial }}</a></td>
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -196,7 +196,7 @@
@foreach ($supplier->asset_maintenances as $improvement) @foreach ($supplier->asset_maintenances as $improvement)
@if (is_null($improvement->deleted_at)) @if (is_null($improvement->deleted_at))
<tr> <tr>
<td><a href="{{ route('view/hardware', $improvement->asset_id) }}">{{ $improvement->asset->name }}</a></td> <td><a href="{{ route('hardware.show', $improvement->asset_id) }}">{{ $improvement->asset->name }}</a></td>
<td>{{ $improvement->improvement_type }}</td> <td>{{ $improvement->improvement_type }}</td>
<td>{{ $improvement->start_date }}</td> <td>{{ $improvement->start_date }}</td>
<td>{{ $improvement->completion_date }}</td> <td>{{ $improvement->completion_date }}</td>

View file

@ -193,10 +193,10 @@
</td> </td>
<td> <td>
@can('assets.view') @can('assets.view')
<a href="{{ route('view/hardware', $asset->id) }}">{{ $asset->asset_tag }}</a> <a href="{{ route('hardware.show', $asset->id) }}">{{ $asset->asset_tag }}</a>
@endcan @endcan
</td> </td>
<td><a href="{{ route('view/hardware', $asset->id) }}">{{ $asset->name }}</a></td> <td><a href="{{ route('hardware.show', $asset->id) }}">{{ $asset->name }}</a></td>
<td class="hidden-print"> <td class="hidden-print">
@can('assets.edit') @can('assets.edit')
@ -223,10 +223,10 @@
@foreach ($user->licenses as $license) @foreach ($user->licenses as $license)
<tr> <tr>
<td> <td>
<a href="{{ route('view/license', $license->id) }}">{{ $license->name }}</a> <a href="{{ route('licenses.show', $license->id) }}">{{ $license->name }}</a>
</td> </td>
<td><a href="{{ route('view/license', $license->id) }}">{{ mb_strimwidth($license->serial, 0, 50, "...") }}</a></td> <td><a href="{{ route('licenses.show', $license->id) }}">{{ mb_strimwidth($license->serial, 0, 50, "...") }}</a></td>
<td class="hidden-print"> <td class="hidden-print">
@can('licenses.edit') @can('licenses.edit')
<a href="{{ route('licenses.checkin', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a> <a href="{{ route('licenses.checkin', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
@ -403,7 +403,7 @@
<td> <td>
@if (($log->item) && ($log->itemType()=="asset")) @if (($log->item) && ($log->itemType()=="asset"))
<a href="{{ route('view/hardware', $log->item_id) }}">{{ $log->item->asset_tag }} - {{ $log->item->showAssetName() }}</a> <a href="{{ route('hardware.show', $log->item_id) }}">{{ $log->item->asset_tag }} - {{ $log->item->showAssetName() }}</a>
@elseif ($log->item) @elseif ($log->item)
<a href="{{ route('view/'. $log->itemType(), $log->item_id) }}">{{ $log->item->name }}</a> <a href="{{ route('view/'. $log->itemType(), $log->item_id) }}">{{ $log->item->name }}</a>
@else @else

View file

@ -3,40 +3,63 @@ use App\Models\CheckoutRequest;
use App\Models\Location; use App\Models\Location;
use App\Models\Statuslabel; use App\Models\Statuslabel;
/* /*
* Custom Fields Routes * Custom Fields Routes
*/ */
Route::resource('fields', 'CustomFieldsController', [ Route::resource('fields', 'CustomFieldsController', [
'parameters' => ['customfield' => 'field_id', 'fieldset' => 'fieldset_id'] 'parameters' => ['customfield' => 'field_id', 'fieldset' => 'fieldset_id']
]); ]);
/* /*
* Companies * Companies
*/ */
Route::resource('companies', 'CompaniesController', [ Route::resource('companies', 'CompaniesController', [
'parameters' => ['company' => 'company_id'] 'parameters' => ['company' => 'company_id']
]); ]);
/* /*
* Categories * 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', [ Route::resource('depreciations', 'DepreciationsController', [
'parameters' => ['category' => 'category_id'] 'parameters' => ['depreciation' => 'depreciation_id']
]); ]);
/* /*
* Locations * Status Labels
*/ */
Route::resource('locations', 'LocationsController', [ Route::resource('statuslabels', 'StatuslabelsController', [
'parameters' => ['location' => 'location_id'] 'parameters' => ['statuslabel' => 'statuslabel_id']
]); ]);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Log Routes | Log Routes
@ -163,92 +186,6 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
Route::get('/', [ 'as' => 'settings/backups', 'uses' => 'SettingsController@getBackups' ]); 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 # Custom fields support

View file

@ -16,7 +16,7 @@ class DepreciationCest
{ {
$I->wantTo('Test Depreciation Creation'); $I->wantTo('Test Depreciation Creation');
$I->lookForwardTo('seeing it load without errors'); $I->lookForwardTo('seeing it load without errors');
$I->amOnPage(route('create/depreciations')); $I->amOnPage(route('depreciations.create'));
$I->seeInTitle('Create Depreciation'); $I->seeInTitle('Create Depreciation');
$I->dontSee('Create Depreciation', '.page-header'); $I->dontSee('Create Depreciation', '.page-header');
$I->see('Create Depreciation', 'h1.pull-left'); $I->see('Create Depreciation', 'h1.pull-left');
@ -25,7 +25,7 @@ class DepreciationCest
public function failsEmptyValidation(FunctionalTester $I) public function failsEmptyValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with blank elements"); $I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('create/depreciations')); $I->amOnPage(route('depreciations.create'));
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg'); $I->see('The name field is required.', '.alert-msg');
@ -35,7 +35,7 @@ class DepreciationCest
public function failsShortValidation(FunctionalTester $I) public function failsShortValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with short name"); $I->wantTo("Test Validation Fails with short name");
$I->amOnPage(route('create/depreciations')); $I->amOnPage(route('depreciations.create'));
$I->fillField('name', 't2'); $I->fillField('name', 't2');
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
@ -50,7 +50,7 @@ class DepreciationCest
'months' => $depreciation->months 'months' => $depreciation->months
]; ];
$I->wantTo("Test Validation Succeeds"); $I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('create/depreciations')); $I->amOnPage(route('depreciations.create'));
$I->submitForm('form#create-form', $values); $I->submitForm('form#create-form', $values);
$I->seeRecord('depreciations', $values); $I->seeRecord('depreciations', $values);
$I->seeElement('.alert-success'); $I->seeElement('.alert-success');
@ -59,7 +59,7 @@ class DepreciationCest
public function allowsDelete(FunctionalTester $I) public function allowsDelete(FunctionalTester $I)
{ {
$I->wantTo('Ensure I can delete a depreciation'); $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'); $I->seeElement('.alert-success');
} }
} }

View file

@ -18,7 +18,7 @@ class ManufacturersCest
{ {
$I->wantTo('Test Manufacturer Creation'); $I->wantTo('Test Manufacturer Creation');
$I->lookForwardTo('seeing it load without errors'); $I->lookForwardTo('seeing it load without errors');
$I->amOnPage(route('create/manufacturer')); $I->amOnPage(route('manufacturers.create'));
$I->seeInTitle('Create Manufacturer'); $I->seeInTitle('Create Manufacturer');
$I->see('Create Manufacturer', 'h1.pull-left'); $I->see('Create Manufacturer', 'h1.pull-left');
} }
@ -26,7 +26,7 @@ class ManufacturersCest
public function failsEmptyValidation(FunctionalTester $I) public function failsEmptyValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with blank elements"); $I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('create/manufacturer')); $I->amOnPage(route('manufacturers.create'));
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg'); $I->see('The name field is required.', '.alert-msg');
@ -35,7 +35,7 @@ class ManufacturersCest
public function failsShortValidation(FunctionalTester $I) public function failsShortValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with short name"); $I->wantTo("Test Validation Fails with short name");
$I->amOnPage(route('create/manufacturer')); $I->amOnPage(route('manufacturers.create'));
$I->fillField('name', 't'); $I->fillField('name', 't');
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
@ -48,7 +48,7 @@ class ManufacturersCest
'name' => $manufacturer->name 'name' => $manufacturer->name
]; ];
$I->wantTo("Test Validation Succeeds"); $I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('create/manufacturer')); $I->amOnPage(route('manufacturers.create'));
$I->submitForm('form#create-form', $values); $I->submitForm('form#create-form', $values);
$I->seeRecord('manufacturers', $values); $I->seeRecord('manufacturers', $values);
$I->seeElement('.alert-success'); $I->seeElement('.alert-success');
@ -57,7 +57,7 @@ class ManufacturersCest
public function allowsDelete(FunctionalTester $I) public function allowsDelete(FunctionalTester $I)
{ {
$I->wantTo('Ensure I can delete a manufacturer'); $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('accessories')
->doesntHave('consumables') ->doesntHave('consumables')
->doesntHave('licenses')->first()->id ->doesntHave('licenses')->first()->id

View file

@ -18,7 +18,7 @@ class StatusLabelsCest
{ {
$I->wantTo('ensure that the create statuslabels form loads without errors'); $I->wantTo('ensure that the create statuslabels form loads without errors');
$I->lookForwardTo('seeing it load 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->dontSee('Create Status Label', '.page-header');
$I->see('Create Status Label', 'h1.pull-left'); $I->see('Create Status Label', 'h1.pull-left');
} }
@ -26,7 +26,7 @@ class StatusLabelsCest
public function failsEmptyValidation(FunctionalTester $I) public function failsEmptyValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with blank elements"); $I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('create/statuslabel')); $I->amOnPage(route('statuslabels.create'));
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg'); $I->see('The name field is required.', '.alert-msg');
@ -53,7 +53,7 @@ class StatusLabelsCest
'show_in_nav' => true, 'show_in_nav' => true,
]; ];
$I->wantTo("Test Validation Succeeds"); $I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('create/statuslabel')); $I->amOnPage(route('statuslabels.create'));
$I->submitForm('form#create-form', $submitValues); $I->submitForm('form#create-form', $submitValues);
$I->seeRecord('status_labels', $recordValues); $I->seeRecord('status_labels', $recordValues);
$I->seeElement('.alert-success'); $I->seeElement('.alert-success');
@ -62,7 +62,7 @@ class StatusLabelsCest
public function allowsDelete(FunctionalTester $I) public function allowsDelete(FunctionalTester $I)
{ {
$I->wantTo('Ensure I can delete a Status Label'); $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'); $I->seeElement('.alert-success');
} }
} }

View file

@ -18,7 +18,7 @@ class SuppliersCest
{ {
$I->wantTo('ensure that the create settings/suppliers form loads without errors'); $I->wantTo('ensure that the create settings/suppliers form loads without errors');
$I->lookForwardTo('seeing it load 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->dontSee('Create Supplier', '.page-header');
$I->see('Create Supplier', 'h1.pull-left'); $I->see('Create Supplier', 'h1.pull-left');
} }
@ -26,7 +26,7 @@ class SuppliersCest
public function failsEmptyValidation(FunctionalTester $I) public function failsEmptyValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with blank elements"); $I->wantTo("Test Validation Fails with blank elements");
$I->amOnPage(route('create/supplier')); $I->amOnPage(route('suppliers.create'));
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
$I->see('The name field is required.', '.alert-msg'); $I->see('The name field is required.', '.alert-msg');
@ -35,7 +35,7 @@ class SuppliersCest
public function failsShortValidation(FunctionalTester $I) public function failsShortValidation(FunctionalTester $I)
{ {
$I->wantTo("Test Validation Fails with short name"); $I->wantTo("Test Validation Fails with short name");
$I->amOnPage(route('create/supplier')); $I->amOnPage(route('suppliers.create'));
$I->fillField('name', 't2'); $I->fillField('name', 't2');
$I->click('Save'); $I->click('Save');
$I->seeElement('.alert-danger'); $I->seeElement('.alert-danger');
@ -60,7 +60,7 @@ class SuppliersCest
'notes' => $supplier->notes 'notes' => $supplier->notes
]; ];
$I->wantTo("Test Validation Succeeds"); $I->wantTo("Test Validation Succeeds");
$I->amOnPage(route('create/supplier')); $I->amOnPage(route('suppliers.create'));
$I->submitForm('form#create-form', $values); $I->submitForm('form#create-form', $values);
$I->seeRecord('suppliers', $values); $I->seeRecord('suppliers', $values);
$I->seeElement('.alert-success'); $I->seeElement('.alert-success');
@ -69,7 +69,7 @@ class SuppliersCest
public function allowsDelete(FunctionalTester $I) public function allowsDelete(FunctionalTester $I)
{ {
$I->wantTo('Ensure I can delete a supplier'); $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'); $I->seeElement('.alert-success');
} }
} }