mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-12 16:44:08 -08:00
initial fetch working
This commit is contained in:
parent
e03a961bcc
commit
804a788a27
|
@ -13,6 +13,8 @@ use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use App\Http\Requests\AssetCheckoutRequest;
|
use App\Http\Requests\AssetCheckoutRequest;
|
||||||
|
use App\Models\CustomField;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class BulkAssetsController extends Controller
|
class BulkAssetsController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -41,6 +43,16 @@ class BulkAssetsController extends Controller
|
||||||
|
|
||||||
$asset_ids = array_values(array_unique($request->input('ids')));
|
$asset_ids = array_values(array_unique($request->input('ids')));
|
||||||
|
|
||||||
|
//custom fields logic for bulk edit
|
||||||
|
$asset_custom_field = Asset::whereIn('id', $asset_ids)->whereHas('model', function ($query) {
|
||||||
|
return $query->where('fieldset_id', '!=', null);
|
||||||
|
})->get();
|
||||||
|
$custom_fields = new Collection();
|
||||||
|
foreach ($asset_custom_field as $asset_key => $asset) {
|
||||||
|
$custom_fields->push($asset->model->fieldset->fields);
|
||||||
|
}
|
||||||
|
$custom_fields = $custom_fields->flatten()->unique('id');
|
||||||
|
|
||||||
if ($request->filled('bulk_actions')) {
|
if ($request->filled('bulk_actions')) {
|
||||||
switch ($request->input('bulk_actions')) {
|
switch ($request->input('bulk_actions')) {
|
||||||
case 'labels':
|
case 'labels':
|
||||||
|
@ -59,7 +71,8 @@ class BulkAssetsController extends Controller
|
||||||
case 'edit':
|
case 'edit':
|
||||||
return view('hardware/bulk')
|
return view('hardware/bulk')
|
||||||
->with('assets', $asset_ids)
|
->with('assets', $asset_ids)
|
||||||
->with('statuslabel_list', Helper::statusLabelList());
|
->with('statuslabel_list', Helper::statusLabelList())
|
||||||
|
->with('custom_fields', $custom_fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
<div class="box box-default">
|
<div class="box box-default">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
|
|
||||||
<!-- Purchase Date -->
|
<!-- Purchase Date -->
|
||||||
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
|
||||||
<label for="purchase_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.date') }}</label>
|
<label for="purchase_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.date') }}</label>
|
||||||
|
@ -181,6 +183,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@foreach ($custom_fields as $key => $value)
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
({{ $value->id }}) | {{ $value->name}} - {{ $value->format }}
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@foreach ($assets as $key => $value)
|
@foreach ($assets as $key => $value)
|
||||||
<input type="hidden" name="ids[{{ $value }}]" value="1">
|
<input type="hidden" name="ids[{{ $value }}]" value="1">
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
Loading…
Reference in a new issue