Added start_date and end_date to user bulk edit

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-27 07:21:19 +01:00
parent d3e8e06638
commit 22bc088f6f
4 changed files with 54 additions and 8 deletions

View file

@ -30,7 +30,7 @@ class BulkUsersController extends Controller
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.7]
* @param Request $request
* @return \Illuminate\Contracts\View\View
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function edit(Request $request)
@ -116,6 +116,8 @@ class BulkUsersController extends Controller
->conditionallyAddItem('remote')
->conditionallyAddItem('ldap_import')
->conditionallyAddItem('activated')
->conditionallyAddItem('start_date')
->conditionallyAddItem('end_date')
->conditionallyAddItem('autoassign_licenses');
@ -146,7 +148,14 @@ class BulkUsersController extends Controller
$this->update_array['company_id'] = null;
}
if ($request->input('null_start_date')=='1') {
$this->update_array['start_date'] = null;
}
if ($request->input('null_end_date')=='1') {
$this->update_array['end_date'] = null;
}
if (! $manager_conflict) {
$this->conditionallyAddItem('manager_id');
}

View file

@ -419,7 +419,7 @@ return [
'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.',
'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.',
'bulk_checkin_success' => 'The items for the selected users have been checked in.',
'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ',
'set_to_null' => 'Delete values for this selection|Delete values for all :selection_count selections ',
'set_users_field_to_null' => 'Delete :field values for this user|Delete :field values for all :user_count users ',
'na_no_purchase_date' => 'N/A - No purchase date provided',
'assets_by_status' => 'Assets by Status',

View file

@ -48,7 +48,7 @@
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_name', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }}
{{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label>
</div>
</div>
@ -67,11 +67,11 @@
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_purchase_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets),['asset_count' => count($assets)]) }}
{{ trans_choice('general.set_to_null', count($assets),['selection_count' => count($assets)]) }}
</label>
</div>
</div>
<!-- Expected Checkin Date -->
<div class="form-group {{ $errors->has('expected_checkin') ? ' has-error' : '' }}">
<label for="expected_checkin" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label>
@ -86,7 +86,7 @@
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_expected_checkin_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }}
{{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label>
</div>
</div>
@ -189,7 +189,7 @@
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_next_audit_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }}
{{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label>
</div>
<div class="col-md-8 col-md-offset-3">

View file

@ -218,6 +218,43 @@
</div> <!--/controls-->
@endif
</div> <!--/col-md-5-->
</div>
<!-- Start Date -->
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">{{ trans('general.start_date') }}</label>
<div class="col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.start_date') }}" name="start_date" id="start_date" value="{{ old('start_date') }}">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('start_date', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}
</div>
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_start_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($users),['selection_count' => count($users)]) }}
</label>
</div>
</div>
<!-- End Date -->
<div class="form-group {{ $errors->has('end_date') ? ' has-error' : '' }}">
<label for="end_date" class="col-md-3 control-label">{{ trans('general.end_date') }}</label>
<div class="col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.end_date') }}" name="end_date" id="end_date" value="{{ old('end_date') }}">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('end_date', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}
</div>
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_end_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($users),['selection_count' => count($users)]) }}
</label>
</div>
</div>