mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -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\Session;
|
||||
use App\Http\Requests\AssetCheckoutRequest;
|
||||
use App\Models\CustomField;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class BulkAssetsController extends Controller
|
||||
{
|
||||
|
@ -40,6 +42,16 @@ class BulkAssetsController extends Controller
|
|||
session(['bulk_back_url' => $bulk_back_url]);
|
||||
|
||||
$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')) {
|
||||
switch ($request->input('bulk_actions')) {
|
||||
|
@ -59,7 +71,8 @@ class BulkAssetsController extends Controller
|
|||
case 'edit':
|
||||
return view('hardware/bulk')
|
||||
->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-body">
|
||||
|
||||
|
||||
<!-- Purchase Date -->
|
||||
<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>
|
||||
|
@ -181,6 +183,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@foreach ($custom_fields as $key => $value)
|
||||
<p>
|
||||
<label>
|
||||
({{ $value->id }}) | {{ $value->name}} - {{ $value->format }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
|
||||
|
||||
|
||||
@foreach ($assets as $key => $value)
|
||||
<input type="hidden" name="ids[{{ $value }}]" value="1">
|
||||
@endforeach
|
||||
|
|
Loading…
Reference in a new issue