Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-08-16 12:48:42 +01:00
commit 12dfe71ea8
18 changed files with 139 additions and 53 deletions

View file

@ -246,7 +246,7 @@ class PredefinedKitsController extends Controller
$relation = $kit->models();
if ($relation->find($model_id)) {
return response()->json(Helper::formatStandardApiResponse('error', null, ['model' => 'Model already attached to kit']));
return response()->json(Helper::formatStandardApiResponse('error', null, ['model' => trans('admin/kits/general.model_already_attached')]));
}
$relation->attach($model_id, ['quantity' => $quantity]);

View file

@ -62,10 +62,10 @@ class CheckoutKitController extends Controller
$checkout_result = $this->kitService->checkout($request, $kit, $user);
if (Arr::has($checkout_result, 'errors') && count($checkout_result['errors']) > 0) {
return redirect()->back()->with('error', trans('general.checkout_error'))->with('error_messages', $checkout_result['errors']);
return redirect()->back()->with('error', trans('admin/kits/general.checkout_error'))->with('error_messages', $checkout_result['errors']);
}
return redirect()->back()->with('success', trans('general.checkout_success'))
return redirect()->back()->with('success', trans('admin/kits/general.checkout_success'))
->with('assets', Arr::get($checkout_result, 'assets', null))
->with('accessories', Arr::get($checkout_result, 'accessories', null))
->with('consumables', Arr::get($checkout_result, 'consumables', null));

View file

@ -48,6 +48,7 @@ class Kernel extends HttpKernel
'api' => [
'auth:api',
\App\Http\Middleware\CheckLocale::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

View file

@ -86,7 +86,7 @@ class AssetsTransformer
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date, 'date'),
'deleted_at' => Helper::getFormattedDateObject($asset->deleted_at, 'datetime'),
'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'),
'age' => $asset->purchase_date ? $asset->purchase_date->diffForHumans() : '',
'age' => $asset->purchase_date ? $asset->purchase_date->locale(app()->getLocale())->diffForHumans() : '',
'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'),
'last_checkin' => Helper::getFormattedDateObject($asset->last_checkin, 'datetime'),
'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'),

View file

@ -1,7 +1,48 @@
#!/bin/sh
# Cribbed from nextcloud docker official repo
# https://github.com/nextcloud/docker/blob/master/docker-entrypoint.sh
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
if [ -n "${varValue}" ]; then
export "$var"="${varValue}"
elif [ -n "${fileVarValue}" ]; then
export "$var"="$(cat "${fileVarValue}")"
elif [ -n "${def}" ]; then
export "$var"="$def"
fi
unset "$fileVar"
}
# Add docker secrets support for the variables below:
file_env APP_KEY
file_env DB_HOST
file_env DB_PORT
file_env DB_DATABASE
file_env DB_USERNAME
file_env DB_PASSWORD
file_env REDIS_HOST
file_env REDIS_PASSWORD
file_env REDIS_PORT
file_env MAIL_HOST
file_env MAIL_PORT
file_env MAIL_USERNAME
file_env MAIL_PASSWORD
# fix key if needed
if [ -z "$APP_KEY" ]
if [ -z "$APP_KEY" -a -z "$APP_KEY_FILE" ]
then
echo "Please re-run this container with an environment variable \$APP_KEY"
echo "An example APP_KEY you could use is: "

View file

@ -1,7 +1,48 @@
#!/bin/bash
# Cribbed from nextcloud docker official repo
# https://github.com/nextcloud/docker/blob/master/docker-entrypoint.sh
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
if [ -n "${varValue}" ]; then
export "$var"="${varValue}"
elif [ -n "${fileVarValue}" ]; then
export "$var"="$(cat "${fileVarValue}")"
elif [ -n "${def}" ]; then
export "$var"="$def"
fi
unset "$fileVar"
}
# Add docker secrets support for the variables below:
file_env APP_KEY
file_env DB_HOST
file_env DB_PORT
file_env DB_DATABASE
file_env DB_USERNAME
file_env DB_PASSWORD
file_env REDIS_HOST
file_env REDIS_PASSWORD
file_env REDIS_PORT
file_env MAIL_HOST
file_env MAIL_PORT
file_env MAIL_USERNAME
file_env MAIL_PASSWORD
# fix key if needed
if [ -z "$APP_KEY" ]
if [ -z "$APP_KEY" -a -z "$APP_KEY_FILE" ]
then
echo "Please re-run this container with an environment variable \$APP_KEY"
echo "An example APP_KEY you could use is: "

View file

@ -845,18 +845,20 @@ th.css-location > .th-inner::before {
}
}
@media screen and (max-width: 1318px) and (min-width: 1200px){
.box{
.admin.box{
height:170px;
}
}
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@media screen and (max-width: 1494px) and (min-width: 1200px){
.dashboard.small-box{
white-space: nowrap;
text-overflow: ellipsis;
max-width: 188px;
display: block;
overflow: hidden;
}
}
/** Form-stuff overrides for checkboxes and stuff **/
label.form-control {

View file

@ -47,4 +47,5 @@ return [
'kit_deleted' => 'Kit was successfully deleted',
'kit_model_updated' => 'Model was successfully updated',
'kit_model_detached' => 'Model was successfully detached',
'model_already_attached' => 'Model already attached to kit',
];

View file

@ -426,7 +426,7 @@ return [
'assets_by_status_type' => 'Assets by Status Type',
'pie_chart_type' => 'Dashboard Pie Chart Type',
'hello_name' => 'Hello, :name!',
'unaccepted_profile_warning' => 'You have :count items requiring acceptance. Click here to accept or decline them',
'unaccepted_profile_warning' => 'You have one item requiring acceptance. Click here to accept or decline it | You have :count items requiring acceptance. Click here to accept or decline them',
'start_date' => 'Start Date',
'end_date' => 'End Date',
'alt_uploaded_image_thumbnail' => 'Uploaded thumbnail',
@ -559,5 +559,6 @@ return [
'expires' => 'Expires',
'map_fields'=> 'Map :item_type Field',
'remaining_var' => ':count Remaining',
'assets_in_var' => 'Assets in :name :type',
];

View file

@ -17,7 +17,7 @@
<strong>
<a href="{{ route('account.accept') }}" style="color: white;">
{{ trans('general.unaccepted_profile_warning', array('count' => $acceptances)) }}
{{ trans_choice('general.unaccepted_profile_warning', $acceptances, ['count' => $acceptances]) }}
</a>
</strong>
</div>

View file

@ -3,8 +3,7 @@
{{-- Page title --}}
@section('title')
{{ $category->name }}
{{ ucwords($category_type_route) }}
{{ trans('general.assets_in_var', ['name'=> $category->name, 'type' => trans('general.category')]) }}
@parent
@stop

View file

@ -31,7 +31,7 @@
<div class="col-lg-2 col-xs-6">
<a href="{{ route('hardware.index') }}">
<!-- small box -->
<div class="small-box bg-teal">
<div class="dashboard small-box bg-teal">
<div class="inner">
<h3>{{ number_format(\App\Models\Asset::AssetsForShow()->count()) }}</h3>
<p>{{ strtolower(trans('general.assets')) }}</p>
@ -49,7 +49,7 @@
<div class="col-lg-2 col-xs-6">
<a href="{{ route('licenses.index') }}">
<!-- small box -->
<div class="small-box bg-maroon">
<div class="dashboard small-box bg-maroon">
<div class="inner">
<h3>{{ number_format($counts['license']) }}</h3>
<p>{{ strtolower(trans('general.licenses')) }}</p>
@ -68,7 +68,7 @@
<div class="col-lg-2 col-xs-6">
<!-- small box -->
<a href="{{ route('accessories.index') }}">
<div class="small-box bg-orange">
<div class="dashboard small-box bg-orange">
<div class="inner">
<h3> {{ number_format($counts['accessory']) }}</h3>
<p>{{ strtolower(trans('general.accessories')) }}</p>
@ -87,7 +87,7 @@
<!-- small box -->
<a href="{{ route('consumables.index') }}">
<div class="small-box bg-purple">
<div class="dashboard small-box bg-purple">
<div class="inner">
<h3> {{ number_format($counts['consumable']) }}</h3>
<p>{{ strtolower(trans('general.consumables')) }}</p>
@ -104,7 +104,7 @@
<div class="col-lg-2 col-xs-6">
<a href="{{ route('components.index') }}">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="dashboard small-box bg-yellow">
<div class="inner">
<h3>{{ number_format($counts['component']) }}</h3>
<p>{{ strtolower(trans('general.components')) }}</p>
@ -122,7 +122,7 @@
<div class="col-lg-2 col-xs-6">
<a href="{{ route('users.index') }}">
<!-- small box -->
<div class="small-box bg-light-blue">
<div class="dashboard small-box bg-light-blue">
<div class="inner">
<h3>{{ number_format($counts['user']) }}</h3>
<p>{{ strtolower(trans('general.people')) }}</p>

View file

@ -132,7 +132,7 @@
:button_label="trans('general.checkin')"
:disabled_select="!$asset->model"
:options="[
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'assets']),
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.assets')]),
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset')]),
]"
/>

