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

@ -33,90 +33,86 @@
$('.snipe-table').bootstrapTable('destroy').bootstrapTable({ $('.snipe-table').bootstrapTable('destroy').bootstrapTable({
classes: 'table table-responsive table-no-bordered', classes: 'table table-responsive table-no-bordered',
undefinedText: '', undefinedText: '',
iconsPrefix: 'fa', iconsPrefix: 'fa',
search: {{ (isset($search)) ? 'true' : 'false' }}, search: {{ (isset($search)) ? 'true' : 'false' }},
paginationVAlign: 'both', paginationVAlign: 'both',
sidePagination: '{{ (isset($clientSearch)) ? 'client' : 'server' }}', sidePagination: '{{ (isset($clientSearch)) ? 'client' : 'server' }}',
sortable: true, sortable: true,
pageSize: 20, pageSize: 20,
pagination: true, pagination: true,
cookie: true, cookie: true,
cookieExpire: '2y', cookieExpire: '2y',
cookieIdTable: '{{ Route::currentRouteName() }}', cookieIdTable: '{{ Route::currentRouteName() }}',
@if (isset($columns))
@if (!isset($simple_view)) columns: {!! $columns !!},
@endif
showRefresh: true, mobileResponsive: true,
showExport: true, maintainSelected: true,
stickyHeader: true, paginationFirstText: "{{ trans('general.first') }}",
stickyHeaderOffsetY: stickyHeaderOffsetY + 'px', paginationLastText: "{{ trans('general.last') }}",
paginationPreText: "{{ trans('general.previous') }}",
@if (isset($showFooter)) paginationNextText: "{{ trans('general.next') }}",
showFooter: true, formatLoadingMessage: function () {
@endif return '<h4><i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Loading... please wait.... </h4>';
showColumns: true,
trimOnSearch: false,
@if (isset($multiSort))
showMultiSort: true,
@endif
@if (isset($exportFile))
exportDataType: 'all',
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
exportOptions: {
fileName: '{{ $exportFile . "-" }}' + (new Date()).toISOString().slice(0,10),
ignoreColumn: ['actions','change','checkbox','checkincheckout','icon'],
worksheetName: "Snipe-IT Export",
jspdf: {
orientation: 'l',
autotable: {
styles: {
rowHeight: 20,
fontSize: 10,
overflow: 'linebreak',
},
headerStyles: {fillColor: 255, textColor: 0},
//alternateRowStyles: {fillColor: [60, 69, 79], textColor: 255}
}
}
}, },
@endif 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))
@endif showRefresh: true,
showExport: true,
stickyHeader: true,
stickyHeaderOffsetY: stickyHeaderOffsetY + 'px',
@if (isset($columns)) @if (isset($showFooter))
columns: {!! $columns !!}, showFooter: true,
@endif @endif
mobileResponsive: true, showColumns: true,
maintainSelected: true, trimOnSearch: false,
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'
}
}); @if (isset($multiSort))
showMultiSort: true,
@endif
@if (isset($exportFile))
exportDataType: 'all',
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
exportOptions: {
fileName: '{{ $exportFile . "-" }}' + (new Date()).toISOString().slice(0,10),
ignoreColumn: ['actions','change','checkbox','checkincheckout','icon'],
worksheetName: "Snipe-IT Export",
jspdf: {
orientation: 'l',
autotable: {
styles: {
rowHeight: 20,
fontSize: 10,
overflow: 'linebreak',
},
headerStyles: {fillColor: 255, textColor: 0},
//alternateRowStyles: {fillColor: [60, 69, 79], textColor: 255}
}
}
},
@endif
@endif
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 // We need a special formatter for license seats, since they don't work exactly the same
// // Checkouts need the license ID, checkins need the specific seat ID
function licenseSeatInOutFormatter(value, row) {
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 // The user is allowed to check items in
} else if (row.available_actions.checkin == true) { } else if (row.available_actions.checkin == true) {
if (row.assigned_to) { 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) { } 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>';
} }
} }