Skip to content

Commit

Permalink
Merge pull request #15314 from Glukose1/features/add_setting_due_for_…
Browse files Browse the repository at this point in the history
…checkin_in_days

 Added #15312: Add checkin due in days setting
  • Loading branch information
snipe authored Aug 16, 2024
2 parents f917259 + d8df52c commit de29c1d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ public function postAlerts(Request $request) : RedirectResponse
$setting->alert_threshold = $request->input('alert_threshold');
$setting->audit_interval = $request->input('audit_interval');
$setting->audit_warning_days = $request->input('audit_warning_days');
$setting->due_checkin_days = $request->input('due_checkin_days');
$setting->show_alerts_in_menu = $request->input('show_alerts_in_menu', '0');

if ($setting->save()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ public function scopeDueOrOverdueForAudit($query, $settings)

public function scopeDueForCheckin($query, $settings)
{
$interval = $settings->audit_warning_days ?? 0;
$interval = $settings->due_checkin_days ?? 0;
$today = Carbon::now();
$interval_date = $today->copy()->addDays($interval)->format('Y-m-d');

Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en-US/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,7 @@
'default_avatar_help' => 'This image will be displayed as a profile if a user does not have a profile photo.',
'restore_default_avatar' => 'Restore <a href=":default_avatar" data-toggle="lightbox" data-type="image">original system default avatar</a>',
'restore_default_avatar_help' => '',
'due_checkin_days' => 'Due For Checkin Warning',
'due_checkin_days_help' => 'How many days before the expected checkin of an asset should it be listed in the "Due for checkin" page?',

];
2 changes: 1 addition & 1 deletion resources/views/hardware/checkin-due.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{-- Page title --}}
@section('title')
{{ trans_choice('general.checkin_due_days', $settings->audit_warning_days, ['days' => $settings->audit_warning_days]) }}
{{ trans_choice('general.checkin_due_days', $settings->due_checkin_days, ['days' => $settings->due_checkin_days]) }}
@stop

{{-- Page content --}}
Expand Down
19 changes: 19 additions & 0 deletions resources/views/settings/alerts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@
</div>
</div>

<!-- Due for checkin days -->
<div class="form-group {{ $errors->has('due_checkin_days') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('due_checkin_days', trans('admin/settings/general.due_checkin_days')) }}
</div>
<div class="input-group col-md-2">
{{ Form::text('due_checkin_days', old('due_checkin_days', $setting->due_checkin_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('due_checkin_days', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{{ trans('admin/settings/general.due_checkin_days_help') }}</p>
</div>
</div>

</div>

</div> <!--/.box-body-->
Expand Down

0 comments on commit de29c1d

Please sign in to comment.