mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-28 23:19:42 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
73ddc0f669
|
@ -55,7 +55,9 @@ class BulkAssetsController extends Controller
|
||||||
|
|
||||||
|
|
||||||
$asset_ids = $request->input('ids');
|
$asset_ids = $request->input('ids');
|
||||||
$assets = Asset::with('assignedTo', 'location', 'model')->find($asset_ids);
|
// Using the 'short-ternary' A/K/A "Elvis operator" '?:' here because ->input() might return an empty string
|
||||||
|
list($sortname,$sortdir) = explode(" ",$request->input('sort') ?: 'id ASC');
|
||||||
|
$assets = Asset::with('assignedTo', 'location', 'model')->whereIn('id', $asset_ids)->orderBy($sortname, $sortdir)->get();
|
||||||
|
|
||||||
$models = $assets->unique('model_id');
|
$models = $assets->unique('model_id');
|
||||||
$modelNames = [];
|
$modelNames = [];
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<form class="form-horizontal" method="post" action="" autocomplete="off">
|
<form class="form-horizontal" id="checkout_form" method="post" action="" autocomplete="off">
|
||||||
<!-- CSRF Token -->
|
<!-- CSRF Token -->
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||||
<button type="submit" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
<button type="submit" id="submit_button" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- .box.box-default -->
|
</div> <!-- .box.box-default -->
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<form class="form-horizontal" method="post" action="" autocomplete="off">
|
<form class="form-horizontal" id="checkout_form" method="post" action="" autocomplete="off">
|
||||||
<!-- CSRF Token -->
|
<!-- CSRF Token -->
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
</div> <!-- .BOX-BODY-->
|
</div> <!-- .BOX-BODY-->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||||
<button type="submit" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
<button type="submit" id="submit_button" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- .box-default-->
|
</div> <!-- .box-default-->
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
<form class="form-horizontal" method="post" action="" autocomplete="off">
|
<form class="form-horizontal" id="checkout_form" method="post" action="" autocomplete="off">
|
||||||
<!-- CSRF Token -->
|
<!-- CSRF Token -->
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
</div> <!-- .box-body -->
|
</div> <!-- .box-body -->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<a class="btn btn-link" href="{{ route('consumables.show', ['consumable'=> $consumable->id]) }}">{{ trans('button.cancel') }}</a>
|
<a class="btn btn-link" href="{{ route('consumables.show', ['consumable'=> $consumable->id]) }}">{{ trans('button.cancel') }}</a>
|
||||||
<button type="submit" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
<button type="submit" id="submit_button" class="btn btn-primary pull-right"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.checkout') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1012,6 +1012,14 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(this).ekkoLightbox();
|
$(this).ekkoLightbox();
|
||||||
});
|
});
|
||||||
|
//This prevents multi-click checkouts for accessories, components, consumables
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#checkout_form').submit(function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$('#submit_button').prop('disabled', true);
|
||||||
|
this.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
'id' => (isset($id_formname)) ? $id_formname : 'assetsBulkForm',
|
'id' => (isset($id_formname)) ? $id_formname : 'assetsBulkForm',
|
||||||
]) }}
|
]) }}
|
||||||
|
|
||||||
|
{{-- The 'id ASC' will only be used if the cookie is actually empty (like on first-use) --}}
|
||||||
|
<input name="sort" type="hidden" value="id ASC">
|
||||||
<label for="bulk_actions">
|
<label for="bulk_actions">
|
||||||
<span class="sr-only">
|
<span class="sr-only">
|
||||||
{{ trans('button.bulk_actions') }}
|
{{ trans('button.bulk_actions') }}
|
||||||
|
|
|
@ -161,6 +161,38 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Initialize sort-order for bulk actions (label-generation) for snipe-tables
|
||||||
|
$('.snipe-table').each(function (i, table) {
|
||||||
|
table_cookie_segment = $(table).data('cookie-id-table');
|
||||||
|
name = '';
|
||||||
|
direction = '';
|
||||||
|
cookies = document.cookie.split(";");
|
||||||
|
for(i in cookies) {
|
||||||
|
cookiedef = cookies[i].split("=", 2);
|
||||||
|
cookiedef[0] = cookiedef[0].trim();
|
||||||
|
if (cookiedef[0] == table_cookie_segment + ".bs.table.sortOrder") {
|
||||||
|
direction = cookiedef[1];
|
||||||
|
}
|
||||||
|
if (cookiedef[0] == table_cookie_segment + ".bs.table.sortName") {
|
||||||
|
name = cookiedef[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name && direction) {
|
||||||
|
domnode = $($(this).data('bulk-form-id')).get(0);
|
||||||
|
if ( domnode && domnode.elements && domnode.elements.sort ) {
|
||||||
|
domnode.elements.sort.value = name + " " + direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If sort order changes, update the sort-order for bulk-actions (for label-generation)
|
||||||
|
$('.snipe-table').on('sort.bs.table', function (event, name, order) {
|
||||||
|
domnode = $($(this).data('bulk-form-id')).get(0);
|
||||||
|
// make safe in case there isn't a bulk-form-id, or it's not found, or has no 'sort' element
|
||||||
|
if ( domnode && domnode.elements && domnode.elements.sort ) {
|
||||||
|
domnode.elements.sort.value = name + " " + order;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue