From c605984db08d76622fb43f61d13ea282576eae85 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Oct 2017 19:21:53 -0700 Subject: [PATCH] =?UTF-8?q?Added=20nicer=20table=20formatting=20for=20?= =?UTF-8?q?=E2=80=9Cassets=20checked=20out=20to=20this=20user=E2=80=9D=20t?= =?UTF-8?q?able?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/hardware/checkout.blade.php | 43 ++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php index f7bb2998ab..d8e8ff6b3b 100755 --- a/resources/views/hardware/checkout.blade.php +++ b/resources/views/hardware/checkout.blade.php @@ -166,7 +166,7 @@ $(function() { $.ajax({ type: 'GET', - url: '{{url('/') }}/api/v1/users/' + userid + '/assets', + url: '{{ url('/') }}/api/v1/users/' + userid + '/assets', headers: { "X-Requested-With": 'XMLHttpRequest', "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') @@ -176,20 +176,45 @@ $(function() { success: function (data) { $('#current_assets_box').fadeIn(); - var table_html = '
'; + var table_html = '
'; + table_html += '
'; + table_html += '
{{ trans('admin/hardware/form.name') }}{{ trans('admin/hardware/form.tag') }}
'; + table_html += ''; + table_html += ''; + table_html += ''; + table_html += ''; + table_html += ''; + table_html += ''; $('#current_assets_content').append(''); - for (var i in data) { - var asset = data[i]; - table_html += ''; + if (asset.image != null) { + table_html += ''; + } else { + table_html += " "; + } + table_html += ''; + table_html += ''; + table_html += ''; + table_html += ""; } - table_html += ""; + } else { + table_html += ''; } - $('#current_assets_content').html(table_html + '
{{ trans('admin/hardware/form.name') }}{{ trans('admin/hardware/form.tag') }}{{ trans('admin/hardware/form.serial') }}
' + asset.name; - if (asset.model.name!='') { - table_html += " (" + asset.model.name + ")"; + if (data.rows.length > 0) { + for (var i in data.rows) { + var asset = data.rows[i]; + table_html += '
'; + + if ((asset.name == '') && (asset.name != null)) { + table_html += " " + asset.model.name; + } else { + table_html += asset.name; + table_html += " (" + asset.model.name + ")"; + } + + table_html += '' + asset.asset_tag + '' + asset.serial + '
" + asset.asset_tag + "
No assets checked out to '+ $('.js-data-user-ajax').find('option:selected').text() + ' yet!
'); },