diff --git a/.gitignore b/.gitignore index c1315449fe..d9cb306538 100755 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ app/config/local/session.php app/storage/dumps/* tests/_support/_generated/* tests/_data/scenarios +public/uploads/assets/* diff --git a/app/config/version.php b/app/config/version.php index 789b9589c9..eca2bd13a9 100644 --- a/app/config/version.php +++ b/app/config/version.php @@ -1,5 +1,5 @@ 'v2.0.5-pre', - 'hash_version' => 'v2.0.5-pre-3-gc1961c0', + 'hash_version' => 'v2.0.5-pre-52-gbbe0189', ); \ No newline at end of file diff --git a/app/controllers/admin/AccessoriesController.php b/app/controllers/admin/AccessoriesController.php index 2d6d25b05c..dbcb7d1503 100755 --- a/app/controllers/admin/AccessoriesController.php +++ b/app/controllers/admin/AccessoriesController.php @@ -69,19 +69,19 @@ class AccessoriesController extends AdminController $accessory->name = e(Input::get('name')); $accessory->category_id = e(Input::get('category_id')); $accessory->order_number = e(Input::get('order_number')); - + if (e(Input::get('purchase_date')) == '') { $accessory->purchase_date = NULL; } else { $accessory->purchase_date = e(Input::get('purchase_date')); } - + if (e(Input::get('purchase_cost')) == '0.00') { $accessory->purchase_cost = NULL; } else { $accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost'))); } - + $accessory->qty = e(Input::get('qty')); $accessory->user_id = Sentry::getId(); @@ -151,19 +151,19 @@ class AccessoriesController extends AdminController $accessory->name = e(Input::get('name')); $accessory->category_id = e(Input::get('category_id')); $accessory->order_number = e(Input::get('order_number')); - + if (e(Input::get('purchase_date')) == '') { $accessory->purchase_date = NULL; } else { $accessory->purchase_date = e(Input::get('purchase_date')); } - + if (e(Input::get('purchase_cost')) == '0.00') { $accessory->purchase_cost = NULL; } else { $accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost'))); } - + $accessory->qty = e(Input::get('qty')); // Was the accessory created? @@ -529,7 +529,7 @@ class AccessoriesController extends AdminController $rows[] = array( 'name' => link_to('admin/accessories/'.$accessory->id.'/view', $accessory->name), - 'category' => $accessory->category->name, + 'category' => link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name), 'qty' => $accessory->qty, 'order_number' => $accessory->order_number, 'purchase_date' => $accessory->purchase_date, diff --git a/app/controllers/admin/AssetMaintenancesController.php b/app/controllers/admin/AssetMaintenancesController.php index c7431df7c7..7959bad096 100644 --- a/app/controllers/admin/AssetMaintenancesController.php +++ b/app/controllers/admin/AssetMaintenancesController.php @@ -83,7 +83,7 @@ foreach($maintenances as $maintenance) { - $actions = ''; + $actions = ''; if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) { $maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost; diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index c2de106483..4e9327330f 100755 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -2,6 +2,7 @@ use AdminController; use Input; +use Image; use Lang; use Asset; use Supplier; @@ -29,6 +30,7 @@ use Paginator; use Manufacturer; //for embedded-create use Artisan; use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\HttpFoundation\JsonResponse; class AssetsController extends AdminController @@ -169,6 +171,19 @@ class AssetsController extends AdminController $asset->physical = '1'; $asset->depreciate = '0'; + // Create the image (if one was chosen.) + if (Input::file('image')) { + $image = Input::file('image'); + $file_name = str_random(25).".".$image->getClientOriginalExtension(); + $path = public_path('uploads/assets/'.$file_name); + Image::make($image->getRealPath())->resize(300, null, function ($constraint) { + $constraint->aspectRatio(); + $constraint->upsize(); + })->save($path); + $asset->image = $file_name; + + } + // Was the asset created? if($asset->save()) { @@ -181,7 +196,6 @@ class AssetsController extends AdminController $logaction->note = e(Input::get('note')); $log = $logaction->logaction('checkout'); } - // Redirect to the asset listing page return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.create.success')); } @@ -308,6 +322,20 @@ class AssetsController extends AdminController $asset->notes = e(Input::get('notes')); $asset->physical = '1'; + // Update the image + if (Input::file('image')) { + $image = Input::file('image'); + $file_name = str_random(25).".".$image->getClientOriginalExtension(); + $path = public_path('uploads/assets/'.$file_name); + Image::make($image->getRealPath())->resize(300, null, function ($constraint) { + $constraint->aspectRatio(); + $constraint->upsize(); + })->save($path); + $asset->image = $file_name; + } + + + // Was the asset updated? if($asset->save()) { // Redirect to the new asset page @@ -1156,7 +1184,8 @@ class AssetsController extends AdminController 'notes', 'expected_checkin', 'order_number', - 'location' + 'location', + 'image', ]; $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; @@ -1208,6 +1237,7 @@ class AssetsController extends AdminController $rows[] = array( 'checkbox' =>'
', 'id' => $asset->id, + 'image' => ($asset->image!='') ? '' : (($asset->model->image!='') ? '' : ''), 'name' => ''.$asset->name.'', 'asset_tag' => ''.$asset->asset_tag.'', 'serial' => $asset->serial, diff --git a/app/controllers/admin/CategoriesController.php b/app/controllers/admin/CategoriesController.php index 0ffeb6e9b3..f77edc22a6 100755 --- a/app/controllers/admin/CategoriesController.php +++ b/app/controllers/admin/CategoriesController.php @@ -299,6 +299,8 @@ class CategoriesController extends AdminController foreach ($category_assets as $asset) { $actions = ''; + $inout=''; + if ($asset->deleted_at=='') { $actions = '
'; } elseif ($asset->deleted_at!='') { diff --git a/app/database/migrations/2015_11_05_183749_image.php b/app/database/migrations/2015_11_05_183749_image.php new file mode 100644 index 0000000000..8d5749a43a --- /dev/null +++ b/app/database/migrations/2015_11_05_183749_image.php @@ -0,0 +1,34 @@ +text('image')->after('notes')->nullable()->default(NULL); + // + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('assets', function ($table) { + $table->dropColumn('image'); + }); + } + +} diff --git a/app/lang/en/admin/hardware/table.php b/app/lang/en/admin/hardware/table.php index 62dbc28ce1..e8baa09d5a 100755 --- a/app/lang/en/admin/hardware/table.php +++ b/app/lang/en/admin/hardware/table.php @@ -18,6 +18,7 @@ return array( 'serial' => 'Serial', 'status' => 'Status', 'title' => 'Asset ', + 'image' => 'Device Image', 'days_without_acceptance' => 'Days Without Acceptance' ); diff --git a/app/lang/en/general.php b/app/lang/en/general.php index a93173b049..19f8743d2a 100755 --- a/app/lang/en/general.php +++ b/app/lang/en/general.php @@ -140,4 +140,5 @@ 'years' => 'years', 'yes' => 'Yes', 'zip' => 'Zip', + 'noimage' => 'No image uploaded or image not found.', ]; diff --git a/app/views/backend/accessories/index.blade.php b/app/views/backend/accessories/index.blade.php index 7837d93aee..fe92543684 100755 --- a/app/views/backend/accessories/index.blade.php +++ b/app/views/backend/accessories/index.blade.php @@ -71,6 +71,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/asset_maintenances/index.blade.php b/app/views/backend/asset_maintenances/index.blade.php index 53caad3bec..6f1b52b077 100644 --- a/app/views/backend/asset_maintenances/index.blade.php +++ b/app/views/backend/asset_maintenances/index.blade.php @@ -64,6 +64,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/categories/index.blade.php b/app/views/backend/categories/index.blade.php index 9757256735..e1c60d6210 100755 --- a/app/views/backend/categories/index.blade.php +++ b/app/views/backend/categories/index.blade.php @@ -69,6 +69,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/consumables/index.blade.php b/app/views/backend/consumables/index.blade.php index c7c1d6f017..f689658464 100644 --- a/app/views/backend/consumables/index.blade.php +++ b/app/views/backend/consumables/index.blade.php @@ -69,6 +69,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/depreciations/index.blade.php b/app/views/backend/depreciations/index.blade.php index d036fa25ba..1ccfc505aa 100755 --- a/app/views/backend/depreciations/index.blade.php +++ b/app/views/backend/depreciations/index.blade.php @@ -67,6 +67,7 @@ $('#table').bootstrapTable({ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/hardware/edit.blade.php b/app/views/backend/hardware/edit.blade.php index d313f3e418..6402f2207a 100755 --- a/app/views/backend/hardware/edit.blade.php +++ b/app/views/backend/hardware/edit.blade.php @@ -113,9 +113,9 @@
@if ($asset->id) -
+ @else - + @endif @@ -300,11 +300,33 @@
+ + @if ($asset->image) +
+ +
+ {{ Form::checkbox('image_delete') }} + + {{ $errors->first('image_delete', '
:message') }} +
+
+ @endif + +
+ +
+ {{ Form::file('image') }} + {{ $errors->first('image', '
:message') }} +
+
+ + +
- @lang('button.cancel') + @lang('button.cancel')
diff --git a/app/views/backend/hardware/index.blade.php b/app/views/backend/hardware/index.blade.php index 128a9bd262..d200c4362e 100755 --- a/app/views/backend/hardware/index.blade.php +++ b/app/views/backend/hardware/index.blade.php @@ -67,6 +67,7 @@
@lang('general.id') + @lang('admin/hardware/table.image') @lang('admin/hardware/form.name') @lang('admin/hardware/table.asset_tag') @lang('admin/hardware/table.serial') @@ -119,6 +120,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/hardware/view.blade.php b/app/views/backend/hardware/view.blade.php index a146644c38..ee5cf34bf7 100755 --- a/app/views/backend/hardware/view.blade.php +++ b/app/views/backend/hardware/view.blade.php @@ -38,8 +38,6 @@
  • @lang('admin/hardware/general.clone')
  • - - @@ -47,7 +45,6 @@
    - @if ($asset->model->deleted_at!='')
    @@ -91,7 +88,7 @@ @if ($asset->purchase_cost)
    @lang('admin/hardware/form.cost'): - + @if (($asset->id) && ($asset->userloc)) {{{ $asset->userloc->currency }}} @elseif (($asset->id) && ($asset->assetloc)) @@ -144,6 +141,7 @@ @endif + @if ($asset->model->eol)
    @lang('admin/hardware/form.eol_rate'): @@ -178,10 +176,11 @@
    +
    Software Assigned
    -
    - + + @if (count($asset->licenses) > 0) @@ -295,8 +294,6 @@ @else {{{ $file->filename }}} @endif - -
    @if ($file->filename) @@ -408,6 +405,17 @@ @endif + + + @if ($asset->image) + + @else + @if ($asset->model->image!='') + + @endif + @endif + + @if (($asset->assigneduser) && ($asset->assigned_to > 0) && ($asset->deleted_at==''))

    @lang('admin/hardware/form.checkedout_to')
    @@ -415,6 +423,8 @@


  • {{ $asset->assigneduser->fullName() }}
  • +
    + @if (isset($asset->userloc)) diff --git a/app/views/backend/locations/index.blade.php b/app/views/backend/locations/index.blade.php index f127a13129..5445a19b4a 100755 --- a/app/views/backend/locations/index.blade.php +++ b/app/views/backend/locations/index.blade.php @@ -66,6 +66,7 @@ Locations :: sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/manufacturers/index.blade.php b/app/views/backend/manufacturers/index.blade.php index 61d26bb783..4bc40d5b4d 100755 --- a/app/views/backend/manufacturers/index.blade.php +++ b/app/views/backend/manufacturers/index.blade.php @@ -80,6 +80,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/models/index.blade.php b/app/views/backend/models/index.blade.php index d4d753730a..7a0410106b 100755 --- a/app/views/backend/models/index.blade.php +++ b/app/views/backend/models/index.blade.php @@ -65,6 +65,8 @@ sortable: true, mobileResponsive: true, showExport: true, + cookie: true, + cookieExpire: '2y', showColumns: true, maintainSelected: true, paginationFirstText: "@lang('general.first')", diff --git a/app/views/backend/suppliers/index.blade.php b/app/views/backend/suppliers/index.blade.php index c4b406676f..89c2ff5cd5 100755 --- a/app/views/backend/suppliers/index.blade.php +++ b/app/views/backend/suppliers/index.blade.php @@ -63,6 +63,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/app/views/backend/users/index.blade.php b/app/views/backend/users/index.blade.php index 9cef6d5310..0ee7342c50 100755 --- a/app/views/backend/users/index.blade.php +++ b/app/views/backend/users/index.blade.php @@ -113,6 +113,7 @@ sidePagination: 'server', sortable: true, cookie: true, + cookieExpire: '2y', mobileResponsive: true, showExport: true, showColumns: true, diff --git a/public/assets/css/compiled/layout.css b/public/assets/css/compiled/layout.css index 70c43e79d4..7f56548093 100644 --- a/public/assets/css/compiled/layout.css +++ b/public/assets/css/compiled/layout.css @@ -9,3 +9,8 @@ To remove this comment, please support us and upgrade to SiteFlow Pro. div.checker { display: inline; } + +.assetimg { + max-width: 250px; + max-height: 250px; +} diff --git a/public/uploads/assets/.gitkeep b/public/uploads/assets/.gitkeep new file mode 100644 index 0000000000..e69de29bb2