mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Nicer UI for history importer
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
8cd0a90ecd
commit
a184b4e67c
|
@ -737,11 +737,11 @@ class AssetsController extends Controller
|
|||
|
||||
if ($isCheckinHeaderExplicit) {
|
||||
|
||||
//if checkin date header exists, assume that empty or future date is still checked out
|
||||
//if checkin is before todays date, assume it's checked in and do not assign user ID, if checkin date is in the future or blank, this is the expected checkin date, items is checked out
|
||||
// if checkin date header exists, assume that empty or future date is still checked out
|
||||
// if checkin is before today's date, assume it's checked in and do not assign user ID, if checkin date is in the future or blank, this is the expected checkin date, items are checked out
|
||||
|
||||
if ((strtotime($checkin_date) > strtotime(Carbon::now())) || (empty($checkin_date))
|
||||
) {
|
||||
if ((strtotime($checkin_date) > strtotime(Carbon::now())) || (empty($checkin_date)))
|
||||
{
|
||||
//only do this if item is checked out
|
||||
$asset->assigned_to = $user->id;
|
||||
$asset->assigned_type = User::class;
|
||||
|
|
|
@ -27,20 +27,13 @@ return [
|
|||
'undeployable_tooltip' => 'This asset has a status label that is undeployable and cannot be checked out at this time.',
|
||||
'view' => 'View Asset',
|
||||
'csv_error' => 'You have an error in your CSV file:',
|
||||
'import_text' => '
|
||||
<p>
|
||||
Upload a CSV that contains asset history. The assets and users MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag. We will try to find a matching user based on the user\'s name you provide, and the criteria you select below. If you do not select any criteria below, it will simply try to match on the username format you configured in the Admin > General Settings.
|
||||
</p>
|
||||
|
||||
<p>Fields included in the CSV must match the headers: <strong>Asset Tag, Name, Checkout Date, Checkin Date</strong>. Any additional fields will be ignored. </p>
|
||||
|
||||
<p>Checkin Date: blank or future checkin dates will checkout items to associated user. Excluding the Checkin Date column will create a checkin date with todays date.</p>
|
||||
'import_text' => '<p>Upload a CSV that contains asset history. The assets and users MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag. We will try to find a matching user based on the user\'s name you provide, and the criteria you select below. If you do not select any criteria below, it will simply try to match on the username format you configured in the <code>Admin > General Settings</code>.</p><p>Fields included in the CSV must match the headers: <strong>Asset Tag, Name, Checkout Date, Checkin Date</strong>. Any additional fields will be ignored. </p><p>Checkin Date: blank or future checkin dates will checkout items to associated user. Excluding the Checkin Date column will create a checkin date with todays date.</p>
|
||||
',
|
||||
'csv_import_match_f-l' => 'Try to match users by firstname.lastname (jane.smith) format',
|
||||
'csv_import_match_initial_last' => 'Try to match users by first initial last name (jsmith) format',
|
||||
'csv_import_match_first' => 'Try to match users by first name (jane) format',
|
||||
'csv_import_match_email' => 'Try to match users by email as username',
|
||||
'csv_import_match_username' => 'Try to match users by username',
|
||||
'csv_import_match_f-l' => 'Try to match users by <strong>firstname.lastname</strong> (<code>jane.smith</code>) format',
|
||||
'csv_import_match_initial_last' => 'Try to match users by <strong>first initial last name</strong> (<code>jsmith</code>) format',
|
||||
'csv_import_match_first' => 'Try to match users by <strong>first name</strong> (<code>jane</code>) format',
|
||||
'csv_import_match_email' => 'Try to match users by <strong>email</strong> as username',
|
||||
'csv_import_match_username' => 'Try to match users by <strong>username</strong>',
|
||||
'error_messages' => 'Error messages:',
|
||||
'success_messages' => 'Success messages:',
|
||||
'alert_details' => 'Please see below for details.',
|
||||
|
|
|
@ -44,179 +44,188 @@
|
|||
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<div class="col-md-12">
|
||||
<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" action="">
|
||||
<!-- CSRF Token -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" action="">
|
||||
<!-- CSRF Token -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
||||
|
||||
@if (Session::get('message'))
|
||||
<p class="alert-danger">
|
||||
{{ trans('admin/hardware/general.csv_error') }}<br />
|
||||
{{ Session::get('message') }}
|
||||
</p>
|
||||
@endif
|
||||
|
||||
{!! trans('admin/hardware/general.import_text') !!}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="first_name" class="col-sm-3 control-label">{{ trans('admin/users/general.usercsv') }}</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="file" name="user_import_csv" id="user_import_csv"{{ (config('app.lock_passwords')===true) ? ' disabled' : '' }}>
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
@if (Session::get('message'))
|
||||
<p class="alert-danger">
|
||||
{{ trans('admin/hardware/general.csv_error') }}<br />
|
||||
{{ Session::get('message') }}
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-12" style="padding: 10px;">
|
||||
{!! trans('admin/hardware/general.import_text') !!}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" style="padding: 10px;">
|
||||
<div class="form-group">
|
||||
<div class="col-md-9 col-md-offset-2">
|
||||
|
||||
<label class="btn btn-default" aria-hidden="true">
|
||||
{{ trans('button.select_file') }}
|
||||
<input type="file" name="user_import_csv" class="js-uploadFile" id="uploadFile" data-maxsize="user_import_csv" accept=".csv,.xls,.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/plain" style="display:none; max-width: 90%" aria-label="user_import_csv" aria-hidden="true"{{ (config('app.lock_passwords')===true) ? ' disabled' : ''}}>
|
||||
</label>
|
||||
<span class="label label-default" id="uploadFile-info" style="font-size: 15px;"></span>
|
||||
|
||||
|
||||
<!-- Match firstname.lastname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('match_firstnamelastname', '1', Request::old('match_firstnamelastname')) }} {{ trans('admin/hardware/general.csv_import_match_f-l') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match flastname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('match_flastname', '1', Request::old('match_flastname')) }} {{ trans('admin/hardware/general.csv_import_match_initial_last') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match firstname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('match_firstname', '1', Request::old('match_firstname')) }} {{ trans('admin/hardware/general.csv_import_match_first') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match email -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('match_email', '1', Request::old('match_email')) }} {{ trans('admin/hardware/general.csv_import_match_email') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match username -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('match_username', '1', Request::old('match_username')) }} {{ trans('admin/hardware/general.csv_import_match_username') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="box-footer text-right">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<div class="col-md-12">
|
||||
<div class="callout callout-info">
|
||||
{{ trans('general.feature_disabled') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
<button type="submit" class="btn btn-default">{{ trans('button.submit') }}</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@if (isset($status))
|
||||
|
||||
|
||||
@if (count($status['error']) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title"> {{ count($status['error']) }} {{ trans('admin/hardware/general.error_messages') }} </h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div style="height : 400px; overflow : auto;">
|
||||
<table class="table">
|
||||
@for ($x = 0; $x < count($status['error']); $x++)
|
||||
@foreach($status['error'][$x] as $object_type => $message)
|
||||
<tr class="danger">
|
||||
<td><strong>{{ ucwords($object_type) }} {{ key($message) }}:</strong></td>
|
||||
<td>{{ $message[key($message)]['msg'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endfor
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
@if (count($status['success']) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title"> {{ count($status['success']) }} {{ trans('admin/hardware/general.success_messages') }} </h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div style="height : 400px; overflow : auto;">
|
||||
<table class="table">
|
||||
@for ($x = 0; $x < count($status['success']); $x++)
|
||||
@foreach($status['success'][$x] as $object_type => $message)
|
||||
<tr class="success">
|
||||
<td><strong>{{ ucwords($object_type) }} {{ key($message) }}:</strong></td>
|
||||
<td>{{ $message[key($message)]['msg'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endfor
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<p class="text-warning"><i class="fas fa-lock"></i>
|
||||
{{ trans('general.feature_disabled') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div></div></div>
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
$(document).ready(function(){
|
||||
<div class="col-md-12">
|
||||
<!-- Match firstname.lastname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-offset-2">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('match_firstnamelastname', '1', Request::old('match_firstnamelastname')) }}
|
||||
<!-- enclosing span needed for the checkbox CSS to work properly, since there's HTML in the label text -->
|
||||
<span>
|
||||
{!! trans('admin/hardware/general.csv_import_match_f-l') !!}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
$('#generate-password').pGenerator({
|
||||
'bind': 'click',
|
||||
'passwordElement': '#password',
|
||||
'displayElement': '#password-display',
|
||||
'passwordLength': 10,
|
||||
'uppercase': true,
|
||||
'lowercase': true,
|
||||
'numbers': true,
|
||||
'specialChars': false,
|
||||
<!-- Match flastname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-offset-2">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('match_flastname', '1', Request::old('match_flastname')) }}
|
||||
<!-- enclosing span needed for the checkbox CSS to work properly, since there's HTML in the label text -->
|
||||
<span>
|
||||
{!! trans('admin/hardware/general.csv_import_match_initial_last') !!}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
});
|
||||
});
|
||||
<!-- Match firstname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-offset-2">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('match_firstname', '1', Request::old('match_firstname')) }}
|
||||
<!-- enclosing span needed for the checkbox CSS to work properly, since there's HTML in the label text -->
|
||||
<span>
|
||||
{!! trans('admin/hardware/general.csv_import_match_first') !!}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match email -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-offset-2">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('match_email', '1', Request::old('match_email')) }}
|
||||
<!-- enclosing span needed for the checkbox CSS to work properly, since there's HTML in the label text -->
|
||||
<span>
|
||||
{!! trans('admin/hardware/general.csv_import_match_email') !!}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match username -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-offset-2">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('match_username', '1', Request::old('match_username')) }}
|
||||
<!-- enclosing span needed for the checkbox CSS to work properly, since there's HTML in the label text -->
|
||||
<span>
|
||||
{!! trans('admin/hardware/general.csv_import_match_username') !!}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="box-footer text-right">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<div class="col-md-12">
|
||||
<div class="callout callout-info">
|
||||
{{ trans('general.feature_disabled') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
<button type="submit" class="btn btn-default">{{ trans('button.submit') }}</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@if (isset($status))
|
||||
|
||||
|
||||
@if (count($status['error']) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title"> {{ count($status['error']) }} {{ trans('admin/hardware/general.error_messages') }} </h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div style="height : 400px; overflow : auto;">
|
||||
<table class="table">
|
||||
@for ($x = 0; $x < count($status['error']); $x++)
|
||||
@foreach($status['error'][$x] as $object_type => $message)
|
||||
<tr class="danger">
|
||||
<td><strong>{{ ucwords($object_type) }} {{ key($message) }}:</strong></td>
|
||||
<td>{{ $message[key($message)]['msg'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endfor
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
@if (count($status['success']) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title"> {{ count($status['success']) }} {{ trans('admin/hardware/general.success_messages') }} </h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div style="height : 400px; overflow : auto;">
|
||||
<table class="table">
|
||||
@for ($x = 0; $x < count($status['success']); $x++)
|
||||
@foreach($status['success'][$x] as $object_type => $message)
|
||||
<tr class="success">
|
||||
<td><strong>{{ ucwords($object_type) }} {{ key($message) }}:</strong></td>
|
||||
<td>{{ $message[key($message)]['msg'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endfor
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue