Skip to content

A free open source IT asset/license management system

Merge branch 'develop' into integrations/2020-04-15-v5-merge

snipe87464e6ec035
diff --cc README.md
index d74c5da3ee,14c2347b54..cd1d76f3e0
--- a/README.md
+++ b/README.md
@@@ -106,7 -115,9 +115,10 @@@ Thanks goes to all of these wonderful p
| [<img src="https://avatars0.githubusercontent.com/u/1680266?v=4" width="110px;"/><br /><sub>saymd</sub>](https://github.com/saymd)<br />[🌍](#translation-saymd "Translation") | [<img src="https://avatars0.githubusercontent.com/u/1826808?v=4" width="110px;"/><br /><sub>Patrik Larsson</sub>](https://nordsken.se)<br />[🌍](#translation-pooot "Translation") | [<img src="https://avatars1.githubusercontent.com/u/20584746?v=4" width="110px;"/><br /><sub>drcryo</sub>](https://github.com/drcryo)<br />[🌍](#translation-drcryo "Translation") | [<img src="https://avatars1.githubusercontent.com/u/19408004?v=4" width="110px;"/><br /><sub>pawel1615</sub>](https://github.com/pawel1615)<br />[🌍](#translation-pawel1615 "Translation") | [<img src="https://avatars2.githubusercontent.com/u/23340468?v=4" width="110px;"/><br /><sub>bodrovics</sub>](https://github.com/bodrovics)<br />[🌍](#translation-bodrovics "Translation") | [<img src="https://avatars0.githubusercontent.com/u/3257654?v=4" width="110px;"/><br /><sub>priatna</sub>](https://github.com/priatna)<br />[🌍](#translation-priatna "Translation") | [<img src="https://avatars1.githubusercontent.com/u/5358374?v=4" width="110px;"/><br /><sub>Fan Jiang</sub>](https://amayume.net)<br />[🌍](#translation-ProfFan "Translation") |
| [<img src="https://avatars1.githubusercontent.com/u/22555451?v=4" width="110px;"/><br /><sub>ragnarcx</sub>](https://github.com/ragnarcx)<br />[🌍](#translation-ragnarcx "Translation") | [<img src="https://avatars2.githubusercontent.com/u/18654582?v=4" width="110px;"/><br /><sub>Rein van Haaren</sub>](http://www.reinvanhaaren.nl/)<br />[🌍](#translation-reinvanhaaren "Translation") | [<img src="https://avatars1.githubusercontent.com/u/386672?v=4" width="110px;"/><br /><sub>Teguh Dwicaksana</sub>](http://dheche.songolimo.net)<br />[🌍](#translation-dheche "Translation") | [<img src="https://avatars2.githubusercontent.com/u/2572552?v=4" width="110px;"/><br /><sub>fraccie</sub>](https://github.com/FRaccie)<br />[🌍](#translation-FRaccie "Translation") | [<img src="https://avatars0.githubusercontent.com/u/35182720?v=4" width="110px;"/><br /><sub>vinzruzell</sub>](https://github.com/vinzruzell)<br />[🌍](#translation-vinzruzell "Translation") | [<img src="https://avatars1.githubusercontent.com/u/7883603?v=4" width="110px;"/><br /><sub>Kevin Austin</sub>](http://kevinaustin.com)<br />[🌍](#translation-vipsystem "Translation") | [<img src="https://avatars3.githubusercontent.com/u/3861828?v=4" width="110px;"/><br /><sub>Wira Sandy</sub>](http://azuraweb.xyz)<br />[🌍](#translation-wira-sandy "Translation") |
| [<img src="https://avatars2.githubusercontent.com/u/8663789?v=4" width="110px;"/><br /><sub>Илья</sub>](https://github.com/GrayHoax)<br />[🌍](#translation-GrayHoax "Translation") | [<img src="https://avatars3.githubusercontent.com/u/30119111?v=4" width="110px;"/><br /><sub>GodUseVPN</sub>](https://github.com/godusevpn)<br />[🌍](#translation-godusevpn "Translation") | [<img src="https://avatars1.githubusercontent.com/u/745576?v=4" width="110px;"/><br /><sub>周周</sub>](https://github.com/EngrZhou)<br />[🌍](#translation-EngrZhou "Translation") | [<img src="https://avatars3.githubusercontent.com/u/1631095?v=4" width="110px;"/><br /><sub>Sam</sub>](https://github.com/takuy)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=takuy "Code") | [<img src="https://avatars1.githubusercontent.com/u/264022?v=4" width="110px;"/><br /><sub>Azerothian</sub>](https://www.illisian.com.au)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=Azerothian "Code") | [<img src="https://avatars1.githubusercontent.com/u/7632599?v=4" width="110px;"/><br /><sub>Tim Farmer</sub>](https://github.com/timothyfarmer)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=timothyfarmer "Code") | [<img src="https://avatars0.githubusercontent.com/u/17459600?v=4" width="110px;"/><br /><sub>MariΓ‘n Skrip</sub>](https://github.com/mskrip)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=mskrip "Code") |
+ | [<img src="https://avatars3.githubusercontent.com/u/2611616?v=4" width="110px;"/><br /><sub>Dmitriy Minaev</sub>](https://github.com/VELIKII-DIVAN)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=VELIKII-DIVAN "Code") | [<img src="https://avatars0.githubusercontent.com/u/5132245?v=4" width="110px;"/><br /><sub>liquidhorse</sub>](https://github.com/liquidhorse)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=liquidhorse "Code") | [<img src="https://avatars1.githubusercontent.com/u/183678?v=4" width="110px;"/><br /><sub>Jordi Boggiano</sub>](https://seld.be/)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=Seldaek "Code") | [<img src="https://avatars0.githubusercontent.com/u/653557?v=4" width="110px;"/><br /><sub>Ivan Nieto</sub>](https://github.com/inietov)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=inietov "Code") | [<img src="https://avatars2.githubusercontent.com/u/6764151?v=4" width="110px;"/><br /><sub>Ben RUBSON</sub>](https://github.com/benrubson)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=benrubson "Code") | [<img src="https://avatars2.githubusercontent.com/u/8554558?v=4" width="110px;"/><br /><sub>NMathar</sub>](https://github.com/NMathar)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=NMathar "Code") | [<img src="https://avatars1.githubusercontent.com/u/139566?v=4" width="110px;"/><br /><sub>Steffen</sub>](https://github.com/smb)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=smb "Code") |
+| [<img src="https://avatars2.githubusercontent.com/u/47435081?v=4" width="110px;"/><br /><sub>Godfrey Martinez</sub>](https://github.com/Godmartinz)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=Godmartinz "Code") | [<img src="https://avatars1.githubusercontent.com/u/2075128?v=4" width="110px;"/><br /><sub>bigtreeEdo</sub>](https://github.com/bigtreeEdo)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=bigtreeEdo "Code") | [<img src="https://avatars0.githubusercontent.com/u/5000430?v=4" width="110px;"/><br /><sub>Colin McNeil</sub>](https://colinmcneil.me/)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=ColinMcNeil "Code") | [<img src="https://avatars0.githubusercontent.com/u/421625?v=4" width="110px;"/><br /><sub>JoKneeMo</sub>](https://github.com/JoKneeMo)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=JoKneeMo "Code") | [<img src="https://avatars0.githubusercontent.com/u/54849013?v=4" width="110px;"/><br /><sub>Joshi</sub>](http://www.redbridge.se)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=joshi-redbridge "Code") | [<img src="https://avatars2.githubusercontent.com/u/15731458?v=4" width="110px;"/><br /><sub>Anthony Burns</sub>](https://github.com/anthonypburns)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=anthonypburns "Code") |
+ | [<img src="https://avatars0.githubusercontent.com/u/6609453?v=4" width="110px;"/><br /><sub>Sxderp</sub>](https://github.com/Sxderp)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=Sxderp "Code") | [<img src="https://avatars1.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>fanta8897</sub>](https://github.com/fanta8897)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=fanta8897 "Code") | [<img src="https://avatars2.githubusercontent.com/u/2576509?v=4" width="110px;"/><br /><sub>Andrey Bolonin</sub>](https://andreybolonin.com/phpconsulting/)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=andreybolonin "Code") | [<img src="https://avatars3.githubusercontent.com/u/2173307?v=4" width="110px;"/><br /><sub>shinayoshi</sub>](http://www.shinayoshi.net/)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=shinayoshi "Code") | [<img src="https://avatars3.githubusercontent.com/u/2130159?v=4" width="110px;"/><br /><sub>Hubert</sub>](https://github.com/reuser)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=reuser "Code") | [<img src="https://avatars0.githubusercontent.com/u/6865789?v=4" width="110px;"/><br /><sub>KeenRivals</sub>](https://brashear.me)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=KeenRivals "Code") | [<img src="https://avatars3.githubusercontent.com/u/2902513?v=4" width="110px;"/><br /><sub>omyno</sub>](https://github.com/omyno)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=omyno "Code") |
+ | [<img src="https://avatars1.githubusercontent.com/u/6271335?v=4" width="110px;"/><br /><sub>Evgeny</sub>](https://github.com/jackka)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=jackka "Code") | [<img src="https://avatars2.githubusercontent.com/u/1169963?v=4" width="110px;"/><br /><sub>Colin Campbell</sub>](https://digitalist.se)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=colin-campbell "Code") | [<img src="https://avatars3.githubusercontent.com/u/2872098?v=4" width="110px;"/><br /><sub>Δ½ubomΓ­r Kučera</sub>](https://github.com/lubo)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=lubo "Code") | [<img src="https://avatars3.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://www.sourceguru.net)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=Mezzle "Code") | [<img src="https://avatars1.githubusercontent.com/u/7632599?v=4" width="110px;"/><br /><sub>Tim Farmer</sub>](https://github.com/timothyfarmer)<br />[πŸ’»](https://github.com/snipe/snipe-it/commits?author=timothyfarmer "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
diff --cc app/Http/Controllers/Api/AssetsController.php
index bc18e852d5,14af3f7536..5585f3a695
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@@ -30,10 -26,7 +26,8 @@@ use Slack
use Str;
use TCPDF;
use Validator;
- use View;
- use App\Http\Transformers\SelectlistTransformer;
+
/**
* This class controls all actions related to assets for
* the Snipe-IT Asset Management application.
@@@ -147,13 -136,9 +141,14 @@@ class AssetsController extends Controll
}
$request->filled('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
-
+ $offset = (($assets) && (request('offset') > $assets->count())) ? 0 : request('offset', 0);
+
+ // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
+ // case we override with the actual count, so we should return 0 items.
+ $offset = (($assets) && ($request->get('offset') > $assets->count())) ? $assets->count() : $request->get('offset', 0);
+
+
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
@@@ -296,9 -281,9 +291,10 @@@
break;
}
+
$total = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get();
+ // dd($assets);
return (new AssetsTransformer)->transformAssets($assets, $total);
}
@@@ -359,8 -344,15 +355,16 @@@
}
+ public function licenses($id)
+ {
+ $this->authorize('view', Asset::class);
+ $this->authorize('view', License::class);
+ $asset = Asset::where('id', $id)->withTrashed()->first();
+ $licenses = $asset->licenses()->get();
+ return (new LicensesTransformer())->transformLicenses($licenses, $licenses->count());
+ }
+
/**
* Gets a paginated collection for the select2 menus
*
@@@ -530,13 -568,9 +580,13 @@@
if ($asset->save()) {
if (($request->filled('assigned_user')) && ($target = User::find($request->get('assigned_user')))) {
- $location = $target->location_id;
+ $location = $target->location_id;
} elseif (($request->filled('assigned_asset')) && ($target = Asset::find($request->get('assigned_asset')))) {
- $location = $target->location_id;
+ $location = $target->location_id;
+
+ Asset::where('assigned_type', '\\App\\Models\\Asset')->where('assigned_to', $id)
+ ->update(['location_id' => $target->location_id]);
+
} elseif (($request->filled('assigned_location')) && ($target = Location::find($request->get('assigned_location')))) {
$location = $target->id;
}
@@@ -646,12 -686,11 +700,13 @@@
$asset_name = request('name', null);
// Set the location ID to the RTD location id if there is one
- if ($asset->rtd_location_id!='') {
- $asset->location_id = $target->rtd_location_id;
- }
+ // Wait, why are we doing this? This overrides the stuff we set further up, which makes no sense.
+ // TODO: Follow up here. WTF. Commented out for now.
+
+// if ((isset($target->rtd_location_id)) && ($asset->rtd_location_id!='')) {
+// $asset->location_id = $target->rtd_location_id;
+// }
diff --cc app/Http/Controllers/Api/LicensesController.php
index a16dd4fa83,86848fba28..389b68e4bb
--- a/app/Http/Controllers/Api/LicensesController.php
+++ b/app/Http/Controllers/Api/LicensesController.php
@@@ -230,21 -229,19 +231,26 @@@ class LicensesController extends Contro
$this->authorize('view', $license);
- $seats = LicenseSeat::where('license_id', $licenseId)->with('license', 'user', 'asset');
+ $seats = LicenseSeat::where('license_seats.license_id', $licenseId)
+
+ $offset = (($seats) && (request('offset') > $seats->count())) ? 0 : request('offset', 0);
+
+ $limit = request('limit', 50);
+ ->with('license', 'user', 'asset', 'user.department');
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
+ $total = $seats->count();
- if($total < $offset){
- $offset = 0;
+ if ($request->input('sort')=='department') {
+ $seats->OrderDepartments($order);
+ } else {
+ $seats->orderBy('id', $order);
}
+ $total = $seats->count();
+ $offset = (($seats) && (request('offset') > $total)) ? 0 : request('offset', 0);
+ $limit = request('limit', 50);
+
$seats = $seats->skip($offset)->take($limit)->get();
if ($seats) {
diff --cc app/Http/Controllers/Api/LocationsController.php
index d634f59599,11a35cd05a..5f3963a08e
--- a/app/Http/Controllers/Api/LocationsController.php
+++ b/app/Http/Controllers/Api/LocationsController.php
@@@ -191,27 -181,6 +182,23 @@@ class LocationsController extends Contr
/**
* Gets a paginated collection for the select2 menus
*
+ * This is handled slightly differently as of ~4.7.8-pre, as
+ * we have to do some recursive magic to get the hierarchy to display
+ * properly when looking at the parent/child relationship in the
+ * rich menus.
+ *
+ * This means we can't use the normal pagination that we use elsewhere
+ * in our selectlists, since we have to get the full set before we can
+ * determine which location is parent/child/grandchild, etc.
+ *
+ * This also means that hierarchy display gets a little funky when people
+ * use the Select2 search functionality, but there's not much we can do about
+ * that right now.
+ *
+ * As a result, instead of paginating as part of the query, we have to grab
+ * the entire data set, and then invoke a paginator manually and pass that
+ * through to the SelectListTransformer.
+ *
- * Many thanks to @uberbrady for the help getting this working better.
- * Recursion still sucks, but I guess he doesn't have to get in the
- * sea... this time.
- *
* @author [A. Gianotto] [<[email protected]>]
* @since [v4.0.16]
* @see \App\Http\Transformers\SelectlistTransformer
@@@ -223,42 -194,53 +212,64 @@@
$locations = Location::select([
'locations.id',
'locations.name',
- 'locations.parent_id',
'locations.image',
- ]);
+ ])->orderBy('name', 'ASC')->paginate(50)->map(function ($location) {
+ return $location->groupBy('parent_id')
+ ->map(function ($parentName) {
+ return $parentName->map(function ($parent) {
+ return $parent->game_types->groupBy('parent_id');
+ });
+ });
+ });
+ $page = 1;
+ if ($request->filled('page')) {
+ $page = $request->input('page');
+ }
- if ($request->filled('search')) {
- $locations = $locations->where('locations.name', 'LIKE', '%'.$request->input('search').'%');
- }
- $locations = $locations->orderBy('name', 'ASC')->get();
+ // $locations = Location::select([
+ // 'locations.id',
+ // 'locations.name',
+ // 'locations.image',
+ // ]);
+ //
+ // if ($request->filled('search')) {
+ // $locations = $locations->where('locations.name', 'LIKE', '%'.$request->get('search').'%');
+ // }
+ //
+ //
+ // $locations = $locations->groupBy(function ($locations) {
+ // return $locations->parent_id;
+ // })->orderBy('name', 'ASC')->paginate(50);
+ $locations_with_children = [];
+ foreach ($locations as $location) {
+ if (!array_key_exists($location->parent_id, $locations_with_children)) {
+ $locations_with_children[$location->parent_id] = [];
+ }
+ $locations_with_children[$location->parent_id][] = $location;
+ }
-// // $location_options_array = Location::getLocationHierarchy($locations);
-// $location_options = Location::flattenLocationsArray($location_options_array);
-// $location_options = array('' => 'Top Level') + $location_options;
-//
-// \Log::debug($location_options);
+ if ($request->filled('search')) {
+ $locations_formatted = $locations;
+ } else {
+ $location_options = Location::indenter($locations_with_children);
+ $locations_formatted = new Collection($location_options);
- // Work here to take an argument and see whether we need to not include the current location ID
+ }
+ // so that a location can't be its own parent
- $paginated_results = new LengthAwarePaginator($locations_formatted->forPage($page, 500), $locations_formatted->count(), 500, $page, []);
+ // Loop through and set some custom properties for the transformer to use.
+ // This lets us have more flexibility in special cases like assets, where
+ // they may not have a ->name value but we want to display something anyway
+ // foreach ($location_options as $location) {
+ // $location->use_text = $location->name;
+ // $location->use_image = ($location->image) ? url('/').'/uploads/locations/'.$location->image : null;
+ // }
- //return [];
- return (new SelectlistTransformer)->transformSelectlist($paginated_results);
+ return (new SelectlistTransformer)->transformSelectlist($locations);
}
diff --cc app/Http/Controllers/Api/SettingsController.php
index 5c8b617199,a1b7bda5d7..e8609d5746
--- a/app/Http/Controllers/Api/SettingsController.php
+++ b/app/Http/Controllers/Api/SettingsController.php
@@@ -15,91 -17,73 +17,75 @@@ use Illuminate\Support\Facades\Notifica
class SettingsController extends Controller
{
-
- public function ldaptest()
+ /**
+ * Test the ldap settings
+ *
+ * @author Wes Hulette <[email protected]>
+ *
+ * @since 5.0.0
+ *
+ * @param App\Models\LdapAd $ldap
+ *
+ * @return \Illuminate\Http\JsonResponse
+ */
+ public function ldapAdSettingsTest(LdapAd $ldap): JsonResponse
{
-
- if (Setting::getSettings()->ldap_enabled!='1') {
- \Log::debug('LDAP is not enabled so cannot test.');
- return response()->json(['message' => 'LDAP is not enabled, so we cannot test LDAP connections.'], 400);
+ if(!$ldap->init()) {
+ Log::info('LDAP is not enabled cannot test.');
+ return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
}
- \Log::debug('Preparing to test LDAP connection');
+ // The connect, bind and resulting users message
+ $message = [];
+ Log::info('Preparing to test LDAP user login');
+ // Test user can connect to the LDAP server
try {
- $connection = Ldap::connectToLdap();
- try {
- \Log::debug('attempting to bind to LDAP for LDAP test');
- Ldap::bindAdminToLdap($connection);
- return response()->json(['message' => 'It worked!'], 200);
- } catch (\Exception $e) {
+ $ldap->testLdapAdUserConnection();
+ $message['login'] = [
+ 'message' => 'Successfully connected to LDAP server.'
+ ];
+ } catch (\Exception $ex) {
+ \Log::debug('LDAP connected but Bind failed. Please check your LDAP settings and try again.');
- return response()->json(['message' => $e->getMessage()], 400);
- //return response()->json(['message' => $e->getMessage()], 500);
- }
+ return response()->json([
+ 'message' => 'Error logging into LDAP server, error: ' . $ex->getMessage() . ' - Verify your that your username and password are correct']);
+
} catch (\Exception $e) {
- \Log::debug('Connection failed but we cannot debug it any further on our end.');
-
+ \Log::info('LDAP connection failed but we cannot debug it any further on our end.');
+ return response()->json(['message' => 'The LDAP connection failed but we cannot debug it any further on our end. The error from the server is: '.$e->getMessage()], 500);
}
-
- }
-
- public function ldaptestlogin(Request $request)
- {
-
- if (Setting::getSettings()->ldap_enabled!='1') {
- \Log::debug('LDAP is not enabled. Cannot test.');
- return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
+ Log::info('Preparing to test LDAP bind connection');
+ // Test user can bind to the LDAP server
+ try {
+ $ldap->testLdapAdBindConnection();
+ $message['bind'] = [
+ 'message' => 'Successfully binded to LDAP server.'
+ ];
+ } catch (\Exception $ex) {
+ return response()->json([
+ 'message' => 'Error binding to LDAP server, error: ' . $ex->getMessage()
+ ], 400);
}
+
- $rules = array(
- 'ldaptest_user' => 'required',
- 'ldaptest_password' => 'required'
- );
-
- $validator = Validator::make($request->all(), $rules);
- if ($validator->fails()) {
- \Log::debug('LDAP Validation test failed.');
- $validation_errors = implode(' ',$validator->errors()->all());
- return response()->json(['message' => $validator->errors()->all()], 400);
- }
-
-
- \Log::debug('Preparing to test LDAP login');
+ Log::info('Preparing to get sample user set from LDAP directory');
+ // Get a sample of 10 users so user can verify the data is correct
try {
- $connection = Ldap::connectToLdap();
- try {
- Ldap::bindAdminToLdap($connection);
- \Log::debug('Attempting to bind to LDAP for LDAP test');
- try {
- $ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
- if ($ldap_user) {
- \Log::debug('It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.');
- return response()->json(['message' => 'It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'], 200);
- }
- return response()->json(['message' => 'Login Failed. '. $request->input('ldaptest_user').' did not successfully bind to LDAP.'], 400);
-
- } catch (\Exception $e) {
- \Log::debug('LDAP login failed');
- return response()->json(['message' => $e->getMessage()], 400);
- }
-
- } catch (\Exception $e) {
- \Log::debug('Bind failed');
- return response()->json(['message' => $e->getMessage()], 400);
- //return response()->json(['message' => $e->getMessage()], 500);
- }
- } catch (\Exception $e) {
- \Log::debug('Connection failed');
- return response()->json(['message' => $e->getMessage()], 500);
+ $users = $ldap->testUserImportSync();
+ $message['user_sync'] = [
+ 'users' => $users
+ ];
+ } catch (\Exception $ex) {
+ $message['user_sync'] = [
+ 'message' => 'Error getting users from LDAP directory, error: ' . $ex->getMessage()
+ ];
+ return response()->json($message, 400);
}
-
+ return response()->json($message, 200);
}
-
public function slacktest()
{
diff --cc app/Http/Controllers/Api/UsersController.php
index 06d7661aa7,576e691da4..3bc1c9edb0
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@@ -2,19 -2,19 +2,20 @@@
namespace App\Http\Controllers\Api;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use App\Http\Transformers\UsersTransformer;
- use App\Models\Company;
- use App\Models\User;
use App\Helpers\Helper;
+ use App\Http\Controllers\Controller;
use App\Http\Requests\SaveUserRequest;
- use App\Models\Asset;
- use App\Http\Transformers\AssetsTransformer;
- use App\Http\Transformers\SelectlistTransformer;
use App\Http\Transformers\AccessoriesTransformer;
+ use App\Http\Transformers\AssetsTransformer;
use App\Http\Transformers\LicensesTransformer;
+ use App\Http\Transformers\SelectlistTransformer;
+ use App\Http\Transformers\UsersTransformer;
+ use App\Models\Asset;
+ use App\Models\Company;
+ use App\Models\License;
+ use App\Models\User;
+ use Illuminate\Http\Request;
+use Auth;
class UsersController extends Controller
{
@@@ -89,11 -89,8 +90,12 @@@
}
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
+ $offset = (($users) && (request('offset') > $users->count())) ? 0 : request('offset', 0);
+ // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
+ // case we override with the actual count, so we should return 0 items.
+ $offset = (($users) && ($request->get('offset') > $users->count())) ? $users->count() : $request->get('offset', 0);
+
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
diff --cc app/Http/Controllers/AssetModelsController.php
index 536a951660,254cee24ac..528504e47b
--- a/app/Http/Controllers/AssetModelsController.php
+++ b/app/Http/Controllers/AssetModelsController.php
@@@ -1,25 -1,15 +1,18 @@@
<?php
namespace App\Http\Controllers;
- use App\Models\CustomField;
- use Image;
- use Input;
- use Lang;
+ use App\Helpers\Helper;
+ use App\Http\Requests\ImageUploadRequest;
use App\Models\AssetModel;
+ use Illuminate\Support\Facades\Auth;
+ use Illuminate\Support\Facades\Input;
+ use Illuminate\Support\Facades\View;
use Redirect;
- use Auth;
- use DB;
- use Str;
- use Validator;
- use View;
- use App\Models\Asset;
- use App\Models\Company;
- use Config;
- use App\Helpers\Helper;
- use Illuminate\Http\Request;
+ use Request;
+ use Storage;
+use App\Http\Requests\ImageUploadRequest;
+
+use Symfony\Component\HttpFoundation\JsonResponse;
/**
* This class controls all actions related to asset models for
diff --cc app/Http/Controllers/Assets/AssetsController.php
index 8a146e8709,789820f56b..9feecbd640
--- a/app/Http/Controllers/Assets/AssetsController.php
+++ b/app/Http/Controllers/Assets/AssetsController.php
@@@ -114,71 -106,59 +106,60 @@@ class AssetsController extends Controll
{
$this->authorize(Asset::class);
+ // Handle asset tags - there could be one, or potentially many.
+ // This is only necessary on create, not update, since bulk editing is handled
+ // differently
+ $asset_tags = $request->input('asset_tags');
- $asset = new Asset();
- $asset->model()->associate(AssetModel::find($request->input('model_id')));
-
- $asset->name = $request->input('name');
- $asset->serial = $request->input('serial');
- $asset->company_id = Company::getIdForCurrentUser($request->input('company_id'));
- $asset->model_id = $request->input('model_id');
- $asset->order_number = $request->input('order_number');
- $asset->notes = $request->input('notes');
- $asset->asset_tag = $request->input('asset_tag');
- $asset->user_id = Auth::id();
- $asset->archived = '0';
- $asset->physical = '1';
- $asset->depreciate = '0';
- $asset->status_id = request('status_id', 0);
- $asset->warranty_months = request('warranty_months', null);
- $asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost'));
- $asset->purchase_date = request('purchase_date', null);
- $asset->assigned_to = request('assigned_to', null);
- $asset->supplier_id = request('supplier_id', 0);
- $asset->requestable = request('requestable', 0);
- $asset->rtd_location_id = request('rtd_location_id', null);
+ $success = false;
+ $serials = $request->input('serials');
- if ($asset->assigned_to=='') {
- $asset->location_id = $request->input('rtd_location_id', null);
- }
+ for ($a = 1; $a <= count($asset_tags); $a++) {
- // Create the image (if one was chosen.)
- if ($request->filled('image')) {
- $image = $request->input('image');
-
- // After modification, the image is prefixed by mime info like the following:
- // data:image/jpeg;base64,; This causes the image library to be unhappy, so we need to remove it.
- $header = explode(';', $image, 2)[0];
- // Grab the image type from the header while we're at it.
- $extension = substr($header, strpos($header, '/')+1);
- // Start reading the image after the first comma, postceding the base64.
- $image = substr($image, strpos($image, ',')+1);
-
- $file_name = str_random(25).".".$extension;
-
- $directory= public_path('uploads/assets/');
- // Check if the uploads directory exists. If not, try to create it.
- if (!file_exists($directory)) {
- mkdir($directory, 0755, true);
+ $asset = new Asset();
+ $asset->model()->associate(AssetModel::find($request->input('model_id')));
+ $asset->name = $request->input('name');
+
+ // Check for a corresponding serial
+ if (($serials) && (array_key_exists($a, $serials))) {
+ $asset->serial = $serials[$a];
}
- $path = public_path('uploads/assets/'.$file_name);
- try {
- Image::make($image)->resize(800, 800, function ($constraint) {
- $constraint->aspectRatio();
- $constraint->upsize();
- })->save($path);
- $asset->image = $file_name;
- } catch (\Exception $e) {
- \Input::flash();
- $messageBag = new \Illuminate\Support\MessageBag();
- $messageBag->add('image', $e->getMessage());
- \Session()->flash('errors', \Session::get('errors', new \Illuminate\Support\ViewErrorBag)
- ->put('default', $messageBag));
- return response()->json(['image' => $e->getMessage()], 422);
+
+ if (($asset_tags) && (array_key_exists($a, $asset_tags))) {
+ $asset->asset_tag = $asset_tags[$a];
}
+
+ $asset->company_id = Company::getIdForCurrentUser($request->input('company_id'));
+ $asset->model_id = $request->input('model_id');
+ $asset->order_number = $request->input('order_number');
+ $asset->notes = $request->input('notes');
+ $asset->user_id = Auth::id();
+ $asset->archived = '0';
+ $asset->physical = '1';
+ $asset->depreciate = '0';
+ $asset->status_id = request('status_id', 0);
+ $asset->warranty_months = request('warranty_months', null);
+ $asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost'));
+ $asset->purchase_date = request('purchase_date', null);
+ $asset->assigned_to = request('assigned_to', null);
+ $asset->supplier_id = request('supplier_id', 0);
+ $asset->requestable = request('requestable', 0);
+ $asset->rtd_location_id = request('rtd_location_id', null);
+
+ if (!empty($settings->audit_interval)) {
+ $asset->next_audit_date = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
+ }
+
+ if ($asset->assigned_to=='') {
+ $asset->location_id = $request->input('rtd_location_id', null);
+ }
+
+ // Create the image (if one was chosen.)
+ if ($request->has('image')) {
+ $asset = $request->handleImages($asset);
}
+
// Update custom fields in the database.
// Validation for these fields is handled through the AssetRequest form request
$model = AssetModel::find($request->get('model_id'));
@@@ -195,31 -175,39 +176,41 @@@
}
}
- // Was the asset created?
- if ($asset->save()) {
+ // Validate the asset before saving
+ if ($asset->isValid() && $asset->save()) {
+
+ if (request('assigned_user')) {
+ $target = User::find(request('assigned_user'));
+ $location = $target->location_id;
+ } elseif (request('assigned_asset')) {
+ $target = Asset::find(request('assigned_asset'));
+ $location = $target->location_id;
+ } elseif (request('assigned_location')) {
+ $target = Location::find(request('assigned_location'));
+ $location = $target->id;
+ }
+
+ if (isset($target)) {
+ $asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e($request->get('name')), $location);
+ }
+
+ $success = true;
- if (request('assigned_user')) {
- $target = User::find(request('assigned_user'));
- $location = $target->location_id;
- } elseif (request('assigned_asset')) {
- $target = Asset::find(request('assigned_asset'));
- $location = $target->location_id;
- } elseif (request('assigned_location')) {
- $target = Location::find(request('assigned_location'));
- $location = $target->id;
}
- if (isset($target)) {
+ }
+
+ if ($success) {
+ $asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e($request->get('name')), $location);
+ }
// Redirect to the asset listing page
- \Session::flash('success', trans('admin/hardware/message.create.success'));
- return response()->json(['redirect_url' => route('hardware.index')]);
+ return redirect()->route('hardware.index')
+ ->with('success', trans('admin/hardware/message.create.success'));
}
- \Input::flash();
- \Session::flash('errors', $asset->getErrors());
- return response()->json(['errors' => $asset->getErrors()], 500);
+
+ return redirect()->back()->withInput()->withErrors($asset->getErrors());
+
}
/**
@@@ -394,19 -353,11 +356,23 @@@
if ($asset->save()) {
+
- // Update any assigned assets with the new location_id from the parent asset
++ // Update any assigned assets with the new location_id from the parent asset
+
+ Asset::where('assigned_type', '\\App\\Models\\Asset')->where('assigned_to', $asset->id)
+ ->update(['location_id' => $asset->location_id]);
+
+ // Redirect to the new asset page
+ \Session::flash('success', trans('admin/hardware/message.update.success'));
+ return response()->json(['redirect_url' => route("hardware.show", $assetId)]);
+ }
+ \Input::flash();
+ \Session::flash('errors', $asset->getErrors());
- return response()->json(['errors' => $asset->getErrors()], 500);
+ return redirect()->route("hardware.show", $assetId)
+ ->with('success', trans('admin/hardware/message.update.success'));
+ }
+
+ return redirect()->back()->withInput()->withErrors($asset->getErrors());
}
/**
@@@ -555,23 -472,33 +529,38 @@@
$barcode_width = ($settings->labels_width - $settings->labels_display_sgutter) * 96.000000000001;
$barcode = new \Com\Tecnick\Barcode\Barcode();
- $barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,($barcode_width < 300 ? $barcode_width : 300),50);
- file_put_contents($barcode_file, $barcode_obj->getPngData());
+ try {
+ return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
+ }
+ }
+ }
+ $barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,($barcode_width < 300 ? $barcode_width : 300),50);
+ /**
+ * Return a label for an individual asset.
+ *
+ * @author [L. Swartzendruber] [<[email protected]>
+ * @param int $assetId
+ * @return View
+ */
- public function getLabel($assetId = null)
+ file_put_contents($barcode_file, $barcode_obj->getPngData());
+ {
+ if (isset($assetId)) {
+ $asset = Asset::find($assetId);
- $this->authorize('view', $asset);
+ return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
+
- } catch (\Exception $e) {
- \Log::debug('Error creating barcode: '.$e->getMessage());
++
+
- return view('hardware/labels')
- ->with('assets', Asset::find($asset))
+ ->with('settings', Setting::getSettings())
- ->with('bulkedit', false)
- ->with('count', 0);
+ \Log::debug('This usually happens because the asset tags are of a format that is not compatible with the selected barcode type.');
+ $img = file_get_contents(public_path().'/uploads/barcodes/invalid_barcode.gif');
+ return response($img)->header('Content-type', 'image/gif');
+ }
+
+
+ }
}
}
@@@ -846,24 -763,28 +824,27 @@@
$asset->next_audit_date = $request->input('next_audit_date');
$asset->last_audit_date = date('Y-m-d h:i:s');
- if ($asset->save()) {
-
+ // Check to see if they checked the box to update the physical location,
+ // not just note it in the audit notes
+ if ($request->input('update_location')=='1') {
+ \Log::debug('update location in audit');
+ $asset->location_id = $request->input('location_id');
+ }
- $filename = '';
+ if ($asset->save()) {
+ $file_name = '';
+ // Upload an image, if attached
if ($request->hasFile('image')) {
- $file = $request->file('image');
- try {
- $destinationPath = config('app.private_uploads').'/audits';
- $extension = $file->getClientOriginalExtension();
- $filename = 'audit-'.$asset->id.'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
- $file->move($destinationPath, $filename);
- } catch (\Exception $e) {
- \Log::info($e);
- }
+ $path = 'private_uploads/audits';
+ if (!Storage::exists($path)) Storage::makeDirectory($path, 775);
+ $upload = $image = $request->file('image');
+ $ext = $image->getClientOriginalExtension();
+ $file_name = 'audit-'.str_random(18).'.'.$ext;
+ Storage::putFileAs($path, $upload, $file_name);
}
- $asset->logAudit($request->input('note'), $request->input('location_id'), $filename);
-
+ $asset->logAudit($request->input('note'), $request->input('location_id'), $file_name);
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.audit.success'));
}
}
diff --cc app/Http/Controllers/Auth/ForgotPasswordController.php
index a7f3c591ad,ef0760e276..1f3f11efc2
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@@ -52,25 -49,15 +52,27 @@@ class ForgotPasswordController extends
*/
public function sendResetLinkEmail(Request $request)
{
+ $this->validate($request, ['username' => 'required'], ['username.required' => 'Please enter your username.']);
+ /**
+ * Let's set a max character count here to prevent potential
+ * buffer overflow issues with attackers sending very large
+ * payloads through.
+ */
+ $this->validate($request, ['email' => 'required|email|max:250']);
- // Make sure the user is active, and their password is not controlled via LDAP
+ /**
+ * If we find a matching email with an activated user, we will
+ * send the password reset link to the user.
+ *
+ * Once we have attempted to send the link, we will examine the response
+ * then see the message we need to show to the user. Finally, we'll send out a proper response.
+ */
$response = $this->broker()->sendResetLink(
array_merge(
- $request->only('email'),
- ['activated' => '1']
+ $request->only('username'),
+ ['activated' => '1'],
+ ['ldap_import' => '0']
)
);
@@@ -79,26 -68,9 +83,26 @@@
}
+ /**
+ * If an error was returned by the password broker, we will get this message
+ * translated so we can notify a user of the problem. We'll redirect back
+ * to where the users came from so they can attempt this process again.
+ *
+ * HOWEVER, we do not want to translate the message if the user isn't found
+ * or isn't active, since that would allow an attacker to walk through
+ * a dictionary attack and figure out registered user email addresses.
+ *
+ * Instead we tell the user we've sent an email even though we haven't.
+ * It's bad UX, but better security. The compromises we sometimes have to make.
+ */
- if ($response == 'passwords.user') {
- \Log::debug('User with email '.$request->input('email').' attempted a password reset request but was not found. No email was sent.');
- return redirect()->route('login')->with('success', trans('passwords.user_inactive'));
+ // Regardless of response, we do not want to disclose the status of a user account,
+ // so we give them a generic "If this exists, we're TOTALLY gonna email you" response
+ return redirect()->route('login')->with('success',trans('passwords.sent'));
+ }
+
+ return back()->withErrors(
+ ['email' => trans($response)]
+ );
}
}
diff --cc app/Http/Controllers/CategoriesController.php
index a2f33ebb0a,dfbaf10e34..6623276bce
--- a/app/Http/Controllers/CategoriesController.php
+++ b/app/Http/Controllers/CategoriesController.php
@@@ -141,14 -134,9 +134,10 @@@ class CategoriesController extends Cont
$category->use_default_eula = $request->input('use_default_eula', '0');
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->checkin_email = $request->input('checkin_email', '0');
- $category = $request->handleImages($category);
- // Set the model's image property to null if the image is being deleted
- if ($request->input('image_delete') == 1) {
- $category->image = null;
- }
+ $category = $request->handleImages($category,600, public_path().'/uploads/categories');
+
if ($category->save()) {
// Redirect to the new category page
return redirect()->route('categories.index')->with('success', trans('admin/categories/message.update.success'));
@@@ -219,8 -210,9 +211,6 @@@
->with('category_type_route',$category_type_route);
}
- // Prepare the error message
- // Redirect to the user management page
- return redirect()->route('categories.index')
- ->with('error', trans('admin/categories/message.does_not_exist'));
+ return redirect()->route('categories.index')->with('error', trans('admin/categories/message.does_not_exist'));
}
-
-
}
diff --cc app/Http/Controllers/CompaniesController.php
index 637f11b1d8,6bec2ed8c7..2a61ffe968
--- a/app/Http/Controllers/CompaniesController.php
+++ b/app/Http/Controllers/CompaniesController.php
@@@ -112,13 -113,7 +113,9 @@@ final class CompaniesController extend
$company->name = $request->input('name');
- // Set the model's image property to null if the image is being deleted
- if ($request->input('image_delete') == 1) {
- $company->image = null;
- }
-
- $company = $request->handleImages($company);
++
+ $company = $request->handleImages($company,600, public_path().'/uploads/companies');
+
if ($company->save()) {
return redirect()->route('companies.index')
diff --cc app/Http/Controllers/LocationsController.php
index c5c5e8d3a0,9bbc7a7540..67ed095e8b
--- a/app/Http/Controllers/LocationsController.php
+++ b/app/Http/Controllers/LocationsController.php
@@@ -153,7 -148,33 +148,8 @@@ class LocationsController extends Contr
$location->zip = $request->input('zip');
$location->ldap_ou = $request->input('ldap_ou');
$location->manager_id = $request->input('manager_id');
+
- $location = $request->handleImages($location, 'public/uploads/locations');
-
-
- if ($request->file('image')) {
- $image = $request->file('image');
- $file_name = $location->id.'-'.str_slug($image->getClientOriginalName()) . "." . $image->getClientOriginalExtension();
-
- if ($image->getClientOriginalExtension()!='svg') {
- Image::make($image->getRealPath())->resize(800, null, function ($constraint) {
- $constraint->aspectRatio();
- $constraint->upsize();
- })->save(app('locations_upload_path').$file_name);
- } else {
- $image->move(app('locations_upload_path'), $file_name);
- }
- $location->image = $file_name;
-
- }
-
- if ((($request->file('image')) && (isset($old_image)) && ($old_image!='')) || ($request->input('image_delete') == 1)) {
- try {
- unlink(app('locations_upload_path').$old_image);
- } catch (\Exception $e) {
- \Log::info($e);
- }
- }
+ $location = $request->handleImages($location,600, public_path().'/uploads/locations');
if ($location->save()) {
diff --cc app/Http/Controllers/ManufacturersController.php
index 09752adb69,9494caacfd..dde37b090d
--- a/app/Http/Controllers/ManufacturersController.php
+++ b/app/Http/Controllers/ManufacturersController.php
@@@ -69,13 -64,15 +64,13 @@@ class ManufacturersController extends C
$this->authorize('create', Manufacturer::class);
$manufacturer = new Manufacturer;
- $manufacturer->name = $request->input('name');
- $manufacturer->user_id = Auth::user()->id;
- $manufacturer->url = $request->input('url');
- $manufacturer->support_url = $request->input('support_url');
+ $manufacturer->name = $request->input('name');
+ $manufacturer->user_id = Auth::id();
+ $manufacturer->url = $request->input('url');
+ $manufacturer->support_url = $request->input('support_url');
$manufacturer->support_phone = $request->input('support_phone');
$manufacturer->support_email = $request->input('support_email');
-
-
- $manufacturer = $request->handleImages($manufacturer,'manufacturers');
+ $manufacturer = $request->handleImages($manufacturer,600, public_path().'/uploads/manufacturers');
@@@ -86,24 -83,22 +81,25 @@@
}
/**
- * Returns a view that displays a form to edit a manufacturer.
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @see ManufacturersController::update()
- * @param int $manufacturerId
- * @since [v1.0]
- * @return \Illuminate\Contracts\View\View
+ * Returns a view that displays a form to edit a manufacturer.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @see ManufacturersController::update()
+ * @param int $manufacturerId
+ * @since [v1.0]
+ * @return \Illuminate\Contracts\View\View
+ * @throws \Illuminate\Auth\Access\AuthorizationException
*/
- public function edit($id = null)
+ public function edit($manufacturerId = null)
{
+ // Handles manufacturer checks and permissions.
$this->authorize('update', Manufacturer::class);
+
// Check if the manufacturer exists
- if (is_null($item = Manufacturer::find($manufacturerId))) {
+ if (!$item = Manufacturer::find($id)) {
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
}
+
// Show the page
return view('manufacturers/edit', compact('item'));
}
@@@ -129,21 -125,15 +126,20 @@@
}
// Save the data
- $manufacturer->name = $request->input('name');
- $manufacturer->url = $request->input('url');
- $manufacturer->support_url = $request->input('support_url');
+ $manufacturer->name = $request->input('name');
+ $manufacturer->url = $request->input('url');
+ $manufacturer->support_url = $request->input('support_url');
$manufacturer->support_phone = $request->input('support_phone');
$manufacturer->support_email = $request->input('support_email');
+
+ // Set the model's image property to null if the image is being deleted
+ if ($request->input('image_delete') == 1) {
+ $manufacturer->image = null;
+ }
- $manufacturer = $request->handleImages($manufacturer);
+ $manufacturer = $request->handleImages($manufacturer,600, public_path().'/uploads/manufacturers');
-
if ($manufacturer->save()) {
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.update.success'));
}
diff --cc app/Http/Controllers/SettingsController.php
index 4aa574a6d7,a8882c7180..93647cd8af
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@@ -1,29 -1,24 +1,23 @@@
<?php
+
namespace App\Http\Controllers;
-use App\Helpers\Helper;
-use App\Http\Requests\ImageUploadRequest;
+use enshrined\svgSanitize\Sanitizer;
- use Input;
- use Lang;
- use Illuminate\Http\Request;
+ use App\Http\Requests\SetupUserRequest;
use App\Models\Setting;
- use App\Models\Ldap;
- use Redirect;
+ use App\Models\User;
+ use App\Notifications\FirstAdminNotification;
+ use App\Notifications\MailTest;
+ use Artisan;
+ use Auth;
+ use Crypt;
use DB;
- use Str;
- use View;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\Storage;
use Image;
- use Config;
+ use Input;
+ use Redirect;
use Response;
- use Artisan;
- use Crypt;
- use Mail;
- use Auth;
- use App\Models\User;
- use App\Http\Requests\SetupUserRequest;
- use App\Http\Requests\ImageUploadRequest;
- use App\Http\Requests\SettingsLdapRequest;
- use App\Helpers\Helper;
- use App\Notifications\FirstAdminNotification;
/**
* This controller handles all actions related to Settings for
@@@ -140,75 -139,63 +138,66 @@@ class SettingsController extends Contro
->with('section', 'Pre-Flight Check');
}
-
/**
- * Save the first admin user from Setup.
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @since [v3.0]
- * @return Redirect
- */
+ * Save the first admin user from Setup.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ *
+ * @since [v3.0]
+ *
+ * @return Redirect
+ */
public function postSaveFirstAdmin(SetupUserRequest $request)
{
-
-
- $user = new User;
- $user->first_name = $data['first_name']= $request->input('first_name');
- $user->last_name = $request->input('last_name');
- $user->email = $data['email'] = $request->input('email');
- $user->activated = 1;
- $permissions = array('superuser' => 1);
+ $user = new User();
+ $user->first_name = $data['first_name'] = $request->input('first_name');
+ $user->last_name = $request->input('last_name');
+ $user->email = $data['email'] = $request->input('email');
+ $user->activated = 1;
+ $permissions = ['superuser' => 1];
$user->permissions = json_encode($permissions);
- $user->username = $data['username'] = $request->input('username');
- $user->password = bcrypt($request->input('password'));
- $data['password'] = $request->input('password');
+ $user->username = $data['username'] = $request->input('username');
+ $user->password = bcrypt($request->input('password'));
+ $data['password'] = $request->input('password');
- $settings = new Setting;
+ $settings = new Setting();
$settings->full_multiple_companies_support = $request->input('full_multiple_companies_support', 0);
- $settings->site_name = $request->input('site_name');
- $settings->alert_email = $request->input('email');
- $settings->alerts_enabled = 1;
- $settings->pwd_secure_min = 10;
- $settings->brand = 1;
- $settings->locale = $request->input('locale', 'en');
- $settings->default_currency = $request->input('default_currency', "USD");
- $settings->user_id = 1;
- $settings->email_domain = $request->input('email_domain');
- $settings->email_format = $request->input('email_format');
- $settings->next_auto_tag_base = 1;
- $settings->auto_increment_assets = $request->input('auto_increment_assets', 0);
- $settings->auto_increment_prefix = $request->input('auto_increment_prefix');
-
-
- if ((!$user->isValid()) || (!$settings->isValid())) {
+ $settings->site_name = $request->input('site_name');
+ $settings->alert_email = $request->input('email');
+ $settings->alerts_enabled = 1;
+ $settings->pwd_secure_min = 10;
+ $settings->brand = 1;
+ $settings->locale = $request->input('locale', 'en');
+ $settings->default_currency = $request->input('default_currency', 'USD');
+ $settings->user_id = 1;
+ $settings->email_domain = $request->input('email_domain');
+ $settings->email_format = $request->input('email_format');
+ $settings->next_auto_tag_base = 1;
+ $settings->auto_increment_assets = $request->input('auto_increment_assets', 0);
+ $settings->auto_increment_prefix = $request->input('auto_increment_prefix');
-
+ if ((! $user->isValid()) || (! $settings->isValid())) {
++
++
++
return redirect()->back()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
} else {
$user->save();
Auth::login($user, true);
$settings->save();
- if (Input::get('email_creds')=='1') {
- $data = array();
- $data['email'] = $user->email;
- $data['username'] = $user->username;
+ if ('1' == $request->input('email_creds')) {
+ $data = [];
+ $data['email'] = $user->email;
+ $data['username'] = $user->username;
$data['first_name'] = $user->first_name;
- $data['last_name'] = $user->last_name;
- $data['password'] = $request->input('password');
+ $data['last_name'] = $user->last_name;
+ $data['password'] = $request->input('password');
$user->notify(new FirstAdminNotification($data));
-
- /*Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use ($data) {
- $m->to($data['email'], $data['first_name']);
- $m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
- $m->subject(trans('mail.your_credentials'));
- });*/
}
+
-
return redirect()->route('setup.done');
}
-
-
}
/**
@@@ -260,25 -249,25 +251,26 @@@
Artisan::call('passport:install');
}
-
return view('setup/migrate')
- ->with('output', $output)
+ ->with('output', 'Databases installed!')
->with('step', 2)
->with('section', 'Create Database Tables');
-
}
+
/**
- * Return a view that shows some of the key settings.
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @since [v1.0]
- * @return View
- */
+ * Return a view that shows some of the key settings.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ *
+ * @since [v1.0]
+ *
+ * @return View
+ */
public function index()
{
- $settings = Setting::all();
+ $settings = Setting::getSettings();
+
return view('settings/index', compact('settings'));
}
@@@ -332,18 -325,17 +328,18 @@@
$setting->modellist_displays = implode(',', $request->input('show_in_model_list'));
}
+
$setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0');
- $setting->load_remote = $request->input('load_remote', '0');
- $setting->unique_serial = $request->input('unique_serial', '0');
- $setting->show_images_in_email = $request->input('show_images_in_email', '0');
- $setting->show_archived_in_list = $request->input('show_archived_in_list', '0');
- $setting->dashboard_message = $request->input('dashboard_message');
- $setting->email_domain = $request->input('email_domain');
- $setting->email_format = $request->input('email_format');
- $setting->username_format = $request->input('username_format');
- $setting->require_accept_signature = $request->input('require_accept_signature');
- if (!config('app.lock_passwords')) {
+ $setting->unique_serial = $request->input('unique_serial', '0');
+ $setting->show_images_in_email = $request->input('show_images_in_email', '0');
+ $setting->show_archived_in_list = $request->input('show_archived_in_list', '0');
+ $setting->dashboard_message = $request->input('dashboard_message');
+ $setting->email_domain = $request->input('email_domain');
+ $setting->email_format = $request->input('email_format');
+ $setting->username_format = $request->input('username_format');
+ $setting->require_accept_signature = $request->input('require_accept_signature');
+ $setting->show_assigned_assets = $request->input('show_assigned_assets', '0');
+ if (! config('app.lock_passwords')) {
$setting->login_note = $request->input('login_note');
}
@@@ -395,57 -391,145 +397,165 @@@
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
- $setting->brand = $request->input('brand', '1');
- $setting->header_color = $request->input('header_color');
- $setting->support_footer = $request->input('support_footer');
- $setting->version_footer = $request->input('version_footer');
- $setting->footer_text = $request->input('footer_text');
- $setting->skin = $request->input('skin');
+ $setting->brand = $request->input('brand', '1');
+ $setting->header_color = $request->input('header_color');
+ $setting->support_footer = $request->input('support_footer');
+ $setting->version_footer = $request->input('version_footer');
+ $setting->footer_text = $request->input('footer_text');
+ $setting->skin = $request->input('skin');
$setting->show_url_in_emails = $request->input('show_url_in_emails', '0');
- $setting->logo_print_assets = $request->input('logo_print_assets', '0');
+ $setting->logo_print_assets = $request->input('logo_print_assets', '0');
+
+
// Only allow the site name and CSS to be changed if lock_passwords is false
// Because public demos make people act like dicks
- if (!config('app.lock_passwords')) {
- $setting->site_name = $request->input('site_name');
+ if (! config('app.lock_passwords')) {
+ $setting->site_name = $request->input('site_name');
$setting->custom_css = $request->input('custom_css');
}
+ $filedate = date('U');
+
// If the user wants to clear the logo, reset the brand type
- if ($request->input('clear_logo')=='1') {
- $setting->logo = null;
+ if ('1' == $request->input('clear_logo')) {
+ Storage::disk('public')->delete($setting->logo);
+ $setting->logo = null;
$setting->brand = 1;
+ }
// If they are uploading an image, validate it and upload it
- } elseif ($request->hasFile('image')) {
+ if ($request->hasFile('logo')) {
+ $image = $request->file('logo');
+ $ext = $image->getClientOriginalExtension();
+ $setting->logo = $file_name = $filedate.'-logo.' . $ext;
+
+ if ('svg' != $image->getClientOriginalExtension()) {
+ $upload = Image::make($image->getRealPath())->resize(null, 150, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+ }
+
+ // This requires a string instead of an object, so we use ($string)
+ Storage::disk('public')->put($file_name, (string) $upload->encode());
+
+ // Remove Current image if exists
+ if (($setting->logo) && (file_exists($file_name))) {
+ Storage::disk('public')->delete($file_name);
+ }
+ }
+
+
+
+ // If the user wants to clear the email logo...
+ if ('1' == $request->input('clear_email_logo')) {
+ Storage::disk('public')->delete($setting->email_logo);
+ $setting->email_logo = null;
+ }
+
+ // If they are uploading an image, validate it and upload it
+ if ($request->hasFile('email_logo')) {
+ $email_image = $email_upload = $request->file('email_logo');
+ $email_ext = $email_image->getClientOriginalExtension();
+ $setting->email_logo = $email_file_name = $filedate.'-email_logo.' . $email_ext;
+
+ if ('svg' != $email_image->getClientOriginalExtension()) {
+ $email_upload = Image::make($email_image->getRealPath())->resize(null, 100, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+ }
+
+ // This requires a string instead of an object, so we use ($string)
+ Storage::disk('public')->put($email_file_name, (string) $email_upload->encode());
+
+ // Remove Current image if exists
+ if (($setting->email_logo) && (file_exists($email_file_name))) {
+ Storage::disk('public')->delete($email_file_name);
+ }
+ }
+
+ // If the user wants to clear the label logo...
+ if ('1' == $request->input('clear_label_logo')) {
+ Storage::disk('public')->delete($setting->label_logo);
+ $setting->label_logo = null;
+ }
+
+ // If they are uploading an image, validate it and upload it
+ if ($request->hasFile('label_logo')) {
+ $image = $request->file('label_logo');
+ $ext = $image->getClientOriginalExtension();
+ $setting->label_logo = $label_file_name = $filedate.'-label_logo.' . $ext;
+
+ if ('svg' != $image->getClientOriginalExtension()) {
+ $upload = Image::make($image->getRealPath())->resize(null, 100, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+ }
+
+ // This requires a string instead of an object, so we use ($string)
+ Storage::disk('public')->put($label_file_name, (string) $upload->encode());
+
+ // Remove Current image if exists
+ if (($setting->label_logo) && (file_exists($label_file_name))) {
+ Storage::disk('public')->delete($label_file_name);
+ }
+ }
+
+ // If the user wants to clear the favicon...
+ if ('1' == $request->input('clear_favicon')) {
+ Storage::disk('public')->delete($setting->clear_favicon);
+ $setting->favicon = null;
+ }
+
+ // If they are uploading an image, validate it and upload it
+ if ($request->hasFile('favicon')) {
+ $favicon_image = $favicon_upload = $request->file('favicon');
+ $favicon_ext = $favicon_image->getClientOriginalExtension();
+ $setting->favicon = $favicon_file_name = $filedate.'-favicon.' . $favicon_ext;
+
+ if (('ico' != $favicon_image->getClientOriginalExtension()) && ('svg' != $favicon_image->getClientOriginalExtension())) {
+ $favicon_upload = Image::make($favicon_image->getRealPath())->resize(null, 36, function ($constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+
+ // This requires a string instead of an object, so we use ($string)
+ Storage::disk('public')->put($favicon_file_name, (string) $favicon_upload->encode());
+ } else {
+ Storage::disk('public')->put($favicon_file_name, file_get_contents($request->file('favicon')));
+ }
+
+
+
+
+
+
+
- // Remove Current image if exists
- if (($setting->favicon) && (file_exists($favicon_file_name))) {
- Storage::disk('public')->delete($favicon_file_name);
++
++
++
++
++
++
+
- if (!config('app.lock_passwords')) {
- $image = $request->file('image');
- $file_name = "logo.".$image->getClientOriginalExtension();
- $path = public_path('uploads');
- if ($image->getClientOriginalExtension()!='svg') {
+
- Image::make($image->getRealPath())->resize(null, 150, function ($constraint) {
- $constraint->aspectRatio();
- $constraint->upsize();
- })->save($path.'/'.$file_name);
- } else {
+
+ // This is kinda copypasta from the ImageUploadRequest - should refactor the ImageUploadRequest to better handle maybe
+ $sanitizer = new Sanitizer();
+ $dirtySVG = file_get_contents($image->getRealPath());
+ $cleanSVG = $sanitizer->sanitize($dirtySVG);
+
- try {
- file_put_contents($path.'/'.$file_name, $cleanSVG);
- } catch (\Exception $e) {
- \Log::debug($e);
- }
- }
- $setting->logo = $file_name;
++
++
++
++
++
++
++
}
}
@@@ -482,15 -569,12 +596,15 @@@
*/
public function postSecurity(Request $request)
{
-
- if (is_null($setting = Setting::first())) {
+ if (is_null($setting = Setting::getSettings())) {
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
+ if (! config('app.lock_passwords')) {
+
+
+
- if (!config('app.lock_passwords')) {
+
- if ($request->input('two_factor_enabled')=='') {
+ if ('' == $request->input('two_factor_enabled')) {
$setting->two_factor_enabled = null;
} else {
$setting->two_factor_enabled = $request->input('two_factor_enabled');
@@@ -517,11 -600,10 +630,11 @@@
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
}
- return redirect()->back()->withInput()->withErrors($setting->getErrors());
+ return redirect()->back()->withInput()->withErrors($setting->getErrors());
}
+
/**
* Return a form to allow a super admin to update settings.
*
@@@ -561,11 -646,10 +678,11 @@@
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
}
- return redirect()->back()->withInput()->withErrors($setting->getErrors());
+ return redirect()->back()->withInput()->withErrors($setting->getErrors());
}
+
/**
* Return a form to allow a super admin to update settings.
*
@@@ -645,29 -734,18 +768,28 @@@
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
- $setting->slack_endpoint = $request->input('slack_endpoint');
- $setting->slack_channel = $request->input('slack_channel');
- $setting->slack_botname = $request->input('slack_botname');
+ $validatedData = $request->validate([
- 'slack_endpoint' => 'url|required_with:slack_channel|nullable',
+
- if ($setting->save()) {
+ 'slack_channel' => 'regex:/(?<!\w)#\w+/|required_with:slack_endpoint|nullable',
- 'slack_botname' => 'string|nullable',
++
+ ]);
+
+ if ($validatedData) {
+
+ $setting->slack_endpoint = $request->input('slack_endpoint');
+ $setting->slack_channel = $request->input('slack_channel');
+ $setting->slack_botname = $request->input('slack_botname');
+
+ $setting->save();
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
+
}
return redirect()->back()->withInput()->withErrors($setting->getErrors());
-
}
+
/**
* Return a form to allow a super admin to update settings.
*
@@@ -705,11 -786,10 +830,11 @@@
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
}
- return redirect()->back()->withInput()->withErrors($setting->getErrors());
+ return redirect()->back()->withInput()->withErrors($setting->getErrors());
}
+
/**
* Return a form to allow a super admin to update settings.
*
@@@ -719,18 -801,19 +846,20 @@@
*/
public function getBarcodes()
{
- $setting = Setting::first();
+ $setting = Setting::getSettings();
$is_gd_installed = extension_loaded('gd');
- return view('settings.barcodes', compact('setting'))->with('is_gd_installed',$is_gd_installed);
+ return view('settings.barcodes', compact('setting'))->with('is_gd_installed', $is_gd_installed);
}
+
/**
- * Saves settings from form
+ * Saves settings from form.
*
* @author [A. Gianotto] [<[email protected]>]
+ *
* @since [v1.0]
+ *
* @return View
*/
public function postBarcodes(Request $request)
@@@ -751,11 -832,10 +878,11 @@@
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
}
- return redirect()->back()->withInput()->withErrors($setting->getErrors());
+ return redirect()->back()->withInput()->withErrors($setting->getErrors());
}
+
/**
* Return a form to allow a super admin to update settings.
*
@@@ -907,51 -995,40 +1042,45 @@@
$setting->custom_forgot_pass_url = $request->input('custom_forgot_pass_url');
if ($setting->save()) {
- return redirect()->route('settings.index')
+ return redirect()->route('settings.ldap.index')
->with('success', trans('admin/settings/message.update.success'));
}
- return redirect()->back()->withInput()->withErrors($setting->getErrors());
+ return redirect()->back()->withInput()->withErrors($setting->getErrors());
}
+
+
+
+
+
/**
- * Show the listing of backups
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @since [v1.8]
- * @return View
- */
+ * Show the listing of backups.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ *
+ * @since [v1.8]
+ *
+ * @return View
+ */
public function getBackups()
{
-
- $path = storage_path().'/app/'.config('backup.backup.name');
-
- $files = array();
-
- if ($handle = opendir($path)) {
-
- /* This is the correct way to loop over the directory. */
- while (false !== ($entry = readdir($handle))) {
- clearstatcache();
- if (substr(strrchr($entry, '.'), 1)=='zip') {
- $files[] = array(
- 'filename' => $entry,
- 'filesize' => Setting::fileSizeConvert(filesize($path.'/'.$entry)),
- 'modified' => filemtime($path.'/'.$entry)
- );
- }
-
+ $path = storage_path() . '/app/' . config('backup.backup.name');
+
+ $path = 'backups';
+ $backup_files = Storage::files($path);
+ $files = [];
+
+ if (count($backup_files) > 0) {
+ for ($f = 0; $f < count($backup_files); ++$f) {
+ $files[] = [
+ 'filename' => basename($backup_files[$f]),
+ 'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])),
+ 'modified' => Storage::lastModified($backup_files[$f]),
+ ];
}
- closedir($handle);
- rsort($files);
}
-
return view('settings/backups', compact('path', 'files'));
}
@@@ -977,40 -1053,34 +1105,37 @@@
->with('success', trans('admin/settings/message.backup.generated'));
}
+
$formatted_output = str_replace('Backup completed!', '', $output);
- $output_split = explode('...', $formatted_output);
+ $output_split = explode('...', $formatted_output);
if (array_key_exists(2, $output_split)) {
- return redirect()->route("settings.backups.index")->with('error', $output_split[2]);
+ return redirect()->route('settings.backups.index')->with('error', $output_split[2]);
}
- return redirect()->route("settings.backups.index")->with('error', $formatted_output);
-
- }
- return redirect()->route("settings.backups.index")->with('error', trans('general.feature_disabled'));
+ return redirect()->route('settings.backups.index')->with('error', $formatted_output);
+ }
+
+
+ return redirect()->route('settings.backups.index')->with('error', trans('general.feature_disabled'));
}
-
/**
- * Download the backup file
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @since [v1.8]
- * @return Redirect
- */
+ * Download the backup file.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ *
+ * @since [v1.8]
+ *
+ * @return Redirect
+ */
public function downloadFile($filename = null)
{
- if (!config('app.lock_passwords')) {
- $path = storage_path().'/app/'.config('backup.backup.name');
- $file = $path.'/'.$filename;
- if (file_exists($file)) {
- return Response::download($file);
+ if (! config('app.lock_passwords')) {
+ if (Storage::exists($filename)) {
+ return Response::download(Storage::url('') . e($filename));
} else {
-
// Redirect to the backup page
return redirect()->route('settings.backups.index')->with('error', trans('admin/settings/message.backup.file_not_found'));
}
@@@ -1045,10 -1118,8 +1173,9 @@@
} else {
return redirect()->route('settings.backups.index')->with('error', trans('general.feature_disabled'));
}
-
}
+
/**
* Return a form to allow a super admin to update settings.
*
diff --cc app/Http/Requests/ImageUploadRequest.php
index 98b9997e04,598deb2d28..7d16e8c67d
--- a/app/Http/Requests/ImageUploadRequest.php
+++ b/app/Http/Requests/ImageUploadRequest.php
@@@ -51,67 -52,56 +52,83 @@@ class ImageUploadRequest extends Reques
$path = str_plural($type);
}
+ \Log::debug('Image path is: '.$path);
+ \Log::debug('Image fieldname is: '.$fieldname);
+
+
+ \Log::debug('Trying to upload to '. $path);
- if ($this->hasFile('image')) {
+ if ($this->hasFile($fieldname)) {
if (!config('app.lock_passwords')) {
+ if (!Storage::disk('public')->exists($path)) Storage::disk('public')->makeDirectory($path, 775);
+ if (!is_dir($path)) {
+ \Log::debug($path.' does not exist');
+ mkdir($path);
+ }
+
- $image = $this->file('image');
+ $image = $this->file($fieldname);
$ext = $image->getClientOriginalExtension();
$file_name = $type.'-'.str_random(18).'.'.$ext;
+
- if ($image->getClientOriginalExtension()!='svg') {
+ \Log::debug('File name will be: '.$file_name);
+ if ($image->getClientOriginalExtension()!=='svg') {
+ \Log::debug('Not an SVG - resize');
+ \Log::debug('Trying to upload to: '.$path.'/'.$file_name);
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
- })->save($path.'/'.$file_name);
- });
++ })
+
+ // This requires a string instead of an object, so we use ($string)
+ Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
+
+ // If the file is an SVG, we need to clean it and NOT encode it
} else {
+ \Log::debug('This is an SVG');
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($image->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
+
+ try {
+ \Log::debug('Trying to upload to: '.$path.'/'.$file_name);
- file_put_contents($path.'/'.$file_name, $cleanSVG);
+ Storage::disk('public')->put($path.'/'.$file_name, $cleanSVG);
+ } catch (\Exception $e) {
+ \Log::debug($e);
+ }
}
- // Remove current image if it exists and we're uploading a new one
+
- // Remove Current image if exists
- if (($item->image) && (file_exists($path.'/'.$item->image))) {
++ // Remove Current image if exists
+ if (($item->{$fieldname}) && (Storage::disk('public')->exists($path.'/'.$item->{$fieldname}))) {
- Storage::disk('public')->delete($path.'/'.$item->{$fieldname});
- } else {
- \Log::debug('Could not delete old file. '.$path.'/'.$item->{$fieldname}.' does not exist?');
+ try {
- unlink($path.'/'.$item->image);
- } catch (\Exception $e) {
- \Log::debug($e);
++ Storage::disk('public')->delete($path.'/'.$item->{$fieldname}); } catch (\Exception $e) {
++ \Log::debug('Could not delete old file. '.$path.'/'.$item->{$fieldname}.' does not exist?');
++
+ }
}
- $item->image = $file_name;
+ // Assign the new filename as the fieldname
+ $item->{$fieldname} = $file_name;
}
+ // If the user isn't uploading anything new but wants to delete their old image, do so
} elseif ($this->input('image_delete')=='1') {
+ Storage::disk('public')->delete($path.'/'.$item->{$fieldname});
+ $item->{$fieldname} = null;
+ }
+ try {
+ unlink($path.'/'.$item->image);
+ } catch (\Exception $e) {
+ \Log::debug($e);
+ }
+
+ $item->image = null;
+ }
return $item;
}
- }
+ }
diff --cc app/Models/Asset.php
index b6ee3f2518,82b32caf3c..be1f1a6fc0
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@@ -603,36 -788,52 +789,58 @@@ class Asset extends Depreciabl
return $this->model->category->checkin_email;
}
+ /**
+ * Determine whether this asset requires acceptance by the assigned user
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v4.0]
+ * @return boolean
+ */
public function requireAcceptance()
{
- return $this->model->category->require_acceptance;
+ if (($this->model) && ($this->model->category)) {
+ return $this->model->category->require_acceptance;
+ }
+
}
+ /**
+ * Checks for a category-specific EULA, and if that doesn't exist,
+ * checks for a settings level EULA
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v4.0]
+ * @return string | false
+ */
public function getEula()
{
$Parsedown = new \Parsedown();
-
- if ($this->model->category->eula_text) {
- return $Parsedown->text(e($this->model->category->eula_text));
- } elseif ($this->model->category->use_default_eula == '1') {
- return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
- } else {
- return false;
+
+ if (($this->model) && ($this->model->category)) {
+ if ($this->model->category->eula_text) {
+ return $Parsedown->text(e($this->model->category->eula_text));
+ } elseif ($this->model->category->use_default_eula == '1') {
+ return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
+ } else {
+ return false;
+ }
}
+ return false;
}
+
+ /**
+ * -----------------------------------------------
+ * BEGIN QUERY SCOPES
+ * -----------------------------------------------
+ **/
+
/**
* Run additional, advanced searches.
- *
- * @param Illuminate\Database\Eloquent\Builder $query
+ *
+ * @param \Illuminate\Database\Eloquent\Builder $query
* @param array $terms The search terms
- * @return Illuminate\Database\Eloquent\Builder
+ * @return \Illuminate\Database\Eloquent\Builder
*/
public function advancedTextSearch(Builder $query, array $terms) {
diff --cc app/Models/Setting.php
index 4212b16185,982377c954..f142bcca2b
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@@ -3,79 -4,142 +4,143 @@@ namespace App\Models
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
+ use Illuminate\Support\Collection;
+ use Illuminate\Support\Facades\App;
+ use Illuminate\Support\Facades\Cache;
+ use Parsedown;
use Watson\Validating\ValidatingTrait;
- use Schema;
+ /**
+ * Settings model.
+ */
class Setting extends Model
{
- use Notifiable;
+ use Notifiable, ValidatingTrait;
+
+ /**
+ * The app settings cache key name.
+ *
+ * @var string
+ */
+ const APP_SETTINGS_KEY = 'snipeit_app_settings';
+
+ /**
+ * The setup check cache key name.
+ *
+ * @var string
+ */
+ const SETUP_CHECK_KEY = 'snipeit_setup_check';
+
+ /**
+ * Whether the model should inject it's identifier to the unique
+ * validation rules before attempting validation. If this property
+ * is not set in the model it will default to true.
+ *
+ * @var bool
+ */
protected $injectUniqueIdentifier = true;
- use ValidatingTrait;
+ /**
+ * Model rules.
+ *
+ * @var array
+ */
protected $rules = [
- 'brand' => 'required|min:1|numeric',
- 'qr_text' => 'max:31|nullable',
- 'logo_img' => 'mimes:jpeg,bmp,png,gif',
- 'alert_email' => 'email_array|nullable',
- 'admin_cc_email' => 'email|nullable',
- 'default_currency' => 'required',
- 'locale' => 'required',
- 'labels_per_page' => 'numeric|min:1',
- 'labels_width' => 'numeric',
- 'labels_height' => 'numeric',
- 'labels_pmargin_left' => 'numeric|nullable',
- 'labels_pmargin_right' => 'numeric|nullable',
- 'labels_pmargin_top' => 'numeric|nullable',
- 'labels_pmargin_bottom' => 'numeric|nullable',
- 'labels_display_bgutter' => 'numeric|nullable',
- 'labels_display_sgutter' => 'numeric|nullable',
- 'labels_fontsize' => 'numeric|min:5',
- 'labels_pagewidth' => 'numeric|nullable',
- 'labels_pageheight' => 'numeric|nullable',
- 'login_remote_user_enabled' => 'numeric|nullable',
- 'login_common_disabled' => 'numeric|nullable',
+ 'brand' => 'required|min:1|numeric',
+ 'qr_text' => 'max:31|nullable',
+ 'logo_img' => 'mimes:jpeg,bmp,png,gif',
+ 'alert_email' => 'email_array|nullable',
+ 'admin_cc_email' => 'email|nullable',
+ 'default_currency' => 'required',
+ 'locale' => 'required',
+ 'slack_endpoint' => 'url|required_with:slack_channel|nullable',
++ 'labels_per_page' => 'numeric',
+ 'slack_channel' => 'regex:/^[\#\@]?\w+/|required_with:slack_endpoint|nullable',
+ 'slack_botname' => 'string|nullable',
+ 'labels_per_page' => 'numeric',
+ 'labels_width' => 'numeric',
+ 'labels_height' => 'numeric',
+ 'labels_pmargin_left' => 'numeric|nullable',
+ 'labels_pmargin_right' => 'numeric|nullable',
+ 'labels_pmargin_top' => 'numeric|nullable',
+ 'labels_pmargin_bottom' => 'numeric|nullable',
+ 'labels_display_bgutter' => 'numeric|nullable',
+ 'labels_display_sgutter' => 'numeric|nullable',
+ 'labels_fontsize' => 'numeric|min:5',
+ 'labels_pagewidth' => 'numeric|nullable',
+ 'labels_pageheight' => 'numeric|nullable',
+ 'login_remote_user_enabled' => 'numeric|nullable',
+ 'login_common_disabled' => 'numeric|nullable',
'login_remote_user_custom_logout_url' => 'string|nullable',
- 'thumbnail_max_h' => 'numeric|max:500|min:25',
- 'pwd_secure_min' => 'numeric|required|min:5',
- 'audit_warning_days' => 'numeric|nullable',
- 'audit_interval' => 'numeric|nullable',
- 'custom_forgot_pass_url' => 'url|nullable',
- 'privacy_policy_link' => 'nullable|url'
+ 'login_remote_user_header_name' => 'string|nullable',
+ 'thumbnail_max_h' => 'numeric|max:500|min:25',
+ 'pwd_secure_min' => 'numeric|required|min:5',
+ 'audit_warning_days' => 'numeric|nullable',
+ 'audit_interval' => 'numeric|nullable',
+ 'custom_forgot_pass_url' => 'url|nullable',
+ 'privacy_policy_link' => 'nullable|url',
];
- protected $fillable = ['site_name','email_domain','email_format','username_format'];
+ protected $fillable = [
+ 'site_name',
+ 'email_domain',
+ 'email_format',
+ 'username_format',
+ ];
- public static function getSettings()
+ /**
+ * Get the app settings.
+ * Cache is expired on Setting model saved in EventServiceProvider.
+ *
+ * @author Wes Hulette <[email protected]>
+ *
+ * @since 5.0.0
+ *
+ * @return \App\Models\Setting|null
+ */
+ public static function getSettings(): ?Setting
{
- static $static_cache = null;
-
- if (!$static_cache) {
- if (Schema::hasTable('settings')) {
- $static_cache = Setting::first();
+ return Cache::rememberForever(self::APP_SETTINGS_KEY, function () {
+ // Need for setup as no tables exist
+ try {
+ return self::first();
+ } catch (\Throwable $th) {
+ return null;
}
+ });
- }
+ }
- return $static_cache;
-
- }
-
- public static function setupCompleted()
+ /**
+ * Check to see if setup process is complete.
+ * Cache is expired on Setting model saved in EventServiceProvider.
+ *
+ * @return bool
+ */
+ public static function setupCompleted(): bool
{
-
- $users_table_exists = Schema::hasTable('users');
- $settings_table_exists = Schema::hasTable('settings');
-
- if ($users_table_exists && $settings_table_exists) {
- $usercount = User::withTrashed()->count();
- $settingsCount = Setting::count();
- return ($usercount > 0 && $settingsCount > 0);
+ return Cache::rememberForever(self::SETUP_CHECK_KEY, function () {
+ try {
+ $usercount = User::withTrashed()->count();
+ $settingsCount = self::count();
+
+ return $usercount > 0 && $settingsCount > 0;
+ } catch (\Throwable $th) {
+ // Catche the error if the tables dont exit
- }
+ }
+ return false;
+ });
}
- public function lar_ver()
+ /**
+ * Get the current Laravel version.
+ *
+ * @return string
+ */
+ public function lar_ver(): string
{
- $app = \App::getFacadeApplication();
+ $app = App::getFacadeApplication();
+
return $app::VERSION;
}
@@@ -108,10 -188,10 +189,10 @@@
/**
* Escapes the custom CSS, and then un-escapes the greater-than symbol
* so it can work with direct descendant characters for bootstrap
- * menu overrides like:
+ * menu overrides like:.
- *
+ *
* .skin-blue .sidebar-menu>li.active>a, .skin-blue .sidebar-menu>li:hover>a
- *
+ *
* Important: Do not remove the e() escaping here, as we output raw in the blade.
*
* @return string escaped CSS
@@@ -128,46 -212,49 +213,49 @@@
}
/**
- * Converts bytes into human readable file size.
- *
- * @param string $bytes
+ * Converts bytes into human readable file size.
+ *
+ * @param string $bytes
+ *
- * @return string human readable file size (2,87 Мб)
+ * @return string human readable file size (2,87 Мб)
+ *
- * @author Mogilev Arseny
- */
+ * @author Mogilev Arseny
+ */
- public static function fileSizeConvert($bytes)
+ public static function fileSizeConvert($bytes): string
{
$bytes = floatval($bytes);
- $arBytes = array(
- 0 => array(
- "UNIT" => "TB",
- "VALUE" => pow(1024, 4)
- ),
- 1 => array(
- "UNIT" => "GB",
- "VALUE" => pow(1024, 3)
- ),
- 2 => array(
- "UNIT" => "MB",
- "VALUE" => pow(1024, 2)
- ),
- 3 => array(
- "UNIT" => "KB",
- "VALUE" => 1024
- ),
- 4 => array(
- "UNIT" => "B",
- "VALUE" => 1
- ),
- );
+ $arBytes = [
+ 0 => [
+ 'UNIT' => 'TB',
+ 'VALUE' => pow(1024, 4),
+ ],
+ 1 => [
+ 'UNIT' => 'GB',
+ 'VALUE' => pow(1024, 3),
+ ],
+ 2 => [
+ 'UNIT' => 'MB',
+ 'VALUE' => pow(1024, 2),
+ ],
+ 3 => [
+ 'UNIT' => 'KB',
+ 'VALUE' => 1024,
+ ],
+ 4 => [
+ 'UNIT' => 'B',
+ 'VALUE' => 1,
+ ],
+ ];
- foreach ($arBytes as $arItem) {
+ foreach ($arBytes as $arItem) {
- if ($bytes >= $arItem["VALUE"]) {
- $result = $bytes / $arItem["VALUE"];
- $result = round($result, 2) .$arItem["UNIT"];
+ if ($bytes >= $arItem['VALUE']) {
+ $result = $bytes / $arItem['VALUE'];
+ $result = round($result, 2).$arItem['UNIT'];
- break;
+ break;
+ }
}
- }
+
- return $result;
+ return $result;
}
/**
diff --cc composer.json
index a531b7d115,9115a28c6a..83f6e65289
--- a/composer.json
+++ b/composer.json
@@@ -33,59 -54,63 +54,65 @@@
"pragmarx/google2fa": "^5.0",
"pragmarx/google2fa-laravel": "^1.0",
"predis/predis": "^1.1",
- "rollbar/rollbar-laravel": "2.*",
- "schuppo/password-strength": "~1.5",
- "spatie/laravel-backup": "^5.12",
+ "rollbar/rollbar-laravel": "^5.0",
+ "spatie/laravel-backup": "^6.7",
"tecnickcom/tc-lib-barcode": "^1.15",
- "tightenco/ziggy": "^0.7.1",
+ "tightenco/ziggy": "^0.8.1",
"unicodeveloper/laravel-password": "^1.0",
- "watson/validating": "^3.0"
+ "watson/validating": "^3.3"
},
- "require-dev": {
- "codeception/codeception": "2.3.6",
+ "require-dev": {
+ "codeception/codeception": "^3.1",
- "fzaninotto/faker": "^1.9",
++ "fzaninotto/faker": "1.9.1",
++ "phpunit/php-token-stream": "1.4.11",
+ "phpunit/phpunit": "^7.5",
+ "squizlabs/php_codesniffer": "^3.5",
++ "symfony/css-selector": "3.1.*",
+ "symfony/dom-crawler": "^4.3"
+ },
+ "suggest": {
+ "ext-mcrypt": "For upgrading from before v5.1 this is used to re-encrypt data"
+ },
+ "extra": {
+ "laravel": {
+ "dont-discover": [
+ "rollbar/rollbar-laravel"
+ ]
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "database"
+ ],
+ "psr-4": {
+ "App\\": "app/"
+ }
+ },
+ "autoload-dev": {
+ "classmap": [
+ "tests/TestCase.php",
+ "tests/unit/BaseTest.php"
+ ]
+ },
+ "scripts": {
+ "post-autoload-dump": [
+ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
- "@php artisan package:discover"
- ],
- "post-root-package-install": [
- "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ "filp/whoops": "~2.0",
+ "fzaninotto/faker": "1.9.1",
+ "phpunit/php-token-stream": "1.4.11",
+ "phpunit/phpunit": "~6.0",
- "roave/security-advisories": "dev-master",
- "squizlabs/php_codesniffer": "*",
- "symfony/css-selector": "3.1.*",
- "symfony/dom-crawler": "3.1.*"
+ ],
+ "post-create-project-cmd": [
+ "php artisan key:generate"
+ ]
},
- "autoload": {
- "classmap": [
- "database"
- ],
- "psr-4": {
- "App\\": "app/"
- }
- },
- "autoload-dev": {
- "classmap": [
- "tests/TestCase.php",
- "tests/unit/BaseTest.php"
- ]
- },
- "scripts": {
- "post-root-package-install": [
- "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
- ],
- "post-create-project-cmd": [
- "php artisan key:generate"
- ],
- "post-autoload-dump": [
- "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
- "@php artisan package:discover"
- ]
- },
- "config": {
- "preferred-install": "dist",
- "sort-packages": true,
- "optimize-autoloader": true,
- "process-timeout":3000,
- "platform": {
- "php": "7.1.2"
- }
+ "config": {
+ "preferred-install": "dist",
+ "sort-packages": true,
+ "optimize-autoloader": true,
+ "process-timeout": 3000,
+ "platform": {
+ "php": "7.2"
}
-
+ }
}
diff --cc config/database.php
index 603c0c14d9,97cf261f60..f32810326a
--- a/config/database.php
+++ b/config/database.php
@@@ -87,14 -87,15 +87,17 @@@ return
//'exclude_tables' => ['table1', 'table2'],
//'add_extra_option' => '--optionname=optionvalue',
],
+
+ 'dump_command_timeout' => 60 * 5, // 5 minute timeout
+ 'dump_using_single_transaction' => true, // perform dump using a single transaction
- 'options' => (env('DB_SSL')) ? [
- PDO::MYSQL_ATTR_SSL_KEY => env('DB_SSL_KEY_PATH'), // /path/to/key.pem
- PDO::MYSQL_ATTR_SSL_CERT => env('DB_SSL_CERT_PATH'), // /path/to/cert.pem
- PDO::MYSQL_ATTR_SSL_CA => env('DB_SSL_CA_PATH'), // /path/to/ca.pem
- PDO::MYSQL_ATTR_SSL_CIPHER => env('DB_SSL_CIPHER')
- ] : []
+ 'options' => (env('DB_SSL')) ? ((env('DB_SSL_IS_PAAS')) ? [
+ PDO::MYSQL_ATTR_SSL_CA => env('DB_SSL_CA_PATH'), // /path/to/ca.pem
+ ] : [
+ PDO::MYSQL_ATTR_SSL_KEY => env('DB_SSL_KEY_PATH'), // /path/to/key.pem
+ PDO::MYSQL_ATTR_SSL_CERT => env('DB_SSL_CERT_PATH'), // /path/to/cert.pem
+ PDO::MYSQL_ATTR_SSL_CA => env('DB_SSL_CA_PATH'), // /path/to/ca.pem
+ PDO::MYSQL_ATTR_SSL_CIPHER => env('DB_SSL_CIPHER')
+ ]) : []
],
'pgsql' => [
diff --cc config/version.php
index 9f818f7eb2,f8085e1891..3bea50621e
--- a/config/version.php
+++ b/config/version.php
@@@ -1,10 -1,10 +1,10 @@@
<?php
return array (
- 'app_version' => 'v4.9.2',
- 'full_app_version' => 'v4.9.2 - build 4352-gec723a3da',
- 'build_version' => '4352',
+ 'app_version' => 'v5.0.0-beta-3',
- 'full_app_version' => 'v5.0.0-beta-3 - build 4190-g88fb1370f',
++ 'full_app_version' => 'v5.0.0-beta-3 - build 4352-gec723a3da',
+ 'build_version' => '4190',
'prerelease_version' => '',
- 'hash_version' => 'g88fb1370f',
- 'full_hash' => 'v5.0.0-beta-3-g88fb1370f',
+ 'hash_version' => 'gec723a3da',
- 'full_hash' => 'v4.9.2-9-gec723a3da',
- 'branch' => 'master',
- );
++ 'full_hash' => 'v5.0.0-beta-3-gec723a3da',
+ 'branch' => 'develop',
+ );
diff --cc package.json
index f0e275e89a,6078ab38d4..82b0b8bc44
--- a/package.json
+++ b/package.json
@@@ -29,16 -34,18 +34,19 @@@
"ekko-lightbox": "^5.1.1",
"font-awesome": "^4.7.0",
"icheck": "^1.0.2",
+ "imagemin": "^5.3.1",
+ "jquery-form-validator": "^2.3.79",
"jquery-slimscroll": "^1.3.8",
"jquery-ui": "^1.12.1",
- "jquery-ui-bundle": "^1.12.1",
+ "jquery-ui-dist": "^1.12.1",
"jquery.iframe-transport": "^1.0.0",
- "less": "less/less.js#efa6eb5306f28a7ef7e235d79ce854b780345591",
+ "less": "github:less/less.js#efa6eb5306f28a7ef7e235d79ce854b780345591",
"less-loader": "^4.1.0",
- "list.js": "^1.5.0",
- "papaparse": "^4.6.3",
- "select2": "^4.0.12",
++ "list.js": "^4.6.3",
+ "papaparse": "^4.3.3",
+ "select2": "4.0.13",
- "tether": "^1.4.0",
+ "tableexport.jquery.plugin": "^1.10.12",
+ "tether": "^1.4.7",
"vue-resource": "^1.3.3"
}
}
diff --cc public/js/dist/bootstrap-table-simple-view.js
index da6b05689a,efa8072bc7..5143159015
mode 100755,100644..100644
--- a/public/js/dist/bootstrap-table-simple-view.js
+++ b/public/js/dist/bootstrap-table-simple-view.js
diff --cc resources/lang/en/passwords.php
index 0e9022fe61,0d55c17811..4d5befd6bc
--- a/resources/lang/en/passwords.php
+++ b/resources/lang/en/passwords.php
@@@ -1,11 -1,7 +1,11 @@@
<?php
return [
- 'sent' => 'Your password link has been sent!',
+ 'sent' => 'If a matching username and email address is found, a password reset link will be sent!',
- 'user' => 'No matching active user found.',
+ 'user' => 'No matching active user found with that email.',
+ 'user_inactive' => 'If that email address exists in our system, a password recovery email has been sent.',
+ 'token' => 'The password reset token you have provided is invalid',
+ 'password' => 'Passwords must be at least eight characters and match the confirmation.',
+ 'reset' => 'Your password has been reset'
];
diff --cc resources/lang/es-CO/general.php
index da5495ca5d,6a51c98731..368ee0abd6
--- a/resources/lang/es-CO/general.php
+++ b/resources/lang/es-CO/general.php
@@@ -206,8 -206,7 +206,8 @@@
'unknown_admin' => 'Admin Desconocido',
'username_format' => 'Formato del nombre de usuario',
'update' => 'Actualizar',
- 'upload_filetypes_help' => 'Tipos de archivos permitidos: png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.
+ 'upload_filetypes_help' => 'Algunos tipos de archivos permitidos son png, gif, jpg, jpeg, doc, docx, pdf, xls, txt, lic, zip, rtf y rar. TamaΓ±o mΓ‘ximo permitido: :size.',
+El tamaΓ±o mΓ‘ximo de archivo es :size.',
'uploaded' => 'Subido',
'user' => 'Usuario',
'accepted' => 'aceptado',
diff --cc resources/lang/es-ES/general.php
index da5495ca5d,6a51c98731..368ee0abd6
--- a/resources/lang/es-ES/general.php
+++ b/resources/lang/es-ES/general.php
@@@ -206,8 -206,7 +206,8 @@@
'unknown_admin' => 'Admin Desconocido',
'username_format' => 'Formato del nombre de usuario',
'update' => 'Actualizar',
- 'upload_filetypes_help' => 'Tipos de archivos permitidos: png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.
+ 'upload_filetypes_help' => 'Algunos tipos de archivos permitidos son png, gif, jpg, jpeg, doc, docx, pdf, xls, txt, lic, zip, rtf y rar. TamaΓ±o mΓ‘ximo permitido: :size.',
+El tamaΓ±o mΓ‘ximo de archivo es :size.',
'uploaded' => 'Subido',
'user' => 'Usuario',
'accepted' => 'aceptado',
diff --cc resources/lang/es-VE/general.php
index 14888644ed,b4a839a18e..9d2d96c401
--- a/resources/lang/es-VE/general.php
+++ b/resources/lang/es-VE/general.php
@@@ -206,8 -206,7 +206,8 @@@
'unknown_admin' => 'Administrador Desconocido',
'username_format' => 'Formato de Nombre de Usuario',
'update' => 'Actualizar',
- 'upload_filetypes_help' => 'Tipos de archivos permitidos: png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.
+ 'upload_filetypes_help' => 'Algunos tipos de archivos permitidos son png, gif, jpg, jpeg, doc, docx, pdf, xls, txt, lic, zip, rtf y rar. TamaΓ±o mΓ‘ximo permitido: :size.',
+El tamaΓ±o mΓ‘ximo de archivo es :size.',
'uploaded' => 'Actualizado',
'user' => 'Usuario',
'accepted' => 'aceptado',
diff --cc resources/less/skins/skin-black-dark.less
index 4ea75f8ad1,0000000000..4ea75f8ad1
mode 100644,000000..100644
--- a/resources/less/skins/skin-black-dark.less
+++ b/resources/less/skins/skin-black-dark.less
diff --cc resources/less/skins/skin-blue-dark.less
index bad30626ea,0000000000..bad30626ea
mode 100644,000000..100644
--- a/resources/less/skins/skin-blue-dark.less
+++ b/resources/less/skins/skin-blue-dark.less
diff --cc resources/less/skins/skin-contrast.less
index 11d3b20255,0000000000..11d3b20255
mode 100644,000000..100644
--- a/resources/less/skins/skin-contrast.less
+++ b/resources/less/skins/skin-contrast.less
diff --cc resources/less/skins/skin-green-dark.less
index d52e76f11d,0000000000..d52e76f11d
mode 100644,000000..100644
--- a/resources/less/skins/skin-green-dark.less
+++ b/resources/less/skins/skin-green-dark.less
diff --cc resources/less/skins/skin-orange-dark.less
index 553fd2927a,0000000000..553fd2927a
mode 100644,000000..100644
--- a/resources/less/skins/skin-orange-dark.less
+++ b/resources/less/skins/skin-orange-dark.less
diff --cc resources/less/skins/skin-orange.less
index 3f4ab432de,0000000000..3f4ab432de
mode 100644,000000..100644
--- a/resources/less/skins/skin-orange.less
+++ b/resources/less/skins/skin-orange.less
diff --cc resources/less/skins/skin-purple-dark.less
index 0ad929582c,0000000000..0ad929582c
mode 100644,000000..100644
--- a/resources/less/skins/skin-purple-dark.less
+++ b/resources/less/skins/skin-purple-dark.less
diff --cc resources/less/skins/skin-red-dark.less
index c46a01525d,0000000000..c46a01525d
mode 100644,000000..100644
--- a/resources/less/skins/skin-red-dark.less
+++ b/resources/less/skins/skin-red-dark.less
diff --cc resources/less/skins/skin-yellow-dark.less
index cb98b70e6d,0000000000..cb98b70e6d
mode 100644,000000..100644
--- a/resources/less/skins/skin-yellow-dark.less
+++ b/resources/less/skins/skin-yellow-dark.less
diff --cc resources/macros/macros.php
index 63e8e5860e,93887ff93c..559c66c09d
--- a/resources/macros/macros.php
+++ b/resources/macros/macros.php
@@@ -465,16 -465,16 +465,16 @@@ Form::macro('username_format', functio
$formats = array(
'firstname.lastname' => trans('general.firstname_lastname_format'),
- 'firstname' => trans('general.first_name_format'),
+ 'firstname_lastname' => trans('general.firstname_lastname_underscore_format'),
'filastname' => trans('general.filastname_format'),
+ 'firstintial.lastname' => trans('general.firstintial_dot_lastname_format'),
+ 'firstname' => trans('general.first_name_format'),
'lastnamefirstinitial' => trans('general.lastnamefirstinitial_format'),
- 'firstname_lastname' => trans('general.firstname_lastname_underscore_format'),
-
);
- $select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%">';
+ $select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
foreach ($formats as $format => $label) {
- $select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected"' : '').'>'.$label.'</option> '."\n";
+ $select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
}
$select .= '</select>';
diff --cc resources/views/accessories/checkin.blade.php
index 56c3f068fa,5964a9721e..d908fe571d
--- a/resources/views/accessories/checkin.blade.php
+++ b/resources/views/accessories/checkin.blade.php
@@@ -50,16 -48,32 +48,32 @@@
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
<label for="note" class="col-md-2 control-label">{{ trans('admin/hardware/form.notes') }}</label>
<div class="col-md-7">
- <textarea class="col-md-6 form-control" id="note" name="note">{{ Request::old('note', $accessory->note) }}</textarea>
- {!! $errors->first('note', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <textarea class="col-md-6 form-control" id="note" name="note">{{ Input::old('note', $accessory->note) }}</textarea>
+ {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
+ <!-- Checkout/Checkin Date -->
+ <div class="form-group{{ $errors->has('checkin_at') ? ' has-error' : '' }}">
+ {{ Form::label('checkin_at', trans('admin/hardware/form.checkin_date'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <div class="input-group col-md-5 required">
+ <div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-end-date="0d" data-autoclose="true">
+ <input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="checkin_at" id="checkin_at" value="{{ Request::old('checkin_at', date('Y-m-d')) }}">
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+ </div>
+ {!! $errors->first('checkin_at', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ </div>
+ </div>
+ </div>
+
</div>
<div class="box-footer">
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
- <button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i>
+ <button type="submit" class="btn btn-primary pull-right"><i class="fa fa-check icon-white" aria-hidden="true"></i>
{{ trans('general.checkin') }}</button>
</div>
+
+
</div> <!-- .box.box-default -->
</form>
</div> <!-- .col-md-9-->
diff --cc resources/views/accessories/edit.blade.php
index d56c5d43fb,70b628544f..d125f81449
--- a/resources/views/accessories/edit.blade.php
+++ b/resources/views/accessories/edit.blade.php
@@@ -29,8 -29,8 +29,8 @@@
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
- <img src="{{ url('/') }}/uploads/accessories/{{ $item->image }}" alt="{{ $item->name }}">
+ <img src="{{ Storage::disk('public')->url(app('accessories_upload_path').e($item->image)) }}" class="img-responsive" />
- {!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('image_delete', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@endif
diff --cc resources/views/auth/passwords/email.blade.php
index bf78290872,2aad4afa4b..a9f4fa8275
--- a/resources/views/auth/passwords/email.blade.php
+++ b/resources/views/auth/passwords/email.blade.php
@@@ -31,12 -31,11 +31,12 @@@
- <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
+ <div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<div class="col-md-12">
- <label for="email">Email</label>
+ <input type="text" class="form-control" name="username" value="{{ old('username') }}" placeholder="{{ trans('admin/users/table.username') }}">
+ <input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="{{ trans('admin/users/table.email') }}" aria-label="email">
- {!! $errors->first('email', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
+ {!! $errors->first('username', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
diff --cc resources/views/custom_fields/fields/edit.blade.php
index 136d36d32c,15294ff658..40fc1f69f4
--- a/resources/views/custom_fields/fields/edit.blade.php
+++ b/resources/views/custom_fields/fields/edit.blade.php
@@@ -70,22 -75,21 +75,21 @@@
{{ trans('admin/custom_fields/general.field_format') }}
</label>
<div class="col-md-6 required">
+ {{ Form::select("format",$predefinedFormats, $field->getFormatType(),
- array('class'=>'format select2 form-control')) }}
- {!! $errors->first('format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select("format",\App\Helpers\Helper::predefined_formats(), $field->format, array('class'=>'format select2 form-control', 'aria-label'=>'format')) }}
+ {!! $errors->first('format', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
-
<!-- Custom Format -->
<div class="form-group {{ $errors->has('custom_format') ? ' has-error' : '' }}" id="custom_regex" style="display:none;">
<label for="custom_format" class="col-md-4 control-label">
{{ trans('admin/custom_fields/general.field_custom_format') }}
</label>
<div class="col-md-6 required">
-
- {{ Form::text('custom_format', Request::old('custom_format', $customFormat), array('class' => 'form-control', 'id' => 'custom_format', 'placeholder'=>'regex:/^[0-9]{15}$/')) }}
+ {{ Form::text('custom_format', Input::old('custom_format', (($field->format!='') && (stripos($field->format,'regex')===0)) ? $field->format : ''), array('class' => 'form-control', 'id' => 'custom_format','aria-label'=>'custom_format', 'placeholder'=>'regex:/^[0-9]{15}$/')) }}
<p class="help-block">{!! trans('admin/custom_fields/general.field_custom_format_help') !!}</p>
- {!! $errors->first('custom_format', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {!! $errors->first('custom_format', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
@@@ -115,39 -119,39 +119,39 @@@
@if (!$field->id)
+ <!-- Encrypted -->
+ <div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
+ <div class="col-md-8 col-md-offset-4">
+ <label for="field_encrypted">
+ <input type="checkbox" value="1" name="field_encrypted" id="field_encrypted" class="minimal"{{ (Request::old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
+ {{ trans('admin/custom_fields/general.encrypt_field') }}
+ </label>
+ </div>
-
+ <div class="col-md-6 col-md-offset-4" id="encrypt_warning" style="display:none;">
- <div class="callout callout-danger">
- <p><i class="fa fa-warning"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
+
-
-
-
- <!-- Encrypted -->
- <div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
- <div class="col-md-8 col-md-offset-4">
- <label for="field_encrypted">
- <input type="checkbox" value="1" name="field_encrypted" id="field_encrypted" class="minimal"{{ (Input::old('field_encrypted') || $field->field_encrypted) ? ' checked="checked"' : '' }}>
- {{ trans('admin/custom_fields/general.encrypt_field') }}
- </label>
- </div>
-
- <div class="col-md-6 col-md-offset-4" id="encrypt_warning" style="display:none;">
+ <div class="callout callout-danger">
+ <p><i class="fa fa-warning" aria-hidden="true"></i> {{ trans('admin/custom_fields/general.encrypt_field_help') }}</p>
- </div>
</div>
</div>
- @endif
-
+ </div>
+ @endif
</div> <!-- /.box-body-->
+
<div class="box-footer text-right">
- <button type="submit" class="btn btn-success"> {{ trans('general.save') }}</button>
+ <button type="submit" class="btn btn-primary"> {{ trans('general.save') }}</button>
</div>
+
</div> <!--.box.box-default-->
+
{{ Form::close() }}
</div> <!--/.col-md-9-->
+
<div class="col-md-3">
- <h4>About Custom Fields</h4>
+ <h2>About Custom Fields</h2>
<p>Custom fields allow you to add arbitrary attributes to assets.</p>
</div>
+
</div>
@stop
diff --cc resources/views/dashboard.blade.php
index 810218559b,749e530068..4ad6bd32b7
--- a/resources/views/dashboard.blade.php
+++ b/resources/views/dashboard.blade.php
@@@ -30,70 -30,79 +30,79 @@@
<div class="row">
<!-- panel -->
<div class="col-lg-3 col-xs-6">
+ <a href="{{ route('hardware.index') }}">
- <!-- small box -->
- <div class="small-box bg-teal">
- <div class="inner">
- <h3>{{ number_format($counts['asset']) }}</h3>
- <p>{{ trans('general.total_assets') }}</p>
- </div>
- <div class="icon">
- <i class="fa fa-barcode"></i>
- </div>
- @can('index', \App\Models\Asset::class)
- <span class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right"></i></span>
- @endcan
- </div>
+ <!-- small box -->
+ <div class="small-box bg-teal">
+ <div class="inner">
+ <h3>{{ number_format($counts['asset']) }}</h3>
+ <p>{{ trans('general.total_assets') }}</p>
+ </div>
+ <div class="icon" aria-hidden="true">
+ <i class="fa fa-barcode" aria-hidden="true"></i>
+ </div>
+ @can('index', \App\Models\Asset::class)
+ <a href="{{ route('hardware.index') }}" class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
+ @endcan
+ </div>
+ </a>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
+ <a href="{{ route('licenses.index') }}">
- <!-- small box -->
- <div class="small-box bg-maroon">
- <div class="inner">
- <h3>{{ number_format($counts['license']) }}</h3>
- <p>{{ trans('general.total_licenses') }}</p>
- </div>
- <div class="icon">
- <i class="fa fa-floppy-o"></i>
- </div>
- @can('view', \App\Models\License::class)
- <span class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right"></i></span>
- @endcan
- </div>
+ <!-- small box -->
+ <div class="small-box bg-maroon">
+ <div class="inner">
+ <h3>{{ number_format($counts['license']) }}</h3>
+ <p>{{ trans('general.total_licenses') }}</p>
+ </div>
+ <div class="icon" aria-hidden="true">
+ <i class="fa fa-floppy-o"></i>
+ </div>
+ @can('view', \App\Models\License::class)
+ <a href="{{ route('licenses.index') }}" class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
+ @endcan
+ </div>
+ </a>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
+ <a href="{{ route('accessories.index') }}">
- <div class="small-box bg-orange">
- <div class="inner">
- <h3> {{ number_format($counts['accessory']) }}</h3>
- <p>{{ trans('general.total_accessories') }}</p>
- </div>
- <div class="icon">
- <i class="fa fa-keyboard-o"></i>
- </div>
- @can('index', \App\Models\Accessory::class)
- <span class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right"></i></span>
- @endcan
- </div>
+ <div class="small-box bg-orange">
+ <div class="inner">
+ <h3> {{ number_format($counts['accessory']) }}</h3>
+ <p>{{ trans('general.total_accessories') }}</p>
+ </div>
+ <div class="icon" aria-hidden="true">
+ <i class="fa fa-keyboard-o"></i>
+ </div>
+ @can('index', \App\Models\Accessory::class)
+ <a href="{{ route('accessories.index') }}" class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
+ @endcan
+ </div>
+ </a>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
+
+ <a href="{{ route('consumables.index') }}">
- <div class="small-box bg-purple">
- <div class="inner">
- <h3> {{ number_format($counts['consumable']) }}</h3>
- <p>{{ trans('general.total_consumables') }}</p>
- </div>
- <div class="icon">
- <i class="fa fa-tint"></i>
- </div>
- @can('index', \App\Models\Consumable::class)
- <span class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right"></i></span>
- @endcan
- </div>
- </a>
+ <div class="small-box bg-purple">
+ <div class="inner">
+ <h3> {{ number_format($counts['consumable']) }}</h3>
+ <p>{{ trans('general.total_consumables') }}</p>
+ </div>
+ <div class="icon" aria-hidden="true">
+ <i class="fa fa-tint"></i>
+ </div>
+ @can('index', \App\Models\Consumable::class)
+ <a href="{{ route('consumables.index') }}" class="small-box-footer">{{ trans('general.moreinfo') }} <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
+ @endcan
+ </div>
+ </div><!-- ./col -->
</div>
+ </div>
@if ($counts['grand_total'] == 0)
@@@ -300,92 -288,42 +311,45 @@@
@section('moar_scripts')
@include ('partials.bootstrap-table', ['simple_view' => true, 'nopages' => true])
+ @stop
- <script src="{{ asset('js/plugins/chartjs/Chart.min.js') }}"></script>
+ @push('js')
+
+
+
<script nonce="{{ csrf_token() }}">
-
-
-
-
- /* ChartJS
- * -------
- */
-
- // -----------------------
- // - LINE CHART -
- // -----------------------
-
-
-
- //var ctx = document.getElementById('salesChart').getContext("2d")
- //var myChart = new Chart(ctx, {
- // type: 'line'
- //});
-
-
- //$.ajax({
- // type: 'GET',
- // url: '{{ route('api.statuslabels.assets.bytype') }}',
- // headers: {
- // "X-Requested-With": 'XMLHttpRequest',
- // "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- // },
-
- // dataType: 'json',
- // success: function (data) {
- // var ctx = new Chart(ctx,{
- // type: 'line',
- // data: data,
- // options: lineOptions
- // });
- // },
- // error: function (data) {
- // window.location.reload(true);
- // }
- // });
-
-
-
-
-
- // ---------------------------
- // - END MONTHLY SALES CHART -
- // ---------------------------
-
-
- var pieChartCanvas = $("#statusPieChart").get(0).getContext("2d");
- var pieChart = new Chart(pieChartCanvas);
- var ctx = document.getElementById("statusPieChart");
-
-
-
- $.ajax({
- type: 'GET',
- url: '{{ route('api.statuslabels.assets.bytype') }}',
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
-
- dataType: 'json',
- success: function (data) {
- var myPieChart = new Chart(ctx,{
-
- type: 'doughnut',
- data: data,
- options: pieOptions
- });
- },
- error: function (data) {
- // window.location.reload(true);
- }
- });
-
-
+ // ---------------------------
+ // - ASSET STATUS CHART -
+ // ---------------------------
+ var pieChartCanvas = $("#statusPieChart").get(0).getContext("2d");
+ var pieChart = new Chart(pieChartCanvas);
+ var ctx = document.getElementById("statusPieChart");
+ var pieOptions = {
+ legend: {
+ position: 'top',
+ responsive: true,
+ maintainAspectRatio: true,
+ }
+ };
+
+ $.ajax({
+ type: 'GET',
+ url: '{{ route('api.statuslabels.assets.bytype') }}',
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ dataType: 'json',
+ success: function (data) {
+ var myPieChart = new Chart(ctx,{
+ type : 'doughnut',
+ data : data,
+ options: pieOptions
+ });
+ },
+ error: function (data) {
+ // window.location.reload(true);
+ }
+ });
</script>
-
-
- @stop
+ @endpush
diff --cc resources/views/depreciations/edit.blade.php
index 0bec75f102,2a84fac471..95df4eda1a
--- a/resources/views/depreciations/edit.blade.php
+++ b/resources/views/depreciations/edit.blade.php
@@@ -17,10 -17,10 +17,10 @@@
</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'months')) ? ' required' : '' }}">
<div class="col-md-2" style="padding-left:0px">
- <input class="form-control" type="text" name="months" id="months" value="{{ Input::old('months', $item->months) }}" style="width: 80px;" />
+ <input class="form-control" type="text" name="months" id="months" value="{{ Request::old('months', $item->months) }}" style="width: 80px;" />
</div>
</div>
- {!! $errors->first('months', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {!! $errors->first('months', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@stop
diff --cc resources/views/hardware/checkin.blade.php
index 5f5e0a5485,b977a5e6bd..488967b5b5
--- a/resources/views/hardware/checkin.blade.php
+++ b/resources/views/hardware/checkin.blade.php
@@@ -35,34 -35,36 +35,45 @@@
action="{{ route('checkin/hardware', $asset->id) }}" autocomplete="off">
@endif
{{csrf_field()}}
- @if ($asset->model->name)
- <!-- AssetModel name -->
+
+ <!-- AssetModel name -->
<div class="form-group">
- {{ Form::label('name', trans('admin/hardware/form.model'), array('class' => 'col-md-3 control-label')) }}
+ {{ Form::label('model', trans('admin/hardware/form.model'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
- <p class="form-control-static">{{ $asset->model->name }}</p>
+ <p class="form-control-static">
+ @if (($asset->model) && ($asset->model->name))
+ {{ $asset->model->name }}
+
+ @else
+ <span class="text-danger text-bold">
+ <i class="fa fa-exclamation-triangle"></i>This asset's model is invalid!
+ The asset <a href="{{ route('hardware.edit', $asset->id) }}">should be edited</a> to correct this before attempting to check it in or out.</span>
+ @endif
+ </p>
</div>
</div>
- @endif
+
<!-- Asset Name -->
+ <!-- Only allow an asset name to be changed if the checker-outer has permission to edit the asset -->
+ @can('update', $asset)
- <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
- {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
- <div class="col-md-8">
- <input class="form-control" type="text" name="name" id="name" value="{{ Request::old('name', $asset->name) }}" tabindex="1">
- {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
+ {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <input class="form-control" type="text" name="name" aria-label="name" id="name"
- value="{{ Input::old('name', $asset->name) }}"/>
+ {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
+ </div>
</div>
- </div>
+ @else
+ @if ($asset->name!='')
+ <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
+ {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <p class="form-control-static">{{ $asset->name }}</p>
+ </div>
+ </div>
+ @endif
+ @endcan
<!-- Status -->
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">
diff --cc resources/views/hardware/checkout.blade.php
index cedf680d08,a94399bf40..ddd3e57b40
--- a/resources/views/hardware/checkout.blade.php
+++ b/resources/views/hardware/checkout.blade.php
@@@ -26,31 -26,37 +26,54 @@@
</div>
<div class="box-body">
{{csrf_field()}}
- @if ($asset->model->name)
- <!-- Model name -->
+ <!-- AssetModel name -->
+ <div class="form-group">
+ {{ Form::label('model', trans('admin/hardware/form.model'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <p class="form-control-static">
+ @if (($asset->model) && ($asset->model->name))
+ {{ $asset->model->name }}
+
+ @else
+ <span class="text-danger text-bold">
+ <i class="fa fa-exclamation-triangle"></i>This asset's model is invalid!
+ The asset <a href="{{ route('hardware.edit', $asset->id) }}">should be edited</a> to correct this before attempting to check it in or out.</span>
+ @endif
+ </p>
+ </div>
+ </div>
+
+ <!-- Asset Name -->
<div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
- {{ Form::label('name', trans('admin/hardware/form.model'), array('class' => 'col-md-3 control-label')) }}
+ {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
- <p class="form-control-static">{{ $asset->model->name }}</p>
+ <input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $asset->name) }}" tabindex="1">
+ {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
+ @endif
+
+ <!-- Asset Name -->
+ <!-- Only allow an asset name to be changed if the checker-outer has permission to edit the asset -->
+ @can('update', $asset)
+ <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
+ {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <input class="form-control" type="text" name="name" id="name" value="{{ Request::old('name', $asset->name) }}" tabindex="1">
+ {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ </div>
+ </div>
+ @else
+ @if ($asset->name!='')
+ <div class="form-group {{ $errors->has('name') ? 'error' : '' }}">
+ {{ Form::label('name', trans('admin/hardware/form.name'), array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-8">
+ <p class="form-control-static">{{ $asset->name }}</p>
+ </div>
+ </div>
+ @endif
+ @endcan
+
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'required'=>'true'])
diff --cc resources/views/hardware/index.blade.php
index 04a953ce93,c9243d5e8a..fe21801e68
--- a/resources/views/hardware/index.blade.php
+++ b/resources/views/hardware/index.blade.php
@@@ -61,13 -64,12 +64,13 @@@
'id' => 'bulkForm']) }}
<div class="row">
<div class="col-md-12">
- @if (Input::get('status')!='Deleted')
+ @if (Request::get('status')!='Deleted')
<div id="toolbar">
- <select name="bulk_actions" class="form-control select2">
+ <label for="bulk_actions"><span class="sr-only">Bulk Actions</span></label>
+ <select name="bulk_actions" class="form-control select2" aria-label="bulk_actions">
- <option value="edit">Edit</option>
- <option value="delete">Delete</option>
- <option value="labels">Generate Labels</option>
+ <option value="edit">{{ trans('button.edit') }}</option>
+ <option value="delete">{{ trans('button.delete') }}</option>
+ <option value="labels">{{ trans_choice('button.generate_labels', 2) }}</option>
</select>
<button class="btn btn-primary" id="bulkEdit" disabled>Go</button>
</div>
diff --cc resources/views/hardware/quickscan.blade.php
index 65e79ba9a2,787e6dd610..4a32c57022
--- a/resources/views/hardware/quickscan.blade.php
+++ b/resources/views/hardware/quickscan.blade.php
@@@ -33,10 -33,10 +33,10 @@@
{{ Form::label('asset_tag', trans('general.asset_tag'), array('class' => 'col-md-3 control-label', 'id' => 'audit_tag')) }}
<div class="col-md-9">
<div class="input-group date col-md-5" data-date-format="yyyy-mm-dd">
- <input type="text" class="form-control" name="asset_tag" id="asset_tag" value="{{ Input::old('asset_tag') }}">
+ <input type="text" class="form-control" name="asset_tag" id="asset_tag" value="{{ Request::old('asset_tag') }}">
</div>
- {!! $errors->first('asset_tag', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {!! $errors->first('asset_tag', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
diff --cc resources/views/hardware/view.blade.php
index 4201eeedc9,cd2e8abbd0..6f99492f5a
--- a/resources/views/hardware/view.blade.php
+++ b/resources/views/hardware/view.blade.php
@@@ -18,46 -18,24 +18,47 @@@
@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))
@if ($asset->assigned_to != '')
@can('checkin', \App\Models\Asset::class)
- <li role="presentation"><a href="{{ route('checkin/hardware', $asset->id) }}">{{ trans('admin/hardware/general.checkin') }}</a></li>
- @endcan
+ <li role="menuitem">
+ <a href="{{ route('checkin/hardware', $asset->id) }}">
+ {{ trans('admin/hardware/general.checkin') }}
+ </a>
+ </li>
+ @endcan
@else
@can('checkout', \App\Models\Asset::class)
- <li role="presentation"><a href="{{ route('checkout/hardware', $asset->id) }}">{{ trans('admin/hardware/general.checkout') }}</a></li>
- @endcan
+ <li role="menuitem">
+ <a href="{{ route('checkout/hardware', $asset->id) }}">
+ {{ trans('admin/hardware/general.checkout') }}
+ </a>
+ </li>
+ @endcan
@endif
@endif
+
@can('update', \App\Models\Asset::class)
- <li role="presentation"><a href="{{ route('hardware.edit', $asset->id) }}">{{ trans('admin/hardware/general.edit') }}</a></li>
+ <li role="menuitem">
+ <a href="{{ route('hardware.edit', $asset->id) }}">
+ {{ trans('admin/hardware/general.edit') }}
+ </a>
+ </li>
@endcan
+
@can('create', \App\Models\Asset::class)
- <li role="presentation"><a href="{{ route('clone/hardware', $asset->id) }}">{{ trans('admin/hardware/general.clone') }}</a></li>
+ <li role="menuitem">
+ <a href="{{ route('clone/hardware', $asset->id) }}">
+ {{ trans('admin/hardware/general.clone') }}
+ </a>
+ </li>
@endcan
+
@can('audit', \App\Models\Asset::class)
- <li role="presentation"><a href="{{ route('asset.audit.create', $asset->id) }}">{{ trans('general.audit') }}</a></li>
+ <li role="menuitem">
+ <a href="{{ route('asset.audit.create', $asset->id) }}">
+ {{ trans('general.audit') }}
+ </a>
+ </li>
@endcan
+ <li role="presentation"><a href="{{ route('label/hardware', $asset->id) }}">{{ trans_choice('button.generate_labels', 1) }}</a></li>
</ul>
</div>
@endcan
@@@ -207,526 -129,382 +208,531 @@@
@elseif (($asset->assetstatus) && ($asset->assetstatus->archived=='1'))
<i class="fa fa-times text-red"></i>
@endif
- <a href="{{ route('statuslabels.show', $asset->assetstatus->id) }}">
- {{ $asset->assetstatus->name }}</a>
- <label class="label label-default">{{ $asset->present()->statusMeta }}</label>
+ <a href="{{ route('statuslabels.show', $asset->assetstatus->id) }}">
+ {{ $asset->assetstatus->name }}</a>
+ <label class="label label-default">{{ $asset->present()->statusMeta }}</label>
@endif
- </td>
- </tr>
- @endif
+ </div>
+ </div>
+ @endif
- @if ($asset->company)
- <tr>
- <td>{{ trans('general.company') }}</td>
- <td><a href="{{ url('/companies/' . $asset->company->id) }}">{{ $asset->company->name }}</a></td>
- </tr>
- @endif
+ @if ($asset->company)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>{{ trans('general.company') }}</strong>
+ </div>
+ <div class="col-md-6">
+ <a href="{{ url('/companies/' . $asset->company->id) }}">{{ $asset->company->name }}</a>
+ </div>
+ </div>
+ @endif
- @if ($asset->name)
- <tr>
- <td>{{ trans('admin/hardware/form.name') }}</td>
- <td>{{ $asset->name }}</td>
- </tr>
- @endif
+ @if ($asset->name)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>{{ trans('admin/hardware/form.name') }}</strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->name }}
+ </div>
+ </div>
+ @endif
+
+ @if ($asset->serial)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>{{ trans('admin/hardware/form.serial') }}</strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->serial }}
+ </div>
+ </div>
+ @endif
- @if ($asset->serial)
- <tr>
- <td>{{ trans('admin/hardware/form.serial') }}</td>
- <td>{{ $asset->serial }}</td>
- </tr>
- @endif
- @if ((isset($audit_log)) && ($audit_log->created_at))
- <tr>
- <td>{{ trans('general.last_audit') }}</td>
- <td> {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} (by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})</td>
- </tr>
- @endif
- @if ($asset->next_audit_date)
- <tr>
- <td>{{ trans('general.next_audit_date') }}</td>
- <td> {{ \App\Helpers\Helper::getFormattedDateObject($asset->next_audit_date, 'date', false) }}</td>
- </tr>
- @endif
- @if (($asset->model) && ($asset->model->manufacturer))
- <tr>
- <td>{{ trans('admin/hardware/form.manufacturer') }}</td>
- <td>
- <ul class="list-unstyled" style="line-height: 25px;">
+ @if ((isset($audit_log)) && ($audit_log->created_at))
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.last_audit') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} (by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})
+ </div>
+ </div>
+ @endif
+
+ @if ($asset->next_audit_date)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.next_audit_date') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->next_audit_date, 'date', false) }}
+ </div>
+ </div>
+ @endif
+
+ @if (($asset->model) && ($asset->model->manufacturer))
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.manufacturer') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ <ul class="list-unstyled" style="line-height: 25px;">
@can('view', \App\Models\Manufacturer::class)
- <li><a href="{{ route('manufacturers.show', $asset->model->manufacturer->id) }}">
- {{ $asset->model->manufacturer->name }}</li>
- </a>
+ <li>
+ <a href="{{ route('manufacturers.show', $asset->model->manufacturer->id) }}">
+ {{ $asset->model->manufacturer->name }}
+ </a>
+ </li>
+
@else
- <li> {{ $asset->model->manufacturer->name }}</li>
+ <li> {{ $asset->model->manufacturer->name }}</li>
@endcan
- @if (($asset->model) && ($asset->model->manufacturer->url))
- <li><i class="fa fa-globe"></i> <a href="{{ $asset->model->manufacturer->url }}">{{ $asset->model->manufacturer->url }}</a></li>
- @endif
-
- @if (($asset->model) && ($asset->model->manufacturer->support_url))
- <li><i class="fa fa-life-ring"></i> <a href="{{ $asset->model->manufacturer->support_url }}">{{ $asset->model->manufacturer->support_url }}</a></li>
- @endif
-
- @if (($asset->model) && ($asset->model->manufacturer->support_phone))
- <li><i class="fa fa-phone"></i>
- <a href="tel:{{ $asset->model->manufacturer->support_phone }}">{{ $asset->model->manufacturer->support_phone }}</a>
- </li>
- @endif
-
- @if (($asset->model) && ($asset->model->manufacturer->support_email))
- <li><i class="fa fa-envelope"></i> <a href="mailto:{{ $asset->model->manufacturer->support_email }}">{{ $asset->model->manufacturer->support_email }}</a></li>
- @endif
- </ul>
- </td>
- </tr>
- @endif
+ @if (($asset->model) && ($asset->model->manufacturer->url))
+ <li>
+ <i class="fa fa-globe" aria-hidden="true"></i>
+ <a href="{{ $asset->model->manufacturer->url }}">
+ {{ $asset->model->manufacturer->url }}
+ </a>
+ </li>
+ @endif
- <tr>
- <td>
- {{ trans('general.category') }}</td>
- <td>
- @if (($asset->model) && ($asset->model->category))
+ @if (($asset->model) && ($asset->model->manufacturer->support_url))
+ <li>
+ <i class="fa fa-life-ring" aria-hidden="true"></i>
+ <a href="{{ $asset->model->manufacturer->support_url }}">
+ {{ $asset->model->manufacturer->support_url }}
+ </a>
+ </li>
+ @endif
- @can('view', \App\Models\Category::class)
+ @if (($asset->model) && ($asset->model->manufacturer->support_phone))
+ <li>
+ <i class="fa fa-phone" aria-hidden="true"></i>
+ <a href="tel:{{ $asset->model->manufacturer->support_phone }}">
+ {{ $asset->model->manufacturer->support_phone }}
+ </a>
+ </li>
+ @endif
- <a href="{{ route('categories.show', $asset->model->category->id) }}">
- {{ $asset->model->category->name }}
+ @if (($asset->model) && ($asset->model->manufacturer->support_email))
+ <li><i class="fa fa-envelope" aria-hidden="true"></i>
+ <a href="mailto:{{ $asset->model->manufacturer->support_email }}">
+ {{ $asset->model->manufacturer->support_email }}
</a>
- @else
+ </li>
+ @endif
+ </ul>
+ </div>
+ </div>
+ @endif
+
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.category') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @if (($asset->model) && ($asset->model->category))
+
+ @can('view', \App\Models\Category::class)
+
+ <a href="{{ route('categories.show', $asset->model->category->id) }}">
{{ $asset->model->category->name }}
- @endcan
+ </a>
@else
- Invalid category
- @endif
+ {{ $asset->model->category->name }}
+ @endcan
+ @else
+ Invalid category
+ @endif
+ </div>
+ </div>
- </td>
- </tr>
+
-
- <tr>
- <td>
+ @if ($asset->model)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
{{ trans('admin/hardware/form.model') }}
- </td>
- <td>
-
+ </strong>
+ </div>
+ <div class="col-md-6">
@if ($asset->model)
- @can('view', \App\Models\AssetModel::class)
- <a href="{{ route('models.show', $asset->model->id) }}">
- {{ $asset->model->name }}
- </a>
- @else
+ @can('view', \App\Models\AssetModel::class)
+ <a href="{{ route('models.show', $asset->model->id) }}">
{{ $asset->model->name }}
- @endcan
-
- @endif
- </td>
- </tr>
+ </a>
+ @else
+ {{ $asset->model->name }}
+ @endcan
+ @endif
+ </div>
+ </div>
+ @endif
- <tr>
- <td>{{ trans('admin/models/table.modelnumber') }}</td>
- <td>
- {{ ($asset->model) ? $asset->model->model_number : ''}}
- </td>
- </tr>
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/models/table.modelnumber') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ ($asset->model) ? $asset->model->model_number : ''}}
+ </div>
+ </div>
+
- @if (($asset->model) && ($asset->model->fieldset))
- @foreach($asset->model->fieldset->fields as $field)
- <tr>
- <td>
+ @if (($asset->model) && ($asset->model->fieldset))
+ @foreach($asset->model->fieldset->fields as $field)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
{{ $field->name }}
- </td>
- <td>
- @if ($field->field_encrypted=='1')
- <i class="fa fa-lock" data-toggle="tooltip" data-placement="top" title="{{ trans('admin/custom_fields/general.value_encrypted') }}"></i>
- @endif
-
- @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
- @can('superuser')
- @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
- <a href="{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}" target="_new">{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}</a>
- @else
- {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}
- @endif
- @else
- {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}
- @endcan
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @if ($field->field_encrypted=='1')
+ <i class="fa fa-lock" data-toggle="tooltip" data-placement="top" title="{{ trans('admin/custom_fields/general.value_encrypted') }}"></i>
+ @endif
- @else
+ @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
+ @can('superuser')
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
- <a href="{{ $asset->{$field->db_column_name()} }}" target="_new">{{ $asset->{$field->db_column_name()} }}</a>
+ <a href="{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}" target="_new">{{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}</a>
@else
- {!! nl2br(e($asset->{$field->db_column_name()})) !!}
+ {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}
@endif
- @endif
- </td>
- </tr>
- @endforeach
- @endif
-
- @if ($asset->purchase_date)
- <tr>
- <td>{{ trans('admin/hardware/form.date') }}</td>
- <td>
- {{ \App\Helpers\Helper::getFormattedDateObject($asset->purchase_date, 'date', false) }}
- </td>
- </tr>
- @endif
+ @else
+ {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}
+ @endcan
- @if ($asset->purchase_cost)
- <tr>
- <td>{{ trans('admin/hardware/form.cost') }}</td>
- <td>
- @if (($asset->id) && ($asset->location))
- {{ $asset->location->currency }}
- @elseif (($asset->id) && ($asset->location))
- {{ $asset->location->currency }}
@else
- {{ $snipeSettings->default_currency }}
+ @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
+ <a href="{{ $asset->{$field->db_column_name()} }}" target="_new">{{ $asset->{$field->db_column_name()} }}</a>
+ @else
+ {!! nl2br(e($asset->{$field->db_column_name()})) !!}
+ @endif
@endif
- {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)}}
+ </div>
+ </div>
+ @endforeach
+ @endif
- </td>
- </tr>
- @endif
- @if ($asset->order_number)
- <tr>
- <td>{{ trans('general.order_number') }}</td>
- <td>
- #{{ $asset->order_number }}
- </td>
- </tr>
- @endif
+ @if ($asset->purchase_date)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.date') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->purchase_date, 'date', false) }}
+ </div>
+ </div>
+ @endif
- @if ($asset->supplier)
- <tr>
- <td>{{ trans('general.supplier') }}</td>
- <td>
- @can ('superuser')
- <a href="{{ route('suppliers.show', $asset->supplier_id) }}">
- {{ $asset->supplier->name }}
- </a>
- @else
- {{ $asset->supplier->name }}
- @endcan
- </td>
- </tr>
- @endif
+ @if ($asset->purchase_cost)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.cost') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @if (($asset->id) && ($asset->location))
+ {{ $asset->location->currency }}
+ @elseif (($asset->id) && ($asset->location))
+ {{ $asset->location->currency }}
+ @else
+ {{ $snipeSettings->default_currency }}
+ @endif
+ {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)}}
- @if ($asset->warranty_months)
- <tr {!! $asset->present()->warrantee_expires() < date("Y-m-d") ? ' class="warning"' : '' !!}>
- <td>{{ trans('admin/hardware/form.warranty') }}</td>
- <td>
- {{ $asset->warranty_months }}
- {{ trans('admin/hardware/form.months') }}
+
- ({{ trans('admin/hardware/form.expires') }}
- {{ $asset->present()->warrantee_expires() }})
- </td>
- </tr>
- @endif
+ </div>
+ </div>
+ @endif
-
+ @if ($asset->order_number)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.order_number') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ #{{ $asset->order_number }}
+ </div>
+ </div>
+ @endif
- @if (($asset->model) && ($asset->depreciation))
- <tr>
- <td>{{ trans('general.depreciation') }}</td>
- <td>
- {{ $asset->depreciation->name }}
- ({{ $asset->depreciation->months }}
- {{ trans('admin/hardware/form.months') }}
- )
- </td>
- </tr>
- <tr>
- <td>
+ @if ($asset->supplier)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.supplier') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @can ('superuser')
+ <a href="{{ route('suppliers.show', $asset->supplier_id) }}">
+ {{ $asset->supplier->name }}
+ </a>
+ @else
+ {{ $asset->supplier->name }}
+ @endcan
+ </div>
+ </div>
+ @endif
+
+
+ @if ($asset->warranty_months)
+ <div class="row{!! $asset->present()->warrantee_expires() < date("Y-m-d") ? ' warning' : '' !!}">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.warranty') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->warranty_months }}
+ {{ trans('admin/hardware/form.months') }}
+
+ ({{ trans('admin/hardware/form.expires') }}
+ {{ $asset->present()->warrantee_expires() }})
+ </div>
+ </div>
+ @endif
+
+ @if (($asset->model) && ($asset->depreciation))
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.depreciation') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->depreciation->name }}
+ ({{ $asset->depreciation->months }}
+ {{ trans('admin/hardware/form.months') }}
+ )
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
{{ trans('admin/hardware/form.fully_depreciated') }}
- </td>
- <td>
- @if ($asset->time_until_depreciated()->y > 0)
- {{ $asset->time_until_depreciated()->y }}
- {{ trans('admin/hardware/form.years') }},
- @endif
- {{ $asset->time_until_depreciated()->m }}
- {{ trans('admin/hardware/form.months') }}
- ({{ $asset->depreciated_date()->format('Y-m-d') }})
- </td>
- </tr>
- @endif
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @if ($asset->time_until_depreciated()->y > 0)
+ {{ $asset->time_until_depreciated()->y }}
+ {{ trans('admin/hardware/form.years') }},
+ @endif
+ {{ $asset->time_until_depreciated()->m }}
+ {{ trans('admin/hardware/form.months') }}
+ ({{ $asset->depreciated_date()->format('Y-m-d') }})
+ </div>
+ </div>
+ @endif
- @if (($asset->model) && ($asset->model->eol))
- <tr>
- <td>{{ trans('admin/hardware/form.eol_rate') }}</td>
- <td>
- {{ $asset->model->eol }}
- {{ trans('admin/hardware/form.months') }}
-
- (
- {{ trans('admin/hardware/form.eol_date') }}:
- {{ $asset->present()->eol_date() }}
- @if ($asset->present()->months_until_eol())
- (
- @if ($asset->present()->months_until_eol()->y > 0) {{ $asset->present()->months_until_eol()->y }}
+ @if (($asset->model) && ($asset->model->eol))
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.eol_rate') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->model->eol }}
+ {{ trans('admin/hardware/form.months') }}
+
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.eol_date') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ $asset->present()->eol_date() }}
+
+
+ @if ($asset->present()->months_until_eol())
+ -
+ @if ($asset->present()->months_until_eol()->y > 0)
+ {{ $asset->present()->months_until_eol()->y }}
{{ trans('general.years') }},
- @endif
+ @endif
- {{ $asset->present()->months_until_eol()->m }}
- {{ trans('general.months') }}
+ {{ $asset->present()->months_until_eol()->m }}
+ {{ trans('general.months') }}
+ )
+ @endif
- </td>
- </tr>
- @endif
+ @endif
+
+ </div>
+ </div>
+ @endif
- @if ($asset->expected_checkin!='')
- <tr>
- <td>{{ trans('admin/hardware/form.expected_checkin') }}</td>
- <td>
- {{ \App\Helpers\Helper::getFormattedDateObject($asset->expected_checkin, 'date', false) }}
- </td>
- </tr>
- @endif
+ @if ($asset->expected_checkin!='')
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.expected_checkin') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->expected_checkin, 'date', false) }}
+ </div>
+ </div>
+ @endif
- <tr>
- <td>{{ trans('admin/hardware/form.notes') }}</td>
- <td> {!! nl2br(e($asset->notes)) !!}</td>
- </tr>
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.notes') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {!! nl2br(e($asset->notes)) !!}
+ </div>
+ </div>
- @if ($asset->location)
- <tr>
- <td>{{ trans('general.location') }}</td>
- <td>
- @can('superuser')
- <a href="{{ route('locations.show', ['location' => $asset->location->id]) }}">
- {{ $asset->location->name }}
- </a>
- @else
- {{ $asset->location->name }}
- @endcan
- </td>
- </tr>
- @endif
+ @if ($asset->location)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.location') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @can('superuser')
+ <a href="{{ route('locations.show', ['location' => $asset->location->id]) }}">
+ {{ $asset->location->name }}
+ </a>
+ @else
+ {{ $asset->location->name }}
+ @endcan
+ </div>
+ </div>
+ @endif
- @if ($asset->defaultLoc)
- <tr>
- <td>{{ trans('admin/hardware/form.default_location') }}</td>
- <td>
- @can('superuser')
- <a href="{{ route('locations.show', ['location' => $asset->defaultLoc->id]) }}">
- {{ $asset->defaultLoc->name }}
- </a>
- @else
- {{ $asset->defaultLoc->name }}
- @endcan
- </td>
- </tr>
- @endif
+ @if ($asset->defaultLoc)
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('admin/hardware/form.default_location') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ @can('superuser')
+ <a href="{{ route('locations.show', ['location' => $asset->defaultLoc->id]) }}">
+ {{ $asset->defaultLoc->name }}
+ </a>
+ @else
+ {{ $asset->defaultLoc->name }}
+ @endcan
+ </div>
+ </div>
+ @endif
- @if ($asset->created_at!='')
- <tr>
- <td>{{ trans('general.created_at') }}</td>
- <td>
- {{ \App\Helpers\Helper::getFormattedDateObject($asset->created_at, 'datetime', false) }}
- </td>
- </tr>
- @endif
+ @if ($asset->created_at!='')
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.created_at') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->created_at, 'datetime', false) }}
+ </div>
+ </div>
+ @endif
- @if ($asset->updated_at!='')
- <tr>
- <td>{{ trans('general.updated_at') }}</td>
- <td>
- {{ \App\Helpers\Helper::getFormattedDateObject($asset->updated_at, 'datetime', false) }}
- </td>
- </tr>
- @endif
+ @if ($asset->updated_at!='')
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.updated_at') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ \App\Helpers\Helper::getFormattedDateObject($asset->updated_at, 'datetime', false) }}
+ </div>
+ </div>
+ @endif
- <tr>
- <td>{{ trans('general.checkouts_count') }}</td>
- <td>
- {{ ($asset->checkouts) ? (int) $asset->checkouts->count() : '0' }}
- </td>
- </tr>
- <tr>
- <td>{{ trans('general.checkins_count') }}</td>
- <td>
- {{ ($asset->checkins) ? (int) $asset->checkins->count() : '0' }}
- </td>
- </tr>
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.checkouts_count') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ ($asset->checkouts) ? (int) $asset->checkouts->count() : '0' }}
+ </div>
+ </div>
- <tr>
- <td>{{ trans('general.user_requests_count') }}</td>
- <td>
- {{ ($asset->userRequests) ? (int) $asset->userRequests->count() : '0' }}
- </td>
- </tr>
- </tbody>
- </table>
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.checkins_count') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ ($asset->checkins) ? (int) $asset->checkins->count() : '0' }}
+ </div>
+ </div>
+
+
+ <div class="row">
+ <div class="col-md-2">
+ <strong>
+ {{ trans('general.user_requests_count') }}
+ </strong>
+ </div>
+ <div class="col-md-6">
+ {{ ($asset->userRequests) ? (int) $asset->userRequests->count() : '0' }}
+ </div>
+ </div>
+
+ </div> <!-- end row-striped -->
-
+ </div> <!-- /table-responsive -->
</div><!-- /col-md-8 -->
<div class="col-md-4">
@if ($asset->image)
<div class="col-md-12 text-center" style="padding-bottom: 15px;">
+ <a href="{{ url('/') }}/uploads/assets/{{ $asset->image }}" data-toggle="lightbox">
- <img src="{{ url('/') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg img-responsive" alt="{{ $asset->getDisplayNameAttribute() }}">
+ <img src="{{ Storage::disk('public')->url(app('assets_upload_path').e($asset->image)) }}" class="assetimg img-responsive">
+ </a>
</div>
@elseif (($asset->model) && ($asset->model->image!=''))
<div class="col-md-12 text-center" style="padding-bottom: 15px;">
+ <a href="{{ url('/') }}/uploads/models/{{ $asset->model->image }}" data-toggle="lightbox">
- <img src="{{ url('/') }}/uploads/models/{{ $asset->model->image }}" class="assetimg img-responsive" alt="{{ $asset->getDisplayNameAttribute() }}">
+ <img src="{{ Storage::disk('public')->url(app('models_upload_url').e($asset->model->image )) }}" class="assetimg img-responsive">
+ </a>
</div>
@endif
@@@ -995,12 -757,13 +1001,13 @@@
data-cookie-id-table="assetHistory">
<thead>
<tr>
- <th data-field="icon" data-visible="true" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter"></th>
- <th class="col-sm-2" data-visible="false" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.record_created') }}</th>
+ <th data-field="icon" data-visible="true" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter"><span class="sr-only">Icon</span></th>
+ <th class="col-sm-2" data-visible="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-1" data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
- <th class="col-sm-1" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
+ <th class="col-sm-1" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
+ <th class="col-sm-2" data-visible="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-2" data-field="note">{{ trans('general.notes') }}</th>
@if ($snipeSettings->require_accept_signature=='1')
<th class="col-md-3" data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
@@@ -1090,17 -849,10 +1097,19 @@@
</td>
</tr>
@endforeach
+
+ @endif
</tbody>
</table>
+
+ @else
+
+ <div class="alert alert-info alert-block">
+ <i class="fa fa-info-circle"></i>
+ {{ trans('general.no_results') }}
+ </div>
+ @endif
+
</div> <!-- /.col-md-12 -->
</div> <!-- /.row -->
</div> <!-- /.tab-pane files -->
diff --cc resources/views/layouts/basic.blade.php
index f3ee0d9fa2,0825e71fb4..d6f59b9206
--- a/resources/views/layouts/basic.blade.php
+++ b/resources/views/layouts/basic.blade.php
@@@ -8,13 -8,11 +8,14 @@@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ ($snipeSettings) && ($snipeSettings->site_name) ? $snipeSettings->site_name : 'Snipe-IT' }}</title>
+ <link rel="shortcut icon" type="image/ico" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url('').e($snipeSettings->favicon) : 'favicon.ico' }} ">
+ {{-- stylesheets --}}
+ <link rel="stylesheet" href="{{ mix('css/all.css') }}">
- <!-- Select2 -->
- <link rel="stylesheet" href="{{ url(asset('js/plugins/select2/select2.min.css')) }}">
+ <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
+ <link rel="shortcut icon" type="image/ico" href="{{ url(asset('favicon.ico')) }}">
+
@if (($snipeSettings) && ($snipeSettings->header_color))
<style>
@@@ -32,10 -30,7 +33,9 @@@
background-color: {{ $snipeSettings->header_color }};
border-color: {{ $snipeSettings->header_color }};
}
+
+
</style>
-
@endif
@if (($snipeSettings) && ($snipeSettings->custom_css))
diff --cc resources/views/layouts/default.blade.php
index e3e4dfd966,d2005e5027..b004120a3b
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@@ -9,46 -9,42 +9,42 @@@
:: {{ $snipeSettings->site_name }}
</title>
<!-- Tell the browser to be responsive to screen width -->
- <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
+ <meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes">
- <link rel="apple-touch-icon" href="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
- <link rel="apple-touch-startup-image" href="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
- <!-- Select2 -->
- <link rel="stylesheet" href="{{ url(asset('js/plugins/select2/select2.min.css')) }}">
- <!-- iCheck for checkboxes and radio inputs -->
- <link rel="stylesheet" href="{{ url(asset('js/plugins/iCheck/all.css')) }}">
+ <link rel="apple-touch-icon" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url('').e($snipeSettings->logo) : '/img/logo.png' }}">
+ <link rel="apple-touch-startup-image" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url('').e($snipeSettings->logo) : '/img/logo.png' }}">
+ <link rel="shortcut icon" type="image/ico" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url('').e($snipeSettings->favicon) : 'favicon.ico' }} ">
- <!-- bootstrap tables CSS -->
- <link rel="stylesheet" href="{{ url(asset('css/bootstrap-table.css')) }}">
- <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
-
- <link rel="shortcut icon" type="image/ico" href="{{ url(asset('favicon.ico')) }}">
-
- <meta name="csrf-token" content="{{ csrf_token() }}">
- <meta name="baseUrl" content="{{ url('/') }}/">
+ <meta name="csrf-token" content="{{ csrf_token() }}">
+ <meta name="baseUrl" content="{{ url('/') }}/">
<script nonce="{{ csrf_token() }}">
window.Laravel = { csrfToken: '{{ csrf_token() }}' };
-
</script>
+ {{-- stylesheets --}}
+ <link rel="stylesheet" href="{{ mix('css/all.css') }}">
+ @if (($snipeSettings) && ($snipeSettings->skin!=''))
+ <link rel="stylesheet" href="{{ mix('css/skins/skin-'.$snipeSettings->skin.'.min.css') }}">
+ @endif
+ {{-- page level css --}}
+ @stack('css')
- {{-- Custom header color --}}
- @if (($snipeSettings) && ($snipeSettings->header_color!=''))
+ <link rel="stylesheet" href="{{ url('css/skins/skin-'.($snipeSettings->skin!='' ? $snipeSettings->skin : 'blue').'.css') }}">
+
<style nonce="{{ csrf_token() }}">
- @if (($snipeSettings) && ($snipeSettings->header_color!=''))
.main-header .navbar, .main-header .logo {
- background-color: {{ $snipeSettings->header_color }};
- background: -webkit-linear-gradient(top, {{ $snipeSettings->header_color }} 0%,{{ $snipeSettings->header_color }} 100%);
- background: linear-gradient(to bottom, {{ $snipeSettings->header_color }} 0%,{{ $snipeSettings->header_color }} 100%);
- border-color: {{ $snipeSettings->header_color }};
+ background-color: {{ $snipeSettings->header_color }};
+ background: -webkit-linear-gradient(top, {{ $snipeSettings->header_color }} 0%,{{ $snipeSettings->header_color }} 100%);
+ background: linear-gradient(to bottom, {{ $snipeSettings->header_color }} 0%,{{ $snipeSettings->header_color }} 100%);
+ border-color: {{ $snipeSettings->header_color }};
}
- .skin-blue .sidebar-menu > li:hover > a, .skin-blue .sidebar-menu > li.active > a {
+ .skin-{{ $snipeSettings->skin!='' ? $snipeSettings->skin : 'blue' }} .sidebar-menu > li:hover > a, .skin-{{ $snipeSettings->skin!='' ? $snipeSettings->skin : 'blue' }} .sidebar-menu > li.active > a {
border-left-color: {{ $snipeSettings->header_color }};
}
@@@ -56,27 -52,16 +52,22 @@@
background-color: {{ $snipeSettings->header_color }};
border-color: {{ $snipeSettings->header_color }};
}
- @endif
-
-
-
- @media (max-width: 400px) {
- .navbar-left {
- margin: 2px;
- }
+ </style>
+ @endif
- .nav::after {
- clear: none;
- }
- }
+ {{-- Custom CSS --}}
+ @if (($snipeSettings) && ($snipeSettings->custom_css))
+ <style>
+ {!! $snipeSettings->show_custom_css() !!}
</style>
+ @endif
+ @if (($snipeSettings) && ($snipeSettings->custom_css))
+ <style>
+ {!! $snipeSettings->show_custom_css() !!}
+ </style>
+ @endif
+
<script nonce="{{ csrf_token() }}">
window.snipeit = {
settings: {
@@@ -86,18 -71,16 +77,15 @@@
</script>
<!-- Add laravel routes into javascript Primarily useful for vue.-->
@routes
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
-
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js" integrity="sha384-qFIkRsVO/J5orlMvxK1sgAt2FXT67og+NyFTITYzvbIP1IJavVEKZM7YWczXkwpB" crossorigin="anonymous"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
+ <script src="{{ url(asset('js/html5shiv.js')) }}" nonce="{{ csrf_token() }}"></script>
+ <script src="{{ url(asset('js/respond.js')) }}" nonce="{{ csrf_token() }}"></script>
+ <![endif]-->
- <![endif]-->
</head>
- <body class="sidebar-mini skin-blue {{ (session('menu_state')!='open') ? 'sidebar-mini sidebar-collapse' : '' }}">
+ <body class="sidebar-mini skin-{{ $snipeSettings->skin!='' ? $snipeSettings->skin : 'blue' }} {{ (session('menu_state')!='open') ? 'sidebar-mini sidebar-collapse' : '' }}">
+ <a class="skip-main" href="#main">Skip to main content</a>
<div class="wrapper">
<header class="main-header">
@@@ -108,11 -91,11 +96,11 @@@
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button above the compact sidenav -->
- <a href="#" style="color: white" class="sidebar-toggle btn btn-white" data-toggle="offcanvas" role="button">
+ <a href="#" style="color: white" class="sidebar-toggle btn btn-white" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
- <ul class="nav navbar-nav navbar-left">
- <li class="left-navblock">
+ <div class="nav navbar-nav navbar-left">
+ <div class="left-navblock">
@if ($snipeSettings->brand == '3')
<a class="logo navbar-brand no-hover" href="{{ url('/') }}">
@if ($snipeSettings->logo!='')
@@@ -123,12 -106,11 +111,12 @@@
@elseif ($snipeSettings->brand == '2')
<a class="logo navbar-brand no-hover" href="{{ url('/') }}">
@if ($snipeSettings->logo!='')
- <img class="navbar-brand-img" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}" alt="">
+ <img class="navbar-brand-img" src="{{ Storage::disk('public')->url('').e($snipeSettings->logo) }}" alt="{{ $snipeSettings->site_name }} logo">
@endif
+ <span class="sr-only">{{ $snipeSettings->site_name }}</span>
</a>
@else
- <a class="logo no-hover" href="{{ url('/') }}">
+ <a class="logo navbar-brand no-hover" href="{{ url('/') }}">
{{ $snipeSettings->site_name }}
</a>
@endif
@@@ -327,10 -298,16 +315,16 @@@
<li {!! (Request::is('account/requested') ? ' class="active"' : '') !!}>
<a href="{{ route('account.requested') }}">
- <i class="fa fa-check fa-disk fa-fw"></i>
+ <i class="fa fa-check fa-disk fa-fw" aria-hidden="true"></i>
Requested Assets
- </a>
- </li>
+ </a></li>
+ <li {!! (Request::is('account/accept') ? ' class="active"' : '') !!}>
+ <a href="{{ route('account.accept') }}">
+ <i class="fa fa-check fa-disk fa-fw"></i>
+ Accept Assets
+ </a></li>
+
+
<li>
<a href="{{ route('profile') }}">
@@@ -793,9 -783,8 +800,9 @@@
{!! Parsedown::instance()->text(e($snipeSettings->footer_text)) !!}
</div>
@endif
-
+
- <a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <i class="fa fa-heart" style="color: #a94442; font-size: 10px"></i> by <a href="https://twitter.com/snipeitapp" rel="noopener">@snipeitapp</a>.
+
+ <a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <i class="fa fa-heart" style="color: #a94442; font-size: 10px" aria-hidden="true"></i><span class="sr-only">love</span> by <a href="https://twitter.com/snipeitapp" rel="noopener">@snipeitapp</a>.
</footer>
@@@ -833,11 -824,20 +842,21 @@@
@section('moar_scripts')
@show
+
<script nonce="{{ csrf_token() }}">
+ $.validate({
+ form : '#create-form',
+ modules : 'date, toggleDisabled',
+ disabledFormFilter : '#create-form',
+ showErrorDialogs : true
+ });
+
$(function () {
+
$('[data-toggle="tooltip"]').tooltip();
+ $('[data-toggle="popover"]').popover();
$('.select2 span').addClass('needsclick');
+ $('.select2 span').removeAttr('title');
// This javascript handles saving the state of the menu (expanded or not)
$('body').bind('expanded.pushMenu', function() {
diff --cc resources/views/layouts/edit-form.blade.php
index 2a6c2dab82,5f3a1476eb..21b0aa0102
--- a/resources/views/layouts/edit-form.blade.php
+++ b/resources/views/layouts/edit-form.blade.php
@@@ -21,23 -21,35 +21,39 @@@
@section('content')
+ <!-- row -->
<div class="row">
+ <!-- col-md-8 -->
<div class="col-md-8 col-md-offset-2">
+
+ <form id="create-form" class="form-horizontal" method="post" action="{{ (isset($formAction)) ? $formAction : \Request::url() }}" autocomplete="off" role="form" enctype="multipart/form-data">
+
+ <!-- box -->
<div class="box box-default">
+ <!-- box-header -->
- <div class="box-header with-border">
+ <div class="box-header{{ ($item->id) ? ' with-border' : '' }}">
+ <h3 class="box-title" style="min-height: 20px;">
+ @if (isset($helpText))
+ @include ('partials.more-info',
+ [
+ 'helpText' => $helpText,
+ 'helpPosition' => (isset($helpPosition)) ? $helpPosition : 'left'
+ ])
+ @endif
+
@if ($item->id)
- {{ $item->display_name }}
+ <h2 class="box-title">
+ {{ $item->display_name }}
+ </h2>
@endif
- </h3>
- @if (isset($topSubmit))
- <div class="box-tools pull-right">
+
+ @if (isset($helpText))
+ <div class="box-tools pull-right">
+ <button class="slideout-menu-toggle btn btn-box-tool btn-box-tool-lg" data-toggle="tooltip" title="Help"><i class="fa fa-question" aria-hidden="true"></i>
+ <span class="sr-only">Help</span>
- </button>
- </div>
+ @include('partials.forms.edit.submit-button')
+ </div>
@endif
</div><!-- /.box-header -->
diff --cc resources/views/licenses/edit.blade.php
index fbdcbcc07b,eabb12c37d..3aeef9a447
--- a/resources/views/licenses/edit.blade.php
+++ b/resources/views/licenses/edit.blade.php
@@@ -28,10 -27,10 +27,10 @@@
<label for="seats" class="col-md-3 control-label">{{ trans('admin/licenses/form.seats') }}</label>
<div class="col-md-7 col-sm-12 required">
<div class="col-md-2" style="padding-left:0px">
- <input class="form-control" type="text" name="seats" id="seats" value="{{ Input::old('seats', $item->seats) }}" />
+ <input class="form-control" type="text" name="seats" id="seats" value="{{ Request::old('seats', $item->seats) }}" />
</div>
</div>
- {!! $errors->first('seats', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fa fa-times"></i> :message</span></div>') !!}
+ {!! $errors->first('seats', '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span></div>') !!}
</div>
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
diff --cc resources/views/locations/edit.blade.php
index 1353ec3e63,9994761974..e0e56ad171
--- a/resources/views/locations/edit.blade.php
+++ b/resources/views/locations/edit.blade.php
@@@ -43,16 -44,13 +44,16 @@@
@endif
<!-- Image -->
-@if ($item->image)
+@if (($item->image) && ($item->image!=''))
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
- <div class="col-md-5">
+ <div class="col-md-9">
- {{ Form::checkbox('image_delete') }}
- <img src="{{ Storage::disk('public')->url(app('locations_upload_path').e($item->image)) }}" class="img-responsive" />
- {!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
+ <label for="image_delete">
+ {{ Form::checkbox('image_delete', '1', Input::old('image_delete'), array('class' => 'minimal', 'aria-label'=>'required')) }}
+ </label>
+ <br>
+ <img src="{{ url('/') }}/uploads/locations/{{ $item->image }}" alt="Image for {{ $item->name }}">
+ {!! $errors->first('image_delete', '<span class="alert-msg" aria-hidden="true"><br>:message</span>') !!}
</div>
</div>
@endif
diff --cc resources/views/models/edit.blade.php
index 0bec1017be,4c8c809716..c62e0c49f1
--- a/resources/views/models/edit.blade.php
+++ b/resources/views/models/edit.blade.php
@@@ -37,10 -38,10 +38,10 @@@
<div class="form-group {{ $errors->has('custom_fieldset') ? ' has-error' : '' }}">
<label for="custom_fieldset" class="col-md-3 control-label">{{ trans('admin/models/general.fieldset') }}</label>
<div class="col-md-7">
- {{ Form::select('custom_fieldset', \App\Helpers\Helper::customFieldsetList(),Request::old('custom_fieldset', $item->fieldset_id), array('class'=>'select2 js-fieldset-field', 'style'=>'width:350px')) }}
- {!! $errors->first('custom_fieldset', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('custom_fieldset', \App\Helpers\Helper::customFieldsetList(),Input::old('custom_fieldset', $item->fieldset_id), array('class'=>'select2 js-fieldset-field', 'style'=>'width:350px', 'aria-label'=>'custom_fieldset')) }}
+ {!! $errors->first('custom_fieldset', '<span class="alert-msg" aria-hidden="true"><br><i class="fa fa-times"></i> :message</span>') !!}
<label class="m-l-xs">
- {{ Form::checkbox('add_default_values', 1, Input::old('add_default_values'), ['class' => 'js-default-values-toggler']) }}
+ {{ Form::checkbox('add_default_values', 1, Request::old('add_default_values'), ['class' => 'js-default-values-toggler']) }}
{{ trans('admin/models/general.add_default_values') }}
</label>
</div>
diff --cc resources/views/models/index.blade.php
index 2ad084249a,3ddad371fd..03a3560d87
--- a/resources/views/models/index.blade.php
+++ b/resources/views/models/index.blade.php
@@@ -43,10 -43,9 +43,10 @@@
<div class="row">
<div class="col-md-12">
- @if (Input::get('status')!='deleted')
+ @if (Request::get('status')!='deleted')
<div id="toolbar">
- <select name="bulk_actions" class="form-control select2" style="width: 300px;">
+ <label for="bulk_actions" class="sr-only">Bulk Actions</label>
+ <select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="width: 300px;">
<option value="edit">Bulk Edit</option>
<option value="delete">Bulk Delete</option>
</select>
diff --cc resources/views/partials/bootstrap-table.blade.php
index 8884ee010b,d4d309d46c..4d14e0dce0
--- a/resources/views/partials/bootstrap-table.blade.php
+++ b/resources/views/partials/bootstrap-table.blade.php
@@@ -31,10 -22,8 +22,9 @@@
stickyHeaderOffsetY += +$('.navbar-fixed-top').css('margin-bottom').replace('px','');
}
+
$('.snipe-table').bootstrapTable('destroy').bootstrapTable({
classes: 'table table-responsive table-no-bordered',
-
ajaxOptions: {
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
@@@ -59,27 -47,23 +48,27 @@@
pageSize: {{ (($snipeSettings->per_page!='') && ($snipeSettings->per_page > 0)) ? $snipeSettings->per_page : 20 }},
paginationVAlign: 'both',
formatLoadingMessage: function () {
- return '<h4><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Loading... please wait.... </h4>';
+ return '<h2><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Loading... please wait.... </h4>';
},
-
icons: {
advancedSearchIcon: 'fa fa-search-plus',
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
- refresh: 'fa-refresh'
+ refresh: 'fa-refresh',
+ export: 'fa-download'
},
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
-
-
+ onLoadSuccess: function () {
+ $('[data-toggle="tooltip"]').tooltip(); // Need to attach tooltips after ajax call
+ }
});
-
});
+
+
+
+
function dateRowCheckStyle(value) {
if ((value.days_to_next_audit) && (value.days_to_next_audit < {{ $snipeSettings->audit_warning_days ?: 0 }})) {
return { classes : "danger" }
@@@ -189,8 -171,12 +177,12 @@@
var dest = 'hardware/maintenances';
}
+ if(element_name != '') {
+ dest = dest + '/' + row.owner_id + '/' + element_name;
+ }
+
if ((row.available_actions) && (row.available_actions.clone === true)) {
- actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/clone" class="btn btn-sm btn-info" data-toggle="tooltip" title="Clone"><i class="fa fa-copy"></i></a>&nbsp;';
+ actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/clone" class="btn btn-sm btn-info" data-tooltip="true" title="Clone Item"><i class="fa fa-copy" aria-hidden="true"></i><span class="sr-only">Clone</span></a>&nbsp;';
}
if ((row.available_actions) && (row.available_actions.update === true)) {
diff --cc resources/views/partials/forms/edit/address.blade.php
index e2dc99b5f2,5a9e8019ba..b7534b46a7
--- a/resources/views/partials/forms/edit/address.blade.php
+++ b/resources/views/partials/forms/edit/address.blade.php
@@@ -25,8 -25,8 +25,10 @@@
<div class="form-group {{ $errors->has('state') ? ' has-error' : '' }}">
{{ Form::label('state', trans('general.state'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
+ {{Form::text('state', Input::old('state', $item->state), array('class' => 'form-control', 'aria-label'=>'state')) }}
+ {!! $errors->first('state', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
+ {{Form::text('state', Request::old('state', $item->state), array('class' => 'form-control')) }}
+ {!! $errors->first('state', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
@@@ -41,7 -41,7 +43,7 @@@
<div class="form-group {{ $errors->has('zip') ? ' has-error' : '' }}">
{{ Form::label('zip', trans('general.zip'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
- {{Form::text('zip', Request::old('zip', $item->zip), array('class' => 'form-control')) }}
- {!! $errors->first('zip', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{Form::text('zip', Input::old('zip', $item->zip), array('class' => 'form-control')) }}
+ {!! $errors->first('zip', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/category.blade.php
index d51d35dc20,e105320b80..0e82cbaa2d
--- a/resources/views/partials/forms/edit/category.blade.php
+++ b/resources/views/partials/forms/edit/category.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('category_id') ? ' has-error' : '' }}">
<label for="category_id" class="col-md-3 control-label">{{ trans('general.category') }}</label>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'category_id')) ? ' required' : '' }}">
- {{ Form::select('category_id', $category_list , Request::old('category_id', $item->category_id), array('class'=>'select2', 'style'=>'width:100%')) }}
- {!! $errors->first('category_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('category_id', $category_list , Input::old('category_id', $item->category_id), array('class'=>'select2', 'style'=>'width:100%')) }}
+ {!! $errors->first('category_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/company-select.blade.php
index 6f7e511f68,faf8464b9a..6cdbc0579e
--- a/resources/views/partials/forms/edit/company-select.blade.php
+++ b/resources/views/partials/forms/edit/company-select.blade.php
@@@ -1,19 -1,32 +1,38 @@@
<!-- Company -->
- <div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
+ @if (($snipeSettings->full_multiple_companies_support=='1') && (!Auth::user()->isSuperUser()))
+ <!-- full company support is enabled and this user isn't a superadmin -->
+ <div class="form-group">
- {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
- <div class="col-md-7">
- <p class="form-control-static">{{ Auth::user()->company->name }}</p>
- <input type="hidden" name="company_id" value="{{ Auth::user()->company->id }}">
+ {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-7">
+ <select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}" style="width: 100%" id="company_select" aria-label="{{ $fieldname }}">
+ @if ($company_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
+ <option value="{{ $company_id }}" selected="selected" role="option" aria-selected="true" role="option">
+ {{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
+ </option>
+ @else
+ <option value="" role="option">{{ trans('general.select_company') }}</option>
+ @endif
- </select>
+ </div>
+
</div>
+ @else
+ <!-- full company support is enabled or this user is a superadmin -->
+ <div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
+ {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
+ <div class="col-md-7">
+ <select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}" style="width: 100%" id="company_select">
+ @if ($company_id = Request::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
+ <option value="{{ $company_id }}" selected="selected">
+ {{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
+ </option>
+ @else
+ <option value="">{{ trans('general.select_company') }}</option>
+ @endif
+ </select>
+ </div>
+ {!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fa fa-times"></i> :message</span></div>') !!}
- </div>
+ {!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span></div>') !!}
- </div>
+ @endif
diff --cc resources/views/partials/forms/edit/company.blade.php
index b3e79080ae,ff80c0758a..27e9352a2e
--- a/resources/views/partials/forms/edit/company.blade.php
+++ b/resources/views/partials/forms/edit/company.blade.php
@@@ -1,11 -1,9 +1,11 @@@
@if (\App\Models\Company::isCurrentUserAuthorized())
<div class="form-group {{ $errors->has('company_id') ? ' has-error' : '' }}">
- <div class="col-md-3 control-label">{{ Form::label('company_id', trans('general.company')) }}</div>
+ <div class="col-md-3 control-label">
+ {{ Form::label('company_id', trans('general.company'), array('class' => 'col-md-3 control-label', 'for' => 'company_id')) }}
+ </div>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'company_id')) ? ' required' : '' }}">
- {{ Form::select('company_id', $company_list , Request::old('company_id', $item->company_id), array('class'=>'select2', 'style'=>'width:100%')) }}
- {!! $errors->first('company_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('company_id', $company_list , Input::old('company_id', $item->company_id), array('class'=>'select2', 'style'=>'width:100%')) }}
+ {!! $errors->first('company_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
- @endif
+ @endif
diff --cc resources/views/partials/forms/edit/depreciation.blade.php
index 020931bfc5,37ebe00713..4768e54ff4
--- a/resources/views/partials/forms/edit/depreciation.blade.php
+++ b/resources/views/partials/forms/edit/depreciation.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('depreciation_id') ? ' has-error' : '' }}">
<label for="depreciation_id" class="col-md-3 control-label">{{ trans('general.depreciation') }}</label>
<div class="col-md-7">
- {{ Form::select('depreciation_id', $depreciation_list , Request::old('depreciation_id', $item->depreciation_id), array('class'=>'select2', 'style'=>'width:350px')) }}
- {!! $errors->first('depreciation_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('depreciation_id', $depreciation_list , Input::old('depreciation_id', $item->depreciation_id), array('class'=>'select2', 'style'=>'width:350px', 'aria-label'=>'depreciation_id')) }}
+ {!! $errors->first('depreciation_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/email.blade.php
index d6b9508717,ac91a45b14..3d1c832dcb
--- a/resources/views/partials/forms/edit/email.blade.php
+++ b/resources/views/partials/forms/edit/email.blade.php
@@@ -1,7 -1,7 +1,7 @@@
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
{{ Form::label('email', trans('admin/suppliers/table.email'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
- {{Form::text('email', Request::old('email', $item->email), array('class' => 'form-control')) }}
- {!! $errors->first('email', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{Form::text('email', Input::old('email', $item->email), array('class' => 'form-control')) }}
+ {!! $errors->first('email', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/image-upload.blade.php
index fa9f403a0b,acbb820971..d2433c6745
--- a/resources/views/partials/forms/edit/image-upload.blade.php
+++ b/resources/views/partials/forms/edit/image-upload.blade.php
@@@ -1,20 -1,17 +1,20 @@@
- <div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
+ <div class="form-group {{ $errors->has((isset($fieldname) ? $fieldname : 'image')) ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-9">
- <label class="btn btn-default">
+
+ <input type="file" id="image" name="image" aria-label="image" class="sr-only">
+
+ <label class="btn btn-default" aria-hidden="true">
{{ trans('button.select_file') }}
- <input type="file" name="{{ (isset($fieldname) ? $fieldname : 'image') }}" class="js-uploadFile" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/gif,image/jpeg,image/png,image/svg,image/svg+xml,image/bmp" style="display:none; max-width: 90%">
+ <input type="file" name="image" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/gif,image/jpeg,image/png,image/svg" style="display:none" aria-label="image" aria-hidden="true">
</label>
- <span class='label label-default' id="upload-file-info"></span>
+ <span class='label label-default' id="uploadFile-info"></span>
- <p class="help-block" id="uploadFile-status">{{ trans('general.image_filetypes_help', ['size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}</p>
- {!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
+ <p class="help-block" id="upload-file-status">{{ trans('general.image_filetypes_help', ['size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}</p>
+ {!! $errors->first('image', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
- <div class="col-md-9 col-md-offset-3">
- <img id="uploadFile-imagePreview" style="max-width: 200px;">
+ <div class="col-md-4 col-md-offset-3" aria-hidden="true">
+ <img id="imagePreview" style="max-width: 200px; display: none;" alt="Uploaded image thumbnail">
</div>
</div>
diff --cc resources/views/partials/forms/edit/item_number.blade.php
index f2d0d29e1c,b149553f12..36fb05547d
--- a/resources/views/partials/forms/edit/item_number.blade.php
+++ b/resources/views/partials/forms/edit/item_number.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('item_no') ? ' has-error' : '' }}">
<label for="item_no" class="col-md-3 control-label">{{ trans('admin/consumables/general.item_no') }}</label>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'item_no')) ? ' required' : '' }}">
- <input class="form-control" type="text" name="item_no" id="item_no" value="{{ Request::old('item_no', $item->item_no) }}" />
- {!! $errors->first('item_no', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <input class="form-control" type="text" name="item_no" id="item_no" value="{{ Input::old('item_no', $item->item_no) }}" />
+ {!! $errors->first('item_no', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/location.blade.php
index bf24c997a0,496b64d784..99e106b435
--- a/resources/views/partials/forms/edit/location.blade.php
+++ b/resources/views/partials/forms/edit/location.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('location_id') ? ' has-error' : '' }}">
<label for="location_id" class="col-md-3 control-label">{{ trans('general.location') }}</label>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'location_id')) ? ' required' : '' }}">
- {{ Form::select('location_id', $location_list , Request::old('location_id', $item->location_id), array('class'=>'select2', 'style'=>'width:350px')) }}
- {!! $errors->first('location_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('location_id', $location_list , Input::old('location_id', $item->location_id), array('class'=>'select2', 'style'=>'width:350px')) }}
+ {!! $errors->first('location_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/maintenance_type.blade.php
index 4438144e63,abe728d552..f30d47b9e5
--- a/resources/views/partials/forms/edit/maintenance_type.blade.php
+++ b/resources/views/partials/forms/edit/maintenance_type.blade.php
@@@ -3,7 -3,7 +3,7 @@@
<label for="asset_maintenance_type" class="col-md-3 control-label">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}
</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'asset_maintenance_type')) ? ' required' : '' }}">
- {{ Form::select('asset_maintenance_type', $assetMaintenanceType , Request::old('asset_maintenance_type', $item->asset_maintenance_type), ['class'=>'select2', 'style'=>'min-width:350px']) }}
- {!! $errors->first('asset_maintenance_type', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('asset_maintenance_type', $assetMaintenanceType , Input::old('asset_maintenance_type', $item->asset_maintenance_type), ['class'=>'select2', 'style'=>'min-width:350px', 'aria-label'=>'asset_maintenance_type']) }}
+ {!! $errors->first('asset_maintenance_type', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/manufacturer.blade.php
index ed9048a85f,217d27e715..8760c63fcf
--- a/resources/views/partials/forms/edit/manufacturer.blade.php
+++ b/resources/views/partials/forms/edit/manufacturer.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<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{{ (\App\Helpers\Helper::checkIfRequired($item, 'manufacturer_id')) ? ' required' : '' }}">
- {{ Form::select('manufacturer_id', $manufacturer_list , Request::old('manufacturer_id', $item->manufacturer_id), array('class'=>'select2', 'style'=>'width:100%')) }}
- {!! $errors->first('manufacturer_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{ Form::select('manufacturer_id', $manufacturer_list , Input::old('manufacturer_id', $item->manufacturer_id), array('class'=>'select2', 'style'=>'width:100%')) }}
+ {!! $errors->first('manufacturer_id', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/minimum_quantity.blade.php
index 7037f32cbc,207031296e..175ec26abd
--- a/resources/views/partials/forms/edit/minimum_quantity.blade.php
+++ b/resources/views/partials/forms/edit/minimum_quantity.blade.php
@@@ -3,16 -3,13 +3,16 @@@
<label for="min_amt" class="col-md-3 control-label">{{ trans('general.min_amt') }}</label>
<div class="col-md-9{{ (\App\Helpers\Helper::checkIfRequired($item, 'min_amt')) ? ' required' : '' }}">
<div class="col-md-2" style="padding-left:0px">
- <input class="form-control col-md-3" type="text" name="min_amt" id="min_amt" value="{{ Request::old('min_amt', $item->min_amt) }}" />
+ <input class="form-control col-md-3" type="text" name="min_amt" id="min_amt" aria-label="min_amt" value="{{ Input::old('min_amt', $item->min_amt) }}" />
</div>
<div class="col-md-7" style="margin-left: -15px;">
- <a href="#" data-toggle="tooltip" title="{{ trans('general.min_amt_help') }}"><i class="fa fa-info-circle"></i></a>
+ <a href="#" data-toggle="tooltip" title="{{ trans('general.min_amt_help') }}"><i class="fa fa-info-circle" aria-hidden="true"></i>
+ <span class="sr-only">{{ trans('general.min_amt_help') }}</span>
+ </a>
+
</div>
<div class="col-md-12">
- {!! $errors->first('min_amt', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {!! $errors->first('min_amt', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/model_number.blade.php
index 715ef4ed7a,4a60658064..cf3ad9e495
--- a/resources/views/partials/forms/edit/model_number.blade.php
+++ b/resources/views/partials/forms/edit/model_number.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('model_number') ? ' has-error' : '' }}">
<label for="model_number" class="col-md-3 control-label">{{ trans('general.model_no') }}</label>
<div class="col-md-7">
- <input class="form-control" type="text" name="model_number" id="model_number" value="{{ Request::old('model_number', $item->model_number) }}" />
- {!! $errors->first('model_number', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <input class="form-control" type="text" name="model_number" aria-label="model_number" id="model_number" value="{{ Input::old('model_number', $item->model_number) }}" />
+ {!! $errors->first('model_number', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/name.blade.php
index 5e4e8d3892,af6e29c2c7..da84fd965f
--- a/resources/views/partials/forms/edit/name.blade.php
+++ b/resources/views/partials/forms/edit/name.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ $translated_name }}</label>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'name')) ? ' required' : '' }}">
- <input class="form-control" type="text" name="name" id="name" value="{{ Request::old('name', $item->name) }}" {!! (\App\Helpers\Helper::checkIfRequired($item, 'name')) ? ' data-validation="required"' : '' !!}>
- {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <input class="form-control" type="text" name="name" aria-label="name" id="name" value="{{ Input::old('name', $item->name) }}" />
+ {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/order_number.blade.php
index 9a26f187f1,80a7f7bc7c..d5fceea436
--- a/resources/views/partials/forms/edit/order_number.blade.php
+++ b/resources/views/partials/forms/edit/order_number.blade.php
@@@ -2,7 -2,7 +2,7 @@@
<div class="form-group {{ $errors->has('order_number') ? ' has-error' : '' }}">
<label for="order_number" class="col-md-3 control-label">{{ trans('general.order_number') }}</label>
<div class="col-md-7 col-sm-12">
- <input class="form-control" type="text" name="order_number" id="order_number" value="{{ Request::old('order_number', $item->order_number) }}" />
- {!! $errors->first('order_number', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <input class="form-control" type="text" name="order_number" aria-label="order_number" id="order_number" value="{{ Input::old('order_number', $item->order_number) }}" />
+ {!! $errors->first('order_number', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/phone.blade.php
index 96cbf7985a,79f94fe565..e7f948bb31
--- a/resources/views/partials/forms/edit/phone.blade.php
+++ b/resources/views/partials/forms/edit/phone.blade.php
@@@ -1,7 -1,7 +1,7 @@@
<div class="form-group {{ $errors->has('phone') ? ' has-error' : '' }}">
{{ Form::label('phone', trans('admin/suppliers/table.phone'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7">
- {{Form::text('phone', Request::old('phone', $item->phone), array('class' => 'form-control')) }}
- {!! $errors->first('phone', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {{Form::text('phone', Input::old('phone', $item->phone), array('class' => 'form-control', 'aria-label'=>'phone')) }}
+ {!! $errors->first('phone', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/quantity.blade.php
index cf14a63ec1,390a576c7a..5e61cdc38a
--- a/resources/views/partials/forms/edit/quantity.blade.php
+++ b/resources/views/partials/forms/edit/quantity.blade.php
@@@ -4,8 -4,8 +4,8 @@@
<label for="qty" class="col-md-3 control-label">{{ trans('general.quantity') }}</label>
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'qty')) ? ' required' : '' }}">
<div class="col-md-2" style="padding-left:0px">
- <input class="form-control" type="text" name="qty" id="qty" value="{{ Request::old('qty', $item->qty) }}" />
+ <input class="form-control" type="text" name="qty" aria-label="qty" id="qty" value="{{ Input::old('qty', $item->qty) }}" />
</div>
- {!! $errors->first('qty', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ {!! $errors->first('qty', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/serial.blade.php
index adf111dfdf,92628c529a..d697f5f9ca
--- a/resources/views/partials/forms/edit/serial.blade.php
+++ b/resources/views/partials/forms/edit/serial.blade.php
@@@ -1,8 -1,8 +1,8 @@@
<!-- Serial -->
<div class="form-group {{ $errors->has('serial') ? ' has-error' : '' }}">
- <label for="serial" class="col-md-3 control-label">{{ trans('admin/hardware/form.serial') }} </label>
+ <label for="{{ $fieldname }}" class="col-md-3 control-label">{{ trans('admin/hardware/form.serial') }} </label>
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}">
- <input class="form-control" type="text" name="{{ $fieldname }}" id="serial" value="{{ Request::old('serial', $item->serial) }}" />
- {!! $errors->first('serial', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
+ <input class="form-control" type="text" name="serial" id="serial" value="{{ Input::old('serial', $item->serial) }}" />
+ {!! $errors->first('serial', '<span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
- </div>
+ </div>
diff --cc resources/views/partials/forms/edit/submit.blade.php
index 93b9f78528,e9c0f3e964..9b58bb4d2f
--- a/resources/views/partials/forms/edit/submit.blade.php
+++ b/resources/views/partials/forms/edit/submit.blade.php
@@@ -1,4 -1,7 +1,7 @@@
+ <!-- partials/forms/edit/submit.blade.php -->
+
-<div class="box-footer">
- <a class="btn btn-link pull-left" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
- @include('partials.forms.edit.submit-button')
+<div class="box-footer text-right">
+ <a class="btn btn-link text-left" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
+ <button type="submit" class="btn btn-primary"><i class="fa fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
</div>
+ <!-- / partials/forms/edit/submit.blade.php -->
diff --cc resources/views/settings/barcodes.blade.php
index a1ae876d35,76b30a3ae4..4a916e479c
--- a/resources/views/settings/barcodes.blade.php
+++ b/resources/views/settings/barcodes.blade.php
@@@ -104,9 -104,9 +104,9 @@@
'title' =>'Extra text that you would like to display on your labels. ',
'data-toggle' =>'tooltip',
'data-placement'=>'top')) }}
- {!! $errors->first('qr_text', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('qr_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
@else
- {{ Form::text('qr_text', Input::old('qr_text', $setting->qr_text), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'Property of Your Company')) }}
+ {{ Form::text('qr_text', Request::old('qr_text', $setting->qr_text), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'Property of Your Company')) }}
<p class="help-block">{{ trans('admin/settings/general.qr_help') }}</p>
@endif
</div>
diff --cc resources/views/settings/branding.blade.php
index 6027b18d0b,a7527238d3..63085a9cb1
--- a/resources/views/settings/branding.blade.php
+++ b/resources/views/settings/branding.blade.php
@@@ -19,11 -19,8 +19,9 @@@
padding-right: 40px;
}
</style>
- <!-- Bootstrap Color Picker -->
- <link rel="stylesheet" href="{{ asset('js/plugins/colorpicker/bootstrap-colorpicker.min.css') }}">
+
- {{ Form::open(['method' => 'POST', 'files' => true, 'autocomplete' => 'off', 'class' => 'form-horizontal', 'role' => 'form' ]) }}
+ {{ Form::open(['method' => 'POST', 'files' => true, 'autocomplete' => 'off', 'class' => 'form-horizontal', 'role' => 'form', 'id' => 'create-form' ]) }}
<!-- CSRF Token -->
{{csrf_field()}}
@@@ -48,40 -45,14 +46,40 @@@
<div class="col-md-3">
{{ Form::label('site_name', trans('admin/settings/general.site_name')) }}
</div>
- <div class="col-md-7">
+ <div class="col-md-7 required">
@if (config('app.lock_passwords')===true)
- {{ Form::text('site_name', Input::old('site_name', $setting->site_name), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'Snipe-IT Asset Management')) }}
+ {{ Form::text('site_name', Request::old('site_name', $setting->site_name), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'Snipe-IT Asset Management')) }}
@else
{{ Form::text('site_name',
- Input::old('site_name', $setting->site_name), array('class' => 'form-control','placeholder' => 'Snipe-IT Asset Management')) }}
+ Request::old('site_name', $setting->site_name), array('class' => 'form-control','placeholder' => 'Snipe-IT Asset Management', 'data-validation' => 'required')) }}
@endif
- {!! $errors->first('site_name', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('site_name', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
+ </div>
+ </div>
+
+
+ <!-- Logo -->
+
+ <div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
+ <label class="col-md-3 control-label" for="image">
+ {{ Form::label('logo', trans('admin/settings/general.logo')) }}</label>
+ <div class="col-md-9">
+ @if (config('app.lock_passwords'))
+ <p class="help-block">{{ trans('general.lock_passwords') }}</p>
+ @else
+ <label class="btn btn-default">
+ {{ trans('button.select_file') }}
+ <input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
+ </label>
+
+ <p class="help-block" id="upload-file-status">{{ trans('general.image_filetypes_help', ['size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}</p>
+
+ {!! $errors->first('image', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
+ <label for="clear_logo">
+ {{ Form::checkbox('clear_logo', '1', Input::old('clear_logo'),array('class' => 'minimal', 'aria-label'=>'clear_logo')) }}
+ {{ trans('general.delete') }}
+ </label>
+ @endif
</div>
</div>
@@@ -157,14 -164,14 +193,14 @@@
</div>
<div class="col-md-9">
@if (config('app.lock_passwords')===true)
- {{ Form::textarea('custom_css', Request::old('custom_css', $setting->custom_css), array('class' => 'form-control','placeholder' => 'Add your custom CSS','disabled'=>'disabled')) }}
- {!! $errors->first('custom_css', '<span class="alert-msg">:message</span>') !!}
+ {{ Form::textarea('custom_css', Input::old('custom_css', $setting->custom_css), array('class' => 'form-control','placeholder' => 'Add your custom CSS','disabled'=>'disabled', 'aria-label'=>'custom_css')) }}
+ {!! $errors->first('custom_css', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{{ trans('general.lock_passwords') }}</p>
@else
- {{ Form::textarea('custom_css', Request::old('custom_css', $setting->custom_css), array('class' => 'form-control','placeholder' => 'Add your custom CSS')) }}
- {!! $errors->first('custom_css', '<span class="alert-msg">:message</span>') !!}
+ {{ Form::textarea('custom_css', Input::old('custom_css', $setting->custom_css), array('class' => 'form-control','placeholder' => 'Add your custom CSS', 'aria-label'=>'custom_css')) }}
+ {!! $errors->first('custom_css', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
@endif
- <p class="help-block">{{ trans('admin/settings/general.custom_css_help') }}</p>
+ <p class="help-block">{!! trans('admin/settings/general.custom_css_help') !!}</p>
</div>
</div>
@@@ -211,13 -218,13 +247,13 @@@
</div>
<div class="col-md-9">
@if (config('app.lock_passwords')===true)
- {{ Form::textarea('footer_text', Input::old('footer_text', $setting->footer_text), array('class' => 'form-control', 'rows' => '4', 'placeholder' => 'Optional footer text','disabled'=>'disabled')) }}
+ {{ Form::textarea('footer_text', Request::old('footer_text', $setting->footer_text), array('class' => 'form-control', 'rows' => '4', 'placeholder' => 'Optional footer text','disabled'=>'disabled')) }}
<p class="help-block">{{ trans('general.lock_passwords') }}</p>
@else
- {{ Form::textarea('footer_text', Input::old('footer_text', $setting->footer_text), array('class' => 'form-control','rows' => '4','placeholder' => 'Optional footer text')) }}
+ {{ Form::textarea('footer_text', Request::old('footer_text', $setting->footer_text), array('class' => 'form-control','rows' => '4','placeholder' => 'Optional footer text')) }}
@endif
<p class="help-block">{!! trans('admin/settings/general.footer_text_help') !!}</p>
- {!! $errors->first('footer_text', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('footer_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --cc resources/views/settings/general.blade.php
index e66e9fdfdb,0557ce35a2..ba2a0b193b
--- a/resources/views/settings/general.blade.php
+++ b/resources/views/settings/general.blade.php
@@@ -66,9 -65,9 +66,9 @@@
trans('admin/settings/general.require_accept_signature')) }}
</div>
<div class="col-md-9">
- {{ Form::checkbox('require_accept_signature', '1', Input::old('require_accept_signature', $setting->require_accept_signature),array('class' => 'minimal')) }}
+ {{ Form::checkbox('require_accept_signature', '1', Request::old('require_accept_signature', $setting->require_accept_signature),array('class' => 'minimal')) }}
{{ trans('general.yes') }}
- {!! $errors->first('require_accept_signature', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('require_accept_signature', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{{ trans('admin/settings/general.require_accept_signature_help_text') }}</p>
</div>
</div>
@@@ -81,9 -80,9 +81,9 @@@
{{ Form::label('email_domain', trans('general.email_domain')) }}
</div>
<div class="col-md-9">
- {{ Form::text('email_domain', Input::old('email_domain', $setting->email_domain), array('class' => 'form-control','placeholder' => 'example.com')) }}
+ {{ Form::text('email_domain', Request::old('email_domain', $setting->email_domain), array('class' => 'form-control','placeholder' => 'example.com')) }}
<span class="help-block">{{ trans('general.email_domain_help') }}</span>
- {!! $errors->first('email_domain', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('email_domain', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -105,21 -104,12 +105,12 @@@
{{ Form::label('username_format', trans('general.username_format')) }}
</div>
<div class="col-md-9">
- {!! Form::username_format('username_format', Request::old('username_format', $setting->username_format), 'select2') !!}
- {!! $errors->first('username_format', '<span class="alert-msg">:message</span>') !!}
+ {!! Form::username_format('username_format', Input::old('username_format', $setting->username_format), 'select2') !!}
+ {!! $errors->first('username_format', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
- </div>
- </div>
-
-
- <!-- remote load -->
- <div class="form-group">
- <div class="col-md-3">
- {{ Form::label('load_remote', trans('admin/settings/general.load_remote_text')) }}
- </div>
- <div class="col-md-9">
- {{ Form::checkbox('load_remote', '1', Input::old('load_remote', $setting->load_remote),array('class' => 'minimal')) }}
- <p class="help-block">{{ trans('admin/settings/general.load_remote_help_text') }}</p>
+ <p class="help-block">
+ {{ trans('admin/settings/general.username_format_help') }}
+ </p>
</div>
</div>
@@@ -129,12 -119,10 +120,10 @@@
{{ Form::label('show_images_in_email', trans('admin/settings/general.show_images_in_email')) }}
</div>
<div class="col-md-9">
- {{ Form::checkbox('show_images_in_email', '1', Input::old('show_images_in_email', $setting->show_images_in_email),array('class' => 'minimal')) }}
+ {{ Form::checkbox('show_images_in_email', '1', Request::old('show_images_in_email', $setting->show_images_in_email),array('class' => 'minimal')) }}
{{ trans('general.yes') }}
- {!! $errors->first('show_images_in_email', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('show_images_in_email', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
- <p class="help-block">
- {{ trans('admin/settings/general.show_images_in_email_help') }}
- </p>
+
</div>
</div>
@@@ -144,9 -132,9 +133,9 @@@
{{ Form::label('unique_serial', trans('admin/settings/general.unique_serial')) }}
</div>
<div class="col-md-9">
- {{ Form::checkbox('unique_serial', '1', Input::old('unique_serial', $setting->unique_serial),array('class' => 'minimal')) }}
+ {{ Form::checkbox('unique_serial', '1', Request::old('unique_serial', $setting->unique_serial),array('class' => 'minimal')) }}
{{ trans('general.yes') }}
- {!! $errors->first('unique_serial', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('unique_serial', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">
{{ trans('admin/settings/general.unique_serial_help_text') }}
</p>
@@@ -171,9 -159,9 +160,9 @@@
{{ Form::label('thumbnail_max_h', trans('admin/settings/general.thumbnail_max_h')) }}
</div>
<div class="col-md-9">
- {{ Form::text('thumbnail_max_h', Input::old('thumbnail_max_h', $setting->thumbnail_max_h), array('class' => 'form-control','placeholder' => '50', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
+ {{ Form::text('thumbnail_max_h', Request::old('thumbnail_max_h', $setting->thumbnail_max_h), array('class' => 'form-control','placeholder' => '50', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
<p class="help-block">{{ trans('admin/settings/general.thumbnail_max_h_help') }}</p>
- {!! $errors->first('thumbnail_max_h', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('thumbnail_max_h', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -262,9 -250,9 +251,9 @@@
trans('admin/settings/general.show_archived_in_list')) }}
</div>
<div class="col-md-9">
- {{ Form::checkbox('show_archived_in_list', '1', Input::old('show_archived_in_list', $setting->show_archived_in_list),array('class' => 'minimal')) }}
+ {{ Form::checkbox('show_archived_in_list', '1', Request::old('show_archived_in_list', $setting->show_archived_in_list),array('class' => 'minimal')) }}
{{ trans('admin/settings/general.show_archived_in_list_text') }}
- {!! $errors->first('show_archived_in_list', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('show_archived_in_list', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -276,12 -278,26 +279,26 @@@
trans('admin/settings/general.show_in_model_list')) }}
</div>
<div class="col-md-9">
- {{ Form::checkbox('show_in_model_list[]', 'image', Request::old('show_in_model_list', $snipeSettings->modellistCheckedValue('image')),array('class' => 'minimal')) }} {{ trans('general.image') }} <br>
- {{ Form::checkbox('show_in_model_list[]', 'category', Request::old('show_in_model_list', $snipeSettings->modellistCheckedValue('category')),array('class' => 'minimal')) }} {{ trans('general.category') }} <br>
- {{ Form::checkbox('show_in_model_list[]', 'manufacturer', Request::old('show_in_model_list', $snipeSettings->modellistCheckedValue('manufacturer')),array('class' => 'minimal')) }} {{ trans('general.manufacturer') }} <br>
- {{ Form::checkbox('show_in_model_list[]', 'model_number', Request::old('show_in_model_list', $snipeSettings->modellistCheckedValue('model_number')),array('class' => 'minimal')) }} {{ trans('general.model_no') }}<br>
+ {{ Form::checkbox('show_in_model_list[]', 'image', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('image')),array('class' => 'minimal', 'aria-label'=>'show_in_model_list' )) }} {{ trans('general.image') }} <br>
+ {{ Form::checkbox('show_in_model_list[]', 'category', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('category')),array('class' => 'minimal', 'aria-label'=>'show_in_model_list' )) }} {{ trans('general.category') }} <br>
+ {{ Form::checkbox('show_in_model_list[]', 'manufacturer', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('manufacturer')),array('class' => 'minimal', 'aria-label'=>'show_in_model_list' )) }} {{ trans('general.manufacturer') }} <br>
+ {{ Form::checkbox('show_in_model_list[]', 'model_number', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('model_number')),array('class' => 'minimal', 'aria-label'=>'show_in_model_list' )) }} {{ trans('general.model_no') }}<br>
</div>
</div>
+
+ <!-- Depreciation method -->
+ <div class="form-group {{ $errors->has('depreciation_method') ? 'error' : '' }}">
+ <div class="col-md-3">
+ {{ Form::label('depreciation_method', trans('Depreciation method')) }}
+ </div>
+ <div class="col-md-9">
+ {{ Form::select('depreciation_method', array(
+ 'default' => 'Linear (default)',
+ 'half_1' => 'Half-year convention, always applied',
+ 'half_2' => 'Half-year convention, applied with condition',
+ ), Request::old('username_format', $setting->depreciation_method), ['class' =>'select2', 'style' => 'width: 80%']) }}
+ </div>
+ </div>
<!-- /.form-group -->
<!-- Privacy Policy Footer-->
diff --cc resources/views/settings/index.blade.php
index 0a9714a4a8,9007abd3c8..707811d63d
--- a/resources/views/settings/index.blade.php
+++ b/resources/views/settings/index.blade.php
@@@ -11,265 -11,181 +11,276 @@@
- <div class="row">
-
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.branding.index') }}" class="btn btn-lg btn-white"><i class="fa fa-copyright fa-3x"></i></a>
- <br>
- Branding
- <p class="help-block">Logo, Site Name</p>
+ <style>
+ #searchinput {
+ width: 200px;
+ }
+ #searchclear {
+ position: absolute;
+ right: 5px;
+ top: 0;
+ bottom: 0;
+ height: 14px;
+ margin: auto;
+ font-size: 14px;
+ cursor: pointer;
+ color: #ccc;
+ }
+ </style>
+
+ <div class="row" id="setting-list">
+
+ <!-- search filter box -->
+ <div class="col-md-3 col-md-offset-9 form-group">
+ <form onsubmit="return false;">
+ <div class="btn-group">
+ <input id="searchinput" name="search" type="search" class="search form-control" placeholder="Filter by setting keyword">
+ <span id="searchclear" class="fa fa-times" aria-hidden="true"></span>
+ <button type="submit" disabled style="display: none" aria-hidden="true"></button>
</div>
- </div>
+ </form>
</div>
+ <!--/ search filter box -->
+
+
+ <!-- search filter list -->
+ <div class="list">
+
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.branding.index') }}">
+ <i class="fa fa-copyright fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Branding</span>
+ <span class="keywords" aria-hidden="true" style="display:none">footer, logo, print, theme, skin, header, colors, color, css</span>
+ </a>
+ </h5>
+ <p class="help-block">Logo, Site Name</p>
+ </div>
+ </div>
+ </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.general.index') }}" class="btn btn-lg btn-white"><i class="fa fa-wrench fa-3x"></i></a>
- <br>
- General Settings
- <p class="help-block">Default EULA and more</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.general.index') }}">
+ <i class="fa fa-wrench fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name"> General Settings</span>
+ <span class="keywords" aria-hidden="true" style="display:none">company support, signature, acceptance, email format, username format, images, per page, thumbnail, eula, tos, dashboard, privacy</span>
+ </a>
+ </h5>
+ <p class="help-block">Default EULA and more</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.security.index') }}" class="btn btn-lg btn-white"><i class="fa fa-lock fa-3x"></i></a>
- <br>
- Security
- <p class="help-block">Two-factor, Password Restrictions</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.security.index') }}">
+ <i class="fa fa-lock fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Security</span>
+ <span class="keywords" aria-hidden="true" style="display:none">password, passwords, requirements, two factor, two-factor, common passwords, remote login, logout, authentication</span>
+ </a>
+ </h5>
+ <p class="help-block">Two-factor, Password Restrictions</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('groups.index') }}" class="btn btn-lg btn-white"><i class="fa fa-group fa-3x"></i></a>
- <br>
- Groups
- <p class="help-block">Account permission groups</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('groups.index') }}">
+ <i class="fa fa-group fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Groups</span>
+ <span class="keywords" aria-hidden="true" style="display:none">permissions, permission groups, authorization</span>
+ </a>
+ </h5>
+ <p class="help-block">Account permission groups</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.localization.index') }}" class="btn btn-lg btn-white"><i class="fa fa-globe fa-3x"></i></a>
- <br>
- Localization
- <p class="help-block">Language, date display</p>
-
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.localization.index') }}">
+ <i class="fa fa-globe fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Localization</span>
+ <span class="keywords" aria-hidden="true" style="display:none">localization, currency, local, locale, time zone, timezone, international, internatinalization, language, languages, translation</span>
+ </a>
+ </h5>
+ <p class="help-block">Language, date display</p>
+
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.alerts.index') }}" class="btn btn-lg btn-white"><i class="fa fa-bell fa-3x"></i></a>
- <br>
- Notifications
- <p class="help-block">Email alerts</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.alerts.index') }}">
+ <i class="fa fa-bell fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Notifications</span>
+ </a>
+ </h5>
+ <p class="help-block">Email alerts</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.slack.index') }}" class="btn btn-lg btn-white"><i class="fa fa-slack fa-3x"></i></a>
- <br>
- Slack
- <p class="help-block">Slack settings</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.slack.index') }}">
+ <i class="fa fa-slack fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Slack</span>
+ </a>
+ </h5>
+ <p class="help-block">Slack settings</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.asset_tags.index') }}" class="btn btn-lg btn-white"><i class="fa fa-list-ol fa-3x"></i></a>
- <br>
- Asset Tags
- <p class="help-block">Incrementing and prefixes</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.asset_tags.index') }}">
+ <i class="fa fa-list-ol fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Asset Tags</span>
+ </a>
+ </h5>
+ <p class="help-block">Incrementing and prefixes</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.barcodes.index') }}" class="btn btn-lg btn-white"><i class="fa fa-barcode fa-3x"></i></a>
- <br>
- Barcodes
- <p class="help-block">Barcode &amp; QR settings</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.barcodes.index') }}">
+ <i class="fa fa-barcode fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Barcodes</span>
+ </a>
+ </h5>
+ <p class="help-block">Barcode &amp; QR settings</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.labels.index') }}" class="btn btn-lg btn-white"><i class="fa fa-tags fa-3x"></i></a>
- <br>
- Labels
- <p class="help-block">Label sizes &amp; settings</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.labels.index') }}">
+ <i class="fa fa-tags fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Labels</span>
+ </a>
+ </h5>
+ <p class="help-block">Label sizes &amp; settings</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.ldap.index') }}" class="btn btn-lg btn-white"><i class="fa fa-sitemap fa-3x"></i></a>
- <br>
- LDAP
- <p class="help-block">LDAP/Active Directory</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.ldap.index') }}">
+ <i class="fa fa-sitemap fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">LDAP</span>
+ </a>
+ </h5>
+ <p class="help-block">LDAP/Active Directory</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.backups.index') }}" class="btn btn-lg btn-white"><i class="fa fa-cloud-download fa-3x"></i></a>
- <br>
- Backups
- <p class="help-block">Download files &amp; Data</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.backups.index') }}">
+ <i class="fa fa-cloud-download fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">Backups</span>
+ </a>
+ </h5>
+ <p class="help-block">Download files &amp; Data</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <a href="{{ route('settings.logins.index') }}" class="btn btn-lg btn-white"><i class="fa fa-sign-in fa-3x"></i></a>
+ <br>
+ Login Attempts
+ <p class="help-block">List of logins</p>
+ </div>
+ </div>
+ </div>
+
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.oauth.index') }}" class="btn btn-lg btn-white"><i class="fa fa-user-secret fa-3x"></i></a>
- <br>
- OAuth
- <p class="help-block">Oauth Endpoint Settings</p>
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.oauth.index') }}">
+ <i class="fa fa-user-secret fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">OAuth</span>
+ </a>
+ </h5>
+ <p class="help-block">Oauth Endpoint Settings</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- @if (config('app.debug')=== true)
- <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
- <div class="box box-default">
- <div class="box-body text-center">
- <a href="{{ route('settings.phpinfo.index') }}" class="btn btn-lg btn-white"><i class="fa fa-server fa-3x"></i></a>
- <br>
- PHP
- <p class="help-block">PHP System Info</p>
+ @if (config('app.debug')=== true)
+ <div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
+ <div class="box box-default">
+ <div class="box-body text-center">
+ <h5>
+ <a href="{{ route('settings.phpinfo.index') }}">
+ <i class="fa fa-server fa-4x" aria-hidden="true"></i>
+ <br><br>
+ <span class="name">PHP</span>
+ <span class="keywords" aria-hidden="true" style="display:none">phpinfo, system, info</span>
+ </a>
+ </h5>
+ <p class="help-block">PHP System Info</p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- @endif
+ @endif
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-danger">
diff --cc resources/views/settings/labels.blade.php
index 8ad11e1a85,dcdc28e274..a29ffe21e1
--- a/resources/views/settings/labels.blade.php
+++ b/resources/views/settings/labels.blade.php
@@@ -129,13 -129,14 +129,14 @@@
<div class="input-group-addon">{{ trans('admin/settings/general.bottom') }}</div>
</div>
<div class="input-group">
- {{ Form::text('labels_pmargin_right', Request::old('labels_pmargin_right', $setting->labels_pmargin_right), ['class' => 'form-control']) }}
- <div class="input-group-addon">{{ trans('admin/settings/general.right') }}</div>
+ {{ Form::text('labels_pmargin_left', Input::old('labels_pmargin_left', $setting->labels_pmargin_left), ['class' => 'form-control', 'aria-label'=>'labels_pmargin_left']) }}
+ <div class="input-group-addon">{{ trans('admin/settings/general.left') }}</div>
</div>
+
</div>
<div class="col-md-9 col-md-offset-3">
- {!! $errors->first('labels_width', '<span class="alert-msg">:message</span>') !!}
- {!! $errors->first('labels_height', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('labels_width', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
+ {!! $errors->first('labels_height', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --cc resources/views/settings/ldap.blade.php
index b57c64fe50,6dd094eb04..e8478b831c
--- a/resources/views/settings/ldap.blade.php
+++ b/resources/views/settings/ldap.blade.php
@@@ -63,50 -63,34 +63,34 @@@
{{ Form::label('ldap_integration', trans('admin/settings/general.ldap_integration')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::checkbox('ldap_enabled', '1', Input::old('ldap_enabled', $setting->ldap_enabled),['class' => 'minimal disabled', 'disabled' => 'disabled']) }}
- @else
- {{ Form::checkbox('ldap_enabled', '1', Input::old('ldap_enabled', $setting->ldap_enabled),array('class' => 'minimal')) }}
- @endcan
-
+ {{ Form::checkbox('ldap_enabled', '1', Request::old('ldap_enabled', $setting->ldap_enabled), ['class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }}
{{ trans('admin/settings/general.ldap_enabled') }}
- {!! $errors->first('ldap_enabled', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_enabled', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
- <!-- AD Flag -->
+ <!-- LDAP Password Sync -->
<div class="form-group">
<div class="col-md-3">
- {{ Form::label('is_ad', trans('admin/settings/general.ad')) }}
+ {{ Form::label('ldap_pw_sync', trans('admin/settings/general.ldap_pw_sync')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::checkbox('is_ad', '1', Input::old('is_ad', $setting->is_ad),['class' => 'minimal disabled', 'disabled' => 'disabled']) }}
- @else
- {{ Form::checkbox('is_ad', '1', Input::old('is_ad', $setting->is_ad),array('class' => 'minimal')) }}
- @endif
-
- {{ trans('admin/settings/general.is_ad') }}
+ {{ Form::checkbox('ldap_pw_sync', '1', Request::old('ldap_pw_sync', $setting->ldap_pw_sync),['class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }}
+ {{ trans('general.yes') }}
+ <p class="help-block">{{ trans('admin/settings/general.ldap_pw_sync_help') }}</p>
- {!! $errors->first('ldap_pw_sync', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('is_ad', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
- <!-- LDAP Password Sync -->
+ <!-- AD Flag -->
<div class="form-group">
<div class="col-md-3">
- {{ Form::label('ldap_pw_sync', trans('admin/settings/general.ldap_pw_sync')) }}
+ {{ Form::label('is_ad', trans('admin/settings/general.ad')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::checkbox('ldap_pw_sync', '1', Input::old('ldap_pw_sync', $setting->ldap_pw_sync),['class' => 'minimal disabled', 'disabled' => 'disabled']) }}
- @else
- {{ Form::checkbox('ldap_pw_sync', '1', Input::old('ldap_pw_sync', $setting->ldap_pw_sync),array('class' => 'minimal')) }}
- @endif
-
-
- {{ trans('general.yes') }}
- <p class="help-block">{{ trans('admin/settings/general.ldap_pw_sync_help') }}</p>
+ {{ Form::checkbox('is_ad', '1', Request::old('is_ad', $setting->is_ad),['class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }}
+ {{ trans('admin/settings/general.is_ad') }}
- {!! $errors->first('is_ad', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_pw_sync', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -116,13 -100,9 +100,9 @@@
{{ Form::label('ad_domain', trans('admin/settings/general.ad_domain')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ad_domain', Input::old('ad_domain', $setting->ad_domain), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'example.com')) }}
- @else
- {{ Form::text('ad_domain', Input::old('ad_domain', $setting->ad_domain), array('class' => 'form-control','placeholder' => 'example.com')) }}
- @endif
+ {{ Form::text('ad_domain', Request::old('ad_domain', $setting->ad_domain), ['class' => 'form-control','placeholder' => 'example.com', $setting->demoMode]) }}
<p class="help-block">{{ trans('admin/settings/general.ad_domain_help') }}</p>
- {!! $errors->first('ad_domain', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ad_domain', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div><!-- AD Domain -->
@@@ -132,13 -125,9 +125,9 @@@
{{ Form::label('ldap_server', trans('admin/settings/general.ldap_server')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_server', Input::old('ldap_server', $setting->ldap_server), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'ldap://ldap.example.com')) }}
- @else
- {{ Form::text('ldap_server', Input::old('ldap_server', $setting->ldap_server), array('class' => 'form-control','placeholder' => 'ldap://ldap.example.com')) }}
- @endif
+ {{ Form::text('ldap_server', Request::old('ldap_server', $setting->ldap_server), ['class' => 'form-control','placeholder' => 'ldap://ldap.example.com', $setting->demoMode]) }}
<p class="help-block">{{ trans('admin/settings/general.ldap_server_help') }}</p>
- {!! $errors->first('ldap_server', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_server', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div><!-- LDAP Server -->
@@@ -148,15 -137,9 +137,9 @@@
{{ Form::label('ldap_tls', trans('admin/settings/general.ldap_tls')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::checkbox('ldap_tls', '1', Input::old('ldap_tls', $setting->ldap_tls),['class' => 'minimal disabled', 'disabled' => 'disabled']) }}
- @else
- {{ Form::checkbox('ldap_tls', '1', Input::old('ldap_tls', $setting->ldap_tls),array('class' => 'minimal')) }}
- @endif
-
-
+ {{ Form::checkbox('ldap_tls', '1', Request::old('ldap_tls', $setting->ldap_tls),['class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }}
{{ trans('admin/settings/general.ldap_tls_help') }}
- {!! $errors->first('ldap_tls', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_tls', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -166,15 -149,9 +149,9 @@@
{{ Form::label('ldap_server_cert_ignore', trans('admin/settings/general.ldap_server_cert')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::checkbox('ldap_server_cert_ignore', '1', Input::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),['class' => 'minimal disabled', 'disabled' => 'disabled']) }}
- @else
- {{ Form::checkbox('ldap_server_cert_ignore', '1', Input::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),array('class' => 'minimal')) }}
- @endif
-
-
+ {{ Form::checkbox('ldap_server_cert_ignore', '1', Request::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),['class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }}
{{ trans('admin/settings/general.ldap_server_cert_ignore') }}
- {!! $errors->first('ldap_server_cert_ignore', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_server_cert_ignore', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{{ trans('admin/settings/general.ldap_server_cert_help') }}</p>
</div>
</div>
@@@ -185,12 -162,8 +162,8 @@@
{{ Form::label('ldap_uname', trans('admin/settings/general.ldap_uname')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_uname', Input::old('ldap_uname', $setting->ldap_uname), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '[email protected]')) }}
- @else
- {{ Form::text('ldap_uname', Input::old('ldap_uname', $setting->ldap_uname), array('class' => 'form-control','placeholder' => '[email protected]')) }}
- @endif
+ {{ Form::text('ldap_uname', Request::old('ldap_uname', $setting->ldap_uname), ['class' => 'form-control','placeholder' => '[email protected]', $setting->demoMode]) }}
- {!! $errors->first('ldap_uname', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_uname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -200,12 -173,8 +173,8 @@@
{{ Form::label('ldap_pword', trans('admin/settings/general.ldap_pword')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords'))
- {{ Form::password('ldap_pword', array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'binduserpassword')) }}
- @else
- {{ Form::password('ldap_pword', array('class' => 'form-control','placeholder' => 'binduserpassword')) }}
- @endif
+ {{ Form::password('ldap_pword', ['class' => 'form-control','placeholder' => 'binduserpassword', $setting->demoMode]) }}
- {!! $errors->first('ldap_pword', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_pword', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -215,12 -184,8 +184,8 @@@
{{ Form::label('ldap_basedn', trans('admin/settings/general.ldap_basedn')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_basedn', Input::old('ldap_basedn', $setting->ldap_basedn), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'cn=users/authorized,dc=example,dc=com')) }}
- @else
- {{ Form::text('ldap_basedn', Input::old('ldap_basedn', $setting->ldap_basedn), array('class' => 'form-control','placeholder' => 'cn=users/authorized,dc=example,dc=com')) }}
- @endif
+ {{ Form::text('ldap_basedn', Request::old('ldap_basedn', $setting->ldap_basedn), ['class' => 'form-control', 'placeholder' => 'cn=users/authorized,dc=example,dc=com', $setting->demoMode]) }}
- {!! $errors->first('ldap_basedn', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_basedn', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -230,12 -195,8 +195,8 @@@
{{ Form::label('ldap_filter', trans('admin/settings/general.ldap_filter')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_filter', Input::old('ldap_filter', $setting->ldap_filter), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '&(cn=*)')) }}
- @else
- {{ Form::text('ldap_filter', Input::old('ldap_filter', $setting->ldap_filter), array('class' => 'form-control','placeholder' => '&(cn=*)')) }}
- @endif
+ {{ Form::text('ldap_filter', Request::old('ldap_filter', $setting->ldap_filter), ['class' => 'form-control','placeholder' => '&(cn=*)', $setting->demoMode]) }}
- {!! $errors->first('ldap_filter', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_filter', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -245,12 -206,8 +206,8 @@@
{{ Form::label('ldap_username_field', trans('admin/settings/general.ldap_username_field')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_username_field', Input::old('ldap_username_field', $setting->ldap_username_field), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'samaccountname')) }}
- @else
- {{ Form::text('ldap_username_field', Input::old('ldap_username_field', $setting->ldap_username_field), array('class' => 'form-control','placeholder' => 'samaccountname')) }}
- @endif
+ {{ Form::text('ldap_username_field', Request::old('ldap_username_field', $setting->ldap_username_field), ['class' => 'form-control','placeholder' => 'samaccountname', $setting->demoMode]) }}
- {!! $errors->first('ldap_username_field', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_username_field', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -260,12 -217,8 +217,8 @@@
{{ Form::label('ldap_lname_field', trans('admin/settings/general.ldap_lname_field')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_lname_field', Input::old('ldap_lname_field', $setting->ldap_lname_field), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'sn')) }}
- @else
- {{ Form::text('ldap_lname_field', Input::old('ldap_lname_field', $setting->ldap_lname_field), array('class' => 'form-control','placeholder' => 'sn')) }}
- @endif
+ {{ Form::text('ldap_lname_field', Request::old('ldap_lname_field', $setting->ldap_lname_field), ['class' => 'form-control','placeholder' => 'sn', $setting->demoMode]) }}
- {!! $errors->first('ldap_lname_field', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_lname_field', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -275,12 -228,8 +228,8 @@@
{{ Form::label('ldap_fname_field', trans('admin/settings/general.ldap_fname_field')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_fname_field', Input::old('ldap_fname_field', $setting->ldap_fname_field), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'givenname')) }}
- @else
- {{ Form::text('ldap_fname_field', Input::old('ldap_fname_field', $setting->ldap_fname_field), array('class' => 'form-control','placeholder' => 'givenname')) }}
- @endif
+ {{ Form::text('ldap_fname_field', Request::old('ldap_fname_field', $setting->ldap_fname_field), ['class' => 'form-control', 'placeholder' => 'givenname', $setting->demoMode]) }}
- {!! $errors->first('ldap_fname_field', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_fname_field', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -290,12 -239,8 +239,8 @@@
{{ Form::label('ldap_auth_filter_query', trans('admin/settings/general.ldap_auth_filter_query')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_auth_filter_query', Input::old('ldap_auth_filter_query', $setting->ldap_auth_filter_query), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '"uid="')) }}
- @else
- {{ Form::text('ldap_auth_filter_query', Input::old('ldap_auth_filter_query', $setting->ldap_auth_filter_query), array('class' => 'form-control','placeholder' => '"uid="')) }}
- @endif
+ {{ Form::text('ldap_auth_filter_query', Request::old('ldap_auth_filter_query', $setting->ldap_auth_filter_query), ['class' => 'form-control','placeholder' => '"uid="', $setting->demoMode]) }}
- {!! $errors->first('ldap_auth_filter_query', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_auth_filter_query', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -305,12 -250,8 +250,8 @@@
{{ Form::label('ldap_version', trans('admin/settings/general.ldap_version')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_version', Input::old('ldap_version', $setting->ldap_version), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '3')) }}
- @else
- {{ Form::text('ldap_version', Input::old('ldap_version', $setting->ldap_version), array('class' => 'form-control','placeholder' => '3')) }}
- @endif
+ {{ Form::text('ldap_version', Request::old('ldap_version', $setting->ldap_version), ['class' => 'form-control','placeholder' => '3', $setting->demoMode]) }}
- {!! $errors->first('ldap_version', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_version', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -320,12 -261,8 +261,8 @@@
{{ Form::label('ldap_active_flag', trans('admin/settings/general.ldap_active_flag')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_active_flag', Input::old('ldap_active_flag', $setting->ldap_active_flag), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '')) }}
- @else
- {{ Form::text('ldap_active_flag', Input::old('ldap_active_flag', $setting->ldap_active_flag), array('class' => 'form-control','placeholder' => '')) }}
- @endif
+ {{ Form::text('ldap_active_flag', Request::old('ldap_active_flag', $setting->ldap_active_flag), ['class' => 'form-control','placeholder' => '', $setting->demoMode]) }}
- {!! $errors->first('ldap_active_flag', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_active_flag', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -335,12 -272,8 +272,8 @@@
{{ Form::label('ldap_emp_num', trans('admin/settings/general.ldap_emp_num')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_emp_num', Input::old('ldap_emp_num', $setting->ldap_emp_num), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '')) }}
- @else
- {{ Form::text('ldap_emp_num', Input::old('ldap_emp_num', $setting->ldap_emp_num), array('class' => 'form-control','placeholder' => '')) }}
- @endif
+ {{ Form::text('ldap_emp_num', Request::old('ldap_emp_num', $setting->ldap_emp_num), ['class' => 'form-control','placeholder' => '', $setting->demoMode]) }}
- {!! $errors->first('ldap_emp_num', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_emp_num', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -350,12 -283,8 +283,8 @@@
{{ Form::label('ldap_email', trans('admin/settings/general.ldap_email')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('ldap_email', Input::old('ldap_email', $setting->ldap_email), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '')) }}
- @else
- {{ Form::text('ldap_email', Input::old('ldap_email', $setting->ldap_email), array('class' => 'form-control','placeholder' => '')) }}
- @endif
+ {{ Form::text('ldap_email', Request::old('ldap_email', $setting->ldap_email), ['class' => 'form-control','placeholder' => '', $setting->demoMode]) }}
- {!! $errors->first('ldap_email', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_email', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -417,13 -317,9 +317,9 @@@
{{ Form::label('custom_forgot_pass_url', trans('admin/settings/general.custom_forgot_pass_url')) }}
</div>
<div class="col-md-9">
- @if (config('app.lock_passwords')===true)
- {{ Form::text('custom_forgot_pass_url', Input::old('custom_forgot_pass_url', $setting->custom_forgot_pass_url), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'https://my.ldapserver-forgotpass.com')) }}
- @else
- {{ Form::text('custom_forgot_pass_url', Input::old('custom_forgot_pass_url', $setting->custom_forgot_pass_url), array('class' => 'form-control','placeholder' => 'https://my.ldapserver-forgotpass.com')) }}
- @endif
+ {{ Form::text('custom_forgot_pass_url', Request::old('custom_forgot_pass_url', $setting->custom_forgot_pass_url), ['class' => 'form-control','placeholder' => 'https://my.ldapserver-forgotpass.com', $setting->demoMode]) }}
<p class="help-block">{{ trans('admin/settings/general.custom_forgot_pass_url_help') }}</p>
- {!! $errors->first('custom_forgot_pass_url', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('custom_forgot_pass_url', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div><!-- LDAP Server -->
@@@ -452,143 -345,111 +345,118 @@@
@stop
- @section('moar_scripts')
- <script nonce="{{ csrf_token() }}">
- $("#ldaptest").click(function(){
- $("#ldaptestrow").removeClass('text-success');
- $("#ldaptestrow").removeClass('text-danger');
- $("#ldapteststatus").html('');
- $("#ldaptesticon").html('<i class="fa fa-spinner spin"></i> Testing LDAP Binding...');
- $.ajax({
- url: '{{ route('api.settings.ldaptest') }}',
- type: 'GET',
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: {},
- dataType: 'json',
-
- success: function (data) {
- $("#ldaptesticon").html('');
- $("#ldapteststatus").addClass('text-success');
- $("#ldapteststatus").html('<i class="fa fa-check text-success"></i> Connection to LDAP server established!');
- },
-
- error: function (data) {
-
- if (data.responseJSON) {
- var bind_errors = data.responseJSON.message;
- } else {
- var bind_errors;
- }
-
- var bind_error_text;
-
-
- $("#ldaptesticon").html('');
- $("#ldapteststatus").addClass('text-danger');
- $("#ldaptesticon").html('<i class="fa fa-exclamation-triangle text-danger"></i>');
-
- if (data.status == 500) {
- $('#ldapteststatus').html('500 Server Error');
+ @push('js')
+ <script nonce="{{ csrf_token() }}">
+
+ /**
+ * Check to see if is_ad is checked, if not disable the ad_domain field
+ */
+ $(function() {
+ if( $('#is_ad').prop('checked') === false) {
+ $('#ad_domain').prop('disabled', 'disabled');
+ } else {
+ $('#ldap_server').prop('disabled', 'disabled');
+ }
+ });
+
+ /**
+ * Toggle the server info based on the is_ad checkbox
+ */
+ $('#is_ad').on('ifClicked', function(){
+ $('#ad_domain').toggleDisabled();
+ $('#ldap_server').toggleDisabled();
+ });
+
+
+ /**
+ * Test the LDAP connection settings
+ */
+ $("#ldaptest").click(function () {
+ $("#ldapad_test_results").removeClass('hidden text-success text-danger');
+ $("#ldapad_test_results").html('');
+ $("#ldapad_test_results").html('<i class="fa fa-spinner spin"></i> Testing LDAP Connection, Binding & Query ...');
+ $.ajax({
+ url: '{{ route('api.settings.ldaptest') }}',
+ type: 'GET',
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: {},
+ dataType: 'json',
+
+ success: function (data) {
+ $("#ldapad_test_results").html('');
+ let html = buildLdapTestResults(data)
+ $("#ldapad_test_results").html(
+ html
+ );
+ },
+
+ error: function (data) {
+ $("#ldapad_test_results").html('');
+ } else if (data.status == 400) {
+
- if (typeof bind_errors !='string') {
+ $("#ldapad_test_results").addClass('text-danger');
+
- for (i = 0; i < bind_errors.length; i++) {
- if (bind_errors[i]) {
- bind_error_text += '<li>Error: ' + bind_errors[i];
+ let errorIcon = '<i class="fa fa-exclamation-triangle text-danger"></i>' + ' ';
+ if (data.status == 500) {
+ $('#ldapad_test_results').html(errorIcon + '500 Server Error');
+ }
+
+ }
+
- } else {
- bind_error_text = bind_errors;
- }
- $('#ldapteststatus').html(bind_error_text);
- } else {
- $('#ldapteststatus').html(data.responseText.message);
+ } else if (data.status == 400) {
+ let errorMessage = '';
+ if( typeof data.responseJSON.user_sync !== 'undefined') {
+ errorMessage = data.responseJSON.user_sync.message;
}
- }
-
-
- });
- });
-
- $("#ldaptestlogin").click(function(){
- $("#ldaptestloginrow").removeClass('text-success');
- $("#ldaptestloginrow").removeClass('text-danger');
- $("#ldaptestloginstatus").removeClass('text-danger');
- $("#ldaptestloginstatus").html('');
- $("#ldaptestloginicon").html('<i class="fa fa-spinner spin"></i> Testing LDAP Authentication...');
- $.ajax({
- url: '{{ route('api.settings.ldaptestlogin') }}',
- type: 'POST',
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: {
- 'ldaptest_user': $('#ldaptest_user').val(),
- 'ldaptest_password': $('#ldaptest_password').val()
- },
-
- dataType: 'json',
-
- success: function (data) {
- $("#ldaptestloginicon").html('');
- $("#ldaptestloginrow").addClass('text-success');
- $("#ldaptestloginstatus").addClass('text-success');
- $("#ldaptestloginstatus").html('<i class="fa fa-check text-success"></i> User authenticated against LDAP successfully!');
- },
-
- error: function (data) {
-
- if (data.responseJSON) {
- var errors = data.responseJSON.message;
- } else {
- var errors;
- }
-
- var error_text = '';
-
- $("#ldaptestloginicon").html('');
- $("#ldaptestloginstatus").addClass('text-danger');
- $("#ldaptestloginicon").html('<i class="fa fa-exclamation-triangle text-danger"></i>');
-
- if (data.status == 500) {
- $('#ldaptestloginstatus').html('500 Server Error');
- } else if (data.status == 400) {
-
- if (typeof errors !='string') {
-
- for (i = 0; i < errors.length; i++) {
- if (errors[i]) {
- error_text += '<li>Error: ' + errors[i];
- }
-
- }
-
- } else {
- error_text = errors;
- }
-
- $('#ldaptestloginstatus').html(error_text);
-
- } else {
- $('#ldaptestloginstatus').html(data.responseText.message);
+ if( typeof data.responseJSON.message !== 'undefined') {
+ errorMessage = data.responseJSON.message;
}
+ $('#ldapad_test_results').html(errorIcon + errorMessage);
+ } else {
+ $('#ldapad_test_results').html(errorIcon + data.responseText.message);
}
-
-
-
-
- });
+ }
});
-
-
-
- </script>
-
- @stop
+ });
+
+ /**
+ * Build the results html table
+ */
+ function buildLdapTestResults(results) {
+ let html = '<ul style="list-style: none;padding-left: 5px;">'
+ html += '<li class="text-success"><i class="fa fa-check" aria-hidden="true"></i> ' + results.login.message + ' </li>'
+ html += '<li class="text-success"><i class="fa fa-check" aria-hidden="true"></i> ' + results.bind.message + ' </li>'
+ html += '</ul>'
+ html += '<div>A sample of 10 users returned from the LDAP server based on your settings:</div>'
+ html += '<table class="table table-bordered table-condensed" style="background-color: #fff">'
+ html += buildLdapResultsTableHeader()
+ html += buildLdapResultsTableBody(results.user_sync.users)
+ html += '<table>'
+ return html;
+ }
+
+ function buildLdapResultsTableHeader(user)
+ {
+ var keys = ['Employee Number', 'Username', 'First Name', 'Last Name','Email']
+ let header = '<thead><tr>'
+ for (var i in keys) {
+ header += '<th>' + keys[i] + '</th>'
+ }
+ header += "</tr></thead>"
+ return header;
+ }
+
+ function buildLdapResultsTableBody(users)
+ {
+ let body = '<tbody>'
+ for (var i in users) {
+ body += '<tr><td>' + users[i].employee_number + '</td><td>' + users[i].username + '</td><td>' + users[i].firstname + '</td><td>' + users[i].lastname + '</td><td>' + users[i].email + '</td></tr>'
+ }
+ body += "</tbody>"
+ return body;
+ }
+ </script>
+ @endpush
diff --cc resources/views/settings/localization.blade.php
index 40c98bd998,de0cbaf919..2688fba94c
--- a/resources/views/settings/localization.blade.php
+++ b/resources/views/settings/localization.blade.php
@@@ -46,9 -46,9 +46,9 @@@
{{ Form::label('site_name', trans('admin/settings/general.default_language')) }}
</div>
<div class="col-md-9">
- {!! Form::locales('locale', Input::old('locale', $setting->locale), 'select2') !!}
+ {!! Form::locales('locale', Request::old('locale', $setting->locale), 'select2') !!}
- {!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -58,11 -58,11 +58,11 @@@
{{ Form::label('time_display_format', trans('general.time_and_date_display')) }}
</div>
<div class="col-md-9">
- {!! Form::date_display_format('date_display_format', Input::old('date_display_format', $setting->date_display_format), 'select2') !!}
+ {!! Form::date_display_format('date_display_format', Request::old('date_display_format', $setting->date_display_format), 'select2') !!}
- {!! Form::time_display_format('time_display_format', Input::old('time_display_format', $setting->time_display_format), 'select2') !!}
+ {!! Form::time_display_format('time_display_format', Request::old('time_display_format', $setting->time_display_format), 'select2') !!}
- {!! $errors->first('time_display_format', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('time_display_format', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --cc resources/views/settings/purge-form.blade.php
index 23ec8bfe4a,a0e7ed5a25..93c9cf648b
--- a/resources/views/settings/purge-form.blade.php
+++ b/resources/views/settings/purge-form.blade.php
@@@ -30,11 -30,11 +30,11 @@@
</div>
<div class="col-md-9{{ $errors->has('confirm_purge') ? 'error' : '' }}">
@if (config('app.lock_passwords')===true)
- {{ Form::text('confirm_purge', Input::old('confirm_purge'), array('class' => 'form-control', 'disabled'=>'disabled')) }}
+ {{ Form::text('confirm_purge', Request::old('confirm_purge'), array('class' => 'form-control', 'disabled'=>'disabled')) }}
@else
- {{ Form::text('confirm_purge', Input::old('confirm_purge'), array('class' => 'form-control')) }}
+ {{ Form::text('confirm_purge', Request::old('confirm_purge'), array('class' => 'form-control')) }}
@endif
- {!! $errors->first('ldap_version', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('ldap_version', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
<div class="box-footer text-right">
diff --cc resources/views/settings/security.blade.php
index bc57586054,14bb339bd9..95869f5a1a
--- a/resources/views/settings/security.blade.php
+++ b/resources/views/settings/security.blade.php
@@@ -60,9 -60,9 +60,9 @@@
{{ Form::label('pwd_secure_min', trans('admin/settings/general.pwd_secure_min')) }}
</div>
<div class="col-md-9">
- {{ Form::text('pwd_secure_min', Input::old('pwd_secure_min', $setting->pwd_secure_min), array('class' => 'form-control', 'style'=>'width: 50px;')) }}
+ {{ Form::text('pwd_secure_min', Request::old('pwd_secure_min', $setting->pwd_secure_min), array('class' => 'form-control', 'style'=>'width: 50px;')) }}
- {!! $errors->first('pwd_secure_min', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('pwd_secure_min', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">
{{ trans('admin/settings/general.pwd_secure_min_help') }}
</p>
@@@ -135,11 -133,18 +135,18 @@@
<p class="help-block">
{{ trans('admin/settings/general.login_remote_user_enabled_help') }}
</p>
+ <!-- Use custom remote user header name -->
+ {{ Form::label('login_remote_user_header_name', trans('admin/settings/general.login_remote_user_header_name_text')) }}
+ {{ Form::text('login_remote_user_header_name', Request::old('login_remote_user_header_name', $setting->login_remote_user_header_name),array('class' => 'form-control')) }}
+ {!! $errors->first('login_remote_user_header_name', '<span class="alert-msg">:message</span>') !!}
+ <p class="help-block">
+ {{ trans('admin/settings/general.login_remote_user_header_name_help') }}
+ </p>
<!-- Custom logout url to redirect to authentication provider -->
{{ Form::label('login_remote_user_custom_logout_url', trans('admin/settings/general.login_remote_user_custom_logout_url_text')) }}
- {{ Form::text('login_remote_user_custom_logout_url', Request::old('login_remote_user_custom_logout_url', $setting->login_remote_user_custom_logout_url),array('class' => 'form-control')) }}
+ {{ Form::text('login_remote_user_custom_logout_url', Input::old('login_remote_user_custom_logout_url', $setting->login_remote_user_custom_logout_url),array('class' => 'form-control', 'aria-label'=>'login_remote_user_custom_logout_url')) }}
- {!! $errors->first('login_remote_user_custom_logout_url', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('login_remote_user_custom_logout_url', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">
{{ trans('admin/settings/general.login_remote_user_custom_logout_url_help') }}
</p>
diff --cc resources/views/settings/slack.blade.php
index 64df80b531,18c221b881..6ad51eef56
--- a/resources/views/settings/slack.blade.php
+++ b/resources/views/settings/slack.blade.php
@@@ -55,13 -55,13 +55,13 @@@
<div class="col-md-3">
{{ Form::label('slack_endpoint', trans('admin/settings/general.slack_endpoint')) }}
</div>
- <div class="col-md-9">
+ <div class="col-md-8">
@if (config('app.lock_passwords')===true)
- {{ Form::text('slack_endpoint', Input::old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX')) }}
+ {{ Form::text('slack_endpoint', Request::old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX')) }}
@else
- {{ Form::text('slack_endpoint', Input::old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX')) }}
+ {{ Form::text('slack_endpoint', Request::old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX')) }}
@endif
- {!! $errors->first('slack_endpoint', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('slack_endpoint', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -70,13 -70,13 +70,13 @@@
<div class="col-md-3">
{{ Form::label('slack_channel', trans('admin/settings/general.slack_channel')) }}
</div>
- <div class="col-md-9">
+ <div class="col-md-8">
@if (config('app.lock_passwords')===true)
- {{ Form::text('slack_channel', Input::old('slack_channel', $setting->slack_channel), array('class' => 'form-control','disabled'=>'disabled','placeholder' => '#IT-Ops')) }}
+ {{ Form::text('slack_channel', Request::old('slack_channel', $setting->slack_channel), array('class' => 'form-control','disabled'=>'disabled','placeholder' => '#IT-Ops')) }}
@else
- {{ Form::text('slack_channel', Input::old('slack_channel', $setting->slack_channel), array('class' => 'form-control','placeholder' => '#IT-Ops')) }}
+ {{ Form::text('slack_channel', Request::old('slack_channel', $setting->slack_channel), array('class' => 'form-control','placeholder' => '#IT-Ops')) }}
@endif
- {!! $errors->first('slack_channel', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('slack_channel', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -85,13 -85,13 +85,13 @@@
<div class="col-md-3">
{{ Form::label('slack_botname', trans('admin/settings/general.slack_botname')) }}
</div>
- <div class="col-md-9">
+ <div class="col-md-8">
@if (config('app.lock_passwords')===true)
- {{ Form::text('slack_botname', Input::old('slack_botname', $setting->slack_botname), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'Snipe-Bot')) }}
+ {{ Form::text('slack_botname', Request::old('slack_botname', $setting->slack_botname), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'Snipe-Bot')) }}
@else
- {{ Form::text('slack_botname', Input::old('slack_botname', $setting->slack_botname), array('class' => 'form-control','placeholder' => 'Snipe-Bot')) }}
+ {{ Form::text('slack_botname', Request::old('slack_botname', $setting->slack_botname), array('class' => 'form-control','placeholder' => 'Snipe-Bot')) }}
@endif
- {!! $errors->first('slack_botname', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('slack_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --cc resources/views/setup/user.blade.php
index 430790534b,8efd03a49e..3543bde836
--- a/resources/views/setup/user.blade.php
+++ b/resources/views/setup/user.blade.php
@@@ -20,9 -20,9 +20,9 @@@ Create a User :
<div class="row">
<div class="form-group col-lg-12 required {{ $errors->has('site_name') ? 'error' : '' }}">
{{ Form::label('site_name', trans('general.site_name')) }}
- {{ Form::text('site_name', Input::old('site_name'), array('class' => 'form-control','placeholder' => 'Snipe-IT Asset Management')) }}
+ {{ Form::text('site_name', Request::old('site_name'), array('class' => 'form-control','placeholder' => 'Snipe-IT Asset Management')) }}
- {!! $errors->first('site_name', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('site_name', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -31,17 -31,17 +31,17 @@@
<!-- Language -->
<div class="form-group col-lg-6{{ (\App\Helpers\Helper::checkIfRequired(\App\Models\User::class, 'default_language')) ? ' required' : '' }} {{$errors->has('default_language') ? 'error' : ''}}">
{{ Form::label('locale', trans('admin/settings/general.default_language')) }}
- {!! Form::locales('locale', Input::old('locale', "en"), 'select2') !!}
+ {!! Form::locales('locale', Request::old('locale', "en"), 'select2') !!}
- {!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
<!-- Currency -->
<div class="form-group col-lg-6{{ (\App\Helpers\Helper::checkIfRequired(\App\Models\User::class, 'default_currency')) ? ' required' : '' }} {{$errors->has('default_currency') ? 'error' : ''}}">
{{ Form::label('default_currency', trans('admin/settings/general.default_currency')) }}
- {{ Form::text('default_currency', Input::old('default_currency'), array('class' => 'form-control','placeholder' => 'USD', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
+ {{ Form::text('default_currency', Request::old('default_currency'), array('class' => 'form-control','placeholder' => 'USD', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
- {!! $errors->first('default_currency', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('default_currency', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -74,16 -74,16 +74,16 @@@
<div class="form-group col-lg-6{{ (\App\Helpers\Helper::checkIfRequired(\App\Models\User::class, 'auto_increment_prefix')) ? ' required' : '' }} {{ $errors->has('auto_increment_prefix') ? 'error' : '' }}">
{{ Form::label('auto_increment_prefix', trans('admin/settings/general.auto_increment_prefix')) }}
- {{ Form::text('auto_increment_prefix', Input::old('auto_increment_prefix'), array('class' => 'form-control')) }}
+ {{ Form::text('auto_increment_prefix', Request::old('auto_increment_prefix'), array('class' => 'form-control')) }}
- {!! $errors->first('auto_increment_prefix', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('auto_increment_prefix', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
<div class="form-group col-lg-6{{ (\App\Helpers\Helper::checkIfRequired(\App\Models\User::class, 'zerofill_count')) ? ' required' : '' }} {{ $errors->has('zerofill_count') ? 'error' : '' }}">
{{ Form::label('zerofill_count', trans('admin/settings/general.zerofill_count')) }}
- {{ Form::text('zerofill_count', Input::old('zerofill_count', 5), array('class' => 'form-control')) }}
+ {{ Form::text('zerofill_count', Request::old('zerofill_count', 5), array('class' => 'form-control')) }}
- {!! $errors->first('zerofill_count', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('zerofill_count', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -92,10 -92,10 +92,10 @@@
<div class="row">
<div class="form-group col-lg-6 required {{ $errors->has('email_domain') ? 'error' : '' }}">
{{ Form::label('email_domain', trans('general.email_domain')) }}
- {{ Form::text('email_domain', Input::old('email_domain'), array('class' => 'form-control','placeholder' => 'example.com')) }}
+ {{ Form::text('email_domain', Request::old('email_domain'), array('class' => 'form-control','placeholder' => 'example.com')) }}
<span class="help-block">{{ trans('general.email_domain_help') }}</span>
- {!! $errors->first('email_domain', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('email_domain', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
<!-- email format -->
diff --cc resources/views/statuslabels/edit.blade.php
index 93b7db7e1a,6dbcd3fb6d..cd9bc661e2
--- a/resources/views/statuslabels/edit.blade.php
+++ b/resources/views/statuslabels/edit.blade.php
@@@ -36,10 -35,10 +35,10 @@@
{{ Form::label('color', trans('admin/statuslabels/table.color'), ['class' => 'col-md-3 control-label']) }}
<div class="col-md-2">
<div class="input-group color">
- {{ Form::text('color', Input::old('color', $item->color), array('class' => 'form-control', 'style' => 'width: 100px;', 'maxlength'=>'10')) }}
+ {{ Form::text('color', Request::old('color', $item->color), array('class' => 'form-control', 'style' => 'width: 100px;', 'maxlength'=>'10')) }}
<div class="input-group-addon"><i></i></div>
</div><!-- /.input group -->
- {!! $errors->first('header_color', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('header_color', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
diff --cc resources/views/users/edit.blade.php
index e15a22ce80,c70eb3185f..93500ef48e
--- a/resources/views/users/edit.blade.php
+++ b/resources/views/users/edit.blade.php
@@@ -230,12 -245,11 +246,12 @@@
<input
class="form-control"
type="text"
+ aria-label="employee_num"
name="employee_num"
id="employee_num"
- value="{{ Input::old('employee_num', $user->employee_num) }}"
+ value="{{ Request::old('employee_num', $user->employee_num) }}"
/>
- {!! $errors->first('employee_num', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('employee_num', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -249,9 -263,9 +265,9 @@@
type="text"
name="jobtitle"
id="jobtitle"
- value="{{ Input::old('jobtitle', $user->jobtitle) }}"
+ value="{{ Request::old('jobtitle', $user->jobtitle) }}"
/>
- {!! $errors->first('jobtitle', '<span class="alert-msg">:message</span>') !!}
+ {!! $errors->first('jobtitle', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@@ -350,9 -364,9 +366,9 @@@
</div>
@elseif ($user->id === Auth::user()->id)
<div class="icheckbox disabled" style="padding-left: 10px;">
- <input type="checkbox" value="1" name="activated" class="minimal disabled" checked="checked" disabled="disabled">
+ <input type="checkbox" value="1" name="activated" class="minimal disabled" {{ (old('activated', $user->activated)) == '1' ? ' checked="checked"' : '' }} disabled="disabled">
<!-- this is necessary because the field is disabled and will reset -->
- <input type="hidden" name="activated" value="1">
+ <input type="hidden" name="activated" value="1" aria-label="activated">
{{ trans('admin/users/general.activated_help_text') }}
<p class="help-block">{{ trans('admin/users/general.activated_disabled_help_text') }}</p>
</div>
diff --cc resources/views/users/index.blade.php
index 4760077cf8,4e80452405..56e606b041
--- a/resources/views/users/index.blade.php
+++ b/resources/views/users/index.blade.php
@@@ -44,13 -44,13 +44,14 @@@
'class' => 'form-inline',
'id' => 'bulkForm']) }}
- @if (Input::get('status')!='deleted')
+ @if (Request::get('status')!='deleted')
@can('delete', \App\Models\User::class)
<div id="toolbar">
- <select name="bulk_actions" class="form-control select2" style="width: 200px;">
+ <label for="bulk_actions" class="sr-only">Bulk Actions</label>
+ <select name="bulk_actions" class="form-control select2" style="width: 200px;" aria-label="bulk_actions">
<option value="delete">Bulk Checkin &amp; Delete</option>
<option value="edit">Bulk Edit</option>
+ <option value="bulkpasswordreset">Send Password Reset</option>
</select>
<button class="btn btn-default" id="bulkEdit" disabled>Go</button>
</div>
diff --cc resources/views/users/ldap.blade.php
index 57573315b2,aa200552be..f05a400362
--- a/resources/views/users/ldap.blade.php
+++ b/resources/views/users/ldap.blade.php
@@@ -27,13 -27,17 +27,21 @@@ LDAP User Syn
<div class="box-body">
<!-- location_id-->
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}">
- <!-- Location -->
+
+ <div class="col-xs-12">
+ <!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
+ <div class="col-md-4">
+ <button type="submit" class="btn btn-warning" id="sync">
+ <i id="sync-button-icon" class="fa fa-refresh icon-white" aria-hidden="true"></i> <span id="sync-button-text">Synchronize</span>
+ </button>
</div>
+ <div class="col-xs-12 text-center">
+ <button type="submit" class="btn btn-warning" id="sync">
+ <i id="sync-button-icon" class="fa fa-refresh icon-white"></i> <span id="sync-button-text">Synchronize</span>
+ </button>
+ </div>
+
</div>
</div>
</div>
diff --cc resources/views/users/print.blade.php
index 0d98829789,684a7b62f2..814f29ca72
--- a/resources/views/users/print.blade.php
+++ b/resources/views/users/print.blade.php
@@@ -190,24 -215,17 +215,25 @@@
@endphp
@foreach ($consumables as $consumable)
-
- <tr>
- <td>{{ $ccounter }}</td>
+ @if ($consumable)
+ <tr>
+ <td>{{ $ccounter }}</td>
+
+
+ <td>
+ @if ($consumable->deleted_at!='')
- <del>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</del>
+ <td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
+ @else
+ {{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}
+ @endif
+ </td>
- <td>{{ ($consumable->category) ? $consumable->category->name : '' }}</td>
- <td>{{ ($consumable->assetlog) ? $consumable->assetlog->first()->created_at : '' }}</td>
- </tr>
- @php
- $ccounter++
- @endphp
+ <td>{{ $consumable->category->name }}</td>
+ <td>{{ $consumable->assetlog->first()->created_at }}</td>
+ </tr>
+ @php
+ $ccounter++
+ @endphp
+ @endif
@endforeach
</table>
@endif
diff --cc resources/views/users/view.blade.php
index f4254b4934,cd8a70ae8f..f278eb7638
--- a/resources/views/users/view.blade.php
+++ b/resources/views/users/view.blade.php
@@@ -287,47 -277,44 +287,44 @@@
<div class="col-md-2">
@can('update', $user)
<div class="col-md-12">
- <a href="{{ route('users.edit', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.edit') }}</a>
+ <a href="{{ route('users.edit', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/users/general.edit') }}</a>
</div>
@endcan
-
+
@can('create', $user)
<div class="col-md-12" style="padding-top: 5px;">
- <a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.clone') }}</a>
+ <a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/users/general.clone') }}</a>
</div>
- @endcan
+ @endcan
- @can('view', $user)
+ @can('view', $user)
<div class="col-md-12" style="padding-top: 5px;">
- <a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.print_assigned') }}</a>
+ <a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener">{{ trans('admin/users/general.print_assigned') }}</a>
</div>
- @endcan
-
- @can('delete', $user)
- @if ($user->deleted_at=='')
- <div class="col-md-12" style="padding-top: 5px;">
- <form action="{{route('users.destroy',$user->id)}}" method="POST">
- {{csrf_field()}}
- {{ method_field("DELETE")}}
- <button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.delete')}}</button>
- </form>
- </div>
- <div class="col-md-12" style="padding-top: 5px;">
- <form action="{{ route('users/bulkedit') }}" method="POST">
- <!-- CSRF Token -->
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
- <input type="hidden" name="ids[{{ $user->id }}]" value="{{ $user->id }}" />
- <button style="width: 100%;" class="btn btn-sm btn-danger hidden-print">{{ trans('button.checkin_and_delete') }}</button>
- </form>
- </div>
- @else
- <div class="col-md-12" style="padding-top: 5px;">
- <a href="{{ route('restore/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</a>
- </div>
- @endif
- @endcan
-
-
+ @endcan
+ @can('delete', $user)
+ @if ($user->deleted_at=='')
+ <div class="col-md-12" style="padding-top: 5px;">
+ <form action="{{route('users.destroy',$user->id)}}" method="POST">
+ {{csrf_field()}}
+ {{ method_field("DELETE")}}
+ <button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.delete')}}</button>
+ </form>
+ </div>
+ <div class="col-md-12" style="padding-top: 5px;">
+ <form action="{{ route('users/bulkedit') }}" method="POST">
+ <!-- CSRF Token -->
+ <input type="hidden" name="_token" value="{{ csrf_token() }}" />
+ <input type="hidden" name="ids[{{ $user->id }}]" value="{{ $user->id }}" />
+ <button style="width: 100%;" class="btn btn-sm btn-danger hidden-print">{{ trans('button.checkin_and_delete') }}</button>
+ </form>
+ </div>
+ @else
+ <div class="col-md-12" style="padding-top: 5px;">
+ <a href="{{ route('restore/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</a>
+ </div>
+ @endif
+ @endcan
</div>
<!-- End button column -->
</div> <!--/.row-->
diff --cc routes/api.php
index 039723797b,fa2ce33f46..058c52bbb3
--- a/routes/api.php
+++ b/routes/api.php
@@@ -319,22 -348,22 +348,32 @@@ Route::group(['prefix' => 'v1','namespa
/*--- Hardware API ---*/
Route::group(['prefix' => 'hardware'], function () {
+
+ Route::get('{asset_id}/licenses', [
+ 'as' => 'api.assets.licenselist',
+ 'uses' => 'AssetsController@licenses'
+ ]);
+
+ Route::get( 'bytag/{tag}', [
+ 'as' => 'assets.show.bytag',
+ 'uses' => 'AssetsController@showByTag'
+ ]);
- Route::get( 'byserial/{serial}', [
- 'as' => 'assets.show.byserial',
- 'uses' => 'AssetsController@showBySerial'
- ]);
+ Route::get('bytag/{any}',
+ [
+ 'as' => 'api.assets.show.bytag',
+ 'uses' => 'AssetsController@showByTag'
+ ]
+ )->where('any', '.*');
+
+ Route::get('byserial/{any}',
+ [
+ 'as' => 'api.assets.show.byserial',
+ 'uses' => 'AssetsController@showBySerial'
+ ]
+ )->where('any', '.*');
+
Route::get( 'selectlist', [
'as' => 'assets.selectlist',
@@@ -746,7 -791,8 +801,8 @@@
]
);
+
- Route::get('{user}/accessories',
+ Route::get('{user}/licenses',
[
'as' => 'api.users.licenselist',
'uses' => 'UsersController@licenses'
diff --cc routes/web/hardware.php
index 0d192efa47,28476b4eec..ac02579005
--- a/routes/web/hardware.php
+++ b/routes/web/hardware.php
@@@ -57,24 -77,13 +77,24 @@@ Route::group
Route::post('history', [
'as' => 'asset.process-import-history',
- 'uses' => 'AssetsController@postImportHistory'
+ 'uses' => 'Assets\AssetsController@postImportHistory'
]);
- Route::get('/bytag', [
- 'as' => 'findbytag/hardware',
- 'uses' => 'Assets\AssetsController@getAssetByTag'
- ]);
+ Route::get('bytag/{any?}',
+ [
+ 'as' => 'findbytag/hardware',
+ 'uses' => 'AssetsController@getAssetByTag'
+ ]
+ )->where('any', '.*');
+
+ Route::get('byserial/{any?}',
+ [
+ 'as' => 'findbyserial/hardware',
+ 'uses' => 'AssetsController@getAssetBySerial'
+ ]
+ )->where('any', '.*');
+
+
Route::get('{assetId}/clone', [
'as' => 'clone/hardware',