Added checkbox for preferences

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-07 20:49:07 +01:00
parent 8fe6395287
commit a99ec062e6
4 changed files with 18 additions and 0 deletions

View file

@ -49,6 +49,7 @@ class ProfileController extends Controller
$user->gravatar = $request->input('gravatar');
$user->skin = $request->input('skin');
$user->phone = $request->input('phone');
$user->enable_sounds = $request->input('enable_sounds');
if (! config('app.lock_passwords')) {
$user->locale = $request->input('locale', 'en-US');

View file

@ -12,4 +12,5 @@ return array(
'api_reference' => 'Please check the <a href="https://snipe-it.readme.io/reference" target="_blank">API reference</a> to find specific API endpoints and additional API documentation.',
'profile_updated' => 'Account successfully updated',
'no_tokens' => 'You have not created any personal access tokens.',
'enable_sounds' => 'Enable sound effects',
);

View file

@ -89,6 +89,15 @@
</div>
</div>
<div class="form-group{{ $errors->has('enable_sounds') ? ' has-error' : '' }}">
<div class="col-md-9 col-md-offset-3">
<label for="enable_sounds" class="form-control">
<input type="checkbox" name="enable_sounds" value="1" {{ old('enable_sounds', $user->enable_sounds) ? 'checked' : '' }}>
{{ trans('account/general.enable_sounds') }}
</label>
</div>
</div>
<!-- Gravatar Email -->
<div class="form-group {{ $errors->has('gravatar') ? ' has-error' : '' }}">
<label for="gravatar" class="col-md-3 control-label">{{ trans('general.gravatar_email') }}
@ -152,6 +161,7 @@
@endif
</div> <!-- .box-body -->
<div class="text-right box-footer">
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>

View file

@ -154,8 +154,12 @@
success : function (data) {
if (data.status == 'success') {
$('#audited tbody').prepend("<tr class='success'><td>" + data.payload.asset_tag + "</td><td>" + data.messages + "</td><td><i class='fas fa-check text-success' style='font-size:18px;'></i></td></tr>");
@if ($user->enable_sounds)
var audio = new Audio('/sounds/success.mp3');
audio.play()
@endif
incrementOnSuccess();
} else {
handleAuditFail(data);
@ -175,8 +179,10 @@
});
function handleAuditFail (data) {
@if ($user->enable_sounds)
var audio = new Audio('/sounds/error.mp3');
audio.play()
@endif
if (data.asset_tag) {
var asset_tag = data.asset_tag;
} else {