Refactored BS tables include for clearer separation of simple v not simple

This commit is contained in:
snipe 2018-01-10 20:34:36 -08:00
parent c6a956382f
commit c31362655c

View file

@ -45,7 +45,30 @@
cookie: true,
cookieExpire: '2y',
cookieIdTable: '{{ Route::currentRouteName() }}',
@if (isset($columns))
columns: {!! $columns !!},
@endif
mobileResponsive: true,
maintainSelected: true,
paginationFirstText: "{{ trans('general.first') }}",
paginationLastText: "{{ trans('general.last') }}",
paginationPreText: "{{ trans('general.previous') }}",
paginationNextText: "{{ trans('general.next') }}",
formatLoadingMessage: function () {
return '<h4><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Loading... please wait.... </h4>';
},
icons: {
advancedSearchIcon: 'fa fa-search-plus',
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
@if( isset($multiSort))
sort: 'fa fa-sort-amount-desc',
plus: 'fa fa-plus',
minus: 'fa fa-minus',
@endif
refresh: 'fa-refresh'
},
@if (!isset($simple_view))
showRefresh: true,
@ -86,35 +109,8 @@
}
},
@endif
@endif
@if (isset($columns))
columns: {!! $columns !!},
@endif
mobileResponsive: true,
maintainSelected: true,
paginationFirstText: "{{ trans('general.first') }}",
paginationLastText: "{{ trans('general.last') }}",
paginationPreText: "{{ trans('general.previous') }}",
paginationNextText: "{{ trans('general.next') }}",
formatLoadingMessage: function () {
return '<h4><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Loading... please wait.... </h4>';
},
pageList: ['20', '30','50','100','150','200'],
icons: {
advancedSearchIcon: 'fa fa-search-plus',
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
@if( isset($multiSort))
sort: 'fa fa-sort-amount-desc',
plus: 'fa fa-plus',
minus: 'fa fa-minus',
@endif
refresh: 'fa-refresh'
}
pageList: ['20', '30','50','100','150','200']
});
}
@ -282,9 +278,15 @@
// We need a special formatter for license seats, since they don't work exactly the same
//
function licenseSeatInOutFormatter(value, row) {
// Checkouts need the license ID, checkins need the specific seat ID
function licenseSeatInOutFormatter(value, row) {
// The user is allowed to check the license seat out and it's available
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) {
return '<a href="{{ url('/') }}/licenses/' + row.license_id + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out">{{ trans('general.checkout') }}</a>';
} else {
return '<a href="{{ url('/') }}/licenses/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check in this license seat.">{{ trans('general.checkin') }}</a>';
}
}
@ -302,9 +304,9 @@
// The user is allowed to check items in
} else if (row.available_actions.checkin == true) {
if (row.assigned_to) {
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
} else if (row.assigned_pivot_id) {
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.assigned_pivot_id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
return '<a href="{{ url('/') }}/' + destination + '/' + row.assigned_pivot_id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
}
}