Standardized model bulk blades a little more

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-04-03 18:54:46 -07:00
parent 146976975c
commit a861672146
2 changed files with 36 additions and 42 deletions

View file

@ -21,7 +21,7 @@
{{csrf_field()}}
<div class="box box-default">
<div class="box-header with-border">
<h2 class="box-title" style="color: red">{{ trans('admin/models/general.bulk_delete_warn', ['model_count' => $valid_count]) }}</h2>
<h2 class="box-title" style="color: red">{{ trans_choice('admin/models/general.bulk_delete_warn', $valid_count, ['model_count' => $valid_count]) }}</h2>
</div>
<div class="box-body">
@ -30,7 +30,7 @@
<tr>
<td class="col-md-1">
<label>
<input type="checkbox" class="all minimal" checked="checked">
<input type="checkbox" id="checkAll" checked="checked">
</label>
</td>
@ -42,7 +42,7 @@
@foreach ($models as $model)
<tr{!! (($model->assets_count > 0 ) ? ' class="danger"' : '') !!}>
<td>
<input type="checkbox" name="ids[]" class="minimal{{ (($model->assets_count == 0) ? '' : ' disabled') }}" value="{{ $model->id }}" {!! (($model->assets_count == 0) ? ' checked="checked"' : ' disabled') !!}>
<input type="checkbox" name="ids[]" class="{ (($model->assets_count == 0) ? '' : ' disabled') }}" value="{{ $model->id }}" {!! (($model->assets_count == 0) ? ' checked="checked"' : ' disabled') !!}>
</td>
<td>{{ $model->assets_count }}</td>
<td>{{ $model->name }}</td>
@ -65,28 +65,10 @@
@section('moar_scripts')
<script>
// Check-all / Uncheck all
$(function () {
var checkAll = $('input.all');
var checkboxes = $('input.minimal');
checkAll.on('ifChecked ifUnchecked', function(event) {
if (event.type == 'ifChecked') {
checkboxes.iCheck('check');
} else {
checkboxes.iCheck('uncheck');
}
});
checkboxes.on('ifChanged', function(event){
if(checkboxes.filter(':checked').length == checkboxes.length) {
checkAll.prop('checked', 'checked');
} else {
checkAll.removeProp('checked');
}
checkAll.iCheck('update');
});
$("#checkAll").change(function () {
$("input:checkbox").prop('checked', $(this).prop("checked"));
});
</script>
@stop

View file

@ -21,11 +21,14 @@
{{ csrf_field() }}
<div class="box box-default">
<div class="box-header with-border">
<div class="box-title"><i class="fas fa-exclamation-triangle"></i>{{ trans('general.bulk_edit_about_to') }}</div>
</div>
<div class="box-body">
<div class="callout callout-warning">
<i class="fas fa-exclamation-triangle"></i>
{{ trans_choice('admin/models/message.bulkedit.warn', count($models), ['model_count' => count($models)]) }}
</div>
<table class="table">
<tbody>
@foreach ($models as $model)
@ -33,7 +36,11 @@
<tr{!! (($model->assets_count > 0 ) ? ' class="warning"' : ' class="success"') !!}>
<td>
<i class="fa {!! (($model->assets_count > 0 ) ? 'fa-warning info' : 'fa-check success') !!}"></i>
{{ $model->display_name }} ({{ $model->model_number }})
{{ $model->display_name }}
@if ($model->model_number)
({{ $model->model_number }})
@endif
</td>
<td>{{ $model->assets_count }} assets
</td>
@ -73,20 +80,24 @@
</div>
<!-- requestable -->
<div class="form-group {{ $errors->has('requestable') ? 'has-error' : '' }}">
<div class="col-md-7 col-md-offset-3">
<div class="checkbox">
<label for="requestable" class="form-control">
{{ Form::radio('requestable', '', true, ['aria-label'=>'requestable']) }} {{ trans('admin/hardware/general.requestable_status_warning')}}<br>
{{ Form::radio('requestable', '1', old('requestable'), ['aria-label'=>'requestable']) }} {{ trans('admin/hardware/general.requestable')}} <br>
{{ Form::radio('requestable', '0', old('requestable'), ['aria-label'=>'requestable']) }} {{ trans('admin/hardware/general.not_requestable')}}
<div class="form-group{{ $errors->has('requestable') ? ' has-error' : '' }}">
<div class="col-md-7 col-md-offset-3">
<label for="requestable_nochange" class="form-control">
{{ Form::radio('requestable', '', true, ['id' => 'requestable_nochange', 'aria-label'=>'requestable_nochange']) }}
{{ trans('admin/hardware/general.requestable_status_warning')}}
</label>
<label for="requestable" class="form-control">
{{ Form::radio('requestable', '1', old('requestable'), ['id' => 'requestable', 'aria-label'=>'requestable']) }}
{{ trans('admin/hardware/general.requestable')}}
</label>
<label for="not_requestable" class="form-control">
{{ Form::radio('requestable', '0', old('requestable'), ['id' => 'not_requestable','aria-label'=>'not_requestable']) }}
{{ trans('admin/hardware/general.not_requestable')}}
</label>
</div>
</div>
</div>
</div>
@foreach ($models as $model)
@ -95,9 +106,10 @@
</div>
</div> <!--/.box-body-->
<div class="text-right box-footer">
<button type="submit" class="btn btn-success"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
</div>
<div class="box-footer text-right">
<a class="btn btn-link pull-left" href="{{ URL::previous() }}" method="post" enctype="multipart/form-data">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success" id="submit-button"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.update') }}</button>
</div><!-- /.box-footer -->
</div> <!--/.box.box-default-->
</form>
</div> <!--/.col-md-8-->