Add manufacturer to licenses (#2436)

* Add manufacturer to licenses.  Shows in table and edit.  Need to improve manufacturer view to show lists beyond assets still.

* Remove extra closing tags, formatting

* Work on making the manufacturer view show more options. Need to figure out how to change the table dynamically.

* Cleanup formatting and fix a few weirdities in hardware/view.blade.php

* Standardize on two-space tabs in this file, as it seems the most
* common.

* Fix a few places where we call number_format without guaranteeing the
* item is a number and not a string.

* Show a "No Results" message on components page if there are no
* components.

* Show table of licenses on manufacturer view page.

This reworks the ManufacturersController::getDataView method to delegate
the view to a sub method (currently assets or licenses, but plan to
extend to consumables/accessories/components as well).  We then put tabs
at the top of the view to show multiple tables.  This just duplicates
the table layout from licenses/index.blade, but I wonder if theres a way
to centralize that code, maybe through partials, over time..

The only known missing part of manufacturers for licenses would be adding it
to the importer, but the license importer should probably migrate to
object importer before doing too much more...

* Add manufacturer to accessory.

* Add consumables to the manufacturer view page.
This commit is contained in:
Daniel Meltzer 2016-08-16 20:49:54 -05:00 committed by snipe
parent 44821b9667
commit ac63642224
18 changed files with 911 additions and 490 deletions

View file

@ -53,14 +53,12 @@ class AccessoriesController extends Controller
public function getCreate(Request $request) public function getCreate(Request $request)
{ {
// Show the page // Show the page
$category_list = Helper::categoryList('accessory');
$company_list = Helper::companyList();
$location_list = Helper::locationsList();
return View::make('accessories/edit') return View::make('accessories/edit')
->with('accessory', new Accessory) ->with('accessory', new Accessory)
->with('category_list', $category_list) ->with('category_list', Helper::categoryList('accessory'))
->with('company_list', $company_list) ->with('company_list', Helper::companyList())
->with('location_list', $location_list); ->with('location_list', Helper::locationsList())
->with('manufacturer_list', Helper::manufacturerList());
} }
@ -83,6 +81,7 @@ class AccessoriesController extends Controller
$accessory->min_amt = e(Input::get('min_amt')); $accessory->min_amt = e(Input::get('min_amt'));
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id')); $accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$accessory->order_number = e(Input::get('order_number')); $accessory->order_number = e(Input::get('order_number'));
$accessory->manufacturer_id = e(Input::get('manufacturer_id'));
if (e(Input::get('purchase_date')) == '') { if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = null; $accessory->purchase_date = null;
@ -126,14 +125,11 @@ class AccessoriesController extends Controller
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions')); return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
} }
$category_list = Helper::categoryList('accessory');
$company_list = Helper::companyList();
$location_list = Helper::locationsList();
return View::make('accessories/edit', compact('accessory')) return View::make('accessories/edit', compact('accessory'))
->with('category_list', $category_list) ->with('category_list', Helper::categoryList('accessory'))
->with('company_list', $company_list) ->with('company_list', Helper::companyList())
->with('location_list', $location_list); ->with('location_list', Helper::locationsList())
->with('manufacturer_list', Helper::manufacturerList());
} }
@ -146,9 +142,9 @@ class AccessoriesController extends Controller
*/ */
public function postEdit(Request $request, $accessoryId = null) public function postEdit(Request $request, $accessoryId = null)
{ {
// Check if the blog post exists // Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) { if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the blogs management page // Redirect to the accessory index page
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist')); return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) { } elseif (!Company::isCurrentUserHasAccess($accessory)) {
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions')); return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
@ -165,6 +161,7 @@ class AccessoriesController extends Controller
$accessory->min_amt = e(Input::get('min_amt')); $accessory->min_amt = e(Input::get('min_amt'));
$accessory->category_id = e(Input::get('category_id')); $accessory->category_id = e(Input::get('category_id'));
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id')); $accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$accessory->manufacturer_id = e(Input::get('manufacturer_id'));
$accessory->order_number = e(Input::get('order_number')); $accessory->order_number = e(Input::get('order_number'));
if (e(Input::get('purchase_date')) == '') { if (e(Input::get('purchase_date')) == '') {
@ -181,9 +178,9 @@ class AccessoriesController extends Controller
$accessory->qty = e(Input::get('qty')); $accessory->qty = e(Input::get('qty'));
// Was the accessory created? // Was the accessory updated?
if ($accessory->save()) { if ($accessory->save()) {
// Redirect to the new accessory page // Redirect to the updated accessory page
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success')); return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
} }
@ -620,7 +617,9 @@ class AccessoriesController extends Controller
'purchase_cost' => number_format($accessory->purchase_cost, 2), 'purchase_cost' => number_format($accessory->purchase_cost, 2),
'numRemaining' => $accessory->numRemaining(), 'numRemaining' => $accessory->numRemaining(),
'actions' => $actions, 'actions' => $actions,
'companyName' => is_null($company) ? '' : e($company->name) 'companyName' => is_null($company) ? '' : e($company->name),
'manufacturer' => $accessory->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$accessory->manufacturer_id.'/view', $accessory->manufacturer->name) : ''
); );
} }

View file

@ -470,10 +470,10 @@ class ConsumablesController extends Controller
'location' => ($consumable->location) ? e($consumable->location->name) : '', 'location' => ($consumable->location) ? e($consumable->location->name) : '',
'min_amt' => e($consumable->min_amt), 'min_amt' => e($consumable->min_amt),
'qty' => e($consumable->qty), 'qty' => e($consumable->qty),
'manufacturer' => ($consumable->manufacturer) ? e($consumable->manufacturer->name) : '', 'manufacturer' => ($consumable->manufacturer) ? (string) link_to('/admin/settings/manufacturers/'.$consumable->manufacturer_id.'/view', $consumable->manufacturer->name): '',
'model_no' => e($consumable->model_no), 'model_no' => e($consumable->model_no),
'item_no' => e($consumable->item_no), 'item_no' => e($consumable->item_no),
'category' => ($consumable->category) ? e($consumable->category->name) : 'Missing category', 'category' => ($consumable->category) ? (string) link_to('/admin/settings/categories/'.$consumable->category_id.'/view', $consumable->category->name) : 'Missing category',
'order_number' => e($consumable->order_number), 'order_number' => e($consumable->order_number),
'purchase_date' => e($consumable->purchase_date), 'purchase_date' => e($consumable->purchase_date),
'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost, 2): '' , 'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost, 2): '' ,

