Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/lang/en-US/admin/users/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'bulk_update_warn' => 'You are about to edit the properties of :user_count users. Please note that you cannot change your own user attributes using this form, and must make edits to your own user individually.',
'bulk_update_help' => 'This form allows you to update multiple users at once. Only fill in the fields you need to change. Any fields left blank will remain unchanged.',
'current_assets' => 'Assets currently checked out to this user',
'current_items' => ':item currently checked out to this user',
'clone' => 'Clone User',
'contact_user' => 'Contact :name',
'edit' => 'Edit User',
Expand Down
19 changes: 17 additions & 2 deletions resources/views/licenses/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@section('content')
<div class="row">
<!-- left column -->
<div class="col-md-8">
<div class="col-md-7">
<form class="form-horizontal" method="post" action="" autocomplete="off">
{{csrf_field()}}

Expand Down Expand Up @@ -115,6 +115,21 @@
</div> <!-- /.box-->
</form>
</div> <!-- /.col-md-7-->
<!-- right column -->
<div class="col-md-5" id="current_license_box" style="display:none;">
<div class="box box-primary">
<div class="box-header with-border">
<h2 class="box-title">{{ trans('admin/users/general.current_items', ['item' => trans('general.licenses')]) }}</h2>
</div>
<div class="box-body">
<div id="current_license_content">
</div>
</div>
</div>
</div>
</div>

@stop

@section('moar_scripts')
@include('partials.licenses-assigned')
@endsection
68 changes: 68 additions & 0 deletions resources/views/partials/licenses-assigned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<script nonce="{{ csrf_token() }}">
let canViewKeys = @json(Gate::check('viewKeys', $license));
// create the assigned licenses listing box for the right side of the screen
$(function() {
$('#assigned_user').on("change",function () {
var userid = $('#assigned_user option:selected').val();

if(userid=='') {
console.warn('no user selected');
$('#current_license_box').fadeOut();
$('#current_license_content').html("");
} else {

$.ajax({
type: 'GET',
url: '{{ config('app.url') }}/api/v1/users/' + userid + '/licenses',
headers: {
"X-Requested-With": 'XMLHttpRequest',
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},

dataType: 'json',
success: function (data) {
$('#current_license_box').fadeIn();

var table_html = '<div class="row">';
table_html += '<div class="col-md-12">';
table_html += '<table class="table table-striped">';
table_html += '<thead><tr>';
table_html += '<th>{{ trans('admin/licenses/form.name') }}</th>';
table_html += '<th>{{ trans('admin/licenses/form.license_key') }}</th>';
table_html += '</tr></thead><tbody>';

$('#current_license_content').append('');

if (data.rows.length > 0) {

for (var i in data.rows) {
var license = data.rows[i];
table_html += '<tr>';
table_html += '<td><a href="{{ config('app.url') }}/licenses/' + license.id + '">';

if ((license.name == '') && (license.name != null)) {
table_html += " " + license.name;
} else {
table_html += license.name;
}
table_html += '</a></td>';
if (canViewKeys) {
table_html += '<td class="col-md-4">' + license.product_key + '</td>';
}
table_html += "</tr>";
}
} else {
table_html += '<tr><td colspan="4">{{ trans('admin/users/message.user_has_no_assets_assigned') }}</td></tr>';
}
$('#current_license_content').html(table_html + '</tbody></table></div></div>');

},
error: function (data) {
$('#current_license_box').fadeOut();
}
});
}
});
});
</script>
<?php
Loading