Skip to content

Commit

Permalink
Merge pull request #15396 from snipe/add_start_end_date_to_users_edit
Browse files Browse the repository at this point in the history
Added `start_date` and `end_date` to user bulk edit
  • Loading branch information
snipe authored Aug 27, 2024
2 parents d3e8e06 + 22bc088 commit 64c4433
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
13 changes: 11 additions & 2 deletions app/Http/Controllers/Users/BulkUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BulkUsersController extends Controller
* @author [A. Gianotto] [<[email protected]>]
* @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)
Expand Down Expand Up @@ -116,6 +116,8 @@ public function update(Request $request)
->conditionallyAddItem('remote')
->conditionallyAddItem('ldap_import')
->conditionallyAddItem('activated')
->conditionallyAddItem('start_date')
->conditionallyAddItem('end_date')
->conditionallyAddItem('autoassign_licenses');


Expand Down Expand Up @@ -146,7 +148,14 @@ public function update(Request $request)
$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');
}
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en-US/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
'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',
Expand Down
10 changes: 5 additions & 5 deletions resources/views/hardware/bulk.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
37 changes: 37 additions & 0 deletions resources/views/users/bulk-edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>


Expand Down

0 comments on commit 64c4433

Please sign in to comment.