View file

@ -180,7 +180,7 @@
:button_label="trans('general.checkout')"
:disabled_select="!$asset->model"
:options="[
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'assets']),
'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.assets')]),
'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset')]),
'target' => trans('admin/hardware/form.redirect_to_checked_out_to'),

View file

@ -139,10 +139,6 @@
<div class="input-group col-md-2">
{{ Form::text('audit_warning_days', old('audit_warning_days', $setting->audit_warning_days), array('class' => 'form-control','placeholder' => '14', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
<span class="input-group-addon">{{ trans('general.days') }}</span>
</div>
<div class="col-md-9 col-md-offset-3">
{!! $errors->first('audit_warning_days', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}

View file

@ -57,7 +57,7 @@
<div class="list clearfix">
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.branding.index') }}" class="settings_button">
@ -74,7 +74,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.general.index') }}" class="settings_button">
@ -91,7 +91,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.security.index') }}" class="settings_button">
@ -107,7 +107,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('groups.index') }}" class="settings_button">
@ -124,7 +124,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.localization.index') }}" class="settings_button">
@ -142,7 +142,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.alerts.index') }}" class="settings_button">
@ -158,7 +158,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.slack.index') }}" class="settings_button">
@ -173,7 +173,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.asset_tags.index') }}" class="settings_button">
@ -188,7 +188,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.barcodes.index') }}" class="settings_button">
@ -203,7 +203,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.labels.index') }}" class="settings_button">
@ -219,7 +219,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.ldap.index') }}" class="settings_button">
@ -234,7 +234,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.google.index') }}" class="settings_button">
@ -249,7 +249,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.saml.index') }}" class="settings_button">
@ -264,7 +264,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.backups.index') }}" class="settings_button">
@ -280,7 +280,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.logins.index') }}" class="settings_button">
@ -295,7 +295,7 @@
</div>
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-default">
<div class="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.oauth.index') }}" class="settings_button">
@ -311,7 +311,7 @@
@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="admin box box-default">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.phpinfo.index') }}" class="settings_button">
@ -329,7 +329,7 @@
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
<div class="box box-danger">
<div class="admin box box-danger">
<div class="box-body text-center">
<h5>
<a href="{{ route('settings.purge.index') }}" class="link-danger">

View file

@ -2,7 +2,7 @@
{{-- Page title --}}
@section('title')
Attempted Logins
{{ trans('admin/settings/general.login') }}
@parent
@stop

View file

@ -373,7 +373,7 @@
</button>
</div>
<table style="margin-top: 80px;">
<table style="margin-top: 80px;" class="snipe-table">
<tr class="collapse" id="eula-row">
<td style="padding-right: 10px; vertical-align: top; font-weight: bold;">EULA</td>
<td style="padding-right: 10px; vertical-align: top; padding-bottom: 80px;" colspan="3">
@ -395,8 +395,8 @@
</tr>
<tr style="height: 80px;">
<td></td>
<td style="padding-right: 10px; vertical-align: top;">Name</td>
<td style="padding-right: 10px; vertical-align: top;">Signature</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.name') }}</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.signature') }}</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.date') }}</td>
</tr>
<tr>
@ -407,8 +407,8 @@
</tr>
<tr>
<td></td>
<td style="padding-right: 10px; vertical-align: top;">Name</td>
<td style="padding-right: 10px; vertical-align: top;">Signature</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.name') }}</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.signature') }}</td>
<td style="padding-right: 10px; vertical-align: top;">{{ trans('general.date') }}</td>
<td></td>
</tr>
@ -419,6 +419,10 @@
<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
<script src="{{ url(mix('js/dist/bootstrap-table.js')) }}"></script>
<script src="{{ url(mix('js/dist/bootstrap-table-locale-all.min.js')) }}"></script>
<!-- load english again here, even though it's in the all.js file, because if BS table doesn't have the translation, it otherwise defaults to chinese. See https://bootstrap-table.com/docs/api/table-options/#locale -->
<script src="{{ url(mix('js/dist/bootstrap-table-en-US.min.js')) }}"></script>
<script>
$('.snipe-table').bootstrapTable('destroy').each(function () {