View file

@ -61,18 +61,17 @@ class LicensesController extends Controller
public function getCreate() public function getCreate()
{ {
$depreciation_list = Helper::depreciationList();
$supplier_list = Helper::suppliersList();
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No'); $maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
$company_list = Helper::companyList();
return View::make('licenses/edit') return View::make('licenses/edit')
//->with('license_options',$license_options) //->with('license_options',$license_options)
->with('depreciation_list', $depreciation_list) ->with('depreciation_list', Helper::depreciationList())
->with('supplier_list', $supplier_list) ->with('supplier_list', Helper::suppliersList())
->with('maintained_list', $maintained_list) ->with('maintained_list', $maintained_list)
->with('company_list', $company_list) ->with('company_list', Helper::companyList())
->with('manufacturer_list', Helper::manufacturerList())
->with('license', new License); ->with('license', new License);
} }
@ -125,6 +124,12 @@ class LicensesController extends Controller
$license->purchase_order = e(Input::get('purchase_order')); $license->purchase_order = e(Input::get('purchase_order'));
} }
if (empty(e(Input::get('manufacturer_id')))) {
$license->manufacturer_id = null;
} else {
$license->manufacturer_id = e(Input::get('manufacturer_id'));
}
// Save the license data // Save the license data
$license->name = e(Input::get('name')); $license->name = e(Input::get('name'));
$license->serial = e(Input::get('serial')); $license->serial = e(Input::get('serial'));
@ -206,17 +211,15 @@ class LicensesController extends Controller
// Show the page // Show the page
$license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id'); $license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id');
$depreciation_list = array('0' => trans('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray();
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No'); $maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
$company_list = Helper::companyList();
return View::make('licenses/edit', compact('license')) return View::make('licenses/edit', compact('license'))
->with('license_options', $license_options) ->with('license_options', $license_options)
->with('depreciation_list', $depreciation_list) ->with('depreciation_list', Helper::depreciationList())
->with('supplier_list', $supplier_list) ->with('supplier_list', Helper::suppliersList())
->with('company_list', $company_list) ->with('company_list', Helper::companyList())
->with('maintained_list', $maintained_list); ->with('maintained_list', $maintained_list)
->with('manufacturer_list', Helper::manufacturerList());
} }
@ -253,6 +256,13 @@ class LicensesController extends Controller
$license->maintained = e(Input::get('maintained')); $license->maintained = e(Input::get('maintained'));
$license->reassignable = e(Input::get('reassignable')); $license->reassignable = e(Input::get('reassignable'));
if (empty(e(Input::get('manufacturer_id')))) {
$license->manufacturer_id = null;
} else {
$license->manufacturer_id = e(Input::get('manufacturer_id'));
}
if (e(Input::get('supplier_id')) == '') { if (e(Input::get('supplier_id')) == '') {
$license->supplier_id = null; $license->supplier_id = null;
} else { } else {
@ -987,21 +997,22 @@ class LicensesController extends Controller
$actions = '<span style="white-space: nowrap;">'; $actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) { if (Gate::allows('licenses.checkout')) {
$actions .= '<a href="' . route('freecheckout/license', $actions .= '<a href="' . route('freecheckout/license', $license->id)
$license->id) . '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> '; . '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
} }
if (Gate::allows('licenses.create')) { if (Gate::allows('licenses.create')) {
$actions .= '<a href="' . route('clone/license', $actions .= '<a href="' . route('clone/license', $license->id)
$license->id) . '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>'; . '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>';
} }
if (Gate::allows('licenses.edit')) { if (Gate::allows('licenses.edit')) {
$actions .= '<a href="' . route('update/license', $actions .= '<a href="' . route('update/license', $license->id)
$license->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>'; . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
} }
if (Gate::allows('licenses.delete')) { if (Gate::allows('licenses.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/license', $actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
$license->id) . '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; . route('delete/license', $license->id)
. '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
} }
$actions .='</span>'; $actions .='</span>';
@ -1020,7 +1031,8 @@ class LicensesController extends Controller
'order_number' => ($license->order_number) ? e($license->order_number) : '', 'order_number' => ($license->order_number) ? e($license->order_number) : '',
'notes' => ($license->notes) ? e($license->notes) : '', 'notes' => ($license->notes) ? e($license->notes) : '',
'actions' => $actions, 'actions' => $actions,
'companyName' => is_null($license->company) ? '' : e($license->company->name) 'companyName' => is_null($license->company) ? '' : e($license->company->name),
'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
); );
} }

View file

@ -5,7 +5,7 @@ use App\Models\Company;
use App\Models\Manufacturer; use App\Models\Manufacturer;
use App\Models\Setting; use App\Models\Setting;
use Auth; use Auth;
use Illuminate\Support\Facades\Gate; use Gate;
use Input; use Input;
use Lang; use Lang;
use Redirect; use Redirect;
@ -255,10 +255,27 @@ class ManufacturersController extends Controller
* @since [v1.0] * @since [v1.0]
* @return String JSON * @return String JSON
*/ */
public function getDataView($manufacturerId) public function getDataView($manufacturerId, $itemtype = null)
{ {
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerId); $manufacturer = Manufacturer::with('assets.company')->find($manufacturerId);
switch ($itemtype) {
case "assets":
return $this->getDataAssetsView($manufacturer);
case "licenses":
return $this->getDataLicensesView($manufacturer);
case "accessories":
return $this->getDataAccessoriesView($manufacturer);
case "consumables":
return $this->getDataConsumablesView($manufacturer);
}
throw new Exception("We shouldn't be here");
}
protected function getDataAssetsView(Manufacturer $manufacturer)
{
$manufacturer_assets = $manufacturer->assets; $manufacturer_assets = $manufacturer->assets;
if (Input::has('search')) { if (Input::has('search')) {
@ -304,7 +321,7 @@ class ManufacturersController extends Controller
} }
} }
$row = array( $rows[] = array(
'id' => $asset->id, 'id' => $asset->id,
'name' => (string)link_to('/hardware/'.$asset->id.'/view', e($asset->showAssetName())), 'name' => (string)link_to('/hardware/'.$asset->id.'/view', e($asset->showAssetName())),
'model' => e($asset->model->name), 'model' => e($asset->model->name),
@ -318,11 +335,189 @@ class ManufacturersController extends Controller
if (isset($inout)) { if (isset($inout)) {
$row['change'] = $inout; $row['change'] = $inout;
} }
$rows[] = $row;
} }
$data = array('total' => $count, 'rows' => $rows); $data = array('total' => $count, 'rows' => $rows);
return $data; return $data;
} }
protected function getDataLicensesView(Manufacturer $manufacturer)
{
$licenses = $manufacturer->licenses;
if (Input::has('search')) {
$licenses = $licenses->TextSearch(Input::get('search'));
}
$licenseCount = $licenses->count();
$rows = array();
foreach ($licenses as $license) {
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
$actions .= '<a href="' . route('freecheckout/license', $license->id)
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}
if (Gate::allows('licenses.create')) {
$actions .= '<a href="' . route('clone/license', $license->id)
. '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>';
}
if (Gate::allows('licenses.edit')) {
$actions .= '<a href="' . route('update/license', $license->id)
. '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('licenses.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
. route('delete/license', $license->id)
. '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</span>';
$rows[] = array(
'id' => $license->id,
'name' => (string) link_to('/admin/licenses/'.$license->id.'/view', $license->name),
'serial' => (string) link_to('/admin/licenses/'.$license->id.'/view', mb_strimwidth($license->serial, 0, 50, "...")),
'totalSeats' => $license->totalSeatsByLicenseID(),
'remaining' => $license->remaincount(),
'license_name' => e($license->license_name),
'license_email' => e($license->license_email),
'purchase_date' => ($license->purchase_date) ? $license->purchase_date : '',
'expiration_date' => ($license->expiration_date) ? $license->expiration_date : '',
'purchase_cost' => ($license->purchase_cost) ? number_format($license->purchase_cost, 2) : '',
'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : '',
'order_number' => ($license->order_number) ? e($license->order_number) : '',
'notes' => ($license->notes) ? e($license->notes) : '',
'actions' => $actions,
'companyName' => is_null($license->company) ? '' : e($license->company->name),
'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
);
}
$data = array('total' => $licenseCount, 'rows' => $rows);
return $data;
}
public function getDataAccessoriesView(Manufacturer $manufacturer)
{
$accessories = $manufacturer->accessories;
if (Input::has('search')) {
$accessories = $accessories->TextSearch(e(Input::get('search')));
}
if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$accessCount = $accessories->count();
$rows = array();
foreach ($accessories as $accessory) {
$actions = '<nobr>';
if (Gate::allows('accessories.checkout')) {
$actions .= '<a href="' . route('checkout/accessory',
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
}
if (Gate::allows('accessories.edit')) {
$actions .= '<a href="' . route('update/accessory',
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('accessories.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .= '</nobr>';
$company = $accessory->company;
$rows[] = array(
'name' => '<a href="'.url('admin/accessories/'.$accessory->id).'/view">'. $accessory->name.'</a>',
'category' => ($accessory->category) ? (string)link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name) : '',
'qty' => e($accessory->qty),
'order_number' => e($accessory->order_number),
'min_amt' => e($accessory->min_amt),
'location' => ($accessory->location) ? e($accessory->location->name): '',
'purchase_date' => e($accessory->purchase_date),
'purchase_cost' => number_format($accessory->purchase_cost, 2),
'numRemaining' => $accessory->numRemaining(),
'actions' => $actions,
'companyName' => is_null($company) ? '' : e($company->name),
'manufacturer' => $accessory->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$accessory->manufacturer_id.'/view', $accessory->manufacturer->name) : ''
);
}
$data = array('total'=>$accessCount, 'rows'=>$rows);
return $data;
}
public function getDataConsumablesView($manufacturer)
{
$consumables = $manufacturer->consumables;
if (Input::has('search')) {
$consumables = $consumables->TextSearch(e(Input::get('search')));
}
if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$consumCount = $consumables->count();
$rows = array();
foreach ($consumables as $consumable) {
$actions = '<nobr>';
if (Gate::allows('consumables.checkout')) {
$actions .= '<a href="' . route('checkout/consumable',
$consumable->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($consumable->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
}
if (Gate::allows('consumables.edit')) {
$actions .= '<a href="' . route('update/consumable',
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('consumables.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</nobr>';
$company = $consumable->company;
$rows[] = array(
'id' => $consumable->id,
'name' => (string)link_to('admin/consumables/'.$consumable->id.'/view', e($consumable->name)),
'location' => ($consumable->location) ? e($consumable->location->name) : '',
'min_amt' => e($consumable->min_amt),
'qty' => e($consumable->qty),
'manufacturer' => ($consumable->manufacturer) ? (string) link_to('/admin/settings/manufacturers/'.$consumable->manufacturer_id.'/view', $consumable->manufacturer->name): '',
'model_no' => e($consumable->model_no),
'item_no' => e($consumable->item_no),
'category' => ($consumable->category) ? (string) link_to('/admin/settings/categories/'.$consumable->category_id.'/view', $consumable->category->name) : 'Missing category',
'order_number' => e($consumable->order_number),
'purchase_date' => e($consumable->purchase_date),
'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost, 2): '' ,
'numRemaining' => $consumable->numRemaining(),
'actions' => $actions,
'companyName' => is_null($company) ? '' : e($company->name),
);
}
$data = array('total' => $consumCount, 'rows' => $rows);
return $data;
}
} }

View file

@ -78,7 +78,7 @@ Route::group([ 'prefix' => 'api', 'middleware' => 'auth' ], function () {
/*---Manufacturers API---*/ /*---Manufacturers API---*/
Route::group(array('prefix'=>'manufacturers'), function () { Route::group(array('prefix'=>'manufacturers'), function () {
Route::get('list', array('as'=>'api.manufacturers.list', 'uses'=>'ManufacturersController@getDatatable')); Route::get('list', array('as'=>'api.manufacturers.list', 'uses'=>'ManufacturersController@getDatatable'));
Route::get('{manufacturerID}/view', array('as'=>'api.manufacturers.view', 'uses'=>'ManufacturersController@getDataView')); Route::get('{manufacturerID}/view/{itemtype}', array('as'=>'api.manufacturers.view', 'uses'=>'ManufacturersController@getDataView'));
}); });
/*---Suppliers API---*/ /*---Suppliers API---*/

View file

@ -82,6 +82,11 @@ class Accessory extends Model
return $this->belongsToMany('\App\Models\User', 'accessories_users', 'accessory_id', 'assigned_to')->count(); return $this->belongsToMany('\App\Models\User', 'accessories_users', 'accessory_id', 'assigned_to')->count();
} }
public function manufacturer()
{
return $this->belongsTo('\App\Models\Manufacturer', 'manufacturer_id');
}
public function checkin_email() public function checkin_email()
{ {
return $this->category->checkin_email; return $this->category->checkin_email;

View file

@ -36,6 +36,11 @@ class License extends Depreciable
return $this->belongsTo('\App\Models\Company', 'company_id'); return $this->belongsTo('\App\Models\Company', 'company_id');
} }
public function manufacturer()
{
return $this->belongsTo('\App\Models\Manufacturer', 'manufacturer_id');
}
/** /**
* Get the assigned user * Get the assigned user
*/ */

View file

@ -46,6 +46,21 @@ class Manufacturer extends Model
return $this->hasManyThrough('\App\Models\Asset', '\App\Models\AssetModel', 'manufacturer_id', 'model_id'); return $this->hasManyThrough('\App\Models\Asset', '\App\Models\AssetModel', 'manufacturer_id', 'model_id');
} }
public function licenses()
{
return $this->hasMany('\App\Models\License', 'manufacturer_id');
}
public function accessories()
{
return $this->hasMany('\App\Models\Accessory', 'manufacturer_id');
}
public function consumables()
{
return $this->hasMany('\App\Models\Consumable', 'manufacturer_id');
}
/** /**
* Query builder scope to search on text * Query builder scope to search on text
* *

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddManufacturerToLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function (Blueprint $table) {
//
$table->integer('manufacturer_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('licenses', function (Blueprint $table) {
//
});
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddManufacturerToAccessoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accessories', function (Blueprint $table) {
//
$table->integer('manufacturer_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accessories', function (Blueprint $table) {
//
$table->dropColumn('manufacturer_id');
});
}
}

View file

@ -86,6 +86,18 @@
</div> </div>
</div> </div>
<!-- Manufacturer -->
<div class="form-group {{ $errors->has('manufacturer_id') ? ' has-error' : '' }}">
<div class="col-md-3">
{{ Form::label('manufacturer_id', trans('general.manufacturer')) }}
</div>
</label>
<div class="col-md-7">
{{ Form::select('manufacturer_id', $manufacturer_list , Input::old('manufacturer_id', $accessory->manufacturer_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('manufacturer_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Location --> <!-- Location -->
<div class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('location_id') ? ' has-error' : '' }}">
<div class="col-md-3"> <div class="col-md-3">

View file

@ -35,6 +35,7 @@
<th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th> <th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/accessories/table.title') }}</th> <th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
<th data-searchable="true" data-sortable="true" data-field="category">{{ trans('admin/accessories/general.accessory_category') }}</th> <th data-searchable="true" data-sortable="true" data-field="category">{{ trans('admin/accessories/general.accessory_category') }}</th>
<th data-field="manufacturer" data-searchable="true" data-sortable="true">{{ trans('general.manufacturer') }}</th>
<th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th> <th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th>
<th data-searchable="false" data-sortable="false" data-field="qty">{{ trans('admin/accessories/general.total') }}</th> <th data-searchable="false" data-sortable="false" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
<th data-searchable="true" data-sortable="true" data-field="purchase_date" data-visible="false">{{ trans('admin/accessories/general.date') }}</th> <th data-searchable="true" data-sortable="true" data-field="purchase_date" data-visible="false">{{ trans('admin/accessories/general.date') }}</th>

View file

@ -43,8 +43,6 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<!-- Custom Tabs --> <!-- Custom Tabs -->
<div class="nav-tabs-custom"> <div class="nav-tabs-custom">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
@ -60,7 +58,6 @@
<li> <li>
<a href="#maintenances" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-wrench"></i></span> <span class="hidden-xs hidden-sm">Maintenances</span></a> <a href="#maintenances" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-wrench"></i></span> <span class="hidden-xs hidden-sm">Maintenances</span></a>
</li> </li>
<li> <li>
<a href="#history" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-history"></i></span> <span class="hidden-xs hidden-sm">History</span></a> <a href="#history" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-history"></i></span> <span class="hidden-xs hidden-sm">History</span></a>
</li> </li>
@ -68,7 +65,8 @@
<a href="#files" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-files-o"></i></span> <span class="hidden-xs hidden-sm">Files</span></a> <a href="#files" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-files-o"></i></span> <span class="hidden-xs hidden-sm">Files</span></a>
</li> </li>
<li class="pull-right"> <li class="pull-right">
<a href="#" data-toggle="modal" data-target="#uploadFileModal"><i class="fa fa-paperclip"></i> </a></li> <a href="#" data-toggle="modal" data-target="#uploadFileModal"><i class="fa fa-paperclip"></i> </a>
</li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane fade in active" id="details"> <div class="tab-pane fade in active" id="details">
@ -131,8 +129,6 @@
@endforeach @endforeach
@endif @endif
@if ($asset->purchase_date) @if ($asset->purchase_date)
<tr> <tr>
<td>{{ trans('admin/hardware/form.date') }}</td> <td>{{ trans('admin/hardware/form.date') }}</td>
@ -143,7 +139,6 @@
@endif @endif
@if ($asset->purchase_cost) @if ($asset->purchase_cost)
<tr> <tr>
<td>{{ trans('admin/hardware/form.cost') }}</td> <td>{{ trans('admin/hardware/form.cost') }}</td>
<td> <td>
@ -154,17 +149,15 @@
@else @else
{{ \App\Models\Setting::first()->default_currency }} {{ \App\Models\Setting::first()->default_currency }}
@endif @endif
{{ number_format($asset->purchase_cost,2) }} {{ is_numeric($asset->purchase_cost) ? number_format($asset->purchase_cost,2) : $asset->purchase_cost }}
@if ($asset->order_number) @if ($asset->order_number)
(Order #{{ $asset->order_number }}) (Order #{{ $asset->order_number }})
@endif @endif
</td> </td>
</tr> </tr>
@endif @endif
@if ($asset->supplier_id) @if ($asset->supplier_id)
<tr> <tr>
<td>{{ trans('admin/hardware/form.supplier') }}</td> <td>{{ trans('admin/hardware/form.supplier') }}</td>
@ -177,7 +170,6 @@
@endif @endif
@if ($asset->warranty_months) @if ($asset->warranty_months)
<tr {!! $asset->warrantee_expires() < date("Y-m-d") ? ' class="warning"' : '' !!}> <tr {!! $asset->warrantee_expires() < date("Y-m-d") ? ' class="warning"' : '' !!}>
<td>{{ trans('admin/hardware/form.warranty') }}</td> <td>{{ trans('admin/hardware/form.warranty') }}</td>
<td> <td>
@ -200,6 +192,7 @@
) )
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
{{ trans('admin/hardware/form.fully_depreciated') }} {{ trans('admin/hardware/form.fully_depreciated') }}
@ -214,8 +207,8 @@
({{ $asset->depreciated_date()->format('Y-m-d') }}) ({{ $asset->depreciated_date()->format('Y-m-d') }})
</td> </td>
</tr> </tr>
@endif @endif
@if ($asset->model->eol) @if ($asset->model->eol)
<tr> <tr>
<td>{{ trans('admin/hardware/form.eol_rate') }}</td> <td>{{ trans('admin/hardware/form.eol_rate') }}</td>
@ -234,11 +227,13 @@
{{ $asset->months_until_eol()->m }} {{ $asset->months_until_eol()->m }}
{{ trans('general.months') }} {{ trans('general.months') }}
@endif
) )
@endif
</td> </td>
</tr> </tr>
@endif @endif
@if ($asset->expected_checkin!='') @if ($asset->expected_checkin!='')
<tr> <tr>
<td>{{ trans('admin/hardware/form.expected_checkin') }}</td> <td>{{ trans('admin/hardware/form.expected_checkin') }}</td>
@ -268,25 +263,23 @@
@if ($asset->image) @if ($asset->image)
<img src="{{ Config::get('app.url') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg"> <img src="{{ Config::get('app.url') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg">
@else @elseif ($asset->model->image!='')
@if ($asset->model->image!='')
<img src="{{ Config::get('app.url') }}/uploads/models/{{{ $asset->model->image }}}" class="assetimg"> <img src="{{ Config::get('app.url') }}/uploads/models/{{{ $asset->model->image }}}" class="assetimg">
@endif @endif
@endif
@if (App\Models\Setting::getSettings()->qr_code=='1') @if (App\Models\Setting::getSettings()->qr_code=='1')
<img src="{{ config('get.url') }}/hardware/{{ $asset->id }}/qr_code" class="img-thumbnail pull-right" style="height: 100px; width: 100px; margin-right: 10px;"> <img src="{{ config('get.url') }}/hardware/{{ $asset->id }}/qr_code" class="img-thumbnail pull-right" style="height: 100px; width: 100px; margin-right: 10px;">
@endif @endif
@if (($asset->assigneduser) && ($asset->assigned_to > 0) && ($asset->deleted_at=='')) @if (($asset->assigneduser) && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
<h4>{{ trans('admin/hardware/form.checkedout_to') }}</h4> <h4>{{ trans('admin/hardware/form.checkedout_to') }}</h4>
<p><img src="{{ $asset->assigneduser->gravatar() }}" class="user-image-inline" alt="{{ $asset->assigneduser->fullName() }}"> <p>
<a href="{{ route('view/user', $asset->assigned_to) }}">{{ $asset->assigneduser->fullName() }}</a></p> <img src="{{ $asset->assigneduser->gravatar() }}" class="user-image-inline" alt="{{ $asset->assigneduser->fullName() }}">
<a href="{{ route('view/user', $asset->assigned_to) }}">{{ $asset->assigneduser->fullName() }}</a>
</p>
<ul class="list-unstyled"> <ul class="list-unstyled">
@if ((isset($asset->assigneduser->email)) && ($asset->assigneduser->email!='')) @if ((isset($asset->assigneduser->email)) && ($asset->assigneduser->email!=''))
<li><i class="fa fa-envelope-o"></i> <a href="mailto:{{ $asset->assigneduser->email }}">{{ $asset->assigneduser->email }}</a></li> <li><i class="fa fa-envelope-o"></i> <a href="mailto:{{ $asset->assigneduser->email }}">{{ $asset->assigneduser->email }}</a></li>
@endif @endif
@ -296,7 +289,7 @@
@endif @endif
@if (isset($asset->userloc)) @if (isset($asset->userloc))
<li>{{ $asset->userloc->name }} <li>{{ $asset->userloc->name }}</li>
<li>{{ $asset->userloc->address }} <li>{{ $asset->userloc->address }}
@if ($asset->userloc->address2!='') @if ($asset->userloc->address2!='')
{{ $asset->userloc->address2 }} {{ $asset->userloc->address2 }}
@ -307,58 +300,34 @@
@if (($asset->userloc->city!='') && ($asset->userloc->state!='')) @if (($asset->userloc->city!='') && ($asset->userloc->state!=''))
, ,
@endif @endif
{{ $asset->userloc->state }} {{ $asset->userloc->zip }}</li> {{ $asset->userloc->state }} {{ $asset->userloc->zip }}
</li>
@elseif (isset($asset->assetloc)) @elseif (isset($asset->assetloc))
<li>{{ $asset->assetloc->name }} <li>{{ $asset->assetloc->name }}</li>
<li>{{ $asset->assetloc->address }} <li>{{ $asset->assetloc->address }}
@if ($asset->assetloc->address2!='') @if ($asset->assetloc->address2!='')
{{ $asset->assetloc->address2 }} {{ $asset->assetloc->address2 }}
@endif @endif
</li> </li>
<li>{{ $asset->assetloc->city }} <li>
{{ $asset->assetloc->city }}
@if (($asset->assetloc->city!='') && ($asset->assetloc->state!='')) @if (($asset->assetloc->city!='') && ($asset->assetloc->state!=''))
, ,
@endif @endif
{{ $asset->assetloc->state }} {{ $asset->assetloc->zip }}</li> {{ $asset->assetloc->state }} {{ $asset->assetloc->zip }}
</li>
@endif @endif
</ul> </ul>
@endif @endif
</div> </div> <!-- div.col-md-4 -->
</div><!-- /row --> </div><!-- /row -->
</div><!-- /.tab-pane --> </div><!-- /.tab-pane asset details -->
<div class="tab-pane fade" id="components">
<!-- checked out assets table -->
<div class="row">
<div class="col-md-12">
<table class="table table-striped">
<tbody>
<?php $totalCost = 0; ?>
@foreach ($asset->components as $component)
@if (is_null($component->deleted_at))
<tr>
<td><a href="{{ route('view/component', $component->id) }}">{{ $component->name }}</a></td>
</tr>
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="7" class="text-right">{{ $use_currency.$totalCost }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="software"> <div class="tab-pane fade" id="software">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -378,7 +347,8 @@
<tr> <tr>
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td> <td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td> <td>{{ $seat->license->serial }}</td>
<td><a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a> <td>
<a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -394,8 +364,42 @@
</div> </div>
@endif @endif
</div><!-- /col --> </div><!-- /col -->
</div> <!-- row -->
</div> <!-- /.tab-pane software -->
<div class="tab-pane fade" id="components">
<!-- checked out assets table -->
<div class="row">
<div class="col-md-12">
@if(count($asset->components) > 0)
<table class="table table-striped">
<tbody>
<?php $totalCost = 0; ?>
@foreach ($asset->components as $component)
@if (is_null($component->deleted_at))
<tr>
<td><a href="{{ route('view/component', $component->id) }}">{{ $component->name }}</a></td>
</tr>
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="7" class="text-right">{{ $use_currency.$totalCost }}</td>
</tr>
</tfoot>
</table>
@else
<div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i>
{{ trans('general.no_results') }}
</div>
@endif
</div> </div>
</div> </div>
</div> <!-- /.tab-pane components -->
<div class="tab-pane fade" id="maintenances"> <div class="tab-pane fade" id="maintenances">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -435,14 +439,13 @@
<td>{{ $assetMaintenance->is_warranty ? trans('admin/asset_maintenances/message.warranty') : trans('admin/asset_maintenances/message.not_warranty') }}</td> <td>{{ $assetMaintenance->is_warranty ? trans('admin/asset_maintenances/message.warranty') : trans('admin/asset_maintenances/message.not_warranty') }}</td>
<td class="text-right"><nobr>{{ $use_currency.$assetMaintenance->cost }}</nobr></td> <td class="text-right"><nobr>{{ $use_currency.$assetMaintenance->cost }}</nobr></td>
<td> <td>
@if ($assetMaintenance->admin) @if ($assetMaintenance->admin)
<a href="{{ config('app.url') }}/admin/users/{{ $assetMaintenance->admin->id }}/view">{{ $assetMaintenance->admin->fullName() }}</a> <a href="{{ config('app.url') }}/admin/users/{{ $assetMaintenance->admin->id }}/view">{{ $assetMaintenance->admin->fullName() }}</a>
@endif @endif
</td> </td>
<?php $totalCost += $assetMaintenance->cost; ?> <?php $totalCost += $assetMaintenance->cost; ?>
<td><a href="{{ route('update/asset_maintenance', $assetMaintenance->id) }}" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <td>
<a href="{{ route('update/asset_maintenance', $assetMaintenance->id) }}" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a>
</td> </td>
</tr> </tr>
@endif @endif
@ -450,20 +453,19 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="8" class="text-right">{{ $use_currency.number_format($totalCost, 2) }}</td> <td colspan="8" class="text-right">{{ is_numeric($totalCost) ? $use_currency.number_format($totalCost, 2) : $totalCost }}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@else @else
<div class="alert alert-info alert-block"> <div class="alert alert-info alert-block">
<i class="fa fa-info-circle"></i> <i class="fa fa-info-circle"></i>
{{ trans('general.no_results') }} {{ trans('general.no_results') }}
</div> </div>
@endif @endif
</div> </div> <!-- /.col-md-12 -->
</div> </div> <!-- /.row -->
</div> </div> <!-- /.tab-pane maintenances -->
<div class="tab-pane fade" id="history"> <div class="tab-pane fade" id="history">
<!-- checked out assets table --> <!-- checked out assets table -->
@ -482,7 +484,6 @@
<tbody> <tbody>
@if (count($asset->assetlog) > 0) @if (count($asset->assetlog) > 0)
@foreach ($asset->assetlog as $log) @foreach ($asset->assetlog as $log)
<tr> <tr>
<td>{{ $log->created_at }}</td> <td>{{ $log->created_at }}</td>
<td> <td>
@ -502,6 +503,7 @@
<a href="{{ route('view/user', $log->checkedout_to) }}"> <a href="{{ route('view/user', $log->checkedout_to) }}">
{{ $log->userlog->fullName() }} {{ $log->userlog->fullName() }}
</a> </a>
@else @else
<del>{{ $log->userlog->fullName() }}</del> <del>{{ $log->userlog->fullName() }}</del>
@endif @endif
@ -518,6 +520,7 @@
@endforeach @endforeach
@endif @endif
<!-- Add a "created asset" row to the log list. This isn't an official log entry.-->
<tr> <tr>
<td>{{ $asset->created_at }}</td> <td>{{ $asset->created_at }}</td>
<td> <td>
@ -526,25 +529,20 @@
@else @else
{{ trans('general.unknown_admin') }} {{ trans('general.unknown_admin') }}
@endif @endif
</td> </td>
<td>{{ trans('general.created_asset') }}</td> <td>{{ trans('general.created_asset') }}</td>
<td></td> <td></td> <!-- User -->
<td> <td></td> <!-- Notes -->
<!-- @if ($asset->notes)
{!! nl2br(e($asset->notes)) !!}
@endif -->
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div> <!-- /.row -->
</div> </div> <!-- /.tab-pane history -->
<div class="tab-pane fade" id="files"> <div class="tab-pane fade" id="files">
<div class="row"> <div class="row">
{{ Form::open([ {{ Form::open([
'method' => 'POST', 'method' => 'POST',
'route' => ['upload/asset', $asset->id], 'route' => ['upload/asset', $asset->id],
@ -571,7 +569,6 @@
<div class="col-md-12"> <div class="col-md-12">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
@ -620,15 +617,13 @@
</tbody> </tbody>
</table> </table>
</div> </div> <!-- /.col-md-12 -->
</div> </div> <!-- /.row -->
</div> </div> <!-- /.tab-pane files -->
</div> <!-- /. tab-content -->
</div><!-- nav-tabs-custom --> </div> <!-- /.nav-tabs-custom -->
</div> <!-- /. col-md-12 -->
</div> <!-- /. row -->
</div>
</div>
@section('moar_scripts') @section('moar_scripts')
<script> <script>

View file

@ -83,6 +83,15 @@
</div> </div>
@endif @endif
<!-- Manufacturer -->
<div class="form-group {{ $errors->has('manufacturer_id') ? ' has-error' : '' }}">
<label for="manufacturer_id" class="col-md-3 control-label">{{ trans('general.manufacturer') }}
</label>
<div class="col-md-7 required">
{{ Form::select('manufacturer_id', $manufacturer_list , Input::old('manufacturer_id', $license->manufacturer_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('manufacturer_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Licensed to name --> <!-- Licensed to name -->
<div class="form-group {{ $errors->has('license_name') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('license_name') ? ' has-error' : '' }}">

View file

@ -37,6 +37,7 @@
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th> <th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-field="companyName" data-sortable="false" data-switchable="true">{{ trans('general.company') }}</th> <th data-field="companyName" data-sortable="false" data-switchable="true">{{ trans('general.company') }}</th>
<th data-field="name" data-sortable="true">{{ trans('admin/licenses/table.title') }}</th> <th data-field="name" data-sortable="true">{{ trans('admin/licenses/table.title') }}</th>
<th data-field="manufacturer" data-sortable="true">{{ trans('general.manufacturer') }}</th>
<th data-field="serial" data-sortable="true" >{{ trans('admin/licenses/table.serial') }}</th> <th data-field="serial" data-sortable="true" >{{ trans('admin/licenses/table.serial') }}</th>
<th data-field="license_name" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_name') }}</th> <th data-field="license_name" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_name') }}</th>
<th data-field="license_email" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_email') }}</th> <th data-field="license_email" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_email') }}</th>

View file

@ -136,6 +136,13 @@
</tr> </tr>
@endif @endif
@if (!is_null($license->manufacturer))
<tr>
<td>{{ trans('general.manufacturer') }}</td>
<td>{{ $license->manufacturer->name }}</td>
</tr>
@endif
@can('licenses.keys') @can('licenses.keys')
@if (!is_null($license->serial)) @if (!is_null($license->serial))
<tr> <tr>

View file

@ -25,17 +25,33 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="box box-default">
<div class="box-body">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#assets" data-toggle="tab">Assets</a>
</li>
<li>
<a href="#licenses" data-toggle="tab">Licenses</a>
</li>
<li>
<a href="#accessories" data-toggle="tab">Accessories</a>
</li>
<li>
<a href="#consumables" data-toggle="tab">Consumables</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="assets">
<table <table
name="category_assets" name="manufacturer_assets"
class="table table-striped" class="table table-striped bootstrap-table"
id="table" id="assets-table"
data-url="{{ route('api.manufacturers.view', $manufacturer->id) }}" data-url="{{ route('api.manufacturers.view', ['manufacturerId' => $manufacturer->id, 'itemtype' => 'assets']) }}"
data-cookie="true" data-cookie="true"
data-click-to-select="true" data-click-to-select="true"
data-cookie-id-table="maufacturerAssetsTableOIUOIUI"> data-cookie-id-table="maufacturerAssetsTable-{{config('version.hash_version') }}"
>
<thead> <thead>
<tr> <tr>
<th data-searchable="false" data-sortable="false" data-field="companyName" data-visible="false"> <th data-searchable="false" data-sortable="false" data-field="companyName" data-visible="false">
@ -52,10 +68,103 @@
</tr> </tr>
</thead> </thead>
</table> </table>
</div> <!-- /.tab-pane assets -->
<div class="tab-pane fade" id="licenses">
<table
name="manufacturer_licenses"
class="table table-striped bootstrap-table"
id="licenses-table"
data-url="{{ route('api.manufacturers.view', ['manufacturerId' => $manufacturer->id, 'itemtype' => 'licenses']) }}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="maufacturerLicensesTable-{{config('version.hash_version') }}"
>
<thead>
<tr>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-field="companyName" data-sortable="false" data-switchable="true">{{ trans('general.company') }}</th>
<th data-field="name" data-sortable="true">{{ trans('admin/licenses/table.title') }}</th>
<th data-field="manufacturer" data-sortable="true">{{ trans('general.manufacturer') }}</th>
<th data-field="serial" data-sortable="true" >{{ trans('admin/licenses/table.serial') }}</th>
<th data-field="license_name" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_name') }}</th>
<th data-field="license_email" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.to_email') }}</th>
<th data-field="totalSeats" data-sortable="false">{{ trans('admin/licenses/form.seats') }}</th>
<th data-field="remaining" data-sortable="false">{{ trans('admin/licenses/form.remaining_seats') }}</th>
<th data-field="purchase_date" data-sortable="true">{{ trans('admin/licenses/table.purchase_date') }}</th>
<th data-field="purchase_cost" data-sortable="true">{{ trans('admin/licenses/form.cost') }}</th>
<th data-field="purchase_order" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.purchase_order') }}</th>
<th data-field="expiration_date" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.expiration') }}</th>
<th data-field="notes" data-sortable="true" data-visible="false">{{ trans('admin/licenses/form.notes') }}</th>
<th data-field="actions">{{ trans('table.actions') }}</th>
</tr>
</thead>
</table>
</div> </div>
<div class="tab-pane fade" id="accessories">
<table
name="manufacturer_licenses"
class="table table-striped bootstrap-table"
id="licenses-table"
data-url="{{ route('api.manufacturers.view', ['manufacturerId' => $manufacturer->id, 'itemtype' => 'accessories']) }}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="maufacturerLicensesTable-{{config('version.hash_version') }}"
>
<thead>
<tr>
<th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
<th data-searchable="true" data-sortable="true" data-field="category">{{ trans('admin/accessories/general.accessory_category') }}</th>
<th data-field="manufacturer" data-searchable="true" data-sortable="true">{{ trans('general.manufacturer') }}</th>
<th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th>
<th data-searchable="false" data-sortable="false" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
<th data-searchable="true" data-sortable="true" data-field="purchase_date" data-visible="false">{{ trans('admin/accessories/general.date') }}</th>
<th data-searchable="true" data-sortable="true" data-field="purchase_cost">{{ trans('admin/accessories/general.cost') }}</th>
<th data-searchable="true" data-sortable="true" data-field="order_number" data-visible="false">{{ trans('admin/accessories/general.order') }}</th>
<th data-searchable="false" data-sortable="true" data-field="min_amt">{{ trans('general.min_amt') }}</th>
<th data-searchable="false" data-sortable="false" data-field="numRemaining">{{ trans('admin/accessories/general.remaining') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions">{{ trans('table.actions') }}</th>
</tr>
</thead>
</table>
</div> </div>
<div class="tab-pane fade" id="consumables">
<table
name="manufacturer_licenses"
class="table table-striped bootstrap-table"
id="licenses-table"
data-url="{{ route('api.manufacturers.view', ['manufacturerId' => $manufacturer->id, 'itemtype' => 'consumables']) }}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="maufacturerLicensesTable-{{config('version.hash_version') }}"
>
<thead>
<tr>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-switchable="true" data-searchable="true" data-sortable="true" data-field="companyName">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-searchable="true" data-field="name">{{ trans('admin/consumables/table.title') }}</th>
<th data-searchable="true" data-sortable="true" data-field="location">{{ trans('general.location') }}</th>
<th data-searchable="true" data-sortable="true" data-field="category">{{ trans('general.category') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="qty"> {{ trans('admin/consumables/general.total') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="numRemaining"> {{ trans('admin/consumables/general.remaining') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="true" data-field="min_amt"> {{ trans('general.min_amt') }}</th>
<th data-sortable="true" data-field="manufacturer" data-visible="false">{{ trans('general.manufacturer') }}</th>
<th data-sortable="true" data-field="model_no" data-visible="false">{{ trans('general.model_no') }}</th>
<th data-sortable="true" data-field="item_no" data-visible="false">{{ trans('admin/consumables/general.item_no') }}</th>
<th data-sortable="true" data-searchable="true" data-field="order_number" data-visible="false">{{ trans('admin/consumables/general.order') }}</th>
<th data-sortable="true" data-searchable="true" data-field="purchase_date" data-visible="false">{{ trans('admin/consumables/general.date') }}</th>
<th data-sortable="true" data-searchable="true" data-field="purchase_cost" data-visible="false">{{ trans('admin/consumables/general.cost') }}</th>
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="actions"> {{ trans('table.actions') }}</th>
</tr>
</thead>
</table>
</div> </div>
</div> </div> <!-- /.tab-content -->
</div> <!-- /.nav-tabs-custom -->
</div><!-- /. col-md-12 -->
</div> <!-- /.row -->
@section('moar_scripts') @section('moar_scripts')
@ -66,7 +175,7 @@
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script> <script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script> <script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
<script type="text/javascript"> <script type="text/javascript">
$('#table').bootstrapTable({ $('.bootstrap-table').bootstrapTable({
classes: 'table table-responsive table-no-bordered', classes: 'table table-responsive table-no-bordered',
undefinedText: '', undefinedText: '',
iconsPrefix: 'fa', iconsPrefix: 'fa',

View file

@ -41,7 +41,6 @@
<!-- Model name --> <!-- Model name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ trans('admin/models/table.name') }}</label> <label for="name" class="col-md-3 control-label">{{ trans('admin/models/table.name') }}</label>
</label>
<div class="col-md-7 required"> <div class="col-md-7 required">
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $model->name) }}" /> <input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $model->name) }}" />
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
@ -49,9 +48,7 @@
</div> </div>
<div class="form-group {{ $errors->has('manufacturer_id') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('manufacturer_id') ? ' has-error' : '' }}">
<label for="manufacturer_id" class="col-md-3 control-label">{{ trans('general.manufacturer') }} <label for="manufacturer_id" class="col-md-3 control-label">{{ trans('general.manufacturer') }}</label>
</label>
</label>
<div class="col-md-7 required"> <div class="col-md-7 required">
{{ Form::select('manufacturer_id', $manufacturer_list , Input::old('manufacturer_id', $model->manufacturer_id), array('class'=>'select2', 'style'=>'width:350px')) }} {{ Form::select('manufacturer_id', $manufacturer_list , Input::old('manufacturer_id', $model->manufacturer_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('manufacturer_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('manufacturer_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
@ -60,9 +57,7 @@
<!-- Category --> <!-- Category -->
<div class="form-group {{ $errors->has('category_id') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('category_id') ? ' has-error' : '' }}">
<label for="category_id" class="col-md-3 control-label">{{ trans('general.category') }} <label for="category_id" class="col-md-3 control-label">{{ trans('general.category') }}</label>
</label>
</label>
<div class="col-md-7 required"> <div class="col-md-7 required">
{{ Form::select('category_id', $category_list , Input::old('category_id', $model->category_id), array('class'=>'select2', 'style'=>'width:350px')) }} {{ Form::select('category_id', $category_list , Input::old('category_id', $model->category_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('category_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('category_id', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
@ -94,9 +89,9 @@
<label for="eol" class="col-md-3 control-label">{{ trans('general.eol') }}</label> <label for="eol" class="col-md-3 control-label">{{ trans('general.eol') }}</label>
<div class="col-md-3"> <div class="col-md-3">
<div class="input-group"> <div class="input-group">
<input class="col-md-1 form-control" type="text" name="eol" id="eol" value="{{ Input::old('eol', isset($model->eol)) ? $model->eol : 0 }}" /> <span class="input-group-addon"> <input class="col-md-1 form-control" type="text" name="eol" id="eol" value="{{ Input::old('eol', isset($model->eol)) ? $model->eol : 0 }}" />
<span class="input-group-addon">
{{ trans('general.months') }} {{ trans('general.months') }}
</span> </span>
{!! $errors->first('eol', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('eol', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
@ -109,7 +104,6 @@
<div class="col-md-7"> <div class="col-md-7">
{{ Form::select('custom_fieldset', \App\Helpers\Helper::customFieldsetList(),Input::old('custom_fieldset', $model->fieldset_id), array('class'=>'select2', 'style'=>'width:350px')) }} {{ Form::select('custom_fieldset', \App\Helpers\Helper::customFieldsetList(),Input::old('custom_fieldset', $model->fieldset_id), array('class'=>'select2', 'style'=>'width:350px')) }}
{!! $errors->first('custom_fieldset', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('custom_fieldset', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
</label>
</div> </div>
</div> </div>
@ -152,7 +146,4 @@
</div> </div>
</div> </div>
</form>
</div>
@stop @stop