Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
642a09f139
4 changed files with 76 additions and 206 deletions
|
@ -30,7 +30,7 @@ class UserFactory extends Factory
|
||||||
'locale' => 'en',
|
'locale' => 'en',
|
||||||
'notes' => 'Created by DB seeder',
|
'notes' => 'Created by DB seeder',
|
||||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||||
'permissions' => '{"user":"0"}',
|
'permissions' => '{}',
|
||||||
'phone' => $this->faker->phoneNumber(),
|
'phone' => $this->faker->phoneNumber(),
|
||||||
'state' => $this->faker->stateAbbr(),
|
'state' => $this->faker->stateAbbr(),
|
||||||
'username' => $this->faker->username(),
|
'username' => $this->faker->username(),
|
||||||
|
@ -81,11 +81,7 @@ class UserFactory extends Factory
|
||||||
|
|
||||||
public function superuser()
|
public function superuser()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['superuser' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"superuser":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function admin()
|
public function admin()
|
||||||
|
@ -102,342 +98,204 @@ class UserFactory extends Factory
|
||||||
|
|
||||||
public function viewAssets()
|
public function viewAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createAssets()
|
public function createAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editAssets()
|
public function editAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAssets()
|
public function deleteAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkinAssets()
|
public function checkinAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.checkin' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.checkin":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkoutAssets()
|
public function checkoutAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.checkout' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.checkout":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewRequestableAssets()
|
public function viewRequestableAssets()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['assets.view.requestable' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"assets.view.requestable":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewAccessories()
|
public function viewAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createAccessories()
|
public function createAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editAccessories()
|
public function editAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAccessories()
|
public function deleteAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkinAccessories()
|
public function checkinAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.checkin' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.checkin":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkoutAccessories()
|
public function checkoutAccessories()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['accessories.checkout' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"accessories.checkout":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewConsumables()
|
public function viewConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createConsumables()
|
public function createConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editConsumables()
|
public function editConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteConsumables()
|
public function deleteConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkinConsumables()
|
public function checkinConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.checkin' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.checkin":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkoutConsumables()
|
public function checkoutConsumables()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['consumables.checkout' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"consumables.checkout":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewDepartments()
|
public function viewDepartments()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['departments.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"departments.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewLicenses()
|
public function viewLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createLicenses()
|
public function createLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editLicenses()
|
public function editLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteLicenses()
|
public function deleteLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkoutLicenses()
|
public function checkoutLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.checkout' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.checkout":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewKeysLicenses()
|
public function viewKeysLicenses()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['licenses.keys' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"licenses.keys":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewComponents()
|
public function viewComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createComponents()
|
public function createComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editComponents()
|
public function editComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteComponents()
|
public function deleteComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkinComponents()
|
public function checkinComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.checkin' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.checkin":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkoutComponents()
|
public function checkoutComponents()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['components.checkout' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"components.checkout":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewUsers()
|
public function viewUsers()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['users.view' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"users.view":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createUsers()
|
public function createUsers()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['users.create' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"users.create":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editUsers()
|
public function editUsers()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['users.edit' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"users.edit":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteUsers()
|
public function deleteUsers()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['users.delete' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"users.delete":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canEditOwnLocation()
|
public function canEditOwnLocation()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['self.edit_location' => '1']);
|
||||||
return [
|
|
||||||
'permissions' => '{"self.edit_location":"1"}',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canViewReports()
|
public function canViewReports()
|
||||||
{
|
{
|
||||||
return $this->state(function () {
|
return $this->appendPermission(['reports.view' => '1']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function appendPermission(array $permission)
|
||||||
|
{
|
||||||
|
return $this->state(function ($currentState) use ($permission) {
|
||||||
return [
|
return [
|
||||||
'permissions' => '{"reports.view":"1"}',
|
'permissions' => json_encode(
|
||||||
|
array_merge(
|
||||||
|
json_decode($currentState['permissions'], true),
|
||||||
|
$permission
|
||||||
|
)
|
||||||
|
),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,9 @@ Form::macro('date_display_format', function ($name = 'date_display_format', $sel
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($formats as $format) {
|
foreach ($formats as $format) {
|
||||||
$date_display_formats[$format] = Carbon::parse(date('Y').'-'.date('m').'-25')->format($format);
|
$date_display_formats[$format] = Carbon::parse(date('Y-m-d'))->format($format);
|
||||||
}
|
}
|
||||||
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:250px" aria-label="'.$name.'">';
|
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:100%" aria-label="'.$name.'">';
|
||||||
foreach ($date_display_formats as $format => $date_display_format) {
|
foreach ($date_display_formats as $format => $date_display_format) {
|
||||||
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'">'.$date_display_format.'</option> ';
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'">'.$date_display_format.'</option> ';
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-11 col-md-offset-1">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<!-- Language -->
|
<!-- Language -->
|
||||||
<div class="form-group {{ $errors->has('site_name') ? 'error' : '' }}">
|
<div class="form-group {{ $errors->has('site_name') ? 'error' : '' }}">
|
||||||
|
@ -52,18 +52,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Date format -->
|
<!-- Date format -->
|
||||||
<div class="form-group {{ $errors->has('time_display_format') ? 'error' : '' }}">
|
<div class="form-group {{ $errors->has('time_display_format') ? 'error' : '' }}">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{{ Form::label('time_display_format', trans('general.time_and_date_display')) }}
|
{{ Form::label('time_display_format', trans('general.time_and_date_display')) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-5">
|
||||||
{!! Form::date_display_format('date_display_format', Request::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', Request::old('time_display_format', $setting->time_display_format), 'select2') !!}
|
|
||||||
|
|
||||||
{!! $errors->first('time_display_format', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
{!! Form::time_display_format('time_display_format', Request::old('time_display_format', $setting->time_display_format), 'select2') !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!! $errors->first('time_display_format', '<div class="col-md-9 col-md-offset-3"><span class="alert-msg" aria-hidden="true">:message</span> </div>') !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Currency -->
|
<!-- Currency -->
|
||||||
|
|
|
@ -111,25 +111,34 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusLabelTypeFormatter (row, value) {
|
function statusLabelTypeFormatter (row, value) {
|
||||||
|
|
||||||
switch (value.type) {
|
switch (value.type) {
|
||||||
case 'deployed':
|
|
||||||
text_color = 'blue';
|
|
||||||
icon_style = 'fa-circle';
|
|
||||||
break;
|
|
||||||
case 'deployable':
|
case 'deployable':
|
||||||
text_color = 'green';
|
text_color = 'green';
|
||||||
icon_style = 'fa-circle';
|
icon_style = 'fa-circle';
|
||||||
|
trans = '{{ strtolower(trans('admin/hardware/general.deployable')) }}';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'pending':
|
case 'pending':
|
||||||
text_color = 'orange';
|
text_color = 'orange';
|
||||||
icon_style = 'fa-circle';
|
icon_style = 'fa-circle';
|
||||||
|
trans = '{{ strtolower(trans('general.pending')) }}';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'undeployable':
|
||||||
|
text_color = 'red';
|
||||||
|
icon_style = 'fa-circle';
|
||||||
|
trans ='{{ trans('admin/statuslabels/table.undeployable') }}';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
text_color = 'red';
|
text_color = 'red';
|
||||||
icon_style = 'fa-times';
|
icon_style = 'fa-times';
|
||||||
|
trans = '{{ strtolower(trans('general.archived')) }}';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var typename_lower = value.type;
|
var typename_lower = trans;
|
||||||
var typename = typename_lower.charAt(0).toUpperCase() + typename_lower.slice(1);
|
var typename = typename_lower.charAt(0).toUpperCase() + typename_lower.slice(1);
|
||||||
return '<i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + typename;
|
return '<i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + typename;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue