Skip to content

Commit

Permalink
Added custom formatter for license seats (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Jan 11, 2018
1 parent bb52a84 commit bab0bda
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions resources/views/partials/bootstrap-table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,23 @@ function itemTypeFormatter(value, row) {
}
// We need a special formatter for license seats, since they don't work exactly the same
//
function licenseSeatInOutFormatter (value, row) {
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && (!row.assigned_to)) {
return '<a href="{{ url('/') }}/' + destination + '/' + row.next_seat + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
} else {
}
}
function genericCheckinCheckoutFormatter(destination) {
return function (value,row) {
// The user is allowed to check items out, AND the item is deployable
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && (!row.assigned_to)) {
// case for licenses
if (row.next_seat) {
return '<a href="{{ url('/') }}/' + destination + '/' + row.next_seat + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
} else {
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
}
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) {
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out">{{ trans('general.checkout') }}</a>';
// The user is allowed to check items out, but the item is not deployable
} else if (((row.user_can_checkout == false)) && (row.available_actions.checkout == true) && (!row.assigned_to)) {
Expand Down

0 comments on commit bab0bda

Please sign in to comment.